	// ===============================================================
	// Global Var
	// ===============================================================




	// ===============================================================
	// Initialize Controls
	// ===============================================================

	function FORM_INITIALIZE()
	{
		// Initialize: Ribbon Buttons [Cash In]
		// ...........................................
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("CASH_IN_BBI"))
		{
    		CASH_IN_BBI = JSOC_ELEMENT.VAR_GET("CASH_IN_BBI"); 

    		CASH_IN_BBI.onclick =
    			function()
    			{
    				if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("CASHIN_MODAL") == true)
					{
						JSOC_DIALOG.VAR_MODAL("CASHIN_MODAL", true);
						JSOC_ELEMENT.VAR_GET("CASHIN_MODAL").style.top = '20%';
						return;
					}
    			};
		}

		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SUBMIT_CASHIN_BBI"))
		{
    		SUBMIT_CASHIN_BBI = JSOC_ELEMENT.VAR_GET("SUBMIT_CASHIN_BBI"); 

    		var CALLBACK_HANDLER =
    			function(IS_SUCCESS)
    			{
    				if(IS_SUCCESS == false)
    				{
    					return;
    				}
    			};

    		SUBMIT_CASHIN_BBI.onclick =
    			function()
    			{
    				var FLAG = [];

    				if
					(
						JSOC_ELEMENT.VAR_ELEMENT_EXISTS("CASHIN_AMOUNT") == true &&
						JSVC_STR.VAR_IS_BLANK(JSOC_ELEMENT.VAR_VALUE("CASHIN_AMOUNT")) == true
					)
					{
						CASHIN_AMOUNT.classList.add('is-invalid');

						CASHIN_AMOUNT_ERROR.innerHTML = 'CASH IN AMOUNT IS REQUIRED';

						FLAG.push(false);
					}
					else
					{
						if(JSVC_NUM.VAR_NVALL(JSOC_ELEMENT.VAR_VALUE("CASHIN_AMOUNT")) <= 0) 
						{
							CASHIN_AMOUNT.classList.add('is-invalid');

							CASHIN_AMOUNT_ERROR.innerHTML = 'CASH IN AMOUNT MUST BE GREATER THAN 0';

							FLAG.push(false);
						}
						else
						{
							CASHIN_AMOUNT.classList.remove('is-invalid');
							FLAG.push(true);
						}
					}

					if(FLAG.includes(false) !== true)
					{
						HTTP_SAVE(1, CALLBACK_HANDLER);
						return;
					}
    			};
		}


		// Initialize: Ribbon Buttons [Cash Out]
		// ...........................................
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("CASH_OUT_BBI"))
		{
    		CASH_OUT_BBI = JSOC_ELEMENT.VAR_GET("CASH_OUT_BBI"); 

    		CASH_OUT_BBI.onclick =
    			function()
    			{
    				if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("CASHOUT_MODAL") == true)
					{
						JSOC_DIALOG.VAR_MODAL("CASHOUT_MODAL", true);
						JSOC_ELEMENT.VAR_GET("CASHOUT_MODAL").style.top = '20%';
						return;
					}
    			};
		}

		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SUBMIT_CASHOUT_BBI"))
		{
    		SUBMIT_CASHOUT_BBI = JSOC_ELEMENT.VAR_GET("SUBMIT_CASHOUT_BBI"); 

    		var CALLBACK_HANDLER =
    			function(IS_SUCCESS)
    			{
    				if(IS_SUCCESS == false)
    				{
    					return;
    				}
    			};

    		SUBMIT_CASHOUT_BBI.onclick =
    			function()
    			{
    				var FLAG = [];

    				if
					(
						JSOC_ELEMENT.VAR_ELEMENT_EXISTS("CASHOUT_AMOUNT") == true &&
						JSVC_STR.VAR_IS_BLANK(JSOC_ELEMENT.VAR_VALUE("CASHOUT_AMOUNT")) == true
					)
					{
						CASHOUT_AMOUNT.classList.add('is-invalid');

						CASHOUT_AMOUNT_ERROR.innerHTML = 'CASH OUT AMOUNT IS REQUIRED';

						FLAG.push(false);
					}
					else
					{
						if(JSVC_NUM.VAR_NVALL(JSOC_ELEMENT.VAR_VALUE("CASHOUT_AMOUNT")) <= 0) 
						{
							CASHOUT_AMOUNT.classList.add('is-invalid');

							CASHOUT_AMOUNT_ERROR.innerHTML = 'CASH OUT AMOUNT MUST BE GREATER THAN 0';

							FLAG.push(false);
						}
						else
						{
							CASHOUT_AMOUNT.classList.remove('is-invalid');
							FLAG.push(true);
						}
					}

					if(FLAG.includes(false) !== true)
					{
						HTTP_SAVE(2, CALLBACK_HANDLER);
						return;
					}
    			};
		}

		// Initialize: Ribbon Buttons [End Shift - Cash breakdown]
		// ...........................................
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SHIFT_END_BBI"))
		{
    		SHIFT_END_BBI = JSOC_ELEMENT.VAR_GET("SHIFT_END_BBI"); 

    		SHIFT_END_BBI.onclick =
    			function()
    			{
    				HTTP_PRINT_CASHBREAKDOWN
    				(
    					function(IS_SUCCESS) 
    					{
    						if(IS_SUCCESS == false)
    						{	
    							return;
    						}
    					}
    				);
    			};
		}

		// Initialize: Ribbon Buttons [End Shift 2]
		// ...........................................
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SHIFT_END_BBI_2"))
		{
    		SHIFT_END_BBI_2 = JSOC_ELEMENT.VAR_GET("SHIFT_END_BBI_2"); 

    		SHIFT_END_BBI_2.onclick =
    			function()
    			{
    				X_READING
    				(
    					function(IS_SUCCESS) 
    					{
    						if(IS_SUCCESS == true)
    						{
    							END_SHIFT();
    						}
    					}
    				);
    			};
		}


		// Prepare onChange event
		// ...........................................
		var ON_CHANGE_EVENT = '';

		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SHIFT_END_MODAL"))
		{
			$('input[id^="CASHBREAKDOWN_"]').on('keyup', function (e) {
				HTTP_CALCULATE_CASH($(this).attr('id'));
			});	
		}
	}