public void executeQuery()
{
Query query,queryline;
QueryRun qr, qrAPInvoice;
QueryBuildDataSource queryBuildDataSource,querylinesource;
//QueryBuildFieldList qbfl = queryBuildDataSource.fields();
QueryBuildRange queryBuildRange,queryrangeline;
// QueryBuildFieldList qbfl = queryBuildDataSource.fields();
Common common;
str recIds;
PurchDP_Header argsRecord;
LedgerJournalTrans ldjt;
//this.query().dataSourceNo(1).clearRanges();
// Get all the markupTrans recIds for the
// sales header and lines.
argsRecord = element.args().record();
recIds = argsRecord.Nomor_PurchDP;
query = new Query();
queryBuildDataSource = query.addDataSource(tableNum(LedgerJournalTrans));
queryBuildRange = queryBuildDataSource.addRange(fieldNum(LedgerJournalTrans,Nomor_DP));
// If no RecIds for markupTrans are associated with the sales order, passing in an empty
// string was causing there to be no filter on recId and returning all records.
if(recIds)
{
queryBuildRange.value(queryValue(recIds));
// PurchDP_Header_ds.object(fieldNum(PurchDP_Header, VendorAccount)).allowEdit(false);
}
else
{
queryBuildRange.value(SysQuery::valueEmptyString());
}
//QBFL SUM
queryBuildDataSource.addSelectionField(fieldNum(LedgerJournalTrans,AmountCurDebit),SelectionField::Sum);
queryBuildDataSource.addSelectionField(fieldNum(LedgerJournalTrans,AmountCurCredit),SelectionField::Sum); queryBuildDataSource.addSortField(fieldnum(LedgerJournalTrans,journalnum));
queryBuildDataSource.addSortField(fieldnum(LedgerJournalTrans,voucher));
queryBuildDataSource.addSortField(fieldnum(LedgerJournalTrans,nomor_dp));
queryBuildDataSource.addSortField(fieldnum(LedgerJournalTrans,nomor_pa));
queryBuildDataSource.addSortField(fieldnum(LedgerJournalTrans,amountdp));
queryBuildDataSource.orderMode(OrderMode::GroupBy);
qr = new QueryRun(query);
while (qr.next())
{
ldjt = qr.get(tableNum(LedgerJournalTrans));
LedgerJournalTransTemp.clear();
LedgerJournalTransTemp.Nomor_DP = ldjt.Nomor_DP;
LedgerJournalTransTemp.Nomor_PA = ldjt.Nomor_PA;
LedgerJournalTransTemp.Voucher = ldjt.Voucher;
LedgerJournalTransTemp.JournalNum = ldjt.JournalNum;
LedgerJournalTransTemp.AmountCurDebit = ldjt.AmountCurDebit;
LedgerJournalTransTemp.AmountCurCredit = ldjt.AmountCurCredit;
LedgerJournalTransTemp.AmountDP = ldjt.AmountDP;
LedgerJournalTransTemp.insert();
}
super();
}