Parameters
icAmountInText | input | character | |
iiCInvoiceid | input | integer | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program4/bcdocumentreport.p)
create tCDocumentReportAll.
assign tCDocumentReportAll.tcCDocRepAmountInText = icAmountInText
tCDocumentReportAll.tcCDocRepCredBRCode = tqCDocumentByFilter.tcBusinessRelationCode
tCDocumentReportAll.tcCDocRepCredCode = tqCDocumentByFilter.tcCreditorCode
tCDocumentReportAll.tcCDocRepCredLngCode = tqCDocumentByFilter.tcLngCode
tCDocumentReportAll.tcCDocRepCredName1 = tqCDocumentByFilter.tcBusinessRelationName1
tCDocumentReportAll.tcCDocRepCredName2 = tqCDocumentByFilter.tcBusinessRelationName2
tCDocumentReportAll.tcCDocRepCurrency = tqCDocumentByFilter.tcCurrencyCode
tCDocumentReportAll.tcCDocRepDocumentStatus = tqCDocumentByFilter.tcCDocumentStatus
tCDocumentReportAll.tcCDocRepDocumentType = tqCDocumentByFilter.tcCDocumentType
tCDocumentReportAll.tcCDocRepReference = tqCDocumentByFilter.tcCDocumentReference
tCDocumentReportAll.tdCDocRepAmount = tqCDocumentByFilter.tdCDocumentOriginalCreditTC
tCDocumentReportAll.tiCDocRepNumber = tqCDocumentByFilter.tiCDocumentNumber
tCDocumentReportAll.tiCDocRepValueDays = tqCDocumentByFilter.tiCDocumentValueDays
tCDocumentReportAll.tiCDocRepYear = tqCDocumentByFilter.tiCDocumentYear
tCDocumentReportAll.tiCDocumentID = tqCDocumentByFilter.tiCDocument_ID
tCDocumentReportAll.ttCDocRepCreationDate = tqCDocumentByFilter.ttCDocumentCreationDate
tCDocumentReportAll.ttCDocRepDueDate = tqCDocumentByFilter.ttCDocumentDueDate
tCDocumentReportAll.tdCDocRepOrigCreditTC = tqCDocumentByFilter.tdCDocumentOriginalCreditTC
tCDocumentReportAll.tdCDocRepOrigDebitTC = tqCDocumentByFilter.tdCDocumentOriginalDebitTC
tCDocumentReportAll.tiCDocRepPrePrintedNum = tqCDocumentByFilter.tiCDocumentPrePrintedNumber
tCDocumentReportAll.tcCurrencyCode = tqCDocumentByFilter.tcCurrencyCode
/* ZJC Defect 10132-3039 Begin */
tCDocumentReportAll.tcPaySelCode = tqCDocumentByFilter.tcPaySelCode.
/* ZJC Defect 10132-3039 End */
case tCDocumentReportAll.tcCDocRepDocumentType:
when {&DOCUMENTTYPECREDITOR-CHEQUE}
then assign tCDocumentReportAll.tcCDocRepDocumentType = {&DOCUMENTTYPECREDITOR-CHEQUE-TR}.
when {&DOCUMENTTYPECREDITOR-DRAFT}
then assign tCDocumentReportAll.tcCDocRepDocumentType = {&DOCUMENTTYPECREDITOR-DRAFT-TR}.
when {&DOCUMENTTYPECREDITOR-ELECTRONIC}
then assign tCDocumentReportAll.tcCDocRepDocumentType = {&DOCUMENTTYPECREDITOR-ELECTRONIC-TR}.
when {&DOCUMENTTYPECREDITOR-PROMNOTE}
then assign tCDocumentReportAll.tcCDocRepDocumentType = {&DOCUMENTTYPECREDITOR-PROMNOTE-TR}.
when {&DOCUMENTTYPECREDITOR-SUMSTATE}
then assign tCDocumentReportAll.tcCDocRepDocumentType = {&DOCUMENTTYPECREDITOR-SUMSTATE-TR}.
when {&DOCUMENTTYPECREDITOR-TRANSFER}
then assign tCDocumentReportAll.tcCDocRepDocumentType = {&DOCUMENTTYPECREDITOR-TRANSFER-TR}.
end.
/* Get Bank Account Number for Bank GL */
if iiCinvoiceId = 0 then do:
<Q-4 run BankNumberByParent (all) (Read) (NoCache)
(input tqCDocumentByFilter.tiGL_ID, (ParentObjectID)
input {&BANKNUMBERPARENTTYPE-GL}, (ParentType)
output dataset tqBankNumberByParent) in BCDocumentReport >
find first tqBankNumberByParent where
tqBankNumberByParent.tiParentObject_ID = tqCDocumentByFilter.tiGL_ID and
tqBankNumberByParent.tcBankNumberParentType = {&BANKNUMBERPARENTTYPE-GL}
no-error.
if available tqBankNumberByParent
then assign tCDocumentReportAll.tcCDocRepCompanyBankBRCode = tqBankNumberByParent.tcBusinessRelationCode
tCDocumentReportAll.tcCDocRepCompanyBankCity = tqBankNumberByParent.tcAddressCity
tCDocumentReportAll.tcCDocRepCompanyBankCountry = tqBankNumberByParent.tcCountryDescription
tCDocumentReportAll.tcCDocRepCompanyBankCounty = tqBankNumberByParent.tcCountyDescription
tCDocumentReportAll.tcCDocRepCompanyBankName1 = tqBankNumberByParent.tcBusinessRelationName1
tCDocumentReportAll.tcCDocRepCompanyBankName2 = tqBankNumberByParent.tcBusinessRelationName2
tCDocumentReportAll.tcCDocRepCompanyBankNumber = tqBankNumberByParent.tcBankNumber
tCDocumentReportAll.tcCDocRepCompanyBankNumberExten = tqBankNumberByParent.tcBankNumberExtension
tCDocumentReportAll.tcCDocRepCompanyBankNumberForm = tqBankNumberByParent.tcBankNumberFormatted
tCDocumentReportAll.tcCDocRepCompanyBankNumberSwift = tqBankNumberByParent.tcBankNumberSwiftCode
tCDocumentReportAll.tcCDocRepCompanyBankNumberValid = tqBankNumberByParent.tcBankNumberValidation
tCDocumentReportAll.tcCDocRepCompanyBankStreet1 = tqBankNumberByParent.tcAddressStreet1
tCDocumentReportAll.tcCDocRepCompanyBankStreet2 = tqBankNumberByParent.tcAddressStreet2
tCDocumentReportAll.tcCDocRepCompanyBankZip = tqBankNumberByParent.tcAddressZip
tCDocumentReportAll.tiCDocRepCompanyBankFormat = tqBankNumberByParent.tiAddressFormat.
end.
else do :
<Q-23 run CInvoiceBankForCDocument (all) (Read) (NoCache)
(input iiCInvoiceId, (CInvoiceID)
input ?, (CompanyId)
output dataset tqCInvoiceBankForCDocument) in BCInvoice >
find first tqCInvoiceBankForCDocument where tqCInvoiceBankForCDocument.tiCInvoice_ID = iiCinvoiceId no-error .
if available tqCInvoiceBankForCDocument then do:
<Q-94 run BankNumberByCinvoiceid (all) (Read) (NoCache)
(input tqCInvoiceBankForCDocument.tiParentObject_id, (Parentobject_id)
input tqCInvoiceBankForCDocument.tcBankNumberParentType, (ParentType)
input tqCInvoiceBankForCDocument.tcOwnBankNumber, (Banknumber)
input ?, (Companyid)
output dataset tqBankNumberByCinvoiceid) in BBankNumber >
find first tqBankNumberByCinvoiceid where tqBankNumberByCinvoiceid.tcBankNumber = tqCInvoiceBankForCDocument.tcOwnBankNumber and
tqBankNumberByCinvoiceid.tiParentObject_ID = tqCInvoiceBankForCDocument.tiParentObject_ID and
tqBankNumberByCinvoiceid.tcBankNumberParentType = tqCInvoiceBankForCDocument.tcBankNumberParentType no-error.
if available tqBankNumberByCinvoiceid
then assign tCDocumentReportAll.tcCDocRepCompanyBankBRCode = tqBankNumberByCinvoiceid.tcBusinessRelationCode
tCDocumentReportAll.tcCDocRepCompanyBankCity = tqBankNumberByCinvoiceid.tcAddressCity
tCDocumentReportAll.tcCDocRepCompanyBankCountry = tqBankNumberByCinvoiceid.tcCountryDescription
tCDocumentReportAll.tcCDocRepCompanyBankCounty = tqBankNumberByCinvoiceid.tcCountyDescription
tCDocumentReportAll.tcCDocRepCompanyBankName1 = tqBankNumberByCinvoiceid.tcBusinessRelationName1
tCDocumentReportAll.tcCDocRepCompanyBankName2 = tqBankNumberByCinvoiceid.tcBusinessRelationName2
tCDocumentReportAll.tcCDocRepCompanyBankNumber = tqBankNumberByCinvoiceid.tcBankNumber
tCDocumentReportAll.tcCDocRepCompanyBankNumberExten = tqBankNumberByCinvoiceid.tcBankNumberExtension
tCDocumentReportAll.tcCDocRepCompanyBankNumberForm = tqBankNumberByCinvoiceid.tcBankNumberFormatted
tCDocumentReportAll.tcCDocRepCompanyBankNumberSwift = tqBankNumberByCinvoiceid.tcBankNumberSwiftCode
tCDocumentReportAll.tcCDocRepCompanyBankNumberValid = tqBankNumberByCinvoiceid.tcBankNumberValidation
tCDocumentReportAll.tcCDocRepCompanyBankStreet1 = tqBankNumberByCinvoiceid.tcAddressStreet1
tCDocumentReportAll.tcCDocRepCompanyBankStreet2 = tqBankNumberByCinvoiceid.tcAddressStreet2
tCDocumentReportAll.tcCDocRepCompanyBankZip = tqBankNumberByCinvoiceid.tcAddressZip
tCDocumentReportAll.tiCDocRepCompanyBankFormat = tqBankNumberByCinvoiceid.tiAddressFormat.
end.
end.
/* Company Data */
if available tqCompanyPropertyByCompanyId
then assign tCDocumentReportAll.tcCDocRepCompanyBRCode = tqCompanyPropertyByCompanyId.tcBusinessRelationCode
tCDocumentReportAll.tcCDocRepCompanyCity = tqCompanyPropertyByCompanyId.tcAddressCity
tCDocumentReportAll.tcCDocRepCompanyCountry = tqCompanyPropertyByCompanyId.tcCountryDescription
tCDocumentReportAll.tcCDocRepCompanyCounty = tqCompanyPropertyByCompanyId.tcCountyDescription
tCDocumentReportAll.tcCDocRepCompanyName1 = tqCompanyPropertyByCompanyId.tcBusinessRelationName1
tCDocumentReportAll.tcCDocRepCompanyName2 = tqCompanyPropertyByCompanyId.tcBusinessRelationName2
tCDocumentReportAll.tcCDocRepCompanyStreet1 = tqCompanyPropertyByCompanyId.tcAddressStreet1
tCDocumentReportAll.tcCDocRepCompanyStreet2 = tqCompanyPropertyByCompanyId.tcAddressStreet2
tCDocumentReportAll.tcCDocRepCompanyStreet3 = tqCompanyPropertyByCompanyId.tcAddressStreet3
tCDocumentReportAll.tcCDocRepCompanyZip = tqCompanyPropertyByCompanyId.tcAddressZip
tCDocumentReportAll.tiCDocRepCompanyFormat = tqCompanyPropertyByCompanyId.tiAddressFormat.
<Q-10 run BankNumberByDocID (all) (Read) (NoCache)
(input tqCDocumentByFilter.tiCompany_ID, (CompanyId)
input tqCDocumentByFilter.tiCDocument_ID, (CDocument_ID)
output dataset tqBankNumberByDocID) in BCDocumentReport >
find first tqBankNumberByDocID no-lock no-error.
if available tqBankNumberByDocID
then assign tCDocumentReportAll.tcCDocRepCredBankBRCity = tqBankNumberByDocID.tcAddressCity
tCDocumentReportAll.tcCDocRepCredBankBRCode = tqBankNumberByDocID.tcBusinessRelationCode
tCDocumentReportAll.tcCDocRepCredBankBRCountry = tqBankNumberByDocID.tcCountryDescription
tCDocumentReportAll.tcCDocRepCredBankBRCounty = tqBankNumberByDocID.tcCountyDescription
tCDocumentReportAll.tcCDocRepCredBankBRName1 = tqBankNumberByDocID.tcBusinessRelationName1
tCDocumentReportAll.tcCDocRepCredBankBRName2 = tqBankNumberByDocID.tcBusinessRelationName2
tCDocumentReportAll.tcCDocRepCredBankBRStreet1 = tqBankNumberByDocID.tcAddressStreet1
tCDocumentReportAll.tcCDocRepCredBankBRStreet2 = tqBankNumberByDocID.tcAddressStreet2
tCDocumentReportAll.tcCDocRepCredBankBRZip = tqBankNumberByDocID.tcAddressZip
tCDocumentReportAll.tiCDocRepCredBankBRFormat = tqBankNumberByDocID.tiAddressFormat
tCDocumentReportAll.tcCDocRepCredBankNumber = tqBankNumberByDocID.tcBankNumber
tCDocumentReportAll.tcCDocRepCredBankNumberExten = tqBankNumberByDocID.tcBankNumberExtension
tCDocumentReportAll.tcCDocRepCredBankNumberForm = tqBankNumberByDocID.tcBankNumberFormatted
tCDocumentReportAll.tcCDocRepCredBankNumberSwift = tqBankNumberByDocID.tcBankNumberSwiftCode
tCDocumentReportAll.tcCDocRepCredBankNumberVal = tqBankNumberByDocID.tcBankNumberValidation.
/* Address Info */
if available tqAddressByBusRelAddressType
then assign tCDocumentReportAll.tcCDocRepCredName1 = tqAddressByBusRelAddressType.tcAddressName
tCDocumentReportAll.tcCDocRepCredCity = tqAddressByBusRelAddressType.tcAddressCity
tCDocumentReportAll.tcCDocRepCredCountry = tqAddressByBusRelAddressType.tcCountryDescription
tCDocumentReportAll.tcCDocRepCredCounty = tqAddressByBusRelAddressType.tcCountyDescription
tCDocumentReportAll.tcCDocRepCredStreet1 = tqAddressByBusRelAddressType.tcAddressStreet1
tCDocumentReportAll.tcCDocRepCredStreet2 = tqAddressByBusRelAddressType.tcAddressStreet2
tCDocumentReportAll.tcCDocRepCredStreet3 = tqAddressByBusRelAddressType.tcAddressStreet3
tCDocumentReportAll.tcCDocRepCredZip = tqAddressByBusRelAddressType.tcAddressZip
tCDocumentReportAll.tiCDocRepCredFormat = tqAddressByBusRelAddressType.tiAddressFormat
tCDocumentReportAll.tcCDocRepCredState = tqAddressByBusRelAddressType.tcStateCode.
/* VAT Number */
if available tqVatNumberByBusRelCountry
then assign tCDocumentReportAll.tcCDocRepCredVatNumber = tqVatNumberByBusRelCountry.tcVatNumberIdentity.