Description
This method is used to generate the prodataset for specific report.
Parameters
| tFilter | input | temp-table | Store all the input parameters. |
| icLanguageCode | input | character | Language code. Usually "en" (English). |
| ohProDs | output | handle | The temp handle for specific ProDataSet |
| oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program1/baccountinginterface.p)
/* This method is used to bulid the prodataset of each report, and return its handle */
assign oiReturnStatus = -98.
/* Empty the dataset handle which will be used*/
if valid-handle(vhProDs)
then vhProDs:clear().
if valid-handle(ohProDs)
then ohProDs:clear().
/* Empty the temp-tables */
empty temp-table tAccntBalance.
empty temp-table tAccntBook.
empty temp-table tChartOfAccnt.
empty temp-table tDepartment.
empty temp-table tEntity.
empty temp-table tFormat.
empty temp-table tGLVoucher.
empty temp-table tProjectData.
empty temp-table tBalanceSheet.
empty temp-table tIncomeStatement.
empty temp-table tReport.
/* Empty method data items */
assign
vcReportCode = ?
vtFromDate1 = ?
vtFromDate2 = ?
vtToDate1 = ?
vtToDate2 = ?
vcEntityList = ?
vcAccountLevel = ?
vcIndustry = ?
vcOrgCode = ?
vcFiscalYear = ?
vcAccBookNo = ?
vcFileNameList = ?
viBudgetLevel = ?
vcCOACrossRefCode = ?.
/* Get the input parameter tFilter into method data items, tFilter would be created in the method ExcuteFileExport,
so the types of parameters must be right */
for each tFilter:
if tFilter.tcBusinessFieldName = {&BUSINESSFIELDNAME-REPORTCODE}
then assign vcReportCode = tFilter.tcParameterValue.
if tFilter.tcBusinessFieldName = {&BUSINESSFIELDNAME-FROMDATE1}
then assign vtFromDate1 = date(tFilter.tcParameterValue).
if tFilter.tcBusinessFieldName = {&BUSINESSFIELDNAME-FROMDATE2}
then assign vtFromDate2 = date(tFilter.tcParameterValue).
if tFilter.tcBusinessFieldName = {&BUSINESSFIELDNAME-TODATE1}
then assign vtToDate1 = date(tFilter.tcParameterValue).
if tFilter.tcBusinessFieldName = {&BUSINESSFIELDNAME-TODATE2}
then assign vtToDate2 = date(tFilter.tcParameterValue).
if tFilter.tcBusinessFieldName = {&BUSINESSFIELDNAME-ENTITYIDLIST}
then assign vcEntityList = tFilter.tcParameterValue.
if tFilter.tcBusinessFieldName = {&BUSINESSFIELDNAME-ACCOUNTLEVEL}
then assign vcAccountLevel = tFilter.tcParameterValue.
if tFilter.tcBusinessFieldName = {&BUSINESSFIELDNAME-INDUSTRY}
then assign vcIndustry = tFilter.tcParameterValue.
if tFilter.tcBusinessFieldName = {&BUSINESSFIELDNAME-ORGCODE}
then assign vcOrgCode = tFilter.tcParameterValue.
if tFilter.tcBusinessFieldName = {&BUSINESSFIELDNAME-FISCALYEAR}
then assign vcFiscalYear = tFilter.tcParameterValue.
if tFilter.tcBusinessFieldName = {&BUSINESSFIELDNAME-ACCBOOKNO}
then assign vcAccBookNo = tFilter.tcParameterValue.
if tFilter.tcBusinessFieldName = {&BUSINESSFIELDNAME-FILENAMELIST}
then assign vcFileNameList = tFilter.tcParameterValue.
if tFilter.tcBusinessFieldName = {&BUSINESSFIELDNAME-BUDGETLEVEL}
then assign viBudgetLevel = integer(tFilter.tcParameterValue).
if tFilter.tcBusinessFieldName = {&BUSINESSFIELDNAME-LAYERCODE}
then assign vcLayerCode = tFilter.tcParameterValue.
if tFilter.tcBusinessFieldName = {&BUSINESSFIELDNAME-REPORTSTRUCTBS}
then assign vcReportStructBS = tFilter.tcParameterValue.
if tFilter.tcBusinessFieldName = {&BUSINESSFIELDNAME-REPORTSTRUCTIS}
then assign vcReportStructIS = tFilter.tcParameterValue.
if tFilter.tcBusinessFieldName = {&BUSINESSFIELDNAME-COACROSSREFCODE}
then assign vcCOACrossRefCode = tFilter.tcParameterValue.
end. /* for each tFilter: */
/* Do some change to layercode to make the layercode can be userd by the next program*/
assign vctemp_layer = trim(replace(vcLayerCode,'~n',chr(2)),chr(2)).
/* Validation of ReportCode */
if vcReportCode = ? or vcReportcode = '':U
then do:
assign oiReturnStatus = -1.
<M-1 run SetMessage
(input #T-20'The RecordCode is blank.':30(60861)T-20# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input '':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-6150':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAccountingInterface>
return.
end. /* if vcReportCode = ? */
/* Use the ReportCode the decide which file should be exported */
case vcReportCode:
/* AccntBook */
when {&EXPORTREPORTCODE-DZZB}
then do:
if vcAccountLevel = ? or
vcIndustry = ? or
vcOrgCode = ? or
vcFiscalYear = ? or
vcAccBookNo = ? or
vcAccountLevel = '':U or
vcIndustry = '':U or
vcOrgCode = '':U or
vcFiscalYear = '':U or
vcAccBookNo = '':U
then do:
assign oiReturnStatus = -1.
<M-2 run SetMessage
(input #T-21'The Account Level, Industry, Org Code, Fiscal Year, and Account Book No. fields must be completed to export an electronic accounting book data file.':200(59757)T-21# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input '':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-6151':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAccountingInterface>
return.
end. /* if vcAccountLevel = ? or vcIndustry = ? or vcOrgCode = ? or vcFiscalYear = ? or vcAccBookNo = ? */
/* Call method FillProDsAccntBook to build the prodataset */
<M-3 run FillProDsAccntBook
(output vhProDs (ohAccntBook),
input vcAccBookNo (icAccntBookNo),
input vcOrgCode (icOrganizationCode),
input vcIndustry (icIndustry),
input vcFiscalYear (icFiscalYear),
input vcAccountLevel (icGLAccntStructure),
input vcCOACrossRefCode (icCOACrossRefCode),
output viFcReturnSuper (oiReturnStatus)) in BAccountingInterface>
if viFcReturnSuper <> 0
then do:
assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
end. /* if viFcReturnSuper <> 0 */
end. /* when {&EXPORTREPORTCODE-DZZB} */
/* ChartOfAccnt */
when {&EXPORTREPORTCODE-KJKM}
then do:
if vcAccountLevel = ? or
vcAccountLevel = '':U or
viBudgetLevel = ? or
viBudgetLevel = 0
then do:
assign oiReturnStatus = -1.
<M-4 run SetMessage
(input #T-22'The Account Level and Budget Level fields must be completed to export the Chart of Accounts data file.':200(59870)T-22# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input '':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-6152':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAccountingInterface>
return.
end. /* if vcAccountLevel = ? */
if (vcReportStructBS = ? or vcReportStructBS = '') and
(vcReportStructIS = ? or vcReportStructIS = '')
then do:
assign oiReturnStatus = -1.
<M-33 run SetMessage
(input #T-35'At least one of the two filters Balance Sheet Structure Code or Income Statement Structure Code must be filled in.':255(413995010)T-35# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input '':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-9635':U:U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAccountingInterface>
return.
end.
/* Call method FillProDsChartOfAccnt to build the ProDataSet */
<M-5 run FillProDsChartOfAccnt
(output vhProDs (ohChartOfAccnt),
input vcAccountLevel (icGLAccntStructure),
input viBudgetLevel (iiBudgetLevel),
input vcReportStructBS (icReportStructBS),
input vcReportStructIS (icReportStructIS),
input vcCOACrossRefCode (icCOACrossRefCode),
output viFcReturnSuper (oiReturnStatus)) in BAccountingInterface>
if viFcReturnSuper <> 0
then do:
assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
end. /* if viFcReturnSuper <> 0 */
end. /* when {&EXPORTREPORTCODE-KJKM} */
/* Department */
when {&EXPORTREPORTCODE-BMXX}
then do:
/* Call method FillProDsDepartment to build the prodataset */
<M-6 run FillProDsDepartment
(output vhProDs (ohDepartment),
output viFcReturnSuper (oiReturnStatus)) in BAccountingInterface>
if viFcReturnSuper <> 0
then do:
assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
end. /* if viFcReturnSuper <> 0 */
end. /* when {&EXPORTREPORTCODE-BMXX} */
/* Entity */
when {&EXPORTREPORTCODE-WLDW}
then do:
/* Call method FillproDsEntity to build the prodataset */
<M-7 run FillProDsEntity
(output vhProDs (ohEntity),
output viFcReturnSuper (oiReturnStatus)) in BAccountingInterface>
if viFcReturnSuper <> 0
then do:
assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
end. /* if viFcReturnSuper <> 0 */
end. /* when {&EXPORTREPORTCODE-WLDW} */
/* ProjectData */
when {&EXPORTREPORTCODE-XMXX}
then do:
/* Call method FillProDsProject to build the prodataset */
<M-8 run FillProDsProject
(output vhProDs (ohProjectData),
output viFcReturnSuper (oiReturnStatus)) in BAccountingInterface>
if viFcReturnSuper <> 0
then do:
assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
end. /* if viFcReturnSuper <> 0 */
end. /* when {&EXPORTREPORTCODE-XMXX} */
/* AccntBalance */
when {&EXPORTREPORTCODE-KMYE}
then do:
if vcEntityList = ? or
vtFromDate1 = ? or
vcEntityList = '':U or
vtFromDate1 = date('01/13/001')
then do:
assign oiReturnStatus = -1.
<M-9 run SetMessage
(input #T-23'The entity list and From Date 1 fields must be completed to export the account balance and movement data file.':200(59240)T-23# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input '':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-6153':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAccountingInterface>
return.
end. /* if vcEntityList = ? or vtFromDate1 = ? */
/* Call method FillProDsAccntBalance to bulid the prodataset */
<M-10 run FillProDsAccntBalance
(output vhProDs (ohAccntBalance),
input vcEntityList (icEntityList),
input vtFromDate1 (itAccntDate),
input vcCOACrossRefCode (icCOACrossRefCode),
output viFcReturnSuper (oiReturnStatus)) in BAccountingInterface>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
end. /* when {&EXPORTREPORTCODE-KMYE} */
/* GLVoucher */
when {&EXPORTREPORTCODE-JZPZ}
then do:
if vtFromDate1 = ? or
vcEntityList = ? or
vtFromDate1 = date('01/13/001') or
vcEntityList = '':U or
vtToDate1 = ? or
vtToDate1 = date('01/13/001')
then do:
assign oiReturnStatus = -1.
<M-11 run SetMessage
(input #T-24'The From Date1, To Date 1 and entity list fields must be completed to export a GL voucher data file.':200(59618)T-24# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input '':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-6154':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAccountingInterface>
return.
end. /* if vtFromDate1 = ? or vcEntityList = ? or vtToDate1 = ? or vtFromDate1 = date('01/13/001') or vtToDate1 = date('01/13/001')*/
/* The FromDate1 could not be later then ToDate1 */
if vtFromDate1 > vtToDate1
then do:
assign oiReturnStatus = -1.
<M-30 run SetMessage
(input #T-30'The value in FromDate1 cannot be later than ToDate1 if you want to export the GL invoice data file.':200(60972)T-30# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input '':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-6232':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAccountingInterface>
return.
end. /* if vtFromDate1 > vtToDate1 */
/* Call method FillProDsGLVoucher to build the prodataset */
<M-12 run FillProDsGLVoucher
(input vcEntityList (icEntityList),
output vhProDs (ohGLVoucher),
input vtFromDate1 (itFromDate),
input vtToDate1 (itToDate),
input vcCOACrossRefCode (icCOACrossRefCode),
output viFcReturnSuper (oiReturnStatus)) in BAccountingInterface>
if viFcReturnSuper <> 0
then do:
assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
end. /* if viFcReturnSuper <> 0 */
end. /* when {&EXPORTREPORTCODE-JZPZ} */
/* BalanceSheet */
when {&EXPORTREPORTCODE-Q_ZCFZ}
then do:
if vtToDate1 = ? or
vtToDate1 = date('01/13/001') or
/*vtToDate2 = ? or
vtToDate2 = date('01/13/001') or */
vcEntityList = ? or
vcEntityList = '':U or
viBudgetLevel = ? or
viBudgetLevel = 0 or
vcReportStructBS = ? or
vcReportStructBS = '':U or
vcLayerCode = ? or
vcLayerCode = '':U
then do:
assign oiReturnStatus = -1.
<M-13 run SetMessage
(input #T-32'The To Date, Budget Level, Layer Code, BS Structure and Entity list cannot be blank if you want to export the Income statement data file':255(583943358)T-32# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input '':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-6155':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAccountingInterface>
return.
end. /* if vtToDate1 = ? or vtToDate1 = date('01/13/001') */
/* Call method FillProDsBalanceSheet to build the prodataset */
<M-14 run FillProDsBalanceSheet
(input vcEntityList (icEntityList),
output vhProDs (ohBalanceSheet),
input vtToDate1 (itAccntToDate1),
input vtToDate2 (itAccntToDate2),
input viBudgetLevel (iiBudgetLevel),
input vcReportStructBS (icReportStructBS),
input vctemp_layer (icLayerCode),
input vcCOACrossRefCode (icCOACrossRefCode),
output viFcReturnSuper (oiReturnStatus)) in BAccountingInterface>
if viFcReturnSuper <> 0
then do:
assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
end. /* if viFcReturnSuper <> 0 */
end. /* when {&EXPORTREPORTCODE-Q_ZCFZ} */
/* IncomeStatement */
when {&EXPORTREPORTCODE-Q_LR}
then do:
if vtToDate1 = ? or
vtToDate1 = date('01/13/001') or
/*vtToDate2 = ? or
vtToDate2 = date('01/13/001') or*/
vtFromDate1 = ? or
vtFromDate1 = date('01/13/001') or
/*vtFromDate2 = ? or
vtFromDate2 = date('01/13/001') or*/
vcEntityList = ? or
vcEntityList = '':U or
viBudgetLevel = ? or
viBudgetLevel = 0 or
vcLayerCode = ? or
vcLayerCode = '':U or
vcReportStructIS = ? or
vcReportStructIS = '':U
then do:
assign oiReturnStatus = -1.
<M-15 run SetMessage
(input #T-26'The From Date, To Date, Budget Level, Layer Code, IS Structure and Entity list cannot be blank if you want to export the Income statement data file':200(606010096)T-26# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input '':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-6156':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAccountingInterface>
return.
end. /* if vtToDate1 = ? */
if vtFromDate1 > vtToDate1 /*or
vtFromDate2 > vtToDate2*/
then do:
assign oiReturnStatus = -1.
<M-31 run SetMessage
(input #T-31'The value in From Date cannot be later than To Date if you want to export the Income Statement data file.':200(332020119)T-31# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input '':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-6235':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAccountingInterface>
return.
end. /* if vtFromDate1 > vtToDate1 */
/* Call method FillProDsIncomeStatement to build the prodataset */
<M-16 run FillProDsIncomeStatement
(input vcEntityList (icEntityList),
output vhProDs (ohIncomeStatement),
input vtFromDate1 (itAccntFromDate1),
input vtFromDate2 (itAccntFromDate2),
input vtToDate1 (itAccntToDate1),
input vtToDate2 (itAccntToDate2),
input viBudgetLevel (iiBudgetLevel),
input vcReportStructIS (icReportStructIS),
input vctemp_layer (icLayerCode),
input vcCOACrossRefCode (icCOACrossRefCode),
output viFcReturnSuper (oiReturnStatus)) in BAccountingInterface>
if viFcReturnSuper <> 0
then do:
assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
end. /* if viFcReturnSuper <> 0 */
end. /* when {&EXPORTREPORTCODE-Q_LR} */
/* Format */
when {&EXPORTREPORTCODE-GSSM}
then do:
if vcFileNameList = ? or
vcFileNameList = '':U
then do:
assign oiReturnStatus = -1.
/* This validation is already done in the other place, so we just return here, or the error message
would be appear twice in the User Interface */
return.
end. /* if vcFileNameList = ? */
/* Call method FillProDsFormat to build the prodataset */
<M-18 run FillProDsFormat
(input vcFileNameList (icFileNameList),
output vhProDs (ohFormat),
output viFcReturnSuper (oiReturnStatus)) in BAccountingInterface>
if viFcReturnSuper <> 0
then do:
assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
end. /* if viFcReturnSuper <> 0 */
end. /* when {&EXPORTREPORTCODE-GSSM} */
otherwise
do:
assign oiReturnStatus = -1.
<M-19 run SetMessage
(input #T-28'No report is selected.':50(59674)T-28# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input '':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-6158':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAccountingInterface>
return.
end. /* otherwise */
end case. /* case vcReportCode: */
/* Validation of the handle of prodataset, if the handle is invalid, pop up error message and return. */
if not valid-handle(vhProDs) or vhProDs = ?
then do:
assign oiReturnStatus = -1.
<M-29 run SetMessage
(input #T-29'The export failed. Check that the input parameters are valid.':100(60864)T-29# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input '':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-6159':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAccountingInterface>
return.
end. /* if not valid-handle(vhProDs) or vhProDs = ? */
/* Make a copy of dataset and clear the ancestor one, so the dataset is independent */
create dataset ohProDs in widget-pool "non-persistent".
ohProDs:create-like(vhProDs).
ohProDs:copy-dataset(vhProDs).
vhProDs:clear().
/* ReturnStatus handling */
if oiReturnStatus = -98 then
assign oiReturnStatus = 0.