Parameters
iiPaySel_ID | input | integer | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program7/bpaymentselection.p)
/* ======================================================= */
/* Fill the ttCompany temp table and it's child temptables
step1. Start All the Queries which will be used in the procedure.
step2. Run the Query to get the records of the target table by supplying the ID parameter.
step3. Validate whether the query return the expect records,if yes then continue else return.
step4. Buffercopy the query result to the target temp table.
step5. (optional) Do some calculation work.
step6. Go to step2 until fill all the child temp tables.
step7. Stop all the queries used in the procedure. */
/* ======================================================= */
if oiReturnStatus = 0
then assign oiReturnStatus = -98.
<Q-7 run CompanyByIDAllInfo
(Start) in BCompany >
<Q-8 run CompanyPropertyByIDAllInfo
(Start) in BCompanyProperty >
<Q-58 run BusinessRelationByIDAllInfo
(Start) in BBusinessRelation >
<Q-59 run AddressByIDsAllInfo
(Start) in BBusinessRelation >
<Q-54 run CountryByIDAllInfo
(Start) in BCountry >
<Q-52 run StateByIDAllInfo
(Start) in BState >
for each tPaySel where tPaySel.PaySel_ID = iiPaySel_ID:
<Q-12 run CompanyByIDAllInfo (all) (Read) (NoCache)
(input tPaySel.Company_ID, (CompanyId)
output dataset tqCompanyByIDAllInfo) in BCompany >
find first tqCompanyByIDAllInfo no-error.
if not available tqCompanyByIDAllInfo
then do:
<M-39 run SetMessage
(input #T-40'No entity record is defined.':50(999890592)T-40# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'D':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-5334':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
assign
oiReturnStatus = -1.
return.
end. /* end of if not available */
else do:
assign
vhBufferForProDataSet = dataset tqCompanyByIDAllInfo:get-buffer-handle(1).
for each tqCompanyByIDAllInfo no-lock:
find first tPaySelCompany where tPaySelCompany.Company_ID = tqCompanyByIDAllInfo.tiCompany_ID no-error.
if not available tPaySelCompany
then do: /* avoid duplicate key issue */
create tPaySelCompany.
<M-13 run BufferCopy
(input vhBufferForProDataSet (ihFrom),
input buffer tPaySelCompany:handle (ihTo),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
end.
<Q-14 run CompanyPropertyByIDAllInfo (all) (Read) (NoCache)
(input tPaySelCompany.Company_ID, (CompanyId)
output dataset tqCompanyPropertyByIDAllInfo) in BCompanyProperty >
find first tqCompanyPropertyByIDAllInfo no-error.
if not available tqCompanyPropertyByIDAllInfo
then do:
<M-41 run SetMessage
(input #T-42'The system cannot find the entity property record.':50(999890593)T-42# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'D':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-5335':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
assign
oiReturnStatus = -1.
return.
end. /* end of if not available tqCompanyPropertyByIDAllInfo */
else do:
assign
vhBufferForCompanyProperty = dataset tqCompanyPropertyByIDAllInfo:get-buffer-handle(1).
/*Fill data to buffer of temp table handle vhCompanyProperty */
for first tqCompanyPropertyByIDAllInfo no-lock:
find first tPropertyOfCompany where tPropertyOfCompany.CompanyProperty_ID = tqCompanyPropertyByIDAllInfo.tiCompanyProperty_ID no-error.
if not available tPropertyOfCompany
then do: /* avoid duplicate key issue */
create tPropertyOfCompany.
<M-15 run BufferCopy
(input vhBufferForCompanyProperty (ihFrom),
input buffer tPropertyOfCompany:handle (ihTo),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
end.
<Q-16 run BusinessRelationByIDAllInfo (all) (Read) (NoCache)
(input tPropertyOfCompany.BusinessRelation_ID, (BusinessRelation_ID)
output dataset tqBusinessRelationByIDAllInfo) in BBusinessRelation >
find first tqBusinessRelationByIDAllInfo no-error.
if not available tqbusinessrelationbyidallinfo
then do:
<M-43 run SetMessage
(input #T-44'No business relation is defined for the entity.':50(999890594)T-44# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'D':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-5336':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
assign
oiReturnStatus = -1.
return.
end. /* end of if not available tqBusinessRelationByIDAllInfo */
else do:
assign
vhBufferForBusinessRelation = dataset tqBusinessRelationByIDAllInfo:get-buffer-handle(1).
for first tqbusinessrelationbyidallinfo:
find first tCompanyBusRel where tCompanyBusRel.BusinessRelation_ID = tqBusinessRelationByIDAllInfo.tiBusinessRelation_ID no-error.
if not available tCompanyBusRel
then do: /* avoid duplicate key issue */
create tCompanyBusRel.
<M-17 run BufferCopy
(input vhBufferForBusinessRelation (ihFrom),
input buffer tCompanyBusRel:handle (ihTo),
output oiReturnStatus (oiReturnStatus)) in BPaymentSelection>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
end.
<Q-18 run AddressByIDsAllInfo (all) (Read) (NoCache)
(input tCompanyBusRel.BusinessRelation_ID, (BusinessRelation_ID)
input viAddressType_ID, (AddressType_ID)
output dataset tqAddressByIDsAllInfo) in BBusinessRelation >
find first tqAddressByIDsAllInfo no-error.
if not available tqaddressbyidsallinfo
then do:
<M-45 run SetMessage
(input #T-46'The system cannot find the entity address record.':50(999890595)T-46# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'D':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-5337':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
assign
oiReturnStatus = -1.
return.
end. /* end of if not available tqAddressByIDsAllInfo */
else do:
assign
vhBufferForAddress = dataset tqAddressByIDsAllInfo:get-buffer-handle(1).
/*Fill data to buffer of temp table handle vhCompanyAddress */
for first tqAddressByIDsAllInfo no-lock:
find first tAddressOfCompany where tAddressOfCompany.Address_ID = tqAddressByIDsAllInfo.tiAddress_ID no-error.
if not available tAddressOfCompany
then do: /* avoid duplicate key issue */
create tAddressOfCompany.
<M-19 run BufferCopy
(input vhBufferForAddress (ihFrom),
input buffer tAddressOfCompany:handle (ihTo),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
end.
<Q-55 run CountryByIDAllInfo (all) (Read) (NoCache)
(input tAddressOfCompany.Country_ID, (Country_ID)
output dataset tqCountryByIDAllInfo) in BCountry >
find first tqCountryByIDAllInfo no-error.
if not available tqCountryByIDAllInfo
then do:
<M-47 run SetMessage
(input #T-48'The system cannot find the entity country record.':50(999890596)T-48# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'D':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-5338':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
assign
oiReturnStatus = -1.
end. /* end of if not available tqCountryByIDAllInfo */
else do:
assign
vhBufferForCountry = dataset tqCountryByIDAllInfo:get-buffer-handle(1).
for first tqCountryByIDAllInfo:
find first tCountryOfCompany where tCountryOfCompany.Country_ID = tqCountryByIDAllInfo.tiCountry_ID no-error.
if not available tCountryOfCompany
then do: /* avoid duplicated key issue */
create tCountryOfCompany.
<M-32 run BufferCopy
(input vhBufferForCountry (ihFrom),
input buffer tCountryOfCompany:handle (ihTo),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
end.
end. /* for each tqCountryAllInfo */
end. /* tqCountryAllInfo else do */
if tAddressOfCompany.State_ID<>0
then do:
<Q-56 run StateByIDAllInfo (all) (Read) (NoCache)
(input tAddressOfCompany.State_ID, (State_ID)
output dataset tqStateByIDAllInfo) in BState >
assign
vhBufferForState = dataset tqStateByIDAllInfo:get-buffer-handle(1).
for first tqStateByIDAllInfo:
find first tStateOfCompany where tStateOfCompany.State_ID = tqStateByIDAllInfo.tiState_ID no-error.
if not available tStateOfCompany
then do: /* avoid duplicate key issue */
create tStateOfCompany.
<M-35 run BufferCopy
(input vhBufferForState (ihFrom),
input buffer tStateOfCompany:handle (ihTo),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
end.
end.
end. /* for each tqStateAllInfo */
end. /* for each tqAddrssAllInfo*/
end. /* tqAddressAllInfo else do */
end. /* for each tqBusinessRelationAllInfo */
end. /* tqBusinessRelationAllInfo else do */
end. /* for each tqCompanyPropertyAllInfo */
end. /* tqCompanyPropertyAllInfo else do */
end. /* for each tqCompanyAllInfo*/
end. /* tqCompanyAllInfo else do */
end. /* for each tPaySel */
<Q-53 run StateByIDAllInfo
(Stop) in BState >
<Q-57 run CountryByIDAllInfo
(Stop) in BCountry >
<Q-23 run AddressByIDsAllInfo
(Stop) in BBusinessRelation >
<Q-24 run BusinessRelationByIDAllInfo
(Stop) in BBusinessRelation >
<Q-25 run CompanyPropertyByIDAllInfo
(Stop) in BCompanyProperty >
<Q-26 run CompanyByIDAllInfo
(Stop) in BCompany >
/* ========================= */
/* Set default return status */
/* ========================= */
if oiReturnStatus = -98
then assign oiReturnstatus = 0.