>Here's the twist.  My current code is a multi-line segment.  Something like

>Cost = Qty * UnitCost
>Tax_Cost = (Cost * Tax_Rate/100)
>SubTotal = Cost + Tax
>Overhead_Cost = SubTotal * (Overhead_Rate/100)
>Markup_Cost = (SubTotal + Overhead_Cost) * (Markup_Rate/100)
>Total_Cost = SubTotal + Overhead_Cost + Markup_Cost

>The reason they're all multi-line is because they're each stored to show 
>the calcs on screen and in a report.

I don't really see the issue.  There's no real limit on the number of things 
you can use a macro substitution with.

Let me see if I understand what you're saying.  What you want to see on screen 
is something like this?  (Please forgive formatting, my E-mail client isn't 
being particularly helpful at the moment.)

Quantity: <Qty>
Base Cost: <UnitCost>
Tax Rate: <Tax_Rate>%
Overhead Rate: <Overhead_Rate>%
Markup Rate: <Markup_Rate>%

Extended Cost (Quantity * Base Cost): <Cost>
Total Taxes (Extended Cost * Tax Rate): <Tax_Cost>
Subtotal (Extended Cost + Total Taxes): <SubTotal>

Overhead Cost (Subtotal * Overhead Rate): <Overhead_Cost>
Total with Overhead (SubTotal + Overhead Cost): <OverTotal>

Markup Cost (Total with Overhead * Markup Rate): <Markup_Cost>

Grand Total (Subtotal + Overhead Cost + Markup Cost): <Total_Cost>


You're going to have at least two tables.  The first table, transactions, 
contains at least four fields: an index key (to let you figure out which client 
it is), a transaction ID, the quantity and base cost.  The tax, overhead, and 
markup rates MIGHT be here as well -- it depends on whether these numbers are 
set on a client or a transaction basis.  I'm more inclined to think that this 
will be client-based, though if you have multiple locations or other 
situations, you can set up a separate client information table for that.

Then the matter is the text you need to output for each calculation and each 
calculation itself.  Well, for each one that changes.  To keep it as wide as 
possible, you can use indexes by client and event number to go from.  Something 
like this:

CLIENT_ID C(10)
EVENT_ID  N(2,0)
CALC_DISP M(4)
CALC_CALC M(4)

You might even include a fifth field, CALC_MASK that contains the display mask 
for the result of CALC_CALC

Then your records would be something like this:

CLIENT_ID: A000000001
EVENT_ID: 1
CALC_DISP: Extended Cost (Quantity * Base Cost)
CALC_CALC: Qty * UnitCost

CLIENT_ID: A000000001
EVENT_ID: 2
CALC_DISP: Total Taxes (Extended Cost * Tax Rate)
CALC_CALC: (Cost * Tax_Rate/100)



And so on and so forth.  Make sure your "calculation" database is indexed on 
both CLIENT_ID and EVENT_ID so it displays in the proper order, but then it's a 
simple DO WHILE loop to display CALC_DISP and the results of CALC_CALC.  Note 
that I don't think macro substitution works on fields directly, so you'll have 
to draw it into an intermediary memory variable, but other than that, it would 
seem to work just fine.  And if you have more than 100 potential "operations" 
(though I can't imagine you would), just expand EVENT_ID to N(3,0).

Unless I've got this complete bass-ackwards?


Joel

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to