// NOTE: [This JS must loaded as last item]


	// ===============================================================
	// Initialize Form
	// ===============================================================
	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)
			{
				// Delete Button
				// ...........................................
				// if(JOB_ORDER_DGV.COLUMN.NAME(COL_INDEX) == "DELETE_CMD")
				// {
				// 	// Delete Unsaved Item
				// 	if
				// 	(
				// 		JOB_ORDER_DGV.COLUMN.IS_EXISTS("REC_JORDER_ID") &&
				// 		JSVC_NUM.VAR_NVALL(JOB_ORDER_DGV.CELL.VALUE("REC_JORDER_ID", ROW_INDEX)) <= 0
				// 	)
				// 	{
				// 		JOB_ORDER_DGV.ROW.REMOVE_AT(ROW_INDEX);
				// 	}
					
				// 	// Delete Saved Item
				// 	else
				// 	{
				// 		HTTP_DELETE
				// 		(
				// 			function(IS_SUCCESS)
				// 			{
				// 				console.log('Record Deleted.');
				// 			}, 
				// 			ROW_INDEX
				// 		);				
				// 	}
				// }			

				// Void Button
				// ...........................................
				// else if(JOB_ORDER_DGV.COLUMN.NAME(COL_INDEX) == "VOID_CMD")
				// {
				// 	// Delete Unsaved Item
				// 	if
				// 	(
				// 		JOB_ORDER_DGV.COLUMN.IS_EXISTS("REC_JORDER_ID") &&
				// 		JSVC_NUM.VAR_NVALL(JOB_ORDER_DGV.CELL.VALUE("REC_JORDER_ID", ROW_INDEX)) <= 0
				// 	)
				// 	{
				// 		JOB_ORDER_DGV.ROW.REMOVE_AT(ROW_INDEX);
				// 	}
					
				// 	// Void Saved Item
				// 	else
				// 	{

				// 	}
				// }	
				
				// Link to Child Table
				// ...........................................
				/*
				// Sample Child Code
				else if(JOB_ORDER_DGV.COLUMN.NAME(COL_INDEX) == "CHILD_CMD")
				{
					// Get Current Root path
					var CURRENT_ROOT_PATH = JSCUS_CACHE.ROOT_PATH + JSVC_STR.VAR_MID(JSVC_STR.VAR_DLEFT(JSCUS_CACHE.AUTH_REDIRECT_URL[JSCUS_CACHE.LOGIN_CLASS], JSCUS_CACHE.SERVER_URL.length), 1, 1);
			
					// Cache Primary Key
					JSVC_COOKIE.VAR_ADD
					(
						'PROPERTY_PARENT_ID', 
						JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_ID', ROW_INDEX), 
						5, 
						CURRENT_ROOT_PATH
					);
					JSVC_COOKIE.VAR_ADD
					(
						'PROPERTY_PARENT_DESCRIPTION', 
						JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_DESCRIPTION', ROW_INDEX), 
						5, 
						CURRENT_ROOT_PATH
					);
					
					// Open EditPage
					window.location = JSCUS_CACHE.SERVER_URL + '/p/record/job_order.html';	
					return;
				}
				*/
						
	
				// If dialog supported
				// ...........................................
				if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("JOB_ORDER_MODAL") == true)
				{
					// Clear Modal
					
					// Display Modal
					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 taken show complete and save button
					//if open show cancel button
					//else hide all 
					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_USER_ASSIGN', ROW_INDEX)) > 1 &&
						JSVC_NUM.VAR_NVALL(JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_FOR_COMPLETION', ROW_INDEX)) == 1
					)
					{
						$("#SAVE_BBI").show();
						$("#COMPLETION_BBI").hide();
						//$("#CANCEL_BBI").show();
					}
					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_USER_ASSIGN', ROW_INDEX)) == 1 &&
						JSVC_NUM.VAR_NVALL(JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_FOR_COMPLETION', ROW_INDEX)) == 1
					)
					{
						$("#SAVE_BBI").show();
						$("#COMPLETION_BBI").hide();
						//$("#CANCEL_BBI").show();
					}
					else
					{
						$("#SAVE_BBI").hide();
						$("#COMPLETION_BBI").hide();
						//$("#CANCEL_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_MIDDLENAME', ROW_INDEX));

					if(JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_USER_ASSIGN', ROW_INDEX) == 1)
						JSOC_CMB.VAR_SELECTED_VALUE("REC_RIDER_ID_CMB", FLAG_BIGINT_NULL.toString());
					else
						JSOC_CMB.VAR_SELECTED_VALUE("REC_RIDER_ID_CMB", JSVC_NUM.VAR_NVALL(JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_USER_ASSIGN', 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;
				}
				
				// Open View / Edit Page
				// ...........................................
				else if(JOB_ORDER_DGV.SETTING_EDITABLE == false)
				{
					// Get Current Root path
					var CURRENT_ROOT_PATH = JSCUS_CACHE.ROOT_PATH + JSVC_STR.VAR_MID(JSVC_STR.VAR_DLEFT(JSCUS_CACHE.AUTH_REDIRECT_URL[JSCUS_CACHE.LOGIN_CLASS], JSCUS_CACHE.SERVER_URL.length), 1, 1);

					
							
					// Cache Primary Key
					JSVC_COOKIE.VAR_ADD
					(
						'PROPERTY_PARENT_ID', 
						JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_ID', ROW_INDEX), 
						5, 
						CURRENT_ROOT_PATH
					);
					JSVC_COOKIE.VAR_ADD
					(
						'PROPERTY_PARENT_DESCRIPTION', 
						JOB_ORDER_DGV.CELL.VALUE('REC_JORDER_DESCRIPTION', ROW_INDEX), 
						5, 
						CURRENT_ROOT_PATH
					);
					
					// Open EditPage
					window.location = 'job_order_info.html';				
				}

			}
		);   

		
		// Show Progress
		// _______________________________________________________________________	
		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		
		
		// Requires Authentication
		// _______________________________________________________________________	
		PAGE_AUTH_REQUIRES_LOGIN(HTTP_POPULATE_RESULT);			


		
		
		// Foreign Key [Fixed]
		// _______________________________________________________________________	
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("REC_JORDER_ACC_GROUP_ID_CMB") == true)
		{
			// Set Default Item, if used in DataGridView
			JSOC_CMB.VAR_ADD("REC_JORDER_ACC_GROUP_ID_CMB", FLAG_BIGINT_NULL.toString(), "-");
			// To use custom populate
			// var GET_MAP_ARRAY = JSCUS_SQL._ACCOUNT._GROUP.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();
			// JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_', JSCUS_SQL._SYSTEM._STATUS.STATUS_ACTIVE);	
			JSCUS_SQL._ACCOUNT._GROUP.CUS_GET_THEN_POPULATE_COMBOBOX
			(
				function(IS_SUCCESS, RESPONSE_STRING)
				{
					// Set Default index
					JSOC_CMB.VAR_SELECTED_INDEX("REC_JORDER_ACC_GROUP_ID_CMB", 0);
					
					// Clone to DGV Cell if ComboBox Exists
					if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("JOB_ORDER_DGV_ROW_REC_JORDER_ACC_GROUP_ID") == true)
					{
						DGV_ELEMENT_CHILD = JSOC_ELEMENT.VAR_SUB_ELEMENTS("JOB_ORDER_DGV_ROW_REC_JORDER_ACC_GROUP_ID");
						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_ACC_GROUP_ID_CMB")
								);
							}	
							DGV_ELEMENT_CHILD_INDEX ++;
						}
					}
					
					// Copy items to edit control
					if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_JORDER_ACC_GROUP_ID_CMB") == true)
					{
						JSOC_CMB.VAR_CLEAR("SEARCH_REC_JORDER_ACC_GROUP_ID_CMB");
						JSOC_CMB.VAR_ADD("SEARCH_REC_JORDER_ACC_GROUP_ID_CMB", FLAG_BIGINT_NULL.toString(),"Any Group");
						JSOC_ELEMENT.VAR_INNER_HTML("SEARCH_REC_JORDER_ACC_GROUP_ID_CMB", JSOC_ELEMENT.VAR_INNER_HTML("REC_JORDER_ACC_GROUP_ID_CMB"), true);
						JSOC_CMB.VAR_SELECTED_INDEX("SEARCH_REC_JORDER_ACC_GROUP_ID_CMB", 0);
						$('.BSSP_SEARCH_REC_JORDER_ACC_GROUP_ID_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_ACC_GROUP_ID_CMB').selectpicker('refresh');
					HTTP_POPULATE_RESULT();		
				},
				"REC_JORDER_ACC_GROUP_ID_CMB",
				true, 2
				// , GET_MAP_ARRAY 
			);
		}
		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_JORDER_ACC_GROUP_ID_CMB") == true &&
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("REC_JORDER_ACC_GROUP_ID_CMB") == false
		)
		{
			JSOC_CMB.VAR_CLEAR("SEARCH_REC_JORDER_ACC_GROUP_ID_CMB");
			JSOC_CMB.VAR_ADD("SEARCH_REC_JORDER_ACC_GROUP_ID_CMB", FLAG_BIGINT_NULL.toString(),"Any Group");
			// To use custom populate
			// var GET_MAP_ARRAY = JSCUS_SQL._ACCOUNT._GROUP.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();
			// JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_', JSCUS_SQL._SYSTEM._STATUS.STATUS_ACTIVE);	
			JSCUS_SQL._ACCOUNT._GROUP.CUS_GET_THEN_POPULATE_COMBOBOX
			(
				function(IS_SUCCESS, RESPONSE_STRING)
				{
					// Set Default index
					JSOC_CMB.VAR_SELECTED_INDEX("SEARCH_REC_JORDER_ACC_GROUP_ID_CMB", 0);
					
					// Forward populate complete event.		
					$('.BSSP_SEARCH_REC_JORDER_ACC_GROUP_ID_CMB').selectpicker('refresh');
					HTTP_POPULATE_RESULT();
				},		
				"SEARCH_REC_JORDER_ACC_GROUP_ID_CMB",
				true, 2
				// , GET_MAP_ARRAY 
			);
		}
		
		// Foreign Key [Fixed]
		// _______________________________________________________________________	
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("REC_JORDER_REC_CLIENT_ID_CMB") == true)
		{
			// Set Default Item, if used in DataGridView
			JSOC_CMB.VAR_ADD("REC_JORDER_REC_CLIENT_ID_CMB", FLAG_BIGINT_NULL.toString(), "-");
			// To use custom populate
			// var GET_MAP_ARRAY = JSCUS_SQL._RECORD._CLIENT.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();
			// JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_', JSCUS_SQL._SYSTEM._STATUS.STATUS_ACTIVE);	
			JSCUS_SQL._RECORD._CLIENT.CUS_GET_THEN_POPULATE_COMBOBOX
			(
				function(IS_SUCCESS, RESPONSE_STRING)
				{
					// Set Default index
					JSOC_CMB.VAR_SELECTED_INDEX("REC_JORDER_REC_CLIENT_ID_CMB", 0);
					
					// Clone to DGV Cell if ComboBox Exists
					if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("JOB_ORDER_DGV_ROW_REC_JORDER_REC_CLIENT_ID") == true)
					{
						DGV_ELEMENT_CHILD = JSOC_ELEMENT.VAR_SUB_ELEMENTS("JOB_ORDER_DGV_ROW_REC_JORDER_REC_CLIENT_ID");
						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_REC_CLIENT_ID_CMB")
								);
							}	
							DGV_ELEMENT_CHILD_INDEX ++;
						}
					}
					
					// Copy items to edit control
					if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_JORDER_REC_CLIENT_ID_CMB") == true)
					{
						JSOC_CMB.VAR_CLEAR("SEARCH_REC_JORDER_REC_CLIENT_ID_CMB");
						JSOC_CMB.VAR_ADD("SEARCH_REC_JORDER_REC_CLIENT_ID_CMB", FLAG_BIGINT_NULL.toString(),"Any Client");
						JSOC_ELEMENT.VAR_INNER_HTML("SEARCH_REC_JORDER_REC_CLIENT_ID_CMB", JSOC_ELEMENT.VAR_INNER_HTML("REC_JORDER_REC_CLIENT_ID_CMB"), true);
						JSOC_CMB.VAR_SELECTED_INDEX("SEARCH_REC_JORDER_REC_CLIENT_ID_CMB", 0);
						$('.BSSP_SEARCH_REC_JORDER_REC_CLIENT_ID_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_REC_CLIENT_ID_CMB').selectpicker('refresh');
					HTTP_POPULATE_RESULT();		
				},
				"REC_JORDER_REC_CLIENT_ID_CMB",
				true, 2
				// , GET_MAP_ARRAY 
			);
		}
		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_JORDER_REC_CLIENT_ID_CMB") == true &&
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("REC_JORDER_REC_CLIENT_ID_CMB") == false
		)
		{
			JSOC_CMB.VAR_CLEAR("SEARCH_REC_JORDER_REC_CLIENT_ID_CMB");
			JSOC_CMB.VAR_ADD("SEARCH_REC_JORDER_REC_CLIENT_ID_CMB", FLAG_BIGINT_NULL.toString(),"Any Client");
			// To use custom populate
			// var GET_MAP_ARRAY = JSCUS_SQL._RECORD._CLIENT.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();
			// JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_', JSCUS_SQL._SYSTEM._STATUS.STATUS_ACTIVE);	
			JSCUS_SQL._RECORD._CLIENT.CUS_GET_THEN_POPULATE_COMBOBOX
			(
				function(IS_SUCCESS, RESPONSE_STRING)
				{
					// Set Default index
					JSOC_CMB.VAR_SELECTED_INDEX("SEARCH_REC_JORDER_REC_CLIENT_ID_CMB", 0);
					
					// Forward populate complete event.		
					$('.BSSP_SEARCH_REC_JORDER_REC_CLIENT_ID_CMB').selectpicker('refresh');
					HTTP_POPULATE_RESULT();
				},		
				"SEARCH_REC_JORDER_REC_CLIENT_ID_CMB",
				true, 2
				// , GET_MAP_ARRAY 
			);
		}
		
		// Foreign Key [Fixed]
		// _______________________________________________________________________	
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("REC_JORDER_USER_POST_CMB") == true)
		{
			// Set Default Item, if used in DataGridView
			JSOC_CMB.VAR_ADD("REC_JORDER_USER_POST_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_POST_CMB", 0);
					
					// Clone to DGV Cell if ComboBox Exists
					if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("JOB_ORDER_DGV_ROW_REC_JORDER_USER_POST") == true)
					{
						DGV_ELEMENT_CHILD = JSOC_ELEMENT.VAR_SUB_ELEMENTS("JOB_ORDER_DGV_ROW_REC_JORDER_USER_POST");
						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_POST_CMB")
								);
							}	
							DGV_ELEMENT_CHILD_INDEX ++;
						}
					}
					
					// Copy items to edit control
					if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_JORDER_USER_POST_CMB") == true)
					{
						JSOC_CMB.VAR_CLEAR("SEARCH_REC_JORDER_USER_POST_CMB");
						JSOC_CMB.VAR_ADD("SEARCH_REC_JORDER_USER_POST_CMB", FLAG_BIGINT_NULL.toString(),"Any Member");
						JSOC_ELEMENT.VAR_INNER_HTML("SEARCH_REC_JORDER_USER_POST_CMB", JSOC_ELEMENT.VAR_INNER_HTML("REC_JORDER_USER_POST_CMB"), true);
						JSOC_CMB.VAR_SELECTED_INDEX("SEARCH_REC_JORDER_USER_POST_CMB", 0);
						$('.BSSP_SEARCH_REC_JORDER_USER_POST_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_POST_CMB').selectpicker('refresh');
					HTTP_POPULATE_RESULT();		
				},
				"REC_JORDER_USER_POST_CMB",
				true, 2
				// , GET_MAP_ARRAY 
			);
		}
		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_JORDER_USER_POST_CMB") == true &&
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("REC_JORDER_USER_POST_CMB") == false
		)
		{
			JSOC_CMB.VAR_CLEAR("SEARCH_REC_JORDER_USER_POST_CMB");
			JSOC_CMB.VAR_ADD("SEARCH_REC_JORDER_USER_POST_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_POST_CMB", 0);
					
					// Forward populate complete event.		
					$('.BSSP_SEARCH_REC_JORDER_USER_POST_CMB').selectpicker('refresh');
					HTTP_POPULATE_RESULT();
				},		
				"SEARCH_REC_JORDER_USER_POST_CMB",
				true, 2
				// , GET_MAP_ARRAY 
			);
		}
		
		// 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);
						$('.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.		
					$('.BSSP_SEARCH_REC_JORDER_USER_ASSIGN_CMB').selectpicker('refresh');
					HTTP_POPULATE_RESULT();
				},		
				"SEARCH_REC_JORDER_USER_ASSIGN_CMB",
				true, 2
				// , GET_MAP_ARRAY 
			);
		}
		
		// Foreign Key [Fixed]
		// _______________________________________________________________________	
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("REC_JORDER_USER_REVIEW_CMB") == true)
		{
			// Set Default Item, if used in DataGridView
			JSOC_CMB.VAR_ADD("REC_JORDER_USER_REVIEW_CMB", FLAG_BIGINT_NULL.toString(), "-");
			// To use custom populate
			// var GET_MAP_ARRAY = JSCUS_SQL._ACCOUNT._ACCESS_RIGHTS.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();
			// JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_', JSCUS_SQL._SYSTEM._STATUS.STATUS_ACTIVE);	
			JSCUS_SQL._ACCOUNT._ACCESS_RIGHTS.CUS_GET_THEN_POPULATE_COMBOBOX
			(
				function(IS_SUCCESS, RESPONSE_STRING)
				{
					// Set Default index
					JSOC_CMB.VAR_SELECTED_INDEX("REC_JORDER_USER_REVIEW_CMB", 0);
					
					// Clone to DGV Cell if ComboBox Exists
					if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("JOB_ORDER_DGV_ROW_REC_JORDER_USER_REVIEW") == true)
					{
						DGV_ELEMENT_CHILD = JSOC_ELEMENT.VAR_SUB_ELEMENTS("JOB_ORDER_DGV_ROW_REC_JORDER_USER_REVIEW");
						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_REVIEW_CMB")
								);
							}	
							DGV_ELEMENT_CHILD_INDEX ++;
						}
					}
					
					// Copy items to edit control
					if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_JORDER_USER_REVIEW_CMB") == true)
					{
						JSOC_CMB.VAR_CLEAR("SEARCH_REC_JORDER_USER_REVIEW_CMB");
						JSOC_CMB.VAR_ADD("SEARCH_REC_JORDER_USER_REVIEW_CMB", FLAG_BIGINT_NULL.toString(),"Any Access_Rights");
						JSOC_ELEMENT.VAR_INNER_HTML("SEARCH_REC_JORDER_USER_REVIEW_CMB", JSOC_ELEMENT.VAR_INNER_HTML("REC_JORDER_USER_REVIEW_CMB"), true);
						JSOC_CMB.VAR_SELECTED_INDEX("SEARCH_REC_JORDER_USER_REVIEW_CMB", 0);
						$('.BSSP_SEARCH_REC_JORDER_USER_REVIEW_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_REVIEW_CMB').selectpicker('refresh');
					HTTP_POPULATE_RESULT();		
				},
				"REC_JORDER_USER_REVIEW_CMB",
				true, 2
				// , GET_MAP_ARRAY 
			);
		}
		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_JORDER_USER_REVIEW_CMB") == true &&
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("REC_JORDER_USER_REVIEW_CMB") == false
		)
		{
			JSOC_CMB.VAR_CLEAR("SEARCH_REC_JORDER_USER_REVIEW_CMB");
			JSOC_CMB.VAR_ADD("SEARCH_REC_JORDER_USER_REVIEW_CMB", FLAG_BIGINT_NULL.toString(),"Any Access_Rights");
			// To use custom populate
			// var GET_MAP_ARRAY = JSCUS_SQL._ACCOUNT._ACCESS_RIGHTS.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();
			// JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_', JSCUS_SQL._SYSTEM._STATUS.STATUS_ACTIVE);	
			JSCUS_SQL._ACCOUNT._ACCESS_RIGHTS.CUS_GET_THEN_POPULATE_COMBOBOX
			(
				function(IS_SUCCESS, RESPONSE_STRING)
				{
					// Set Default index
					JSOC_CMB.VAR_SELECTED_INDEX("SEARCH_REC_JORDER_USER_REVIEW_CMB", 0);
					
					// Forward populate complete event.		
					$('.BSSP_SEARCH_REC_JORDER_USER_REVIEW_CMB').selectpicker('refresh');
					HTTP_POPULATE_RESULT();
				},		
				"SEARCH_REC_JORDER_USER_REVIEW_CMB",
				true, 2
				// , GET_MAP_ARRAY 
			);
		}

		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("REC_RIDER_ID_CMB") == true)
		{
			JSOC_CMB.VAR_CLEAR("REC_RIDER_ID_CMB");
			JSOC_CMB.VAR_ADD("REC_RIDER_ID_CMB", FLAG_BIGINT_NULL.toString(),"-");

			var GET_MAP_ARRAY = JSCUS_SQL._ACCOUNT._MEMBER.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();
			JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_ACC_ACCOUNT_ACC_LEVEL_ID', 8);

			JSCUS_SQL._ACCOUNT._MEMBER.CUS_GET_THEN_POPULATE_COMBOBOX
			(
				function(){ HTTP_POPULATE_RESULT(); },
				"REC_RIDER_ID_CMB",
				true,
				2,
				GET_MAP_ARRAY
			);
		}
		
		// Status		
		// _______________________________________________________________________	
		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","Pending");
			JSOC_CMB.VAR_ADD("SEARCH_REC_JORDER_STATUS_CMB", "888","Taken");
			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","Completed");
			JSOC_CMB.VAR_ADD("SEARCH_REC_JORDER_STATUS_CMB", "777","Collected");
			JSOC_CMB.VAR_SELECTED_VALUE("SEARCH_REC_JORDER_STATUS_CMB", "2");
		}			
		
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("REC_JORDER_STATUS_CMB") == true)
		{
			JSOC_CMB.VAR_CLEAR("REC_JORDER_STATUS_CMB");
			JSOC_CMB.VAR_ADD("REC_JORDER_STATUS_CMB", "1","Inactive");
			JSOC_CMB.VAR_ADD("REC_JORDER_STATUS_CMB", "2","Active");
			// JSOC_CMB.VAR_ADD("REC_JORDER_STATUS_CMB", "3","Closed");
			// JSOC_CMB.VAR_ADD("REC_JORDER_STATUS_CMB", "4","Completed");
			JSOC_CMB.VAR_SELECTED_VALUE("REC_JORDER_STATUS_CMB", "2");
		}
		
		// Get Modal Instance (Add Modal Adjustment before this line)
		// _______________________________________________________________________	
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("JOB_ORDER_MODAL") == true)
		{
			INPUT_INSTANCE = JSOC_WINDOW.VAR_INPUT_INSTANCE_CLONE("JOB_ORDER_MODAL");
		}
		
		// Add Search Events for the SEARCH_DESCRIPTION_TXT - TextInput
		// _______________________________________________________________________		
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_JORDER_DESCRIPTION_TXT"))
		{
			var SEARCH_REC_JORDER_DESCRIPTION_TXT = JSOC_ELEMENT.VAR_GET("SEARCH_REC_JORDER_DESCRIPTION_TXT");
			SEARCH_REC_JORDER_DESCRIPTION_TXT.onkeydown = 
				function() 
				{ 
					return function(e) 
					{
						if
						(
							(
								e.which == 13 || 
								e.keyCode == 13 || 
								e.key === "Enter"
							) &&
							JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_CMD")
						)
						{
							HTTP_SEARCH();
						}
					};
				}();
		}
		

		
		// Load Parent Data (if Exists)
		// _______________________________________________________________________	
		HTTP_PARENT_LOAD();
		
		
		// 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();
			}
		}
	};

	
	// ===============================================================
	// Request Search - PART.A
	// ===============================================================
	function HTTP_SEARCH(NEW_ITEM_ID, EDITED_ROW_INDEX)
	{
		CMB_STATUS_IDENTIFIER = 0;
		// Optional Value
		// _______________________________________________________________________
		NEW_ITEM_ID = JSVC_VAR.VAR_OPTIONAL(NEW_ITEM_ID, -1);
		EDITED_ROW_INDEX = JSVC_VAR.VAR_OPTIONAL(EDITED_ROW_INDEX, -1);
		
		// Parameter Validate
		// _______________________________________________________________________
		JSVC_AV.VAR_VALIDATE_ARGUMENT_TYPE(NEW_ITEM_ID, 'NEW_ITEM_ID', 'NUMERIC');
		JSVC_AV.VAR_VALIDATE_ARGUMENT_TYPE(EDITED_ROW_INDEX, 'EDITED_ROW_INDEX', 'NUMERIC');
		
		
		// Actual Function
		// _______________________________________________________________________
		GET_MAP_ARRAY = JSCUS_SQL._RECORD._JOB_ORDER.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();	
		// if(JSVC_VAR.VAR_ISSET("PROPERTY_PARENT_ID"))
		// {
		//	JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_PARENT_ID', PROPERTY_PARENT_ID);
		// }  // Parent ID Sample
		
		//if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_JORDER_ACC_GROUP_ID_CMB") == true)
		//{
		// JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_ACC_GROUP_ID', JSVC_NUM.VAR_NVALL(JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_ACC_GROUP_ID));
		//}
		
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_JORDER_REC_CLIENT_ID_CMB") == true)
		{
			JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_REC_CLIENT_ID', JSVC_NUM.VAR_NVAL(JSOC_CMB.VAR_SELECTED_VALUE("SEARCH_REC_JORDER_REC_CLIENT_ID_CMB")));
		}
		
		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_DESCRIPTION_TXT") == true &&
			JSVC_STR.VAR_IS_BLANK( JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_JORDER_DESCRIPTION_TXT")) == false
		)
		{
			JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_DESCRIPTION', JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_JORDER_DESCRIPTION_TXT"));
		}
		
		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_JORDER_AMOUNT_FROM_TXT") == true &&
			JSOC_STYLE.VAR_IS_VISIBLE('SEARCH_REC_JORDER_AMOUNT_FROM_TXT') == true
		)
		{
			JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_AMOUNT_FROM', JSVC_NUM.VAR_NVAL(JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_JORDER_AMOUNT_FROM_TXT")));
		}
		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_JORDER_AMOUNT_TO_TXT") == true &&
			JSOC_STYLE.VAR_IS_VISIBLE('SEARCH_REC_JORDER_AMOUNT_TO_TXT') == true
		)
		{
			JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_AMOUNT_TO', JSVC_NUM.VAR_NVAL(JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_JORDER_AMOUNT_TO_TXT")));
		}			
		
		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_JORDER_REMARKS_TXT") == true &&
			JSVC_STR.VAR_IS_BLANK( JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_JORDER_REMARKS_TXT")) == false
		)
		{
			JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_REMARKS', JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_JORDER_REMARKS_TXT"));
		}
		
		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_JORDER_DATE_POST_FROM_DTP") == true &&
			JSOC_STYLE.VAR_IS_VISIBLE('SEARCH_REC_JORDER_DATE_POST_FROM_DTP') == true &&
			JSVC_STR.VAR_IS_BLANK(JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_JORDER_DATE_POST_FROM_DTP")) == false
		)
		{
			JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_DATE_POST_FROM', JSVC_DATE.VAR_FORMAT(JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_JORDER_DATE_POST_FROM_DTP"), "YYYY-MM-DD") + " 00:00:00.000000");
		}
		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_JORDER_DATE_POST_TO_DTP") == true &&
			JSOC_STYLE.VAR_IS_VISIBLE('SEARCH_REC_JORDER_DATE_POST_TO_DTP') == true &&
			JSVC_STR.VAR_IS_BLANK(JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_JORDER_DATE_POST_TO_DTP")) == false
		)
		{
			JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_DATE_POST_TO', JSVC_DATE.VAR_FORMAT(JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_JORDER_DATE_POST_TO_DTP"), "YYYY-MM-DD") + " 23:59:59.999999");
		}
		
		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_JORDER_DATE_ASSIGN_FROM_DTP") == true &&
			JSOC_STYLE.VAR_IS_VISIBLE('SEARCH_REC_JORDER_DATE_ASSIGN_FROM_DTP') == true &&
			JSVC_STR.VAR_IS_BLANK(JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_JORDER_DATE_ASSIGN_FROM_DTP")) == false
		)
		{
			JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_DATE_ASSIGN_FROM', JSVC_DATE.VAR_FORMAT(JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_JORDER_DATE_ASSIGN_FROM_DTP"), "YYYY-MM-DD") + " 00:00:00.000000");
		}
		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_JORDER_DATE_ASSIGN_TO_DTP") == true &&
			JSOC_STYLE.VAR_IS_VISIBLE('SEARCH_REC_JORDER_DATE_ASSIGN_TO_DTP') == true &&
			JSVC_STR.VAR_IS_BLANK(JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_JORDER_DATE_ASSIGN_TO_DTP")) == false
		)
		{
			JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_DATE_ASSIGN_TO', JSVC_DATE.VAR_FORMAT(JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_JORDER_DATE_ASSIGN_TO_DTP"), "YYYY-MM-DD") + " 23:59:59.999999");
		}
		
		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_JORDER_DATE_COMPLETE_FROM_DTP") == true &&
			JSOC_STYLE.VAR_IS_VISIBLE('SEARCH_REC_JORDER_DATE_COMPLETE_FROM_DTP') == true &&
			JSVC_STR.VAR_IS_BLANK(JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_JORDER_DATE_COMPLETE_FROM_DTP")) == false
		)
		{
			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 &&
			JSOC_STYLE.VAR_IS_VISIBLE('SEARCH_REC_JORDER_DATE_COMPLETE_TO_DTP') == true &&
			JSVC_STR.VAR_IS_BLANK(JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_JORDER_DATE_COMPLETE_TO_DTP")) == false
		)
		{
			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_USER_POST_CMB") == true)
		{
			JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_USER_POST', JSVC_NUM.VAR_NVAL(JSOC_CMB.VAR_SELECTED_VALUE("SEARCH_REC_JORDER_USER_POST_CMB")));
		}
		
		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_USER_REVIEW_CMB") == true)
		{
			JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_USER_REVIEW', JSVC_NUM.VAR_NVAL(JSOC_CMB.VAR_SELECTED_VALUE("SEARCH_REC_JORDER_USER_REVIEW_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)
			{
				// ALL COLLECTED
				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_STATUS', JSVC_NUM.VAR_NVALL(JSOC_CMB.VAR_SELECTED_VALUE(SEARCH_REC_JORDER_STATUS_CMB)));

			//JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_STATUS', JSVC_NUM.VAR_NVAL(JSOC_CMB.VAR_SELECTED_VALUE("SEARCH_REC_JORDER_STATUS_CMB")));
		}
		
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_ORDER_BY_CMB") == true)
		{
			var SELECTED_VAL = JSOC_CMB.VAR_SELECTED_VALUE("SEARCH_ORDER_BY_CMB");
			if(JSVC_STR.VAR_CONTAINS_RIGHT(SELECTED_VAL, '_ASC'))
			{
				JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_ORDER_FIELD', JSVC_STR.VAR_DRIGHT(SELECTED_VAL, 4));
				JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_ORDER_TYPE', 'ASC');		
			}
			else
			{
				JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_ORDER_FIELD', SELECTED_VAL);
				JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_ORDER_TYPE', 'DESC');
			}
		}	
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_LIMIT_CMB") == true)
		{
			JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_LIMIT', JSOC_CMB.VAR_SELECTED_VALUE("SEARCH_LIMIT_CMB"));		
		}			
		
		var SELECTED_SEARCH_MODE = 0;
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_MODE_CMB") == true)
		{
			SELECTED_SEARCH_MODE = JSVC_NUM.VAR_NVALL(JSOC_CMB.VAR_SELECTED_VALUE("SEARCH_MODE_CMB"));		
		}

		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_ORDER_FIELD', 'REC_JORDER_DATETIME_A');
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_ORDER_TYPE', 'DESC');
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_LIMIT', 10);
			
		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		
		
		// Search Inserted / Saved Record
		// _______________________________________________________________________
		if(NEW_ITEM_ID >= 0)
		{
			GET_MAP_ARRAY = JSCUS_SQL._RECORD._JOB_ORDER.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();	
			JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_REC_JORDER_ID', NEW_ITEM_ID);
			
			JSCUS_SQL._RECORD._JOB_ORDER.CUS_GET
			(
				GET_MAP_ARRAY,
				function(IS_SUCCESS, RESPONSE_STRING)
				{
					// Update Existing Row
					if(EDITED_ROW_INDEX >= 0)
					{
						HTTP_SEARCH_LIMITED_ROWS_CALLBACK(IS_SUCCESS, RESPONSE_STRING, EDITED_ROW_INDEX);
					}
					
					// Add new item
					else
					{
						HTTP_SEARCH_LIMITED_ROWS_CALLBACK(IS_SUCCESS, RESPONSE_STRING, 0);
					}
				},
				true
			); 			
		}
			
			
		// REGULAR Search Mode
		// _______________________________________________________________________
		else if(SELECTED_SEARCH_MODE == 0)
		{			
			JSCUS_SQL._RECORD._JOB_ORDER.CUS_GET
			(
				GET_MAP_ARRAY,
				HTTP_SEARCH_CALLBACK,
				true
			); 			
       	}
		
		
		// LITE Search Mode
		// _______________________________________________________________________
		else if(SELECTED_SEARCH_MODE == 1)
		{
			JSCUS_SQL._RECORD._JOB_ORDER.CUS_GET_LITE
			(
				GET_MAP_ARRAY,
				HTTP_SEARCH_CALLBACK,
				true
			); 				
		}
		
		
		// ALL Search Mode
		// _______________________________________________________________________
		else if(SELECTED_SEARCH_MODE == 2)
		{
			JSCUS_SQL._RECORD._JOB_ORDER.CUS_GET_ALL
			(
				GET_MAP_ARRAY,
				HTTP_SEARCH_CALLBACK,
				true
			); 							
		}
		
		
		// Update Paging Cache
		// _______________________________________________________________________
		if(NEW_ITEM_ID < 0)
		{
			JOB_ORDER_LAST_GET_MAP_ARRAY = GET_MAP_ARRAY;
		}
	};
	
	
	// ===============================================================
	// Request Search - PART.A
	// ===============================================================
	function HTTP_SEARCH_LOAD_MORE()
	{
		// Abort if no GET cache is found
		// _______________________________________________________________________		
		if(JSVC_VAR.VAR_ISSET(JOB_ORDER_LAST_GET_MAP_ARRAY) == false)
		{
			return;
		}
		
		
		// Update Paging row count
		// _______________________________________________________________________		
		JOB_ORDER_LAST_GET_MAP_ARRAY['PARAM_SKIP'] = 
			JSVC_NUM.VAR_NVALL(JOB_ORDER_LAST_GET_MAP_ARRAY['PARAM_SKIP']) + 
			JSVC_NUM.VAR_NVALL(JOB_ORDER_LAST_GET_MAP_ARRAY['PARAM_LIMIT']);		
			
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_LIMIT_CMB") == true)
		{
			JSVC_MAP_ARRAY.VAR_SET
			(
				JOB_ORDER_LAST_GET_MAP_ARRAY,
				'PARAM_LIMIT', 
				JSOC_CMB.VAR_SELECTED_VALUE("SEARCH_LIMIT_CMB")
			);		
		}
		

		// Prepare Loading Dialog
		// _______________________________________________________________________			
		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		
		
		// REGULAR Search Mode
		// _______________________________________________________________________
		if(SELECTED_SEARCH_MODE == 0)
		{			
			JSCUS_SQL._RECORD._JOB_ORDER.CUS_GET_ALL
			(
				JOB_ORDER_LAST_GET_MAP_ARRAY,
				HTTP_SEARCH_CALLBACK,
				true
			); 		
		}

		
		// LITE Search Mode
		// _______________________________________________________________________
		else if(SELECTED_SEARCH_MODE == 1)
		{			
			JSCUS_SQL._RECORD._JOB_ORDER.CUS_GET_LITE
			(
				JOB_ORDER_LAST_GET_MAP_ARRAY,
				HTTP_SEARCH_CALLBACK,
				true
			); 		
		}

		
		// ALL Search Mode
		// _______________________________________________________________________
		else if(SELECTED_SEARCH_MODE == 2)
		{			
			JSCUS_SQL._RECORD._JOB_ORDER.CUS_GET_ALL
			(
				JOB_ORDER_LAST_GET_MAP_ARRAY,
				function (IS_SUCCESS, RESPONSE_STRING)
				{
					HTTP_SEARCH_CALLBACK(IS_SUCCESS, RESPONSE_STRING, true);
				},
				true
			); 		
		}	
	}

	// ===============================================================
	// Request Search - PART.A2
	// ===============================================================
	function HTTP_SEARCH_LOAD_PAGE()
	{
		// Abort if no GET cache is found
		// _______________________________________________________________________		
		if
		(
			JSVC_VAR.VAR_ISSET(JOB_ORDER_LAST_GET_MAP_ARRAY) == false ||
			JSOC_CMB.VAR_SELECTED_INDEX("LOAD_PAGING_CMB") < 0
		)
		{
			return;
		}
		
		// Update Paging row count
		// _______________________________________________________________________
		JOB_ORDER_LAST_GET_MAP_ARRAY['PARAM_SKIP'] = 
		JSVC_NUM.VAR_NVALL(JOB_ORDER_LAST_GET_MAP_ARRAY['PARAM_LIMIT']) *
		JSOC_CMB.VAR_SELECTED_INDEX("LOAD_PAGING_CMB");	
		
		// REGULAR Search Mode
		// _______________________________________________________________________
		LOAD_PAGING_IGNORE_NEXT_REQUEST = true;
		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._RECORD._JOB_ORDER.CUS_GET
		(
			JOB_ORDER_LAST_GET_MAP_ARRAY,
			function (IS_SUCCESS, RESPONSE_STRING)
			{
				HTTP_SEARCH_CALLBACK(IS_SUCCESS, RESPONSE_STRING, false);
			},
			true
		);
	}
	
	function HTTP_SEARCH_LOAD_PAGING_UPDATE(ROW_COUNT)
	{
		// Abort if no paging function enabled
		// _______________________________________________________________________
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("LOAD_PAGING_CMB") == false || LOAD_PAGING_IGNORE_NEXT_REQUEST == true)
		{
			LOAD_PAGING_IGNORE_NEXT_REQUEST = false;
			return;
		}
		
		// Initialize
		// _______________________________________________________________________
		var PAGING_INDEX = 0;
		var PAGING_COUNT = 
			ROW_COUNT / JSVC_NUM.VAR_NVALL(JOB_ORDER_LAST_GET_MAP_ARRAY['PARAM_LIMIT']);
		PAGING_COUNT = Math.trunc(PAGING_COUNT) + 1;
		JSOC_CMB.VAR_CLEAR("LOAD_PAGING_CMB");
		
		// Populate Paging
		// _______________________________________________________________________
		while(PAGING_COUNT > PAGING_INDEX)
		{
			JSOC_CMB.VAR_ADD
			(
				"LOAD_PAGING_CMB", 
				(PAGING_INDEX + 1).toString(), 
				(PAGING_INDEX + 1).toString()
			);
			PAGING_INDEX ++;
		}
	}
	
	// ===============================================================
	// Request Search - PART.B
	// ===============================================================
	function HTTP_SEARCH_CALLBACK(IS_SUCCESS, RESPONSE_STRING, KEEP_DGV_ITEMS = false)
	{
		// Disable Dialogs
		// _______________________________________________________________________
		CUS_SEND_DIALOG_TRY_DISMISS();
		
		// 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;
		}

		// Back to DGV Top
		// _______________________________________________________________________	
		if(LOAD_PAGING_IGNORE_NEXT_REQUEST == true)
		{
			JSOC_ELEMENT.VAR_GET("JOB_ORDER_DGV").scrollIntoView
			(
				{
			  		behavior: 'auto', 
			  		block: 'start'
				}
			);		
		}

		// JSON Empty (Clears the DataGrodView)
		// _______________________________________________________________________
		if(JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT") <= 0)
		{
			HTTP_SEARCH_LOAD_PAGING_UPDATE(0);
			JOB_ORDER_DGV.ROW.CLEAR();
			return;
		}

		HTTP_SEARCH_LOAD_PAGING_UPDATE
		(
			JSVC_NUM.VAR_NVALL
			(
				JSRC_JSON.REF_READ(JSON_OBJECT, "RECORD_COUNT", 1)
			)
		);

		// Populate DGV
		// _______________________________________________________________________
		JOB_ORDER_DGV.POPULATE_FROM_QUERY
		(
				JSON_OBJECT, 
				'',
				KEEP_DGV_ITEMS,
				false,
				JOB_ORDER_LAST_GET_MAP_ARRAY['PARAM_SKIP'] + 1,
				[2, 1]
		);
		
		
		// For Applying CFormat
		// _______________________________________________________________________	
		JOB_ORDER_DGV.COLUMN.CFORMAT("REC_JORDER_AMOUNT");
		
		
		// Initialize
		// _______________________________________________________________________	
		var WEBTABLE_DATE = null;
		var CURRENT_CELL_VALUE = null;
		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 ++;
			}
		}


		// DateTime Format
		// _______________________________________________________________________	
		if(JOB_ORDER_DGV.COLUMN.IS_EXISTS("REC_JORDER_DATE_POST"))
		{
			WEBTABLE_DATE = null;
			ROW_INDEX = 0;
			while(JOB_ORDER_DGV.ROW.COUNT() > ROW_INDEX)
			{
				// Get Value
				// ...........................................
				CURRENT_CELL_VALUE = JOB_ORDER_DGV.CELL.VALUE
					(
						"REC_JORDER_DATE_POST", 
						ROW_INDEX
					);
				
				// Read Current Value
				// ...........................................
				if(JSVC_STR.VAR_IS_BLANK(CURRENT_CELL_VALUE) == false)
				{
					WEBTABLE_DATE = JSVC_DATE.VAR_TO_DATE(CURRENT_CELL_VALUE);			
				}
				else
				{
					WEBTABLE_DATE = null;
				}
				
				// Apply CFormat, and DateFormat
				// ...........................................
				if(JSVC_VAR.VAR_ISSET(WEBTABLE_DATE))
				{
					JOB_ORDER_DGV.CELL.VALUE
					(
							"REC_JORDER_DATE_POST", ROW_INDEX, 
							JSVC_DATE.VAR_FORMAT(WEBTABLE_DATE, "MMM DD, YYYY")
					);				
				}			
				
				// Color Coding (Uncomment to use)
				// ...........................................	
				//JOB_ORDER_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#1cc88a"; // Safe
				//JOB_ORDER_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#5a5c69"; // Neutral
				//JOB_ORDER_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#f6c23e"; // Caution
				//JOB_ORDER_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#e74a3b"; // Warning
				
				// To next loop
				// ...........................................	
				ROW_INDEX ++;
			}			
		}
		if(JOB_ORDER_DGV.COLUMN.IS_EXISTS("REC_JORDER_DATE_ASSIGN"))
		{
			WEBTABLE_DATE = null;
			ROW_INDEX = 0;
			while(JOB_ORDER_DGV.ROW.COUNT() > ROW_INDEX)
			{
				// Get Value
				// ...........................................
				CURRENT_CELL_VALUE = JOB_ORDER_DGV.CELL.VALUE
					(
						"REC_JORDER_DATE_ASSIGN", 
						ROW_INDEX
					);
				
				// Read Current Value
				// ...........................................
				if(JSVC_STR.VAR_IS_BLANK(CURRENT_CELL_VALUE) == false)
				{
					WEBTABLE_DATE = JSVC_DATE.VAR_TO_DATE(CURRENT_CELL_VALUE);			
				}
				else
				{
					WEBTABLE_DATE = null;
				}
				
				// Apply CFormat, and DateFormat
				// ...........................................
				if(JSVC_VAR.VAR_ISSET(WEBTABLE_DATE))
				{
					JOB_ORDER_DGV.CELL.VALUE
					(
							"REC_JORDER_DATE_ASSIGN", ROW_INDEX, 
							JSVC_DATE.VAR_FORMAT(WEBTABLE_DATE, "MMM DD, YYYY")
					);				
				}			
				
				// Color Coding (Uncomment to use)
				// ...........................................	
				//JOB_ORDER_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#1cc88a"; // Safe
				//JOB_ORDER_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#5a5c69"; // Neutral
				//JOB_ORDER_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#f6c23e"; // Caution
				//JOB_ORDER_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#e74a3b"; // Warning
				
				// To next loop
				// ...........................................	
				ROW_INDEX ++;
			}			
		}
		if(JOB_ORDER_DGV.COLUMN.IS_EXISTS("REC_JORDER_DATE_COMPLETE"))
		{
			WEBTABLE_DATE = null;
			ROW_INDEX = 0;
			while(JOB_ORDER_DGV.ROW.COUNT() > ROW_INDEX)
			{
				// Get Value
				// ...........................................
				CURRENT_CELL_VALUE = JOB_ORDER_DGV.CELL.VALUE
					(
						"REC_JORDER_DATE_COMPLETE", 
						ROW_INDEX
					);
				
				// Read Current Value
				// ...........................................
				if(JSVC_STR.VAR_IS_BLANK(CURRENT_CELL_VALUE) == false)
				{
					WEBTABLE_DATE = JSVC_DATE.VAR_TO_DATE(CURRENT_CELL_VALUE);			
				}
				else
				{
					WEBTABLE_DATE = null;
				}
				
				// 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")
					);				
				}			
				
				// Color Coding (Uncomment to use)
				// ...........................................	
				//JOB_ORDER_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#1cc88a"; // Safe
				//JOB_ORDER_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#5a5c69"; // Neutral
				//JOB_ORDER_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#f6c23e"; // Caution
				//JOB_ORDER_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#e74a3b"; // Warning
				
				// To next loop
				// ...........................................	
				ROW_INDEX ++;
			}			
		}
		if(JOB_ORDER_DGV.COLUMN.IS_EXISTS("REC_JORDER_DATETIME_A"))
		{
			WEBTABLE_DATE = null;
			ROW_INDEX = 0;
			while(JOB_ORDER_DGV.ROW.COUNT() > ROW_INDEX)
			{
				// Get Value
				// ...........................................
				CURRENT_CELL_VALUE = JOB_ORDER_DGV.CELL.VALUE
					(
						"REC_JORDER_DATETIME_A", 
						ROW_INDEX
					);
				
				// Read Current Value
				// ...........................................
				if(JSVC_STR.VAR_IS_BLANK(CURRENT_CELL_VALUE) == false)
				{
					WEBTABLE_DATE = JSVC_DATE.VAR_TO_DATE(CURRENT_CELL_VALUE);			
				}
				else
				{
					WEBTABLE_DATE = null;
				}
				
				// Apply CFormat, and DateFormat
				// ...........................................
				if(JSVC_VAR.VAR_ISSET(WEBTABLE_DATE))
				{
					JOB_ORDER_DGV.CELL.VALUE
					(
							"REC_JORDER_DATETIME_A", ROW_INDEX, 
							JSVC_DATE.VAR_FORMAT(WEBTABLE_DATE, "MMM DD, YYYY")
					);				
				}			
				
				// Color Coding (Uncomment to use)
				// ...........................................	
				//JOB_ORDER_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#1cc88a"; // Safe
				//JOB_ORDER_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#5a5c69"; // Neutral
				//JOB_ORDER_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#f6c23e"; // Caution
				//JOB_ORDER_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#e74a3b"; // Warning
				
				// To next loop
				// ...........................................	
				ROW_INDEX ++;
			}			
		}


		ROW_INDEX = 0;
		while(JOB_ORDER_DGV.ROW.COUNT() > 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, 'for Completion');
			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, 'Taken');
			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, 'Pending');
			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, 'Completed');

			ROW_INDEX ++;
		}

	};
	
	
	// ===============================================================
	// Request Search - PART.C
	// ===============================================================
	function HTTP_SEARCH_LIMITED_ROWS_CALLBACK(IS_SUCCESS, RESPONSE_STRING, ROW_INDEX)
	{
		// Disable Dialogs
		// _______________________________________________________________________
		CUS_SEND_DIALOG_TRY_DISMISS();
		
		// 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)
		{
			JOB_ORDER_DGV.ROW.CLEAR();
			return;
		}

		// Validate Row Count
		// _______________________________________________________________________	
		if(JOB_ORDER_DGV.ROW.COUNT() <= 0)
		{
			console.error("DataGridView has no rows to fill.");
			return;
		}
		JSVC_AV.VAR_VALIDATE_RANGE(ROW_INDEX, "ROW_INDEX", 0, JOB_ORDER_DGV.ROW.COUNT() - 1);
		
		// Populate DGV
		// _______________________________________________________________________
		JOB_ORDER_DGV.POPULATE_FROM_QUERY
		(
				JSON_OBJECT, 
				'',
				false,
				false,
				1,
				[2, 1],
				ROW_INDEX
		);
		
		
		// For Applying CFormat
		// _______________________________________________________________________	
		JOB_ORDER_DGV.COLUMN.CFORMAT("REC_JORDER_AMOUNT");
		
		
		// Initialize
		// _______________________________________________________________________	
		var WEBTABLE_DATE = null;
		var CURRENT_CELL_VALUE = null;
	
	
		// DateTime Format
		// _______________________________________________________________________	
		if(JOB_ORDER_DGV.COLUMN.IS_EXISTS("REC_JORDER_DATE_POST"))
		{
			WEBTABLE_DATE = null;
			// Get Value
			// ...........................................
			CURRENT_CELL_VALUE = JOB_ORDER_DGV.CELL.VALUE
				(
						"REC_JORDER_DATE_POST", 
						ROW_INDEX
				);
			
			// Read Current Value
			// ...........................................
			if(JSVC_STR.VAR_IS_BLANK(CURRENT_CELL_VALUE) == false)
			{
				WEBTABLE_DATE = JSVC_DATE.VAR_TO_DATE(CURRENT_CELL_VALUE);			
			}
			else
			{
				WEBTABLE_DATE = null;
			}
			
			// Apply CFormat, and DateFormat
			// ...........................................
			if(JSVC_VAR.VAR_ISSET(WEBTABLE_DATE))
			{
				JOB_ORDER_DGV.CELL.VALUE
				(
						"REC_JORDER_DATE_POST", ROW_INDEX, 
						JSVC_DATE.VAR_FORMAT(WEBTABLE_DATE, "MMM DD, YYYY")
				);				
			}			
			
			// Color Coding (Uncomment to use)
			// ...........................................	
			//JOB_ORDER_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#1cc88a"; // Safe
			//JOB_ORDER_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#5a5c69"; // Neutral
			//JOB_ORDER_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#f6c23e"; // Caution
			//JOB_ORDER_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#e74a3b"; // Warning
		}
		if(JOB_ORDER_DGV.COLUMN.IS_EXISTS("REC_JORDER_DATE_ASSIGN"))
		{
			WEBTABLE_DATE = null;
			// Get Value
			// ...........................................
			CURRENT_CELL_VALUE = JOB_ORDER_DGV.CELL.VALUE
				(
						"REC_JORDER_DATE_ASSIGN", 
						ROW_INDEX
				);
			
			// Read Current Value
			// ...........................................
			if(JSVC_STR.VAR_IS_BLANK(CURRENT_CELL_VALUE) == false)
			{
				WEBTABLE_DATE = JSVC_DATE.VAR_TO_DATE(CURRENT_CELL_VALUE);			
			}
			else
			{
				WEBTABLE_DATE = null;
			}
			
			// Apply CFormat, and DateFormat
			// ...........................................
			if(JSVC_VAR.VAR_ISSET(WEBTABLE_DATE))
			{
				JOB_ORDER_DGV.CELL.VALUE
				(
						"REC_JORDER_DATE_ASSIGN", ROW_INDEX, 
						JSVC_DATE.VAR_FORMAT(WEBTABLE_DATE, "MMM DD, YYYY")
				);				
			}			
			
			// Color Coding (Uncomment to use)
			// ...........................................	
			//JOB_ORDER_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#1cc88a"; // Safe
			//JOB_ORDER_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#5a5c69"; // Neutral
			//JOB_ORDER_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#f6c23e"; // Caution
			//JOB_ORDER_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#e74a3b"; // Warning
		}
		if(JOB_ORDER_DGV.COLUMN.IS_EXISTS("REC_JORDER_DATE_COMPLETE"))
		{
			WEBTABLE_DATE = null;
			// Get Value
			// ...........................................
			CURRENT_CELL_VALUE = JOB_ORDER_DGV.CELL.VALUE
				(
						"REC_JORDER_DATE_COMPLETE", 
						ROW_INDEX
				);
			
			// Read Current Value
			// ...........................................
			if(JSVC_STR.VAR_IS_BLANK(CURRENT_CELL_VALUE) == false)
			{
				WEBTABLE_DATE = JSVC_DATE.VAR_TO_DATE(CURRENT_CELL_VALUE);			
			}
			else
			{
				WEBTABLE_DATE = null;
			}
			
			// 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")
				);				
			}			
			
			// Color Coding (Uncomment to use)
			// ...........................................	
			//JOB_ORDER_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#1cc88a"; // Safe
			//JOB_ORDER_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#5a5c69"; // Neutral
			//JOB_ORDER_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#f6c23e"; // Caution
			//JOB_ORDER_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#e74a3b"; // Warning
		}

	};
	
				
	// ===============================================================
	// Begin Processing the Page
	// ===============================================================
	FORM_INITIALIZE();
	FORM_LOAD();