project QadFinancials > class BMfgDaybookSetReport > method DaybookSetReport

report procedure


Parameters


icLanguageCodeinputcharacter
tFilterinputtemp-table
dcrDaybookSetReportoutputdataset
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program7/bmfgdaybooksetreport.p)

empty temp-table tqDaybookSetReport.
assign vlDaybookSetBySite = false.

<M-1 run GetReportLabels
   (input  'DaybookSetReport':U (icReportName), 
    input  icLanguageCode (icLanguageCode), 
    input  tFilter (tFilter), 
    output tqHeader (tqHeader), 
    output tqFilter (tqFilter), 
    output tqText (tqText), 
    output oiReturnStatus (oiReturnStatus)) in BMfgDaybookSetReport>                          
                          
if oiReturnStatus <> 0
then return.                          

<M-2 run SetDataItemsBasedOnFilterTT  (output oiReturnStatus (oiReturnStatus)) in BMfgDaybookSetReport>

<Q-12 run POAccountingControlByDomain (all) (Read) (NoCache)
   (input vcDomainCode, (Domain)
    output dataset tqPOAccountingControlByDomain) in BMfgPOAccountingControl >

find first tqPOAccountingControlByDomain no-error.
if available tqPOAccountingControlByDomain 
then assign vlDaybookSetBySite = tqPOAccountingControlByDomain.tlpoc_dybkset_by_site.  

<Q-3 run DaybookSetByCodeType (all) (Read) (NoCache)
   (input vcFromDaybookSet, (FromDaybookSet)
    input vcDBSType, (DaybookSetType)
    input vlDaybookSetActive, (DaybookSetActive)
    input vcToDaybookSet, (ToDaybookSet)
    input vcDomainCode, (DomainCode)
    output dataset tqDaybookSetByCodeType) in BMfgDaybookSetReport >
    
for each tqDaybookSetByCodeType:
if (not vlDaybookSetBySite 
    and (tqDaybookSetByCodeType.tcdybs_site <> "":U  
    and  tqDaybookSetByCodeType.tcdybs_site <> ?))
then next.          

    if tqDaybookSetByCodeType.tcdybs_invoices_dybk <> "":U and
       tqDaybookSetByCodeType.tcdybs_invoices_dybk <> ?
    then do:    
        create tqDaybookSetReport.
        assign 
            tqDaybookSetReport.tcDaybookSetCode     = tqDaybookSetByCodeType.tcdybs_code            
            tqDaybookSetReport.tcDaybookSetDesc     = tqDaybookSetByCodeType.tcdybs_desc
            tqDaybookSetReport.tcSite               = tqDaybookSetByCodeType.tcdybs_site
            tqDaybookSetReport.tcDaybookCode        = tqDaybookSetByCodeType.tcdybs_invoices_dybk. 
            /* tqDaybookSetReport.tcDaybookType        =  "Invoice Daybook":U. */

        if tqDaybookSetByCodeType.tldybs_active = true
        then assign tqDaybookSetReport.tcDaybookSetIsActive = trim(#T-13'Yes':4(16037)T-13#).
        else if tqDaybookSetByCodeType.tldybs_active = false
        then assign tqDaybookSetReport.tcDaybookSetIsActive = trim(#T-14'No':4(16038)T-14#).         
        
        if tqDaybookSetByCodeType.tcdybs_type = "1":U
        then assign tqDaybookSetReport.tcDaybookSetType = {&DAYBOOKSETTYPE-AR}.
        else if tqDaybookSetByCodeType.tcdybs_type = "2":U
        then assign tqDaybookSetReport.tcDaybookSetType = {&DAYBOOKSETTYPE-AP}.            
    end.
    if tqDaybookSetByCodeType.tcdybs_credit_dybk <> "":U and
       tqDaybookSetByCodeType.tcdybs_credit_dybk <> ?
    then do:    
        create tqDaybookSetReport.
        assign 
            tqDaybookSetReport.tcDaybookSetCode     = tqDaybookSetByCodeType.tcdybs_code            
            tqDaybookSetReport.tcDaybookSetDesc     = tqDaybookSetByCodeType.tcdybs_desc
            tqDaybookSetReport.tcSite               = tqDaybookSetByCodeType.tcdybs_site
            tqDaybookSetReport.tcDaybookCode        = tqDaybookSetByCodeType.tcdybs_credit_dybk.
            /* tqDaybookSetReport.tcDaybookType        = "Credit Note Daybook":U. */     
        
        if tqDaybookSetByCodeType.tldybs_active = true
        then assign tqDaybookSetReport.tcDaybookSetIsActive = trim(#T-31'Yes':4(16037)T-31#).
        else if tqDaybookSetByCodeType.tldybs_active = false
        then assign tqDaybookSetReport.tcDaybookSetIsActive = trim(#T-32'No':4(16038)T-32#).   
                      
        if tqDaybookSetByCodeType.tcdybs_type = "1":U
        then assign tqDaybookSetReport.tcDaybookSetType = {&DAYBOOKSETTYPE-AR}.
        else if tqDaybookSetByCodeType.tcdybs_type = "2":U
        then assign tqDaybookSetReport.tcDaybookSetType = {&DAYBOOKSETTYPE-AP}.             
    end.         
    if tqDaybookSetByCodeType.tcdybs_interco_dybk <> "":U and
       tqDaybookSetByCodeType.tcdybs_interco_dybk <> ?
    then do:    
        create tqDaybookSetReport.
        assign 
            tqDaybookSetReport.tcDaybookSetCode     = tqDaybookSetByCodeType.tcdybs_code            
            tqDaybookSetReport.tcDaybookSetDesc     = tqDaybookSetByCodeType.tcdybs_desc
            tqDaybookSetReport.tcSite               = tqDaybookSetByCodeType.tcdybs_site
            tqDaybookSetReport.tcDaybookCode        = tqDaybookSetByCodeType.tcdybs_interco_dybk.
           /* tqDaybookSetReport.tcDaybookType        = "Intercompany Daybook":U.  */      

        if tqDaybookSetByCodeType.tldybs_active = true
        then assign tqDaybookSetReport.tcDaybookSetIsActive = trim(#T-33'Yes':4(16037)T-33#).
        else if tqDaybookSetByCodeType.tldybs_active = false
        then assign tqDaybookSetReport.tcDaybookSetIsActive = trim(#T-34'No':4(16038)T-34#).    
        
        if tqDaybookSetByCodeType.tcdybs_type = "1":U
        then assign tqDaybookSetReport.tcDaybookSetType = {&DAYBOOKSETTYPE-AR}.
        else if tqDaybookSetByCodeType.tcdybs_type = "2":U
        then assign tqDaybookSetReport.tcDaybookSetType = {&DAYBOOKSETTYPE-AP}.             
    end.     
    if tqDaybookSetByCodeType.tcdybs_neg_criv_dybk <> "":U and
       tqDaybookSetByCodeType.tcdybs_neg_criv_dybk <> ?
    then do:    
        create tqDaybookSetReport.
        assign 
            tqDaybookSetReport.tcDaybookSetCode     = tqDaybookSetByCodeType.tcdybs_code            
            tqDaybookSetReport.tcDaybookSetDesc     = tqDaybookSetByCodeType.tcdybs_desc
            tqDaybookSetReport.tcSite               = tqDaybookSetByCodeType.tcdybs_site
            tqDaybookSetReport.tcDaybookCode        = tqDaybookSetByCodeType.tcdybs_neg_criv_dybk. 
           /* tqDaybookSetReport.tcDaybookType        = "Correction Invoices (Negative)":U.  */
                  
        if tqDaybookSetByCodeType.tldybs_active = true
        then assign tqDaybookSetReport.tcDaybookSetIsActive = trim(#T-35'Yes':4(16037)T-35#).
        else if tqDaybookSetByCodeType.tldybs_active = false
        then assign tqDaybookSetReport.tcDaybookSetIsActive = trim(#T-36'No':4(16038)T-36#).  
        
        if tqDaybookSetByCodeType.tcdybs_type = "1":U
        then assign tqDaybookSetReport.tcDaybookSetType = {&DAYBOOKSETTYPE-AR}.
        else if tqDaybookSetByCodeType.tcdybs_type = "2":U
        then assign tqDaybookSetReport.tcDaybookSetType = {&DAYBOOKSETTYPE-AP}.             
    end.  
    if tqDaybookSetByCodeType.tcdybs_neg_crcn_dybk <> "":U and
       tqDaybookSetByCodeType.tcdybs_neg_crcn_dybk <> ?
    then do:    
        create tqDaybookSetReport.
        assign 
            tqDaybookSetReport.tcDaybookSetCode     = tqDaybookSetByCodeType.tcdybs_code            
            tqDaybookSetReport.tcDaybookSetDesc     = tqDaybookSetByCodeType.tcdybs_desc
            tqDaybookSetReport.tcSite               = tqDaybookSetByCodeType.tcdybs_site
            tqDaybookSetReport.tcDaybookCode        = tqDaybookSetByCodeType.tcdybs_neg_crcn_dybk. 
          /*  tqDaybookSetReport.tcDaybookType        = "Correction Credit Notes (Negative)":U.  */

        if tqDaybookSetByCodeType.tldybs_active = true
        then assign tqDaybookSetReport.tcDaybookSetIsActive = trim(#T-37'Yes':4(16037)T-37#).
        else if tqDaybookSetByCodeType.tldybs_active = false
        then assign tqDaybookSetReport.tcDaybookSetIsActive = trim(#T-38'No':4(16038)T-38#).  
                    
        if tqDaybookSetByCodeType.tcdybs_type = "1":U
        then assign tqDaybookSetReport.tcDaybookSetType = {&DAYBOOKSETTYPE-AR}.
        else if tqDaybookSetByCodeType.tcdybs_type = "2":U
        then assign tqDaybookSetReport.tcDaybookSetType = {&DAYBOOKSETTYPE-AP}.             
    end. 
    if tqDaybookSetByCodeType.tcdybs_pos_criv_dybk <> "":U and
       tqDaybookSetByCodeType.tcdybs_pos_criv_dybk <> ?
    then do:    
        create tqDaybookSetReport.
        assign 
            tqDaybookSetReport.tcDaybookSetCode     = tqDaybookSetByCodeType.tcdybs_code            
            tqDaybookSetReport.tcDaybookSetDesc     = tqDaybookSetByCodeType.tcdybs_desc
            tqDaybookSetReport.tcSite               = tqDaybookSetByCodeType.tcdybs_site
            tqDaybookSetReport.tcDaybookCode        = tqDaybookSetByCodeType.tcdybs_pos_criv_dybk. 
          /*  tqDaybookSetReport.tcDaybookType        = "Correction Invoices (Positive)":U. */

        if tqDaybookSetByCodeType.tldybs_active = true
        then assign tqDaybookSetReport.tcDaybookSetIsActive = trim(#T-39'Yes':4(16037)T-39#).
        else if tqDaybookSetByCodeType.tldybs_active = false
        then assign tqDaybookSetReport.tcDaybookSetIsActive = trim(#T-40'No':4(16038)T-40#).  
            
        if tqDaybookSetByCodeType.tcdybs_type = "1":U
        then assign tqDaybookSetReport.tcDaybookSetType = {&DAYBOOKSETTYPE-AR}.
        else if tqDaybookSetByCodeType.tcdybs_type = "2":U
        then assign tqDaybookSetReport.tcDaybookSetType = {&DAYBOOKSETTYPE-AP}.             
    end. 
    if tqDaybookSetByCodeType.tcdybs_pos_crcn_dybk <> "":U and
       tqDaybookSetByCodeType.tcdybs_pos_crcn_dybk <> ?
    then do:    
        create tqDaybookSetReport.
        assign 
            tqDaybookSetReport.tcDaybookSetCode     = tqDaybookSetByCodeType.tcdybs_code            
            tqDaybookSetReport.tcDaybookSetDesc     = tqDaybookSetByCodeType.tcdybs_desc
            tqDaybookSetReport.tcSite               = tqDaybookSetByCodeType.tcdybs_site
            tqDaybookSetReport.tcDaybookCode        = tqDaybookSetByCodeType.tcdybs_pos_crcn_dybk. 
          /*  tqDaybookSetReport.tcDaybookType        = "Correction Credit Notes (Positive)":U.  */      

        if tqDaybookSetByCodeType.tldybs_active = true
        then assign tqDaybookSetReport.tcDaybookSetIsActive = trim(#T-41'Yes':4(16037)T-41#).
        else if tqDaybookSetByCodeType.tldybs_active = false
        then assign tqDaybookSetReport.tcDaybookSetIsActive = trim(#T-42'No':4(16038)T-42#).  
        
        if tqDaybookSetByCodeType.tcdybs_type = "1":U
        then assign tqDaybookSetReport.tcDaybookSetType = {&DAYBOOKSETTYPE-AR}.
        else if tqDaybookSetByCodeType.tcdybs_type = "2":U
        then assign tqDaybookSetReport.tcDaybookSetType = {&DAYBOOKSETTYPE-AP}.             
    end. 
    if tqDaybookSetByCodeType.tcdybs_adjustment_dybk <> "":U and
       tqDaybookSetByCodeType.tcdybs_adjustment_dybk <> ?
    then do:    
        create tqDaybookSetReport.
        assign 
            tqDaybookSetReport.tcDaybookSetCode     = tqDaybookSetByCodeType.tcdybs_code            
            tqDaybookSetReport.tcDaybookSetDesc     = tqDaybookSetByCodeType.tcdybs_desc
            tqDaybookSetReport.tcSite               = tqDaybookSetByCodeType.tcdybs_site
            tqDaybookSetReport.tcDaybookCode        = tqDaybookSetByCodeType.tcdybs_adjustment_dybk. 
          /*  tqDaybookSetReport.tcDaybookType        = "Adjustment Daybook":U. */       

        if tqDaybookSetByCodeType.tldybs_active = true
        then assign tqDaybookSetReport.tcDaybookSetIsActive = trim(#T-43'Yes':4(16037)T-43#).
        else if tqDaybookSetByCodeType.tldybs_active = false
        then assign tqDaybookSetReport.tcDaybookSetIsActive = trim(#T-44'No':4(16038)T-44#).  
        
        if tqDaybookSetByCodeType.tcdybs_type = "1":U
        then assign tqDaybookSetReport.tcDaybookSetType = {&DAYBOOKSETTYPE-AR}.
        else if tqDaybookSetByCodeType.tcdybs_type = "2":U
        then assign tqDaybookSetReport.tcDaybookSetType = {&DAYBOOKSETTYPE-AP}.             
    end.
end.    
    for each tqDaybookSetReport:
        <Q-49 run JournalByJournalCode (all) (Read) (NoCache)
           (input viCompanyId, (CompanyId)
            input tqDaybookSetReport.tcDaybookCode, (JournalCode)
            output dataset tqJournalByJournalCode) in BJournal >
        
        find first tqJournalByJournalCode
                   where tqJournalByJournalCode.tcJournalCode = tqDaybookSetReport.tcDaybookCode no-error.
        if available tqJournalByJournalCode
        then do:            
            assign 
                tqDaybookSetReport.tcDaybookDesc     =  tqJournalByJournalCode.tcJournalDescription
                tqDaybookSetReport.tcDaybookType     =  tqJournalByJournalCode.tcJournalTypeCodeTr.
                
            if tqJournalByJournalCode.tlJournalIsActive = true 
            then assign tqDaybookSetReport.tcDaybookIsActive  = trim(#T-45'Yes':4(16037)T-45#).
            else if tqJournalByJournalCode.tlJournalIsActive = false
            then assign tqDaybookSetReport.tcDaybookIsActive  = trim(#T-48'No':4(16038)T-48#). 
                
            if tqJournalByJournalCode.tcJournalControl = {&JOURNALCONTROL-FINANCIAL}
            then do:
            
                <Q-9 run FirstNumber (all) (Read) (NoCache)
                   (input viCompanyId, (CompanyId)
                    input Year(Today), (NumbrYear)
                    input tqDaybookSetReport.tcDaybookCode, (NumbrType)
                    input {&NUMBERSTATUS-RELEASED}, (NumbrStatus)
                    output dataset tqFirstNumber) in BNumber >

                find first tqFirstNumber no-error.
                if available tqFirstNumber
                then do:
                    assign tqDaybookSetReport.tiNextSequenceNum = tqFirstNumber.tiNumbr.
                end.
                else assign tqDaybookSetReport.tiNextSequenceNum = 1.
            end.
            else if tqJournalByJournalCode.tcJournalControl = {&JOURNALCONTROL-LOGISTIC}
            then do:
            
                vhFcComponent = ?.
                <M-11 run APINextNumberInSequence
                   (input  vcDomainCode (icDomain), 
                    input  tqDaybookSetReport.tcDaybookCode (icSequence), 
                    output tqDaybookSetReport.tiNextSequenceNum (oiNumber), 
                    output oiReturnStatus (oiReturnStatus)) in BMfgNRM>
            end. 
        end.
    end.