<?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_psoverview');

	if
	(
		PHPRC_HTTP_PARAM::REF_ISSET_IN_ARRAY
		(
			[
					'PARAM_REC_PSOVERVIEW_ID',
					'PARAM_REC_PSOVERVIEW_CAT_PRODUCT_ID',
					'PARAM_REC_PSOVERVIEW_DESCRIPTION',
					'PARAM_REC_PSOVERVIEW_DATE_FROM',
					'PARAM_REC_PSOVERVIEW_DATE_TO',
					'PARAM_REC_PSOVERVIEW_CNT_PRODUCTION_FROM',
					'PARAM_REC_PSOVERVIEW_CNT_PRODUCTION_TO',
					'PARAM_REC_PSOVERVIEW_CNT_PRODUCTION_ON_FROM',
					'PARAM_REC_PSOVERVIEW_CNT_PRODUCTION_ON_TO',
					'PARAM_REC_PSOVERVIEW_QTY_REQUEST_FROM',
					'PARAM_REC_PSOVERVIEW_QTY_REQUEST_TO',
					'PARAM_REC_PSOVERVIEW_QTY_PRODUCE_FROM',
					'PARAM_REC_PSOVERVIEW_QTY_PRODUCE_TO',
					'PARAM_REC_PSOVERVIEW_QTY_PRODUCE_ON_FROM',
					'PARAM_REC_PSOVERVIEW_QTY_PRODUCE_ON_TO',
					'PARAM_REC_PSOVERVIEW_QTY_DELIVERY_FROM',
					'PARAM_REC_PSOVERVIEW_QTY_DELIVERY_TO',
					'PARAM_REC_PSOVERVIEW_QTY_DELIVERY_ON_FROM',
					'PARAM_REC_PSOVERVIEW_QTY_DELIVERY_ON_TO',
					'PARAM_REC_PSOVERVIEW_QTY_DAMAGE_FROM',
					'PARAM_REC_PSOVERVIEW_QTY_DAMAGE_TO',
					'PARAM_REC_PSOVERVIEW_QTY_SNACK_FROM',
					'PARAM_REC_PSOVERVIEW_QTY_SNACK_TO',
					'PARAM_REC_PSOVERVIEW_QTY_YEILD_FROM',
					'PARAM_REC_PSOVERVIEW_QTY_YEILD_TO',
					'PARAM_REC_PSOVERVIEW_PRICE_FROM',
					'PARAM_REC_PSOVERVIEW_PRICE_TO',
					'PARAM_REC_PSOVERVIEW_COST_FDATA_FROM',
					'PARAM_REC_PSOVERVIEW_COST_FDATA_TO',
					'PARAM_REC_PSOVERVIEW_COST_PDATA_FROM',
					'PARAM_REC_PSOVERVIEW_COST_PDATA_TO',
					'PARAM_REC_PSOVERVIEW_MIX_REQUEST_FROM',
					'PARAM_REC_PSOVERVIEW_MIX_REQUEST_TO',
					'PARAM_REC_PSOVERVIEW_MIX_PRODUCTION_FROM',
					'PARAM_REC_PSOVERVIEW_MIX_PRODUCTION_TO',
					'PARAM_REC_PSOVERVIEW_MIX_PRODUCTION_ON_FROM',
					'PARAM_REC_PSOVERVIEW_MIX_PRODUCTION_ON_TO',
					'PARAM_REC_PSOVERVIEW_COGS_PERC_FROM',
					'PARAM_REC_PSOVERVIEW_COGS_PERC_TO',
					'PARAM_REC_PSOVERVIEW_STATUS',
					
					'PARAM_CAT_PRODUCT_ID',	
					'PARAM_CAT_PRODUCT_CAT_UOM_ID',	
					'PARAM_CAT_PRODUCT_BARCODE',	
					'PARAM_CAT_PRODUCT_ITEMCODE',	
					'PARAM_CAT_PRODUCT_DESCRIPTION',	
					'PARAM_CAT_PRODUCT_HAS_RECIPE',	
					'PARAM_CAT_PRODUCT_ING_PRICE_FROM',
					'PARAM_CAT_PRODUCT_ING_PRICE_TO',
					'PARAM_CAT_PRODUCT_ING_NET_CONTENT_FROM',
					'PARAM_CAT_PRODUCT_ING_NET_CONTENT_TO',
					'PARAM_CAT_PRODUCT_MIXTURE_QTY_FROM',
					'PARAM_CAT_PRODUCT_MIXTURE_QTY_TO',
					'PARAM_CAT_PRODUCT_MIXTURE_COST_FROM',
					'PARAM_CAT_PRODUCT_MIXTURE_COST_TO',
					'PARAM_CAT_PRODUCT_STATUS',	
					'PARAM_CAT_PRODUCT_SYSTEM_GENERATED',	
		
					'PARAM_ORDER_FIELD',
					'PARAM_ORDER_TYPE',
					'PARAM_SKIP',
					'PARAM_LIMIT'
			], True
		)
	)
	{
		Try
		{
			// Read params
			// ------------------------------------------------------------------	
			$PARAM_REC_PSOVERVIEW_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_REC_PSOVERVIEW_ID');
			$PARAM_REC_PSOVERVIEW_CAT_PRODUCT_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_REC_PSOVERVIEW_CAT_PRODUCT_ID');
			$PARAM_REC_PSOVERVIEW_DESCRIPTION = PHPCUS_PARAM::CUS_READ_NVARCHAR('PARAM_REC_PSOVERVIEW_DESCRIPTION');
			$PARAM_REC_PSOVERVIEW_DATE_FROM = PHPCUS_PARAM::CUS_READ_DATETIME('PARAM_REC_PSOVERVIEW_DATE_FROM');
			$PARAM_REC_PSOVERVIEW_DATE_TO = PHPCUS_PARAM::CUS_READ_DATETIME('PARAM_REC_PSOVERVIEW_DATE_TO');
			$PARAM_REC_PSOVERVIEW_CNT_PRODUCTION_FROM = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_REC_PSOVERVIEW_CNT_PRODUCTION_FROM');
			$PARAM_REC_PSOVERVIEW_CNT_PRODUCTION_TO = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_REC_PSOVERVIEW_CNT_PRODUCTION_TO');
			$PARAM_REC_PSOVERVIEW_CNT_PRODUCTION_ON_FROM = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_REC_PSOVERVIEW_CNT_PRODUCTION_ON_FROM');
			$PARAM_REC_PSOVERVIEW_CNT_PRODUCTION_ON_TO = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_REC_PSOVERVIEW_CNT_PRODUCTION_ON_TO');
			$PARAM_REC_PSOVERVIEW_QTY_REQUEST_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_QTY_REQUEST_FROM');
			$PARAM_REC_PSOVERVIEW_QTY_REQUEST_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_QTY_REQUEST_TO');
			$PARAM_REC_PSOVERVIEW_QTY_PRODUCE_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_QTY_PRODUCE_FROM');
			$PARAM_REC_PSOVERVIEW_QTY_PRODUCE_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_QTY_PRODUCE_TO');
			$PARAM_REC_PSOVERVIEW_QTY_PRODUCE_ON_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_QTY_PRODUCE_ON_FROM');
			$PARAM_REC_PSOVERVIEW_QTY_PRODUCE_ON_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_QTY_PRODUCE_ON_TO');
			$PARAM_REC_PSOVERVIEW_QTY_DELIVERY_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_QTY_DELIVERY_FROM');
			$PARAM_REC_PSOVERVIEW_QTY_DELIVERY_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_QTY_DELIVERY_TO');
			$PARAM_REC_PSOVERVIEW_QTY_DELIVERY_ON_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_QTY_DELIVERY_ON_FROM');
			$PARAM_REC_PSOVERVIEW_QTY_DELIVERY_ON_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_QTY_DELIVERY_ON_TO');
			$PARAM_REC_PSOVERVIEW_QTY_DAMAGE_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_QTY_DAMAGE_FROM');
			$PARAM_REC_PSOVERVIEW_QTY_DAMAGE_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_QTY_DAMAGE_TO');
			$PARAM_REC_PSOVERVIEW_QTY_SNACK_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_QTY_SNACK_FROM');
			$PARAM_REC_PSOVERVIEW_QTY_SNACK_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_QTY_SNACK_TO');
			$PARAM_REC_PSOVERVIEW_QTY_YEILD_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_QTY_YEILD_FROM');
			$PARAM_REC_PSOVERVIEW_QTY_YEILD_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_QTY_YEILD_TO');
			$PARAM_REC_PSOVERVIEW_PRICE_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_PRICE_FROM');
			$PARAM_REC_PSOVERVIEW_PRICE_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_PRICE_TO');
			$PARAM_REC_PSOVERVIEW_COST_FDATA_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_COST_FDATA_FROM');
			$PARAM_REC_PSOVERVIEW_COST_FDATA_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_COST_FDATA_TO');
			$PARAM_REC_PSOVERVIEW_COST_PDATA_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_COST_PDATA_FROM');
			$PARAM_REC_PSOVERVIEW_COST_PDATA_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_COST_PDATA_TO');
			$PARAM_REC_PSOVERVIEW_MIX_REQUEST_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_MIX_REQUEST_FROM');
			$PARAM_REC_PSOVERVIEW_MIX_REQUEST_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_MIX_REQUEST_TO');
			$PARAM_REC_PSOVERVIEW_MIX_PRODUCTION_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_MIX_PRODUCTION_FROM');
			$PARAM_REC_PSOVERVIEW_MIX_PRODUCTION_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_MIX_PRODUCTION_TO');
			$PARAM_REC_PSOVERVIEW_MIX_PRODUCTION_ON_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_MIX_PRODUCTION_ON_FROM');
			$PARAM_REC_PSOVERVIEW_MIX_PRODUCTION_ON_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_MIX_PRODUCTION_ON_TO');
			$PARAM_REC_PSOVERVIEW_COGS_PERC_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_COGS_PERC_FROM');
			$PARAM_REC_PSOVERVIEW_COGS_PERC_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_REC_PSOVERVIEW_COGS_PERC_TO');
			$PARAM_REC_PSOVERVIEW_STATUS = PHPCUS_PARAM::CUS_READ_INT('PARAM_REC_PSOVERVIEW_STATUS');
			
			$PARAM_CAT_PRODUCT_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_CAT_PRODUCT_ID');	
			$PARAM_CAT_PRODUCT_CAT_UOM_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_CAT_PRODUCT_CAT_UOM_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_HAS_RECIPE = PHPCUS_PARAM::CUS_READ_INT('PARAM_CAT_PRODUCT_HAS_RECIPE');	
			$PARAM_CAT_PRODUCT_ING_PRICE_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_CAT_PRODUCT_ING_PRICE_FROM');
			$PARAM_CAT_PRODUCT_ING_PRICE_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_CAT_PRODUCT_ING_PRICE_TO');
			$PARAM_CAT_PRODUCT_ING_NET_CONTENT_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_CAT_PRODUCT_ING_NET_CONTENT_FROM');
			$PARAM_CAT_PRODUCT_ING_NET_CONTENT_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_CAT_PRODUCT_ING_NET_CONTENT_TO');
			$PARAM_CAT_PRODUCT_MIXTURE_QTY_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_CAT_PRODUCT_MIXTURE_QTY_FROM');
			$PARAM_CAT_PRODUCT_MIXTURE_QTY_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_CAT_PRODUCT_MIXTURE_QTY_TO');
			$PARAM_CAT_PRODUCT_MIXTURE_COST_FROM = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_CAT_PRODUCT_MIXTURE_COST_FROM');
			$PARAM_CAT_PRODUCT_MIXTURE_COST_TO = PHPCUS_PARAM::CUS_READ_DECIMAL('PARAM_CAT_PRODUCT_MIXTURE_COST_TO');
			$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_ORDER_FIELD = PHPCUS_PARAM::CUS_READ_SORT_FIELD
			(
					'PARAM_ORDER_FIELD',
					[
						'REC_PSOVERVIEW_ID', 
						'REC_PSOVERVIEW_CAT_PRODUCT_ID', 
						'REC_PSOVERVIEW_DESCRIPTION', 
						'REC_PSOVERVIEW_DATE', 
						'REC_PSOVERVIEW_CNT_PRODUCTION', 
						'REC_PSOVERVIEW_CNT_PRODUCTION_ON', 
						'REC_PSOVERVIEW_QTY_REQUEST', 
						'REC_PSOVERVIEW_QTY_PRODUCE', 
						'REC_PSOVERVIEW_QTY_PRODUCE_ON', 
						'REC_PSOVERVIEW_QTY_DELIVERY', 
						'REC_PSOVERVIEW_QTY_DELIVERY_ON', 
						'REC_PSOVERVIEW_QTY_DAMAGE', 
						'REC_PSOVERVIEW_QTY_SNACK', 
						'REC_PSOVERVIEW_QTY_YEILD', 
						'REC_PSOVERVIEW_PRICE', 
						'REC_PSOVERVIEW_COST_FDATA', 
						'REC_PSOVERVIEW_COST_PDATA', 
						'REC_PSOVERVIEW_MIX_REQUEST', 
						'REC_PSOVERVIEW_MIX_PRODUCTION', 
						'REC_PSOVERVIEW_MIX_PRODUCTION_ON', 
						'REC_PSOVERVIEW_COGS_PERC', 
						'REC_PSOVERVIEW_STATUS'
						, 
						'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_MIXTURE_COST',		
						'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_PSOVERVIEW::CUS_PREPARE_MAPPED_ARRAY_FOR_GET();
			
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_ID'] = $PARAM_REC_PSOVERVIEW_ID;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_CAT_PRODUCT_ID'] = $PARAM_REC_PSOVERVIEW_CAT_PRODUCT_ID;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_DESCRIPTION'] = $PARAM_REC_PSOVERVIEW_DESCRIPTION;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_DATE_FROM'] = $PARAM_REC_PSOVERVIEW_DATE_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_DATE_TO'] = $PARAM_REC_PSOVERVIEW_DATE_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_CNT_PRODUCTION_FROM'] = $PARAM_REC_PSOVERVIEW_CNT_PRODUCTION_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_CNT_PRODUCTION_TO'] = $PARAM_REC_PSOVERVIEW_CNT_PRODUCTION_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_CNT_PRODUCTION_ON_FROM'] = $PARAM_REC_PSOVERVIEW_CNT_PRODUCTION_ON_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_CNT_PRODUCTION_ON_TO'] = $PARAM_REC_PSOVERVIEW_CNT_PRODUCTION_ON_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_QTY_REQUEST_FROM'] = $PARAM_REC_PSOVERVIEW_QTY_REQUEST_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_QTY_REQUEST_TO'] = $PARAM_REC_PSOVERVIEW_QTY_REQUEST_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_QTY_PRODUCE_FROM'] = $PARAM_REC_PSOVERVIEW_QTY_PRODUCE_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_QTY_PRODUCE_TO'] = $PARAM_REC_PSOVERVIEW_QTY_PRODUCE_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_QTY_PRODUCE_ON_FROM'] = $PARAM_REC_PSOVERVIEW_QTY_PRODUCE_ON_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_QTY_PRODUCE_ON_TO'] = $PARAM_REC_PSOVERVIEW_QTY_PRODUCE_ON_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_QTY_DELIVERY_FROM'] = $PARAM_REC_PSOVERVIEW_QTY_DELIVERY_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_QTY_DELIVERY_TO'] = $PARAM_REC_PSOVERVIEW_QTY_DELIVERY_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_QTY_DELIVERY_ON_FROM'] = $PARAM_REC_PSOVERVIEW_QTY_DELIVERY_ON_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_QTY_DELIVERY_ON_TO'] = $PARAM_REC_PSOVERVIEW_QTY_DELIVERY_ON_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_QTY_DAMAGE_FROM'] = $PARAM_REC_PSOVERVIEW_QTY_DAMAGE_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_QTY_DAMAGE_TO'] = $PARAM_REC_PSOVERVIEW_QTY_DAMAGE_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_QTY_SNACK_FROM'] = $PARAM_REC_PSOVERVIEW_QTY_SNACK_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_QTY_SNACK_TO'] = $PARAM_REC_PSOVERVIEW_QTY_SNACK_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_QTY_YEILD_FROM'] = $PARAM_REC_PSOVERVIEW_QTY_YEILD_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_QTY_YEILD_TO'] = $PARAM_REC_PSOVERVIEW_QTY_YEILD_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_PRICE_FROM'] = $PARAM_REC_PSOVERVIEW_PRICE_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_PRICE_TO'] = $PARAM_REC_PSOVERVIEW_PRICE_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_COST_FDATA_FROM'] = $PARAM_REC_PSOVERVIEW_COST_FDATA_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_COST_FDATA_TO'] = $PARAM_REC_PSOVERVIEW_COST_FDATA_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_COST_PDATA_FROM'] = $PARAM_REC_PSOVERVIEW_COST_PDATA_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_COST_PDATA_TO'] = $PARAM_REC_PSOVERVIEW_COST_PDATA_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_MIX_REQUEST_FROM'] = $PARAM_REC_PSOVERVIEW_MIX_REQUEST_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_MIX_REQUEST_TO'] = $PARAM_REC_PSOVERVIEW_MIX_REQUEST_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_MIX_PRODUCTION_FROM'] = $PARAM_REC_PSOVERVIEW_MIX_PRODUCTION_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_MIX_PRODUCTION_TO'] = $PARAM_REC_PSOVERVIEW_MIX_PRODUCTION_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_MIX_PRODUCTION_ON_FROM'] = $PARAM_REC_PSOVERVIEW_MIX_PRODUCTION_ON_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_MIX_PRODUCTION_ON_TO'] = $PARAM_REC_PSOVERVIEW_MIX_PRODUCTION_ON_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_COGS_PERC_FROM'] = $PARAM_REC_PSOVERVIEW_COGS_PERC_FROM;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_COGS_PERC_TO'] = $PARAM_REC_PSOVERVIEW_COGS_PERC_TO;
			$GET_MAP_ARRAY['PARAM_REC_PSOVERVIEW_STATUS'] = $PARAM_REC_PSOVERVIEW_STATUS;
			
			$GET_MAP_ARRAY['PARAM_CAT_PRODUCT_ID'] = $PARAM_CAT_PRODUCT_ID;	
			$GET_MAP_ARRAY['PARAM_CAT_PRODUCT_CAT_UOM_ID'] = $PARAM_CAT_PRODUCT_CAT_UOM_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_HAS_RECIPE'] = $PARAM_CAT_PRODUCT_HAS_RECIPE;	
			$GET_MAP_ARRAY['PARAM_CAT_PRODUCT_ING_PRICE_FROM'] = $PARAM_CAT_PRODUCT_ING_PRICE_FROM;
			$GET_MAP_ARRAY['PARAM_CAT_PRODUCT_ING_PRICE_TO'] = $PARAM_CAT_PRODUCT_ING_PRICE_TO;
			$GET_MAP_ARRAY['PARAM_CAT_PRODUCT_ING_NET_CONTENT_FROM'] = $PARAM_CAT_PRODUCT_ING_NET_CONTENT_FROM;
			$GET_MAP_ARRAY['PARAM_CAT_PRODUCT_ING_NET_CONTENT_TO'] = $PARAM_CAT_PRODUCT_ING_NET_CONTENT_TO;
			$GET_MAP_ARRAY['PARAM_CAT_PRODUCT_MIXTURE_QTY_FROM'] = $PARAM_CAT_PRODUCT_MIXTURE_QTY_FROM;
			$GET_MAP_ARRAY['PARAM_CAT_PRODUCT_MIXTURE_QTY_TO'] = $PARAM_CAT_PRODUCT_MIXTURE_QTY_TO;
			$GET_MAP_ARRAY['PARAM_CAT_PRODUCT_MIXTURE_COST_FROM'] = $PARAM_CAT_PRODUCT_MIXTURE_COST_FROM;
			$GET_MAP_ARRAY['PARAM_CAT_PRODUCT_MIXTURE_COST_TO'] = $PARAM_CAT_PRODUCT_MIXTURE_COST_TO;
			$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_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_PSOVERVIEW::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');
	}

?>