	// ===============================================================
	// 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_CAT_BANK_ID, 1, 1))
		{
			return;
		}
		
		
		// Load DB data of item
		// ...........................................
		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._CATEGORY._BANK.CUS_GET_THEN_POPULATE_FORM
		(
			function()
			{
				CUS_SEND_DIALOG_TRY_DISMISS();
				
				/*
				JSOC_IMAGE.VAR_SRC_WITH_PROGRESS
				(
					'QR_IMAGE_IMG', 
					'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEAAAAALAAAAAABAAEAAAI=', 
					JSCUS_CACHE.SERVER_URL + '/System/image/qrcode?PARAM_QRCODE=' + JSOC_ELEMENT.VAR_VALUE("CAT_BANK_ID") + '&PARAM_SIZE=10', 
					JSCUS_CACHE.SERVER_URL + '/res/lib/dlg/noimage.png'
				);
				*/
				
				if(JSVC_VAR.VAR_ISSET(CALLBACK_FUNCTION))
				{
					CALLBACK_FUNCTION();
				}
			},
			
			"BANK_MODAL", 
			FLAG_TINYINT_NULL, 
			PROPERTY_CAT_BANK_ID
		);
		
		
		// Clear Changes due to loading
		// ...........................................
		
		
	}


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


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

		
	// ===============================================================
	// Request Save
	// ===============================================================
	function HTTP_SAVE(CALLBACK_METHOD)
	{

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


		// Validate Null [String Input]
		// _______________________________________________________________________
		if(JSOC_INPUT_TEXT.CTL_VALIDATE(CAT_BANK_CODE_TXT, "Code", null, 1, 150) == false)
		{
			CAT_BANK_CODE_TXT.style.borderColor = JSCUS_CACHE.SITE_ON_ERROR_BORDER_COLOR;
			CAT_BANK_CODE_TXT.focus();
			return false;
		}
		if(JSOC_INPUT_TEXT.CTL_VALIDATE(CAT_BANK_DESCRIPTION_TXT, "Description", null, 1, 150) == false)
		{
			CAT_BANK_DESCRIPTION_TXT.style.borderColor = JSCUS_CACHE.SITE_ON_ERROR_BORDER_COLOR;
			CAT_BANK_DESCRIPTION_TXT.focus();
			return false;
		}
		
		
		// Validate Zero [Numeric Input]
		// _______________________________________________________________________
	
	
		// Validate Negative [Numeric Input]
		// _______________________________________________________________________
		
		
		// Validate Range [Numeric Input]
		// _______________________________________________________________________	


		// Foreign key check
		// _______________________________________________________________________
		

		// Validate Duplicates
		// _______________________________________________________________________
		var EXCEPTION_ROW_INDEX = -1;
		if(PROPERTY_CAT_BANK_ID >= 0)
		{
			EXCEPTION_ROW_INDEX = PROPERTY_EDIT_ROW_INDEX;
		}
			

		
		
		// Password Items (if available)
		// _______________________________________________________________________
		
		
		// CheckBox Items (if available)
		// _______________________________________________________________________

	
		// File is required
		// _______________________________________________________________________
		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("PARAM_CAT_BANK_ID_FILE_FP") &&
			PARAM_CAT_BANK_ID_FILE_FP.files.length <= 0
		)
		{
			JSOC_DIALOG.VAR_MESSAGE_BOX
			(
				JSVC_ERROR.VAR_ARGUMENT_EXCEPTION_MISSING_INPUT("Upload File", false), 
				'Information',
				'OK', 'WARNING',
				function(MESSAGE_RESPONSE)
				{
					PARAM_CAT_BANK_ID_FILE_FP.style.borderColor = JSCUS_CACHE.SITE_ON_ERROR_BORDER_COLOR;
					CALLBACK_METHOD(false);
				}
			);		
			return;	
		}
		
	
		// File is too large (Sample Code : 3mb)
		// _______________________________________________________________________
		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("PARAM_CAT_BANK_ID_FILE_FP") &&
			PARAM_CAT_BANK_ID_FILE_FP.files[0].size > 1024 * 1024 * 3
		)
		{
			JSOC_DIALOG.VAR_MESSAGE_BOX
			(
				'Selected file is too large. File size is restricted to 3mb or below',
				'Information',
				'OK', 'ERROR',
				function()
				{
					CALLBACK_METHOD(false);
				}
			);	
		   PARAM_CAT_BANK_ID_FILE_FP.value = "";
		   return;
		};
		
		 

		
		// Save item [Prepare]
		// _______________________________________________________________________
		var SAVE_MAP_ARRAY = JSCUS_SQL._CATEGORY._BANK.CUS_PREPARE_MAPPED_ARRAY_FOR_SAVE();
		// JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_PARENT_ID', PROPERTY_PARENT_ID);		// Parent ID Sample
		// JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_PARENT_ID', INPUT_FILE_ELEMENT_FP);		// File Upload Sample
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_CAT_BANK_ID", PROPERTY_CAT_BANK_ID);				
		
			
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_CAT_BANK_CODE", JSOC_ELEMENT.VAR_VALUE(CAT_BANK_CODE_TXT));					
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_CAT_BANK_DESCRIPTION", JSOC_ELEMENT.VAR_VALUE(CAT_BANK_DESCRIPTION_TXT));					
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_CAT_BANK_REMARKS", JSOC_ELEMENT.VAR_VALUE(CAT_BANK_REMARKS_TXT));					
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_CAT_BANK_STATUS", JSVC_NUM.VAR_NVALL(JSOC_CMB.VAR_SELECTED_VALUE(CAT_BANK_STATUS_CMB)));
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("PARAM_CAT_BANK_ID_FILE_FP"))
		{
			JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_CAT_BANK_ID_FILE", PARAM_CAT_BANK_ID_FILE_FP);
		}
		
		
		// Declare Post Request Handler
		// _______________________________________________________________________
		var RESPONSE_HANDLER = 			
			function(IS_SUCCESS, HTTP_RESPONSE)
			{
				// Disable Dialogs
				// ...........................................
				CUS_SEND_DIALOG_TRY_DISMISS();
				
				// Handle Error
				// ...........................................
				if(IS_SUCCESS === false)
				{
					METHOD_UNABLE_TO_SEND_REQUEST(CALLBACK_METHOD);	
					return;
				}
				
				// Catch JSON Error
				// ...........................................
				else if(JSRC_JSON.REF_IS_JSTRING(HTTP_RESPONSE) == false)
				{
					METHOD_SERVER_ISSUE(CALLBACK_METHOD, HTTP_RESPONSE);
					return;			
				}
					
				// Read Response
				// ...........................................
				else
				{
					// Load Response
					var JSON_OBJECT = JSRC_JSON.REF_CREATE(HTTP_RESPONSE);
					if(JSRC_JSON.REF_IS_SUCCESS(JSON_OBJECT) === false)
					{
						METHOD_REQUEST_FAILURE(CALLBACK_METHOD, JSON_OBJECT);
						return;
					}
					
			
					// Post Save Action
					else
					{				
						// Update Changes to DataGridView
						if(PROPERTY_CAT_BANK_ID > 0)
						{
							HTTP_SEARCH(PROPERTY_CAT_BANK_ID, PROPERTY_EDIT_ROW_INDEX);
						}
						
						// Load new item into the DataGridView
						else
						{
							// Retrieve Inserted ID
							PROPERTY_CAT_BANK_ID = JSVC_NUM.VAR_NVALL(JSRC_JSON.REF_READ(JSON_OBJECT, "INSERTED_ID", "1"));
							
							// Add new line
							BANK_DGV.ROW.INSERT_AT(0);
							HTTP_SEARCH(PROPERTY_CAT_BANK_ID, 0);
						}	

						// Lift edit and Exit EditMode
						EDIT_HANDLER.REF_IS_MODIFIED = false;
						EDIT_HANDLER.HAS_NEWLY_SAVED_DATA = true;			
						if
						(
							JSOC_ELEMENT.VAR_ELEMENT_EXISTS('BANK_MODAL') == true
						)
						{
							JSOC_DIALOG.VAR_MODAL('BANK_MODAL', false);
						}
						
						//SWAP_EDIT_MODE(false);
						CALLBACK_METHOD(true);											
					}
				}
			};
			
			
		// Save Item [Send Request]
		// _______________________________________________________________________
		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._CATEGORY._BANK.CUS_SAVE 
		(
			SAVE_MAP_ARRAY,
			RESPONSE_HANDLER
		);
		
	}
	
	
	// ===============================================================
	// Request Delete
	// ===============================================================
	function HTTP_DELETE(CALLBACK_METHOD, ROW_INDEX)
	{
		// Escape if Disabled
		// _______________________________________________________________________
		if(JSVC_VAR.VAR_ISSET(DELETE_BBI) && DELETE_BBI.Enabled == false)
		{
			CALLBACK_METHOD(false);
			return;
		}

		// Escape if nothing selected
		// _______________________________________________________________________
		if(ROW_INDEX < 0)
		{
			JSVC_ERROR.VAR_ARGUMENT_EXCEPTION_NOTHING_SELECTED(true);
			CALLBACK_METHOD(false);
			return;
		}
		
		// Initialize
		// _______________________________________________________________________
		var DELETE_ITEM_DESCRIPTION = BANK_DGV.CELL.VALUE('CAT_BANK_DESCRIPTION', ROW_INDEX);
		
		// Should not edit a System Generated items.
		// _______________________________________________________________________
		if 
		(
			JSVC_NUM.VAR_NVALI(BANK_DGV.CELL.VALUE('CAT_BANK_SYSTEM_GENERATED', ROW_INDEX)) == JSCUS_SQL._SYSTEM._STATUS.STATUS_ACTIVE
		)
		{
			JSOC_DIALOG.VAR_MESSAGE_BOX
				(
					'Request denied: This item is system generated.',
					'Information',
					'OK', 'WARNING',
					function()
					{
						CALLBACK_METHOD(false);
					}
				);	
			return;		
		}	
		
		
		// Declare Post Request Handler
		// _______________________________________________________________________
		var RESPONSE_HANDLER = function
		(
			IS_SUCCESS, 
			HTTP_RESPONSE
		)
		{
			// Disable Dialogs
			// ...........................................
			CUS_SEND_DIALOG_TRY_DISMISS();
				
				
			// Handle Error
			// ...........................................
			if(IS_SUCCESS === false)
			{
				METHOD_UNABLE_TO_SEND_REQUEST(CALLBACK_METHOD);
				return;
			}
			
			// Catch JSON Error
			// ...........................................
			else if(JSRC_JSON.REF_IS_JSTRING(HTTP_RESPONSE) == false)
			{
				METHOD_SERVER_ISSUE(CALLBACK_METHOD, HTTP_RESPONSE);
				return;			
			}
			
			
			// Read Response
			// ...........................................
			else
			{
				// Load Response
				var JSON_OBJECT = JSRC_JSON.REF_CREATE(HTTP_RESPONSE);
				if(JSRC_JSON.REF_IS_SUCCESS(JSON_OBJECT) === false)
				{
					METHOD_REQUEST_FAILURE(CALLBACK_METHOD, JSON_OBJECT);
					return;
				}
				
				// Post Delete Action
				else
				{
					BANK_DGV.ROW.REMOVE_AT(ROW_INDEX);
					BANK_DGV.COLUMN.ROW_COUNT_PRINT('ROW_COUNT');
					JSVC_INFO.VAR_RECORD_DELETED
					(
						DELETE_ITEM_DESCRIPTION, 
						function()
						{
							CALLBACK_METHOD(true);
						}
					);		
				}
			}
		};
		
		
		// Request User Verification for Delete
		// _______________________________________________________________________
		JSVC_INFO.VAR_VERIFY_DELETE
		(
			DELETE_ITEM_DESCRIPTION,
			function(VERIFY_RESULT) 
			{
				// Abort if rejected by user.
				// ...........................................
				if(VERIFY_RESULT != JSOC_DIALOG.MSGBOX_YES)
				{

					CALLBACK_METHOD(false);
					return;
				}
				
				
				//Delete Item
				// ...........................................
				JSOC_DIALOG.VAR_LOADING_SPINNER(true);
				JSCUS_SQL._CATEGORY._BANK.CUS_DELETE
				(
					BANK_DGV.CELL.VALUE('CAT_BANK_ID', ROW_INDEX),
					RESPONSE_HANDLER
				)
			}
		);
	}
	
	
	// ===============================================================
	// Request Void
	// ===============================================================
	function HTTP_VOID(CALLBACK_METHOD, ROW_INDEX)
	{
		
		// Escape if Disabled
		// _______________________________________________________________________
		if
		(
			JSVC_VAR.VAR_ISSET(BANK_DGV.CELL.ELEMENT('CAT_BANK_STATUS', ROW_INDEX)) && 
			BANK_DGV.CELL.ELEMENT('CAT_BANK_STATUS', ROW_INDEX).Enabled == false
		)
		{
			CALLBACK_METHOD(false);
			return;
		}

		// Escape if nothing selected
		// _______________________________________________________________________
		if(ROW_INDEX < 0)
		{
			JSVC_ERROR.VAR_ARGUMENT_EXCEPTION_NOTHING_SELECTED(true);
			CALLBACK_METHOD(false);
			return;
		}
		
		// Abort if already Voided (Status = 3)
		// _______________________________________________________________________
		if(BANK_DGV.CELL.VALUE('CAT_BANK_STATUS', ROW_INDEX) == 3)
		{
			JSOC_DIALOG.VAR_MESSAGE_BOX
			(
				'This item is already Voided', 
				'Information',
				'OK', 'INFO',
				null
			);		
			return;
		}		
		
		// Notify User to Void	
		// _______________________________________________________________________
		JSOC_DIALOG.VAR_MESSAGE_BOX
		(
			'Do you want to void the selected item?', 
			'Information',
			'YESNO', 'QUESTION',
			function(VERIFY_RESULT)
			{
				if(VERIFY_RESULT == JSOC_DIALOG.MSGBOX_YES)
				{
					PROPERTY_REC_VOUCHER_ID = BANK_DGV.CELL.VALUE('4660', ROW_INDEX);
					PROPERTY_EDIT_ROW_INDEX = ROW_INDEX;
					HTTP_LOAD
					(
						function()
						{
							JSOC_CMB.VAR_SELECTED_VALUE(CAT_BANK_STATUS_CMB, 3);
							JSOC_DIALOG.VAR_MODAL("BANK_MODAL", true);
							EDIT_HANDLER.REF_IS_MODIFIED = true;				
						}
					);
				}
			}
		);
		
	}