
var SEARCH_CMD = null;
var EXPORT_BBI = null;
var JOB_ORDER_DGV = null;

var G_ROW_INDEX = 0;
var NEW_COL_CTR = 0;

var SEARCH_SALES_BY_CUST_ACC_GROUP_ID_CMB = null;

function FORM_INITIALIZE()
{
	if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_DATE_FROM_SALES_BY_CUST_DTP"))
	{
		JSOC_ELEMENT.VAR_VALUE("SEARCH_DATE_FROM_SALES_BY_CUST_DTP", JSVC_DATE.VAR_FORMAT(JSVC_DATE.VAR_ADD('DAY', 1, JSVC_DATE.VAR_BEGIN_OF_MONTH(JSVC_DATE.VAR_NOW())), "YYYY-MM-DD") + "T00:00");
	}

	if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_DATE_TO_SALES_BY_CUST_DTP"))
	{
		JSOC_ELEMENT.VAR_VALUE("SEARCH_DATE_TO_SALES_BY_CUST_DTP", JSVC_DATE.VAR_FORMAT(JSVC_DATE.VAR_ADD('DAY', 0, JSVC_DATE.VAR_NOW()), "YYYY-MM-DD") + "T00:00");
	}

	// Initialize: Ribbon Buttons [Add Search]
	// ...........................................
	if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_CMD"))
	{
		SEARCH_CMD = JSOC_ELEMENT.VAR_GET("SEARCH_CMD");
		SEARCH_CMD.onclick = function(){HTTP_SEARCH()};
	}
	
	// Initialize: Ribbon Buttons [Add Search]
	// ...........................................
	if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("EXPORT_BBI"))
	{
		EXPORT_BBI = JSOC_ELEMENT.VAR_GET("EXPORT_BBI");
		EXPORT_BBI.onclick = function()
		{
			JSRC_EXCEL.REF_EXPORT('JOB_ORDER_DGV');
		};
	}

	if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_SALES_BY_CUST_ACC_GROUP_ID_CMB"))
	{
		SEARCH_SALES_BY_CUST_ACC_GROUP_ID_CMB = JSOC_ELEMENT.VAR_GET("SEARCH_SALES_BY_CUST_ACC_GROUP_ID_CMB");      	
		SEARCH_SALES_BY_CUST_ACC_GROUP_ID_CMB.onchange = 
			function()
			{
				if(SEARCH_SALES_BY_CUST_ACC_GROUP_ID_CMB.disabled == false)
				{
					LOAD_PRODUCT();
				}
			};
		SEARCH_SALES_BY_CUST_ACC_GROUP_ID_CMB.onkeypress = function(){SEARCH_SALES_BY_CUST_ACC_GROUP_ID_CMB.onchange();};
		SEARCH_SALES_BY_CUST_ACC_GROUP_ID_CMB.onpaste = function(){SEARCH_SALES_BY_CUST_ACC_GROUP_ID_CMB.onchange();};
		//REC_POSRESERVE_ACC_GROUP_ID_CMB.oninput = function(){REC_POSRESERVE_ACC_GROUP_ID_CMB.onchange();};							
	}
}