	// ===============================================================
	// 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_JORDER_ID, 1, 1))
		{
			return;
		}
		
		// Load DB data of item
		// ...........................................
		JSOC_DIALOG.VAR_LOADING_SPINNER(true);


		// Actual Function
		var GET_MAP_ARRAY = JSCUS_SQL._RECORD._JOB_ORDER_TASK.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_TASK_LONG_A_FROM', JSVC_NUM.VAR_NVALL(PROPERTY_REC_JORDER_ID));
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_TASK_LONG_A_TO', JSVC_NUM.VAR_NVALL(PROPERTY_REC_JORDER_ID));


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


				// 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
					{

						var JSON_COUNT = JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT");
						var COUNTER = 1;
						var TOTAL_SALES = 0;

						while(COUNTER <= JSON_COUNT)
						{
							if(JSVC_NUM.VAR_NVALL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_JORDER_TASK_DECIMAL_A", COUNTER)) == 1)
							{
								var RINDEX = JOB_ORDER_TASK_DELIVER_DGV.ROW.COUNT();
								JOB_ORDER_TASK_DELIVER_DGV.ROW.INSERT_AT(RINDEX);
								JOB_ORDER_TASK_DELIVER_DGV.CELL.VALUE("ROW_COUNT", RINDEX, RINDEX + 1);
								JOB_ORDER_TASK_DELIVER_DGV.CELL.VALUE("REC_JORDER_TASK_ID", RINDEX, JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_JORDER_TASK_ID", COUNTER)));
								JOB_ORDER_TASK_DELIVER_DGV.CELL.VALUE("REC_JORDER_TASK_DESCRIPTION", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_JORDER_TASK_DESCRIPTION", COUNTER));
								JOB_ORDER_TASK_DELIVER_DGV.CELL.VALUE("REC_JORDER_TASK_QTY_TARGET", RINDEX, JSVC_NUM.VAR_CFORMAT(JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_JORDER_TASK_QTY_TARGET", COUNTER))));
								JOB_ORDER_TASK_DELIVER_DGV.CELL.VALUE("REC_JORDER_TASK_QTY_ACTUAL", RINDEX, JSVC_NUM.VAR_CFORMAT(JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_JORDER_TASK_QTY_ACTUAL", COUNTER))));
							}
							else
							{
								var RINDEX = JOB_ORDER_TASK_RETURN_DGV.ROW.COUNT();
								JOB_ORDER_TASK_RETURN_DGV.ROW.INSERT_AT(RINDEX);
								JOB_ORDER_TASK_RETURN_DGV.CELL.VALUE("ROW_COUNT", RINDEX, RINDEX + 1);
								JOB_ORDER_TASK_RETURN_DGV.CELL.VALUE("REC_JORDER_TASK_ID", RINDEX, JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_JORDER_TASK_ID", COUNTER)));
								JOB_ORDER_TASK_RETURN_DGV.CELL.VALUE("REC_JORDER_TASK_DESCRIPTION", RINDEX, JSRC_JSON.REF_READ(JSON_OBJECT, "REC_JORDER_TASK_DESCRIPTION", COUNTER));
								JOB_ORDER_TASK_RETURN_DGV.CELL.VALUE("REC_JORDER_TASK_QTY_TARGET", RINDEX, JSVC_NUM.VAR_CFORMAT(JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_JORDER_TASK_QTY_TARGET", COUNTER))));
								JOB_ORDER_TASK_RETURN_DGV.CELL.VALUE("REC_JORDER_TASK_QTY_ACTUAL", RINDEX, JSVC_NUM.VAR_CFORMAT(JSVC_NUM.VAR_NVAL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_JORDER_TASK_QTY_ACTUAL", COUNTER))));							}
							
							COUNTER++;
						}
					}
				}
			};

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


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

		// Create Deliver Line
		var ROW_INDEX = 0;
		while(JOB_ORDER_TASK_DELIVER_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_ID",JSVC_NUM.VAR_NVAL(JOB_ORDER_TASK_DELIVER_DGV.CELL.VALUE('REC_JORDER_TASK_ID', ROW_INDEX)));
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_QTY_ACTUAL", JSVC_NUM.VAR_NVAL(JOB_ORDER_TASK_DELIVER_DGV.CELL.VALUE('REC_JORDER_TASK_QTY_ACTUAL', ROW_INDEX)));

			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(JOB_ORDER_TASK_RETURN_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_ID", JSVC_NUM.VAR_NVAL(JOB_ORDER_TASK_RETURN_DGV.CELL.VALUE('REC_JORDER_TASK_ID', ROW_INDEX)));
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_TASK_QTY_ACTUAL", JSVC_NUM.VAR_NVAL(JOB_ORDER_TASK_RETURN_DGV.CELL.VALUE('REC_JORDER_TASK_QTY_ACTUAL', ROW_INDEX)));

			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
					{
						// Lift edit and Exit EditMode
						if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS('JOB_ORDER_MODAL') == true)
							JSOC_DIALOG.VAR_MODAL('JOB_ORDER_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_COMPLETE(CALLBACK_METHOD)
	{
		// Save item [Prepare]
		// _______________________________________________________________________
		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_ID", PROPERTY_REC_JORDER_ID);
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_FOR_COMPLETION", 2);
		
		// 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_SAVE(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_CANCEL(CALLBACK_METHOD)
	{
		var GET_MAP_ARRAY = JSCUS_SQL._RECORD._POS_RESERVE.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_POSRESERVE_CODE', JSVC_NUM.VAR_NVALL(JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_REFERENCE_NUMBER', PROPERTY_EDIT_ROW_INDEX)));

		var RESPONSE_HANDLER =
			function HTTP_SEARCH_CALLBACK(IS_SUCCESS, RESPONSE_STRING)
			{
				// Disable Dialogs
				// _______________________________________________________________________
				CUS_SEND_DIALOG_TRY_DISMISS();

				// Validate
				// _______________________________________________________________________
				if(IS_SUCCESS === false)
				{
					alert("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)
				{
					alert("REQUEST ERROR: \n" + RESPONSE_STRING);
					return;
				}
				
				if(JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT") > 0)
				{
					if(JSVC_NUM.VAR_NVALL(JSRC_JSON.REF_READ(JSON_OBJECT, "REC_POSRESERVE_STATUS", 1)) == 4)
					{
						JSOC_DIALOG.VAR_MESSAGE_BOX
						(
							'Cannot cancel order due to it is already paid.', 
							'Information',
							'OK', 'WARNING',
							function(){ }
						);	
						return;
					}
				}

				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_ID", PROPERTY_REC_JORDER_ID);
				JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_USER_ASSIGN", 1);
				JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "REC_POSRESERVE_STATUS", 3);
				
				var RESPONSE_HANDLER2 = 			
					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
								if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS('JOB_ORDER_MODAL') == true)
									JSOC_DIALOG.VAR_MODAL('JOB_ORDER_MODAL', false);
								
								//SWAP_EDIT_MODE(false);
								CALLBACK_METHOD(true);	
							}
						}
					};

				JSOC_DIALOG.VAR_LOADING_SPINNER(true);
				JSCUS_SQL._RECORD._JOB_ORDER.CUS_SAVE
				(
					SAVE_MAP_ARRAY,
					RESPONSE_HANDLER2
				);
			}

		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._RECORD._POS_RESERVE.CUS_GET
		(
			GET_MAP_ARRAY,
			RESPONSE_HANDLER,
			true
		);
	}

	function RIDER_ASSIGN(CALLBACK_METHOD)
	{

		if
		(
			JSVC_VAR.VAR_ISSET(REC_RIDER_ID_CMB) &&
			(
				JSOC_CMB.VAR_SELECTED_INDEX(REC_RIDER_ID_CMB) < 0 ||
				JSVC_NUM.VAR_NVALL(JSOC_CMB.VAR_SELECTED_VALUE(REC_RIDER_ID_CMB)) < 0
			)
		)
		{
			JSOC_DIALOG.VAR_MESSAGE_BOX
			(
				'Rider is required.', 
				'Information',
				'OK', 'WARNING',
				function(MESSAGE_RESPONSE)
				{
					CALLBACK_METHOD(false);
				}
			);	
			return;			
		}

		// Save item [Prepare]
		// _______________________________________________________________________
		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_ID", PROPERTY_REC_JORDER_ID);
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_JORDER_USER_ASSIGN", JSVC_NUM.VAR_NVALL(JSOC_CMB.VAR_SELECTED_VALUE(REC_RIDER_ID_CMB)));
		
		// 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
						if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS('JOB_ORDER_MODAL') == true)
							JSOC_DIALOG.VAR_MODAL('JOB_ORDER_MODAL', false);
						
						//SWAP_EDIT_MODE(false);
						CALLBACK_METHOD(true);	
					}
				}
			};
			
		// Save Item [Send Request]
		// _______________________________________________________________________
		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._RECORD._JOB_ORDER.CUS_SAVE 
		(
			SAVE_MAP_ARRAY,
			RESPONSE_HANDLER
		);
	}