	// ===============================================================
	// Load Parent Information Flags
	// ===============================================================	
	function HTTP_PARENT_LOAD()
	{
	};
	

	// ===============================================================
	// EditHandler Flags
	// ===============================================================	
	
	function HTTP_LOAD(CALLBACK_FUNCTION)
	{
		// Escape if new item
		// ...........................................
		if(JSRC_FLAG.IS_NULL_BIGINT(PROPERTY_REC_POSRESERVE_ID, 1, 1))
		{
			return;
		}
		
		// Reset Holder
		TOTAL_AMOUNT = 0;
		APPROVE_FLAG = 0;

		// Load DB data of item
		// ...........................................
		JSOC_DIALOG.VAR_LOADING_SPINNER(true);


		// Actual Function
		var GET_MAP_ARRAY = JSCUS_SQL._RECORD._POS_RESERVE_LIST.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();

		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_POSRESERVE_LIST_REC_POSRESERVE_ID', JSVC_NUM.VAR_NVALL(PROPERTY_REC_POSRESERVE_ID));


		// Declare Post Request Handler
		// _______________________________________________________________________
		var RESPONSE_HANDLER = 			
			function(IS_SUCCESS, HTTP_RESPONSE)
			{
				// Disable Dialogs
				// ...........................................
				//CUS_SEND_DIALOG_TRY_DISMISS();
				
				// Handle Error
				// ...........................................
				if(IS_SUCCESS === false)
				{
					METHOD_UNABLE_TO_SEND_REQUEST(CALLBACK_METHOD);	
					return;
				}
				
				// Catch JSON Error
				// ...........................................
				else if(JSRC_JSON.REF_IS_JSTRING(HTTP_RESPONSE) == false)
				{
					METHOD_SERVER_ISSUE(CALLBACK_METHOD, HTTP_RESPONSE);
					return;			
				}
					
				// Read Response
				// ...........................................
				else
				{
					// Load Response
					var JSON_OBJECT = JSRC_JSON.REF_CREATE(HTTP_RESPONSE);

					if(JSRC_JSON.REF_IS_SUCCESS(JSON_OBJECT) === false)
					{
						METHOD_REQUEST_FAILURE(CALLBACK_METHOD, JSON_OBJECT);
						return;
					}
					else
					{
						POS_RESERVE_LIST_DGV.POPULATE_FROM_QUERY
						(
							JSON_OBJECT, 
							'',
							false,
							false,
							1,
							[2, 1]
						);

						POS_RESERVE_LIST_DGV.COLUMN.CFORMAT("REC_POSRESERVE_LIST_QTY");
						POS_RESERVE_LIST_DGV.COLUMN.CFORMAT("REC_POSRESERVE_LIST_PRICE_BASE");
						POS_RESERVE_LIST_DGV.COLUMN.CFORMAT("REC_POSRESERVE_LIST_PRICE_EXPECT");

						TOTAL_ITEMS = POS_RESERVE_LIST_DGV.COLUMN.SUM("REC_POSRESERVE_LIST_QTY");
						TOTAL_AMOUNT = POS_RESERVE_LIST_DGV.COLUMN.SUM("REC_POSRESERVE_LIST_PRICE_EXPECT");

						JSOC_ELEMENT.VAR_VALUE("TOTAL_ITEMS", JSVC_NUM.VAR_CFORMAT(TOTAL_ITEMS));
						JSOC_ELEMENT.VAR_VALUE("TOTAL_AMOUNT", JSVC_NUM.VAR_CFORMAT(TOTAL_AMOUNT));


						var ROW_INDEX = 0;

						while(POS_RESERVE_LIST_DGV.ROW.COUNT() > ROW_INDEX)
						{
							HTTP_CHECK_INVENTORY
							(
								ROW_INDEX, 
								function(IS_SUCCESS)
								{
									console.log(IS_SUCCESS);
									return;
								}
							);

							ROW_INDEX++;
						}
					}
				}
			};

		
		JSCUS_SQL._RECORD._POS_RESERVE_LIST.CUS_GET
		(
			GET_MAP_ARRAY,
			RESPONSE_HANDLER,
			true
		);		
	};

	function HTTP_LOAD2(CALLBACK_FUNCTION)
	{
		// Escape if new item
		// ...........................................
		if(JSRC_FLAG.IS_NULL_BIGINT(PROPERTY_REC_POSRESERVE_ID, 1, 1))
		{
			return;
		}
		

		// Load DB data of item
		// ...........................................
		JSOC_DIALOG.VAR_LOADING_SPINNER(true);


		// Actual Function
		var GET_MAP_ARRAY = JSCUS_SQL._RECORD._POS_RESERVE_LIST.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_POSRESERVE_LIST_REC_POSRESERVE_ID', PROPERTY_REC_POSRESERVE_ID);


		// Declare Post Request Handler
		// _______________________________________________________________________
		var RESPONSE_HANDLER = 			
			function(IS_SUCCESS, RESPONSE_STRING)
			{
				// Disable Dialogs
				// ...........................................
				CUS_SEND_DIALOG_TRY_DISMISS();
				
				// Clear DGV
				// ...........................................
				PRODUCT_BRANCH_DGV.ROW.CLEAR();

				// Validate
				// _______________________________________________________________________
				if(IS_SUCCESS === false)
				{
					console.error("CONNECTION ERROR: \n" + RESPONSE_STRING);
					return;
				}
				
				// Validate JSON Response
				// _______________________________________________________________________
				var JSON_OBJECT = JSRC_JSON.REF_CREATE(RESPONSE_STRING);
				if(JSRC_JSON.REF_IS_SUCCESS(JSON_OBJECT) === false)
				{
					console.error("REQUEST ERROR: \n" + RESPONSE_STRING);
					return;
				}
				
				// JSON Empty (Clears the DataGrodView)
				// _______________________________________________________________________
				if(JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT") <= 0)
				{
					PRODUCT_BRANCH_DGV.ROW.CLEAR();
					return;
				}

				// Populate DGV
				// _______________________________________________________________________
				PRODUCT_BRANCH_DGV.POPULATE_FROM_QUERY
				(
						JSON_OBJECT, 
						'',
						false,
						false,
						1,
						[2, 1]
				);

				PRODUCT_BRANCH_DGV.COLUMN.CFORMAT("REC_POSRESERVE_LIST_QTY");
				PRODUCT_BRANCH_DGV.COLUMN.CFORMAT("REC_POSRESERVE_LIST_PRICE_BASE");
			};

		
		JSCUS_SQL._RECORD._POS_RESERVE_LIST.CUS_GET
		(
			GET_MAP_ARRAY,
			RESPONSE_HANDLER,
			true
		);				
		
	};


	// ===============================================================
	// Trims empty spaces and perform convertion for numeric fields.
	// ===============================================================
	function FIX_INPUT()
	{
		// Fix String Fields
		// ...........................................
		
		
		// Fix Numeric Fields (if field type is not number.)
		// ...........................................


		// Fix Password Fields
		// ...........................................
	};

	function HTTP_DELETE(CALLBACK_METHOD, ROW_INDEX)
	{
		// Escape if Disabled
		// _______________________________________________________________________
		// if(JSVC_VAR.VAR_ISSET(DELETE_BBI) && DELETE_BBI.Enabled == false)
		// {
		// 	CALLBACK_METHOD(false);
		// 	return;
		// }

		// Escape if nothing selected
		// _______________________________________________________________________
		if(ROW_INDEX < 0)
		{
			JSVC_ERROR.VAR_ARGUMENT_EXCEPTION_NOTHING_SELECTED(true);
			CALLBACK_METHOD(false);
			return;
		}
		
		// Initialize
		// _______________________________________________________________________
		var DELETE_ITEM_DESCRIPTION = PRODUCT_BRANCH_DGV.CELL.VALUE('REC_POSRESERVE_LIST_CAT_PRODUCT_ID_DESCRIPTION', ROW_INDEX);
		
		
		
		// Declare Post Request Handler
		// _______________________________________________________________________
		var RESPONSE_HANDLER = function
		(
			IS_SUCCESS, 
			HTTP_RESPONSE
		)
		{
			// Disable Dialogs
			// ...........................................
			CUS_SEND_DIALOG_TRY_DISMISS();
				
				
			// Handle Error
			// ...........................................
			if(IS_SUCCESS === false)
			{
				METHOD_UNABLE_TO_SEND_REQUEST(CALLBACK_METHOD);
				return;
			}
			
			// Catch JSON Error
			// ...........................................
			else if(JSRC_JSON.REF_IS_JSTRING(HTTP_RESPONSE) == false)
			{
				METHOD_SERVER_ISSUE(CALLBACK_METHOD, HTTP_RESPONSE);
				return;			
			}
			
			
			// Read Response
			// ...........................................
			else
			{
				// Load Response
				var JSON_OBJECT = JSRC_JSON.REF_CREATE(HTTP_RESPONSE);
				if(JSRC_JSON.REF_IS_SUCCESS(JSON_OBJECT) === false)
				{
					METHOD_REQUEST_FAILURE(CALLBACK_METHOD, JSON_OBJECT);
					return;
				}
				
				// Post Delete Action
				else
				{
					PRODUCT_BRANCH_DGV.ROW.REMOVE_AT(ROW_INDEX);
					JSVC_INFO.VAR_RECORD_DELETED
					(
						DELETE_ITEM_DESCRIPTION, 
						function()
						{
							CALLBACK_METHOD(true);
						}
					);		
				}
			}
		};
		
		
		// Request User Verification for Delete
		// _______________________________________________________________________
		JSVC_INFO.VAR_VERIFY_DELETE
		(
			DELETE_ITEM_DESCRIPTION,
			function(VERIFY_RESULT) 
			{
				// Abort if rejected by user.
				// ...........................................
				if(VERIFY_RESULT != JSOC_DIALOG.MSGBOX_YES)
				{

					CALLBACK_METHOD(false);
					return;
				}
				
				
				//Delete Item
				// ...........................................
				JSOC_DIALOG.VAR_LOADING_SPINNER(true);
				JSCUS_SQL._RECORD._POS_RESERVE_LIST.CUS_DELETE
				(
					PRODUCT_BRANCH_DGV.CELL.VALUE('REC_POSRESERVE_LIST_ID', ROW_INDEX),
					RESPONSE_HANDLER
				)
			}
		);
	};

	function HTTP_CHECK_INVENTORY(ROW_INDEX, CALLBACK_METHOD)
	{
		var GET_MAP_ARRAY = JSCUS_SQL._RECORD._INVENTORY.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();

		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, "PARAM_REC_INVENTORY_ACC_GROUP_ID", JSVC_NUM.VAR_NVALL(JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_ACC_GROUP_ID));
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, "PARAM_REC_INVENTORY_CAT_PRODUCT_ID", JSVC_NUM.VAR_NVALL(POS_RESERVE_LIST_DGV.CELL.VALUE('REC_POSRESERVE_LIST_CAT_PRODUCT_ID', ROW_INDEX)));

		var RESPONSE_HANDLER = 			
			function(IS_SUCCESS, HTTP_RESPONSE)
			{
				// Disable Dialogs
				// ...........................................
				CUS_SEND_DIALOG_TRY_DISMISS();
					
				// Handle Error
				// ...........................................
				if(IS_SUCCESS === false)
				{
					METHOD_UNABLE_TO_SEND_REQUEST(CALLBACK_METHOD);	
					return;
				}
					
				// Catch JSON Error
				// ...........................................
				else if(JSRC_JSON.REF_IS_JSTRING(HTTP_RESPONSE) == false)
				{
					METHOD_SERVER_ISSUE(CALLBACK_METHOD, HTTP_RESPONSE);
					return;			
				}
						
				// Read Response
				// ...........................................
				else
				{
					// Load Response
					var JSON_OBJECT = JSRC_JSON.REF_CREATE(HTTP_RESPONSE);
					if(JSRC_JSON.REF_IS_SUCCESS(JSON_OBJECT) === false)
					{
						METHOD_REQUEST_FAILURE(CALLBACK_METHOD, JSON_OBJECT);
						return;
					}
					else
					{
						if(JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, 'REC_INVENTORY_QUANTITY', 2)) < JSVC_NUM.VAR_NVALL(POS_RESERVE_LIST_DGV.CELL.VALUE('REC_POSRESERVE_LIST_QTY', ROW_INDEX)))
						{
							JSOC_ELEMENT.VAR_GET('POS_RESERVE_LIST_DGV_ROW_'+JSVC_NUM.VAR_NVALL(ROW_INDEX+1)).classList.add("table-danger");
							APPROVE_FLAG = 1;
							CALLBACK_METHOD(false);
						}
						else
						{
							APPROVE_FLAG = 0;
							CALLBACK_METHOD(true);
						}
					}
				}
			};

		JSOC_DIALOG.VAR_LOADING_SPINNER(true);

		JSCUS_SQL._RECORD._INVENTORY.CUS_GET
		(
			GET_MAP_ARRAY,
			RESPONSE_HANDLER,
			true
		);
	}

		
	// ===============================================================
	// Request Save
	// ===============================================================

	function HTTP_RESERVE_SAVE(CALLBACK_METHOD)
	{

		// Sanitize User Inputs
		// _______________________________________________________________________
		FIX_INPUT();
	
	
		// Check Edit Status
		// _______________________________________________________________________
		// if(EDIT_HANDLER.REF_IS_MODIFIED == false)
		// {
		// 	JSVC_INFO.VAR_NOTHING_TO_SAVE(function(){CALLBACK_METHOD(false);})	
		// 	return;		
		// }

		// Validate Null [String Input]
		// _______________________________________________________________________
		
		
		// Validate Zero [Numeric Input]
		// _______________________________________________________________________
	
	
		// Validate Negative [Numeric Input]
		// _______________________________________________________________________
		
		
		// Validate Range [Numeric Input]
		// _______________________________________________________________________	


		// Foreign key check
		// _______________________________________________________________________
		if
		(
			JSVC_VAR.VAR_ISSET(REC_POSRESERVE_REC_CLIENT_ID_CMB) &&
			(
				JSOC_CMB.VAR_SELECTED_INDEX(REC_POSRESERVE_REC_CLIENT_ID_CMB) < 0 ||
				JSVC_NUM.VAR_NVALL(JSOC_CMB.VAR_SELECTED_VALUE(REC_POSRESERVE_REC_CLIENT_ID_CMB)) < 0
			)
		)
		{
			JSOC_DIALOG.VAR_MESSAGE_BOX
			(
				'Field Client is required.', 
				'Information',
				'OK', 'WARNING',
				function(MESSAGE_RESPONSE)
				{
					REC_POSRESERVE_REC_CLIENT_ID_CMB.style.borderColor = JSCUS_CACHE.SITE_ON_ERROR_BORDER_COLOR;
					REC_POSRESERVE_REC_CLIENT_ID_CMB.focus();
					CALLBACK_METHOD(false);
				}
			);	
			return;			
		}
		if
		(
			PRODUCT_BRANCH_DGV.ROW.COUNT() <= 0
		)
		{
			JSOC_DIALOG.VAR_MESSAGE_BOX
			(
				'You must add atleast One (1) product.', 
				'Information',
				'OK', 'WARNING',
				function(MESSAGE_RESPONSE)
				{
					CALLBACK_METHOD(false);
				}
			);	
			return;			
		}
		
		// Validate Duplicates
		// _______________________________________________________________________
		var EXCEPTION_ROW_INDEX = -1;
		if(PROPERTY_REC_POSRESERVE_ID >= 0)
		{
			EXCEPTION_ROW_INDEX = PROPERTY_EDIT_ROW_INDEX;
		}
			
		// Password Items (if available)
		// _______________________________________________________________________
		
		
		// CheckBox Items (if available)
		// _______________________________________________________________________

	
		// File is required
		// _______________________________________________________________________
		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("PARAM_REC_POSRESERVE_ID_FILE_FP") &&
			PARAM_REC_POSRESERVE_ID_FILE_FP.files.length <= 0
		)
		{
			JSOC_DIALOG.VAR_MESSAGE_BOX
			(
				JSVC_ERROR.VAR_ARGUMENT_EXCEPTION_MISSING_INPUT("Upload File", false), 
				'Information',
				'OK', 'WARNING',
				function(MESSAGE_RESPONSE)
				{
					PARAM_REC_POSRESERVE_ID_FILE_FP.style.borderColor = JSCUS_CACHE.SITE_ON_ERROR_BORDER_COLOR;
					CALLBACK_METHOD(false);
				}
			);		
			return;	
		}
		
	
		// File is too large (Sample Code : 3mb)
		// _______________________________________________________________________
		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("PARAM_REC_POSRESERVE_ID_FILE_FP") &&
			PARAM_REC_POSRESERVE_ID_FILE_FP.files[0].size > 1024 * 1024 * 3
		)
		{
			JSOC_DIALOG.VAR_MESSAGE_BOX
			(
				'Selected file is too large. File size is restricted to 3mb or below',
				'Information',
				'OK', 'ERROR',
				function()
				{
					CALLBACK_METHOD(false);
				}
			);	
		   PARAM_REC_POSRESERVE_ID_FILE_FP.value = "";
		   return;
		};
		
		// Save item [Prepare]
		// _______________________________________________________________________
		var SAVE_MAP_ARRAY = JSCUS_SQL._RECORD._POS_RESERVE.CUS_PREPARE_MAPPED_ARRAY_FOR_SAVE();
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_POSRESERVE_ID", PROPERTY_REC_POSRESERVE_ID);
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_POSRESERVE_ACC_GROUP_ID", JSVC_NUM.VAR_NVALL(JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_ACC_GROUP_ID));
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_POSRESERVE_REC_CLIENT_ID", JSVC_NUM.VAR_NVALL(JSOC_CMB.VAR_SELECTED_VALUE(REC_POSRESERVE_REC_CLIENT_ID_CMB)));
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_POSRESERVE_REFERENCE_CODE", JSOC_ELEMENT.VAR_VALUE(REC_POSRESERVE_REFERENCE_CODE_TXT));					
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_POSRESERVE_DATE_EXPECTED", JSVC_DATE.VAR_FORMAT(JSVC_DATE.VAR_END_OF_DAY(JSOC_ELEMENT.VAR_VALUE(REC_POSRESERVE_DATE_EXPECTED_DTP)), "YYYY-MM-DD HH:mm:ss") + '.999999');
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_POSRESERVE_REMARKS", JSOC_ELEMENT.VAR_VALUE(REC_POSRESERVE_REMARKS_TXT));
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_POSRESERVE_LONG_A", JSVC_NUM.VAR_NVALL(JSOC_CMB.VAR_SELECTED_VALUE(REC_POSRESERVE_LONG_A_CMB))); // Mode of Payment 2-Cash, 3-Credit
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_POSRESERVE_LONG_B", 0);
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_POSRESERVE_DECIMAL_A", 0);
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_POSRESERVE_DECIMAL_B", 0);
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_POSRESERVE_VARCHAR_A", '');
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_POSRESERVE_VARCHAR_B", '');

		if(IS_APPROVE == 0)
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_POSRESERVE_STATUS", 1);
		else
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_POSRESERVE_STATUS", 2);

		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("PARAM_REC_POSRESERVE_ID_FILE_FP"))
		{
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_POSRESERVE_ID_FILE", PARAM_REC_POSRESERVE_ID_FILE_FP);
		}
		
		
		// Declare Post Request Handler
		// _______________________________________________________________________
		var RESPONSE_HANDLER = 			
			function(IS_SUCCESS, HTTP_RESPONSE)
			{
				// Disable Dialogs
				// ...........................................
				CUS_SEND_DIALOG_TRY_DISMISS();
				
				// Handle Error
				// ...........................................
				if(IS_SUCCESS === false)
				{
					METHOD_UNABLE_TO_SEND_REQUEST(CALLBACK_METHOD);	
					return;
				}
				
				// Catch JSON Error
				// ...........................................
				else if(JSRC_JSON.REF_IS_JSTRING(HTTP_RESPONSE) == false)
				{
					METHOD_SERVER_ISSUE(CALLBACK_METHOD, HTTP_RESPONSE);
					return;			
				}
					
				// Read Response
				// ...........................................
				else
				{
					// Load Response
					var JSON_OBJECT = JSRC_JSON.REF_CREATE(HTTP_RESPONSE);
					if(JSRC_JSON.REF_IS_SUCCESS(JSON_OBJECT) === false)
					{
						METHOD_REQUEST_FAILURE(CALLBACK_METHOD, JSON_OBJECT);
						return;
					}
					// Post Save Action
					else
					{
						//SAVE LINE
						var PARENT_ID_HOLDER = JSVC_NUM.VAR_NVALL(JSRC_JSON.REF_READ(JSON_OBJECT, "INSERTED_ID", "1"));
						HTTP_RESERVE_SAVE_LINE(CALLBACK_METHOD, PARENT_ID_HOLDER);
					}
				}
			};
			
			
		// Save Item [Send Request]
		// _______________________________________________________________________
		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._RECORD._POS_RESERVE.CUS_SAVE 
		(
			SAVE_MAP_ARRAY,
			RESPONSE_HANDLER
		);
		
	};

	function HTTP_RESERVE_SAVE_LINE(CALLBACK_METHOD, PARENT_ID_HOLDER)
	{
		// Save item [Prepare]
		// _______________________________________________________________________
		var SAVE_MAP_ARRAY = [];
		var BUNDLE_MAP_ARRAY = [];
		var ROW_INDEX = 0;
		while(PRODUCT_BRANCH_DGV.ROW.COUNT() > ROW_INDEX)
		{
			SAVE_MAP_ARRAY = JSCUS_SQL._RECORD._POS_RESERVE_LIST.CUS_PREPARE_MAPPED_ARRAY_FOR_SAVE();
		
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_POSRESERVE_LIST_ID", JSVC_NUM.VAR_NVALL(PRODUCT_BRANCH_DGV.CELL.VALUE('REC_POSRESERVE_LIST_ID',ROW_INDEX)));			
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_POSRESERVE_LIST_REC_POSRESERVE_ID", PARENT_ID_HOLDER);
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_POSRESERVE_LIST_CAT_DISCOUNT_ID", 1); //DEFAULT WALA PA MUNA DISCOUNT
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_POSRESERVE_LIST_CAT_PRODUCT_ID", JSVC_NUM.VAR_NVALL(PRODUCT_BRANCH_DGV.CELL.VALUE('REC_POSRESERVE_LIST_CAT_PRODUCT_ID',ROW_INDEX)));
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_POSRESERVE_LIST_PRICE_EXPECT",
				JSVC_NUM.VAR_NVAL(PRODUCT_BRANCH_DGV.CELL.VALUE('REC_POSRESERVE_LIST_PRICE_BASE',ROW_INDEX)) *
				JSVC_NUM.VAR_NVAL(PRODUCT_BRANCH_DGV.CELL.VALUE('REC_POSRESERVE_LIST_QTY',ROW_INDEX))
				);	
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_POSRESERVE_LIST_PRICE_BASE", JSVC_NUM.VAR_NVAL(PRODUCT_BRANCH_DGV.CELL.VALUE('REC_POSRESERVE_LIST_PRICE_BASE',ROW_INDEX)));	
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_POSRESERVE_LIST_QTY", JSVC_NUM.VAR_NVAL(PRODUCT_BRANCH_DGV.CELL.VALUE('REC_POSRESERVE_LIST_QTY',ROW_INDEX)));	
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_POSRESERVE_LIST_STATUS", JSVC_NUM.VAR_NVALL(PRODUCT_BRANCH_DGV.CELL.VALUE('REC_POSRESERVE_LIST_STATUS',ROW_INDEX)));

			BUNDLE_MAP_ARRAY = JSCUS_SQL._RECORD._POS_RESERVE_LIST.CUS_ADD_MAPPED_ARRAY_FOR_SAVE(BUNDLE_MAP_ARRAY, SAVE_MAP_ARRAY);

			ROW_INDEX++;
		}
		
		
		// Declare Post Request Handler
		// _______________________________________________________________________
		var RESPONSE_HANDLER = 			
			function(IS_SUCCESS, HTTP_RESPONSE)
			{
				// Disable Dialogs
				// ...........................................
				CUS_SEND_DIALOG_TRY_DISMISS();
				
				// Handle Error
				// ...........................................
				if(IS_SUCCESS === false)
				{
					METHOD_UNABLE_TO_SEND_REQUEST(CALLBACK_METHOD);	
					return;
				}
				
				// Catch JSON Error
				// ...........................................
				else if(JSRC_JSON.REF_IS_JSTRING(HTTP_RESPONSE) == false)
				{
					METHOD_SERVER_ISSUE(CALLBACK_METHOD, HTTP_RESPONSE);
					return;			
				}
					
				// Read Response
				// ...........................................
				else
				{
					// Load Response
					var JSON_OBJECT = JSRC_JSON.REF_CREATE(HTTP_RESPONSE);
					if(JSRC_JSON.REF_IS_SUCCESS(JSON_OBJECT) === false)
					{
						METHOD_REQUEST_FAILURE(CALLBACK_METHOD, JSON_OBJECT);
						return;
					}
					
			
					// Post Save Action
					else
					{
						if(IS_APPROVE == 0)
						{
							if(PROPERTY_REC_POSRESERVE_ID > 0)
								HTTP_SEARCH(PROPERTY_REC_POSRESERVE_ID, PROPERTY_EDIT_ROW_INDEX);
							else
							{
								POS_RESERVE_DGV.ROW.INSERT_AT(0);
								HTTP_SEARCH(PARENT_ID_HOLDER, 0);
							}

							// Lift edit and Exit EditMode
							EDIT_HANDLER.REF_IS_MODIFIED = false;
							EDIT_HANDLER.HAS_NEWLY_SAVED_DATA = true;			
							if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS('POS_RESERVE_NEW_MODAL') == true)
								JSOC_DIALOG.VAR_MODAL('POS_RESERVE_NEW_MODAL', false);
							
							//SWAP_EDIT_MODE(false);
							CALLBACK_METHOD(true);
						}
						else
						{
							var ROW_INDEX = 0;

							while(PRODUCT_BRANCH_DGV.ROW.COUNT() > ROW_INDEX)
							{
								PRODUCT_BRANCH_DGV.CELL.VALUE("REC_POSRESERVE_LIST_ID", ROW_INDEX, JSVC_NUM.VAR_NVALL(JSRC_JSON.REF_READ(JSON_OBJECT, "INSERTED_ID", ROW_INDEX + 1)));
								ROW_INDEX ++;
							}

							if(PROPERTY_REC_POSRESERVE_ID > 0)
								HTTP_SEARCH(PROPERTY_REC_POSRESERVE_ID, PROPERTY_EDIT_ROW_INDEX);
							else
							{
								PROPERTY_EDIT_ROW_INDEX = 0;
								PROPERTY_REC_POSRESERVE_ID = PARENT_ID_HOLDER;
								POS_RESERVE_DGV.ROW.INSERT_AT(0);
								HTTP_SEARCH(PARENT_ID_HOLDER, 0);
							}
						}
					}
				}
			};
			
			
		// Save Item [Send Request]
		// _______________________________________________________________________
		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._RECORD._POS_RESERVE_LIST.CUS_SAVE 
		(
			BUNDLE_MAP_ARRAY,
			RESPONSE_HANDLER
		);
	}

	function HTTP_SAVE(CALLBACK_METHOD)
	{
		//check inventory
		// if(APPROVE_FLAG == 1)
		// {
		// 	JSOC_DIALOG.VAR_MESSAGE_BOX
		// 	(
		// 		'Not enough inventory for the items highlighted', 
		// 		'Information',
		// 		'OK', 'WARNING',
		// 		function(MESSAGE_RESPONSE){}
		// 	);	
		// 	return;	
		// }

		if
		(
			JSVC_VAR.VAR_ISSET(REC_POSRESERVE_REC_CLIENT_ID_CMB) &&
			(
				JSOC_CMB.VAR_SELECTED_INDEX(REC_POSRESERVE_REC_CLIENT_ID_CMB) < 0 ||
				JSVC_NUM.VAR_NVALL(JSOC_CMB.VAR_SELECTED_VALUE(REC_POSRESERVE_REC_CLIENT_ID_CMB)) < 0
			)
		)
		{
			JSOC_DIALOG.VAR_MESSAGE_BOX
			(
				'Field Client is required.', 
				'Information',
				'OK', 'WARNING',
				function(MESSAGE_RESPONSE)
				{
					REC_POSRESERVE_REC_CLIENT_ID_CMB.style.borderColor = JSCUS_CACHE.SITE_ON_ERROR_BORDER_COLOR;
					REC_POSRESERVE_REC_CLIENT_ID_CMB.focus();
					CALLBACK_METHOD(false);
				}
			);	
			return;			
		}
		if
		(
			PRODUCT_BRANCH_DGV.ROW.COUNT() <= 0
		)
		{
			JSOC_DIALOG.VAR_MESSAGE_BOX
			(
				'You must add atleast One (1) product.', 
				'Information',
				'OK', 'WARNING',
				function(MESSAGE_RESPONSE)
				{
					CALLBACK_METHOD(false);
				}
			);	
			return;			
		}

		// Save item [Prepare]
		// _______________________________________________________________________
		var SAVE_MAP_ARRAY = JSCUS_SQL._RECORD._POS_RESERVE.CUS_PREPARE_MAPPED_ARRAY_FOR_SAVE();

		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_POSRESERVE_ID", PROPERTY_REC_POSRESERVE_ID);
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_POSRESERVE_STATUS", 2); //APPROVE
		
		// Declare Post Request Handler
		// _______________________________________________________________________
		var RESPONSE_HANDLER = 			
			function(IS_SUCCESS, HTTP_RESPONSE)
			{
				// Disable Dialogs
				// ...........................................
				CUS_SEND_DIALOG_TRY_DISMISS();
				
				// Handle Error
				// ...........................................
				if(IS_SUCCESS === false)
				{
					METHOD_UNABLE_TO_SEND_REQUEST(CALLBACK_METHOD);	
					return;
				}
				
				// Catch JSON Error
				// ...........................................
				else if(JSRC_JSON.REF_IS_JSTRING(HTTP_RESPONSE) == false)
				{
					METHOD_SERVER_ISSUE(CALLBACK_METHOD, HTTP_RESPONSE);
					return;			
				}
					
				// Read Response
				// ...........................................
				else
				{
					// Load Response
					var JSON_OBJECT = JSRC_JSON.REF_CREATE(HTTP_RESPONSE);
					if(JSRC_JSON.REF_IS_SUCCESS(JSON_OBJECT) === false)
					{
						METHOD_REQUEST_FAILURE(CALLBACK_METHOD, JSON_OBJECT);
						return;
					}
					// Post Save Action
					else
					{
						// Save JO
						HTTP_SAVE_JO(CALLBACK_METHOD);
					}
				}
			};
			
			
		// Save Item [Send Request]
		// _______________________________________________________________________
		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._RECORD._POS_RESERVE.CUS_SAVE 
		(
			SAVE_MAP_ARRAY,
			RESPONSE_HANDLER
		);
		
	};

	function HTTP_SAVE_JO(CALLBACK_METHOD)
	{
		// Save item [Prepare]
		// _______________________________________________________________________

		var AHolder = 0;
		var RIndex = 0;
		while(PRODUCT_BRANCH_DGV.ROW.COUNT() > RIndex)
		{
			AHolder += (JSVC_NUM.VAR_NVAL(PRODUCT_BRANCH_DGV.CELL.VALUE("REC_POSRESERVE_LIST_PRICE_BASE", RIndex)) * JSVC_NUM.VAR_NVAL(PRODUCT_BRANCH_DGV.CELL.VALUE("REC_POSRESERVE_LIST_QTY", RIndex)))
			RIndex++;
		}

		var SAVE_MAP_ARRAY = JSCUS_SQL._RECORD._JOB_ORDER.CUS_PREPARE_MAPPED_ARRAY_FOR_SAVE();

		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_ACC_GROUP_ID", JSVC_NUM.VAR_NVALL(POS_RESERVE_DGV.CELL.VALUE('REC_POSRESERVE_ACC_GROUP_ID', PROPERTY_EDIT_ROW_INDEX)));
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_REC_CLIENT_ID", JSVC_NUM.VAR_NVALL(POS_RESERVE_DGV.CELL.VALUE('REC_CLIENT_ID', PROPERTY_EDIT_ROW_INDEX)));
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_REFERENCE_NUMBER", POS_RESERVE_DGV.CELL.VALUE('REC_POSRESERVE_CODE', PROPERTY_EDIT_ROW_INDEX));
		//JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_DESCRIPTION", POS_RESERVE_DGV.CELL.VALUE('ACC_GROUP_DESCRIPTION', PROPERTY_EDIT_ROW_INDEX) + ' will deliver water to ' + POS_RESERVE_DGV.CELL.VALUE('REC_CLIENT_MIDDLENAME', PROPERTY_EDIT_ROW_INDEX)); // User define, Pwdng palitan base kung anong business model
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_DESCRIPTION", POS_RESERVE_DGV.CELL.VALUE('ACC_GROUP_DESCRIPTION', PROPERTY_EDIT_ROW_INDEX));
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_AMOUNT", AHolder);
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_REMARKS", '');
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_REMARKS_ASSIGN", '');
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_USER_ASSIGN", JSVC_NUM.VAR_NVALL(JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_ID)); // Hub ID
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_FOR_COMPLETION", 1);
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_LONG_A", PROPERTY_REC_POSRESERVE_ID); // Reservation ID (Extra reference)
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_LONG_B", 0); // Reserve column for cashier. If paid change value to 1
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_DECIMAL_A", POS_RESERVE_DGV.CELL.VALUE('REC_POSRESERVE_LONG_A', PROPERTY_EDIT_ROW_INDEX)); // Reserve column for mode of payment
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_DECIMAL_B", 0); // Reserve for Sales ID
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_VARCHAR_A", '');
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_VARCHAR_B", '');
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_DATETIME_A", POS_RESERVE_DGV.CELL.VALUE('REC_POSRESERVE_DATE_RECORDED_RAW', PROPERTY_EDIT_ROW_INDEX));
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_DATETIME_B", '1000-01-01 01:00:00.000000');
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_STATUS", IS_JO_STATUS);
		
		// Declare Post Request Handler
		// _______________________________________________________________________
		var RESPONSE_HANDLER = 			
			function(IS_SUCCESS, HTTP_RESPONSE)
			{
				// Disable Dialogs
				// ...........................................
				CUS_SEND_DIALOG_TRY_DISMISS();
				
				// Handle Error
				// ...........................................
				if(IS_SUCCESS === false)
				{
					METHOD_UNABLE_TO_SEND_REQUEST(CALLBACK_METHOD);	
					return;
				}
				
				// Catch JSON Error
				// ...........................................
				else if(JSRC_JSON.REF_IS_JSTRING(HTTP_RESPONSE) == false)
				{
					METHOD_SERVER_ISSUE(CALLBACK_METHOD, HTTP_RESPONSE);
					return;			
				}
					
				// Read Response
				// ...........................................
				else
				{
					// Load Response
					var JSON_OBJECT = JSRC_JSON.REF_CREATE(HTTP_RESPONSE);
					if(JSRC_JSON.REF_IS_SUCCESS(JSON_OBJECT) === false)
					{
						METHOD_REQUEST_FAILURE(CALLBACK_METHOD, JSON_OBJECT);
						return;
					}
					// Post Save Action
					else
					{
						PROPERTY_PARENT_JOLINE = JSVC_NUM.VAR_NVALL(JSRC_JSON.REF_READ(JSON_OBJECT, "INSERTED_ID", "1"));
						HTTP_SAVE_JO_LINE(CALLBACK_METHOD)
					}
				}
			};
			
			
		// Save Item [Send Request]
		// _______________________________________________________________________
		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._RECORD._JOB_ORDER.CUS_SAVE 
		(
			SAVE_MAP_ARRAY,
			RESPONSE_HANDLER
		);
	}

	function HTTP_SAVE_JO_LINE(CALLBACK_METHOD)
	{
		// Save item [Prepare]
		// _______________________________________________________________________
		var SAVE_MAP_ARRAY = [];
		var BUNDLE_MAP_ARRAY = [];

		// Create Deliver Line
		var ROW_INDEX = 0;
		while(PRODUCT_BRANCH_DGV .ROW.COUNT() > ROW_INDEX)
		{
			SAVE_MAP_ARRAY = JSCUS_SQL._RECORD._JOB_ORDER_TASK.CUS_PREPARE_MAPPED_ARRAY_FOR_SAVE();

			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_LONG_A", PROPERTY_PARENT_JOLINE); // Parent ID
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_LONG_B", JSVC_NUM.VAR_NVALL(PRODUCT_BRANCH_DGV.CELL.VALUE('REC_POSRESERVE_LIST_ID', ROW_INDEX))); // Line ID (Maybe usefull in future)
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_DESCRIPTION", PRODUCT_BRANCH_DGV.CELL.VALUE('REC_POSRESERVE_LIST_CAT_PRODUCT_ID_DESCRIPTION', ROW_INDEX));
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_REMARKS", 'To be delivered');
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_QTY_TARGET", JSVC_NUM.VAR_NVAL(PRODUCT_BRANCH_DGV.CELL.VALUE('REC_POSRESERVE_LIST_QTY', ROW_INDEX)));
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_QTY_ACTUAL", JSVC_NUM.VAR_NVAL(PRODUCT_BRANCH_DGV.CELL.VALUE('REC_POSRESERVE_LIST_QTY', ROW_INDEX)));
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_AMT_TARGET", JSVC_NUM.VAR_NVAL(PRODUCT_BRANCH_DGV.CELL.VALUE('REC_POSRESERVE_LIST_PRICE_BASE', ROW_INDEX)));
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_AMT_ACTUAL", 0);
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_DECIMAL_A", 1); // 1 for delivery
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_DECIMAL_B", JSVC_NUM.VAR_NVAL(PRODUCT_BRANCH_DGV.CELL.VALUE('REC_POSRESERVE_LIST_CAT_PRODUCT_ID', ROW_INDEX))); // PRODUCT ID
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_VARCHAR_A", PRODUCT_BRANCH_DGV.CELL.VALUE('CAT_PRODUCT_CAT_UOM_ID_DESCRIPTION', ROW_INDEX)); //UOM
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_VARCHAR_B", '');
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_DATETIME_A", '1000-01-01 01:00:00.000000');
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_DATETIME_B", '1000-01-01 01:00:00.000000');
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_STATUS", 2); // 2 - default.

			BUNDLE_MAP_ARRAY = JSCUS_SQL._RECORD._JOB_ORDER_TASK.CUS_ADD_MAPPED_ARRAY_FOR_SAVE(BUNDLE_MAP_ARRAY, SAVE_MAP_ARRAY);

			ROW_INDEX++;
		}

		// Create Return Line
		ROW_INDEX = 0;
		while(PRODUCT_BRANCH_DGV.ROW.COUNT() > ROW_INDEX)
		{
			SAVE_MAP_ARRAY = JSCUS_SQL._RECORD._JOB_ORDER_TASK.CUS_PREPARE_MAPPED_ARRAY_FOR_SAVE();

			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_LONG_A", PROPERTY_PARENT_JOLINE); // Parent ID
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_LONG_B", JSVC_NUM.VAR_NVALL(PRODUCT_BRANCH_DGV.CELL.VALUE('REC_POSRESERVE_LIST_ID', ROW_INDEX))); // Line ID (Maybe usefull in future)
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_DESCRIPTION", PRODUCT_BRANCH_DGV.CELL.VALUE('REC_POSRESERVE_LIST_CAT_PRODUCT_ID_DESCRIPTION', ROW_INDEX));
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_REMARKS", 'To be delivered');
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_QTY_TARGET", JSVC_NUM.VAR_NVAL(PRODUCT_BRANCH_DGV.CELL.VALUE('REC_POSRESERVE_LIST_QTY', ROW_INDEX)));
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_QTY_ACTUAL", 0);
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_AMT_TARGET", JSVC_NUM.VAR_NVAL(PRODUCT_BRANCH_DGV.CELL.VALUE('REC_POSRESERVE_LIST_PRICE_BASE', ROW_INDEX)));
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_AMT_ACTUAL", 0);
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_DECIMAL_A", 2); // 1 for return
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_DECIMAL_B", JSVC_NUM.VAR_NVAL(PRODUCT_BRANCH_DGV.CELL.VALUE('REC_POSRESERVE_LIST_CAT_PRODUCT_ID', ROW_INDEX))); // PRODUCT ID
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_VARCHAR_A", PRODUCT_BRANCH_DGV.CELL.VALUE('CAT_PRODUCT_CAT_UOM_ID_DESCRIPTION', ROW_INDEX)); //UOM
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_VARCHAR_B", '');
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_DATETIME_A", '1000-01-01 01:00:00.000000');
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_DATETIME_B", '1000-01-01 01:00:00.000000');
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_STATUS", 2); // 2 - default.

			BUNDLE_MAP_ARRAY = JSCUS_SQL._RECORD._JOB_ORDER_TASK.CUS_ADD_MAPPED_ARRAY_FOR_SAVE(BUNDLE_MAP_ARRAY, SAVE_MAP_ARRAY);

			ROW_INDEX++;
		}

		// Declare Post Request Handler
		// _______________________________________________________________________
		var RESPONSE_HANDLER = 			
			function(IS_SUCCESS, HTTP_RESPONSE)
			{
				// Disable Dialogs
				// ...........................................
				CUS_SEND_DIALOG_TRY_DISMISS();
				
				// Handle Error
				// ...........................................
				if(IS_SUCCESS === false)
				{
					METHOD_UNABLE_TO_SEND_REQUEST(CALLBACK_METHOD);	
					return;
				}
				
				// Catch JSON Error
				// ...........................................
				else if(JSRC_JSON.REF_IS_JSTRING(HTTP_RESPONSE) == false)
				{
					METHOD_SERVER_ISSUE(CALLBACK_METHOD, HTTP_RESPONSE);
					return;			
				}
					
				// Read Response
				// ...........................................
				else
				{
					// Load Response
					var JSON_OBJECT = JSRC_JSON.REF_CREATE(HTTP_RESPONSE);
					if(JSRC_JSON.REF_IS_SUCCESS(JSON_OBJECT) === false)
					{
						METHOD_REQUEST_FAILURE(CALLBACK_METHOD, JSON_OBJECT);
						return;
					}
					// Post Save Action
					else
					{
						HTTP_SEARCH();

						// Lift edit and Exit EditMode
						EDIT_HANDLER.REF_IS_MODIFIED = false;
						EDIT_HANDLER.HAS_NEWLY_SAVED_DATA = true;			
						if
						(
							JSOC_ELEMENT.VAR_ELEMENT_EXISTS('POS_RESERVE_NEW_MODAL') == true
						)
						{
							JSOC_DIALOG.VAR_MODAL('POS_RESERVE_NEW_MODAL', false);
						}
						
						//SWAP_EDIT_MODE(false);
						CALLBACK_METHOD(true);		
					}
				}
			};


		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._RECORD._JOB_ORDER_TASK.CUS_SAVE
		(
			BUNDLE_MAP_ARRAY,
			RESPONSE_HANDLER
		);	
	}

	function HTTP_GROSS_CALL(CALLBACK_METHOD)
	{
		if
		(
			JSVC_VAR.VAR_ISSET(REC_POSRESERVE_REC_CLIENT_ID_CMB) &&
			(
				JSOC_CMB.VAR_SELECTED_INDEX(REC_POSRESERVE_REC_CLIENT_ID_CMB) < 0 ||
				JSVC_NUM.VAR_NVALL(JSOC_CMB.VAR_SELECTED_VALUE(REC_POSRESERVE_REC_CLIENT_ID_CMB)) < 0
			)
		)
		{
			JSOC_DIALOG.VAR_MESSAGE_BOX
			(
				'Field Client is required.', 
				'Information',
				'OK', 'WARNING',
				function(MESSAGE_RESPONSE)
				{
					REC_POSRESERVE_REC_CLIENT_ID_CMB.style.borderColor = JSCUS_CACHE.SITE_ON_ERROR_BORDER_COLOR;
					REC_POSRESERVE_REC_CLIENT_ID_CMB.focus();
					CALLBACK_METHOD(false);
				}
			);	
			return;			
		}


		// Save item [Prepare]
		// _______________________________________________________________________

		var SAVE_MAP_ARRAY = JSCUS_SQL._RECORD._GROSS_CALL.CUS_PREPARE_MAPPED_ARRAY_FOR_SAVE();

		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_GROSSCALL_ACC_GROUP_ID", JSVC_NUM.VAR_NVALL(JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_ACC_GROUP_ID));
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_GROSSCALL_REC_CLIENT_ID", JSVC_NUM.VAR_NVALL(JSOC_CMB.VAR_SELECTED_VALUE(REC_POSRESERVE_REC_CLIENT_ID_CMB)));
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_GROSSCALL_DATE", JSVC_DATE.VAR_FORMAT(JSVC_DATE.VAR_NOW(), "YYYY-MM-DD HH:mm:ss"));
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_GROSSCALL_REMARKS", '');
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_GROSSCALL_STATUS", GROSS_STATUS_ID);
		
		// Declare Post Request Handler
		// _______________________________________________________________________
		var RESPONSE_HANDLER = 			
			function(IS_SUCCESS, HTTP_RESPONSE)
			{
				// Disable Dialogs
				// ...........................................
				CUS_SEND_DIALOG_TRY_DISMISS();
				
				// Handle Error
				// ...........................................
				if(IS_SUCCESS === false)
				{
					METHOD_UNABLE_TO_SEND_REQUEST(CALLBACK_METHOD);	
					return;
				}
				
				// Catch JSON Error
				// ...........................................
				else if(JSRC_JSON.REF_IS_JSTRING(HTTP_RESPONSE) == false)
				{
					METHOD_SERVER_ISSUE(CALLBACK_METHOD, HTTP_RESPONSE);
					return;			
				}
					
				// Read Response
				// ...........................................
				else
				{
					// Load Response
					var JSON_OBJECT = JSRC_JSON.REF_CREATE(HTTP_RESPONSE);
					if(JSRC_JSON.REF_IS_SUCCESS(JSON_OBJECT) === false)
					{
						METHOD_REQUEST_FAILURE(CALLBACK_METHOD, JSON_OBJECT);
						return;
					}
					// Post Save Action
					else
					{
						// Lift edit and Exit EditMode
						EDIT_HANDLER.REF_IS_MODIFIED = false;
						EDIT_HANDLER.HAS_NEWLY_SAVED_DATA = true;			
						if
						(
							JSOC_ELEMENT.VAR_ELEMENT_EXISTS('POS_RESERVE_NEW_MODAL') == true
						)
						{
							JSOC_DIALOG.VAR_MODAL('POS_RESERVE_NEW_MODAL', false);
						}
						
						//SWAP_EDIT_MODE(false);
						CALLBACK_METHOD(true);		
					}
				}
			};
			
			
		// Save Item [Send Request]
		// _______________________________________________________________________
		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._RECORD._GROSS_CALL.CUS_SAVE 
		(
			SAVE_MAP_ARRAY,
			RESPONSE_HANDLER
		);
	}