VendInvoiceJour -> Financial Voucher table relations

SELECT A.* FROM GeneralJournalEntry A
INNER JOIN GENERALJOURNALACCOUNTENTRY B ON B.GENERALJOURNALENTRY=A.RECID
INNER JOIN SubledgerVoucherGeneralJournalEntry C ON A.RECID=C.GENERALJOURNALENTRY
WHERE
C.VOUCHER IN(
SELECT LEDGERVOUCHER FROM VendInvoiceJour WHERE PURCHID='PO-14010189'
UNION
SELECT COSTLEDGERVOUCHER FROM VendInvoiceJour WHERE PURCHID='PO-14010189')
Advertisements

fix bugs Remove Sales Line when the sales Line already pick,pack,or invoiced on AX2012

i don’t know this is a bug come from our own customize or bugs originated from AX 2012.
anyway we have to fix this. Our client found this bug and requesting to add some validation and disable Remove Button on sales line when already pick.

so how i did this :

go to form SalesTable,
locate button Remove , and set AutoDeclaration to Yes, so we can call this button and disable or enable it via code.
look for method “active” in datasource SalesLine.

add this code below :

//AIFD fix bug remove button
    InventTrans     inventTransLoc;
    boolean         cekStatus;
    WMSOrderTrans   wmsOrderTrans;
  //END


    //add this code before return ret;
    cekStatus = true;
    //cek status dari inventtrans
    while select inventTransLoc   where inventTransLoc.InventTransOrigin==
    InventTransOrigin::findByInventTransId(SalesLine.InventTransId).RecId
    {
        if(inventTransLoc.StatusIssue != StatusIssue::OnOrder)
        {
            cekStatus = false;
            break;
        }
    }

    //cek status dari picking list
    while select wmsOrderTrans where   wmsOrderTrans.inventTransId==SalesLine.InventTransId
    {
        cekStatus = false;
        break;
    }


    if( salesLine.SalesStatus == SalesStatus::Backorder && cekStatus)
    {
        LineStripDelete.enabled(true);
    }
    else
    {
       LineStripDelete.enabled(false);
    }
    
    //END

voila… happy Daxing !!

add Department Name to grid form PurchReqTableListPage

On table purchReqTable,

create new method and add this

display public server Name aiDepartment()
{
    return HcmWorker::find(this.Originator).primaryDepartmentName();
}

on form PurchReqTableListPage, right click and choose Restore (to restore DataSource).
and add string to Grid, set datasource and method on properties.

voila !! done..

happy Daxing… !!

Create Number Sequence on Sales Module, custInvoiceJour

read more on
http://swathidynamicsax.blogspot.com/2012/07/simple-steps-to-create-number-sequence.html

My case is to create number sequence on Sales Module,
so i had to modify some code on there..

on table SalesParameters.

static client server NumberSequenceReference AI_numRefPackingListId()
{
    return NumberSeqReference::findReference(extendedTypeNum(AI_PackingListId));
}

add this code to class NumSeqModuleSalesOrder\LoadModule

//AIFD_ seq packingListId
datatype.parmDatatypeId(extendedTypeNum(AI_packingListId));
datatype.parmReferenceHelp(literalStr("Packing List Id setiap create Invoice"));
datatype.parmReferenceLabel(literalStr("Packing List Id"));
datatype.parmWizardIsManual(NoYes::No);
datatype.parmWizardIsChangeDownAllowed(NoYes::No);
datatype.parmWizardIsChangeUpAllowed(NoYes::No);
datatype.parmWizardHighest(999999);
datatype.parmSortField(66);
datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);
this.create(datatype);
//END

and modify the code on job

static void AIFD_JobSequence(Args _args)
{
   NumberSeqModuleSalesOrder NumberSeqModuleSalesOrderLoc = new NumberSeqModuleSalesOrder();
   NumberSeqModuleSalesOrderLoc.load();
}

then run wizard number sequence and run this job

static void AIFD_TestRunSeqNum(Args _args)
{
   NumberSeq numberSeq;
   AI_PackingListId num;
   ;
   numberSeq = NumberSeq::newGetNum(SalesParameters::AI_numRefPackingListId());
   num = numberSeq.num();
   info(num);
}

done.. voila, i need to add my newly added number sequence to my customize CustInvoiceJour,
so when sales Invoice is created, my newly added number sequence is generated and automatically save in table CustInvoiceJour..

how i did this :

1. add new field on custInvoiceJour, i named it AI_PackingListId and set the extended data type to my new data type.

2. modify some code on class SalesInvoiceJournalCreateBase\initJournalHeader

NumberSeq numberSeqLoc;
AI_PackingListId numPackingListId;

numberSeqLoc = NumberSeq::newGetNum(SalesParameters::AI_numRefPackingListId());
numPackingListId = numberSeqLoc.num();

//add this code below custInvoiceJour.initFromSalesParmTable(salesParmTable);
custInvoiceJour.AI_PackingListId = numPackingListId;
//END

3. Last, Generate Incremental CIL , dont forget that 🙂
Voila.. done !!

happy Daxing !!