Simple contract Class :
[
DataContractAttribute,
SysOperationGroupAttribute('ItemGroup', "Item group", '1') ---->Declare item group
]
class NEC_SalesContributionContract
{
ItemGroupId itemGroupId;
[
DataMemberAttribute('ItemGroupId'), ----> EDT name
SysOperationDisplayOrderAttribute('1'), ----> order of parameter
SysOperationLabelAttribute(literalStr("Item group")), ----->Lable
SysOperationGroupMemberAttribute('ItemGroup') ----->Groupname
]
public ItemGroupId ParmItemGroup(ItemGroupId _itemGroupId = itemGroupId)
{
itemGroupId = _itemGroupId;
return itemGroupId;
}
}
Simple DP class:
[SrsReportQueryAttribute(querystr(SalesContributionQuery)),
SRSReportParameterAttribute(classStr(SalesContributionContract))]
class NEC_SalesContributionDP extends SrsReportDataProviderPreProcessTempDB
{
SalesContributionTmp salesContributionTmp;
[
SRSReportDataSetAttribute(tableStr(SalesContributionTmp))
]
public SalesContributionTmp getSalesContributionTmp()
{
select salesContributionTmp;
return salesContributionTmp;
}
public void processReport()
{
RetailTransactionSalesTrans retailTransactionSalesTrans;
RetailTransactionTable retailTransactionTable;
InventItemGroup inventItemGroup;
InventTable inventTable;
ItemGroupId itemGroup;
NEC_SalesContributionContract contract = this.parmDataContract() as NEC_SalesContributionContract;
Query query = this.parmQuery();
itemGroup = contract.ParmItemGroup();
QueryRun queryRun = new QueryRun(query);
while(queryRun.next())
{
retailTransactionSalesTrans = queryRun.get(tableNum(RetailTransactionSalesTrans));
(or)
retailTransactionSalesTrans = queryRun.getNo(2);
//here insert data in Tmp table from retailTransactionSalesTrans ;
}
}
}
3.Another ProcessReport Method in DP Class while pass the Range
public void ProcessReport()
{
TransDate fromDate,toDate;
RetailStoreId fromRetailStoreId,toRetailStoreId;
Description fromStorename,toStoreName;
RetailTransactionSalesTrans retailTransactionSalesTrans;
InventLocation inventLocation;
RetailTransactionTable retailTransactionTable;
RetailTransactionPaymentTrans retailTransactionPymentTrans;
RetailTenderTypeTable retailTenderTypeTable;
retailchanneltable retailchanneltable;
OMOperatingUnit oMOperatingUnit;
int i;
price salesBeforetax,grossAmount,paymentAmount;
price tradeamount,negcash;
Query query;
QueryBuildDataSource qbds;
QueryBuildRange qbrTrans,qbrWareHouse,qbrType,qbrentystatus;
QueryRun qr;
storeDetailsContract = this.parmDataContract();
fromDate = storeDetailsContract.ParmTrnasFromDate();
toDate = storeDetailsContract.ParmTrnasToDate();
fromRetailStoreId = storeDetailsContract.ParmFromStore();
toRetailStoreId = storeDetailsContract.ParmtoStore();
query = new Query();
qbds = query.addDataSource(tablenum(retailTransactionTable));
qbrTrans = qbds.addRange(fieldnum(retailTransactionTable,transDate));
qbrWareHouse = qbds.addRange(fieldnum(retailTransactionTable,store));
qbrType = qbds.addRange(fieldnum(retailTransactionTable,Type));
qbrentystatus = qbds.addRange(fieldnum(retailTransactionTable,entryStatus));
if (fromDate !=datenull() && toDate != datenull() && fromRetailStoreId !=null && toRetailStoreId !=null)
{
qbrTrans.value(SysQuery::range(fromDate,toDate));
qbrWareHouse.value(SysQuery::range(fromRetailStoreId,toRetailStoreId));
qbrentystatus.value(SysQuery::valueNot(RetailEntryStatus::Voided));
qbrType.value(queryValue(RetailTransactionType::Sales));
}
if ( fromDate !=datenull() && toDate != datenull() && fromRetailStoreId ==null && toRetailStoreId ==null)
{
qbrTrans.value(SysQuery::range(fromDate,toDate));
qbrType.value(queryValue(RetailTransactionType::Sales));
qbrentystatus.value(SysQuery::valueNot(RetailEntryStatus::Voided));
}
if ( fromDate ==datenull() && toDate == datenull() && fromRetailStoreId !=null && toRetailStoreId !=null)
{
qbrWareHouse.value(SysQuery::range(fromRetailStoreId,toRetailStoreId));
qbrType.value(queryValue(RetailTransactionType::Sales));
qbrentystatus.value(SysQuery::valueNot(RetailEntryStatus::Voided));
}
qr = new QueryRun(query);
while(qr.next())
{
retailTransactionTable = qr.get(Tablenum(RetailTransactionTable));
storeDetailsTmp.clear();
storeDetailsTmp.NEC_Date = retailTransactionTable.transDate;
storeDetailsTmp.day = dayName(dayOfWk(retailTransactionTable.transDate));
storeDetailsTmp.WareHouse = retailTransactionTable.InventLocationId;
}
}
}
[
DataContractAttribute,
SysOperationGroupAttribute('ItemGroup', "Item group", '1') ---->Declare item group
]
class NEC_SalesContributionContract
{
ItemGroupId itemGroupId;
[
DataMemberAttribute('ItemGroupId'), ----> EDT name
SysOperationDisplayOrderAttribute('1'), ----> order of parameter
SysOperationLabelAttribute(literalStr("Item group")), ----->Lable
SysOperationGroupMemberAttribute('ItemGroup') ----->Groupname
]
public ItemGroupId ParmItemGroup(ItemGroupId _itemGroupId = itemGroupId)
{
itemGroupId = _itemGroupId;
return itemGroupId;
}
}
Simple DP class:
[SrsReportQueryAttribute(querystr(SalesContributionQuery)),
SRSReportParameterAttribute(classStr(SalesContributionContract))]
class NEC_SalesContributionDP extends SrsReportDataProviderPreProcessTempDB
{
SalesContributionTmp salesContributionTmp;
[
SRSReportDataSetAttribute(tableStr(SalesContributionTmp))
]
public SalesContributionTmp getSalesContributionTmp()
{
select salesContributionTmp;
return salesContributionTmp;
}
public void processReport()
{
RetailTransactionSalesTrans retailTransactionSalesTrans;
RetailTransactionTable retailTransactionTable;
InventItemGroup inventItemGroup;
InventTable inventTable;
ItemGroupId itemGroup;
NEC_SalesContributionContract contract = this.parmDataContract() as NEC_SalesContributionContract;
Query query = this.parmQuery();
itemGroup = contract.ParmItemGroup();
QueryRun queryRun = new QueryRun(query);
while(queryRun.next())
{
retailTransactionSalesTrans = queryRun.get(tableNum(RetailTransactionSalesTrans));
(or)
retailTransactionSalesTrans = queryRun.getNo(2);
//here insert data in Tmp table from retailTransactionSalesTrans ;
}
}
}
3.Another ProcessReport Method in DP Class while pass the Range
public void ProcessReport()
{
TransDate fromDate,toDate;
RetailStoreId fromRetailStoreId,toRetailStoreId;
Description fromStorename,toStoreName;
RetailTransactionSalesTrans retailTransactionSalesTrans;
InventLocation inventLocation;
RetailTransactionTable retailTransactionTable;
RetailTransactionPaymentTrans retailTransactionPymentTrans;
RetailTenderTypeTable retailTenderTypeTable;
retailchanneltable retailchanneltable;
OMOperatingUnit oMOperatingUnit;
int i;
price salesBeforetax,grossAmount,paymentAmount;
price tradeamount,negcash;
Query query;
QueryBuildDataSource qbds;
QueryBuildRange qbrTrans,qbrWareHouse,qbrType,qbrentystatus;
QueryRun qr;
storeDetailsContract = this.parmDataContract();
fromDate = storeDetailsContract.ParmTrnasFromDate();
toDate = storeDetailsContract.ParmTrnasToDate();
fromRetailStoreId = storeDetailsContract.ParmFromStore();
toRetailStoreId = storeDetailsContract.ParmtoStore();
query = new Query();
qbds = query.addDataSource(tablenum(retailTransactionTable));
qbrTrans = qbds.addRange(fieldnum(retailTransactionTable,transDate));
qbrWareHouse = qbds.addRange(fieldnum(retailTransactionTable,store));
qbrType = qbds.addRange(fieldnum(retailTransactionTable,Type));
qbrentystatus = qbds.addRange(fieldnum(retailTransactionTable,entryStatus));
if (fromDate !=datenull() && toDate != datenull() && fromRetailStoreId !=null && toRetailStoreId !=null)
{
qbrTrans.value(SysQuery::range(fromDate,toDate));
qbrWareHouse.value(SysQuery::range(fromRetailStoreId,toRetailStoreId));
qbrentystatus.value(SysQuery::valueNot(RetailEntryStatus::Voided));
qbrType.value(queryValue(RetailTransactionType::Sales));
}
if ( fromDate !=datenull() && toDate != datenull() && fromRetailStoreId ==null && toRetailStoreId ==null)
{
qbrTrans.value(SysQuery::range(fromDate,toDate));
qbrType.value(queryValue(RetailTransactionType::Sales));
qbrentystatus.value(SysQuery::valueNot(RetailEntryStatus::Voided));
}
if ( fromDate ==datenull() && toDate == datenull() && fromRetailStoreId !=null && toRetailStoreId !=null)
{
qbrWareHouse.value(SysQuery::range(fromRetailStoreId,toRetailStoreId));
qbrType.value(queryValue(RetailTransactionType::Sales));
qbrentystatus.value(SysQuery::valueNot(RetailEntryStatus::Voided));
}
qr = new QueryRun(query);
while(qr.next())
{
retailTransactionTable = qr.get(Tablenum(RetailTransactionTable));
storeDetailsTmp.clear();
storeDetailsTmp.NEC_Date = retailTransactionTable.transDate;
storeDetailsTmp.day = dayName(dayOfWk(retailTransactionTable.transDate));
storeDetailsTmp.WareHouse = retailTransactionTable.InventLocationId;
}
}
}
No comments:
Post a Comment