Steve-vfp9user
Programmer
Hi all
I have a report that lists invoices. I can choose whether I want to show "paid", "unpaid" or "all".
A field in my table called INVOICEPYN is a character field C(1) which either stores a "Y" for paid or "N" for unpaid.
Examples:
In the footer of the report I have a numeric field called TOTAL which has a calculation type: Sum
All this works ok however, if I create the report for "all" invoices, the TOTAL adds up all the invoices whether they are paid or not.
Question: What do I need to do to differentiate between "paid" and "unpaid" so the sum total only adds up the "paid" invoices with the condition INVOICEPYN="Y" and ignores the total of the "unpaid" invoices with the condition INVOICEPYN="N" when I produce a report for "all" invoices.
In other words, invoices:
123 - paid - 150.00
124 - paid - 200.00
125 - unpaid - 150.00
Total of paid reports would be 350.00
I hope the above makes sense!
Thank you
Steve Williams
VFP9, SP2, Windows 10
I have a report that lists invoices. I can choose whether I want to show "paid", "unpaid" or "all".
A field in my table called INVOICEPYN is a character field C(1) which either stores a "Y" for paid or "N" for unpaid.
Examples:
Code:
* Invoices "paid"
cPrinter=GETPRINTER()
IF NOT EMPTY(cPrinter)
SET PRINTER TO NAME(cPrinter)
REPORT FORM STATEMENTREPORTDENT NOCONSOLE TO PRINTER FOR INVOICEPYN="Y"
cPrinter=""
SET PRINTER TO DEFAULT
ENDIF
* Invoices "unpaid"
cPrinter=GETPRINTER()
IF NOT EMPTY(cPrinter)
SET PRINTER TO NAME(cPrinter)
REPORT FORM STATEMENTREPORTDENT NOCONSOLE TO PRINTER FOR INVOICEPYN="N"
cPrinter=""
SET PRINTER TO DEFAULT
ENDIF
* Invoices "all"
cPrinter=GETPRINTER()
IF NOT EMPTY(cPrinter)
SET PRINTER TO NAME(cPrinter)
REPORT FORM STATEMENTREPORTDENT NOCONSOLE TO PRINTER
cPrinter=""
SET PRINTER TO DEFAULT
ENDIF
In the footer of the report I have a numeric field called TOTAL which has a calculation type: Sum
All this works ok however, if I create the report for "all" invoices, the TOTAL adds up all the invoices whether they are paid or not.
Question: What do I need to do to differentiate between "paid" and "unpaid" so the sum total only adds up the "paid" invoices with the condition INVOICEPYN="Y" and ignores the total of the "unpaid" invoices with the condition INVOICEPYN="N" when I produce a report for "all" invoices.
In other words, invoices:
123 - paid - 150.00
124 - paid - 200.00
125 - unpaid - 150.00
Total of paid reports would be 350.00
I hope the above makes sense!
Thank you
Steve Williams
VFP9, SP2, Windows 10