project QadFinancials > class BAPMatchingReport > method SetDataItemsBasedOnFilterTT

Description

This method will transfer the filter parameters values to the variables defined in BL code.


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BAPMatchingReport.InvoiceMatching
method BAPMatchingReport.MatchingVariance
method BAPMatchingReport.MatchingVarianceForLC
method BAPMatchingReport.UnmatchedReceipt


program code (program7/bapmatchingreport.p)

/* Find all filter-parameters and assign them to the correct data-item */
assign 
    vcCompanyFilter = ?
    viCreditorIDAPMFilter = ?
    viInvoiceYearAPMFilter = ?
    vtInvoiceDateFilter = ?
    viInvoiceNumberFilter = ?
    viCompanyIDFilter = ?
    vcCreditorCodeFromFilter = ?
    vcCreditorCodeToFilter = ?
    viFromInvoiceYearFilter = ?
    viToInvoiceYearFilter = ?
    vcFromInvoiceJournalFilter = ?
    vcToInvoiceJournalFilter = ? 
    viFromInvoiceNumberFilter = ?
    viToInvoiceNumberFilter = ?
    vtFromInvoiceDateFilter = ?
    vtToInvoiceDateFilter = ?
    vcInvoiceRefFilter = ?
    vcMatchStatusFilter = ?
    vtFromMatchDateFilter = ?
    vtToMatchDateFilter = ?
    vcMatchTypeFilter = ?
    vcFromPurchaseOrderFilter = ?
    vcToPurchaseOrderFilter = ?
    vcFromItemFilter = ?
    vcToItemFilter = ?
    vtFromReceiptDateFilter = ?
    vtToReceiptDateFilter = ?
    vcSiteFilter = ?
    vcGLAcctCodeFilter = ?
    vcDivisionCodeFilter = ?
    vcCostCenterCodeFilter = ?
    vlIncludeInventory = ?
    vlIncludeSubcontracted = ?
    vlIncludeMemo = ?
    vlIncludeLogisitic = ?
    vtFromPODateFilter = ?
    vtToPODateFilter = ?
    vcFromLgChargeFilter = ?
    vcToLgChargeFilter = ?
    vcBuyerFilter = ?
    vlIncludeReturn = ?
    vcCurrFilter = ?
    vcRateCostRef = ?
    vcFromInternalRefFilter = ?
    vcToInternalRefFilter = ?
    vtFromInvoicePostDateFilter = ?
    vtToInvoicePostDateFilter = ?
    vcFromShipFromFilter = ?
    vcToShipFromFilter = ?
    vcFromShipToFilter = ?
    vcToShipToFilter = ?
    vdShowVarOverPerFilter = ?
    vdShowVarOverAmtFilter = ?
    vlShowPostingDetailsFilter = ?
    vcSortingFilter = ?
    vcOrderTypeFilter = ?
    vlIsBlankSupplierFilter = ?
    vlShowOnlyVar = ?.

       
/*BE CAREFUL - USE THE SAME STRING CONSTANTS 
a) here after when phrase as well as in
b) GetBusinessFields for assigning tBusinessFields.tcFcFieldName*/
for each tFilter:
    case tFilter.tcBusinessFieldName:
        when "Company_CANDO":U
            then do :
                assign vcCompanyFilter = tFilter.tcParameterValue no-error.
                if num-entries(tFilter.tcParameterValue) = 1
                then do :
                    <Q-1 run CompanyPrim (all) (Read) (NoCache)
                       (input ?, (LookupCompanyId)
                        input trim(entry(1,tFilter.tcParameterValue,',':U)), (CompanyCode)
                        output dataset tqCompanyPrim) in BCompany >
                    find first tqCompanyPrim where 
                               tqCompanyPrim.tcCompanyCode = trim(entry(1,tFilter.tcParameterValue,',':U))
                               no-lock no-error.
                    if available tqCompanyPrim
                    then assign viCompanyIDFilter = tqCompanyPrim.tiCompany_ID.
                end. /* if num-entries(tFilter.tcParameterValue) = 1 */
            end. /* when */
        when "CreditorCode_RANGE":U
            then do :
                if tFilter.tcOperator = ">=":U
                then assign vcCreditorCodeFromFilter = tFilter.tcParameterValue no-error.
                else if tFilter.tcOperator = "<=":U
                     then assign vcCreditorCodeToFilter = tFilter.tcParameterValue no-error.
            end.
        when "InvYear_RANGE":U
             then if tFilter.tcOperator = ">=":U
                then assign viFromInvoiceYearFilter = int(tFilter.tcParameterValue) no-error.
             else if tFilter.tcOperator = "<=":U
                then assign viToInvoiceYearFilter = int(tFilter.tcParameterValue) no-error.
        when "InvJournal_RANGE":U
             then if tFilter.tcOperator = ">=":U
                then assign vcFromInvoiceJournalFilter = tFilter.tcParameterValue no-error.
             else if tFilter.tcOperator = "<=":U
                then assign vcToInvoiceJournalFilter = tFilter.tcParameterValue no-error.
        when "InvoiceNumber_RANGE":U
             then if tFilter.tcOperator = ">=":U
                then assign viFromInvoiceNumberFilter = int(tFilter.tcParameterValue) no-error.
             else if tFilter.tcOperator = "<=":U
                then assign viToInvoiceNumberFilter = int(tFilter.tcParameterValue) no-error.    
        when "InvoiceDate_RANGE":U
            then if tFilter.tcOperator = ">=":U
                then assign vtFromInvoiceDateFilter = DATE(INTEGER(SUBSTRING(tFilter.tcParameterValue,5,2,"CHARACTER":U)),integer(SUBSTRING(tFilter.tcParameterValue,7,2,"CHARACTER":U)),INTEGER(SUBSTRING(tFilter.tcParameterValue,1,4,"CHARACTER":U))) no-error.
            else if tFilter.tcOperator = "<=":U
                then assign vtToInvoiceDateFilter = DATE(INTEGER(SUBSTRING(tFilter.tcParameterValue,5,2,"CHARACTER":U)),integer(SUBSTRING(tFilter.tcParameterValue,7,2,"CHARACTER":U)),INTEGER(SUBSTRING(tFilter.tcParameterValue,1,4,"CHARACTER":U))) no-error.                                                            
        when "InvoiceRef":U
            then assign vcInvoiceRefFilter = tFilter.tcParameterValue no-error.
        when "MatchStatus":U
            then assign vcMatchStatusFilter = tFilter.tcParameterValue no-error.
        when "MatchType":U
            then assign vcMatchTypeFilter = tFilter.tcParameterValue no-error.
        when "MatchingDate_RANGE":U
            then if tFilter.tcOperator = ">=":U
                then assign vtFromMatchDateFilter = DATE(INTEGER(SUBSTRING(tFilter.tcParameterValue,5,2,"CHARACTER":U)),integer(SUBSTRING(tFilter.tcParameterValue,7,2,"CHARACTER":U)),INTEGER(SUBSTRING(tFilter.tcParameterValue,1,4,"CHARACTER":U))) no-error.
            else if tFilter.tcOperator = "<=":U
                then assign vtToMatchDateFilter = DATE(INTEGER(SUBSTRING(tFilter.tcParameterValue,5,2,"CHARACTER":U)),integer(SUBSTRING(tFilter.tcParameterValue,7,2,"CHARACTER":U)),INTEGER(SUBSTRING(tFilter.tcParameterValue,1,4,"CHARACTER":U))) no-error.                                                            
        when "PO_RANGE":U
             then if tFilter.tcOperator = ">=":U
                then assign vcFromPurchaseOrderFilter = tFilter.tcParameterValue no-error.
             else if tFilter.tcOperator = "<=":U
                then assign vcToPurchaseOrderFilter = tFilter.tcParameterValue no-error.  
        when "Item_RANGE":U
             then if tFilter.tcOperator = ">=":U
                then assign vcFromItemFilter = tFilter.tcParameterValue no-error.
             else if tFilter.tcOperator = "<=":U
                then assign vcToItemFilter = tFilter.tcParameterValue no-error.  
        when "Site_CANDO":U
             then assign vcSiteFilter = tFilter.tcParameterValue no-error.
        when "ReceiptDate_RANGE":U
            then if tFilter.tcOperator = ">=":U
                then assign vtFromReceiptDateFilter = DATE(INTEGER(SUBSTRING(tFilter.tcParameterValue,5,2,"CHARACTER":U)),integer(SUBSTRING(tFilter.tcParameterValue,7,2,"CHARACTER":U)),INTEGER(SUBSTRING(tFilter.tcParameterValue,1,4,"CHARACTER":U))) no-error.
            else if tFilter.tcOperator = "<=":U
                then assign vtToReceiptDateFilter = DATE(INTEGER(SUBSTRING(tFilter.tcParameterValue,5,2,"CHARACTER":U)),integer(SUBSTRING(tFilter.tcParameterValue,7,2,"CHARACTER":U)),INTEGER(SUBSTRING(tFilter.tcParameterValue,1,4,"CHARACTER":U))) no-error.                                                            
        when "GLCode_CANDO":U
            then assign vcGLAcctCodeFilter = tFilter.tcParameterValue no-error.
        when "Division_CANDO":U
            then assign vcDivisionCodeFilter = tFilter.tcParameterValue no-error.
        when "CostCentre_CANDO":U
            then assign vcCostCenterCodeFilter = tFilter.tcParameterValue no-error.
        when "IncludeInventory":U
        then assign vlIncludeInventory = tFilter.tcParameterValue = string(true) or
                                         tFilter.tcParameterValue = "true":U.
        when "IncludeSubcontracted":U
        then assign vlIncludeSubcontracted = tFilter.tcParameterValue = string(true) or
                                         tFilter.tcParameterValue = "true":U.
        when "IncludeMemo":U
        then assign vlIncludeMemo = tFilter.tcParameterValue = string(true) or
                                         tFilter.tcParameterValue = "true":U.
        when "IncludeLgCharge":U
        then assign vlIncludeLogisitic = tFilter.tcParameterValue = string(true) or
                                         tFilter.tcParameterValue = "true":U.        
        when "PODate_RANGE":U
            then if tFilter.tcOperator = ">=":U
                then assign vtFromPODateFilter = DATE(INTEGER(SUBSTRING(tFilter.tcParameterValue,5,2,"CHARACTER":U)),integer(SUBSTRING(tFilter.tcParameterValue,7,2,"CHARACTER":U)),INTEGER(SUBSTRING(tFilter.tcParameterValue,1,4,"CHARACTER":U))) no-error.
            else if tFilter.tcOperator = "<=":U
                then assign vtToPODateFilter = DATE(INTEGER(SUBSTRING(tFilter.tcParameterValue,5,2,"CHARACTER":U)),integer(SUBSTRING(tFilter.tcParameterValue,7,2,"CHARACTER":U)),INTEGER(SUBSTRING(tFilter.tcParameterValue,1,4,"CHARACTER":U))) no-error.                                                            
        when "LgCharge_RANGE":U
             then if tFilter.tcOperator = ">=":U
                then assign vcFromLgChargeFilter = tFilter.tcParameterValue no-error.
             else if tFilter.tcOperator = "<=":U
                then assign vcToLgChargeFilter = tFilter.tcParameterValue no-error.  
        when "Buyer_CANDO":U
             then assign vcBuyerFilter = tFilter.tcParameterValue no-error.
        when "Currency":U
             then assign vcCurrFilter = tFilter.tcParameterValue no-error.
        when "IncludeReturn":U
        then assign vlIncludeReturn = tFilter.tcParameterValue = string(true) or
                                         tFilter.tcParameterValue = "true":U.
        when "RateRef":U
             then assign vcRateCostRef = tFilter.tcParameterValue no-error.
        when "InternalRef_RANGE":U
             then if tFilter.tcOperator = ">=":U
                then assign vcFromInternalRefFilter = tFilter.tcParameterValue no-error.
             else if tFilter.tcOperator = "<=":U
                then assign vcToInternalRefFilter = tFilter.tcParameterValue no-error.  
        when "InvPostDt_RANGE":U
            then if tFilter.tcOperator = ">=":U
                then assign vtFromInvoicePostDateFilter = DATE(INTEGER(SUBSTRING(tFilter.tcParameterValue,5,2,"CHARACTER":U)),integer(SUBSTRING(tFilter.tcParameterValue,7,2,"CHARACTER":U)),INTEGER(SUBSTRING(tFilter.tcParameterValue,1,4,"CHARACTER":U))) no-error.
            else if tFilter.tcOperator = "<=":U
                then assign vtToInvoicePostDateFilter = DATE(INTEGER(SUBSTRING(tFilter.tcParameterValue,5,2,"CHARACTER":U)),integer(SUBSTRING(tFilter.tcParameterValue,7,2,"CHARACTER":U)),INTEGER(SUBSTRING(tFilter.tcParameterValue,1,4,"CHARACTER":U))) no-error.                                                            
        when "ShipFrom_RANGE":U
             then if tFilter.tcOperator = ">=":U
                then assign vcFromShipFromFilter = tFilter.tcParameterValue no-error.
             else if tFilter.tcOperator = "<=":U
                then assign vcToShipFromFilter = tFilter.tcParameterValue no-error.  
        when "ShipTo_RANGE":U
             then if tFilter.tcOperator = ">=":U
                then assign vcFromShipToFilter = tFilter.tcParameterValue no-error.
             else if tFilter.tcOperator = "<=":U
                then assign vcToShipToFilter = tFilter.tcParameterValue no-error.  
        when "ShowVarOverPer":U
             then assign vdShowVarOverPerFilter = decimal(tFilter.tcParameterValue) no-error.
        when "ShowVarOverAmt":U
             then assign vdShowVarOverAmtFilter = decimal(tFilter.tcParameterValue) no-error.
        when "ShowDetail":U
             then assign vlShowPostingDetailsFilter = tFilter.tcParameterValue = string(true) or
                                                      tFilter.tcParameterValue = "true":U.
        when "SortBy":U
             then assign vcSortingFilter = tFilter.tcParameterValue no-error.
        when "OrderType":U
             then assign vcOrderTypeFilter = tFilter.tcParameterValue no-error.
        when "OnlyBlankCreditor":U
             then assign vlIsBlankSupplierFilter = tFilter.tcParameterValue = string(true) or
                                                      tFilter.tcParameterValue = "true":U.
        when "ShowOnlyVar":U
             then assign vlShowOnlyVar = tFilter.tcParameterValue = string(true) or
                                         tFilter.tcParameterValue = "true":U.                                                      
    end case. /*tFilter.tcBusinessFieldName*/
end.    



if vcCreditorCodeFromFilter  = vcCreditorCodeToFilter and 
   vcCreditorCodeFromFilter <> "":U                   and 
   vcCreditorCodeFromFilter <> ?                      and 
   viCreditorIDAPMFilter     = ? 
then do :
    <Q-2 run CreditorPrim (all) (Read) (NoCache)
       (input viCompanyIDFilter, (CompanyId)
        input ?, (CreditorId)
        input vcCreditorCodeFromFilter, (CreditorCode)
        output dataset tqCreditorPrim) in BCreditor >
    find tqCreditorPrim where
         tqCreditorPrim.tcCreditorCode = vcCreditorCodeFromFilter
         no-lock no-error. /* do not use a 'first' option as there may be multiple ones with the same code in case viCompanyIDFilter is empty */
    if available tqCreditorPrim
    then assign viCreditorIDAPMFilter = tqCreditorPrim.tiCreditor_ID.
end. /* if vcCreditorCodeFromFilter  = vcCreditorCodeToFilter and  */

if viFromInvoiceYearFilter <> ? and 
   viFromInvoiceYearFilter <> 0 and 
   viFromInvoiceYearFilter  = viToInvoiceYearFilter
then assign viInvoiceYearAPMFilter = viToInvoiceYearFilter.
                                                                                                     
if viFromInvoiceNumberFilter <> ? and 
   viFromInvoiceNumberFilter <> 0 and 
   viFromInvoiceNumberFilter  = viToInvoiceNumberFilter
then assign viInvoiceNumberFilter = viToInvoiceNumberFilter.

if vtFromInvoiceDateFilter <> ? and 
   vtToInvoiceDateFilter   <> ? and 
   vtFromInvoiceDateFilter  = vtToInvoiceDateFilter
then assign vtInvoiceDateFilter = vtToInvoiceDateFilter.

if vcFromInvoiceJournalFilter <> ? and
   vcToInvoiceJournalFilter   <> ? and
   vcFromInvoiceJournalFilter  = vcToInvoiceJournalFilter
then do:
    <Q-4 run JournalPrim (all) (Read) (NoCache)
       (input viAPCurrentCompany_ID, (CompanyId)
        input vcFromInvoiceJournalFilter, (JournalCode)
        input ?, (JournalID)
        output dataset tqJournalPrim) in BJournal>
    find tqJournalPrim where
         tqJournalPrim.tcJournalCode = vcFromInvoiceJournalFilter
         no-lock no-error. /* do not use a 'first' option as there may be multiple ones with the same code in case viCompanyIDFilter is empty */
    if available tqJournalPrim
    then assign viJournalIDFilter = tqJournalPrim.tiJournal_ID.
end.
/* Get Info about CrossCompany (number of entries) */
<M-3 run CrossCompanyEntries  (output oiReturnStatus (oiReturnStatus)) in BAPMatchingReport>