<?php

	// Dismiss Session
	PHPVC_SESSION::VAR_STOP();
	
	// 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 This may slow down server, uncomment this if you requires an extra security
	// PHPCUS_PARAM::CUS_HAS_PERMISSION(PHPCUS_SYSTEM::AUTHORITY_VIEW_ONLY, 'record_pschedule');

	if
	(
		PHPRC_HTTP_PARAM::REF_ISSET_IN_ARRAY
		(
			[
					'PARAM_REC_PSCHEDULE_ID',
					'PARAM_REC_PSCHEDULE_ACC_GROUP_ID',
					'PARAM_REC_PSCHEDULE_CAT_PRODUCT_ID',
					'PARAM_REC_PSCHEDULE_AMOUNT_PRICE_FROM',
					'PARAM_REC_PSCHEDULE_AMOUNT_PRICE_TO',
					'PARAM_REC_PSCHEDULE_AMOUNT_COST_FROM',
					'PARAM_REC_PSCHEDULE_AMOUNT_COST_TO',
					'PARAM_REC_PSCHEDULE_QTY_D01_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D01_TO',
					'PARAM_REC_PSCHEDULE_QTY_D02_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D02_TO',
					'PARAM_REC_PSCHEDULE_QTY_D03_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D03_TO',
					'PARAM_REC_PSCHEDULE_QTY_D04_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D04_TO',
					'PARAM_REC_PSCHEDULE_QTY_D05_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D05_TO',
					'PARAM_REC_PSCHEDULE_QTY_D06_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D06_TO',
					'PARAM_REC_PSCHEDULE_QTY_D07_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D07_TO',
					'PARAM_REC_PSCHEDULE_QTY_D08_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D08_TO',
					'PARAM_REC_PSCHEDULE_QTY_D09_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D09_TO',
					'PARAM_REC_PSCHEDULE_QTY_D10_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D10_TO',
					'PARAM_REC_PSCHEDULE_QTY_D11_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D11_TO',
					'PARAM_REC_PSCHEDULE_QTY_D12_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D12_TO',
					'PARAM_REC_PSCHEDULE_QTY_D13_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D13_TO',
					'PARAM_REC_PSCHEDULE_QTY_D14_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D14_TO',
					'PARAM_REC_PSCHEDULE_QTY_D15_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D15_TO',
					'PARAM_REC_PSCHEDULE_QTY_D16_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D16_TO',
					'PARAM_REC_PSCHEDULE_QTY_D17_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D17_TO',
					'PARAM_REC_PSCHEDULE_QTY_D18_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D18_TO',
					'PARAM_REC_PSCHEDULE_QTY_D19_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D19_TO',
					'PARAM_REC_PSCHEDULE_QTY_D20_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D20_TO',
					'PARAM_REC_PSCHEDULE_QTY_D21_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D21_TO',
					'PARAM_REC_PSCHEDULE_QTY_D22_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D22_TO',
					'PARAM_REC_PSCHEDULE_QTY_D23_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D23_TO',
					'PARAM_REC_PSCHEDULE_QTY_D24_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D24_TO',
					'PARAM_REC_PSCHEDULE_QTY_D25_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D25_TO',
					'PARAM_REC_PSCHEDULE_QTY_D26_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D26_TO',
					'PARAM_REC_PSCHEDULE_QTY_D27_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D27_TO',
					'PARAM_REC_PSCHEDULE_QTY_D28_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D28_TO',
					'PARAM_REC_PSCHEDULE_QTY_D29_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D29_TO',
					'PARAM_REC_PSCHEDULE_QTY_D30_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D30_TO',
					'PARAM_REC_PSCHEDULE_QTY_D31_FROM',
					'PARAM_REC_PSCHEDULE_QTY_D31_TO',
					'PARAM_REC_PSCHEDULE_QTY_TOTAL_FROM',
					'PARAM_REC_PSCHEDULE_QTY_TOTAL_TO',
					'PARAM_REC_PSCHEDULE_DATE_FROM',
					'PARAM_REC_PSCHEDULE_DATE_TO',
					'PARAM_REC_PSCHEDULE_REMARKS',
					'PARAM_REC_PSCHEDULE_STATUS',
					
					'PARAM_ORDER_FIELD',
					'PARAM_ORDER_TYPE',
					'PARAM_SKIP',
					'PARAM_LIMIT'
			], True
		)
	)
	{
		Try
		{
			// Read params
			// ------------------------------------------------------------------	
			$PARAM_REC_PSCHEDULE_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_REC_PSCHEDULE_ID');
			$PARAM_REC_PSCHEDULE_ACC_GROUP_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_REC_PSCHEDULE_ACC_GROUP_ID');
			$PARAM_REC_PSCHEDULE_CAT_PRODUCT_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_REC_PSCHEDULE_CAT_PRODUCT_ID');
			$PARAM_REC_PSCHEDULE_AMOUNT_PRICE_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_AMOUNT_PRICE_FROM');
			$PARAM_REC_PSCHEDULE_AMOUNT_PRICE_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_AMOUNT_PRICE_TO');
			$PARAM_REC_PSCHEDULE_AMOUNT_COST_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_AMOUNT_COST_FROM');
			$PARAM_REC_PSCHEDULE_AMOUNT_COST_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_AMOUNT_COST_TO');
			$PARAM_REC_PSCHEDULE_QTY_D01_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D01_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D01_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D01_TO');
			$PARAM_REC_PSCHEDULE_QTY_D02_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D02_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D02_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D02_TO');
			$PARAM_REC_PSCHEDULE_QTY_D03_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D03_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D03_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D03_TO');
			$PARAM_REC_PSCHEDULE_QTY_D04_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D04_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D04_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D04_TO');
			$PARAM_REC_PSCHEDULE_QTY_D05_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D05_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D05_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D05_TO');
			$PARAM_REC_PSCHEDULE_QTY_D06_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D06_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D06_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D06_TO');
			$PARAM_REC_PSCHEDULE_QTY_D07_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D07_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D07_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D07_TO');
			$PARAM_REC_PSCHEDULE_QTY_D08_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D08_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D08_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D08_TO');
			$PARAM_REC_PSCHEDULE_QTY_D09_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D09_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D09_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D09_TO');
			$PARAM_REC_PSCHEDULE_QTY_D10_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D10_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D10_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D10_TO');
			$PARAM_REC_PSCHEDULE_QTY_D11_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D11_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D11_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D11_TO');
			$PARAM_REC_PSCHEDULE_QTY_D12_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D12_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D12_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D12_TO');
			$PARAM_REC_PSCHEDULE_QTY_D13_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D13_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D13_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D13_TO');
			$PARAM_REC_PSCHEDULE_QTY_D14_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D14_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D14_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D14_TO');
			$PARAM_REC_PSCHEDULE_QTY_D15_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D15_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D15_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D15_TO');
			$PARAM_REC_PSCHEDULE_QTY_D16_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D16_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D16_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D16_TO');
			$PARAM_REC_PSCHEDULE_QTY_D17_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D17_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D17_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D17_TO');
			$PARAM_REC_PSCHEDULE_QTY_D18_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D18_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D18_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D18_TO');
			$PARAM_REC_PSCHEDULE_QTY_D19_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D19_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D19_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D19_TO');
			$PARAM_REC_PSCHEDULE_QTY_D20_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D20_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D20_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D20_TO');
			$PARAM_REC_PSCHEDULE_QTY_D21_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D21_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D21_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D21_TO');
			$PARAM_REC_PSCHEDULE_QTY_D22_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D22_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D22_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D22_TO');
			$PARAM_REC_PSCHEDULE_QTY_D23_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D23_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D23_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D23_TO');
			$PARAM_REC_PSCHEDULE_QTY_D24_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D24_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D24_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D24_TO');
			$PARAM_REC_PSCHEDULE_QTY_D25_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D25_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D25_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D25_TO');
			$PARAM_REC_PSCHEDULE_QTY_D26_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D26_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D26_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D26_TO');
			$PARAM_REC_PSCHEDULE_QTY_D27_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D27_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D27_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D27_TO');
			$PARAM_REC_PSCHEDULE_QTY_D28_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D28_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D28_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D28_TO');
			$PARAM_REC_PSCHEDULE_QTY_D29_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D29_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D29_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D29_TO');
			$PARAM_REC_PSCHEDULE_QTY_D30_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D30_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D30_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D30_TO');
			$PARAM_REC_PSCHEDULE_QTY_D31_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D31_FROM');
			$PARAM_REC_PSCHEDULE_QTY_D31_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_D31_TO');
			$PARAM_REC_PSCHEDULE_QTY_TOTAL_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_TOTAL_FROM');
			$PARAM_REC_PSCHEDULE_QTY_TOTAL_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSCHEDULE_QTY_TOTAL_TO');
			$PARAM_REC_PSCHEDULE_DATE_FROM = PHPCUS_PARAM::CUS_READ_DATETIME('PARAM_REC_PSCHEDULE_DATE_FROM');
			$PARAM_REC_PSCHEDULE_DATE_TO = PHPCUS_PARAM::CUS_READ_DATETIME('PARAM_REC_PSCHEDULE_DATE_TO');
			$PARAM_REC_PSCHEDULE_REMARKS = PHPCUS_PARAM::CUS_READ_NVARCHAR('PARAM_REC_PSCHEDULE_REMARKS');
			$PARAM_REC_PSCHEDULE_STATUS = PHPCUS_PARAM::CUS_READ_INT('PARAM_REC_PSCHEDULE_STATUS');
			
			$PARAM_ORDER_FIELD = PHPCUS_PARAM::CUS_READ_SORT_FIELD
			(
					'PARAM_ORDER_FIELD',
					[
						'REC_PSCHEDULE_ID', 
						'REC_PSCHEDULE_ACC_GROUP_ID', 
						'REC_PSCHEDULE_CAT_PRODUCT_ID', 
						'REC_PSCHEDULE_AMOUNT_PRICE', 
						'REC_PSCHEDULE_AMOUNT_COST', 
						'REC_PSCHEDULE_QTY_D01', 
						'REC_PSCHEDULE_QTY_D02', 
						'REC_PSCHEDULE_QTY_D03', 
						'REC_PSCHEDULE_QTY_D04', 
						'REC_PSCHEDULE_QTY_D05', 
						'REC_PSCHEDULE_QTY_D06', 
						'REC_PSCHEDULE_QTY_D07', 
						'REC_PSCHEDULE_QTY_D08', 
						'REC_PSCHEDULE_QTY_D09', 
						'REC_PSCHEDULE_QTY_D10', 
						'REC_PSCHEDULE_QTY_D11', 
						'REC_PSCHEDULE_QTY_D12', 
						'REC_PSCHEDULE_QTY_D13', 
						'REC_PSCHEDULE_QTY_D14', 
						'REC_PSCHEDULE_QTY_D15', 
						'REC_PSCHEDULE_QTY_D16', 
						'REC_PSCHEDULE_QTY_D17', 
						'REC_PSCHEDULE_QTY_D18', 
						'REC_PSCHEDULE_QTY_D19', 
						'REC_PSCHEDULE_QTY_D20', 
						'REC_PSCHEDULE_QTY_D21', 
						'REC_PSCHEDULE_QTY_D22', 
						'REC_PSCHEDULE_QTY_D23', 
						'REC_PSCHEDULE_QTY_D24', 
						'REC_PSCHEDULE_QTY_D25', 
						'REC_PSCHEDULE_QTY_D26', 
						'REC_PSCHEDULE_QTY_D27', 
						'REC_PSCHEDULE_QTY_D28', 
						'REC_PSCHEDULE_QTY_D29', 
						'REC_PSCHEDULE_QTY_D30', 
						'REC_PSCHEDULE_QTY_D31', 
						'REC_PSCHEDULE_QTY_TOTAL', 
						'REC_PSCHEDULE_DATE', 
						'REC_PSCHEDULE_REMARKS', 
						'REC_PSCHEDULE_STATUS'
						, 
						'ACC_GROUP_ID',		
						'ACC_GROUP_DESCRIPTION',		
						'ACC_GROUP_STATUS',		
						'ACC_GROUP_SYSTEM_GENERATED',		
						'CAT_PRODUCT_ID',		
						'CAT_PRODUCT_CAT_UOM_ID',		
						'CAT_PRODUCT_BARCODE',		
						'CAT_PRODUCT_ITEMCODE',		
						'CAT_PRODUCT_DESCRIPTION',		
						'CAT_PRODUCT_HAS_RECIPE',		
						'CAT_PRODUCT_ING_PRICE',		
						'CAT_PRODUCT_ING_NET_CONTENT',		
						'CAT_PRODUCT_MIXTURE_QTY',		
						'CAT_PRODUCT_STATUS',		
						'CAT_PRODUCT_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_PSCHEDULE::CUS_PREPARE_MAPPED_ARRAY_FOR_GET();
			
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_ID'] = $PARAM_REC_PSCHEDULE_ID;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_ACC_GROUP_ID'] = $PARAM_REC_PSCHEDULE_ACC_GROUP_ID;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_CAT_PRODUCT_ID'] = $PARAM_REC_PSCHEDULE_CAT_PRODUCT_ID;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_AMOUNT_PRICE_FROM'] = $PARAM_REC_PSCHEDULE_AMOUNT_PRICE_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_AMOUNT_PRICE_TO'] = $PARAM_REC_PSCHEDULE_AMOUNT_PRICE_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_AMOUNT_COST_FROM'] = $PARAM_REC_PSCHEDULE_AMOUNT_COST_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_AMOUNT_COST_TO'] = $PARAM_REC_PSCHEDULE_AMOUNT_COST_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D01_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D01_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D01_TO'] = $PARAM_REC_PSCHEDULE_QTY_D01_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D02_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D02_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D02_TO'] = $PARAM_REC_PSCHEDULE_QTY_D02_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D03_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D03_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D03_TO'] = $PARAM_REC_PSCHEDULE_QTY_D03_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D04_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D04_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D04_TO'] = $PARAM_REC_PSCHEDULE_QTY_D04_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D05_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D05_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D05_TO'] = $PARAM_REC_PSCHEDULE_QTY_D05_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D06_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D06_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D06_TO'] = $PARAM_REC_PSCHEDULE_QTY_D06_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D07_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D07_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D07_TO'] = $PARAM_REC_PSCHEDULE_QTY_D07_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D08_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D08_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D08_TO'] = $PARAM_REC_PSCHEDULE_QTY_D08_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D09_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D09_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D09_TO'] = $PARAM_REC_PSCHEDULE_QTY_D09_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D10_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D10_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D10_TO'] = $PARAM_REC_PSCHEDULE_QTY_D10_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D11_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D11_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D11_TO'] = $PARAM_REC_PSCHEDULE_QTY_D11_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D12_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D12_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D12_TO'] = $PARAM_REC_PSCHEDULE_QTY_D12_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D13_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D13_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D13_TO'] = $PARAM_REC_PSCHEDULE_QTY_D13_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D14_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D14_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D14_TO'] = $PARAM_REC_PSCHEDULE_QTY_D14_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D15_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D15_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D15_TO'] = $PARAM_REC_PSCHEDULE_QTY_D15_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D16_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D16_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D16_TO'] = $PARAM_REC_PSCHEDULE_QTY_D16_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D17_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D17_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D17_TO'] = $PARAM_REC_PSCHEDULE_QTY_D17_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D18_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D18_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D18_TO'] = $PARAM_REC_PSCHEDULE_QTY_D18_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D19_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D19_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D19_TO'] = $PARAM_REC_PSCHEDULE_QTY_D19_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D20_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D20_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D20_TO'] = $PARAM_REC_PSCHEDULE_QTY_D20_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D21_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D21_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D21_TO'] = $PARAM_REC_PSCHEDULE_QTY_D21_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D22_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D22_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D22_TO'] = $PARAM_REC_PSCHEDULE_QTY_D22_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D23_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D23_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D23_TO'] = $PARAM_REC_PSCHEDULE_QTY_D23_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D24_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D24_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D24_TO'] = $PARAM_REC_PSCHEDULE_QTY_D24_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D25_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D25_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D25_TO'] = $PARAM_REC_PSCHEDULE_QTY_D25_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D26_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D26_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D26_TO'] = $PARAM_REC_PSCHEDULE_QTY_D26_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D27_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D27_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D27_TO'] = $PARAM_REC_PSCHEDULE_QTY_D27_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D28_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D28_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D28_TO'] = $PARAM_REC_PSCHEDULE_QTY_D28_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D29_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D29_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D29_TO'] = $PARAM_REC_PSCHEDULE_QTY_D29_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D30_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D30_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D30_TO'] = $PARAM_REC_PSCHEDULE_QTY_D30_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D31_FROM'] = $PARAM_REC_PSCHEDULE_QTY_D31_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_D31_TO'] = $PARAM_REC_PSCHEDULE_QTY_D31_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_TOTAL_FROM'] = $PARAM_REC_PSCHEDULE_QTY_TOTAL_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_QTY_TOTAL_TO'] = $PARAM_REC_PSCHEDULE_QTY_TOTAL_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_DATE_FROM'] = $PARAM_REC_PSCHEDULE_DATE_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_DATE_TO'] = $PARAM_REC_PSCHEDULE_DATE_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_REMARKS'] = $PARAM_REC_PSCHEDULE_REMARKS;
			$GET_MAP_ARRAY['PARAM_REC_PSCHEDULE_STATUS'] = $PARAM_REC_PSCHEDULE_STATUS;
			
			$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_PSCHEDULE::CUS_GET_SUM_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');
	}

?>