Create Number Sequence on Sales Module, custInvoiceJour


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.parmReferenceHelp(literalStr("Packing List Id setiap create Invoice"));
datatype.parmReferenceLabel(literalStr("Packing List Id"));
datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);

and modify the code on job

static void AIFD_JobSequence(Args _args)
   NumberSeqModuleSalesOrder NumberSeqModuleSalesOrderLoc = new NumberSeqModuleSalesOrder();

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();

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;

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

happy Daxing !!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s