project QadFinancials > class BPaymentSelectionReport > 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 BPaymentSelectionReport.Paylist
method BPaymentSelectionReport.Remittance


program code (program1/bpaymentselectionreport.p)

/* Find all filter-parameters and assign them to the correct data-item */
/* Find all filter-parameters and assign them to the correct data-item */
assign viPaySelCodesFilter            = ?
       vcPSCreditorCodesFilter        = ?
       vcPSFromCreditorNameFilter     = ?
       vcPSToCreditorNameFilter       = ?
       vcPSCreditorNameFilter         = ?
       vcPSDebtorCodesFilter          = ?
       vcPSFromCollectionRefFilter    = ?
       vcPSFromCreditorCodeFilter     = ?
       vcPSFromDebtorCodeFilter       = ?
       vcPSMeansOfPaymentFilter       = ?
       vcPSFromPayselCodeFilter       = ?
       vcPSToPayselCodeFilter         = ?
       vcPSStatusFilter               = ?
       vcPSTillCollectionRefFilter    = ?
       vcPSTillCreditorCodeFilter     = ?
       vcPSTillDebtorCodeFilter       = ?
       viPSFromCollectionNumberFilter = ?
       viPSFromCollectionYearFilter   = ?
       viPSTillCollectionNumberFilter = ?
       viPSTillCollectionYearFilter   = ?
       vlPSRefInBankFilesFilter       = ?
       vtPSFromExecutionDateFilter    = ?
       vtPSTillExecutionDateFilter    = ?
       vlSendRemittanceFilter         = ?
       vcSortBySupBR                  = ?.

empty temp-table tPaySelCodesFilter.

/*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:
        /*PaySelPaySelCodes*/
        when "PaySelPaySelCodes":U
        then do viPaySelCodesFilter = 1 to num-entries(tFilter.tcParameterValue,chr(2)):
            create tPaySelCodesFilter.
            assign tPaySelCodesFilter.tcPaySelCode = entry(viPaySelCodesFilter, tFilter.tcParameterValue, chr(2)) no-error.
        end.    
        /*BankNumberBankNumber*/
        when "BankNumberBankNumber_ID":U
        then assign viBankGLCode_ID = integer(tFilter.tcParameterValue) no-error.
        /*IsPayList*/
        when "IsPaylist":U
        then assign vlIsPayList = trim(tFilter.tcParameterValue) = "yes":U or
                                  trim(tFilter.tcParameterValue) = "true":U.
        when "CollectionID":U
        then assign viCollection_ID = integer (tFilter.tcParameterValue) no-error.

        when "SortBy":U
        then assign vcSortBySupBR = trim(tFilter.tcParameterValue) no-error.

        /* New Payment Selections filter */
        when "PaySelCode_RANGE":U
        then if tFilter.tcOperator = ">=":U
             then assign vcPSFromPayselCodeFilter = tFilter.tcParameterValue no-error. 
             else if tFilter.tcOperator = "<=":U
                  then assign vcPSToPayselCodeFilter = tFilter.tcParameterValue NO-ERROR. 

        when "ExecutionDate_RANGE":U
        then if tFilter.tcOperator = ">=":U
             then assign vtPSFromExecutionDateFilter = 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 vtPSTillExecutionDateFilter = 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 "DebtorCode_RANGE":U
        then if tFilter.tcOperator = ">=":U
             then assign vcPSFromDebtorCodeFilter = tFilter.tcParameterValue no-error.
             else if tFilter.tcOperator = "<=":U
                  then assign vcPSTillDebtorCodeFilter = tFilter.tcParameterValue no-error.

        when "DebtorCode_CANDO":U
        then assign vcPSDebtorCodesFilter = tFilter.tcParameterValue no-error.


        when "CreditorCode_RANGE":U
        then if tFilter.tcOperator = ">=":U
             then assign vcPSFromCreditorCodeFilter = tFilter.tcParameterValue no-error.
             else if tFilter.tcOperator = "<=":U
                  then assign vcPSTillCreditorCodeFilter = tFilter.tcParameterValue no-error.

        when "CreditorBRName_RANGE":U
        then if tFilter.tcOperator = ">=":U
             then assign vcPSFromCreditorNameFilter = tFilter.tcParameterValue no-error.
             else if tFilter.tcOperator = "<=":U
                  then assign vcPSToCreditorNameFilter = tFilter.tcParameterValue no-error.

        when "CreditorCode_CANDO":U
        then assign vcPSCreditorCodesFilter = tFilter.tcParameterValue no-error.

        when "CreditorBRName_CANDO":U
        then assign vcPSCreditorNameFilter = tFilter.tcParameterValue no-error.

        when "Status":U
        then assign vcPSStatusFilter = tFilter.tcParameterValue no-error.
/*
        when "MeansOfPayment":U
        then assign vcPSMeansOfPaymentFilter = tFilter.tcParameterValue no-error. */
/*
        when "CollectionYear_RANGE":U
        then if tFilter.tcOperator = ">=":U
             then assign viPSFromCollectionYearFilter = int(tFilter.tcParameterValue) no-error.
             else if tFilter.tcOperator = "<=":U
                  then assign viPSTillCollectionYearFilter = int(tFilter.tcParameterValue) no-error.

        when "CollectionNumber_RANGE":U
        then if tFilter.tcOperator = ">=":U
             then assign viPSFromCollectionNumberFilter = int(tFilter.tcParameterValue) no-error.
             else if tFilter.tcOperator = "<=":U
                  then assign viPSTillCollectionNumberFilter = int(tFilter.tcParameterValue) no-error. */

/*        when "CollectionReference_RANGE":U
        then if tFilter.tcOperator = ">=":U
             then assign vcPSFromCollectionRefFilter = tFilter.tcParameterValue no-error.
             else if tFilter.tcOperator = "<=":U
                  then assign vcPSTillCollectionRefFilter = tFilter.tcParameterValue no-error. */

        when "ReferenceInBankFiles":U
        then assign vlPSRefInBankFilesFilter = if tFilter.tcParameterValue = "true":U 
                                      then true 
                                      else if tFilter.tcParameterValue = "false":U 
                                           then false 
                                           else vlPSRefInBankFilesFilter no-error.

        when "SendRemittance":U
        then assign vlSendRemittanceFilter = if tFilter.tcParameterValue = "true":U 
                                      then true 
                                      else if tFilter.tcParameterValue = "false":U 
                                           then false 
                                           else vlSendRemittanceFilter no-error.
    end case.
end.

/* ================ */
/* Equality matches */
/* ================ */
assign viEqualityCollectionYear        = ?
       viEqualityCollectionNumber      = ?
       vcEqualityCollectionReference   = ?
       vcEqualityPaySelCode            = ?
       vtEqualityExecutionDate         = ?.

if vcPSFromPayselCodeFilter <> ? and 
   vcPSFromPayselCodeFilter = vcPSToPayselCodeFilter 
then assign vcEqualityPaySelCode = vcPSFromPayselCodeFilter
            vcPSFromPayselCodeFilter = ?
            vcPSToPayselCodeFilter = ?.
/*
if vcPSFromCollectionRefFilter <> ? and 
   vcPSFromCollectionRefFilter = vcPSTillCollectionRefFilter
then assign vcEqualityCollectionReference = vcPSFromCollectionRefFilter
            vcPSFromCollectionRefFilter = ?
            vcPSTillCollectionRefFilter = ?. */
/*            
if viPSFromCollectionNumberFilter <> 0 and 
   viPSFromCollectionNumberFilter <> ? and 
   viPSFromCollectionNumberFilter = viPSTillCollectionNumberFilter
then assign viEqualityCollectionNumber = viPSFromCollectionNumberFilter
            viPSFromCollectionNumberFilter = ?
            viPSTillCollectionNumberFilter = ?. */
/*
if viPSFromCollectionYearFilter <> 0 and 
   viPSFromCollectionYearFilter <> ? and 
   viPSFromCollectionYearFilter = viPSTillCollectionYearFilter
then assign viEqualityCollectionYear = viPSFromCollectionYearFilter
            viPSFromCollectionYearFilter = ?
            viPSTillCollectionYearFilter = ?. */

if vtPSFromExecutionDateFilter <> ? and 
   vtPSFromExecutionDateFilter = vtPSTillExecutionDateFilter
then assign vtEqualityExecutionDate = vtPSFromExecutionDateFilter
            vtPSFromExecutionDateFilter = ?
            vtPSTillExecutionDateFilter = ?.

if vcSortBySupBR = ?
then assign vcSortBySupBR = "BUSINESSRELATIONNAME":U.