<?php

// Perform Login
$SHORTCODE_STATUS = PHPCUS_SHORTCODE::CUS_QUICK_LOGIN();

// Check Array Input
PHPCUS_PARAM::CUS_DOES_NOT_SUPPORT_ARRAY();

// Check already authenticated
PHPCUS_PARAM::CUS_REQUIRES_AUTHENTICATION();
// Check access rights
PHPCUS_PARAM::CUS_HAS_PERMISSION(PHPCUS_SYSTEM::AUTHORITY_VIEW_ONLY, 'record_pos_sale_list');

if
(
    PHPRC_HTTP_PARAM::REF_ISSET_IN_ARRAY
    (
        [
            'PARAM_REC_POSSALE_LIST_ID',
            'PARAM_REC_POSSALE_LIST_REC_POSSALE_ID',
            'PARAM_REC_POSSALE_LIST_CAT_PRODUCT_ID',
            'PARAM_REC_POSSALE_LIST_CAT_UOM_ID',
            'PARAM_REC_POSSALE_LIST_AMOUNT_PRICE_FROM',
            'PARAM_REC_POSSALE_LIST_AMOUNT_PRICE_TO',
            'PARAM_REC_POSSALE_LIST_AMOUNT_COST_FROM',
            'PARAM_REC_POSSALE_LIST_AMOUNT_COST_TO',
            'PARAM_REC_POSSALE_LIST_AMOUNT_VAT_FROM',
            'PARAM_REC_POSSALE_LIST_AMOUNT_VAT_TO',
            'PARAM_REC_POSSALE_LIST_QUANTITY_FROM',
            'PARAM_REC_POSSALE_LIST_QUANTITY_TO',
            'PARAM_REC_POSSALE_LIST_QUANTITY_PCS_FROM',
            'PARAM_REC_POSSALE_LIST_QUANTITY_PCS_TO',
            'PARAM_REC_POSSALE_LIST_CAT_DISCOUNT_ID',
            'PARAM_REC_POSSALE_LIST_TOPAY_SUBTOTAL_FROM',
            'PARAM_REC_POSSALE_LIST_TOPAY_SUBTOTAL_TO',
            'PARAM_REC_POSSALE_LIST_TOPAY_DISCOUNT_FROM',
            'PARAM_REC_POSSALE_LIST_TOPAY_DISCOUNT_TO',
            'PARAM_REC_POSSALE_LIST_TOPAY_VATABLE_FROM',
            'PARAM_REC_POSSALE_LIST_TOPAY_VATABLE_TO',
            'PARAM_REC_POSSALE_LIST_TOPAY_VATEXEMPT_FROM',
            'PARAM_REC_POSSALE_LIST_TOPAY_VATEXEMPT_TO',
            'PARAM_REC_POSSALE_LIST_TOPAY_NONVAT_FROM',
            'PARAM_REC_POSSALE_LIST_TOPAY_NONVAT_TO',
            'PARAM_REC_POSSALE_LIST_TOPAY_ZERORATED_FROM',
            'PARAM_REC_POSSALE_LIST_TOPAY_ZERORATED_TO',
            'PARAM_REC_POSSALE_LIST_TOPAY_VATOTHER_FROM',
            'PARAM_REC_POSSALE_LIST_TOPAY_VATOTHER_TO',
            'PARAM_REC_POSSALE_LIST_TOPAY_VAT_FROM',
            'PARAM_REC_POSSALE_LIST_TOPAY_VAT_TO',
            'PARAM_REC_POSSALE_LIST_TOPAY_VAT_LESS_FROM',
            'PARAM_REC_POSSALE_LIST_TOPAY_VAT_LESS_TO',
            'PARAM_REC_POSSALE_LIST_POINTS_FROM',
            'PARAM_REC_POSSALE_LIST_POINTS_TO',
            'PARAM_REC_POSSALE_LIST_STATUS',
            
            'PARAM_REC_POSSALE_ID',
            'PARAM_REC_POSSALE_ACC_GROUP_ID',
            'PARAM_REC_POSSALE_REC_POSDEVICE_ID',
            'PARAM_REC_POSSALE_REC_CLIENT_ID',
            'PARAM_REC_POSSALE_REC_LOYALTY_ID',
            'PARAM_REC_POSSALE_CODE',
            'PARAM_REC_POSSALE_TOTAL_SUBTOTAL_FROM',
            'PARAM_REC_POSSALE_TOTAL_SUBTOTAL_TO',
            'PARAM_REC_POSSALE_TOTAL_DISCOUNT_FROM',
            'PARAM_REC_POSSALE_TOTAL_DISCOUNT_TO',
            'PARAM_REC_POSSALE_TOTAL_VATABLE_FROM',
            'PARAM_REC_POSSALE_TOTAL_VATABLE_TO',
            'PARAM_REC_POSSALE_TOTAL_VATEXEMPT_FROM',
            'PARAM_REC_POSSALE_TOTAL_VATEXEMPT_TO',
            'PARAM_REC_POSSALE_TOTAL_NONVAT_FROM',
            'PARAM_REC_POSSALE_TOTAL_NONVAT_TO',
            'PARAM_REC_POSSALE_TOTAL_ZERORATED_FROM',
            'PARAM_REC_POSSALE_TOTAL_ZERORATED_TO',
            'PARAM_REC_POSSALE_TOTAL_VATOTHER_FROM',
            'PARAM_REC_POSSALE_TOTAL_VATOTHER_TO',
            'PARAM_REC_POSSALE_TOTAL_VAT_FROM',
            'PARAM_REC_POSSALE_TOTAL_VAT_TO',
            'PARAM_REC_POSSALE_TOTAL_VAT_LESS_FROM',
            'PARAM_REC_POSSALE_TOTAL_VAT_LESS_TO',
            'PARAM_REC_POSSALE_TOTAL_POINT_FROM',
            'PARAM_REC_POSSALE_TOTAL_POINT_TO',
            'PARAM_REC_POSSALE_TOTAL_RTN_SUBTOTAL_FROM',
            'PARAM_REC_POSSALE_TOTAL_RTN_SUBTOTAL_TO',
            'PARAM_REC_POSSALE_TOTAL_PAID_FROM',
            'PARAM_REC_POSSALE_TOTAL_PAID_TO',
            'PARAM_REC_POSSALE_DATE_PAID_FROM',
            'PARAM_REC_POSSALE_DATE_PAID_TO',
            'PARAM_REC_POSSALE_DATE_DUE_FROM',
            'PARAM_REC_POSSALE_DATE_DUE_TO',
            'PARAM_REC_POSSALE_REMARKS',
            'PARAM_REC_POSSALE_ACC_ACCOUNT_ID',
            'PARAM_REC_POSSALE_DATE_TRANSACT_FROM',
            'PARAM_REC_POSSALE_DATE_TRANSACT_TO',
            'PARAM_REC_POSSALE_STATUS',
            'PARAM_CAT_PRODUCT_ID',
            'PARAM_CAT_PRODUCT_BARCODE',
            'PARAM_CAT_PRODUCT_ITEMCODE',
            'PARAM_CAT_PRODUCT_DESCRIPTION',
            'PARAM_CAT_PRODUCT_ALIAS_MAIN',
            'PARAM_CAT_PRODUCT_ALIAS_SUB',
            'PARAM_CAT_PRODUCT_CAT_PRODTYPE_ID_LV1',
            'PARAM_CAT_PRODUCT_CAT_PRODTYPE_ID_LV2',
            'PARAM_CAT_PRODUCT_CAT_PRODTYPE_ID_LV3',
            'PARAM_CAT_PRODUCT_CAT_BRAND_ID',
            'PARAM_CAT_PRODUCT_CAT_UOM_ID',
            'PARAM_CAT_PRODUCT_CAT_DISCOUNT_ID',
            'PARAM_CAT_PRODUCT_CAT_TAXMODEL_ID',
            'PARAM_CAT_PRODUCT_AMOUNT_COST_FROM',
            'PARAM_CAT_PRODUCT_AMOUNT_COST_TO',
            'PARAM_CAT_PRODUCT_AMOUNT_PRICE_FROM',
            'PARAM_CAT_PRODUCT_AMOUNT_PRICE_TO',
            'PARAM_CAT_PRODUCT_AMOUNT_VAT_FROM',
            'PARAM_CAT_PRODUCT_AMOUNT_VAT_TO',
            'PARAM_CAT_PRODUCT_AMOUNT_POINT_FROM',
            'PARAM_CAT_PRODUCT_AMOUNT_POINT_TO',
            'PARAM_CAT_PRODUCT_ALLOW_DISCOUNT',
            'PARAM_CAT_PRODUCT_ALLOW_SENIOR',
            'PARAM_CAT_PRODUCT_IS_BASICCOM',
            'PARAM_CAT_PRODUCT_IS_SERVICE',
            'PARAM_CAT_PRODUCT_REORDER_POINT_FROM',
            'PARAM_CAT_PRODUCT_REORDER_POINT_TO',
            'PARAM_CAT_PRODUCT_REORDER_QUANTITY_FROM',
            'PARAM_CAT_PRODUCT_REORDER_QUANTITY_TO',
            'PARAM_CAT_PRODUCT_CAT_PRODUCT_ID',
            'PARAM_CAT_PRODUCT_PER_PIECE_QTY_FROM',
            'PARAM_CAT_PRODUCT_PER_PIECE_QTY_TO',
            'PARAM_CAT_PRODUCT_CAT_SUPPLIER_ID',
            'PARAM_CAT_PRODUCT_IS_INVENTORY_ONLY',
            'PARAM_CAT_PRODUCT_IS_SERIALIZED',
            'PARAM_CAT_PRODUCT_STATUS',
            'PARAM_CAT_PRODUCT_SYSTEM_GENERATED',
            'PARAM_CAT_UOM_ID',
            'PARAM_CAT_UOM_CODE',
            'PARAM_CAT_UOM_DESCRIPTION',
            'PARAM_CAT_UOM_STATUS',
            'PARAM_CAT_UOM_SYSTEM_GENERATED',
            'PARAM_CAT_DISCOUNT_ID',
            'PARAM_CAT_DISCOUNT_DESCRIPTION',
            'PARAM_CAT_DISCOUNT_PERCENTAGE_FROM',
            'PARAM_CAT_DISCOUNT_PERCENTAGE_TO',
            'PARAM_CAT_DISCOUNT_AMOUNT_FROM',
            'PARAM_CAT_DISCOUNT_AMOUNT_TO',
            'PARAM_CAT_DISCOUNT_VAT_FROM',
            'PARAM_CAT_DISCOUNT_VAT_TO',
            'PARAM_CAT_DISCOUNT_HAS_POINT',
            'PARAM_CAT_DISCOUNT_CHANGE_TAX_TYPE',
            'PARAM_CAT_DISCOUNT_CAT_TAXMODEL_ID',
            'PARAM_CAT_DISCOUNT_REMARKS',
            'PARAM_CAT_DISCOUNT_IS_MONITORED_FROM',
            'PARAM_CAT_DISCOUNT_IS_MONITORED_TO',
            'PARAM_CAT_DISCOUNT_STATUS',
            'PARAM_CAT_DISCOUNT_SYSTEM_GENERATED',
            
            'PARAM_ORDER_FIELD',
            'PARAM_ORDER_TYPE',
            'PARAM_SKIP',
            'PARAM_LIMIT'
        ], True
        )
    )
{
    Try
    {
        // Read params
        // ------------------------------------------------------------------
        $PARAM_REC_POSSALE_LIST_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_REC_POSSALE_LIST_ID');
        $PARAM_REC_POSSALE_LIST_REC_POSSALE_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_REC_POSSALE_LIST_REC_POSSALE_ID');
        $PARAM_REC_POSSALE_LIST_CAT_PRODUCT_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_REC_POSSALE_LIST_CAT_PRODUCT_ID');
        $PARAM_REC_POSSALE_LIST_CAT_UOM_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_REC_POSSALE_LIST_CAT_UOM_ID');
        $PARAM_REC_POSSALE_LIST_AMOUNT_PRICE_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_AMOUNT_PRICE_FROM');
        $PARAM_REC_POSSALE_LIST_AMOUNT_PRICE_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_AMOUNT_PRICE_TO');
        $PARAM_REC_POSSALE_LIST_AMOUNT_COST_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_AMOUNT_COST_FROM');
        $PARAM_REC_POSSALE_LIST_AMOUNT_COST_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_AMOUNT_COST_TO');
        $PARAM_REC_POSSALE_LIST_AMOUNT_VAT_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_AMOUNT_VAT_FROM');
        $PARAM_REC_POSSALE_LIST_AMOUNT_VAT_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_AMOUNT_VAT_TO');
        $PARAM_REC_POSSALE_LIST_QUANTITY_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_QUANTITY_FROM');
        $PARAM_REC_POSSALE_LIST_QUANTITY_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_QUANTITY_TO');
        $PARAM_REC_POSSALE_LIST_QUANTITY_PCS_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_QUANTITY_PCS_FROM');
        $PARAM_REC_POSSALE_LIST_QUANTITY_PCS_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_QUANTITY_PCS_TO');
        $PARAM_REC_POSSALE_LIST_CAT_DISCOUNT_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_REC_POSSALE_LIST_CAT_DISCOUNT_ID');
        $PARAM_REC_POSSALE_LIST_TOPAY_SUBTOTAL_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_TOPAY_SUBTOTAL_FROM');
        $PARAM_REC_POSSALE_LIST_TOPAY_SUBTOTAL_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_TOPAY_SUBTOTAL_TO');
        $PARAM_REC_POSSALE_LIST_TOPAY_DISCOUNT_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_TOPAY_DISCOUNT_FROM');
        $PARAM_REC_POSSALE_LIST_TOPAY_DISCOUNT_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_TOPAY_DISCOUNT_TO');
        $PARAM_REC_POSSALE_LIST_TOPAY_VATABLE_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_TOPAY_VATABLE_FROM');
        $PARAM_REC_POSSALE_LIST_TOPAY_VATABLE_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_TOPAY_VATABLE_TO');
        $PARAM_REC_POSSALE_LIST_TOPAY_VATEXEMPT_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_TOPAY_VATEXEMPT_FROM');
        $PARAM_REC_POSSALE_LIST_TOPAY_VATEXEMPT_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_TOPAY_VATEXEMPT_TO');
        $PARAM_REC_POSSALE_LIST_TOPAY_NONVAT_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_TOPAY_NONVAT_FROM');
        $PARAM_REC_POSSALE_LIST_TOPAY_NONVAT_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_TOPAY_NONVAT_TO');
        $PARAM_REC_POSSALE_LIST_TOPAY_ZERORATED_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_TOPAY_ZERORATED_FROM');
        $PARAM_REC_POSSALE_LIST_TOPAY_ZERORATED_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_TOPAY_ZERORATED_TO');
        $PARAM_REC_POSSALE_LIST_TOPAY_VATOTHER_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_TOPAY_VATOTHER_FROM');
        $PARAM_REC_POSSALE_LIST_TOPAY_VATOTHER_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_TOPAY_VATOTHER_TO');
        $PARAM_REC_POSSALE_LIST_TOPAY_VAT_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_TOPAY_VAT_FROM');
        $PARAM_REC_POSSALE_LIST_TOPAY_VAT_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_TOPAY_VAT_TO');
        $PARAM_REC_POSSALE_LIST_TOPAY_VAT_LESS_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_TOPAY_VAT_LESS_FROM');
        $PARAM_REC_POSSALE_LIST_TOPAY_VAT_LESS_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_TOPAY_VAT_LESS_TO');
        $PARAM_REC_POSSALE_LIST_POINTS_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_POINTS_FROM');
        $PARAM_REC_POSSALE_LIST_POINTS_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_LIST_POINTS_TO');
        $PARAM_REC_POSSALE_LIST_STATUS = PHPCUS_PARAM::CUS_READ_INT('PARAM_REC_POSSALE_LIST_STATUS');
        
        $PARAM_REC_POSSALE_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_REC_POSSALE_ID');
        $PARAM_REC_POSSALE_ACC_GROUP_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_REC_POSSALE_ACC_GROUP_ID');
        $PARAM_REC_POSSALE_REC_POSDEVICE_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_REC_POSSALE_REC_POSDEVICE_ID');
        $PARAM_REC_POSSALE_REC_CLIENT_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_REC_POSSALE_REC_CLIENT_ID');
        $PARAM_REC_POSSALE_REC_LOYALTY_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_REC_POSSALE_REC_LOYALTY_ID');
        $PARAM_REC_POSSALE_CODE = PHPCUS_PARAM::CUS_READ_NVARCHAR('PARAM_REC_POSSALE_CODE');
        $PARAM_REC_POSSALE_TOTAL_SUBTOTAL_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_TOTAL_SUBTOTAL_FROM');
        $PARAM_REC_POSSALE_TOTAL_SUBTOTAL_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_TOTAL_SUBTOTAL_TO');
        $PARAM_REC_POSSALE_TOTAL_DISCOUNT_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_TOTAL_DISCOUNT_FROM');
        $PARAM_REC_POSSALE_TOTAL_DISCOUNT_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_TOTAL_DISCOUNT_TO');
        $PARAM_REC_POSSALE_TOTAL_VATABLE_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_TOTAL_VATABLE_FROM');
        $PARAM_REC_POSSALE_TOTAL_VATABLE_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_TOTAL_VATABLE_TO');
        $PARAM_REC_POSSALE_TOTAL_VATEXEMPT_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_TOTAL_VATEXEMPT_FROM');
        $PARAM_REC_POSSALE_TOTAL_VATEXEMPT_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_TOTAL_VATEXEMPT_TO');
        $PARAM_REC_POSSALE_TOTAL_NONVAT_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_TOTAL_NONVAT_FROM');
        $PARAM_REC_POSSALE_TOTAL_NONVAT_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_TOTAL_NONVAT_TO');
        $PARAM_REC_POSSALE_TOTAL_ZERORATED_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_TOTAL_ZERORATED_FROM');
        $PARAM_REC_POSSALE_TOTAL_ZERORATED_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_TOTAL_ZERORATED_TO');
        $PARAM_REC_POSSALE_TOTAL_VATOTHER_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_TOTAL_VATOTHER_FROM');
        $PARAM_REC_POSSALE_TOTAL_VATOTHER_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_TOTAL_VATOTHER_TO');
        $PARAM_REC_POSSALE_TOTAL_VAT_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_TOTAL_VAT_FROM');
        $PARAM_REC_POSSALE_TOTAL_VAT_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_TOTAL_VAT_TO');
        $PARAM_REC_POSSALE_TOTAL_VAT_LESS_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_TOTAL_VAT_LESS_FROM');
        $PARAM_REC_POSSALE_TOTAL_VAT_LESS_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_TOTAL_VAT_LESS_TO');
        $PARAM_REC_POSSALE_TOTAL_POINT_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_TOTAL_POINT_FROM');
        $PARAM_REC_POSSALE_TOTAL_POINT_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_TOTAL_POINT_TO');
        $PARAM_REC_POSSALE_TOTAL_RTN_SUBTOTAL_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_TOTAL_RTN_SUBTOTAL_FROM');
        $PARAM_REC_POSSALE_TOTAL_RTN_SUBTOTAL_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_TOTAL_RTN_SUBTOTAL_TO');
        $PARAM_REC_POSSALE_TOTAL_PAID_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_TOTAL_PAID_FROM');
        $PARAM_REC_POSSALE_TOTAL_PAID_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_POSSALE_TOTAL_PAID_TO');
        $PARAM_REC_POSSALE_DATE_PAID_FROM = PHPCUS_PARAM::CUS_READ_DATETIME('PARAM_REC_POSSALE_DATE_PAID_FROM');
        $PARAM_REC_POSSALE_DATE_PAID_TO = PHPCUS_PARAM::CUS_READ_DATETIME('PARAM_REC_POSSALE_DATE_PAID_TO');
        $PARAM_REC_POSSALE_DATE_DUE_FROM = PHPCUS_PARAM::CUS_READ_DATETIME('PARAM_REC_POSSALE_DATE_DUE_FROM');
        $PARAM_REC_POSSALE_DATE_DUE_TO = PHPCUS_PARAM::CUS_READ_DATETIME('PARAM_REC_POSSALE_DATE_DUE_TO');
        $PARAM_REC_POSSALE_REMARKS = PHPCUS_PARAM::CUS_READ_NVARCHAR('PARAM_REC_POSSALE_REMARKS');
        $PARAM_REC_POSSALE_ACC_ACCOUNT_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_REC_POSSALE_ACC_ACCOUNT_ID');
        $PARAM_REC_POSSALE_DATE_TRANSACT_FROM = PHPCUS_PARAM::CUS_READ_DATETIME('PARAM_REC_POSSALE_DATE_TRANSACT_FROM');
        $PARAM_REC_POSSALE_DATE_TRANSACT_TO = PHPCUS_PARAM::CUS_READ_DATETIME('PARAM_REC_POSSALE_DATE_TRANSACT_TO');
        $PARAM_REC_POSSALE_STATUS = PHPCUS_PARAM::CUS_READ_INT('PARAM_REC_POSSALE_STATUS');
        $PARAM_CAT_PRODUCT_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_CAT_PRODUCT_ID');
        $PARAM_CAT_PRODUCT_BARCODE = PHPCUS_PARAM::CUS_READ_NVARCHAR('PARAM_CAT_PRODUCT_BARCODE');
        $PARAM_CAT_PRODUCT_ITEMCODE = PHPCUS_PARAM::CUS_READ_NVARCHAR('PARAM_CAT_PRODUCT_ITEMCODE');
        $PARAM_CAT_PRODUCT_DESCRIPTION = PHPCUS_PARAM::CUS_READ_NVARCHAR('PARAM_CAT_PRODUCT_DESCRIPTION');
        $PARAM_CAT_PRODUCT_ALIAS_MAIN = PHPCUS_PARAM::CUS_READ_NVARCHAR('PARAM_CAT_PRODUCT_ALIAS_MAIN');
        $PARAM_CAT_PRODUCT_ALIAS_SUB = PHPCUS_PARAM::CUS_READ_NVARCHAR('PARAM_CAT_PRODUCT_ALIAS_SUB');
        $PARAM_CAT_PRODUCT_CAT_PRODTYPE_ID_LV1 = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_CAT_PRODUCT_CAT_PRODTYPE_ID_LV1');
        $PARAM_CAT_PRODUCT_CAT_PRODTYPE_ID_LV2 = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_CAT_PRODUCT_CAT_PRODTYPE_ID_LV2');
        $PARAM_CAT_PRODUCT_CAT_PRODTYPE_ID_LV3 = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_CAT_PRODUCT_CAT_PRODTYPE_ID_LV3');
        $PARAM_CAT_PRODUCT_CAT_BRAND_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_CAT_PRODUCT_CAT_BRAND_ID');
        $PARAM_CAT_PRODUCT_CAT_UOM_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_CAT_PRODUCT_CAT_UOM_ID');
        $PARAM_CAT_PRODUCT_CAT_DISCOUNT_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_CAT_PRODUCT_CAT_DISCOUNT_ID');
        $PARAM_CAT_PRODUCT_CAT_TAXMODEL_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_CAT_PRODUCT_CAT_TAXMODEL_ID');
        $PARAM_CAT_PRODUCT_AMOUNT_COST_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_CAT_PRODUCT_AMOUNT_COST_FROM');
        $PARAM_CAT_PRODUCT_AMOUNT_COST_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_CAT_PRODUCT_AMOUNT_COST_TO');
        $PARAM_CAT_PRODUCT_AMOUNT_PRICE_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_CAT_PRODUCT_AMOUNT_PRICE_FROM');
        $PARAM_CAT_PRODUCT_AMOUNT_PRICE_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_CAT_PRODUCT_AMOUNT_PRICE_TO');
        $PARAM_CAT_PRODUCT_AMOUNT_VAT_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_CAT_PRODUCT_AMOUNT_VAT_FROM');
        $PARAM_CAT_PRODUCT_AMOUNT_VAT_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_CAT_PRODUCT_AMOUNT_VAT_TO');
        $PARAM_CAT_PRODUCT_AMOUNT_POINT_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_CAT_PRODUCT_AMOUNT_POINT_FROM');
        $PARAM_CAT_PRODUCT_AMOUNT_POINT_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_CAT_PRODUCT_AMOUNT_POINT_TO');
        $PARAM_CAT_PRODUCT_ALLOW_DISCOUNT = PHPCUS_PARAM::CUS_READ_INT('PARAM_CAT_PRODUCT_ALLOW_DISCOUNT');
        $PARAM_CAT_PRODUCT_ALLOW_SENIOR = PHPCUS_PARAM::CUS_READ_INT('PARAM_CAT_PRODUCT_ALLOW_SENIOR');
        $PARAM_CAT_PRODUCT_IS_BASICCOM = PHPCUS_PARAM::CUS_READ_INT('PARAM_CAT_PRODUCT_IS_BASICCOM');
        $PARAM_CAT_PRODUCT_IS_SERVICE = PHPCUS_PARAM::CUS_READ_INT('PARAM_CAT_PRODUCT_IS_SERVICE');
        $PARAM_CAT_PRODUCT_REORDER_POINT_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_CAT_PRODUCT_REORDER_POINT_FROM');
        $PARAM_CAT_PRODUCT_REORDER_POINT_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_CAT_PRODUCT_REORDER_POINT_TO');
        $PARAM_CAT_PRODUCT_REORDER_QUANTITY_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_CAT_PRODUCT_REORDER_QUANTITY_FROM');
        $PARAM_CAT_PRODUCT_REORDER_QUANTITY_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_CAT_PRODUCT_REORDER_QUANTITY_TO');
        $PARAM_CAT_PRODUCT_CAT_PRODUCT_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_CAT_PRODUCT_CAT_PRODUCT_ID');
        $PARAM_CAT_PRODUCT_PER_PIECE_QTY_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_CAT_PRODUCT_PER_PIECE_QTY_FROM');
        $PARAM_CAT_PRODUCT_PER_PIECE_QTY_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_CAT_PRODUCT_PER_PIECE_QTY_TO');
        $PARAM_CAT_PRODUCT_CAT_SUPPLIER_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_CAT_PRODUCT_CAT_SUPPLIER_ID');
        $PARAM_CAT_PRODUCT_IS_INVENTORY_ONLY = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_CAT_PRODUCT_IS_INVENTORY_ONLY');
        $PARAM_CAT_PRODUCT_IS_SERIALIZED = PHPCUS_PARAM::CUS_READ_INT('PARAM_CAT_PRODUCT_IS_SERIALIZED');
        $PARAM_CAT_PRODUCT_STATUS = PHPCUS_PARAM::CUS_READ_INT('PARAM_CAT_PRODUCT_STATUS');
        $PARAM_CAT_PRODUCT_SYSTEM_GENERATED = PHPCUS_PARAM::CUS_READ_INT('PARAM_CAT_PRODUCT_SYSTEM_GENERATED');
        $PARAM_CAT_UOM_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_CAT_UOM_ID');
        $PARAM_CAT_UOM_CODE = PHPCUS_PARAM::CUS_READ_NVARCHAR('PARAM_CAT_UOM_CODE');
        $PARAM_CAT_UOM_DESCRIPTION = PHPCUS_PARAM::CUS_READ_NVARCHAR('PARAM_CAT_UOM_DESCRIPTION');
        $PARAM_CAT_UOM_STATUS = PHPCUS_PARAM::CUS_READ_INT('PARAM_CAT_UOM_STATUS');
        $PARAM_CAT_UOM_SYSTEM_GENERATED = PHPCUS_PARAM::CUS_READ_INT('PARAM_CAT_UOM_SYSTEM_GENERATED');
        $PARAM_CAT_DISCOUNT_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_CAT_DISCOUNT_ID');
        $PARAM_CAT_DISCOUNT_DESCRIPTION = PHPCUS_PARAM::CUS_READ_NVARCHAR('PARAM_CAT_DISCOUNT_DESCRIPTION');
        $PARAM_CAT_DISCOUNT_PERCENTAGE_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_CAT_DISCOUNT_PERCENTAGE_FROM');
        $PARAM_CAT_DISCOUNT_PERCENTAGE_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_CAT_DISCOUNT_PERCENTAGE_TO');
        $PARAM_CAT_DISCOUNT_AMOUNT_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_CAT_DISCOUNT_AMOUNT_FROM');
        $PARAM_CAT_DISCOUNT_AMOUNT_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_CAT_DISCOUNT_AMOUNT_TO');
        $PARAM_CAT_DISCOUNT_VAT_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_CAT_DISCOUNT_VAT_FROM');
        $PARAM_CAT_DISCOUNT_VAT_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_CAT_DISCOUNT_VAT_TO');
        $PARAM_CAT_DISCOUNT_HAS_POINT = PHPCUS_PARAM::CUS_READ_INT('PARAM_CAT_DISCOUNT_HAS_POINT');
        $PARAM_CAT_DISCOUNT_CHANGE_TAX_TYPE = PHPCUS_PARAM::CUS_READ_INT('PARAM_CAT_DISCOUNT_CHANGE_TAX_TYPE');
        $PARAM_CAT_DISCOUNT_CAT_TAXMODEL_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_CAT_DISCOUNT_CAT_TAXMODEL_ID');
        $PARAM_CAT_DISCOUNT_REMARKS = PHPCUS_PARAM::CUS_READ_NVARCHAR('PARAM_CAT_DISCOUNT_REMARKS');
        $PARAM_CAT_DISCOUNT_IS_MONITORED_FROM = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_CAT_DISCOUNT_IS_MONITORED_FROM');
        $PARAM_CAT_DISCOUNT_IS_MONITORED_TO = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_CAT_DISCOUNT_IS_MONITORED_TO');
        $PARAM_CAT_DISCOUNT_STATUS = PHPCUS_PARAM::CUS_READ_INT('PARAM_CAT_DISCOUNT_STATUS');
        $PARAM_CAT_DISCOUNT_SYSTEM_GENERATED = PHPCUS_PARAM::CUS_READ_INT('PARAM_CAT_DISCOUNT_SYSTEM_GENERATED');
        
        $PARAM_ORDER_FIELD = PHPCUS_PARAM::CUS_READ_SORT_FIELD
        (
            'PARAM_ORDER_FIELD',
            [
                'REC_POSSALE_LIST_ID',
                'REC_POSSALE_LIST_REC_POSSALE_ID',
                'REC_POSSALE_LIST_CAT_PRODUCT_ID',
                'REC_POSSALE_LIST_CAT_UOM_ID',
                'REC_POSSALE_LIST_AMOUNT_PRICE',
                'REC_POSSALE_LIST_AMOUNT_COST',
                'REC_POSSALE_LIST_AMOUNT_VAT',
                'REC_POSSALE_LIST_QUANTITY',
                'REC_POSSALE_LIST_QUANTITY_PCS',
                'REC_POSSALE_LIST_CAT_DISCOUNT_ID',
                'REC_POSSALE_LIST_TOPAY_SUBTOTAL',
                'REC_POSSALE_LIST_TOPAY_DISCOUNT',
                'REC_POSSALE_LIST_TOPAY_VATABLE',
                'REC_POSSALE_LIST_TOPAY_VATEXEMPT',
                'REC_POSSALE_LIST_TOPAY_NONVAT',
                'REC_POSSALE_LIST_TOPAY_ZERORATED',
                'REC_POSSALE_LIST_TOPAY_VATOTHER',
                'REC_POSSALE_LIST_TOPAY_VAT',
                'REC_POSSALE_LIST_TOPAY_VAT_LESS',
                'REC_POSSALE_LIST_POINTS',
                'REC_POSSALE_LIST_STATUS'
                ,
                'REC_POSSALE_ID',
                'REC_POSSALE_ACC_GROUP_ID',
                'REC_POSSALE_REC_POSDEVICE_ID',
                'REC_POSSALE_REC_CLIENT_ID',
                'REC_POSSALE_REC_LOYALTY_ID',
                'REC_POSSALE_CODE',
                'REC_POSSALE_TOTAL_SUBTOTAL',
                'REC_POSSALE_TOTAL_DISCOUNT',
                'REC_POSSALE_TOTAL_VATABLE',
                'REC_POSSALE_TOTAL_VATEXEMPT',
                'REC_POSSALE_TOTAL_NONVAT',
                'REC_POSSALE_TOTAL_ZERORATED',
                'REC_POSSALE_TOTAL_VATOTHER',
                'REC_POSSALE_TOTAL_VAT',
                'REC_POSSALE_TOTAL_VAT_LESS',
                'REC_POSSALE_TOTAL_POINT',
                'REC_POSSALE_TOTAL_RTN_SUBTOTAL',
                'REC_POSSALE_TOTAL_PAID',
                'REC_POSSALE_DATE_PAID',
                'REC_POSSALE_DATE_DUE',
                'REC_POSSALE_REMARKS',
                'REC_POSSALE_ACC_ACCOUNT_ID',
                'REC_POSSALE_DATE_TRANSACT',
                'REC_POSSALE_STATUS',
                'CAT_PRODUCT_ID',
                'CAT_PRODUCT_BARCODE',
                'CAT_PRODUCT_ITEMCODE',
                'CAT_PRODUCT_DESCRIPTION',
                'CAT_PRODUCT_ALIAS_MAIN',
                'CAT_PRODUCT_ALIAS_SUB',
                'CAT_PRODUCT_CAT_PRODTYPE_ID_LV1',
                'CAT_PRODUCT_CAT_PRODTYPE_ID_LV2',
                'CAT_PRODUCT_CAT_PRODTYPE_ID_LV3',
                'CAT_PRODUCT_CAT_BRAND_ID',
                'CAT_PRODUCT_CAT_UOM_ID',
                'CAT_PRODUCT_CAT_DISCOUNT_ID',
                'CAT_PRODUCT_CAT_TAXMODEL_ID',
                'CAT_PRODUCT_AMOUNT_COST',
                'CAT_PRODUCT_AMOUNT_PRICE',
                'CAT_PRODUCT_AMOUNT_VAT',
                'CAT_PRODUCT_AMOUNT_POINT',
                'CAT_PRODUCT_ALLOW_DISCOUNT',
                'CAT_PRODUCT_ALLOW_SENIOR',
                'CAT_PRODUCT_IS_BASICCOM',
                'CAT_PRODUCT_IS_SERVICE',
                'CAT_PRODUCT_REORDER_POINT',
                'CAT_PRODUCT_REORDER_QUANTITY',
                'CAT_PRODUCT_CAT_PRODUCT_ID',
                'CAT_PRODUCT_PER_PIECE_QTY',
                'CAT_PRODUCT_CAT_SUPPLIER_ID',
                'CAT_PRODUCT_IS_INVENTORY_ONLY',
                'CAT_PRODUCT_IS_SERIALIZED',
                'CAT_PRODUCT_STATUS',
                'CAT_PRODUCT_SYSTEM_GENERATED',
                'CAT_UOM_ID',
                'CAT_UOM_CODE',
                'CAT_UOM_DESCRIPTION',
                'CAT_UOM_STATUS',
                'CAT_UOM_SYSTEM_GENERATED',
                'CAT_DISCOUNT_ID',
                'CAT_DISCOUNT_DESCRIPTION',
                'CAT_DISCOUNT_PERCENTAGE',
                'CAT_DISCOUNT_AMOUNT',
                'CAT_DISCOUNT_VAT',
                'CAT_DISCOUNT_HAS_POINT',
                'CAT_DISCOUNT_CHANGE_TAX_TYPE',
                'CAT_DISCOUNT_CAT_TAXMODEL_ID',
                'CAT_DISCOUNT_REMARKS',
                'CAT_DISCOUNT_IS_MONITORED',
                'CAT_DISCOUNT_STATUS',
                'CAT_DISCOUNT_SYSTEM_GENERATED'
            ]
            );
        $PARAM_ORDER_TYPE = PHPCUS_PARAM::CUS_READ_SORT_TYPE('PARAM_ORDER_TYPE');
        $PARAM_SKIP	= PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_SKIP');
        $PARAM_LIMIT = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_LIMIT');
        
        // ------------------------------------------------------------------
        
        
        // Populate Map Array
        // ...........................................
        $GET_MAP_ARRAY = PHPCUS_RECORD_POS_SALE_LIST::CUS_PREPARE_MAPPED_ARRAY_FOR_GET();
        
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_ID'] = $PARAM_REC_POSSALE_LIST_ID;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_REC_POSSALE_ID'] = $PARAM_REC_POSSALE_LIST_REC_POSSALE_ID;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_CAT_PRODUCT_ID'] = $PARAM_REC_POSSALE_LIST_CAT_PRODUCT_ID;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_CAT_UOM_ID'] = $PARAM_REC_POSSALE_LIST_CAT_UOM_ID;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_AMOUNT_PRICE_FROM'] = $PARAM_REC_POSSALE_LIST_AMOUNT_PRICE_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_AMOUNT_PRICE_TO'] = $PARAM_REC_POSSALE_LIST_AMOUNT_PRICE_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_AMOUNT_COST_FROM'] = $PARAM_REC_POSSALE_LIST_AMOUNT_COST_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_AMOUNT_COST_TO'] = $PARAM_REC_POSSALE_LIST_AMOUNT_COST_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_AMOUNT_VAT_FROM'] = $PARAM_REC_POSSALE_LIST_AMOUNT_VAT_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_AMOUNT_VAT_TO'] = $PARAM_REC_POSSALE_LIST_AMOUNT_VAT_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_QUANTITY_FROM'] = $PARAM_REC_POSSALE_LIST_QUANTITY_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_QUANTITY_TO'] = $PARAM_REC_POSSALE_LIST_QUANTITY_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_QUANTITY_PCS_FROM'] = $PARAM_REC_POSSALE_LIST_QUANTITY_PCS_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_QUANTITY_PCS_TO'] = $PARAM_REC_POSSALE_LIST_QUANTITY_PCS_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_CAT_DISCOUNT_ID'] = $PARAM_REC_POSSALE_LIST_CAT_DISCOUNT_ID;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_TOPAY_SUBTOTAL_FROM'] = $PARAM_REC_POSSALE_LIST_TOPAY_SUBTOTAL_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_TOPAY_SUBTOTAL_TO'] = $PARAM_REC_POSSALE_LIST_TOPAY_SUBTOTAL_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_TOPAY_DISCOUNT_FROM'] = $PARAM_REC_POSSALE_LIST_TOPAY_DISCOUNT_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_TOPAY_DISCOUNT_TO'] = $PARAM_REC_POSSALE_LIST_TOPAY_DISCOUNT_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_TOPAY_VATABLE_FROM'] = $PARAM_REC_POSSALE_LIST_TOPAY_VATABLE_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_TOPAY_VATABLE_TO'] = $PARAM_REC_POSSALE_LIST_TOPAY_VATABLE_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_TOPAY_VATEXEMPT_FROM'] = $PARAM_REC_POSSALE_LIST_TOPAY_VATEXEMPT_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_TOPAY_VATEXEMPT_TO'] = $PARAM_REC_POSSALE_LIST_TOPAY_VATEXEMPT_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_TOPAY_NONVAT_FROM'] = $PARAM_REC_POSSALE_LIST_TOPAY_NONVAT_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_TOPAY_NONVAT_TO'] = $PARAM_REC_POSSALE_LIST_TOPAY_NONVAT_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_TOPAY_ZERORATED_FROM'] = $PARAM_REC_POSSALE_LIST_TOPAY_ZERORATED_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_TOPAY_ZERORATED_TO'] = $PARAM_REC_POSSALE_LIST_TOPAY_ZERORATED_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_TOPAY_VATOTHER_FROM'] = $PARAM_REC_POSSALE_LIST_TOPAY_VATOTHER_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_TOPAY_VATOTHER_TO'] = $PARAM_REC_POSSALE_LIST_TOPAY_VATOTHER_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_TOPAY_VAT_FROM'] = $PARAM_REC_POSSALE_LIST_TOPAY_VAT_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_TOPAY_VAT_TO'] = $PARAM_REC_POSSALE_LIST_TOPAY_VAT_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_TOPAY_VAT_LESS_FROM'] = $PARAM_REC_POSSALE_LIST_TOPAY_VAT_LESS_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_TOPAY_VAT_LESS_TO'] = $PARAM_REC_POSSALE_LIST_TOPAY_VAT_LESS_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_POINTS_FROM'] = $PARAM_REC_POSSALE_LIST_POINTS_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_POINTS_TO'] = $PARAM_REC_POSSALE_LIST_POINTS_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_LIST_STATUS'] = $PARAM_REC_POSSALE_LIST_STATUS;
        
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_ID'] = $PARAM_REC_POSSALE_ID;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_ACC_GROUP_ID'] = $PARAM_REC_POSSALE_ACC_GROUP_ID;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_REC_POSDEVICE_ID'] = $PARAM_REC_POSSALE_REC_POSDEVICE_ID;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_REC_CLIENT_ID'] = $PARAM_REC_POSSALE_REC_CLIENT_ID;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_REC_LOYALTY_ID'] = $PARAM_REC_POSSALE_REC_LOYALTY_ID;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_CODE'] = $PARAM_REC_POSSALE_CODE;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_TOTAL_SUBTOTAL_FROM'] = $PARAM_REC_POSSALE_TOTAL_SUBTOTAL_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_TOTAL_SUBTOTAL_TO'] = $PARAM_REC_POSSALE_TOTAL_SUBTOTAL_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_TOTAL_DISCOUNT_FROM'] = $PARAM_REC_POSSALE_TOTAL_DISCOUNT_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_TOTAL_DISCOUNT_TO'] = $PARAM_REC_POSSALE_TOTAL_DISCOUNT_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_TOTAL_VATABLE_FROM'] = $PARAM_REC_POSSALE_TOTAL_VATABLE_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_TOTAL_VATABLE_TO'] = $PARAM_REC_POSSALE_TOTAL_VATABLE_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_TOTAL_VATEXEMPT_FROM'] = $PARAM_REC_POSSALE_TOTAL_VATEXEMPT_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_TOTAL_VATEXEMPT_TO'] = $PARAM_REC_POSSALE_TOTAL_VATEXEMPT_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_TOTAL_NONVAT_FROM'] = $PARAM_REC_POSSALE_TOTAL_NONVAT_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_TOTAL_NONVAT_TO'] = $PARAM_REC_POSSALE_TOTAL_NONVAT_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_TOTAL_ZERORATED_FROM'] = $PARAM_REC_POSSALE_TOTAL_ZERORATED_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_TOTAL_ZERORATED_TO'] = $PARAM_REC_POSSALE_TOTAL_ZERORATED_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_TOTAL_VATOTHER_FROM'] = $PARAM_REC_POSSALE_TOTAL_VATOTHER_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_TOTAL_VATOTHER_TO'] = $PARAM_REC_POSSALE_TOTAL_VATOTHER_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_TOTAL_VAT_FROM'] = $PARAM_REC_POSSALE_TOTAL_VAT_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_TOTAL_VAT_TO'] = $PARAM_REC_POSSALE_TOTAL_VAT_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_TOTAL_VAT_LESS_FROM'] = $PARAM_REC_POSSALE_TOTAL_VAT_LESS_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_TOTAL_VAT_LESS_TO'] = $PARAM_REC_POSSALE_TOTAL_VAT_LESS_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_TOTAL_POINT_FROM'] = $PARAM_REC_POSSALE_TOTAL_POINT_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_TOTAL_POINT_TO'] = $PARAM_REC_POSSALE_TOTAL_POINT_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_TOTAL_RTN_SUBTOTAL_FROM'] = $PARAM_REC_POSSALE_TOTAL_RTN_SUBTOTAL_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_TOTAL_RTN_SUBTOTAL_TO'] = $PARAM_REC_POSSALE_TOTAL_RTN_SUBTOTAL_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_TOTAL_PAID_FROM'] = $PARAM_REC_POSSALE_TOTAL_PAID_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_TOTAL_PAID_TO'] = $PARAM_REC_POSSALE_TOTAL_PAID_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_DATE_PAID_FROM'] = $PARAM_REC_POSSALE_DATE_PAID_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_DATE_PAID_TO'] = $PARAM_REC_POSSALE_DATE_PAID_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_DATE_DUE_FROM'] = $PARAM_REC_POSSALE_DATE_DUE_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_DATE_DUE_TO'] = $PARAM_REC_POSSALE_DATE_DUE_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_REMARKS'] = $PARAM_REC_POSSALE_REMARKS;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_ACC_ACCOUNT_ID'] = $PARAM_REC_POSSALE_ACC_ACCOUNT_ID;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_DATE_TRANSACT_FROM'] = $PARAM_REC_POSSALE_DATE_TRANSACT_FROM;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_DATE_TRANSACT_TO'] = $PARAM_REC_POSSALE_DATE_TRANSACT_TO;
        $GET_MAP_ARRAY['PARAM_REC_POSSALE_STATUS'] = $PARAM_REC_POSSALE_STATUS;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_ID'] = $PARAM_CAT_PRODUCT_ID;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_BARCODE'] = $PARAM_CAT_PRODUCT_BARCODE;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_ITEMCODE'] = $PARAM_CAT_PRODUCT_ITEMCODE;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_DESCRIPTION'] = $PARAM_CAT_PRODUCT_DESCRIPTION;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_ALIAS_MAIN'] = $PARAM_CAT_PRODUCT_ALIAS_MAIN;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_ALIAS_SUB'] = $PARAM_CAT_PRODUCT_ALIAS_SUB;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_CAT_PRODTYPE_ID_LV1'] = $PARAM_CAT_PRODUCT_CAT_PRODTYPE_ID_LV1;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_CAT_PRODTYPE_ID_LV2'] = $PARAM_CAT_PRODUCT_CAT_PRODTYPE_ID_LV2;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_CAT_PRODTYPE_ID_LV3'] = $PARAM_CAT_PRODUCT_CAT_PRODTYPE_ID_LV3;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_CAT_BRAND_ID'] = $PARAM_CAT_PRODUCT_CAT_BRAND_ID;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_CAT_UOM_ID'] = $PARAM_CAT_PRODUCT_CAT_UOM_ID;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_CAT_DISCOUNT_ID'] = $PARAM_CAT_PRODUCT_CAT_DISCOUNT_ID;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_CAT_TAXMODEL_ID'] = $PARAM_CAT_PRODUCT_CAT_TAXMODEL_ID;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_AMOUNT_COST_FROM'] = $PARAM_CAT_PRODUCT_AMOUNT_COST_FROM;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_AMOUNT_COST_TO'] = $PARAM_CAT_PRODUCT_AMOUNT_COST_TO;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_AMOUNT_PRICE_FROM'] = $PARAM_CAT_PRODUCT_AMOUNT_PRICE_FROM;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_AMOUNT_PRICE_TO'] = $PARAM_CAT_PRODUCT_AMOUNT_PRICE_TO;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_AMOUNT_VAT_FROM'] = $PARAM_CAT_PRODUCT_AMOUNT_VAT_FROM;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_AMOUNT_VAT_TO'] = $PARAM_CAT_PRODUCT_AMOUNT_VAT_TO;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_AMOUNT_POINT_FROM'] = $PARAM_CAT_PRODUCT_AMOUNT_POINT_FROM;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_AMOUNT_POINT_TO'] = $PARAM_CAT_PRODUCT_AMOUNT_POINT_TO;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_ALLOW_DISCOUNT'] = $PARAM_CAT_PRODUCT_ALLOW_DISCOUNT;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_ALLOW_SENIOR'] = $PARAM_CAT_PRODUCT_ALLOW_SENIOR;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_IS_BASICCOM'] = $PARAM_CAT_PRODUCT_IS_BASICCOM;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_IS_SERVICE'] = $PARAM_CAT_PRODUCT_IS_SERVICE;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_REORDER_POINT_FROM'] = $PARAM_CAT_PRODUCT_REORDER_POINT_FROM;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_REORDER_POINT_TO'] = $PARAM_CAT_PRODUCT_REORDER_POINT_TO;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_REORDER_QUANTITY_FROM'] = $PARAM_CAT_PRODUCT_REORDER_QUANTITY_FROM;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_REORDER_QUANTITY_TO'] = $PARAM_CAT_PRODUCT_REORDER_QUANTITY_TO;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_CAT_PRODUCT_ID'] = $PARAM_CAT_PRODUCT_CAT_PRODUCT_ID;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_PER_PIECE_QTY_FROM'] = $PARAM_CAT_PRODUCT_PER_PIECE_QTY_FROM;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_PER_PIECE_QTY_TO'] = $PARAM_CAT_PRODUCT_PER_PIECE_QTY_TO;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_CAT_SUPPLIER_ID'] = $PARAM_CAT_PRODUCT_CAT_SUPPLIER_ID;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_IS_INVENTORY_ONLY'] = $PARAM_CAT_PRODUCT_IS_INVENTORY_ONLY;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_IS_SERIALIZED'] = $PARAM_CAT_PRODUCT_IS_SERIALIZED;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_STATUS'] = $PARAM_CAT_PRODUCT_STATUS;
        $GET_MAP_ARRAY['PARAM_CAT_PRODUCT_SYSTEM_GENERATED'] = $PARAM_CAT_PRODUCT_SYSTEM_GENERATED;
        $GET_MAP_ARRAY['PARAM_CAT_UOM_ID'] = $PARAM_CAT_UOM_ID;
        $GET_MAP_ARRAY['PARAM_CAT_UOM_CODE'] = $PARAM_CAT_UOM_CODE;
        $GET_MAP_ARRAY['PARAM_CAT_UOM_DESCRIPTION'] = $PARAM_CAT_UOM_DESCRIPTION;
        $GET_MAP_ARRAY['PARAM_CAT_UOM_STATUS'] = $PARAM_CAT_UOM_STATUS;
        $GET_MAP_ARRAY['PARAM_CAT_UOM_SYSTEM_GENERATED'] = $PARAM_CAT_UOM_SYSTEM_GENERATED;
        $GET_MAP_ARRAY['PARAM_CAT_DISCOUNT_ID'] = $PARAM_CAT_DISCOUNT_ID;
        $GET_MAP_ARRAY['PARAM_CAT_DISCOUNT_DESCRIPTION'] = $PARAM_CAT_DISCOUNT_DESCRIPTION;
        $GET_MAP_ARRAY['PARAM_CAT_DISCOUNT_PERCENTAGE_FROM'] = $PARAM_CAT_DISCOUNT_PERCENTAGE_FROM;
        $GET_MAP_ARRAY['PARAM_CAT_DISCOUNT_PERCENTAGE_TO'] = $PARAM_CAT_DISCOUNT_PERCENTAGE_TO;
        $GET_MAP_ARRAY['PARAM_CAT_DISCOUNT_AMOUNT_FROM'] = $PARAM_CAT_DISCOUNT_AMOUNT_FROM;
        $GET_MAP_ARRAY['PARAM_CAT_DISCOUNT_AMOUNT_TO'] = $PARAM_CAT_DISCOUNT_AMOUNT_TO;
        $GET_MAP_ARRAY['PARAM_CAT_DISCOUNT_VAT_FROM'] = $PARAM_CAT_DISCOUNT_VAT_FROM;
        $GET_MAP_ARRAY['PARAM_CAT_DISCOUNT_VAT_TO'] = $PARAM_CAT_DISCOUNT_VAT_TO;
        $GET_MAP_ARRAY['PARAM_CAT_DISCOUNT_HAS_POINT'] = $PARAM_CAT_DISCOUNT_HAS_POINT;
        $GET_MAP_ARRAY['PARAM_CAT_DISCOUNT_CHANGE_TAX_TYPE'] = $PARAM_CAT_DISCOUNT_CHANGE_TAX_TYPE;
        $GET_MAP_ARRAY['PARAM_CAT_DISCOUNT_CAT_TAXMODEL_ID'] = $PARAM_CAT_DISCOUNT_CAT_TAXMODEL_ID;
        $GET_MAP_ARRAY['PARAM_CAT_DISCOUNT_REMARKS'] = $PARAM_CAT_DISCOUNT_REMARKS;
        $GET_MAP_ARRAY['PARAM_CAT_DISCOUNT_IS_MONITORED_FROM'] = $PARAM_CAT_DISCOUNT_IS_MONITORED_FROM;
        $GET_MAP_ARRAY['PARAM_CAT_DISCOUNT_IS_MONITORED_TO'] = $PARAM_CAT_DISCOUNT_IS_MONITORED_TO;
        $GET_MAP_ARRAY['PARAM_CAT_DISCOUNT_STATUS'] = $PARAM_CAT_DISCOUNT_STATUS;
        $GET_MAP_ARRAY['PARAM_CAT_DISCOUNT_SYSTEM_GENERATED'] = $PARAM_CAT_DISCOUNT_SYSTEM_GENERATED;
        
        $GET_MAP_ARRAY["PARAM_ORDER_FIELD"] = $PARAM_ORDER_FIELD;
        $GET_MAP_ARRAY["PARAM_ORDER_TYPE"] = $PARAM_ORDER_TYPE;
        $GET_MAP_ARRAY["PARAM_SKIP"] = $PARAM_SKIP;
        $GET_MAP_ARRAY["PARAM_LIMIT"] = $PARAM_LIMIT;
        
        
        // Execute Stored Procedure
        // ...........................................
        $DATA_SET = PHPCUS_RECORD_POS_SALE_LIST::CUS_GET_ALL_MA($GET_MAP_ARRAY);
        
        
        // Return JSON response
        // ...........................................
        if(empty($DATA_SET) === False)
        {
            PHPCUS_PARAM::CUS_JSON_SUCCESS($DATA_SET);
        }
        else
        {
            PHPCUS_PARAM::CUS_JSON_SUCCESS('');
        }
        
    }
    Catch(Exception $ERR)
    {
        PHPVC_LOG::VAR_REPORT_ERROR($ERR, 0);
        if(isset($_SERVER['HTTP_ORIGIN']))
        {
            PHPVC_LOG::VAR_ERROR('HTTP_ORIGIN', $_SERVER['HTTP_ORIGIN']);
        }
        if(isset($_SERVER['HTTP_HOST']))
        {
            PHPVC_LOG::VAR_ERROR('HTTP_HOST', $_SERVER['HTTP_HOST']);
        }
        if(isset($_SERVER['HTTP_REFERER']))
        {
            PHPVC_LOG::VAR_ERROR('HTTP_REFERER', $_SERVER['HTTP_REFERER']);
        }
        if(isset($_SERVER['REMOTE_ADDR']))
        {
            PHPVC_LOG::VAR_ERROR('REMOTE_ADDR', $_SERVER['REMOTE_ADDR']);
        }
        
        PHPCUS_PARAM::CUS_JSON_ERROR($ERR->getMessage());
    }
}
else
{
    PHPCUS_PARAM::CUS_JSON_ERROR('Missing parameters');
}

?>