ProdCalcTransVarianceDP
===================
Once values are inserted to table, i need to modify and then update to table.
Since in report the temp table is 'Inmemory ' , the ProdCalcTransVarianceDP is applied to only one selected Prodid.
But my requirement is to get all ProdId's if prodid is not selected.
Modified , to my requirment
===================
Once values are inserted to table, i need to modify and then update to table.
Since in report the temp table is 'Inmemory ' , the ProdCalcTransVarianceDP is applied to only one selected Prodid.
But my requirement is to get all ProdId's if prodid is not selected.
Modified , to my requirment
///
<summary>
/// The
<c>CitProdCalcTransVarianceSumryDP</c> class is the Report Data
Provider class for the
///
<c>CitProdCalcTransVarianceSumry</c> report.
///
</summary>
/// REM 3/12/14
- CIT_245_VarianceSummaryReport
[SRSReportParameterAttribute(classStr(CitProdCalcTransVarianceSumryContract)),
SRSReportQueryAttribute(queryStr(CitProdTableProdCalcTrans))]
class
CitProdCalcTransVarianceSumryDP extends
SRSReportDataProviderBase
{
TmpProdStandardVariance tmpProdStandardVariance;
TmpProdStandardVariance tmpProdStandardVarianceAll;
ProdStandardVariance prodStandardVariance;
}
|
private
InventItemPrice getItemPrice(ProdTable prodTable)
{
InventItemPrice inventItemPrice;
InventCostTrans inventCostTrans;
select firstonly TableId from
inventCostTrans
where
inventCostTrans.InventTransId ==
prodTable.InventTransId
&&
inventCostTrans.CostTransType ==
InventCostTransType::Receipt
&&
inventCostTrans.CostTransState ==
InventCostTransState::Financial
&&
inventCostTrans.CostTransRefType ==
InventCostTransRefType::Production
join
inventItemPrice
where
inventItemPrice.RecId == inventCostTrans.ItemPriceRefRecId;
return
inventItemPrice;
}
|
///
<summary>
/// Retrieves
data from the <c>TmpProdStandardVariance</c> table.
///
</summary>
///
<returns>
/// Data from
the <c>TmpProdStandardVariance</c> table.
///
</returns>
[SRSReportDataSetAttribute(tableStr(TmpProdStandardVariance))]
public
TmpProdStandardVariance getTmpProdStandardVariance()
{
select
tmpProdStandardVarianceAll
order by CalcType asc,
CostGroupId asc
where
tmpProdStandardVarianceAll.InventCostLevel <= InventCostLevel::Single;
return
tmpProdStandardVarianceAll;
}
|
private CostAmount
getTotalVariance()
{
TmpProdStandardVariance
totalStandardVariance;
totalStandardVariance.setTmpData(tmpProdStandardVarianceAll);
select firstonly
totalStandardVariance
where
totalStandardVariance.CalcType == ItemCalcType::Production;
return
totalStandardVariance.totalVariance();
}
|
public void new(ProdStandardVariance
_prodStandardVariance =
ProdStandardVariance::construct(ProdTransRefType::Production))
{
super();
prodStandardVariance =
_prodStandardVariance;
}
|
///
<summary>
/// Fetches the
required data for the report.
///
</summary>
[SysEntryPointAttribute]
public void
processReport()
{
InventItemPrice inventItemPrice;
CitProdCalcTransVarianceSumryContract
contract = this.parmDataContract() as
CitProdCalcTransVarianceSumryContract;
ProdTable prodTable;
CostAmount totalVariance;
//REM ->
Query query = this.parmQuery();
QueryRun queryRun;
ProdCalcTrans prodCalcTransLoc;
RecId recidCount = 1;
//REM <-
;
prodStandardVariance.citSetCalledFromVarianceSummaryReport(true); //REM
queryRun = new
QueryRun(query); //REM
while
(queryRun.next()) //REM
{
prodTable = queryRun.get(TableNum(prodTable));
prodCalcTransLoc = queryRun.get(TableNum(prodCalcTrans));
InventItemPrice =
this.getItemPrice(prodTable);
prodStandardVariance.calc(prodTable.ProdId,
ProdTransRefType::Production,
prodTable.CollectRefLevel,
prodTable.CollectRefProdId,
prodTable.RealDate);
tmpProdStandardVariance.setTmpData(prodStandardVariance.parmTmpProdStandardVariance());
//Retrieve record set from class
totalVariance =
this.getTotalVariance();
while select
tmpProdStandardVariance
{
tmpProdStandardVariance.CitProdId
= prodTable.ProdId;
tmpProdStandardVariance.CitItemId
= prodTable.ItemId;
tmpProdStandardVariance.CitItemName
= prodTable.itemName();
tmpProdStandardVariance.CitDateEnded = prodCalcTransLoc.TransDate; //Date ended on
'Production' type record
if
(inventItemPrice.PriceCalcId)
{
tmpProdStandardVariance.LotSize =
BOMCalcTable::find(inventItemPrice.PriceCalcId).Qty;
}
else
{
tmpProdStandardVariance.LotSize = inventItemPrice.PriceUnit;
}
tmpProdStandardVariance.TotalVarianceValue
= totalVariance;
tmpProdStandardVariance.ReportedGood =
prodTable.reportedFinishedGood();
tmpProdStandardVariance.update();
//Insert all
records in buffer into temp table used by report ->
tmpProdStandardVarianceAll.data(tmpProdStandardVariance);
tmpProdStandardVarianceAll.RecId
= recidCount;
recidCount ++;
tmpProdStandardVarianceAll.insert();
//Insert all
records in buffer into temp table used by report <-
}
}
}
|
No comments:
Post a Comment