class RunnableClass2
{
InventTransOrigin transOrigin;
InventTrans trans;
InventDim inventDim;
InventTable tempTable;
/// <summary>
/// Runs the class with the specified arguments.
/// </summary>
/// <param name = "_args">The specified arguments.</param>
public void ProcessReport()
{
utcdatetime fromDateTime;
utcdatetime toDateTime;
FromDate fromDate;
ToDate toDate;
InventSiteId site;
InventLocationId warehouse;
fromDateTime = DateTimeUtil::newDateTime(fromDate,0);
toDateTime = DateTimeUtil::newDateTime(toDate,86400);
this.populateOnorderSales(fromDateTime, toDateTime, site, warehouse);
this.populateOnorderTransfers(fromDateTime, toDateTime, site, warehouse);
}
public void populateOnorderSales(utcdatetime _fromDate, utcdatetime _toDate, InventSiteId _site, InventLocationId _warehouse)
{
SalesTable salesTable;
SalesLine salesLine;
while select transOrigin
join trans
where trans.InventTransOrigin == transOrigin.RecId
&& transOrigin.ReferenceCategory == InventTransType::Sales
&& trans.StatusIssue == StatusIssue::OnOrder
join inventDim
where inventDim.inventDimId == trans.inventDimId
&& (inventDim.InventSiteId == _site || !_site)
&& (inventDim.InventLocationId == _warehouse || !_warehouse)
join salesTable
where salesTable.SalesId == transOrigin.ReferenceId
&& salesTable.CreatedDateTime >= _fromDate
&& salesTable.CreatedDateTime <= _toDate
{
salesLine = SalesLine::findInventTransId(transOrigin.InventTransId);
tempTable.clear();
this.insertTempTable();
//tempTable.CreatedDateTime = salesTable.CreatedDateTime;
tempTable.insert();
}
}
public void populateOnorderTransfers(utcdatetime _fromDate, utcdatetime _toDate, InventSiteId _site, InventLocationId _warehouse)
{
InventTransferTable transferTable;
while select transOrigin
join trans
where trans.InventTransOrigin == transOrigin.RecId
&& transOrigin.ReferenceCategory == InventTransType::TransferOrderShip
&& trans.StatusIssue == StatusIssue::OnOrder
join inventDim
where inventDim.inventDimId == trans.inventDimId
&& (inventDim.InventSiteId == _site || !_site)
&& (inventDim.InventLocationId == _warehouse || !_warehouse)
join transferTable
where transferTable.TransferId == transOrigin.ReferenceId
&& transferTable.CreatedDateTime >= _fromDate
&& transferTable.CreatedDateTime <= _toDate
{
tempTable.clear();
this.insertTempTable();
//tempTable.CreatedDateTime = transferTable.CreatedDateTime;
tempTable.insert();
}
}
public void insertTempTable()
{
tempTable.ItemId = transOrigin.ItemId;
}
}
No comments:
Post a Comment