project QadFinancials > class BDDocumentReport > method DDocumentReportAllCreate


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BDDocumentReport.DDocumentReportAll


program code (program4/bddocumentreport.p)

create tDDocumentReportAll.                            
        assign tDDocumentReportAll.tcDDocRepDocumentType             = tqDDocumentForAll.tcDDocumentType
               tDDocumentReportAll.tiDDocumentID                     = tqDDocumentForAll.tiDDocument_ID
               tDDocumentReportAll.tiDDocRepYear                     = tqDDocumentForAll.tiDDocumentYear
               tDDocumentReportAll.tiDDocRepNumber                   = tqDDocumentForAll.tiDDocumentNumber
               tDDocumentReportAll.tcDDocRepDocumentStatus           = tqDDocumentForAll.tcDDocumentStatus
               tDDocumentReportAll.tcDDocRepReference                = tqDDocumentForAll.tcDDocumentReference
               tDDocumentReportAll.ttDDocRepDueDate                  = tqDDocumentForAll.ttDDocumentDueDate
               tDDocumentReportAll.tdDDocRepAmount                   = 0
               tDDocumentReportAll.tcDDocRepAmountInText             = "":U
               /*tDDocumentReportAll.tcDDocRepCurrency                 = "":U
               tDDocumentReportAll.ttDDocRepCreationDate             = today*/
               tDDocumentReportAll.tcDDocRepCurrency                 = tqDDocumentForAll.tcCurrencyCode
               tDDocumentReportAll.ttDDocRepCreationDate             = tqDDocumentForAll.ttDDocumentCreationDate
               tDDocumentReportAll.tcDDocRepCompanyBRCode            = tqCompanyPropByOwnCompanyID.tcBusinessRelationCode
               tDDocumentReportAll.tcDDocRepCompanyName1             = tqCompanyPropByOwnCompanyID.tcBusinessRelationName1
               tDDocumentReportAll.tcDDocRepCompanyName2             = tqCompanyPropByOwnCompanyID.tcBusinessRelationName2
               tDDocumentReportAll.tcDDocRepCompanyStreet1           = tqCompanyPropByOwnCompanyID.tcAddressStreet1
               tDDocumentReportAll.tcDDocRepCompanyStreet2           = tqCompanyPropByOwnCompanyID.tcAddressStreet2

               tDDocumentReportAll.tcDDocRepCompanyStreet3           = tqCompanyPropByOwnCompanyID.tcAddressStreet3

               tDDocumentReportAll.tcDDocRepCompanyZip               = tqCompanyPropByOwnCompanyID.tcAddressZip
               tDDocumentReportAll.tcDDocRepCompanyCity              = tqCompanyPropByOwnCompanyID.tcAddressCity
               tDDocumentReportAll.tiDDocRepCompanyFormat            = tqCompanyPropByOwnCompanyID.tiAddressFormat
               tDDocumentReportAll.tcDDocRepCompanyCounty            = tqCompanyPropByOwnCompanyID.tcCountyDescription
               tDDocumentReportAll.tcDDocRepCompanyCountry           = tqCompanyPropByOwnCompanyID.tcCountryDescription.


       find first tqBankNumberForDebtor where tqBankNumberForDebtor.tiBankNumber_ID = tqDDocumentForAll.tiBankNumber_ID no-lock no-error.
       if available tqBankNumberForDebtor
          then assign
               tDDocumentReportAll.tcDDocRepCompanyBankNumber        = tqBankNumberForDebtor.tcBankNumber
               tDDocumentReportAll.tcDDocRepCompanyBankNumberForm    = tqBankNumberForDebtor.tcBankNumberFormatted
               tDDocumentReportAll.tcDDocRepCompanyBankNumberExten   = tqBankNumberForDebtor.tcBankNumberExtension
               tDDocumentReportAll.tcDDocRepCompanyBankNumberValid   = tqBankNumberForDebtor.tcBankNumberValidation
               tDDocumentReportAll.tcDDocRepCompanyBankNumberSwift   = tqBankNumberForDebtor.tcBankNumberSwiftCode
               tDDocumentReportAll.tcDDocRepCompanyBankBRCode        = tqBankNumberForDebtor.tcBusinessRelationCode
               tDDocumentReportAll.tcDDocRepCompanyBankName1         = tqBankNumberForDebtor.tcBusinessRelationName1
               tDDocumentReportAll.tcDDocRepCompanyBankName2         = tqBankNumberForDebtor.tcBusinessRelationName2
               tDDocumentReportAll.tcDDocRepCompanyBankStreet1       = tqBankNumberForDebtor.tcAddressStreet1
               tDDocumentReportAll.tcDDocRepCompanyBankStreet2       = tqBankNumberForDebtor.tcAddressStreet2
               tDDocumentReportAll.tcDDocRepCompanyBankZip           = tqBankNumberForDebtor.tcAddressZip
               tDDocumentReportAll.tcDDocRepCompanyBankCity          = tqBankNumberForDebtor.tcAddressCity
               tDDocumentReportAll.tiDDocRepCompanyBankFormat        = tqBankNumberForDebtor.tiAddressFormat
               tDDocumentReportAll.tcDDocRepCompanyBankCounty        = tqBankNumberForDebtor.tcCountyDescription
               tDDocumentReportAll.tcDDocRepCompanyBankCountry       = tqBankNumberForDebtor.tcCountryDescription.
        
        assign tDDocumentReportAll.tcDDocRepDebtorBRCode               = tqHeadOfficeForDebtor.tcBusinessRelationCode
               tDDocumentReportAll.tcDDocRepDebtorName1                = tqHeadOfficeForDebtor.tcBusinessRelationName1
               tDDocumentReportAll.tcDDocRepDebtorName2                = tqHeadOfficeForDebtor.tcBusinessRelationName2
               tDDocumentReportAll.tcDDocRepDebtorStreet1              = tqHeadOfficeForDebtor.tcAddressStreet1
               tDDocumentReportAll.tcDDocRepDebtorStreet2              = tqHeadOfficeForDebtor.tcAddressStreet2
               tDDocumentReportAll.tcDDocRepDebtorStreet3              = tqHeadOfficeForDebtor.tcAddressStreet3
               tDDocumentReportAll.tcDDocRepDebtorZip                  = tqHeadOfficeForDebtor.tcAddressZip
               tDDocumentReportAll.tcDDocRepDebtorCity                 = tqHeadOfficeForDebtor.tcAddressCity
               tDDocumentReportAll.tiDDocRepDebtorFormat               = tqHeadOfficeForDebtor.tiAddressFormat
               tDDocumentReportAll.tcDDocRepDebtorCounty               = tqHeadOfficeForDebtor.tcCountyDescription
               tDDocumentReportAll.tcDDocRepDebtorCountry              = tqHeadOfficeForDebtor.tcCountryDescription
               tDDocumentReportAll.tcDDocRepDebtorCode                 = tqHeadOfficeForDebtor.tcDebtorCode
               tDDocumentReportAll.tcDDocRepDebtorVatNumber            = "":U.
  /*   
  The following query is not correct as DDocument table should be used instead of CDocument
  <Q-6 run BankNumberForDocument (all) (Read) (NoCache)
     (input tqDDocumentForAll.tiCompany_ID, (CompanyId)
      input tqDDocumentForAll.tiDDocument_ID, (Document_ID)
      output dataset tqBankNumberForDocument) in BDDocumentReport >
      */
  <Q-7 run BankNumberForDocumentID (all) (Read) (NoCache)
     (input tqDDocumentForAll.tiCompany_ID, (CompanyId)
      input tqDDocumentForAll.tiDDocument_ID, (Document_ID)
      output dataset tqBankNumberForDocumentID) in BDDocumentReport >
  find first tqBankNumberForDocumentID no-lock no-error.
  if available tqBankNumberForDocumentID
        then do:
            assign
               tDDocumentReportAll.tcDDocRepDebtorBankNumber           = tqBankNumberForDocumentID.tcBankNumber
               tDDocumentReportAll.tcDDocRepDebtorBankNumberForm       = tqBankNumberForDocumentID.tcBankNumberFormatted
               tDDocumentReportAll.tcDDocRepDebtorBankNumberExtent     = tqBankNumberForDocumentID.tcBankNumberExtension
               tDDocumentReportAll.tcDDocRepDebtorBankNumberVal        = tqBankNumberForDocumentID.tcBankNumberValidation
               tDDocumentReportAll.tcDDocRepDebtorBankNumberSwift      = tqBankNumberForDocumentID.tcBankNumberSwiftCode
               tDDocumentReportAll.tcDDocRepDebtorBankBRCode           = tqBankNumberForDocumentID.tcBusinessRelationCode
               tDDocumentReportAll.tcDDocRepDebtorBankBRName1          = tqBankNumberForDocumentID.tcBusinessRelationName1
               tDDocumentReportAll.tcDDocRepDebtorBankBRName2          = tqBankNumberForDocumentID.tcBusinessRelationName2
               tDDocumentReportAll.tcDDocRepDebtorBankBRStreet1        = tqBankNumberForDocumentID.tcAddressStreet1
               tDDocumentReportAll.tcDDocRepDebtorBankBRStreet2        = tqBankNumberForDocumentID.tcAddressStreet2
               tDDocumentReportAll.tcDDocRepDebtorBankBRZip            = tqBankNumberForDocumentID.tcAddressZip
               tDDocumentReportAll.tcDDocRepDebtorBankBRCity           = tqBankNumberForDocumentID.tcAddressCity
               tDDocumentReportAll.tiDDocRepDebtorBankBRFormat         = tqBankNumberForDocumentID.tiAddressFormat
               tDDocumentReportAll.tcDDocRepDebtorBankBRCounty         = tqBankNumberForDocumentID.tcCountyDescription
               tDDocumentReportAll.tcDDocRepDebtorBankBRCountry        = tqBankNumberForDocumentID.tcCountryDescription.
  
            empty temp-table tqSelectVatNumberForDDocument.
            <Q-2 run SelectVatNumberForDDocument (all) (Read) (NoCache)
               (input if available tqBankNumberForDebtor then tqBankNumberForDebtor.tiBusinessRelation_ID else ?, (BussinessRelationID)
                input tqHeadOfficeForDebtor.tiCountry_ID, (CountryID)
                output dataset tqSelectVatNumberForDDocument) in BDDocumentReport >
            find first tqSelectVatNumberForDDocument no-lock no-error.
            if available tqSelectVatNumberForDDocument
            then ASSIGN tDDocumentReportAll.tcDDocRepDebtorVatNumber = tqSelectVatNumberForDDocument.tcVatNumberIdentity.
   end.
        assign tDDocumentReportAll.tcDDocRepDInvoiceDebtorCode      = tqHeadOfficeForDebtor.tcDebtorCode.