× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I'm sure you can do some complex logics that can interpret tax formula
from table using RPG.  However, I wonder if this can be easily achieved
thru dynamic SQL.  

Example:

File Layout:
TAXFORMULA (Contains all different type of tax formula):
TFState  2  chars
TFCounty        25 chars
TFTax1     255 chars
TFTax2     255 chars            

TAXDEPENON (Dummy Temp File):
TDState  2   chars
TDCounty        25   chars
TDPrice  7,2 pack
TDQty           10,0 pack


Example data:
TAXFORMULA:
TFState="MS", TFCounty="RANKIN", TFTax1="TDPrice*TDQty*.02",
TFTax2="TDPrice*TDQty*.0006" 


Create a dup object of TAXDEPENON in QTEMP and insert the info into this
QTEMP file.  Dynamically create a sql to join this file with TAXFORMULA.

"Select " + TFTax1 + "as tax1Amt" + TFTax2 + "as tax2Amt " +
" from qtemp/TAXDEPENON join TAXFORMULA on TDState=TFState and
TDCounty=TFCounty "


Note: I've never done this before.  Above example probably have a lot of
syntax errors but hopefully you got the idea.

 

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
ewart.desouza@xxxxxxxxxxx
Sent: Tuesday, March 13, 2007 11:10 PM
To: RPG programming on the AS400 / iSeries
Subject: Dynamic formulae calculation in RPG

Hello All,

We have a complicated Invoice calculation process where a lot local
taxes are to be considered. In order to make these calculations dynamic
I plan to do the calculations using dynamic formulas so that any future
changes can be considered.

Eg:

Description             Name            Formula         Value
Base value              Base            Qty * price             1000
Tax1 20% of base        Tax1            Base * .02              20
Tax2 30% of Tax1        Tax2            Tax1 * .03              0.6
Total                   Total           Base + Tax1 + Tax2      1020.6


Has anyone built something like that & can share the code - I can save
some time.

Thanks & best regards
Ewart

This e-mail is confidential and it is intended only for the addressees. 
Any review, dissemination, distribution, or copying of this message by
persons or entities other than the intended recipient is prohibited. If
you have received this e-mail in error, kindly notify us immediately by
telephone or e-mail and delete the message from your system. The sender
does not accept liability for any errors or omissions in the contents of
this message which may arise as a result of the e-mail transmission.
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.