qbdsCIT = query.addDataSource(tableNum(CustInvoiceTrans));
qbdsAgreementLineReleasedLine = qbdsCIT.addDataSource(tableNum(AgreementLineReleasedLineUnion));
qbdsAgreementLineReleasedLine.joinMode(JoinMode::ExistsJoin);
qbdsAgreementLineReleasedLine.addLink(fieldNum(CustInvoiceTrans, RecId),
fieldNum(AgreementLineReleasedLineUnion,CustInvoiceTrans));
qbdsAgreementLine = qbdsAgreementLineReleasedLine.addDataSource(tableNum(AgreementLine));
qbdsAgreementLine.joinMode(JoinMode::ExistsJoin);
qbdsAgreementLine.addLink(fieldNum(AgreementLineReleasedLineUnion, AgreementLine),
fieldNum(AgreementLine, RecId));
qbdsAgreementHeader = qbdsAgreementLine.addDataSource(tablenum (SalesAgreementHeader));
qbdsAgreementHeader.joinMode(JoinMode::ExistsJoin);
qbdsAgreementHeader.addLink(fieldNum(AgreementLine, Agreement),
fieldNum(SalesAgreementHeader, RecId));
qbdsAgreementHeader.addRange(fieldNum(SalesAgreementHeader, Salesnumbersequence)).value(nomorsacari);
qr = new QueryRun(query);
while (qr.next())
{
CT = qr.Get(tableNum(CustInvoiceTrans));
//ID = qr.Get(tableNum(InventDim));
InvoiceAndFreeTaxTmp.clear();
InvoiceAndFreeTaxTmp.InvoiceId = CT.InvoiceId;
InvoiceAndFreeTaxTmp.tanggal = CT.InvoiceDate;
InvoiceAndFreeTaxTmp.nmrSO = CT.OrigSalesId;
InvoiceAndFreeTaxTmp.licenseplate=CT.LicensePlate();
InvoiceAndFreeTaxTmp.ka=CT.KadarAir();
InvoiceAndFreeTaxTmp.CIT_SDL=CT.SourceDocumentLine;
//InvoiceAndFreeTaxTemp.licenseplate=CustInvoicePackingSlip::PackAndLicense(0, CT.RecId);
InvoiceAndFreeTaxTmp.KG=CT.Qty;
//InvoiceAndFreeTaxTmp.ka=CustInvoicePackingSlip::KadarAirs(0, CT.RecId);
InvoiceAndFreeTaxTmp.refraksipercent=CT.markupAmountPercent();
InvoiceAndFreeTaxTmp.refraksipcs=CT.markupAmountPcs();
InvoiceAndFreeTaxTmp.jumlah=CT.LineInvoiceAmount();
InvoiceAndFreeTaxTmp.harga=CT.PriceUnit;
cittvalue=CT.SourceDocumentLine;
//info(int642str(cittvalue));
InvoiceAndFreeTaxTmp.komoditi=CT.Name;
if(CT.B2BSupplier()!="")
{
InvoiceAndFreeTaxTmp.supplier=CT.B2BSupplier();
}
else
{
InvoiceAndFreeTaxTmp.supplier=CT.inventLocationId();
}
if(CT.OrigSalesId=="")
{
InvoiceAndFreeTaxTmp.FreeTax=1;
InvoiceAndFreeTaxTmp.Jenis='FREETEXT';
}
InvoiceAndFreeTaxTmp.insert();
////////////////////////////////////////////////////////////////
///
}
Tidak ada komentar:
Posting Komentar