keithm2008
Programmer
- Feb 27, 2009
- 9
CR2008 & btrieve(Peachtree)
I am producing a report that shows A/R amount, billing amount and calculating a % from those values, grouped by customer. A/R amount comes from main report using customers and jrnlhdr tables. Billing amount comes from a subreport using customers and ticket tables. Subreport is linked using customerId. Reports are produced in a given date range and that range is passed to the subreport as well. I have a shared variable VarBillAmt defined in both reports - to be used in my formula for calculating Percent of billing. The main report shows the correct values for both A/R Amount and billing amount, but when I use the values in a formula (@Pct of Billing) the results are way off. I've included some the report below for reference.
FYI - i have tried simplifying by adding the values and still get similar unexpected results.
Hope this lines up correctly...
section customerId A/R Billing Ticket Amount % Billing
GH1a Allison
GH1b
D Allison 950.00
D Allison 1,100.00
D Allison 1,100.00
GF1a Allison 3,500.00 6,100.00 <-from subreport
GF1b 24.18 <- @VarBillAmt; should be .52
@VarBillAmt is in GF1b; if I put it in GF1a i get a divide by 0 error.
Formulas with some comments added for some(?) clarity:
@Pct of Billing
local numbervar PctBilling;
PctBilling := (Sum ({JrnlHdr.MainAmount}))/{@VarBillAmt}
//3,500.00 = (Sum ({JrnlHdr.MainAmount}))
//6,100.00 = @VarBillAmt
@VarBillAmt
shared numbervar VarBillAmt;
//variable from subreport
@Reset VarBillAmt
whileprintingrecords;
shared numbervar VarBillAmt := 0;
//used in GH1A
I am producing a report that shows A/R amount, billing amount and calculating a % from those values, grouped by customer. A/R amount comes from main report using customers and jrnlhdr tables. Billing amount comes from a subreport using customers and ticket tables. Subreport is linked using customerId. Reports are produced in a given date range and that range is passed to the subreport as well. I have a shared variable VarBillAmt defined in both reports - to be used in my formula for calculating Percent of billing. The main report shows the correct values for both A/R Amount and billing amount, but when I use the values in a formula (@Pct of Billing) the results are way off. I've included some the report below for reference.
FYI - i have tried simplifying by adding the values and still get similar unexpected results.
Hope this lines up correctly...
section customerId A/R Billing Ticket Amount % Billing
GH1a Allison
GH1b
D Allison 950.00
D Allison 1,100.00
D Allison 1,100.00
GF1a Allison 3,500.00 6,100.00 <-from subreport
GF1b 24.18 <- @VarBillAmt; should be .52
@VarBillAmt is in GF1b; if I put it in GF1a i get a divide by 0 error.
Formulas with some comments added for some(?) clarity:
@Pct of Billing
local numbervar PctBilling;
PctBilling := (Sum ({JrnlHdr.MainAmount}))/{@VarBillAmt}
//3,500.00 = (Sum ({JrnlHdr.MainAmount}))
//6,100.00 = @VarBillAmt
@VarBillAmt
shared numbervar VarBillAmt;
//variable from subreport
@Reset VarBillAmt
whileprintingrecords;
shared numbervar VarBillAmt := 0;
//used in GH1A