Create a SSRS report for VendPurchReceivingLog
Today we have a requirement to create a VendPurchReceivingLog ssrs report :-
1) Create a Contract class AVAVendPurchReceivingLogContract.
2) Create a DP class AVAVendPurchReceivingLogDP.
1) Create a Contract class AVAVendPurchReceivingLogContract. :-
1) Create a Contract class AVAVendPurchReceivingLogContract.
/// <summary>
/// The <c>AVAVendPurchReceivingLogContract</c> class contains all the parameters needed for the report.
/// </summary>
[
DataContractAttribute
]
public class AVAVendPurchReceivingLogContract implements SysOperationValidatable
{
FromDate fromDate;
ToDate toDate;
[
DataMemberAttribute(identifierStr(FromDate)),
SysOperationDisplayOrderAttribute('1'),
SysOperationLabelAttribute(literalStr("@SYS5209"))
]
public FromDate parmFromDate(FromDate _fromDate = fromDate)
{
fromDate = _fromDate;
return fromDate;
}
[
DataMemberAttribute(identifierStr(ToDate)),
SysOperationDisplayOrderAttribute('2'),
SysOperationLabelAttribute(literalStr("@SYS14656"))
]
public ToDate parmToDate(ToDate _toDate = toDate)
{
toDate = _toDate;
return toDate;
}
/// Determines whether the parameters are valid.
/// </summary>
/// <returns>
/// true when the parameters are valid; otherwise, false.
/// </returns>
public boolean validate()
{
boolean isValid = true;
if (!fromDate)
{
isValid = checkFailed(strFmt("@SYS84753", "@SYS180311"));
}
if (!toDate)
{
isValid = checkFailed(strFmt("@SYS84753", "@SYS180217"));
}
if (fromDate > toDate)
{
isValid = checkFailed(strFmt("@SYS300457", date2StrUsr(fromDate, DateFlags::FormatAll), date2StrUsr(toDate, DateFlags::FormatAll)));
}
return isvalid;
}
}
=====================================================================
2) Create a DP class AVAVendPurchReceivingLogDP. :-
/// <summary>
/// The <c>AVAVendPurchReceivingLogDP</c> class is the data provider for the <c>AVAVendPurchReceivingLog</c> report.
/// </summary>
[
SRSReportParameterAttribute(classstr(AVAVendPurchReceivingLogContract))
]
class AVAVendPurchReceivingLogDP extends SrsReportDataProviderPreProcessTempDB
{
AVAVendPurchReceivingLogTmp VendPurchReceivingLogTmp;
AVAVendPurchReceivingLogContract VendPurchReceivingLogContract;
FromDate fromDate;
ToDate toDate;
/// <summary>
/// Retrieves the actual data for the report from the temporary table.
/// </summary>
/// <returns>
/// The <c>AVAVendPurchReceivingLogTmp</c> temporary table.
/// </returns>
[SrsReportDataSetAttribute(tableStr(AVAVendPurchReceivingLogTmp))]
public AVAVendPurchReceivingLogTmp getVendPurchReceivingLogTmp()
{
select VendPurchReceivingLogTmp;
return VendPurchReceivingLogTmp;
}
/// <summary>
/// Processes the report business logic.
/// </summary>
public void processReport()
{
VendPurchReceivingLogContract = this.parmDataContract() as AVAVendPurchReceivingLogContract;
fromDate = VendPurchReceivingLogContract.parmFromDate();
toDate = VendPurchReceivingLogContract.parmToDate();
this.insertValue();
}
/// <summary>
/// Data fill process in the Tmp table.
/// </summary>
private void insertValue()
{
AVAVendPurchReceivingLog VendPurchReceivingLogView;
RecordInsertList VendPurchReceivingLogTmpList;
VendPurchReceivingLogTmpList = new RecordInsertList(tableNum(AVAVendPurchReceivingLogTmp), true, true, true, false, true, VendPurchReceivingLogTmp);
while select VendPurchReceivingLogView order by DeliveryDate asc
where VendPurchReceivingLogView.DeliveryDate >= fromDate
&& VendPurchReceivingLogView.DeliveryDate <= toDate
{
VendPurchReceivingLogTmp.VendorNumber = VendPurchReceivingLogView.InvoiceAccount;
VendPurchReceivingLogTmp.Name = this.VendName(VendPurchReceivingLogView.InvoiceAccount);
VendPurchReceivingLogTmp.VendorCountyName = this.vendorCountyName(VendPurchReceivingLogView.InvoiceAccount);
VendPurchReceivingLogTmp.VendorStateName = this.vendorState(VendPurchReceivingLogView.InvoiceAccount);
VendPurchReceivingLogTmp.PurchId = VendPurchReceivingLogView.PurchId;
VendPurchReceivingLogTmp.TermsOfDelivery = VendPurchReceivingLogView.DlvTerm;
VendPurchReceivingLogTmp.DeliveryDate = VendPurchReceivingLogView.DeliveryDate;
VendPurchReceivingLogTmp.Qty = VendPurchReceivingLogView.Qty;
VendPurchReceivingLogTmp.PurchUnit = VendPurchReceivingLogView.PurchUnit;
VendPurchReceivingLogTmp.ItemId = VendPurchReceivingLogView.ItemId;
VendPurchReceivingLogTmp.ProductName = this.itemName(VendPurchReceivingLogView.ItemId, VendPurchReceivingLogView.InventDimId);
VendPurchReceivingLogTmp.PackingSlipId = VendPurchReceivingLogView.PackingSlipId;
VendPurchReceivingLogTmp.Amount = VendPurchReceivingLogView.ValueMST;
VendPurchReceivingLogTmpList.add(VendPurchReceivingLogTmp);
}
VendPurchReceivingLogTmpList.insertDatabase();
}
/// <summary>
/// create this method to find Vendor name.
/// </summary>
/// <param name = "_vendInvoiceAccount">
/// The invoice account of vendor whether the <paramref name="_vendInvoiceAccount" /> parameter is retrieved and set.
/// </param>
/// <returns>
/// Returns VendName object.
/// </returns>
private VendName VendName(VendInvoiceAccount _vendInvoiceAccount)
{
return VendTable::find(_vendInvoiceAccount).Name();
}
/// <summary>
/// create this method to find stateID.
/// </summary>
/// <param name = "_vendInvoiceAccount">
/// The invoice account of vendor whether the <paramref name="_vendInvoiceAccount" /> parameter is retrieved and set.
/// </param>
/// <returns>
/// Returns LogisticsAddressStatename object.
/// </returns>
private LogisticsAddressStatename vendorState(VendInvoiceAccount _vendInvoiceAccount)
{
LogisticsPostalAddress postalAddress = DirParty::primaryPostalAddress(VendTable::find(_vendInvoiceAccount).Party);
return LogisticsAddressState::find(postalAddress.CountryRegionId, postalAddress.State).StateId;
}
/// <summary>
/// create this method to find CountryRegionID.
/// </summary>
/// <param name = "_vendInvoiceAccount">
/// The invoice account of vendor whether the <paramref name="_vendInvoiceAccount" /> parameter is retrieved and set.
/// </param>
/// <returns>
/// Returns LogisticsAddressCountyName object.
/// </returns>
private LogisticsAddressCountryRegionId vendorCountyName(VendInvoiceAccount _vendInvoiceAccount)
{
LogisticsPostalAddress postalAddress = DirParty::primaryPostalAddress(VendTable::find(_vendInvoiceAccount).Party);
return postalAddress.CountryRegionId;
}
/// <summary>
/// create this method to find inventDim.
/// </summary>
/// <param name = "_inventdimID">
/// The inventdimof item whether the <paramref name="_vendInvoiceAccount" /> parameter is retrieved and set.
/// </param>
/// <returns>
/// Returns InventDim object.
/// </returns>
private InventDim inventDim(InventDimId _inventdimID, boolean update = false)
{
return InventDim::find(_inventdimID, update);
}
/// <summary>
/// create this method to find ProductName.
/// </summary>
/// /// <param name = "_itemID">
/// The inventdimof item whether the <paramref name="_itemID" /> parameter is retrieved and set.
/// </param>
/// <returns>
/// Returns ItemNameDisplay object.
/// </returns>
private ItemNameDisplay itemName(ItemId _itemID, InventDimId _inventdimID)
{
return InventTable::find(_itemID).itemName(this.inventDim(_inventdimID));
}
}
========================================================================
Comments
Post a Comment