class ASAP_SalesOrder_Infolog
{
}
------------
public static void main(Args args)
{
SalesTable SalesTableInfo, SalesLocal , salesTable;
SalesLine salesLine;
SalesId salesId , currentSalesId;
ASAP_SalesStatus_Info ASAP_SalesStatus_Info, infoLocalTable,validateLocalInfo;
DataAreaId companyId,localCompanyId;
int i = 0;
if (args.dataset() == tableNum(SalesTable))
{
SalesLocal = args.record();
salesId = SalesLocal.SalesId;
select ASAP_SalesStatus_Info
where ASAP_SalesStatus_Info.SalesId == salesId ;
if(ASAP_SalesStatus_Info.SalesId !=salesId)
{
while select crossCompany SalesTableInfo
where SalesTableInfo.salesId == salesId
{
ASAP_SalesStatus_Info.clear();
ASAP_SalesStatus_Info.SalesId = SalesTableInfo.salesId;
ASAP_SalesStatus_Info.DataArea = strUpr(SalesTableInfo.dataAreaId);
ASAP_SalesStatus_Info.SalesStatus = SalesTableInfo.SalesStatus;
ASAP_SalesStatus_Info.IsInserted = NoYes::Yes;
ASAP_SalesStatus_Info.Approval = NoYes::No;
ASAP_SalesStatus_Info.IsGenerated = i + 1;
ASAP_SalesStatus_Info.insert();
i++;
}
}
while select crossCompany salesTable
where salesTable.salesId == salesId
{
while select forupdate ASAP_SalesStatus_Info
order by ASAP_SalesStatus_Info.DataArea
where ASAP_SalesStatus_Info.SalesId == salesTable.salesId
{
changeCompany(salesTable.dataAreaId)
{
if(ASAP_SalesStatus_Info.DataArea == salesTable.dataAreaId)
{
ttsBegin;
ASAP_SalesStatus_Info.SalesStatus = salesTable.SalesStatus;
ASAP_SalesStatus_Info.Update();
ttsCommit;
}
}
}
}
ttsBegin;
while select crossCompany SalesTable where SalesTable.salesId == salesId
{
select infoLocalTable
order by infoLocalTable.DataArea
where infoLocalTable.salesId == SalesTable.salesId;
{
changeCompany(SalesTable.dataAreaId)
{
companyId = strUpr(salesTable.dataAreaId);
localCompanyId = strUpr(infoLocalTable.DataArea);
select infoLocalTable where infoLocalTable.DataArea != companyId;
{
select validateLocalInfo where validateLocalInfo.SalesId == SalesTable.salesId//infoLocalTable.SalesId
&& validateLocalInfo.DataArea == SalesTable.dataAreaId;
if(!validateLocalInfo)
{
validateLocalInfo.clear();
validateLocalInfo.SalesId = SalesTable.salesId;
validateLocalInfo.SalesStatus = SalesTable.SalesStatus;
validateLocalInfo.IsInserted = NoYes::Yes;
validateLocalInfo.Approval = NoYes::No;
validateLocalInfo.DataArea = companyId;
validateLocalInfo.insert();
}
}
}
}
}
ttsCommit;
}
new MenuFunction(MenuItemDisplayStr(ASAP_SalesOrder_Status),MenuItemType::Display).run(Args);
}
Tuesday, January 8, 2019
Dialog Based Parameter With Cust Account and Sales id selection Multiple
class ASAP_VATDocumentationDialogFields extends RunBase
{
Dialog dialog;
DialogField dialogCustId;
DialogField dialogSalesId;
DialogRunbase dialogRunBase;
CustAccount custId;
Str1260 salesId;
ASAP_VATHeader headerTable;
ASAP_VATLine lineTable;
NumberSeq numberSeq;
ASAPG_VATDocuNumber newDocuNumber;
}
-----------
public void CustIdLookup(FormStringControl control)
{
boolean ret;
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(CustTable), control);
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;
;
queryBuildDataSource = query.addDataSource(tablenum(CustTable));
sysTableLookup.addLookupfield(fieldnum(CustTable, AccountNum));
sysTableLookup.addLookupfield(fieldnum(CustTable, party ));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
{
Dialog dialog;
DialogField dialogCustId;
DialogField dialogSalesId;
DialogRunbase dialogRunBase;
CustAccount custId;
Str1260 salesId;
ASAP_VATHeader headerTable;
ASAP_VATLine lineTable;
NumberSeq numberSeq;
ASAPG_VATDocuNumber newDocuNumber;
}
-----------
public void CustIdLookup(FormStringControl control)
{
boolean ret;
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(CustTable), control);
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;
;
queryBuildDataSource = query.addDataSource(tablenum(CustTable));
sysTableLookup.addLookupfield(fieldnum(CustTable, AccountNum));
sysTableLookup.addLookupfield(fieldnum(CustTable, party ));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
-------
public Object Dialog()
{
FormRun formRun;
FormStringControl ctrlSalesId, ctrlCustId;
;
super();
dialog =super();
dialog.caption("VAT Documentation Creation ");
dialogCustId = dialog.addField(extendedTypeStr(CustAccount));
//dialogSalesId = dialog.addField(extendedTypeStr(SalesId));
dialogSalesId = dialog.addField (extendedTypeStr(Str1260),"Sales ID");
ctrlCustId = dialogCustId.control();
ctrlCustId.registerOverrideMethod(methodStr(FormStringControl,lookup), methodStr(ASAP_VATDocumentationDialogFields, custIdLookup),this);
ctrlSalesId = dialogSalesId.control();
ctrlSalesId.registerOverrideMethod(methodStr(FormStringControl,lookup), methodStr(ASAP_VATDocumentationDialogFields, salesIdLookup),this);
return dialog;
}
--------------
public void run()
{
Query query = new query();
QueryRun queryRun;
QueryBuildDataSource salesTableBuildDataSource;
QueryBuildRange salesLineRange;
boolean recordFound = false;
SalesLine salesLine;
CustTable custTable;
CustAccount previousCustAccount;
QueryBuildDataSource invemtDimBuildDataSource;
SalesTable salesTable, _salesTable;
;
custId = dialogCustId.value();
salesId = dialogSalesId.value();
salesId = strReplace(salesId,";",",");
if(!salesId || !custId)
throw error("Sales id and Customer id must be filled");
custTable = CustTable::find(custId);
salesTableBuildDataSource = query.addDataSource(tablenum(SalesTable));
salesTableBuildDataSource.addRange(fieldNum(SalesTable,SalesId)).value(salesId);
numberSeq = NumberSeq::newGetNum(SalesParameters::numRefVATDocumentation());
newDocuNumber = numberSeq.num();
numberSeq.used();
queryRun = new QueryRun(query);
while(queryRun.next())
{
salesTable = queryRun.get(tableNum(SalesTable));
// added for non repeating the salesid in dropdown --start
ttsBegin;
select forUpdate _salesTable
where _salesTable.SalesId == salesTable.SalesId;
{
_salesTable.ASAPG_VAT_IsGenerated = NoYes::Yes;
_salesTable.update();
}
ttsCommit;
// -- end
if(previousCustAccount != custId)
{
headerTable.AllSalesId = salesId;
headerTable.DocumentNum = newDocuNumber;
headerTable.GeneratedDate = today();
// info(strFmt("header % 1",headerTable.AllSalesId ));
headerTable.CustAccount = salesTable.CustAccount;
custTable = CustTable::find(salesTable.CustAccount);
headerTable.CustName = custTable.name();
headerTable.insert();
lineTable.DocumentNum = newDocuNumber;
lineTable.IsGenerated = NoYes::Yes;
lineTable.insert();
previousCustAccount = headerTable.CustAccount ;
}
}
if(headerTable)
{
info(strFmt("New PackingSlip %1", newDocuNumber));
info(strFmt("SalesIds are %1: ",salesId));
}
}
---------------
public void salesIdLookup(FormStringControl SalesOrderLookup)
{
Query query = new Query(Querystr(ASAP_VATDocumentation));
QueryBuildDataSource qbdsSO;
container cnt;
SysLookupMultiSelectGrid SysLookupMultiSelectGrid;
;
if(dialogCustId.value())
{
query.dataSourceTable(tableNum(SalesTable)).addRange(fieldNum(SalesTable, CustAccount)).value(dialogCustId.value());
query.dataSourceTable(tableNum(SalesTable)).addRange(RangeStatus::Locked);
if (SalesOrderLookup != null)
{
SysLookupMultiSelectGrid::lookup(query, SalesOrderLookup, SalesOrderLookup, cnt);
}
}
}
------------
public static void main(Args args)
{
ASAP_VATDocumentationDialogFields vatDocumentationDialogFields = new ASAP_VATDocumentationDialogFields();
;
vatDocumentationDialogFields.prompt();
vatDocumentationDialogFields.run();
}
Form Fields Controls And Lookups
public class FormRun extends ObjectRun
{
ASAP_VATHeader tmpHeader;
QueryBuildRange qrDocumentNum;
}
---------
public void init()
{
#Admin
UserInfo userInfo, userInfoAdmin;
SecurityUserRole userRole;
SecurityRole securityRole;
super();
select userRole
where userRole.User == curUserId()
join securityRole
where userRole.SecurityRole == securityrole.RecId && (securityRole.AotName == 'LedgerAccountant' || securityRole.AotName == '-SYSADMIN-');
if( securityRole.AotName == 'LedgerAccountant' || securityRole.AotName == '-SYSADMIN-' )
{
EditButton.visible(true);
}
else
{
//EditButton.visible(isSystemAdministrator());
EditButton.visible(false);
}
tmpHeader = element.args().record();
}
---------
public void executeQuery()
{
qrDocumentNum.value(DocumentNumberFilter.valueStr());
super();
}
--------
public void init()
{
super();
qrDocumentNum =this.query().dataSourceNo(1).addRange(fieldNum(ASAP_VATHeader,DocumentNum));
// qrDocumentNum =this.query().dataSourceNo(1).addRange(fieldNum(ASAP_VATHeader,DocumentNum));
}
-----------
public int active()
{
int ret;
Name docNo;
ret = super();
if(ASAP_VATHeader.SaveLine == NoYes::No)
{
SaveButton.enabled(true);
ASAP_VATLine_ds.allowEdit(true);
}
else
{
SaveButton.enabled(false);
ASAP_VATLine_ds.allowEdit(false);
}
//for CustAccount/Name
docNo = ASAP_VATHeader.DocumentNum;
custAccount.text(ASAP_VATHeader::find(docNo).CustAccount);
custName.text(ASAP_VATHeader::find(docNo).CustName);
//ASAP_VATLine_ds.research();
//ASAP_VATHeader_DocumentNum.enabled(true);
// ASAP_VATHeader_DocumentNum.allowEdit(true);
return ret;
}
-----------
public int active()
{
int ret;
ASAP_VATHeader _header;
ret = super();
select _header where _header.DocumentNum == ASAP_VATLine.DocumentNum ;
if(ASAP_VATHeader.SaveLine == NoYes::yes)// curUserId() != 'ADMIN')
{
ASAP_VATLine_ds.allowEdit(false);
ASAP_VATLine_ds.allowDelete(false);
ASAP_VATLine_ds.allowCreate(false);
}
else
{
ASAP_VATLine_ds.allowEdit(true);
ASAP_VATLine_ds.allowDelete(true);
ASAP_VATLine_ds.allowCreate(true);
}
//ASAP_VATHeader_DocumentNum.allowEdit(false);
return ret;
}
-------------
public void lookup()
{
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(ASAP_VATHeader), this);
Query query = new Query();
QueryBuildDataSource qbds;
QueryBuildRange qbr;
;
qbds = query.addDataSource(tablenum(ASAP_VATHeader));
sysTableLookup.addLookupfield(fieldnum(ASAP_VATHeader, DocumentNum ));
sysTableLookup.addLookupfield(fieldnum(ASAP_VATHeader, CustAccount ));
//qbds.clearRange(fieldNum(ASAP_VATHeader, DocumentNum ));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
--------------
public boolean modified()
{
boolean ret;
ret = super();
ASAP_VATLine_ds.research();
return ret;
}
--------------
public boolean modified()
{
boolean ret;
ret = super();
ASAP_VATHeader_ds.executeQuery();
ASAP_VATLine_ds.executeQuery();
return ret;
}
------------
void clicked()
{
super();
tmpHeader.data(ASAP_VATHeader);
select forUpdate ASAP_VATHeader where
ASAP_VATHeader.DocumentNum == ASAP_VATLine.DocumentNum;
{
ASAP_VATHeader.SaveLine = NoYes::No;
}
ASAP_VATHeader_ds.executeQuery();
ASAP_VATHeader_ds.findRecord(tmpHeader);
ASAP_VATHeader_ds.setCurrent();
}
------------
void clicked()
{
Dialog dialog;
DialogField dialogText;
super();
tmpHeader.data(ASAP_VATHeader);
dialog = new Dialog("VAT Details Confirmation");
dialog.addText("Please enter CONFIRM (in upper-case) to continue with the Entered Values");
dialogText = dialog.addField(extendedTypeStr(IdentifierName),"@PYL5345", "@PYL5346");
dialog.run();
if(dialog.closedOK())
{
if ( strcmp( dialogText.value(), "CONFIRM" ) == 0 )
{
//if ( ASAP_VATHeader.validate() )
//{
ASAP_VATHeader.SaveLine = NoYes::Yes;
ASAP_VATHeader_ds.executeQuery();
ASAP_VATHeader_ds.findRecord(tmpHeader);
ASAP_VATHeader_ds.setCurrent();
// }
}
}
}
--------------
{
ASAP_VATHeader tmpHeader;
QueryBuildRange qrDocumentNum;
}
---------
public void init()
{
#Admin
UserInfo userInfo, userInfoAdmin;
SecurityUserRole userRole;
SecurityRole securityRole;
super();
select userRole
where userRole.User == curUserId()
join securityRole
where userRole.SecurityRole == securityrole.RecId && (securityRole.AotName == 'LedgerAccountant' || securityRole.AotName == '-SYSADMIN-');
if( securityRole.AotName == 'LedgerAccountant' || securityRole.AotName == '-SYSADMIN-' )
{
EditButton.visible(true);
}
else
{
//EditButton.visible(isSystemAdministrator());
EditButton.visible(false);
}
tmpHeader = element.args().record();
}
---------
public void executeQuery()
{
qrDocumentNum.value(DocumentNumberFilter.valueStr());
super();
}
--------
public void init()
{
super();
qrDocumentNum =this.query().dataSourceNo(1).addRange(fieldNum(ASAP_VATHeader,DocumentNum));
// qrDocumentNum =this.query().dataSourceNo(1).addRange(fieldNum(ASAP_VATHeader,DocumentNum));
}
-----------
public int active()
{
int ret;
Name docNo;
ret = super();
if(ASAP_VATHeader.SaveLine == NoYes::No)
{
SaveButton.enabled(true);
ASAP_VATLine_ds.allowEdit(true);
}
else
{
SaveButton.enabled(false);
ASAP_VATLine_ds.allowEdit(false);
}
//for CustAccount/Name
docNo = ASAP_VATHeader.DocumentNum;
custAccount.text(ASAP_VATHeader::find(docNo).CustAccount);
custName.text(ASAP_VATHeader::find(docNo).CustName);
//ASAP_VATLine_ds.research();
//ASAP_VATHeader_DocumentNum.enabled(true);
// ASAP_VATHeader_DocumentNum.allowEdit(true);
return ret;
}
-----------
public int active()
{
int ret;
ASAP_VATHeader _header;
ret = super();
select _header where _header.DocumentNum == ASAP_VATLine.DocumentNum ;
if(ASAP_VATHeader.SaveLine == NoYes::yes)// curUserId() != 'ADMIN')
{
ASAP_VATLine_ds.allowEdit(false);
ASAP_VATLine_ds.allowDelete(false);
ASAP_VATLine_ds.allowCreate(false);
}
else
{
ASAP_VATLine_ds.allowEdit(true);
ASAP_VATLine_ds.allowDelete(true);
ASAP_VATLine_ds.allowCreate(true);
}
//ASAP_VATHeader_DocumentNum.allowEdit(false);
return ret;
}
-------------
public void lookup()
{
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(ASAP_VATHeader), this);
Query query = new Query();
QueryBuildDataSource qbds;
QueryBuildRange qbr;
;
qbds = query.addDataSource(tablenum(ASAP_VATHeader));
sysTableLookup.addLookupfield(fieldnum(ASAP_VATHeader, DocumentNum ));
sysTableLookup.addLookupfield(fieldnum(ASAP_VATHeader, CustAccount ));
//qbds.clearRange(fieldNum(ASAP_VATHeader, DocumentNum ));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
--------------
public boolean modified()
{
boolean ret;
ret = super();
ASAP_VATLine_ds.research();
return ret;
}
--------------
public boolean modified()
{
boolean ret;
ret = super();
ASAP_VATHeader_ds.executeQuery();
ASAP_VATLine_ds.executeQuery();
return ret;
}
------------
void clicked()
{
super();
tmpHeader.data(ASAP_VATHeader);
select forUpdate ASAP_VATHeader where
ASAP_VATHeader.DocumentNum == ASAP_VATLine.DocumentNum;
{
ASAP_VATHeader.SaveLine = NoYes::No;
}
ASAP_VATHeader_ds.executeQuery();
ASAP_VATHeader_ds.findRecord(tmpHeader);
ASAP_VATHeader_ds.setCurrent();
}
------------
void clicked()
{
Dialog dialog;
DialogField dialogText;
super();
tmpHeader.data(ASAP_VATHeader);
dialog = new Dialog("VAT Details Confirmation");
dialog.addText("Please enter CONFIRM (in upper-case) to continue with the Entered Values");
dialogText = dialog.addField(extendedTypeStr(IdentifierName),"@PYL5345", "@PYL5346");
dialog.run();
if(dialog.closedOK())
{
if ( strcmp( dialogText.value(), "CONFIRM" ) == 0 )
{
//if ( ASAP_VATHeader.validate() )
//{
ASAP_VATHeader.SaveLine = NoYes::Yes;
ASAP_VATHeader_ds.executeQuery();
ASAP_VATHeader_ds.findRecord(tmpHeader);
ASAP_VATHeader_ds.setCurrent();
// }
}
}
}
--------------
Customer Excel Export Based on Dialog Window Parameter
class ASAPG_CustomerListReport
{
Dialog dialog;
str ID;
DialogField dialogCountryCode;
DialogGroup dialogGroup;
DialogField dialogField,dialogField1;
DialogRunbase dialogRunbase;
}
-----------
public void CountryCodeLookup(FormStringControl control)
{
//boolean ret;
//Query query = new Query();
//QueryBuildDataSource queryBuildDataSource;
//QueryBuildRange queryBuildRange;
//;
dialogField1 = dialog.addField(extendedTypeStr(LogisticsAddressCountryRegionId));
}
----------
public void run()
{
SysExcelApplication xlsApplication;
SysExcelWorkBooks xlsWorkBookCollection;
SysExcelWorkBook xlsWorkBook;
SysExcelWorkSheets xlsWorkSheetCollection;
SysExcelWorkSheet xlsWorkSheet;
SysExcelRange xlsRange;
CustTable custTable, _custTablenow;
int row = 1;
Name fileName , phoneNum , emailAddr , teleFax , faxNum,var1,var2,var3;
str phonedesc , emailAddrdesc , teleFaxdesc , faxNumdesc,descrp1,descrp2,descrp3;
str type1,type2,type3,type4,type5,type6;
container contactInfo,ContactInfoDes,typeCon;
int counter, counter1d ;
RecId localCustRecid;
Name countryReg;
DirPartyLocation dirPartyLocation;
LogisticsElectronicAddress logisticsElectronicAddress;
;
fileName = "C:\\CustomerList.xlsx";
xlsApplication = SysExcelApplication::construct();
xlsWorkBookCollection = xlsApplication.workbooks();
xlsWorkBook = xlsWorkBookCollection.add();
xlsWorkSheetCollection = xlsWorkBook.worksheets();
xlsWorkSheet = xlsWorkSheetCollection.itemFromNum(1);
dialogRunbase = this.showDialog();
if(dialogRunbase.run())
{
ID = dialogCountryCode.value();
if(!ID)
throw error("Enter Country Region ID");
while select custTable // where custTable.AccountNum == '2332'
{
countryReg = custTable.countryRegionId();
if(countryReg == ID )
{
_custTablenow = CustTable::find(custTable.AccountNum);
while select dirPartyLocation
where dirPartyLocation.Party ==custTable.Party
join logisticsElectronicAddress where logisticsElectronicAddress.Location == dirPartyLocation.Location
if(logisticsElectronicAddress)
{
contactInfo += logisticsElectronicAddress.Locator;
ContactInfoDes += logisticsElectronicAddress.Description;
// typeCon += enum2str(logisticsElectronicAddress.Type);
for(counter=1 ; counter<=conLen(contactInfo);counter++)
{
//info(conPeek(contactInfo,counter));
phoneNum = conPeek(contactInfo,1);
faxNum = conPeek(contactInfo,2);
emailAddr = conPeek(contactInfo,3);
var1 = conPeek(contactInfo,4);
var2 = conPeek(contactInfo,5);
var3 = conPeek(contactInfo,6);
}
for(counter1d=1 ; counter1d<=conLen(ContactInfoDes);counter1d++)
{
// info(conPeek(ContactInfoDes,counter1d));
phonedesc = conPeek(ContactInfoDes,1);
faxNumdesc = conPeek(ContactInfoDes,2);
emailAddrdesc = conPeek(ContactInfoDes,3);
descrp1 = conPeek(ContactInfoDes,4);
descrp2 = conPeek(ContactInfoDes,5);
descrp3 = conPeek(ContactInfoDes,6);
}
}
//Actual data here**
xlsWorkSheet.cells().item(row,1).value(custTable.AccountNum);
xlsWorkSheet.cells().item(row,2).value(custTable.name());
xlsWorkSheet.cells().item(row,3).value(custTable.address());
xlsWorkSheet.cells().item(row,4).value(custTable.countryRegionId());
xlsWorkSheet.cells().item(row,5).value(phoneNum);
xlsWorkSheet.cells().item(row,6).value(faxNum);
xlsWorkSheet.cells().item(row,7).value(emailAddr);
xlsWorkSheet.cells().item(row,8).value(var1);
xlsWorkSheet.cells().item(row,9).value(var2);
xlsWorkSheet.cells().item(row,10).value(var3);
xlsWorkSheet.cells().item(row,11).value(phonedesc);
xlsWorkSheet.cells().item(row,12).value(faxNumdesc);
xlsWorkSheet.cells().item(row,13).value(emailAddrdesc);
xlsWorkSheet.cells().item(row,14).value(descrp1);
xlsWorkSheet.cells().item(row,15).value(descrp2);
xlsWorkSheet.cells().item(row,16).value(descrp3);
row++;
phoneNum = '';
faxNum = '';
emailAddr = '';
var1 ='';
var2 ='';
var3 = '';
phonedesc ='';
faxNumdesc ='';
emailAddrdesc ='';
descrp1 = '';
descrp2 ='';
descrp3 ='';
contactInfo = conNull();
ContactInfoDes = conNull();
}
}
//Check whether the document already exists
if(WinApi::fileExists(fileName))
WinApi::deleteFile(fileName);
//Save Excel document
xlsWorkbook.saveAs(fileName);
//Open Excel document
xlsApplication.visible(true);
info(strfmt("Total no of rows exported %1", row));
}
}
{
Dialog dialog;
str ID;
DialogField dialogCountryCode;
DialogGroup dialogGroup;
DialogField dialogField,dialogField1;
DialogRunbase dialogRunbase;
}
-----------
public void CountryCodeLookup(FormStringControl control)
{
//boolean ret;
//Query query = new Query();
//QueryBuildDataSource queryBuildDataSource;
//QueryBuildRange queryBuildRange;
//;
dialogField1 = dialog.addField(extendedTypeStr(LogisticsAddressCountryRegionId));
}
----------
public void run()
{
SysExcelApplication xlsApplication;
SysExcelWorkBooks xlsWorkBookCollection;
SysExcelWorkBook xlsWorkBook;
SysExcelWorkSheets xlsWorkSheetCollection;
SysExcelWorkSheet xlsWorkSheet;
SysExcelRange xlsRange;
CustTable custTable, _custTablenow;
int row = 1;
Name fileName , phoneNum , emailAddr , teleFax , faxNum,var1,var2,var3;
str phonedesc , emailAddrdesc , teleFaxdesc , faxNumdesc,descrp1,descrp2,descrp3;
str type1,type2,type3,type4,type5,type6;
container contactInfo,ContactInfoDes,typeCon;
int counter, counter1d ;
RecId localCustRecid;
Name countryReg;
DirPartyLocation dirPartyLocation;
LogisticsElectronicAddress logisticsElectronicAddress;
;
fileName = "C:\\CustomerList.xlsx";
xlsApplication = SysExcelApplication::construct();
xlsWorkBookCollection = xlsApplication.workbooks();
xlsWorkBook = xlsWorkBookCollection.add();
xlsWorkSheetCollection = xlsWorkBook.worksheets();
xlsWorkSheet = xlsWorkSheetCollection.itemFromNum(1);
dialogRunbase = this.showDialog();
if(dialogRunbase.run())
{
ID = dialogCountryCode.value();
if(!ID)
throw error("Enter Country Region ID");
while select custTable // where custTable.AccountNum == '2332'
{
countryReg = custTable.countryRegionId();
if(countryReg == ID )
{
_custTablenow = CustTable::find(custTable.AccountNum);
while select dirPartyLocation
where dirPartyLocation.Party ==custTable.Party
join logisticsElectronicAddress where logisticsElectronicAddress.Location == dirPartyLocation.Location
if(logisticsElectronicAddress)
{
contactInfo += logisticsElectronicAddress.Locator;
ContactInfoDes += logisticsElectronicAddress.Description;
// typeCon += enum2str(logisticsElectronicAddress.Type);
for(counter=1 ; counter<=conLen(contactInfo);counter++)
{
//info(conPeek(contactInfo,counter));
phoneNum = conPeek(contactInfo,1);
faxNum = conPeek(contactInfo,2);
emailAddr = conPeek(contactInfo,3);
var1 = conPeek(contactInfo,4);
var2 = conPeek(contactInfo,5);
var3 = conPeek(contactInfo,6);
}
for(counter1d=1 ; counter1d<=conLen(ContactInfoDes);counter1d++)
{
// info(conPeek(ContactInfoDes,counter1d));
phonedesc = conPeek(ContactInfoDes,1);
faxNumdesc = conPeek(ContactInfoDes,2);
emailAddrdesc = conPeek(ContactInfoDes,3);
descrp1 = conPeek(ContactInfoDes,4);
descrp2 = conPeek(ContactInfoDes,5);
descrp3 = conPeek(ContactInfoDes,6);
}
}
//Actual data here**
xlsWorkSheet.cells().item(row,1).value(custTable.AccountNum);
xlsWorkSheet.cells().item(row,2).value(custTable.name());
xlsWorkSheet.cells().item(row,3).value(custTable.address());
xlsWorkSheet.cells().item(row,4).value(custTable.countryRegionId());
xlsWorkSheet.cells().item(row,5).value(phoneNum);
xlsWorkSheet.cells().item(row,6).value(faxNum);
xlsWorkSheet.cells().item(row,7).value(emailAddr);
xlsWorkSheet.cells().item(row,8).value(var1);
xlsWorkSheet.cells().item(row,9).value(var2);
xlsWorkSheet.cells().item(row,10).value(var3);
xlsWorkSheet.cells().item(row,11).value(phonedesc);
xlsWorkSheet.cells().item(row,12).value(faxNumdesc);
xlsWorkSheet.cells().item(row,13).value(emailAddrdesc);
xlsWorkSheet.cells().item(row,14).value(descrp1);
xlsWorkSheet.cells().item(row,15).value(descrp2);
xlsWorkSheet.cells().item(row,16).value(descrp3);
row++;
phoneNum = '';
faxNum = '';
emailAddr = '';
var1 ='';
var2 ='';
var3 = '';
phonedesc ='';
faxNumdesc ='';
emailAddrdesc ='';
descrp1 = '';
descrp2 ='';
descrp3 ='';
contactInfo = conNull();
ContactInfoDes = conNull();
}
}
//Check whether the document already exists
if(WinApi::fileExists(fileName))
WinApi::deleteFile(fileName);
//Save Excel document
xlsWorkbook.saveAs(fileName);
//Open Excel document
xlsApplication.visible(true);
info(strfmt("Total no of rows exported %1", row));
}
}
------------------
Dialog showDialog()
{
FormRun formRun;
FormStringControl ctrlCountryCodeId;
DialogWindow dialogWindow;
;
dialog = new Dialog();
dialog.addText("Customer Information:");
dialogGroup = dialog.addGroup("Country Region Code");
dialogGroup.caption("Enter Country Code Details");
dialogCountryCode = dialog.addField(extendedTypeStr(LogisticsAddressCountryRegionId));
dialogCountryCode.displayLength(15);
dialog.run(true);
return dialog;
}
-----------------------
public static void main(Args args)
{
ASAPG_CustomerListReport customerListReport = new ASAPG_CustomerListReport();
;
customerListReport.run();
}
Last Year Closing Balance for the Brand ( Stock ) Value
//Last year CLosing Balance
select _BrandWiseStockValues
where _BrandWiseStockValues.StockDate == LastYearClosing && _BrandWiseStockValues.BrandName == brandMasterTable.Brand;
if(_BrandWiseStockValues)
{
globalTable.LastYrDate = LastYearClosing;
globalTable.LastYearClosingBalance = _BrandWiseStockValues.StockAmount;
}
else
{
select crossCompany InventTable
GROUP BY InventTable.ItemType, EcoResStorageDimensionGroupItem.StorageDimensionGroup, InventTable.OGSBrand
where inventTable.ItemType != ItemType::Service && inventTable.OGSBrand == brandMasterTable.Brand
OUTER JOIN EcoResStorageDimensionGroupItem
where InventTable.ItemId == EcoResStorageDimensionGroupItem.ItemId && InventTable.dataAreaId == EcoResStorageDimensionGroupItem.ItemDataAreaId
JOIN SUM(Qty), SUM(Amount) FROM InventValueReportView
where InventTable.ItemId == InventValueReportView.ItemId && InventValueReportView.InventTransPostingType == InventTransPostingType::Financial
&& InventValueReportView.TransDate > LastYearClosing && InventValueReportView.TransDate <= _todate
JOIN InventDim
where InventValueReportView.InventDimId == InventDim.inventDimId;
{
globalTable.LastYearClosingBalance += InventValueReportView.Amount * -1;
globalTable.LastYrDate = LastYearClosing;
}
if(globalTable.LastYearClosingBalance)
{
BrandWiseStockValues.clear();
BrandWiseStockValues.BrandName = brandMasterTable.Brand;
BrandWiseStockValues.StockDate = LastYearClosing;
BrandWiseStockValues.StockAmount = globalTable.LastYearClosingBalance;
BrandWiseStockValues.insert();
}
}
select _BrandWiseStockValues
where _BrandWiseStockValues.StockDate == LastYearClosing && _BrandWiseStockValues.BrandName == brandMasterTable.Brand;
if(_BrandWiseStockValues)
{
globalTable.LastYrDate = LastYearClosing;
globalTable.LastYearClosingBalance = _BrandWiseStockValues.StockAmount;
}
else
{
select crossCompany InventTable
GROUP BY InventTable.ItemType, EcoResStorageDimensionGroupItem.StorageDimensionGroup, InventTable.OGSBrand
where inventTable.ItemType != ItemType::Service && inventTable.OGSBrand == brandMasterTable.Brand
OUTER JOIN EcoResStorageDimensionGroupItem
where InventTable.ItemId == EcoResStorageDimensionGroupItem.ItemId && InventTable.dataAreaId == EcoResStorageDimensionGroupItem.ItemDataAreaId
JOIN SUM(Qty), SUM(Amount) FROM InventValueReportView
where InventTable.ItemId == InventValueReportView.ItemId && InventValueReportView.InventTransPostingType == InventTransPostingType::Financial
&& InventValueReportView.TransDate > LastYearClosing && InventValueReportView.TransDate <= _todate
JOIN InventDim
where InventValueReportView.InventDimId == InventDim.inventDimId;
{
globalTable.LastYearClosingBalance += InventValueReportView.Amount * -1;
globalTable.LastYrDate = LastYearClosing;
}
if(globalTable.LastYearClosingBalance)
{
BrandWiseStockValues.clear();
BrandWiseStockValues.BrandName = brandMasterTable.Brand;
BrandWiseStockValues.StockDate = LastYearClosing;
BrandWiseStockValues.StockAmount = globalTable.LastYearClosingBalance;
BrandWiseStockValues.insert();
}
}
Same Date Running Again After Closing Report .. It Will Excute Quick from Stagging Table
select _BrandWiseStockValues
where _BrandWiseStockValues.StockDate == LastOfMth1 && _BrandWiseStockValues.BrandName == brandMasterTable.Brand;
if(_BrandWiseStockValues)
{
globalTable.BrandStockDate_1 = startOfMth1;
globalTable.StockAmount_1 = _BrandWiseStockValues.StockAmount;
}
else
{
select crossCompany InventTable
GROUP BY InventTable.ItemType, EcoResStorageDimensionGroupItem.StorageDimensionGroup, InventTable.OGSBrand
where inventTable.ItemType != ItemType::Service && inventTable.OGSBrand == brandMasterTable.Brand
OUTER JOIN EcoResStorageDimensionGroupItem
where InventTable.ItemId == EcoResStorageDimensionGroupItem.ItemId && InventTable.dataAreaId == EcoResStorageDimensionGroupItem.ItemDataAreaId
JOIN SUM(Qty), SUM(Amount) FROM InventValueReportView
where InventTable.ItemId == InventValueReportView.ItemId && InventValueReportView.InventTransPostingType == InventTransPostingType::Financial
&& InventValueReportView.TransDate > LastOfMth1 && InventValueReportView.TransDate <= _todate
JOIN InventDim
where InventValueReportView.InventDimId == InventDim.inventDimId;
{
globalTable.StockAmount_1 += InventValueReportView.Amount * -1;
globalTable.BrandStockDate_1 = startOfMth1;
}
if(globalTable.StockAmount_1)
{
BrandWiseStockValues.clear();
BrandWiseStockValues.BrandName = brandMasterTable.Brand;
BrandWiseStockValues.StockDate = LastOfMth1;
BrandWiseStockValues.StockAmount = globalTable.StockAmount_1;
BrandWiseStockValues.insert();
}
}
where _BrandWiseStockValues.StockDate == LastOfMth1 && _BrandWiseStockValues.BrandName == brandMasterTable.Brand;
if(_BrandWiseStockValues)
{
globalTable.BrandStockDate_1 = startOfMth1;
globalTable.StockAmount_1 = _BrandWiseStockValues.StockAmount;
}
else
{
select crossCompany InventTable
GROUP BY InventTable.ItemType, EcoResStorageDimensionGroupItem.StorageDimensionGroup, InventTable.OGSBrand
where inventTable.ItemType != ItemType::Service && inventTable.OGSBrand == brandMasterTable.Brand
OUTER JOIN EcoResStorageDimensionGroupItem
where InventTable.ItemId == EcoResStorageDimensionGroupItem.ItemId && InventTable.dataAreaId == EcoResStorageDimensionGroupItem.ItemDataAreaId
JOIN SUM(Qty), SUM(Amount) FROM InventValueReportView
where InventTable.ItemId == InventValueReportView.ItemId && InventValueReportView.InventTransPostingType == InventTransPostingType::Financial
&& InventValueReportView.TransDate > LastOfMth1 && InventValueReportView.TransDate <= _todate
JOIN InventDim
where InventValueReportView.InventDimId == InventDim.inventDimId;
{
globalTable.StockAmount_1 += InventValueReportView.Amount * -1;
globalTable.BrandStockDate_1 = startOfMth1;
}
if(globalTable.StockAmount_1)
{
BrandWiseStockValues.clear();
BrandWiseStockValues.BrandName = brandMasterTable.Brand;
BrandWiseStockValues.StockDate = LastOfMth1;
BrandWiseStockValues.StockAmount = globalTable.StockAmount_1;
BrandWiseStockValues.insert();
}
}
Brand Stock Value Purchased Summary
static void BrandStockValue_Purchased(Args _args)
{
ASAPG_BrandWiseValues globalTable ;
ASAPG_BrandNameMaster brandMasterTable;
Date _today,_lastMonth;
VendInvoiceJour vendInvoiceJour;
VendInvoiceTrans vendInvoiceTrans;
InventTable inventTable;
TransDate startOfMth1,LastOfMth1;
TransDate asonDate = mkDate(11,04,2017); //today();
_today = asOnDate ;
_lastMonth = prevMth(_today );
startOfMth1 = dateStartMth(_lastMonth );
LastOfMth1 = endmth(_lastMonth);
while select brandMasterTable where brandMasterTable.Brand == 'RBI'
{
select sum(LineAmount) from vendInvoiceTrans
where vendInvoiceTrans.InvoiceDate >= startOfMth1 && vendInvoiceTrans.InvoiceDate <= LastOfMth1
join vendInvoiceJour
where vendInvoiceTrans.PurchID == vendInvoiceJour.PurchId && vendInvoiceTrans.InvoiceId == vendInvoiceJour.InvoiceId
&& vendInvoiceTrans.InvoiceDate == vendInvoiceJour.InvoiceDate && vendInvoiceTrans.numberSequenceGroup == vendInvoiceJour.numberSequenceGroup
&& vendInvoiceJour.VendGroup != 'GROUP'
join inventTable
where vendInvoiceTrans.ItemId == inventTable.ItemId
&& inventTable.OGSBrand == brandMasterTable.Brand;
globalTable.SalesAmount_1 = vendInvoiceTrans.LineAmount;
info(strFmt("Brand %1 - Amount %2", brandMasterTable.Brand, vendInvoiceTrans.LineAmount));
}
}
{
ASAPG_BrandWiseValues globalTable ;
ASAPG_BrandNameMaster brandMasterTable;
Date _today,_lastMonth;
VendInvoiceJour vendInvoiceJour;
VendInvoiceTrans vendInvoiceTrans;
InventTable inventTable;
TransDate startOfMth1,LastOfMth1;
TransDate asonDate = mkDate(11,04,2017); //today();
_today = asOnDate ;
_lastMonth = prevMth(_today );
startOfMth1 = dateStartMth(_lastMonth );
LastOfMth1 = endmth(_lastMonth);
while select brandMasterTable where brandMasterTable.Brand == 'RBI'
{
select sum(LineAmount) from vendInvoiceTrans
where vendInvoiceTrans.InvoiceDate >= startOfMth1 && vendInvoiceTrans.InvoiceDate <= LastOfMth1
join vendInvoiceJour
where vendInvoiceTrans.PurchID == vendInvoiceJour.PurchId && vendInvoiceTrans.InvoiceId == vendInvoiceJour.InvoiceId
&& vendInvoiceTrans.InvoiceDate == vendInvoiceJour.InvoiceDate && vendInvoiceTrans.numberSequenceGroup == vendInvoiceJour.numberSequenceGroup
&& vendInvoiceJour.VendGroup != 'GROUP'
join inventTable
where vendInvoiceTrans.ItemId == inventTable.ItemId
&& inventTable.OGSBrand == brandMasterTable.Brand;
globalTable.SalesAmount_1 = vendInvoiceTrans.LineAmount;
info(strFmt("Brand %1 - Amount %2", brandMasterTable.Brand, vendInvoiceTrans.LineAmount));
}
}
Brand Stock Values Sold Summary
static void BrandStockValue_Sold(Args _args)
{
ASAPG_BrandWiseValues globalTable ;
ASAPG_BrandNameMaster brandMasterTable;
Date _today,_lastMonth;
CustInvoiceJour custInvoiceJour;
CustInvoiceTrans custInvoiceTrans;
InventTable inventTable;
TransDate startOfMth1,LastOfMth1;
TransDate asonDate = mkDate(11,06,2018); //today();
_today = asOnDate ;
_lastMonth = prevMth(_today );
startOfMth1 = dateStartMth(_lastMonth );
LastOfMth1 = endmth(_lastMonth);
while select brandMasterTable where brandMasterTable.Brand == 'HAS'
{
select sum(LineAmount) from custInvoiceTrans
where custInvoiceTrans.InvoiceDate >= startOfMth1 && custInvoiceTrans.InvoiceDate <= LastOfMth1
join custInvoiceJour
where custInvoiceTrans.SalesId == custInvoiceJour.SalesId && custInvoiceTrans.InvoiceId == custInvoiceJour.InvoiceId
&& custInvoiceTrans.InvoiceDate == custInvoiceJour.InvoiceDate && custInvoiceTrans.numberSequenceGroup == custInvoiceJour.numberSequenceGroup
&& custInvoiceJour.CustGroup != 'ASAP-3000'
join inventTable
where custInvoiceTrans.ItemId == inventTable.ItemId
&& inventTable.OGSBrand == brandMasterTable.Brand;
globalTable.SalesAmount_1 = custInvoiceTrans.LineAmount;
info(strFmt("Brand %1 - Amount %2", brandMasterTable.Brand, custInvoiceTrans.LineAmount));
}
}
{
ASAPG_BrandWiseValues globalTable ;
ASAPG_BrandNameMaster brandMasterTable;
Date _today,_lastMonth;
CustInvoiceJour custInvoiceJour;
CustInvoiceTrans custInvoiceTrans;
InventTable inventTable;
TransDate startOfMth1,LastOfMth1;
TransDate asonDate = mkDate(11,06,2018); //today();
_today = asOnDate ;
_lastMonth = prevMth(_today );
startOfMth1 = dateStartMth(_lastMonth );
LastOfMth1 = endmth(_lastMonth);
while select brandMasterTable where brandMasterTable.Brand == 'HAS'
{
select sum(LineAmount) from custInvoiceTrans
where custInvoiceTrans.InvoiceDate >= startOfMth1 && custInvoiceTrans.InvoiceDate <= LastOfMth1
join custInvoiceJour
where custInvoiceTrans.SalesId == custInvoiceJour.SalesId && custInvoiceTrans.InvoiceId == custInvoiceJour.InvoiceId
&& custInvoiceTrans.InvoiceDate == custInvoiceJour.InvoiceDate && custInvoiceTrans.numberSequenceGroup == custInvoiceJour.numberSequenceGroup
&& custInvoiceJour.CustGroup != 'ASAP-3000'
join inventTable
where custInvoiceTrans.ItemId == inventTable.ItemId
&& inventTable.OGSBrand == brandMasterTable.Brand;
globalTable.SalesAmount_1 = custInvoiceTrans.LineAmount;
info(strFmt("Brand %1 - Amount %2", brandMasterTable.Brand, custInvoiceTrans.LineAmount));
}
}
BrandStockValue Summary
static void TestDebuggerJobForBrandStockValue(Args _args)
{
TransDate fromdate = mkDate(01,01,2017); //today();
TransDate todate = mkDate(31,01,2017); //today();
TransDate _todate = dateMax();
InventTable InventTable;
EcoResStorageDimensionGroupItem EcoResStorageDimensionGroupItem;
InventDim InventDim;
InventValueReportView InventValueReportView;
Amount amount;
qty qty;
while SELECT crossCompany InventTable
GROUP BY InventTable.ItemType, EcoResStorageDimensionGroupItem.StorageDimensionGroup, InventTable.OGSBrand
where inventTable.ItemType != ItemType::Service
OUTER JOIN EcoResStorageDimensionGroupItem
where InventTable.ItemId == EcoResStorageDimensionGroupItem.ItemId && InventTable.dataAreaId == EcoResStorageDimensionGroupItem.ItemDataAreaId
JOIN SUM(Qty), SUM(Amount) FROM InventValueReportView
where InventTable.ItemId == InventValueReportView.ItemId && InventValueReportView.InventTransPostingType == InventTransPostingType::Financial
&& InventValueReportView.TransDate > todate && InventValueReportView.TransDate <= _todate
JOIN InventDim
where InventValueReportView.InventDimId == InventDim.inventDimId
{
amount += InventValueReportView.Amount * -1;
qty += InventValueReportView.qty * -1;
info(strFmt("%1&%2&%3",InventTable.OGSBrand, InventValueReportView.Amount * -1, InventValueReportView.qty * -1));
}
info(strFmt("Amount %1 -- Qty %2", Amount,Qty));
}
{
TransDate fromdate = mkDate(01,01,2017); //today();
TransDate todate = mkDate(31,01,2017); //today();
TransDate _todate = dateMax();
InventTable InventTable;
EcoResStorageDimensionGroupItem EcoResStorageDimensionGroupItem;
InventDim InventDim;
InventValueReportView InventValueReportView;
Amount amount;
qty qty;
while SELECT crossCompany InventTable
GROUP BY InventTable.ItemType, EcoResStorageDimensionGroupItem.StorageDimensionGroup, InventTable.OGSBrand
where inventTable.ItemType != ItemType::Service
OUTER JOIN EcoResStorageDimensionGroupItem
where InventTable.ItemId == EcoResStorageDimensionGroupItem.ItemId && InventTable.dataAreaId == EcoResStorageDimensionGroupItem.ItemDataAreaId
JOIN SUM(Qty), SUM(Amount) FROM InventValueReportView
where InventTable.ItemId == InventValueReportView.ItemId && InventValueReportView.InventTransPostingType == InventTransPostingType::Financial
&& InventValueReportView.TransDate > todate && InventValueReportView.TransDate <= _todate
JOIN InventDim
where InventValueReportView.InventDimId == InventDim.inventDimId
{
amount += InventValueReportView.Amount * -1;
qty += InventValueReportView.qty * -1;
info(strFmt("%1&%2&%3",InventTable.OGSBrand, InventValueReportView.Amount * -1, InventValueReportView.qty * -1));
}
info(strFmt("Amount %1 -- Qty %2", Amount,Qty));
}
RDP Based Report With Dialog Controls
[
DataContractAttribute,
SysOperationContractProcessingAttribute(classstr(ASAP_DailyCashBookUIBuilder))
]
public class ASAP_DailyCashBookContract
{
TransDate transDate;
Integer aed1000,aed500,aed200,aed100,aed50,aed20,aed10,aed5,aed1,aed5Fills,aed25Fills,usdTotal,jpyTotal,othersTotal,closing,opening,expenses;
RealBaseRate rateUSD,rateEUR,rateOthers;
}
-----------
[
DataMemberAttribute('AED-1'),
SysOperationLabelAttribute(literalStr("1")),
SysOperationDisplayOrderAttribute("9")
]
public Integer parmAED1(Integer _aed1 = aed1)
{
aed1 = _aed1;
return aed1;
}
----------
[
DataMemberAttribute('AED-1000'),
SysOperationLabelAttribute(literalStr("1000")),
SysOperationDisplayOrderAttribute("1")
]
public Integer parmAED1000(Integer _aed1000 = aed1000)
{
aed1000 = _aed1000;
return aed1000;
}
---
[
DataMemberAttribute('AED-05Fills'),
SysOperationLabelAttribute(literalStr("0.50")),
SysOperationDisplayOrderAttribute("10")
]
public Integer parmAED5Fills(Integer _aed5Fills = aed5Fills)
{
aed5Fills = _aed5Fills;
return aed5Fills;
}
------------
[
DataMemberAttribute('AED-200'),
SysOperationLabelAttribute(literalStr("200")),
SysOperationDisplayOrderAttribute("3")
]
public Integer parmAED200(Integer _aed200 = aed200)
{
aed200 = _aed200;
return aed200;
}
--------
[
DataMemberAttribute('Closing'),
SysOperationLabelAttribute(literalStr("Closing"))
]
public Integer parmClosing(Integer _closing = closing)
{
closing = _closing;
return closing;
}
-----------
[
DataMemberAttribute('Expenses'),
SysOperationLabelAttribute(literalStr("Expenses"))
]
public Integer parmExpenses(Integer _expenses = expenses)
{
expenses = _expenses;
return expenses;
}
--
[
DataMemberAttribute('RateUSD'),
SysOperationLabelAttribute(literalStr("RateUSD"))
]
public RealBaseRate parmRateUSD(RealBaseRate _rateUSD = rateUSD)
{
rateUSD = _rateUSD;
return rateUSD;
}
------
[
DataMemberAttribute('Trans Date')
]
public TransDate parmTransDate(TransDate _transDate = transDate)
{
transDate = _transDate;
return transDate;
}
----------
[
DataMemberAttribute('RateEUR'),
SysOperationLabelAttribute(literalStr("RateEUR"))
]
public RealBaseRate parmRateEUR(RealBaseRate _rateEUR = rateEUR)
{
rateEUR = _rateEUR;
return rateEUR;
}
----------
Dp classs starting --------------
---------------------------------------
[
SRSReportParameterAttribute(classStr(ASAP_DailyCashBookContract))
]
public class ASAP_DailyCashBookDP extends SRSReportDataProviderBase
//SrsReportDataProviderPreProcessTempDB
//SrsReportDataProviderPreProcess
{
TransDate transDate;
ASAP_DailyCashBookContract contract;
ASAP_DailyCashReport DailyCashReport;
companyinfo companyinfo;
Bitmap companyImage;
AmountCur OpeningBalance, ClosingBalance;
LedgerJournalTable ledgerJournalTable;
LedgerJournalTrans ledgerJournalTrans;
GeneralJournalEntry generalJournalEntry;
GeneralJournalAccountEntry generalJournalAccountEntry;
MainAccount MainAccount;
CustInvoiceJour CustInvoiceJour;
salesTable salesTable;
Integer aed1000,aed500,aed200,aed100,aed50,aed20,aed10,aed5,aed1,aed5Fills,aed25Fills,usdTotal,jpyTotal,othersTotal,closing,opening,expenses;
RealBaseRate rateUSD,rateEUR,rateOthers;
}
------------
public AmountCur getOpeningBalace()
{
LedgerTrialBalanceListPageTmp _tmp;
Name _primaryFocus = 'Main account set';
FromDate _fromDate = transDate - 1;
ToDate _toDate = _fromDate;
boolean _includeOpening = false;
boolean _includeClosing = false;
OperationsTax _postingLayer = OperationsTax::Current;
boolean _showErrors = false;
LedgerTrialBalanceDP trialBalanceDP = new LedgerTrialBalanceDP();
LedgerTrialBalanceContract trialBalanceContract = new LedgerTrialBalanceContract();
LedgerTrialBalanceTmp trialBalanceTmp;
UserConnection userConn;
DimensionHierarchy dimHier;
AmountCur _OpeningBalance;
#define.ShowErrors(true)
dimHier = DimensionHierarchy::getMainAccountFocus();
select firstOnly RecId from _tmp;
delete_from _tmp;
DimensionFocusUpdateBalance::updateBalance(
DimensionHierarchy::findByTypeAndName(DimensionHierarchyType::Focus, _primaryFocus),
_showErrors);
userConn = new UserConnection();
trialBalanceTmp.setConnection(userConn);
_tmp.setConnection(userConn);
userConn.ttsbegin();
// Use the trial balance DP to generate a summary trial balance
trialBalanceContract.parmDetailSummary(DetailSummary::Summary);
trialBalanceContract.parmFromDate(_fromDate);
trialBalanceContract.parmToDate(_toDate);
trialBalanceContract.parmIncludeOpening(_includeOpening);
trialBalanceContract.parmIncludeClosing(_includeClosing);
trialBalanceContract.parmOperationsTax(_postingLayer);
trialBalanceContract.parmPrimaryDimensionFocus(_primaryFocus);
trialBalanceDP.parmDataContract(trialBalanceContract);
trialBalanceDP.parmUserConnection(userConn);
trialBalanceDP.processReport();
// Copy that data into the LedgerTrialBalanceListPageTmp, disabling RLS so the insert doesn't
// degrade to row-by-row
_tmp.recordLevelSecurity(false);
trialBalanceTmp = trialBalanceDP.getLedgerTrialBalanceTmp();
select trialBalanceTmp where trialBalanceTmp.PrimaryFocus == '1111001';
_OpeningBalance = trialBalanceTmp.EndingBalance;
_tmp.recordLevelSecurity(true);
userConn.ttsCommit();
return _OpeningBalance;
}
--------------------------------------
[
SRSReportDataSetAttribute(tableStr('ASAP_DailyCashReport'))
]
public ASAP_DailyCashReport getASAP_DailyCashReport()
{
select * from DailyCashReport;
return DailyCashReport;
}
-------
public void AdvancePaidDetails()
{
while select ledgerJournalTrans
join ledgerJournalTable
where ledgerJournalTable.JournalNum == ledgerJournalTrans.JournalNum
&& ledgerJournalTable.Posted == NoYes::No && ledgerJournalTable.JournalName == 'AV'
&& ledgerJournalTrans.TransDate == transDate && ledgerJournalTrans.AmountCurCredit && !ledgerJournalTrans.AmountCurDebit
{
DailyCashReport.Voucher = ledgerJournalTrans.Voucher;
DailyCashReport.TransDate = ledgerJournalTrans.TransDate;
DailyCashReport.AccountingCurrencyAmount = ledgerJournalTrans.AmountCurCredit;
DailyCashReport.TransAmount = abs(ledgerJournalTrans.AmountCurCredit);
DailyCashReport.Txt = ledgerJournalTrans.Txt;
DailyCashReport.DailyCashType = ASAP_DailyCashType::AdvancePaid;
DailyCashReport.Company = companyinfo.Name;
DailyCashReport.CompanyLogo = companyImage;
DailyCashReport.OpeningBalance = OpeningBalance;
DailyCashReport.ClosingBalance = ClosingBalance;
DailyCashReport.insert();
}
}
-----
private void AdvanceReceivedDetails()
{
while select ledgerJournalTrans
join ledgerJournalTable
where ledgerJournalTable.JournalNum == ledgerJournalTrans.JournalNum
&& ledgerJournalTable.Posted == NoYes::No && ledgerJournalTable.JournalName == 'AV'
&& ledgerJournalTrans.TransDate == transDate && !ledgerJournalTrans.AmountCurCredit && ledgerJournalTrans.AmountCurDebit
{
DailyCashReport.Voucher = ledgerJournalTrans.Voucher;
DailyCashReport.TransDate = ledgerJournalTrans.TransDate;
DailyCashReport.AccountingCurrencyAmount = ledgerJournalTrans.AmountCurDebit;
DailyCashReport.TransAmount = abs(ledgerJournalTrans.AmountCurDebit);
DailyCashReport.Txt = ledgerJournalTrans.Txt;
DailyCashReport.DailyCashType = ASAP_DailyCashType::AdvanceReceived;
DailyCashReport.Company = companyinfo.Name;
DailyCashReport.CompanyLogo = companyImage;
DailyCashReport.OpeningBalance = OpeningBalance;
DailyCashReport.ClosingBalance = ClosingBalance;
DailyCashReport.insert();
}
}
------
public void insertCreditSales_GroupCustomers()
{
SalesLine salesLine;
utcDateTime UtcPreviousDay, UtcNxtDay;
CustTable CustTable;
Description SalesIds, SalesIdFrst, SalesIdLst;
container displayFields;
AmountCur totalInvoiceAmount;
;
while select salesTable
order by salesTable.SalesId asc
where salesTable.SalesStatus ==SalesStatus::Invoiced
&& salesTable.Payment != "Cash" && salesTable.SalesType == SalesType::Sales
join CustTable
where CustTable.AccountNum == salesTable.CustAccount && CustTable.CustGroup == 'ASAP-3000'
join CustInvoiceJour
where CustInvoiceJour.SalesId == salesTable.SalesId
&& CustInvoiceJour.InvoiceDate == transDate
{
totalInvoiceAmount += salesTable.amountInvoiced();
if(SalesIdFrst == "")
SalesIdFrst = salesTable.SalesId;
else
SalesIdLst = salesTable.SalesId;
}
SalesIds = SalesIdFrst + " - " + SalesIdLst;
if(totalInvoiceAmount > 0)
{
DailyCashReport.Voucher = SalesIds;
DailyCashReport.TransDate = TransDate;
DailyCashReport.AccountingCurrencyAmount = totalInvoiceAmount;
DailyCashReport.TransAmount = abs(totalInvoiceAmount);
DailyCashReport.Txt = "Credit Sales";
DailyCashReport.DailyCashType = ASAP_DailyCashType::GroupCustomers;
DailyCashReport.Company = companyinfo.Name;
DailyCashReport.CompanyLogo = companyImage;
DailyCashReport.OpeningBalance = OpeningBalance;
DailyCashReport.ClosingBalance = ClosingBalance;
DailyCashReport.insert();
}
}
---------------
public void insertDailyCash()
{
;
ttsBegin;
this.ReceiptDetails();
this.PaymentDetails();
this.AdvancePaidDetails();
this.AdvanceReceivedDetails();
this.insertCreditSalesDetails();
this.insertCreditSales_GroupCustomers();
ttsCommit;
}
---------
public void PaymentDetails()
{
while select generalJournalEntry
where generalJournalEntry.AccountingDate == transDate
join generalJournalAccountEntry
where generalJournalAccountEntry.GeneralJournalEntry == generalJournalEntry.RecId
join MainAccount
where MainAccount.RecId == generalJournalAccountEntry.MainAccount
&& MainAccount.MainAccountId == '1111001'
exists join ledgerJournalTrans
where ledgerJournalTrans.Voucher == generalJournalEntry.SubledgerVoucher
join ledgerJournalTable
where ledgerJournalTable.JournalNum == ledgerJournalTrans.JournalNum
&& (ledgerJournalTable.JournalName == "PV" || ledgerJournalTable.JournalName == "CD" || ledgerJournalTable.JournalName == "InterCompany" )
{
DailyCashReport.Voucher = generalJournalEntry.SubledgerVoucher;
DailyCashReport.TransDate = generalJournalEntry.AccountingDate;
DailyCashReport.AccountingCurrencyAmount = generalJournalAccountEntry.AccountingCurrencyAmount;
DailyCashReport.TransAmount = abs(generalJournalAccountEntry.AccountingCurrencyAmount);
DailyCashReport.Txt = generalJournalAccountEntry.Text;
DailyCashReport.DailyCashType = ASAP_DailyCashType::Payment;
DailyCashReport.Company = companyinfo.Name;
DailyCashReport.CompanyLogo = companyImage;
DailyCashReport.OpeningBalance = OpeningBalance;
DailyCashReport.ClosingBalance = ClosingBalance;
DailyCashReport.insert();
}
while select salesTable
order by salesTable.SalesId asc
where salesTable.SalesStatus ==SalesStatus::Invoiced
&& salesTable.Payment == "Cash" && salesTable.SalesType == SalesType::ReturnItem
join CustInvoiceJour
where CustInvoiceJour.SalesId == salesTable.SalesId
&& CustInvoiceJour.InvoiceDate == transDate
{
DailyCashReport.Voucher = salesTable.SalesId;
DailyCashReport.TransDate = TransDate;
DailyCashReport.AccountingCurrencyAmount = salesTable.amountInvoiced();
DailyCashReport.TransAmount = abs(salesTable.amountInvoiced());
DailyCashReport.Txt = salestable::find(CustInvoiceJour.SalesId).customerName();
DailyCashReport.DailyCashType = ASAP_DailyCashType::Payment;
DailyCashReport.Company = companyinfo.Name;
DailyCashReport.CompanyLogo = companyImage;
DailyCashReport.OpeningBalance = OpeningBalance;
DailyCashReport.ClosingBalance = ClosingBalance;
DailyCashReport.insert();
}
}
-----------
public void ReceiptDetails()
{
while select generalJournalEntry
where generalJournalEntry.AccountingDate == transDate
join generalJournalAccountEntry
where generalJournalAccountEntry.GeneralJournalEntry == generalJournalEntry.RecId
join MainAccount
where MainAccount.RecId == generalJournalAccountEntry.MainAccount
&& MainAccount.MainAccountId == '1111001'
exists join ledgerJournalTrans
where ledgerJournalTrans.Voucher == generalJournalEntry.SubledgerVoucher
join ledgerJournalTable
where ledgerJournalTable.JournalNum == ledgerJournalTrans.JournalNum
&& ledgerJournalTable.JournalName == "RV"
{
DailyCashReport.Voucher = generalJournalEntry.SubledgerVoucher;
DailyCashReport.TransDate = generalJournalEntry.AccountingDate;
DailyCashReport.AccountingCurrencyAmount = generalJournalAccountEntry.AccountingCurrencyAmount;
DailyCashReport.TransAmount = abs(generalJournalAccountEntry.AccountingCurrencyAmount);
DailyCashReport.Txt = generalJournalAccountEntry.Text;
DailyCashReport.DailyCashType = ASAP_DailyCashType::Receipt;
DailyCashReport.Company = companyinfo.Name;
DailyCashReport.CompanyLogo = companyImage;
DailyCashReport.OpeningBalance = OpeningBalance;
DailyCashReport.ClosingBalance = ClosingBalance;
DailyCashReport.insert();
}
while select salesTable
order by salesTable.SalesId asc
where salesTable.SalesStatus ==SalesStatus::Invoiced
&& salesTable.Payment == "Cash" && salesTable.SalesType == SalesType::Sales
join CustInvoiceJour
where CustInvoiceJour.SalesId == salesTable.SalesId
&& CustInvoiceJour.InvoiceDate == transDate
{
DailyCashReport.Voucher = salesTable.SalesId;
DailyCashReport.TransDate = TransDate;
DailyCashReport.AccountingCurrencyAmount = salesTable.amountInvoiced();
DailyCashReport.TransAmount = abs(salesTable.amountInvoiced());
DailyCashReport.Txt = salestable::find(CustInvoiceJour.SalesId).customerName();
DailyCashReport.DailyCashType = ASAP_DailyCashType::Receipt;
DailyCashReport.Company = companyinfo.Name;
DailyCashReport.CompanyLogo = companyImage;
DailyCashReport.OpeningBalance = OpeningBalance;
DailyCashReport.ClosingBalance = ClosingBalance;
DailyCashReport.insert();
}
}
---------------
[SysEntryPointAttribute]
public void processReport()
{
contract = this.parmDataContract();
transDate = contract.parmTransDate();
aed1000 = contract.parmAED1000();
aed500 = contract.parmAED500();
aed200 = contract.parmAED200();
aed100 = contract.parmAED100();
aed50 = contract.parmAED50();
aed20 = contract.parmAED20();
aed10 = contract.parmAED10();
aed5 = contract.parmAED5();
aed1 = contract.parmAED1();
aed5Fills = contract.parmAED5Fills();
aed25Fills = contract.parmAED25Fills();
usdTotal = contract.parmUSDTotal();
jpytotal = contract.parmJPYTotal();
otherstotal = contract.parmOthersTotal();
rateUSD = contract.parmRateUSD();
rateEUR = contract.parmRateEUR();
rateOthers = contract.parmRateOthers();
opening = contract.parmOpening();
expenses = contract.parmExpenses();
closing = contract.parmClosing();
companyinfo = CompanyInfo::find();
CompanyImage = CompanyImage::find(companyInfo.DataAreaId, companyInfo.TableId, companyInfo.RecId).Image;
OpeningBalance = this.getOpeningBalace();
// added for no transcation means display only opening and closing balance in report on feb 10th 2018
DailyCashReport.OpeningBalance = OpeningBalance;
DailyCashReport.Company = companyinfo.Name;
DailyCashReport.insert();
// end
// breakpoint;
this.insertDailyCash();
}
------------------ dp class completed ..
class ASAP_DailyCashbookController extends SrsReportRunController
{
#define.reportName('ASAP_DailyCashReport.DailyCashRpt')
}
--
protected void prePromptModifyContract()
{
ASAP_DailyCashBookContract contract = this.parmReportContract().parmRdpContract() as ASAP_DailyCashBookContract;
super();
}
--
public boolean showQuerySelectButton(str parameterName)
{
return false;
}
--
public static void main(Args _args)
{
ASAP_DailyCashbookController controller = new ASAP_DailyCashbookController();
controller.parmReportName(#ReportName);
controller.parmArgs(_args);
controller.parmLoadFromSysLastValue(false);
controller.startOperation();
}
----------------------------------------
public class ASAP_DailyCashBookUIBuilder extends SrsReportDataContractUIBuilder
{
DialogField dialogTransDate;
DialogField dialogAED1000;
DialogField dialogAED500;
DialogField dialogAED200;
DialogField dialogAED100;
DialogField dialogAED50;
DialogField dialogAED20;
DialogField dialogAED10;
DialogField dialogAED5;
DialogField dialogAED1;
DialogField dialogAED05Fills;
DialogField dialogAED25Fills;
DialogField dialogUSD;
DialogField dialogJPY;
DialogField dialogOthers;
DialogField dialogRateUSD;
DialogField dialogRateEUR;
DialogField dialogRateOthers;
DialogField dialogOpening;
DialogField dialogClosing;
DialogField dialogExpenses;
ASAP_DailyCashBookContract contractLocal;
TransDate transDate;
Integer aed1000,aed500,aed200,aed100,aed50,aed20,aed10,aed5,aed1,aed5Fills,aed25Fills,usdTotal,jpyTotal,othersTotal,closing,opening,expenses;
RealBaseRate rateUSD,rateEUR,rateOthers;
}
---
public void build()
{
DialogGroup dlgGroup;
Dialog dlg;
dlg = this.dialog();
contractLocal = this.dataContractObject();
dlgGroup = dlg.addGroup("Trans Date");
dialogTransDate = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmTransDate),contractLocal);
// dialogTransDate.value("");
dlgGroup = dlg.addGroup("Local Currency");
dialogAED1000 = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmAED1000),contractLocal);
dialogAED1000.label("1000");
//dialogAED1000.value("");
dialogAED500 = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmAED500),contractLocal);
dialogAED500.label("500");
// dialogAED500.value("");
dialogAED200 = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmAED200),contractLocal);
dialogAED200.label("200");
//dialogAED200.value("");
dialogAED100 = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmAED100),contractLocal);
dialogAED100.label("100");
// dialogAED100.value("");
dialogAED50 = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmAED50),contractLocal);
dialogAED50.label("50");
// dialogAED50.value("");
dialogAED20 = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmAED20),contractLocal);
dialogAED20.label("20");
// dialogAED20.value("");
dialogAED10 = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmAED10),contractLocal);
dialogAED10.label("10");
// dialogAED10.value("");
dialogAED5 = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmAED5),contractLocal);
dialogAED5.label("5");
// dialogAED5.value("");
dialogAED1 = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmAED1),contractLocal);
dialogAED1.label("1");
// dialogAED1.value("");
dialogAED05Fills = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmAED5Fills),contractLocal);
// dialogAED05Fills.value("");
dialogAED25Fills = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmAED25Fills),contractLocal);
// dialogAED25Fills.value("");
dlgGroup = dlg.addGroup("USD");
dialogUSD = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmUSDTotal),contractLocal);
// dialogUSD.value("");
dialogRateUSD = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmRateUSD),contractLocal);
dialogRateUSD.label("Exchange rate");
// dialogRateUSD.value("");
dlgGroup = dlg.addGroup("EUR");
dialogJPY = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmJPYTotal),contractLocal);
dialogJPY.label("EUR");
// dialogJPY.value("");
dialogRateEUR = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmRateEUR),contractLocal);
dialogRateEUR.label("Exchange rate");
// dialogRateEUR.value("");
dlgGroup = dlg.addGroup("Others");
dialogOthers = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmOthersTotal),contractLocal);
// dialogOthers.value("");
dialogRateOthers = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmRateOthers),contractLocal);
dialogRateOthers.label("Exchange rate");
// dialogRateOthers.value("");
dlgGroup = dlg.addGroup("Petty Cash");
dialogOpening = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmOpening),contractLocal);
// dialogOpening.value("");
dialogExpenses = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmExpenses),contractLocal);
// dialogExpenses.value("");
dialogClosing = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmClosing),contractLocal);
// dialogClosing.value("");
}
--------
public void getFromDialog()
{
contractLocal = this.dataContractObject();
super();
}
--
public void postBuild()
{
super();
dialogTransDate = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmTransDate));
dialogAED1000 = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmAED1000));
dialogAED500 = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmAED500));
dialogAED200 = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmAED200));
dialogAED100 = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmAED100));
dialogAED50 = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmAED50));
dialogAED20 = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmAED20));
dialogAED10 = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmAED10));
dialogAED5 = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmAED5));
dialogAED1 = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmAED1));
dialogAED05Fills = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmAED5Fills));
dialogAED25Fills = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmAED25Fills));
dialogUSD = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmUSDTotal));
dialogJPY = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmJPYTotal));
dialogOthers = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmOthersTotal));
dialogRateUSD = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmRateUSD));
dialogRateEUR = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmRateEUR));
dialogRateOthers = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmRateOthers));
dialogOpening = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmOpening));
dialogExpenses = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmExpenses));
dialogClosing = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmClosing));
}
--------
public void postRun()
{
}
DataContractAttribute,
SysOperationContractProcessingAttribute(classstr(ASAP_DailyCashBookUIBuilder))
]
public class ASAP_DailyCashBookContract
{
TransDate transDate;
Integer aed1000,aed500,aed200,aed100,aed50,aed20,aed10,aed5,aed1,aed5Fills,aed25Fills,usdTotal,jpyTotal,othersTotal,closing,opening,expenses;
RealBaseRate rateUSD,rateEUR,rateOthers;
}
-----------
[
DataMemberAttribute('AED-1'),
SysOperationLabelAttribute(literalStr("1")),
SysOperationDisplayOrderAttribute("9")
]
public Integer parmAED1(Integer _aed1 = aed1)
{
aed1 = _aed1;
return aed1;
}
----------
[
DataMemberAttribute('AED-1000'),
SysOperationLabelAttribute(literalStr("1000")),
SysOperationDisplayOrderAttribute("1")
]
public Integer parmAED1000(Integer _aed1000 = aed1000)
{
aed1000 = _aed1000;
return aed1000;
}
---
[
DataMemberAttribute('AED-05Fills'),
SysOperationLabelAttribute(literalStr("0.50")),
SysOperationDisplayOrderAttribute("10")
]
public Integer parmAED5Fills(Integer _aed5Fills = aed5Fills)
{
aed5Fills = _aed5Fills;
return aed5Fills;
}
------------
[
DataMemberAttribute('AED-200'),
SysOperationLabelAttribute(literalStr("200")),
SysOperationDisplayOrderAttribute("3")
]
public Integer parmAED200(Integer _aed200 = aed200)
{
aed200 = _aed200;
return aed200;
}
--------
[
DataMemberAttribute('Closing'),
SysOperationLabelAttribute(literalStr("Closing"))
]
public Integer parmClosing(Integer _closing = closing)
{
closing = _closing;
return closing;
}
-----------
[
DataMemberAttribute('Expenses'),
SysOperationLabelAttribute(literalStr("Expenses"))
]
public Integer parmExpenses(Integer _expenses = expenses)
{
expenses = _expenses;
return expenses;
}
--
[
DataMemberAttribute('RateUSD'),
SysOperationLabelAttribute(literalStr("RateUSD"))
]
public RealBaseRate parmRateUSD(RealBaseRate _rateUSD = rateUSD)
{
rateUSD = _rateUSD;
return rateUSD;
}
------
[
DataMemberAttribute('Trans Date')
]
public TransDate parmTransDate(TransDate _transDate = transDate)
{
transDate = _transDate;
return transDate;
}
----------
[
DataMemberAttribute('RateEUR'),
SysOperationLabelAttribute(literalStr("RateEUR"))
]
public RealBaseRate parmRateEUR(RealBaseRate _rateEUR = rateEUR)
{
rateEUR = _rateEUR;
return rateEUR;
}
----------
Dp classs starting --------------
---------------------------------------
[
SRSReportParameterAttribute(classStr(ASAP_DailyCashBookContract))
]
public class ASAP_DailyCashBookDP extends SRSReportDataProviderBase
//SrsReportDataProviderPreProcessTempDB
//SrsReportDataProviderPreProcess
{
TransDate transDate;
ASAP_DailyCashBookContract contract;
ASAP_DailyCashReport DailyCashReport;
companyinfo companyinfo;
Bitmap companyImage;
AmountCur OpeningBalance, ClosingBalance;
LedgerJournalTable ledgerJournalTable;
LedgerJournalTrans ledgerJournalTrans;
GeneralJournalEntry generalJournalEntry;
GeneralJournalAccountEntry generalJournalAccountEntry;
MainAccount MainAccount;
CustInvoiceJour CustInvoiceJour;
salesTable salesTable;
Integer aed1000,aed500,aed200,aed100,aed50,aed20,aed10,aed5,aed1,aed5Fills,aed25Fills,usdTotal,jpyTotal,othersTotal,closing,opening,expenses;
RealBaseRate rateUSD,rateEUR,rateOthers;
}
------------
public AmountCur getOpeningBalace()
{
LedgerTrialBalanceListPageTmp _tmp;
Name _primaryFocus = 'Main account set';
FromDate _fromDate = transDate - 1;
ToDate _toDate = _fromDate;
boolean _includeOpening = false;
boolean _includeClosing = false;
OperationsTax _postingLayer = OperationsTax::Current;
boolean _showErrors = false;
LedgerTrialBalanceDP trialBalanceDP = new LedgerTrialBalanceDP();
LedgerTrialBalanceContract trialBalanceContract = new LedgerTrialBalanceContract();
LedgerTrialBalanceTmp trialBalanceTmp;
UserConnection userConn;
DimensionHierarchy dimHier;
AmountCur _OpeningBalance;
#define.ShowErrors(true)
dimHier = DimensionHierarchy::getMainAccountFocus();
select firstOnly RecId from _tmp;
delete_from _tmp;
DimensionFocusUpdateBalance::updateBalance(
DimensionHierarchy::findByTypeAndName(DimensionHierarchyType::Focus, _primaryFocus),
_showErrors);
userConn = new UserConnection();
trialBalanceTmp.setConnection(userConn);
_tmp.setConnection(userConn);
userConn.ttsbegin();
// Use the trial balance DP to generate a summary trial balance
trialBalanceContract.parmDetailSummary(DetailSummary::Summary);
trialBalanceContract.parmFromDate(_fromDate);
trialBalanceContract.parmToDate(_toDate);
trialBalanceContract.parmIncludeOpening(_includeOpening);
trialBalanceContract.parmIncludeClosing(_includeClosing);
trialBalanceContract.parmOperationsTax(_postingLayer);
trialBalanceContract.parmPrimaryDimensionFocus(_primaryFocus);
trialBalanceDP.parmDataContract(trialBalanceContract);
trialBalanceDP.parmUserConnection(userConn);
trialBalanceDP.processReport();
// Copy that data into the LedgerTrialBalanceListPageTmp, disabling RLS so the insert doesn't
// degrade to row-by-row
_tmp.recordLevelSecurity(false);
trialBalanceTmp = trialBalanceDP.getLedgerTrialBalanceTmp();
select trialBalanceTmp where trialBalanceTmp.PrimaryFocus == '1111001';
_OpeningBalance = trialBalanceTmp.EndingBalance;
_tmp.recordLevelSecurity(true);
userConn.ttsCommit();
return _OpeningBalance;
}
--------------------------------------
[
SRSReportDataSetAttribute(tableStr('ASAP_DailyCashReport'))
]
public ASAP_DailyCashReport getASAP_DailyCashReport()
{
select * from DailyCashReport;
return DailyCashReport;
}
-------
public void AdvancePaidDetails()
{
while select ledgerJournalTrans
join ledgerJournalTable
where ledgerJournalTable.JournalNum == ledgerJournalTrans.JournalNum
&& ledgerJournalTable.Posted == NoYes::No && ledgerJournalTable.JournalName == 'AV'
&& ledgerJournalTrans.TransDate == transDate && ledgerJournalTrans.AmountCurCredit && !ledgerJournalTrans.AmountCurDebit
{
DailyCashReport.Voucher = ledgerJournalTrans.Voucher;
DailyCashReport.TransDate = ledgerJournalTrans.TransDate;
DailyCashReport.AccountingCurrencyAmount = ledgerJournalTrans.AmountCurCredit;
DailyCashReport.TransAmount = abs(ledgerJournalTrans.AmountCurCredit);
DailyCashReport.Txt = ledgerJournalTrans.Txt;
DailyCashReport.DailyCashType = ASAP_DailyCashType::AdvancePaid;
DailyCashReport.Company = companyinfo.Name;
DailyCashReport.CompanyLogo = companyImage;
DailyCashReport.OpeningBalance = OpeningBalance;
DailyCashReport.ClosingBalance = ClosingBalance;
DailyCashReport.insert();
}
}
-----
private void AdvanceReceivedDetails()
{
while select ledgerJournalTrans
join ledgerJournalTable
where ledgerJournalTable.JournalNum == ledgerJournalTrans.JournalNum
&& ledgerJournalTable.Posted == NoYes::No && ledgerJournalTable.JournalName == 'AV'
&& ledgerJournalTrans.TransDate == transDate && !ledgerJournalTrans.AmountCurCredit && ledgerJournalTrans.AmountCurDebit
{
DailyCashReport.Voucher = ledgerJournalTrans.Voucher;
DailyCashReport.TransDate = ledgerJournalTrans.TransDate;
DailyCashReport.AccountingCurrencyAmount = ledgerJournalTrans.AmountCurDebit;
DailyCashReport.TransAmount = abs(ledgerJournalTrans.AmountCurDebit);
DailyCashReport.Txt = ledgerJournalTrans.Txt;
DailyCashReport.DailyCashType = ASAP_DailyCashType::AdvanceReceived;
DailyCashReport.Company = companyinfo.Name;
DailyCashReport.CompanyLogo = companyImage;
DailyCashReport.OpeningBalance = OpeningBalance;
DailyCashReport.ClosingBalance = ClosingBalance;
DailyCashReport.insert();
}
}
------
public void insertCreditSales_GroupCustomers()
{
SalesLine salesLine;
utcDateTime UtcPreviousDay, UtcNxtDay;
CustTable CustTable;
Description SalesIds, SalesIdFrst, SalesIdLst;
container displayFields;
AmountCur totalInvoiceAmount;
;
while select salesTable
order by salesTable.SalesId asc
where salesTable.SalesStatus ==SalesStatus::Invoiced
&& salesTable.Payment != "Cash" && salesTable.SalesType == SalesType::Sales
join CustTable
where CustTable.AccountNum == salesTable.CustAccount && CustTable.CustGroup == 'ASAP-3000'
join CustInvoiceJour
where CustInvoiceJour.SalesId == salesTable.SalesId
&& CustInvoiceJour.InvoiceDate == transDate
{
totalInvoiceAmount += salesTable.amountInvoiced();
if(SalesIdFrst == "")
SalesIdFrst = salesTable.SalesId;
else
SalesIdLst = salesTable.SalesId;
}
SalesIds = SalesIdFrst + " - " + SalesIdLst;
if(totalInvoiceAmount > 0)
{
DailyCashReport.Voucher = SalesIds;
DailyCashReport.TransDate = TransDate;
DailyCashReport.AccountingCurrencyAmount = totalInvoiceAmount;
DailyCashReport.TransAmount = abs(totalInvoiceAmount);
DailyCashReport.Txt = "Credit Sales";
DailyCashReport.DailyCashType = ASAP_DailyCashType::GroupCustomers;
DailyCashReport.Company = companyinfo.Name;
DailyCashReport.CompanyLogo = companyImage;
DailyCashReport.OpeningBalance = OpeningBalance;
DailyCashReport.ClosingBalance = ClosingBalance;
DailyCashReport.insert();
}
}
---------------
public void insertDailyCash()
{
;
ttsBegin;
this.ReceiptDetails();
this.PaymentDetails();
this.AdvancePaidDetails();
this.AdvanceReceivedDetails();
this.insertCreditSalesDetails();
this.insertCreditSales_GroupCustomers();
ttsCommit;
}
---------
public void PaymentDetails()
{
while select generalJournalEntry
where generalJournalEntry.AccountingDate == transDate
join generalJournalAccountEntry
where generalJournalAccountEntry.GeneralJournalEntry == generalJournalEntry.RecId
join MainAccount
where MainAccount.RecId == generalJournalAccountEntry.MainAccount
&& MainAccount.MainAccountId == '1111001'
exists join ledgerJournalTrans
where ledgerJournalTrans.Voucher == generalJournalEntry.SubledgerVoucher
join ledgerJournalTable
where ledgerJournalTable.JournalNum == ledgerJournalTrans.JournalNum
&& (ledgerJournalTable.JournalName == "PV" || ledgerJournalTable.JournalName == "CD" || ledgerJournalTable.JournalName == "InterCompany" )
{
DailyCashReport.Voucher = generalJournalEntry.SubledgerVoucher;
DailyCashReport.TransDate = generalJournalEntry.AccountingDate;
DailyCashReport.AccountingCurrencyAmount = generalJournalAccountEntry.AccountingCurrencyAmount;
DailyCashReport.TransAmount = abs(generalJournalAccountEntry.AccountingCurrencyAmount);
DailyCashReport.Txt = generalJournalAccountEntry.Text;
DailyCashReport.DailyCashType = ASAP_DailyCashType::Payment;
DailyCashReport.Company = companyinfo.Name;
DailyCashReport.CompanyLogo = companyImage;
DailyCashReport.OpeningBalance = OpeningBalance;
DailyCashReport.ClosingBalance = ClosingBalance;
DailyCashReport.insert();
}
while select salesTable
order by salesTable.SalesId asc
where salesTable.SalesStatus ==SalesStatus::Invoiced
&& salesTable.Payment == "Cash" && salesTable.SalesType == SalesType::ReturnItem
join CustInvoiceJour
where CustInvoiceJour.SalesId == salesTable.SalesId
&& CustInvoiceJour.InvoiceDate == transDate
{
DailyCashReport.Voucher = salesTable.SalesId;
DailyCashReport.TransDate = TransDate;
DailyCashReport.AccountingCurrencyAmount = salesTable.amountInvoiced();
DailyCashReport.TransAmount = abs(salesTable.amountInvoiced());
DailyCashReport.Txt = salestable::find(CustInvoiceJour.SalesId).customerName();
DailyCashReport.DailyCashType = ASAP_DailyCashType::Payment;
DailyCashReport.Company = companyinfo.Name;
DailyCashReport.CompanyLogo = companyImage;
DailyCashReport.OpeningBalance = OpeningBalance;
DailyCashReport.ClosingBalance = ClosingBalance;
DailyCashReport.insert();
}
}
-----------
public void ReceiptDetails()
{
while select generalJournalEntry
where generalJournalEntry.AccountingDate == transDate
join generalJournalAccountEntry
where generalJournalAccountEntry.GeneralJournalEntry == generalJournalEntry.RecId
join MainAccount
where MainAccount.RecId == generalJournalAccountEntry.MainAccount
&& MainAccount.MainAccountId == '1111001'
exists join ledgerJournalTrans
where ledgerJournalTrans.Voucher == generalJournalEntry.SubledgerVoucher
join ledgerJournalTable
where ledgerJournalTable.JournalNum == ledgerJournalTrans.JournalNum
&& ledgerJournalTable.JournalName == "RV"
{
DailyCashReport.Voucher = generalJournalEntry.SubledgerVoucher;
DailyCashReport.TransDate = generalJournalEntry.AccountingDate;
DailyCashReport.AccountingCurrencyAmount = generalJournalAccountEntry.AccountingCurrencyAmount;
DailyCashReport.TransAmount = abs(generalJournalAccountEntry.AccountingCurrencyAmount);
DailyCashReport.Txt = generalJournalAccountEntry.Text;
DailyCashReport.DailyCashType = ASAP_DailyCashType::Receipt;
DailyCashReport.Company = companyinfo.Name;
DailyCashReport.CompanyLogo = companyImage;
DailyCashReport.OpeningBalance = OpeningBalance;
DailyCashReport.ClosingBalance = ClosingBalance;
DailyCashReport.insert();
}
while select salesTable
order by salesTable.SalesId asc
where salesTable.SalesStatus ==SalesStatus::Invoiced
&& salesTable.Payment == "Cash" && salesTable.SalesType == SalesType::Sales
join CustInvoiceJour
where CustInvoiceJour.SalesId == salesTable.SalesId
&& CustInvoiceJour.InvoiceDate == transDate
{
DailyCashReport.Voucher = salesTable.SalesId;
DailyCashReport.TransDate = TransDate;
DailyCashReport.AccountingCurrencyAmount = salesTable.amountInvoiced();
DailyCashReport.TransAmount = abs(salesTable.amountInvoiced());
DailyCashReport.Txt = salestable::find(CustInvoiceJour.SalesId).customerName();
DailyCashReport.DailyCashType = ASAP_DailyCashType::Receipt;
DailyCashReport.Company = companyinfo.Name;
DailyCashReport.CompanyLogo = companyImage;
DailyCashReport.OpeningBalance = OpeningBalance;
DailyCashReport.ClosingBalance = ClosingBalance;
DailyCashReport.insert();
}
}
---------------
[SysEntryPointAttribute]
public void processReport()
{
contract = this.parmDataContract();
transDate = contract.parmTransDate();
aed1000 = contract.parmAED1000();
aed500 = contract.parmAED500();
aed200 = contract.parmAED200();
aed100 = contract.parmAED100();
aed50 = contract.parmAED50();
aed20 = contract.parmAED20();
aed10 = contract.parmAED10();
aed5 = contract.parmAED5();
aed1 = contract.parmAED1();
aed5Fills = contract.parmAED5Fills();
aed25Fills = contract.parmAED25Fills();
usdTotal = contract.parmUSDTotal();
jpytotal = contract.parmJPYTotal();
otherstotal = contract.parmOthersTotal();
rateUSD = contract.parmRateUSD();
rateEUR = contract.parmRateEUR();
rateOthers = contract.parmRateOthers();
opening = contract.parmOpening();
expenses = contract.parmExpenses();
closing = contract.parmClosing();
companyinfo = CompanyInfo::find();
CompanyImage = CompanyImage::find(companyInfo.DataAreaId, companyInfo.TableId, companyInfo.RecId).Image;
OpeningBalance = this.getOpeningBalace();
// added for no transcation means display only opening and closing balance in report on feb 10th 2018
DailyCashReport.OpeningBalance = OpeningBalance;
DailyCashReport.Company = companyinfo.Name;
DailyCashReport.insert();
// end
// breakpoint;
this.insertDailyCash();
}
------------------ dp class completed ..
class ASAP_DailyCashbookController extends SrsReportRunController
{
#define.reportName('ASAP_DailyCashReport.DailyCashRpt')
}
--
protected void prePromptModifyContract()
{
ASAP_DailyCashBookContract contract = this.parmReportContract().parmRdpContract() as ASAP_DailyCashBookContract;
super();
}
--
public boolean showQuerySelectButton(str parameterName)
{
return false;
}
--
public static void main(Args _args)
{
ASAP_DailyCashbookController controller = new ASAP_DailyCashbookController();
controller.parmReportName(#ReportName);
controller.parmArgs(_args);
controller.parmLoadFromSysLastValue(false);
controller.startOperation();
}
----------------------------------------
public class ASAP_DailyCashBookUIBuilder extends SrsReportDataContractUIBuilder
{
DialogField dialogTransDate;
DialogField dialogAED1000;
DialogField dialogAED500;
DialogField dialogAED200;
DialogField dialogAED100;
DialogField dialogAED50;
DialogField dialogAED20;
DialogField dialogAED10;
DialogField dialogAED5;
DialogField dialogAED1;
DialogField dialogAED05Fills;
DialogField dialogAED25Fills;
DialogField dialogUSD;
DialogField dialogJPY;
DialogField dialogOthers;
DialogField dialogRateUSD;
DialogField dialogRateEUR;
DialogField dialogRateOthers;
DialogField dialogOpening;
DialogField dialogClosing;
DialogField dialogExpenses;
ASAP_DailyCashBookContract contractLocal;
TransDate transDate;
Integer aed1000,aed500,aed200,aed100,aed50,aed20,aed10,aed5,aed1,aed5Fills,aed25Fills,usdTotal,jpyTotal,othersTotal,closing,opening,expenses;
RealBaseRate rateUSD,rateEUR,rateOthers;
}
---
public void build()
{
DialogGroup dlgGroup;
Dialog dlg;
dlg = this.dialog();
contractLocal = this.dataContractObject();
dlgGroup = dlg.addGroup("Trans Date");
dialogTransDate = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmTransDate),contractLocal);
// dialogTransDate.value("");
dlgGroup = dlg.addGroup("Local Currency");
dialogAED1000 = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmAED1000),contractLocal);
dialogAED1000.label("1000");
//dialogAED1000.value("");
dialogAED500 = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmAED500),contractLocal);
dialogAED500.label("500");
// dialogAED500.value("");
dialogAED200 = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmAED200),contractLocal);
dialogAED200.label("200");
//dialogAED200.value("");
dialogAED100 = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmAED100),contractLocal);
dialogAED100.label("100");
// dialogAED100.value("");
dialogAED50 = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmAED50),contractLocal);
dialogAED50.label("50");
// dialogAED50.value("");
dialogAED20 = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmAED20),contractLocal);
dialogAED20.label("20");
// dialogAED20.value("");
dialogAED10 = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmAED10),contractLocal);
dialogAED10.label("10");
// dialogAED10.value("");
dialogAED5 = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmAED5),contractLocal);
dialogAED5.label("5");
// dialogAED5.value("");
dialogAED1 = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmAED1),contractLocal);
dialogAED1.label("1");
// dialogAED1.value("");
dialogAED05Fills = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmAED5Fills),contractLocal);
// dialogAED05Fills.value("");
dialogAED25Fills = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmAED25Fills),contractLocal);
// dialogAED25Fills.value("");
dlgGroup = dlg.addGroup("USD");
dialogUSD = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmUSDTotal),contractLocal);
// dialogUSD.value("");
dialogRateUSD = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmRateUSD),contractLocal);
dialogRateUSD.label("Exchange rate");
// dialogRateUSD.value("");
dlgGroup = dlg.addGroup("EUR");
dialogJPY = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmJPYTotal),contractLocal);
dialogJPY.label("EUR");
// dialogJPY.value("");
dialogRateEUR = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmRateEUR),contractLocal);
dialogRateEUR.label("Exchange rate");
// dialogRateEUR.value("");
dlgGroup = dlg.addGroup("Others");
dialogOthers = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmOthersTotal),contractLocal);
// dialogOthers.value("");
dialogRateOthers = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmRateOthers),contractLocal);
dialogRateOthers.label("Exchange rate");
// dialogRateOthers.value("");
dlgGroup = dlg.addGroup("Petty Cash");
dialogOpening = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmOpening),contractLocal);
// dialogOpening.value("");
dialogExpenses = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmExpenses),contractLocal);
// dialogExpenses.value("");
dialogClosing = this.addDialogField(methodStr(ASAP_DailyCashBookContract, parmClosing),contractLocal);
// dialogClosing.value("");
}
--------
public void getFromDialog()
{
contractLocal = this.dataContractObject();
super();
}
--
public void postBuild()
{
super();
dialogTransDate = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmTransDate));
dialogAED1000 = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmAED1000));
dialogAED500 = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmAED500));
dialogAED200 = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmAED200));
dialogAED100 = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmAED100));
dialogAED50 = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmAED50));
dialogAED20 = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmAED20));
dialogAED10 = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmAED10));
dialogAED5 = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmAED5));
dialogAED1 = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmAED1));
dialogAED05Fills = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmAED5Fills));
dialogAED25Fills = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmAED25Fills));
dialogUSD = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmUSDTotal));
dialogJPY = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmJPYTotal));
dialogOthers = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmOthersTotal));
dialogRateUSD = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmRateUSD));
dialogRateEUR = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmRateEUR));
dialogRateOthers = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmRateOthers));
dialogOpening = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmOpening));
dialogExpenses = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmExpenses));
dialogClosing = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(ASAP_DailyCashBookContract, parmClosing));
}
--------
public void postRun()
{
}
Finding yesterday Closing Balance from Main account id
static void Job1(Args _args)
{
LedgerTrialBalanceListPageTmp _tmp;
Name _primaryFocus = 'Main account set';
FromDate _fromDate = today() - 203;
ToDate _toDate = _fromDate;
boolean _includeOpening = false;
boolean _includeClosing = false;
OperationsTax _postingLayer = OperationsTax::Current;
boolean _showErrors = false;
LedgerTrialBalanceDP trialBalanceDP = new LedgerTrialBalanceDP();
LedgerTrialBalanceContract trialBalanceContract = new LedgerTrialBalanceContract();
LedgerTrialBalanceTmp trialBalanceTmp;
UserConnection userConn;
DimensionHierarchy dimHier;
#define.ShowErrors(true)
dimHier = DimensionHierarchy::getMainAccountFocus();
select firstOnly RecId from _tmp;
delete_from _tmp;
if (!_primaryFocus)
{
return;
}
DimensionFocusUpdateBalance::updateBalance(
DimensionHierarchy::findByTypeAndName(DimensionHierarchyType::Focus, _primaryFocus),
_showErrors);
userConn = new UserConnection();
trialBalanceTmp.setConnection(userConn);
_tmp.setConnection(userConn);
userConn.ttsbegin();
// Use the trial balance DP to generate a summary trial balance
trialBalanceContract.parmDetailSummary(DetailSummary::Summary);
trialBalanceContract.parmFromDate(_fromDate);
trialBalanceContract.parmToDate(_toDate);
trialBalanceContract.parmIncludeOpening(_includeOpening);
trialBalanceContract.parmIncludeClosing(_includeClosing);
trialBalanceContract.parmOperationsTax(_postingLayer);
trialBalanceContract.parmPrimaryDimensionFocus(_primaryFocus);
trialBalanceDP.parmDataContract(trialBalanceContract);
trialBalanceDP.parmUserConnection(userConn);
trialBalanceDP.processReport();
// Copy that data into the LedgerTrialBalanceListPageTmp, disabling RLS so the insert doesn't
// degrade to row-by-row
_tmp.recordLevelSecurity(false);
trialBalanceTmp = trialBalanceDP.getLedgerTrialBalanceTmp();
while select trialBalanceTmp where trialBalanceTmp.PrimaryFocus == '1111001'
{
info(strFmt("%1 -- %2", trialBalanceTmp.OpeningBalance , trialBalanceTmp.EndingBalance));
}
// Copy the data from the report run over to the DBTemp table backing the form
//insert_recordset _tmp (PrimaryFocus, LedgerDimension, OpeningBalance, AmountDebit, AmountCredit, ClosingBalance, EndingBalance, Description, DimensionValues)
//select PrimaryFocus, LedgerDimension, OpeningBalance, AmountDebit, AmountCredit, ClosingBalance, EndingBalance, PrimaryFocusDescription, DimensionValues
//from trialBalanceTmp;
_tmp.recordLevelSecurity(true);
userConn.ttsCommit();
}
{
LedgerTrialBalanceListPageTmp _tmp;
Name _primaryFocus = 'Main account set';
FromDate _fromDate = today() - 203;
ToDate _toDate = _fromDate;
boolean _includeOpening = false;
boolean _includeClosing = false;
OperationsTax _postingLayer = OperationsTax::Current;
boolean _showErrors = false;
LedgerTrialBalanceDP trialBalanceDP = new LedgerTrialBalanceDP();
LedgerTrialBalanceContract trialBalanceContract = new LedgerTrialBalanceContract();
LedgerTrialBalanceTmp trialBalanceTmp;
UserConnection userConn;
DimensionHierarchy dimHier;
#define.ShowErrors(true)
dimHier = DimensionHierarchy::getMainAccountFocus();
select firstOnly RecId from _tmp;
delete_from _tmp;
if (!_primaryFocus)
{
return;
}
DimensionFocusUpdateBalance::updateBalance(
DimensionHierarchy::findByTypeAndName(DimensionHierarchyType::Focus, _primaryFocus),
_showErrors);
userConn = new UserConnection();
trialBalanceTmp.setConnection(userConn);
_tmp.setConnection(userConn);
userConn.ttsbegin();
// Use the trial balance DP to generate a summary trial balance
trialBalanceContract.parmDetailSummary(DetailSummary::Summary);
trialBalanceContract.parmFromDate(_fromDate);
trialBalanceContract.parmToDate(_toDate);
trialBalanceContract.parmIncludeOpening(_includeOpening);
trialBalanceContract.parmIncludeClosing(_includeClosing);
trialBalanceContract.parmOperationsTax(_postingLayer);
trialBalanceContract.parmPrimaryDimensionFocus(_primaryFocus);
trialBalanceDP.parmDataContract(trialBalanceContract);
trialBalanceDP.parmUserConnection(userConn);
trialBalanceDP.processReport();
// Copy that data into the LedgerTrialBalanceListPageTmp, disabling RLS so the insert doesn't
// degrade to row-by-row
_tmp.recordLevelSecurity(false);
trialBalanceTmp = trialBalanceDP.getLedgerTrialBalanceTmp();
while select trialBalanceTmp where trialBalanceTmp.PrimaryFocus == '1111001'
{
info(strFmt("%1 -- %2", trialBalanceTmp.OpeningBalance , trialBalanceTmp.EndingBalance));
}
// Copy the data from the report run over to the DBTemp table backing the form
//insert_recordset _tmp (PrimaryFocus, LedgerDimension, OpeningBalance, AmountDebit, AmountCredit, ClosingBalance, EndingBalance, Description, DimensionValues)
//select PrimaryFocus, LedgerDimension, OpeningBalance, AmountDebit, AmountCredit, ClosingBalance, EndingBalance, PrimaryFocusDescription, DimensionValues
//from trialBalanceTmp;
_tmp.recordLevelSecurity(true);
userConn.ttsCommit();
}
Subscribe to:
Posts (Atom)

