Description
This method is used to generate prodataset for Account Book Report.
Parameters
ohAccntBook | output | handle | Handle for Account Book Prodataset. |
icAccntBookNo | input | character | Account Book Number. |
icOrganizationCode | input | character | Organization Code. |
icIndustry | input | character | Industry. |
icFiscalYear | input | character | Fiscal Year. |
icGLAccntStructure | input | character | GL Account Structure. |
icCOACrossRefCode | input | character | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program3/baccountinginterface.p)
assign oiReturnStatus = -98.
/* Empty the temp-tables which will be used later */
empty temp-table tAccntBook.
empty temp-table tReport.
/* to create a temp table, due to EDI limitation */
create tReport.
assign tReport.tiReportID = 1.
if icCOACrossRefCode <> ? and icCOACrossRefCode <> ''
then do:
<Q-16 run COACrossRefByAll (all) (Read) (NoCache)
(input ?, (COACrossRefID)
input viDomainID, (SourceDomainID)
input ?, (TargetDomainID)
input ?, (AltCOAStructID)
input icCOACrossRefCode, (COACrossRefCode)
input {&COACROSSREFTYPE-ALTERNATE}, (COACrossRefType)
input ?, (COACrossRefIsActive)
input vcDomainCode, (SourceDomainCode)
input ?, (TargetDomainCode)
input ?, (AltCOAStructCode)
output dataset tqCOACrossRefByAll) in BCOACrossRef >
find first tqCOACrossRefByAll no-error.
if available tqCOACrossRefByAll
then do:
assign vcAltCOAStructCodeTemp = tqCOACrossRefByAll.tcAltCOAStructCode.
end.
end.
<Q-4 run CompanySharedSetBySharedSet (all) (Read) (NoCache)
(input ?, (SharedSetId)
input viCompanyId, (CompanyId)
output dataset tqCompanySharedSetBySharedSet) in BCompany >
/* Start querys */
<Q-6 run CompanyByIDAllInfo (Start) in BCompany >
/*<Q-7 run CompanySSBySSCodeIDType (Start) in BCompany >*/
<Q-13 run CompanySSBySSCodeIDTypeForCAI (Start) in BCompany >
<Q-8 run CompanyPropertyByCompany (Start) in BCompanyProperty >
for each tqCompanySharedSetBySharedSet:
<Q-2 run CompanyByIDAllInfo (all) (Read) (NoCache)
(input tqCompanySharedSetBySharedSet.tiCompany_ID, (CompanyId)
output dataset tqCompanyByIDAllInfo) in BCompany >
/*<Q-3 run CompanySSBySSCodeIDType (all) (Read) (NoCache)
(input ?, (CompanyId)
input tqCompanySharedSetBySharedSet.tiSharedSet_ID, (SharedSetID)
input ?, (SharedSetCode)
input ?, (SharedSetTypeCode)
output dataset tqCompanySSBySSCodeIDType) in BCompany >*/
<Q-12 run CompanySSBySSCodeIDTypeForCAI (all) (Read) (NoCache)
(input ?, (CompanyId)
input tqCompanySharedSetBySharedSet.tiSharedSet_ID, (SharedSetID)
input ?, (SharedSetCode)
input ?, (SharedSetTypeCode)
output dataset tqCompanySSBySSCodeIDTypeForCAI) in BCompany >
<Q-5 run CompanyPropertyByCompany (all) (Read) (NoCache)
(input tqCompanySharedSetBySharedSet.tiCompany_ID, (CompanyId)
input ?, (CompanyCode)
input ?, (CurrencyCode)
output dataset tqCompanyPropertyByCompany) in BCompanyProperty >
find first tqCompanySSBySSCodeIDTypeForCAI no-error.
if available tqCompanySSBySSCodeIDTypeForCAI
then do:
if tqCompanySSBySSCodeIDTypeForCAI.tcSharedSetTypeCode = 'GL'
then do:
create tAccntBook.
assign
tAccntBook.tcAccountingBookNo = icAccntBookNo
tAccntBook.tcOrganizationCode = icOrganizationCode
tAccntBook.tcCompanyType = #T-17'QYDW':255(733772260)T-17#
tAccntBook.tcIndustry = icIndustry
tAccntBook.tcSoftwareProvidor = 'QAD inc.':U
tAccntBook.tcVersion = '':U
tAccntBook.tcFiscalYear = icFiscalYear
tAccntBook.tcGLAccountStructure = icGLAccntStructure
tAccntBook.tcShareSetDescription = tqCompanySSBySSCodeIDTypeForCAI.tcSharedSetDescription
tAccntBook.tiReportID = 1.
for first tqCompanyByIDAllInfo:
assign tAccntBook.tcCompanyDescription = tqCompanyByIDAllInfo.tcCompanyDescription.
end. /* for first tqCompanyByIDAllInfo: */
for first tqCompanyPropertyByCompany:
assign tAccntBook.tcCurrencyCode = tqCompanyPropertyByCompany.tcCurrencyCode.
end. /* for first tqCompanyPropertyByCompany: */
if icCOACrossRefCode <> ? and icCOACrossRefCode <> ''
then do:
assign tAccntBook.tcGLAccountStructure = vcAltCOAStructCodeTemp.
end.
end. /* if tqCompanySSBySSCodeIDType.tcSharedSetTypeCode = 'GL' */
end. /* if available tqCompanySSBySSCodeIDType */
end. /* for each tqCompanySharedSetBySharedSet: */
/* Use prodataset to encapsulate the temp-table */
/*create dataset ohAccntBook in widget-pool "non-persistent".
ohAccntBook:set-buffers(buffer tReport:handle, buffer tAccntBook:handle).
ohAccntBook:add-relation(buffer tReport:handle, buffer tAccntBook:handle, 'tiReportID,tiReportID',?,true).
ohAccntBook:name = {&EXPORTREPORTCODE-DZZB}.*/
create dataset ohAccntBook in widget-pool "non-persistent".
create buffer vhReport for table buffer tReport:handle in widget-pool "non-persistent".
create buffer vhAccntBook for table buffer tAccntBook:handle in widget-pool "non-persistent".
ohAccntBook:set-buffers(vhReport, vhAccntBook).
ohAccntBook:add-relation(vhReport, vhAccntBook, 'tiReportID,tiReportID', ?, true).
ohAccntBook:name = {&EXPORTREPORTCODE-DZZB}.
/* ohAccntBook:WRITE-XML("file", "C:\Develop\wht\Client\testDZZB.xml", YES, ?, ?, NO, NO). */
/* Stop querys */
<Q-9 run CompanyByIDAllInfo (Stop) in BCompany >
/*<Q-10 run CompanySSBySSCodeIDType (Stop) in BCompany >*/
<Q-14 run CompanySSBySSCodeIDTypeForCAI (Stop) in BCompany >
<Q-11 run CompanyPropertyByCompany (Stop) in BCompanyProperty >
if oiReturnStatus = -98
then assign oiReturnStatus = 0.