12 May 2016

SSRS Report RDP class with process report method - Query in process report with multiple tables

[SysEntryPointAttribute(false)]
public void processReport()
{
Query query;
QueryRun queryRun;
QueryBuildRange vendAccountRange;
QueryBuildRange fromDateRange;
QueryBuildRange toDateRange;
QueryBuildRange incoTermsRange;
QueryBuildRange cTMLocationIdRange;
QueryBuildRange cTMItemIdRange;
QueryBuildRange WMSCarrierNameRange;

QueryBuildRange approvedContractRange;
QueryBuildRange locationRange;
QueryBuildrange commodityRange;
QueryBuildRange contractTypeRange;
QueryBuildDataSource qbds;
QueryBuildDataSource qbds1
,qbds2
,qbds3
,qbds4;
QueryBuildDataSource qbds_load;
QueryBuildLink queryBuildLink;

CTMContractLoads ctmContractLoads;
CTMContractOnCost ctmContractOnCost;
CTMContractLines ctmContractLines;
CTMMIHeader ctmMIHeader;
CTMContractHdr ctmContractHdr;
CTMMILine ctmMILine;

UOMLogisticsContract2 contract;
VendTable vendTable;
CTMCustVendName ctmCustVendName; // origin Name
VendAccount vendAccount;
CTMDeliveryFromDate ctmDeliveryFromDate; // delivery from date
CTMDeliveryToDate ctmDeliveryToDate; // delivery to date
CTMLogisticStepStatus ctmLogisticStepStatus; // status
CTMIncoTermsCode ctmIncoTermsCode; // Inco Terms
CTMLocationId ctmLocationId;
CTMLocationId shipTo;
WMSCarrierName vendAccountHau; // Haulier
CTMItemId ctmItemId; // Commodity
CTMContractId contractId;

;

contract = this.parmDataContract() as UOMLogisticsContract2;
query = this.parmQuery();

qbds = query.dataSourceTable(tableNum(VendTable));
qbds1 = query.dataSourceTable(tableNum(CTMContractLoads));
qbds2 = query.dataSourceTable(tableNum(CTMMIHeader));
qbds3 = query.dataSourceTable(tableNum(CTMMILine));
//qbds1 = query.dataSourceTable(tableNum(CTMContractLoadsForm));
//qbds1 = query.dataSourceTable(tableNum(CTMContractLoadsForm));
//qbds1 = query.dataSourceTable(tableNum(CTMContractLoadsForm));

vendAccount = contract.parmOriginName(); // done
ctmDeliveryFromDate = Contract.parmDeliveryFromDate();// done
ctmDeliveryToDate = contract.parmDeliveryToDate();// done
ctmLogisticStepStatus = contract.parmStatus(); // done
ctmIncoTermsCode = contract.parmIncoTerms();
// cTMLocationId = contract.parmDe
ctmLocationId = contract.parmPickUpLocaton(); // done
vendAccountHau = contract.parmHaulier(); // done
ctmItemId = contract.parmComodity(); // done
//shipTo = contract.parmShipTo();

if(vendAccount)
{
vendAccountRange = SysQuery::findOrCreateRange(qbds,fieldNum(VendTable,AccountNum));
vendAccountRange.value(vendAccount);
}

if(vendAccountHau)
{
WMSCarrierNameRange = SysQuery::findOrCreateRange(qbds2,fieldNum(CTMMIHeader,carrier));
WMSCarrierNameRange.value(vendAccountHau);
}

if(cTMLocationId)
{
cTMLocationIdRange = SysQuery::findOrCreateRange(qbds1,fieldNum(CTMContractLoads,DeliveryLocation));
cTMLocationIdRange.value(cTMLocationId);
}

if(cTMItemId)
{
cTMItemIdRange = SysQuery::findOrCreateRange(qbds1,fieldNum(CTMContractLoads,PurchaseCommodity));
cTMItemIdRange.value(cTMItemId);
}


if(cTMDeliveryFromDate)
{
fromDateRange = SysQuery::findOrCreateRange(qbds2,fieldNum(CTMMIHeader,DeliveryFromDate));
fromDateRange.value(SysQuery::range(cTMDeliveryFromDate,dateNull()));
//vendAccountRange.value(cTMDeliveryFromDate);
}
if(cTMDeliveryToDate)
{
toDateRange = SysQuery::findOrCreateRange(qbds2,fieldNum(CTMMIHeader,DeliveryToDate));
toDateRange.value(SysQuery::range(dateNull(),cTMDeliveryToDate));
}

queryRun = new queryRun(query);

while ((queryRun.next()))
{
vendTable = queryRun.get(tableNum(VendTable));
ctmContractLoads = queryRun.get(tableNum(CTMContractLoads));
ctmMIHeader = queryRun.get(tableNum(CTMMIHeader));
ctmContractOnCost = queryRun.get(tableNum(CTMContractOnCost));
ctmMILine = queryRun.get(tableNum(CTMMILine));

select firstOnly ctmContractHdr
where ctmContractLoads.PurchaseContract == ctmContractHdr.ContractId;

this.insertIntoLogisticsTMP(
vendTable
,ctmContractLoads
,ctmMIHeader
,ctmContractOnCost
,ctmMILine
,ctmContractHdr
);
}

}

==========

SSRS Report design - >
Parameters Change proeperty
Allow Blank: True
Nullable: True

Ledger Voucher creation Framework and x++ code to create ledger voucher

 Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension-...