/**essentialdata_lib*/
//ȡʡ
function getProvinceOptions() {
	var dql = "$formname='province'";
	var datas = getOptionsByDQL(dql, "province", true);
	return datas;
}
//ȡʡby
function getProvinceOptionsByRegion(region) {
	var dql = "$formname='province' and region ='"+getItemValue(region)+"'";
	var datas = getOptionsByDQL(dql, "province", true);
	return datas;
}
//ʡֹ˾
function getBranchOptionsByRegion(region) {
	var dql = "$formname='branch' and region='"+getItemValue(region)+"'";
	var datas = getOptionsByDQL(dql, ["branchId","branchName"], true);
	return datas;
}



//ȡ
function getCityOptions() {
	var dql = "$formname='city'";
	var datas = getOptionsByDQL(dql, "city", true);
	return datas;
}
//ʡȡ
function getCityProOptions(province) {
	var dql = "$formname='city' and province='"+getItemValue(province)+"'";
	var datas = getOptionsByDQL(dql, "city", true);
	return datas;
}
//ȡ
function getRegionOptions() {
	var dql = "$formname='region'";
	var datas = getOptionsByDQL(dql, ["regionid","region"], true);
	return datas;
}
//ȡ
function getChannelOptions() {
	var dql = "$formname='channel'";
	var datas = getOptionsByDQL(dql, ["channelID","channelName"], true);
	return datas;
}

//,Ӽǰ
function getYearOptions(from, to) {
	var opts = $TOOLS.createOptions();
	opts.add("", "");
	var iYear = getYear($TOOLS.DATE_UTIL.getToday());
	for (var i = parseInt(from); i < parseInt(to); i++) {
		var year = iYear + i;
		opts.add(year, year);
	}
	return opts;
}
//ȡ
function getExpenseOptions() {
	var dql = "$formname='expensetype'";
	var datas = getOptionsByDQL(dql, ["expensetypeID","expensetype"], true);
	return datas;
}
//ȡͻŵ
function getStoreOptions(customerno){
	//var dql = "$formname = 'customerstores' and customerno='"+customerno+"'";
        var dql = "$formname = 'customerstores' and customerno='"+customerno+"' and use_status ='A'";
		var datas = getOptionsByDQL(dql,"storesname");	
	return datas;
}

//ȡͻŵ
function getStoreOptions2(customerno) {
	var opts = $TOOLS.createOptions();
	//opts.add("", "");
	var sql = "select top 10000 * from tlk_customerstores where item_customerno='" + customerno + "' and item_use_status ='A' order by item_storesname";
	var docs = queryBySQL(sql);
	for (var iter = docs.iterator(); iter.hasNext();) {
		var doc = iter.next();
		var value = "";
		var text = "";
		value = doc.getItemValueAsString("storesname");
		text = doc.getItemValueAsString("storesname");
		opts.add(text, value);
	}
	return opts;
}