Minggu, 11 Oktober 2020

Get value VendTransOpen.Duedate and update LedgerJournalLines.Due with VendTransOpen.Duedate

Classes CustVendOpenTransManager
Classes VendOpenTransform

Jadi kita akan melakukan custom pada modul AP-Journal payment. terutama pada VendTransOpen.Duedate.

Skenario :
pada saat user memilih Open Settlement (VendTransOpen form), value VendTransOpen.duedate dapat dikopi dan masukan ke table LedgerjournalTrans.Due.

Caranya adalah.
custom class CustVendOpenTransManager.updateOriginatorForMarkedTrans

LedgerJournalTrans ledgerJournalTrans;
    BankThirdPartyAccountId firstVendBank;
    SalesTable salesTable;
    PurchTable purchTable;
    NoYes autoSettlement;

    // <GIN>
    LedgerJournalType           ledgerJournalType;
    TaxWithholdAuthorities_IN   taxWithholdAuthorities;
    // </GIN>

    // <GEEU>
    CustInvoiceJour custInvoiceJour;
    CustInvoiceJour_RU custInvoiceJourRU;
    // </GEEU>

    DueDate         duedateAP;//Add husna 20201011

    if (specTransManager.getSpecTransCount() > 0)
    {
        // If transactions were marked, write data back to the originating record.
        switch(originator.TableId)
        {
            case tableNum(LedgerJournalTrans):
                ledgerJournalTrans = originator;
                duedateAP = vendOpenTransForm.getDuedatesettlement();//add husna 20201011
                ledgerJournalTrans.Due = duedateAP;//add husna 20201011

lalu
di class VendOpenTransform buat sebuah method getDuedatesettlement()
public DueDate getDuedatesettlement()
{
    DueDate             duedatesettlement;
    SpecTrans               specTrans;

    if (!diffVendBankExist)
    {
        select firstOnly RecId, RefTableId, RefCompany, RefRecId from specTrans
            where specTrans.SpecRecId == originator.RecId;

        duedatesettlement = specTrans.vendTransOpen().DueDate;
    }

    return duedatesettlement;
}

Erorr CS1963 - An expression tree may not contain a dynamic operation.

Kali ini saya mendapatkan erorr dengan code CS1963, padahal sebelumnya saya sudah mendefinisikan 'var item in Model' di @foreach(var...