Home » U++ Library support » RichText,QTF,RTF... » Documentation / more info
|
Re: Documentation / more info [message #55015 is a reply to message #55014] |
Mon, 05 October 2020 02:05   |
jimlef
Messages: 90 Registered: September 2020 Location: US
|
Member |
|
|
I've managed to answer some of my own questions by going to the source... here's some sample code:
sqlTaxReport.AddColumn(INVOICENUMBER, "Inv NO.", 100);
sqlTaxReport.AddColumn(DATEPAID, "Date Paid", 200).SetConvert(DateIntConvert());
sqlTaxReport.AddColumn(CUSTOMERID, "Cust. No.", 65); // OR CUSTNAME, IF NOT ANON
sqlTaxReport.AddColumn(CUSTNAME, "Customer Name", 140).HeaderTab().Show(false);
sqlTaxReport.AddColumn(TAXABLESUB, "Taxable", 80).SetConvert(ConvDouble()).SetDisplay(StdRightDisplay()).HeaderTab().AlignRight();
sqlTaxReport.AddColumn(NONTAXABLESUB, "Non-Taxable", 80).SetConvert(ConvDouble()).SetDisplay(StdRightDisplay()).HeaderTab().AlignRight();
sqlTaxReport.AddColumn(TAX, "Sales Tax", 80).SetConvert(ConvDouble()).SetDisplay(StdRightDisplay()).HeaderTab().AlignRight();
sqlTaxReport.AddColumn(GRANDTOTAL, "Total", 80).SetConvert(ConvDouble()).SetDisplay(StdRightDisplay()).HeaderTab().AlignRight();
sqlTaxReport.AddColumn(COST, "My Parts Cost", 80).SetConvert(ConvDouble()).SetDisplay(StdRightDisplay()).HeaderTab().AlignRight(); // PARTS COST FOR THIS INVOICE
.
.
.
void TaxWindow::CreateReport()
{
if (sqlTaxReport.GetCount() > 0) {
// QtfReport(sqlTaxReport.AsQtf());
Report report;
report.Landscape().Header("TaxReport");
report.SetStdFont(SansSerifZ(12));
report << sqlTaxReport.AsQtf();
Perform(report);
}
}
Successfully sets landscape mode, and creates a header that is shown on each page ("TaxReport").
SetStdFont doesn't seem to be doing anything? Of course I'm guessing as to it's field ...
Still looking for a way to set column alignment. (Was hoping sqlArray would send that info through in QTF).
|
|
|
Re: Documentation / more info [message #55017 is a reply to message #55014] |
Mon, 05 October 2020 06:04   |
jimlef
Messages: 90 Registered: September 2020 Location: US
|
Member |
|
|
Well, I have usable reports printing with my test data, I'll attach a sample pdf here.
Still haven't found a way to override font size though LOL
Jim
void TaxWindow::CreateReport(String start, String end)
{
if ( sqlTaxReport.GetCount() > 0 )
{
double sumTaxable = 0.0, sumNontaxable = 0.0, sumTax = 0.0, sumTotal = 0.0, sumParts = 0.0;
String headertext;
int strt, ending;
String s = ::Format(Date( 1970, 1, 1) + StrInt(start));
String e = ::Format(Date( 1970, 1, 1) + StrInt(end));
headertext << "Tax Report " << s << " to " << e;
for ( int i = 0; i < sqlTaxReport.GetCount(); i++ )
{
sumTaxable += ( double ) sqlTaxReport.Get ( i, TAXABLESUB );
sumNontaxable += ( double ) sqlTaxReport.Get ( i, NONTAXABLESUB );
sumTax += ( double ) sqlTaxReport.Get ( i, TAX );
sumTotal += ( double ) sqlTaxReport.Get ( i, GRANDTOTAL );
sumParts += (IsNull(sqlTaxReport.Get ( i, COST ))) ? 0.0 : ( double ) sqlTaxReport.Get ( i, COST );
}
if (anon.Get() == 1)
taxQTF = "{{148:297:96:0:119:118:119:119:119 [C2 :: Totals:: :: :: ";
else taxQTF = "{{135:270:0:189:108:108:108:108:109 [C2 :: Totals:: :: :: ";
taxQTF << DblStr(sumTaxable) << ":: " << DblStr(sumNontaxable) << ":: " << DblStr(sumTax) <<
":: " << DblStr(sumParts) <<":: " << DblStr(sumTotal) << "}}";
Report report;
report.SetStdFont ( SansSerif( 12 ) );
report.Landscape().Header ( headertext ).Footer ( "Page $$P" );
report << sqlTaxReport.AsQtf() << taxQTF;
Perform ( report );
}
}
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Mon May 12 01:00:32 CEST 2025
Total time taken to generate the page: 0.01134 seconds
|