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

	// ===============================================================
	// EditHandler Flags
	// ===============================================================	
	function HTTP_LOAD(CALLBACK_FUNCTION)
	{
		// Escape if new item
		// ...........................................
		if(JSRC_FLAG.IS_NULL_BIGINT(PROPERTY_REC_CHLDCOLLECT_ID, 1, 1))
		{
			return;
		}
		
		
		// Load DB data of item
		// ...........................................
		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._RECORD._CHILD_COLLECTION.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("REC_CHLDCOLLECT_ID") + '&PARAM_SIZE=10', 
					JSCUS_CACHE.SERVER_URL + '/res/lib/dlg/noimage.png'
				);
				*/
				
				if(JSVC_VAR.VAR_ISSET(CALLBACK_FUNCTION))
				{
					CALLBACK_FUNCTION();
				}
			},
			
			"CHILD_COLLECTION_MODAL", 
			FLAG_TINYINT_NULL, 
			PROPERTY_REC_CHLDCOLLECT_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(REC_CHLDCOLLECT_DESCRIPTION_TXT);
		
		
		// Fix Numeric Fields (if field type is not number.)
		// ...........................................
			JSOC_INPUT_TEXT.CTL_NVAL(REC_CHLDCOLLECT_LINKSVR_ACC_GROUP_ID_TXT);
			if(JSOC_ELEMENT.VAR_TYPE_IS(REC_CHLDCOLLECT_AMOUNT_TXT, 'input', 'number'))
			{
				JSOC_INPUT_TEXT.CTL_NVAL(REC_CHLDCOLLECT_AMOUNT_TXT);
			}
			else
			{
				JSOC_INPUT_TEXT.CTL_CFORMAT(REC_CHLDCOLLECT_AMOUNT_TXT);
			}			


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

		
	// ===============================================================
	// Request Save
	// ===============================================================
	function HTTP_SAVE(CALLBACK_METHOD)
	{
		// Initialize
		// _______________________________________________________________________
		var REC_CHLDCOLLECT_AMOUNT_TXT = JSOC_ELEMENT.VAR_GET('REC_CHLDCOLLECT_AMOUNT_TXT');
		
		
		// Validate Negative [Numeric Input]
		// _______________________________________________________________________
		if(JSOC_INPUT_TEXT.CTL_NVAL(REC_CHLDCOLLECT_AMOUNT_TXT) <= 0)
		{
			JSOC_DIALOG.VAR_MESSAGE_BOX
			(
				'Invalid Amount.', 
				'Information',
				'OK', 'WARNING',
				function(MESSAGE_RESPONSE)
				{
					REC_CHLDCOLLECT_AMOUNT_TXT.style.borderColor = JSCUS_CACHE.SITE_ON_ERROR_BORDER_COLOR;
					REC_CHLDCOLLECT_AMOUNT_TXT.focus();
					CALLBACK_METHOD(false);
				}
			);	
			return;			
		}
		
		
		// Save item [Prepare]
		// _______________________________________________________________________
		var SAVE_MAP_ARRAY = JSCUS_SQL._RECORD._CHILD_COLLECTION.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_REC_CHLDCOLLECT_ID", PROPERTY_REC_CHLDCOLLECT_ID);				
		
			
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_CHLDCOLLECT_REC_POSDEVICE_ID", PROPERTY_CURRENT_POSDEVICE_ID);
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_CHLDCOLLECT_ACC_LINKSVR_ID", JSOC_ELEMENT.VAR_VALUE('REC_CHLDCOLLECT_ACC_LINKSVR_ID_TXT'));
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_CHLDCOLLECT_LINKSVR_ACC_GROUP_ID", JSOC_ELEMENT.VAR_VALUE('REC_CHLDCOLLECT_LINKSVR_ACC_GROUP_ID_TXT'));
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_CHLDCOLLECT_LINKSVR_DATE", JSVC_DATE.VAR_FORMAT(JSVC_DATE.VAR_END_OF_DAY(JSOC_ELEMENT.VAR_VALUE('REC_CHLDCOLLECT_LINKSVR_DATE_DTP')), "YYYY-MM-DD HH:mm:ss") + '.999999');
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_CHLDCOLLECT_DESCRIPTION", JSOC_ELEMENT.VAR_VALUE('REC_CHLDCOLLECT_DESCRIPTION_TXT'));					
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_CHLDCOLLECT_AMOUNT", JSVC_NUM.VAR_NVAL(JSOC_ELEMENT.VAR_VALUE(REC_CHLDCOLLECT_AMOUNT_TXT)));	
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_CHLDCOLLECT_REMARKS", JSOC_ELEMENT.VAR_VALUE(REC_CHLDCOLLECT_REMARKS_TXT));	

		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_CHLDCOLLECT_LINKSVR_PAID_BANK", JSVC_NUM.VAR_NVAL(JSOC_ELEMENT.VAR_VALUE(REC_EODREP_ZREAD_PAID_BANK_TXT)));	
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_CHLDCOLLECT_LINKSVR_PAID_CASH", JSVC_NUM.VAR_NVAL(JSOC_ELEMENT.VAR_VALUE(REC_EODREP_ZREAD_PAID_CASH_TXT)));	
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_CHLDCOLLECT_LINKSVR_PAID_CARD", JSVC_NUM.VAR_NVAL(JSOC_ELEMENT.VAR_VALUE(REC_EODREP_ZREAD_PAID_CARD_TXT)));	
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_CHLDCOLLECT_LINKSVR_PAID_CHECK", JSVC_NUM.VAR_NVAL(JSOC_ELEMENT.VAR_VALUE(REC_EODREP_ZREAD_PAID_CHECK_TXT)));	
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_CHLDCOLLECT_LINKSVR_PAID_LOYALTY", JSVC_NUM.VAR_NVAL(JSOC_ELEMENT.VAR_VALUE(REC_EODREP_ZREAD_PAID_LOYALTY_TXT)));	
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_CHLDCOLLECT_LINKSVR_PAID_VOUCHER", JSVC_NUM.VAR_NVAL(JSOC_ELEMENT.VAR_VALUE(REC_EODREP_ZREAD_PAID_VOUCHER_TXT)));	
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_CHLDCOLLECT_LINKSVR_PAID_OTHER", JSVC_NUM.VAR_NVAL(JSOC_ELEMENT.VAR_VALUE(REC_EODREP_ZREAD_PAID_OTHER_TXT)));	
				
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_REC_CHLDCOLLECT_STATUS", 2);

		
		
		// Declare Post Request Handler
		// _______________________________________________________________________
		var RESPONSE_HANDLER = 			
			function(IS_SUCCESS, HTTP_RESPONSE)
			{
				// Disable Dialogs
				// ...........................................
				CUS_SEND_DIALOG_TRY_DISMISS();
				
				// Handle Error
				// ...........................................
				if(IS_SUCCESS === false)
				{
					METHOD_UNABLE_TO_SEND_REQUEST(CALLBACK_METHOD);	
					return;
				}
				
				// Catch JSON Error
				// ...........................................
				else if(JSRC_JSON.REF_IS_JSTRING(HTTP_RESPONSE) == false)
				{
					METHOD_SERVER_ISSUE(CALLBACK_METHOD, HTTP_RESPONSE);
					return;			
				}
					
				// Read Response
				// ...........................................
				else
				{
					// Load Response
					var JSON_OBJECT = JSRC_JSON.REF_CREATE(HTTP_RESPONSE);
					if(JSRC_JSON.REF_IS_SUCCESS(JSON_OBJECT) === false)
					{
						METHOD_REQUEST_FAILURE(CALLBACK_METHOD, JSON_OBJECT);
						return;
					}
					
			
					// Post Save Action
					else
					{				
						// Lift edit and Exit EditMode
						// ...........................................
						EOD_ZREADING_DGV.CELL.VALUE
						(
							'REC_CHLDCOLLECT_AMOUNT', PROPERTY_EDIT_ROW_INDEX,
							JSVC_NUM.VAR_CFORMAT
							(
								JSVC_NUM.VAR_NVAL(EOD_ZREADING_DGV.CELL.VALUE('REC_CHLDCOLLECT_AMOUNT', PROPERTY_EDIT_ROW_INDEX)) +
								JSVC_NUM.VAR_NVAL(JSOC_ELEMENT.VAR_VALUE(REC_CHLDCOLLECT_AMOUNT_TXT))
							)
						);

						// Check if fully paid
						// ...........................................
						if
						(
							JSVC_NUM.VAR_NVAL(EOD_ZREADING_DGV.CELL.VALUE('REC_CHLDCOLLECT_AMOUNT', PROPERTY_EDIT_ROW_INDEX)) >= 
							JSVC_NUM.VAR_NVAL
							(
								EOD_ZREADING_DGV.CELL.VALUE('REC_POSSALE_PAID', PROPERTY_EDIT_ROW_INDEX)
							)
						)
						{
							EOD_ZREADING_DGV.CELL.VALUE('PAYMENT_STATUS',  PROPERTY_EDIT_ROW_INDEX, 'Collected');
							EOD_ZREADING_DGV.CELL.ELEMENT('PAY_BBI',  PROPERTY_EDIT_ROW_INDEX).disabled = true;
							EOD_ZREADING_DGV.ROW.ELEMENT(PROPERTY_EDIT_ROW_INDEX).style.color = '#28a745';
						}
						
						// Partial
						// ...........................................
						else
						{
							EOD_ZREADING_DGV.CELL.VALUE('PAYMENT_STATUS',  PROPERTY_EDIT_ROW_INDEX, 'Partially Paid');
							EOD_ZREADING_DGV.CELL.ELEMENT('PAY_BBI',  PROPERTY_EDIT_ROW_INDEX).disabled = false;
						}


						//SWAP_EDIT_MODE(false);
						JSOC_DIALOG.VAR_MODAL("CHILD_COLLECTION_MODAL", false);
						CALLBACK_METHOD(true);											
					}
				}
			};
			
			
		// Save Item [Send Request]
		// _______________________________________________________________________
		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._RECORD._CHILD_COLLECTION.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 = CHILD_COLLECTION_DGV.CELL.VALUE('REC_CHLDCOLLECT_DESCRIPTION', ROW_INDEX);
		
		
		
		// Declare Post Request Handler
		// _______________________________________________________________________
		var RESPONSE_HANDLER = function
		(
			IS_SUCCESS, 
			HTTP_RESPONSE
		)
		{
			// Disable Dialogs
			// ...........................................
			CUS_SEND_DIALOG_TRY_DISMISS();
				
				
			// Handle Error
			// ...........................................
			if(IS_SUCCESS === false)
			{
				METHOD_UNABLE_TO_SEND_REQUEST(CALLBACK_METHOD);
				return;
			}
			
			// Catch JSON Error
			// ...........................................
			else if(JSRC_JSON.REF_IS_JSTRING(HTTP_RESPONSE) == false)
			{
				METHOD_SERVER_ISSUE(CALLBACK_METHOD, HTTP_RESPONSE);
				return;			
			}
			
			
			// Read Response
			// ...........................................
			else
			{
				// Load Response
				var JSON_OBJECT = JSRC_JSON.REF_CREATE(HTTP_RESPONSE);
				if(JSRC_JSON.REF_IS_SUCCESS(JSON_OBJECT) === false)
				{
					METHOD_REQUEST_FAILURE(CALLBACK_METHOD, JSON_OBJECT);
					return;
				}
				
				// Post Delete Action
				else
				{
					CHILD_COLLECTION_DGV.ROW.REMOVE_AT(ROW_INDEX);
					CHILD_COLLECTION_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._RECORD._CHILD_COLLECTION.CUS_DELETE
				(
					CHILD_COLLECTION_DGV.CELL.VALUE('REC_CHLDCOLLECT_ID', ROW_INDEX),
					RESPONSE_HANDLER
				)
			}
		);
	};
	
	
	// ===============================================================
	// Request Void
	// ===============================================================
	function HTTP_VOID(CALLBACK_METHOD, ROW_INDEX)
	{
		
		// Escape if Disabled
		// _______________________________________________________________________
		if
		(
			JSVC_VAR.VAR_ISSET(CHILD_COLLECTION_DGV.CELL.ELEMENT('REC_CHLDCOLLECT_STATUS', ROW_INDEX)) && 
			CHILD_COLLECTION_DGV.CELL.ELEMENT('REC_CHLDCOLLECT_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(CHILD_COLLECTION_DGV.CELL.VALUE('REC_CHLDCOLLECT_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 = CHILD_COLLECTION_DGV.CELL.VALUE('5878', ROW_INDEX);
					PROPERTY_EDIT_ROW_INDEX = ROW_INDEX;
					HTTP_LOAD
					(
						function()
						{
							JSOC_CMB.VAR_SELECTED_VALUE(REC_CHLDCOLLECT_STATUS_CMB, 3);
							JSOC_DIALOG.VAR_MODAL("CHILD_COLLECTION_MODAL", true);
							EDIT_HANDLER.REF_IS_MODIFIED = true;				
						}
					);
				}
			}
		);
		
	};