Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Subtotals and totals
Message
 
À
12/07/2006 11:39:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Versions des environnements
Visual FoxPro:
VFP 6
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01135680
Message ID:
01135738
Vues:
15
Can you send me the report and a simple cursor for it?

>Rather than trying to fix what I've apparently done wrong, can someone just tell me how to do it correctly from the start?
>
>Here are some of the fields in my cursor:
>
>order_no, qty, price, frt
>
>Here are a few sample records for order #100:
>
>100, 10, 1.23, 50
>100, 20, 2.00, 50
>100, 10, 1.50, 50
>
>As you can see, "frt" is in each record, but is the total freight for the order.
>
>My invoices show all three detail lines:
>
>QTY 10, $1.23/ea $12.30
>QTY 20, $2.00/ea $40.00
>QTY 10, $1.50/ea $15.00
>
>Then the subtotals look like this:
>
>SUB: $ 67.30
>FRT: 50.00
>TOT: $217.30
>
>The FRT is showing correctly as $50, but is adding $50 three times (once for each detail line).
>
>Suggestions for changes to my form?
>
>Thanks!
>
>
>>oops...never mind. Original reply misunderstood the problem
>>
>>
>>>frt_chg is a field from the cursor. Each line of the cursor contains this field, and the value is the same in each line (in this example, $100).
>>>
>>>The value is appearing correctly on the form (showing $100), but when I calculate my grand totals, it's adding once for each detail line.
>>>
>>>
>>>>frt_chg? What is it? A field from your cursor or report variable? If this is a field from your cursor what is the value in it for each record? If it is the total value for the group that just porint the value, do not put any calculations on it.
>>>>(I suspect that you have 100 in frt_chg in both records, that's why you get 600 as Grand total)
>>>>
>>>>>Hi all,
>>>>>
>>>>>If I had any hair, I'd be pulling it out over this one.
>>>>>
>>>>>On my Invoice form, I have the following fields:
>>>>>
>>>>>(in the Detail band)
>>>>>qty_select unit_price qty_select*unit_price (for the extended line total)
>>>>>
>>>>>In the Group Footer band, I have the extended line total summed. It's perfectly fine. I also have three other fields there:
>>>>>
>>>>>misc_chg
>>>>>sales_tax
>>>>>frt_chg
>>>>>
>>>>>And a fourth field that adds those three fields to the subtotal for a grand invoice total.
>>>>>
>>>>>The problem: it doesn't just add the above three fields one time. It adds them one time for each line of detail on the invoice. For example, for an invoice with two detail lines, I get this:
>>>>>
>>>>>Sub : $400
>>>>>Misc: 0
>>>>>Tax : 0
>>>>>Frt : 100
>>>>>Tot : $600
>>>>>
>>>>>If I display the misc_chg, sales_tax and frt_chg fields on the form for testing purposes, they're correct (just $100 for frt). But why is it adding those lines once for each line of detail, even though it's displaying correctly on the form? I want to add my subtotal, then each of the other three displayed items (misc, tax, frt) to get my grand total.
>>>>>
>>>>>This oughta be simple. In fact, it probably is. But I'm just not seeing it.
>>>>>
>>>>>Thanks!
>>>>>
>>>>>John
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform