0

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();     
}   
}
}
Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50
  • On first glance, your code seems to be correct. But CoC does work, the standard application also has two extension classes for FreeTextInvoiceDP, one of which extends the same methods you do. Did you do a model compile or just a compile in the solution/project? – FH-Inway Oct 05 '21 at 15:17
  • Hi, thanks for comment. I have done a build model with DB synchro – Aitor Ramos Pajares Oct 07 '21 at 08:08

0 Answers0