I am trying to extend FreeTextInvoiceDP to add new fields to the report, I have created a chain of command, but when I run it the process does not go through the extension. I have debug it and effectively the extension doesn't work, is there anything that I have forgotten?
my extension:
[ExtensionOf(classStr(FreeTextInvoiceDP))]
final class FreeTextInvoiceDP_Cls_ARQ_CONCCo_Extension
{
protected void populateFreeTextInvoiceHeaderFooterTmp(CustInvoiceJour _custInvoiceJour,
CompanyInfo _companyInfo)
{
CustInvoiceTable custInvoiceTable;
CustInvoiceTrans custInvoiceTrans;
CustTable custTable;
TaxTrans taxTrans;
next populateFreeTextInvoiceHeaderFooterTmp(_custInvoiceJour, _companyInfo);
custInvoiceTable = _custInvoiceJour.custInvoiceTable();
custTable = CustTable::find(_custInvoiceJour.OrderAccount);
freeTextInvoiceHeaderFooterTmp.ARQ_CONCCo_InvoiceId = custInvoiceTable.InvoiceId;
freeTextInvoiceHeaderFooterTmp.ARQ_CONCCo_InvoiceDate = custInvoiceTable.InvoiceDate;
freeTextInvoiceHeaderFooterTmp.ARQ_CONCCo_DueDate = custInvoiceTable.DueDate;
freeTextInvoiceHeaderFooterTmp.ARQ_CONCCo_Currency = custInvoiceTable.CurrencyCode;
freeTextInvoiceHeaderFooterTmp.ARQ_CONCCo_Address = DirParty::primaryPostalAddress(custTable.party).address;
freeTextInvoiceHeaderFooterTmp.ARQ_CONCCo_VatNum = custInvoiceTable.VatNum;
freeTextInvoiceHeaderFooterTmp.ARQ_CONCCo_CustName = custInvoiceTable.Name;
freeTextInvoiceHeaderFooterTmp.ARQ_CONCCo_CompanyLogo = CompanyImage::FindByRecord(CompanyInfo::find()).Image;
}
protected void populateFreeTextInvoiceTmp(CustInvoiceJour _custInvoiceJour, CustInvoiceTrans _custInvoiceTrans, TaxSpec _taxSpec, CustPaymSchedLine _custPaymSchedLine, CustTrans _prepaymentCustTrans, TaxTrans _prepaymentTaxTrans)
{
TaxTrans taxTrans;
next populateFreeTextInvoiceTmp(_custInvoiceJour, _custInvoiceTrans, _taxSpec, _custPaymSchedLine, _prepaymentCustTrans, _prepaymentTaxTrans);
select firstonly taxTrans
where taxTrans.SourceRecId == _custInvoiceTrans.RecId
&& taxTrans.SourceTableId == _custInvoiceTrans.TableId;
freeTextInvoiceTmp.ARQ_CONCCo_TaxCode = taxTrans.TaxCode;
}
protected void insertIntoFreeTextInvoiceHeaderFooterTmp(CustInvoiceJour _custInvoiceJour, CompanyInfo _companyInfo)
{
TaxTrans taxTrans;
CustInvoiceTrans custInvoiceTrans;
next insertIntoFreeTextInvoiceHeaderFooterTmp(_custInvoiceJour, _companyInfo);
while select custInvoiceTrans
where custInvoiceTrans.InvoiceId == _custInvoiceJour.InvoiceId
join sum(TaxBaseAmount), sum(TaxAmount), taxcode, taxvalue from taxTrans
group by taxTrans.TaxCode, taxtrans.taxvalue
where taxTrans.SourceRecId == custinvoicetrans.recid
&& taxtrans.sourcetableid == custinvoicetrans.tableid
{
FreeTextInvoiceLocalizationTmp.caption = taxtrans.taxcode;
FreeTextInvoiceLocalizationTmp.cashdisc = taxtrans.taxvalue;
FreeTextInvoiceLocalizationTmp.cashdiscamount = taxtrans.taxbaseamount * -1;
FreeTextInvoiceLocalizationTmp.discamount = taxtrans.taxamount * -1;
freeTextInvoiceLocalizationTmp.insert();
freeTextInvoiceLocalizationTmp.clear();
}
}
}