Multiple sales into one invoice

Hello guys,

I really really need your help… I have for example 2 Sales orders and I need to print one invoice for them, no for each other… Maybe anyone did it in x++ ? I found smth like that : salesparmupdate.sumby, but I don’t know how to use this… Please help me.

Use the summary update on the periodic invoice routine and it will combine them without any coding.

I need to write a code, because I’m doin auto invoicing, I did invoicing for selected for each, so I need to join invoices…

I did it :slight_smile:

void SFjoin()

{

SalesFormLetter letter=SalesFormLetter::construct(DocumentStatus::Invoice);

SalesParmLine parmLine;

salesLine _salesLine;

SalesParmTable SalesParmTable;

salesParmUpdate salesParmUpdate;

SalesTable SalesTableMarked;

;

ttsBegin;

letter.transDate(systemDateGet());

letter.multiForm(true);

letter.specQty(SalesUpdate::All);

letter.printFormLetter (true);

letter.createParmUpdate();

select forupdate firstonly salesParmUpdate where

salesParmUpdate.RecId == letter.salesParmUpdate().RecId;

salesParmUpdate.SumBy = AccountOrder::Account;

salesParmUpdate.update();

letter.salesParmUpdate(salesParmUpdate);

letter.initParameters(letter.salesParmUpdate(),

PrintOut::Current);

if (SalesTable_ds.anyMarked())

{

SalesTableMarked = SalesTable_ds.getFirst(1,false);

while(SalesTableMarked)

{

letter.createParmTable(SalesParmTable, SalesTable::find(SalesTableMarked.SalesId));

SalesParmTable.DocumentDate = SalesTable::find(SalesTableMarked.SalesId).DeliveryDate;

SalesParmTable.Transdate = SalesTable::find(SalesTableMarked.SalesId).DeliveryDate;

SalesParmTable.DocNumberingCode_LT = “P_SF1”;

SalesParmTable.insert();

SalesParmTable.clear();

while select _salesLine where _salesLine.SalesId == SalesTableMarked.SalesId

letter.createParmLine(_salesLine);

SalesTableMarked = SalesTable_ds.getNext();

}

}

letter.run();

ttscommit;

}

Hi ,

Could any one tell the above code in Ax2012.

Thanks a lot…!!

Daxing

Hi ,

Any help kindly.!!!