
var SEARCH_CMD = null;
var EXPORT_BBI = null;
var POS_SALE_LIST_DGV = null;
var TRANSFLOW_SMRY_DGV = null;

var SKIP = 0;


function FORM_INITIALIZE()
{
	if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_DATE_FROM_SALES_BY_PROD_DTP"))
	{
		JSOC_ELEMENT.VAR_VALUE("SEARCH_DATE_FROM_SALES_BY_PROD_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_PROD_DTP"))
	{
		JSOC_ELEMENT.VAR_VALUE("SEARCH_DATE_TO_SALES_BY_PROD_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"))
	{
		 SKIP = 0;
		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('TRANSFLOW_SMRY_DGV');
		};
	}	

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

	// Initialize: Input Controls
	// ...........................................
	if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_SALES_BY_PROD_ACC_GROUP_ID_CMB"))
	{
		SEARCH_SALES_BY_PROD_ACC_GROUP_ID_CMB = JSOC_ELEMENT.VAR_GET("SEARCH_SALES_BY_PROD_ACC_GROUP_ID_CMB");      
		SEARCH_SALES_BY_PROD_ACC_GROUP_ID_CMB.onchange = 
			function()
			{
				HTTP_LOAD_BRANCH_PRODUCTS(JSVC_NUM.VAR_NVALL(JSOC_ELEMENT.VAR_VALUE("SEARCH_SALES_BY_PROD_ACC_GROUP_ID_CMB")));
			};
	}
}