


	function FORM_LOAD()
	{
		// Initialize
		// _______________________________________________________________________	
		var DGV_ELEMENT_CHILD = null;
		var DGV_ELEMENT_CHILD_INDEX = 0;
		
		// Load DataGridVuew
		// _______________________________________________________________________	
		JOB_ORDER_DGV = DataGridView("JOB_ORDER_DGV");
		JOB_ORDER_TASK_DELIVER_DGV = DataGridView("JOB_ORDER_TASK_DELIVER_DGV");
		JOB_ORDER_TASK_RETURN_DGV = DataGridView("JOB_ORDER_TASK_RETURN_DGV");

		//JOB_ORDER_DGV.SETTING_ALLOW_USER_TO_ADD_ROWS = true;
		//JOB_ORDER_DGV.SETTING_EDITABLE = true;
		JOB_ORDER_DGV.ON_CLICK
		(			
			function(COL_INDEX, ROW_INDEX)
			{
				// If dialog supported
				// ...........................................
				if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("JOB_ORDER_MODAL") == true)
				{
					// Clear Modal
					
					// Display Modal
					PROPERTY_PARENT_ID = JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_LONG_A', ROW_INDEX);
					PROPERTY_REC_JORDER_ID = JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_ID', ROW_INDEX);
					PROPERTY_REC_JORDER_CODE = JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_REFERENCE_NUMBER', ROW_INDEX);
					PROPERTY_EDIT_ROW_INDEX = ROW_INDEX;
					
					if
					(
						JSVC_NUM.VAR_NVALL(JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_STATUS', ROW_INDEX)) == 4 &&
						JSVC_NUM.VAR_NVALL(JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_LONG_B', ROW_INDEX)) == 0
					)
					{	
						$("#APPROVE_BBI").show();
						$("#REJECT_BBI").show();
						$("#DELIVERED_BBI").hide();
					}
					else if
					(
						JSVC_NUM.VAR_NVALL(JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_STATUS', ROW_INDEX)) == 2
					)
					{	
						$("#APPROVE_BBI").hide();
						$("#REJECT_BBI").show();
						$("#DELIVERED_BBI").show();
					}
					else
					{
						$("#APPROVE_BBI").hide();
						$("#REJECT_BBI").hide();
						$("#DELIVERED_BBI").hide();
					}

					JSOC_DIALOG.VAR_MODAL("JOB_ORDER_MODAL", true);
					JSOC_ELEMENT.VAR_VALUE("REC_JORDER_CODE_LBL", PROPERTY_REC_JORDER_CODE);
					JSOC_ELEMENT.VAR_VALUE("REC_JORDER_REC_CLIENT_LBL", ': ' + JOB_ORDER_DGV.CELL.VALUE('REC_CLIENT_LASTNAME', ROW_INDEX));
					JSOC_ELEMENT.VAR_VALUE("REC_JORDER_REC_CONTACT_LBL", ': ' + JOB_ORDER_DGV.CELL.VALUE('REC_CLIENT_CONTACT', ROW_INDEX));
					JSOC_ELEMENT.VAR_VALUE("REC_JORDER_REC_ADDRESS_LBL", ': ' + JOB_ORDER_DGV.CELL.VALUE('REC_CLIENT_ADDRESS', ROW_INDEX));

					JSOC_ELEMENT.VAR_VALUE("TOTAL_AMOUNT", JSVC_NUM.VAR_CFORMAT(JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_AMOUNT', ROW_INDEX)));
					
					HTTP_LOAD();
					return;
				}
			}	
		);

		JOB_ORDER_TASK_DELIVER_DGV.ON_CHANGE
		(			
			function(COL_INDEX, ROW_INDEX)
			{
				if(JOB_ORDER_TASK_DELIVER_DGV.COLUMN.NAME(COL_INDEX) == "REC_JORDER_TASK_QTY_ACTUAL" || JOB_ORDER_TASK_DELIVER_DGV.COLUMN.NAME(COL_INDEX) == "REC_JORDER_TASK_AMT_TARGET")
				{
					JOB_ORDER_TASK_DELIVER_DGV.CELL.VALUE
					(
						"TOTAL",
						ROW_INDEX,
						JSVC_NUM.VAR_CFORMAT
						(
							JSVC_NUM.VAR_NVAL(JOB_ORDER_TASK_DELIVER_DGV.CELL.VALUE('REC_JORDER_TASK_QTY_ACTUAL', ROW_INDEX)) *
							JSVC_NUM.VAR_NVAL(JOB_ORDER_TASK_DELIVER_DGV.CELL.VALUE('REC_JORDER_TASK_AMT_TARGET', ROW_INDEX))
						)
					)
				}
			}	
		);

		// Requires Authentication
		// _______________________________________________________________________
		PAGE_AUTH_REQUIRES_LOGIN(HTTP_POPULATE_RESULT);

		// Foreign Key [Fixed]
		// _______________________________________________________________________	
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("REC_JORDER_USER_ASSIGN_CMB") == true)
		{
			// Set Default Item, if used in DataGridView
			JSOC_CMB.VAR_ADD("REC_JORDER_USER_ASSIGN_CMB", FLAG_BIGINT_NULL.toString(), "-");
			// To use custom populate
			// var GET_MAP_ARRAY = JSCUS_SQL._ACCOUNT._MEMBER.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();
			// JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_', JSCUS_SQL._SYSTEM._STATUS.STATUS_ACTIVE);	
			JSCUS_SQL._ACCOUNT._MEMBER.CUS_GET_THEN_POPULATE_COMBOBOX
			(
				function(IS_SUCCESS, RESPONSE_STRING)
				{
					// Set Default index
					JSOC_CMB.VAR_SELECTED_INDEX("REC_JORDER_USER_ASSIGN_CMB", 0);
					
					// Clone to DGV Cell if ComboBox Exists
					if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("JOB_ORDER_DGV_ROW_REC_JORDER_USER_ASSIGN") == true)
					{
						DGV_ELEMENT_CHILD = JSOC_ELEMENT.VAR_SUB_ELEMENTS("JOB_ORDER_DGV_ROW_REC_JORDER_USER_ASSIGN");
						DGV_ELEMENT_CHILD_INDEX = 0;
						while(DGV_ELEMENT_CHILD.length > DGV_ELEMENT_CHILD_INDEX)
						{
							if
							(
								DGV_ELEMENT_CHILD[DGV_ELEMENT_CHILD_INDEX].tagName == "SELECT" &&
								JSVC_STR.VAR_IS_BLANK(DGV_ELEMENT_CHILD[DGV_ELEMENT_CHILD_INDEX].id.toString())
							)
							{
								JSOC_ELEMENT.VAR_INNER_HTML
								(
									DGV_ELEMENT_CHILD[DGV_ELEMENT_CHILD_INDEX], 
									JSOC_ELEMENT.VAR_INNER_HTML("REC_JORDER_USER_ASSIGN_CMB")
								);
							}	
							DGV_ELEMENT_CHILD_INDEX ++;
						}
					}
					
					// Copy items to edit control
					if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_JORDER_USER_ASSIGN_CMB") == true)
					{
						JSOC_CMB.VAR_CLEAR("SEARCH_REC_JORDER_USER_ASSIGN_CMB");
						JSOC_CMB.VAR_ADD("SEARCH_REC_JORDER_USER_ASSIGN_CMB", FLAG_BIGINT_NULL.toString(),"Any Member");
						JSOC_ELEMENT.VAR_INNER_HTML("SEARCH_REC_JORDER_USER_ASSIGN_CMB", JSOC_ELEMENT.VAR_INNER_HTML("REC_JORDER_USER_ASSIGN_CMB"), true);
						JSOC_CMB.VAR_SELECTED_INDEX("SEARCH_REC_JORDER_USER_ASSIGN_CMB", 0);
						$('#SEARCH_REC_JORDER_USER_ASSIGN_CMB').html($('#SEARCH_REC_JORDER_USER_ASSIGN_CMB option').sort(function (a, b) {
						    return a.text == b.text ? 0 : a.text < b.text ? -1 : 1
						}));
						$('.BSSP_SEARCH_REC_JORDER_USER_ASSIGN_CMB').selectpicker('refresh');
					}				
					
					// Update Modal Settings
					if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("JOB_ORDER_MODAL") == true)
					{
						INPUT_INSTANCE = JSOC_WINDOW.VAR_INPUT_INSTANCE_CLONE("JOB_ORDER_MODAL");
					}
					
					// Forward populate complete event.
					$('.BSSP_REC_JORDER_USER_ASSIGN_CMB').selectpicker('refresh');
					HTTP_POPULATE_RESULT();		
				},
				"REC_JORDER_USER_ASSIGN_CMB",
				true, 2
				// , GET_MAP_ARRAY 
			);
		}
		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_JORDER_USER_ASSIGN_CMB") == true &&
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("REC_JORDER_USER_ASSIGN_CMB") == false
		)
		{
			JSOC_CMB.VAR_CLEAR("SEARCH_REC_JORDER_USER_ASSIGN_CMB");
			JSOC_CMB.VAR_ADD("SEARCH_REC_JORDER_USER_ASSIGN_CMB", FLAG_BIGINT_NULL.toString(),"Any Member");
			// To use custom populate
			// var GET_MAP_ARRAY = JSCUS_SQL._ACCOUNT._MEMBER.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();
			// JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_', JSCUS_SQL._SYSTEM._STATUS.STATUS_ACTIVE);	
			JSCUS_SQL._ACCOUNT._MEMBER.CUS_GET_THEN_POPULATE_COMBOBOX
			(
				function(IS_SUCCESS, RESPONSE_STRING)
				{
					// Set Default index
					JSOC_CMB.VAR_SELECTED_INDEX("SEARCH_REC_JORDER_USER_ASSIGN_CMB", 0);
					
					// Forward populate complete event.
					$('#SEARCH_REC_JORDER_USER_ASSIGN_CMB').html($('#SEARCH_REC_JORDER_USER_ASSIGN_CMB option').sort(function (a, b) {
						    return a.text == b.text ? 0 : a.text < b.text ? -1 : 1
						}));
					$('.BSSP_SEARCH_REC_JORDER_USER_ASSIGN_CMB').selectpicker('refresh');
					HTTP_POPULATE_RESULT();
				},		
				"SEARCH_REC_JORDER_USER_ASSIGN_CMB",
				true, 2
				// , GET_MAP_ARRAY 
			);
		}
				
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_JORDER_STATUS_CMB") == true)
		{
			JSOC_CMB.VAR_CLEAR("SEARCH_REC_JORDER_STATUS_CMB");
			JSOC_CMB.VAR_ADD("SEARCH_REC_JORDER_STATUS_CMB", "0","Any Status");
			JSOC_CMB.VAR_ADD("SEARCH_REC_JORDER_STATUS_CMB", "2","Approve");
			// JSOC_CMB.VAR_ADD("SEARCH_REC_JORDER_STATUS_CMB", "888","Assigned to rider");
			// JSOC_CMB.VAR_ADD("SEARCH_REC_JORDER_STATUS_CMB", "999","For Completion");
			JSOC_CMB.VAR_ADD("SEARCH_REC_JORDER_STATUS_CMB", "3","Cancelled");
			JSOC_CMB.VAR_ADD("SEARCH_REC_JORDER_STATUS_CMB", "4","Delivered");
			JSOC_CMB.VAR_ADD("SEARCH_REC_JORDER_STATUS_CMB", "777","Collected");

			if(JSVC_STR.VAR_IS_BLANK(JSCUS_QUICK_SAVE.CACHE_RETURN_URL) == false &&	JSVC_STR.VAR_IS_BLANK(JSCUS_QUICK_SAVE.CACHE_SEND_PARAMETER) == false)
				JSOC_CMB.VAR_SELECTED_VALUE("SEARCH_REC_JORDER_STATUS_CMB", "2");
			else
				JSOC_CMB.VAR_SELECTED_VALUE("SEARCH_REC_JORDER_STATUS_CMB", "4");

		}

		// Pre-Load Items (uncomment if no foreign key pre-fetch)
		// _______________________________________________________________________
		if(CUS_SEND_REQUEST_HAS_QUEUE() == false)
		{
			//HTTP_SEARCH();
		}

		// Disable Dialogs
		// _______________________________________________________________________	
		CUS_SEND_DIALOG_TRY_DISMISS();
	}

	// ===============================================================
	// Populate Foreign Keys
	// ===============================================================
	function HTTP_POPULATE_RESULT(IS_SUCCESS, HTTP_RESPONSE)
	{
		// Disable Dialogs
		CUS_SEND_DIALOG_TRY_DISMISS();

		// Handle Error
		if(IS_SUCCESS === false)
		{
			alert("Unable to populate lists.");
		}
		else
		{
			// Disable Dialogs
			if(CUS_SEND_REQUEST_HAS_QUEUE() == false)
			{
				
				//HTTP_SEARCH();
				//LOAD_DATA_FRWRD();
			}
		}
	};

	function LOAD_DATA_FRWRD()
	{
		// Disable Dialogs
		if(CUS_SEND_REQUEST_HAS_QUEUE() == false)
		{
			if(JSVC_STR.VAR_IS_BLANK(JSCUS_QUICK_SAVE.CACHE_SEND_PARAMETER) == false)
				PAR_DATA = JSCUS_QUICK_SAVE.CACHE_SEND_PARAMETER.split('|'); //ItemID|BrnchId|StatId|UserId|SearchId|DFrom|DTo

			if(JSVC_STR.VAR_IS_BLANK(JSCUS_QUICK_SAVE.CACHE_RETURN_URL) == false &&
				JSVC_STR.VAR_IS_BLANK(JSCUS_QUICK_SAVE.CACHE_SEND_PARAMETER) == false)
			{
				var ROW_INDEX = 0;
				while(JOB_ORDER_DGV.ROW.COUNT() > ROW_INDEX)
				{
					if
					(
						JSVC_NUM.VAR_NVALL(JOB_ORDER_DGV.CELL.VALUE("REC_JORDER_ID", ROW_INDEX)) ==
						JSVC_NUM.VAR_NVALL(PAR_DATA[0])
					)
					{
						JOB_ORDER_DGV.CELL.ELEMENT(1, ROW_INDEX).onclick();
						break;
					}

					ROW_INDEX++;
				}
			}
		}
		else
		{
			JSRC_THREAD.REF_POST_DELAYED
			(
				function()
				{
					LOAD_DATA_FRWRD();
				},
				500
			);
			return;
		}
	};

	function HTTP_SEARCH()
	{
		SEARCH_REC_JORDER_USER_ASSIGN_CMB.style.borderColor = '';
		
		if
		(
			JSVC_VAR.VAR_ISSET(SEARCH_REC_JORDER_USER_ASSIGN_CMB) &&
			(
				JSOC_CMB.VAR_SELECTED_INDEX(SEARCH_REC_JORDER_USER_ASSIGN_CMB) < 0 ||
				JSVC_NUM.VAR_NVALL(JSOC_CMB.VAR_SELECTED_VALUE(SEARCH_REC_JORDER_USER_ASSIGN_CMB)) < 0
			)
		)
		{
			JSOC_DIALOG.VAR_MESSAGE_BOX
			(
				'No selected user.', 
				'Information',
				'OK', 'WARNING',
				function(MESSAGE_RESPONSE)
				{
					SEARCH_REC_JORDER_USER_ASSIGN_CMB.style.borderColor = JSCUS_CACHE.SITE_ON_ERROR_BORDER_COLOR;
					SEARCH_REC_JORDER_USER_ASSIGN_CMB.focus();
				}
			);	
			return;			
		}

		CMB_STATUS_IDENTIFIER = 0;
		var GET_MAP_ARRAY = JSCUS_SQL._RECORD._JOB_ORDER.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();

		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_JORDER_DATE_COMPLETE_FROM_DTP") == true)
		{
			JSVC_MAP_ARRAY.VAR_SET
			(
				GET_MAP_ARRAY, 'PARAM_REC_JORDER_DATE_COMPLETE_FROM', 
				JSVC_DATE.VAR_FORMAT(JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_JORDER_DATE_COMPLETE_FROM_DTP"), "YYYY-MM-DD") + " 00:00:00.000000"
			);
		}
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_JORDER_DATE_COMPLETE_TO_DTP") == true)
		{
			JSVC_MAP_ARRAY.VAR_SET
			(
				GET_MAP_ARRAY, 'PARAM_REC_JORDER_DATE_COMPLETE_TO', 
				JSVC_DATE.VAR_FORMAT(JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_JORDER_DATE_COMPLETE_TO_DTP"), "YYYY-MM-DD") + " 23:59:59.999999"
			);
		}

		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_JORDER_REFERENCE_NUMBER_TXT") == true &&
			JSVC_STR.VAR_IS_BLANK( JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_JORDER_REFERENCE_NUMBER_TXT")) == false
		)
		{
			JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_REFERENCE_NUMBER', JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_JORDER_REFERENCE_NUMBER_TXT"));
		}

		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_JORDER_USER_ASSIGN_CMB") == true)
		{
			JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_USER_ASSIGN', JSVC_NUM.VAR_NVAL(JSOC_CMB.VAR_SELECTED_VALUE("SEARCH_REC_JORDER_USER_ASSIGN_CMB")));
		}
		
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_JORDER_STATUS_CMB") == true)
		{
			// if(JSVC_NUM.VAR_NVALL(JSOC_CMB.VAR_SELECTED_VALUE(SEARCH_REC_JORDER_STATUS_CMB)) == 999)
			// {
			// 	JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_FOR_COMPLETION', 2);
			// 	JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_STATUS', 2);
			// }
			// else if (JSVC_NUM.VAR_NVALL(JSOC_CMB.VAR_SELECTED_VALUE(SEARCH_REC_JORDER_STATUS_CMB)) == 888)
			// {
			// 	CMB_STATUS_IDENTIFIER = 1; // ALL TAKEN DATA
			// 	JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_FOR_COMPLETION', 1);
			// 	JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_STATUS', 2);
			// }
			// else
			// if (JSVC_NUM.VAR_NVALL(JSOC_CMB.VAR_SELECTED_VALUE(SEARCH_REC_JORDER_STATUS_CMB)) == 777)
			// {
			// 	CMB_STATUS_IDENTIFIER = 1; // ALL COLLECTED DATA
			// 	JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_LONG_B_FROM', 1);
			// 	JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_LONG_B_TO', 1);
			// }
			// // else if (JSVC_NUM.VAR_NVALL(JSOC_CMB.VAR_SELECTED_VALUE(SEARCH_REC_JORDER_STATUS_CMB)) == 2)
			// // {
			// // 	//CMB_STATUS_IDENTIFIER = 2; // ALL OPEN AND NOT TAKEN
			// // 	//JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_FOR_COMPLETION', 1);
			// // 	JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_STATUS', JSVC_NUM.VAR_NVALL(JSOC_CMB.VAR_SELECTED_VALUE(SEARCH_REC_JORDER_STATUS_CMB)));
			// // }
			// else
			// {
				//JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_LONG_B_FROM', 0);
				//JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_LONG_B_TO', 0);
				JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_STATUS', JSVC_NUM.VAR_NVALL(JSOC_CMB.VAR_SELECTED_VALUE(SEARCH_REC_JORDER_STATUS_CMB)));

				JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_ORDER_FIELD', 'REC_JORDER_DATE_COMPLETE');
				JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_ORDER_TYPE', 'ASC');
			//}
		}

		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._RECORD._JOB_ORDER.CUS_GET
		(
			GET_MAP_ARRAY,
			HTTP_SEARCH_CALLBACK,
			true
		);
	}

	function HTTP_SEARCH_CALLBACK(IS_SUCCESS, RESPONSE_STRING)
	{
		// Disable Dialogs
		// _______________________________________________________________________
		CUS_SEND_DIALOG_TRY_DISMISS();
		JSOC_ELEMENT.VAR_VALUE('REC_JORDER_TOTAL_NET_LBL', "0.00");

		//RESET DGV
		// _______________________________________________________________________
		JOB_ORDER_DGV.ROW.CLEAR();
		
		// 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;
		}
		
		// JSON Empty (Clears the DataGrodView)
		// _______________________________________________________________________
		if(JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT") <= 0)
		{
			JOB_ORDER_DGV.ROW.CLEAR();
			return;
		}

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

		// For Applying CFormat
		// _______________________________________________________________________	
		JOB_ORDER_DGV.COLUMN.CFORMAT("REC_JORDER_AMOUNT");
		JSOC_ELEMENT.VAR_VALUE('REC_JORDER_TOTAL_NET_LBL', JSVC_NUM.VAR_CFORMAT(JOB_ORDER_DGV.COLUMN.SUM("REC_JORDER_AMOUNT")));	
		
		var ROW_INDEX = 0;
		//HIDE NOT NEEDED;
		if(CMB_STATUS_IDENTIFIER != 0)
		{
			while(JOB_ORDER_DGV.ROW.COUNT() > ROW_INDEX)
			{
				if
				(
					CMB_STATUS_IDENTIFIER == 1 &&
					JSVC_NUM.VAR_NVALL(JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_USER_ASSIGN', ROW_INDEX)) == 1
					// HIDE ALL NOT TAKEN ORDER
				)
				{
					JOB_ORDER_DGV.ROW.DISPLAY(ROW_INDEX, "none");
				}
				else if
				(
					CMB_STATUS_IDENTIFIER == 2 &&
					JSVC_NUM.VAR_NVALL(JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_USER_ASSIGN', ROW_INDEX)) > 1
					// HIDE ALL TAKER ORDER
				)
				{
					JOB_ORDER_DGV.ROW.DISPLAY(ROW_INDEX, "none");
				}

				ROW_INDEX ++;
			}
		}

		WEBTABLE_DATE = null;
		ROW_INDEX = 0;
		while(JOB_ORDER_DGV.ROW.COUNT() > ROW_INDEX)
		{
			// Read Current Value
			// ...........................................
			 WEBTABLE_DATE = JSVC_DATE.VAR_TO_DATE
				 (
						JOB_ORDER_DGV.CELL.VALUE
						(
								"REC_JORDER_DATE_COMPLETE", 
								ROW_INDEX
						)
				 );
			
			// Apply CFormat, and DateFormat
			// ...........................................
			if(JSVC_VAR.VAR_ISSET(WEBTABLE_DATE))
			{
				JOB_ORDER_DGV.CELL.VALUE
				(
						"REC_JORDER_DATE_COMPLETE", ROW_INDEX, 
						JSVC_DATE.VAR_FORMAT(WEBTABLE_DATE, "MMM DD, YYYY hh:mm TT")
				);		
			}

			if(ROW_INDEX == 0)
				JOB_ORDER_DGV.CELL.VALUE("REC_JORDER_DATE_COMPLETE_DIFFERENCE", ROW_INDEX, "-");
			else
			{
				var FDelivered = new Date(JOB_ORDER_DGV.CELL.VALUE("REC_JORDER_DATE_COMPLETE", ROW_INDEX-1));
				var SDelivered = new Date(JOB_ORDER_DGV.CELL.VALUE("REC_JORDER_DATE_COMPLETE", ROW_INDEX));
				var Diff = ((JSVC_DATE.VAR_TO_DATE(SDelivered) - JSVC_DATE.VAR_TO_DATE(FDelivered)) / 1000 / 60 / 60) * 60;

				JOB_ORDER_DGV.CELL.VALUE("REC_JORDER_DATE_COMPLETE_DIFFERENCE", ROW_INDEX, Diff + ' mins');
			}

				
			
			
			JOB_ORDER_DGV.CELL.VALUE
			(
				'REC_CLIENT_NAME',
				ROW_INDEX,
				JOB_ORDER_DGV.CELL.VALUE('REC_CLIENT_FIRSTNAME', ROW_INDEX) +
				' ' +
				JOB_ORDER_DGV.CELL.VALUE('REC_CLIENT_LASTNAME', ROW_INDEX)
			);
			
			if
			(
				JSVC_NUM.VAR_NVALL(JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_STATUS', ROW_INDEX)) == 2 &&
				JSVC_NUM.VAR_NVALL(JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_FOR_COMPLETION', ROW_INDEX)) == 2
			)
				JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_STATUS_TEXT', ROW_INDEX, 'Approve');
			else if
			(
				JSVC_NUM.VAR_NVALL(JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_STATUS', ROW_INDEX)) == 2 &&
				JSVC_NUM.VAR_NVALL(JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_FOR_COMPLETION', ROW_INDEX)) == 1 &&
				JSVC_NUM.VAR_NVALL(JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_USER_ASSIGN', ROW_INDEX)) > 1
			)
				JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_STATUS_TEXT', ROW_INDEX, 'Approve');
			else if (JSVC_NUM.VAR_NVALL(JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_LONG_B', ROW_INDEX)) == 1)
				JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_STATUS_TEXT', ROW_INDEX, 'Collected');
			else if(JSVC_NUM.VAR_NVALL(JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_STATUS', ROW_INDEX)) == 2)
				JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_STATUS_TEXT', ROW_INDEX, 'Approve');
			else if(JSVC_NUM.VAR_NVALL(JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_STATUS', ROW_INDEX)) == 3)
				JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_STATUS_TEXT', ROW_INDEX, 'Cancelled');
			else if(JSVC_NUM.VAR_NVALL(JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_STATUS', ROW_INDEX)) == 4)
				JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_STATUS_TEXT', ROW_INDEX, 'Delivered');

			ROW_INDEX ++;
		}
	}

	FORM_INITIALIZE();
	FORM_LOAD();