	// ===============================================================
	// Global Var
	// ===============================================================
	SUPPORTED_LINKS = [];
	SUPPORTED_LINKS.push(''); 																				// Desktop
			
	SUPPORTED_LINKS.push('REP_TRANSACTION_HISTORY_LNK, REP_INVENTORY_SUMMARY_LNK'); 						// Water:Hub 
	SUPPORTED_LINKS.push('REP_TRANSACTION_HISTORY_LNK, REP_STOCK_CARD_LNK, REP_INVENTORY_SUMMARY_LNK, REP_RESERVATION_SUMMARY_LNK'); 	// Water:Cashier
	SUPPORTED_LINKS.push('REP_DELIVERY_LNK, REP_STOCK_FOR_RETURN_LNK'); 									// Water:Rider
	SUPPORTED_LINKS.push('');																				// sa
	SUPPORTED_LINKS.push('');																				// Trucking

	SUPPORTED_LINKS.push('REP_TRANSACTION_HISTORY_LNK, REP_STOCK_CARD_LNK, REP_INVENTORY_SUMMARY_LNK'); 	// Bakery

	SUPPORTED_LINKS.push(''); 																				// Resto:Cashier
	SUPPORTED_LINKS.push(''); 																				// Resto:Waiter


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

	function FORM_INITIALIZE()
	{
		// Initialize: Ribbon Buttons [Transaction History]
		// ...........................................
		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("REP_TRANSACTION_HISTORY_LNK") &&
			JSVC_STR.VAR_CONTAINS
			(
				SUPPORTED_LINKS[JSCUS_CACHE.LOGIN_CLASS], 
				"REP_TRANSACTION_HISTORY_LNK", false
			)		
		)
		{
			JSOC_STYLE.VAR_DISPLAY("REP_TRANSACTION_HISTORY_LNK", "DEFAULT");
		}
		
		
		// Initialize: Ribbon Buttons [Stock card]
		// ...........................................
		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("REP_STOCK_CARD_LNK") &&
			JSVC_STR.VAR_CONTAINS
			(
				SUPPORTED_LINKS[JSCUS_CACHE.LOGIN_CLASS], 
				"REP_STOCK_CARD_LNK", false
			)
		)
		{
			JSOC_STYLE.VAR_DISPLAY("REP_STOCK_CARD_LNK", "DEFAULT");
		}
		

		// Initialize: Ribbon Buttons [Inventory Summary]
		// ...........................................
		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("REP_INVENTORY_SUMMARY_LNK") &&
			JSVC_STR.VAR_CONTAINS
			(
				SUPPORTED_LINKS[JSCUS_CACHE.LOGIN_CLASS], 
				"REP_INVENTORY_SUMMARY_LNK", false
			) 
		)
		{
			JSOC_STYLE.VAR_DISPLAY("REP_INVENTORY_SUMMARY_LNK", "DEFAULT");
		}
		
		// Initialize: Ribbon Buttons [Reservation Summary]
		// ...........................................
		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("REP_RESERVATION_SUMMARY_LNK") &&
			JSVC_STR.VAR_CONTAINS
			(
				SUPPORTED_LINKS[JSCUS_CACHE.LOGIN_CLASS], 
				"REP_RESERVATION_SUMMARY_LNK", false
			) 
		)
		{
			JSOC_STYLE.VAR_DISPLAY("REP_RESERVATION_SUMMARY_LNK", "DEFAULT");
		}

		// Initialize: Ribbon Buttons [Delivery Report]
		// ...........................................
		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("REP_DELIVERY_LNK") &&
			JSVC_STR.VAR_CONTAINS
			(
				SUPPORTED_LINKS[JSCUS_CACHE.LOGIN_CLASS], 
				"REP_DELIVERY_LNK", false
			)
		)
		{
			JSOC_STYLE.VAR_DISPLAY("REP_DELIVERY_LNK", "DEFAULT");
		}
				
		// Initialize: Ribbon Buttons [Stocks for Return]
		// ...........................................
		if
		(
			JSOC_ELEMENT.VAR_ELEMENT_EXISTS("REP_STOCK_FOR_RETURN_LNK") &&				
			JSVC_STR.VAR_CONTAINS
			(
				SUPPORTED_LINKS[JSCUS_CACHE.LOGIN_CLASS], 
				"REP_STOCK_FOR_RETURN_LNK", false
			)
		)
		{
			JSOC_STYLE.VAR_DISPLAY("REP_STOCK_FOR_RETURN_LNK", "DEFAULT");
		}	

				
		// Initialize: Ribbon Buttons [Cashflow]
		// ...........................................
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("CASHFLOW_BBI"))
		{
    		CASHFLOW_BBI = JSOC_ELEMENT.VAR_GET("CASHFLOW_BBI"); 

    		CASHFLOW_BBI.onclick =
    			function()
    			{
    				HTTP_PRINT_CASHFLOW();
    			};
		}


		// Initialize: Ribbon Buttons [Z Read]
		// ...........................................
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("ZREAD_BBI"))
		{
    		ZREAD_BBI = JSOC_ELEMENT.VAR_GET("ZREAD_BBI"); 

    		ZREAD_BBI.onclick =
    			function()
    			{
    				if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("ZREADING_MODAL") == true)
					{
						JSOC_DIALOG.VAR_INPUT_BOX
						(
							'Enter PIN:', 
							'Z-READING', 
							'',
							true,
							function(RESULT_STRING, IS_SUCCESS)
							{
								if(IS_SUCCESS == false)
								{
									return;
								}
								
								JSRC_ENCRYPT.REF_AUTHENTICATOR_VALIDATE
								(
									RESULT_STRING, 
									JSOC_ELEMENT.VAR_VALUE('ANDRC_DEVICE_MODEL') + ' ' + JSOC_ELEMENT.VAR_VALUE('ANDRC_DEVICE_ID'), 
									30, 
									function(AUTH_RESULT)
									{
										if(AUTH_RESULT)
										{
											JSOC_ELEMENT.VAR_VALUE('ZREADING_FROM_DATE', JSVC_DATE.VAR_FORMAT(JSVC_DATE.VAR_NOW(), "YYYY-MM-DD"));
											JSOC_DIALOG.VAR_MODAL("ZREADING_MODAL", true);
											return;							
										}	
										else
										{
											alert('Invalid PIN');
										}
									}
								);
							}		
						);
					}
    			};
		}


		// Initialize: Ribbon Buttons [Print Z Read]
		// ...........................................
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("PRINT_ZREAD_BBI"))
		{
    		PRINT_ZREAD_BBI = JSOC_ELEMENT.VAR_GET("PRINT_ZREAD_BBI"); 

    		PRINT_ZREAD_BBI.onclick =
    			function()
    			{
    				//SAVE_EOD(JSOC_ELEMENT.VAR_VALUE('ZREADING_FROM_DATE'));
    				//console.log(JSOC_ELEMENT.VAR_VALUE('ZREADING_FROM_DATE'));
    				//console.log(JSVC_DATE.VAR_FORMAT(JSVC_DATE.VAR_NOW(), "YYYY-MM-DD"));
    				//console.log(JSOC_ELEMENT.VAR_VALUE('ZREADING_FROM_DATE') >= JSVC_DATE.VAR_FORMAT(JSVC_DATE.VAR_NOW(), "YYYY-MM-DD"));

    				//back date
    				if((JSOC_ELEMENT.VAR_VALUE('ZREADING_FROM_DATE') >= JSVC_DATE.VAR_FORMAT(JSVC_DATE.VAR_NOW(), "YYYY-MM-DD")) == false)
    				{
    					SAVE_EOD(JSOC_ELEMENT.VAR_VALUE('ZREADING_FROM_DATE'));
    				}
    				else 
    				{
    					if((JSOC_ELEMENT.VAR_VALUE('ZREADING_FROM_DATE') == JSVC_DATE.VAR_FORMAT(JSVC_DATE.VAR_NOW(), "YYYY-MM-DD")) == true)
    					{
    						CHECK_CURRENT_SHIFT
		    				(
		    					function(IS_SUCCESS)
		    					{
		    						if(IS_SUCCESS == false)
		    						{
		    							JSOC_DIALOG.VAR_MESSAGE_BOX
										(
											'You have an open shift. Please end your shift before generating the Z Reading report.',
											'Information',
											'OK', 'ERROR',
											function() {}
										);
		    						}
		    						else
		    						{
		    							//check if zreading has been generated already
										/*CHECK_ZREAD_EXIST
						    			(
						    				function(IS_SUCCESS)
						    				{
						    					if(IS_SUCCESS == true)
						    					{
						    						PRELOAD_LOCK_POS_SCREEN();

						    						JSOC_DIALOG.VAR_MESSAGE_BOX
													(
														'You cannot transact any further, Z Reading report has been generated.',
														'Information',
														'OK', 'ERROR',
														function() {}
													);
						    					}
						    					else
						    					{
						    						SAVE_EOD(JSOC_ELEMENT.VAR_VALUE('ZREADING_FROM_DATE'));
						    					}
						    				}
						    			);*/

						    			SAVE_EOD(JSOC_ELEMENT.VAR_VALUE('ZREADING_FROM_DATE'));
		    						}
		    					}
		    				);
    					}
    					else
    					{
    						JSOC_DIALOG.VAR_MESSAGE_BOX
							(
								'You cannot generate report for future dates.',
								'Information',
								'OK', 'ERROR',
								function() {}
							);
    					}
    				}
    			};
		}


		// 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();
    						}
    					}
    				);
    			};
		}

		// Initialize: Ribbon Buttons [X Read]
		// ...........................................
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("XREAD_BBI"))
		{
    		XREAD_BBI = JSOC_ELEMENT.VAR_GET("XREAD_BBI"); 
			
			var XREAD_ONCLICK_ACTUAL_FUNCTION = function()
			{
				if(JSVC_ARR.VAR_EMPTY(CACHE_ARRAY_SHIFT_ID))
				{
					alert("CONNECTION ERROR: \n" + "There is no available shift to generate reading.");
					return;	
				}
				
				JSOC_DIALOG.VAR_SELECT_BOX
				(
					'Select Shift :', 
					'X-Reading', 
					CACHE_ARRAY_SHIFT_ID,
					CACHE_ARRAY_SHIFT_DESCRIPTION,
					null,
					function (CMB_INDEX, CMB_VALUE, IS_SUCCESS)
					{
						if(IS_SUCCESS)
						{
							X_READING
							(
								null, 
								CACHE_ARRAY_SHIFT_START[CMB_INDEX], 
								CACHE_ARRAY_SHIFT_END[CMB_INDEX]
							);
						}	
					}
				);				
			};
			
			var XREAD_ONCLICK_VALIDATOR = function()
			{
				JSOC_DIALOG.VAR_INPUT_BOX
				(
					'Enter PIN:', 
					'Z-READING', 
					'',
					true,
					function(RESULT_STRING, IS_SUCCESS)
					{
						if(IS_SUCCESS == false)
						{
							return;
						}
						
						JSRC_ENCRYPT.REF_AUTHENTICATOR_VALIDATE
						(
							RESULT_STRING, 
							JSOC_ELEMENT.VAR_VALUE('ANDRC_DEVICE_MODEL') + ' ' + JSOC_ELEMENT.VAR_VALUE('ANDRC_DEVICE_ID'), 
							30, 
							function(AUTH_RESULT)
							{
								if(AUTH_RESULT == false)
								{
									alert('Invalid PIN');	
									return;				
								}	

								XREAD_ONCLICK_ACTUAL_FUNCTION();
								return;		
							}
						);
					}		
				);				
			};
			
    		XREAD_BBI.onclick =
    			function()
    			{
					XREAD_ONCLICK_VALIDATOR();
    			};
		}

		

		// 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'));
			});
		}
	};