You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

671 lines
26 KiB
JavaScript

12 months ago
var comboCustomer;//委托单位
var comboCodeSource;//市场来源
var comboDeptInfo;//所属部门
var comboOperator;//操作
var comboSale;//揽货人
var comboDoc;//单证
var comboCustService;//客服
var comboCustOperator;//客户操作
var comboCustFinancial;//客户财务
var comboShipper;//发货人
var comboConsignee;//收货人
var comboNotifyParty;//通知人
function $(id){
return document.getElementById(id);
}
function initCustomer(){
createComboCustomer();//创建委托单位
createComboCodeSource();//创建业务来源
createComboDeptInfo();//所属部门
createComboOperator();//操作
createComboSale();//揽货人
createComboDocument();//单证
createComboCustService();//客服
createComboCustOperator();//客户操作
createComboCustFinancial();//客户财务
}
function createComboCustomer(){//委托单位
comboCustomer = dhtmlXComboFromSelect("sel_customer");
comboCustomer.loadXML("../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0"+"&uid="+newGuid());
comboCustomer.attachEvent("onChange", function(){
comboCustomer.setComboText($("h_customer").value);
});
comboCustomer.attachEvent("onBlur", function(){
var s1 = comboCustomer.getComboText().trim();
var s2 = s1.indexOf("|");
if(s2>0){
s2=s2+2;
}
var s3 = s1.substring(s2);
if(s2>0){
comboCustomer.setComboText(s3);
$("h_customer").value=s3;
}
else
{
comboCustomer.setComboText($("h_customer").value);
}
});
comboCustomer.setComboText($("h_customer").value);
comboCustomer.attachEvent("onKeyPressed", function(keyCode){
if(keyCode!="8"){
var arrayArg = new Array();
setTimeout(function(){
var filterCount = 0;
var is = -1;
var ishd = $("h_customer").value.trim();
if("" != comboCustomer.getComboText().trim()){
while("undefined" != typeof comboCustomer.getOptionByIndex(filterCount)){
var comboValue = comboCustomer.getOptionByIndex(filterCount).text.toUpperCase();//.value;
var enterValue = comboCustomer.getComboText().trim().toUpperCase();
$("h_customer").value = comboCustomer.getComboText().trim().toUpperCase();
if(comboValue.indexOf(enterValue) == 0){
comboCustomer.selectOption(filterCount,true,true);
is=filterCount;
break;
}
++filterCount;
}
if(is==-1){
$("h_customer").value = ishd;
alert("无此内容,请重新选择!");
}
}
},10);
}
});
comboCustomer.attachEvent("onSelectionChange", function(){
$("h_customer").value = comboCustomer.getComboText().trim();
var customerVal = "";
if($("h_customer").value.trim() != ""){
var s1 = $("h_customer").value.trim();
var s2 = s1.indexOf("|");
if(s2>0){
s2=s2+2;
}
var s3 = s1.substring(s2);
customerVal = s3;
}
comboCustOperator.loadXML("../FeeCodes/opseaservices.aspx?handle=clientcontact&ctype=xml&pos=1&mask=1&utype=op&checkname="+customerVal+"&uid="+newGuid());
comboCustFinancial.loadXML("../FeeCodes/opseaservices.aspx?handle=clientcontact&ctype=xml&pos=1&mask=1&utype=finan&checkname="+customerVal+"&uid="+newGuid());
});
}
function createComboCodeSource(){//市场来源
comboCodeSource = dhtmlXComboFromSelect("sel_codesource");
comboCodeSource.loadXML("../FeeCodes/opseaservices.aspx?handle=codesource&ctype=xml&pos=1&mask=1"+"&uid="+newGuid());
comboCodeSource.attachEvent("onChange", function(){
comboCodeSource.setComboText($("h_codesource").value);
});
comboCodeSource.attachEvent("onBlur", function(){
var s1 = comboCodeSource.getComboText().trim();
var s2 = s1.indexOf("|");
if(s2>0){
s2=s2+2;
}
var s3 = s1.substring(s2);
if(s2>0){
comboCodeSource.setComboText(s3);
$("comboCodeSource").value=s3;
}
else
{
comboCodeSource.setComboText($("h_codesource").value);
}
});
comboCodeSource.setComboText($("h_codesource").value);
comboCodeSource.attachEvent("onKeyPressed", function(keyCode){
if(keyCode!="8"){
var arrayArg = new Array();
setTimeout(function(){
var filterCount = 0;
var is = -1;
var ishd = $("h_codesource").value.trim();
if("" != comboCodeSource.getComboText().trim()){
while("undefined" != typeof comboCodeSource.getOptionByIndex(filterCount)){
var comboValue = comboCodeSource.getOptionByIndex(filterCount).text.toUpperCase();//.value;
var enterValue = comboCodeSource.getComboText().trim().toUpperCase();
$("h_codesource").value = comboCodeSource.getComboText().trim().toUpperCase();
if(comboValue.indexOf(enterValue) == 0){
comboCodeSource.selectOption(filterCount,true,true);
is=filterCount;
break;
}
++filterCount;
}
if(is==-1){
$("h_codesource").value = ishd;
alert("无此内容,请重新选择!");
}
}
},10);
}
});
comboCodeSource.attachEvent("onSelectionChange", function(){
$("h_codesource").value = comboCodeSource.getComboText().trim();
});
}
//Trim
String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g,""); }
//所属部门
function createComboDeptInfo(){//所属部门
comboDeptInfo = dhtmlXComboFromSelect("sel_dept");
comboDeptInfo.loadXML("../FeeCodes/opseaservices.aspx?handle=deptinfo&ctype=xml&pos=1&mask=1"+"&uid="+newGuid());
comboDeptInfo.attachEvent("onChange", function(){
comboDeptInfo.setComboText($("h_deptinfo").value);
});
comboDeptInfo.attachEvent("onBlur", function(){
var s1 = comboDeptInfo.getComboText().trim();
var s2 = s1.indexOf("|");
if(s2>0){
s2=s2+2;
}
var s3 = s1.substring(s2);
if(s2>0){
comboDeptInfo.setComboText(s3);
$("comboDeptInfo").value=s3;
}
else
{
comboDeptInfo.setComboText($("h_deptinfo").value);
}
});
comboDeptInfo.setComboText($("h_deptinfo").value);
comboDeptInfo.attachEvent("onKeyPressed", function(keyCode){
if(keyCode!="8"){
var arrayArg = new Array();
setTimeout(function(){
var filterCount = 0;
var is = -1;
var ishd = $("h_deptinfo").value.trim();
if("" != comboDeptInfo.getComboText().trim()){
while("undefined" != typeof comboDeptInfo.getOptionByIndex(filterCount)){
var comboValue = comboDeptInfo.getOptionByIndex(filterCount).text.toUpperCase();//.value;
var enterValue = comboDeptInfo.getComboText().trim().toUpperCase();
$("h_deptinfo").value = comboDeptInfo.getComboText().trim().toUpperCase();
if(comboValue.indexOf(enterValue) == 0){
comboDeptInfo.selectOption(filterCount,true,true);
is=filterCount;
break;
}
++filterCount;
}
if(is==-1){
$("h_deptinfo").value = ishd;
alert("无此内容,请重新选择!");
}
}
},10);
}
});
comboDeptInfo.attachEvent("onSelectionChange", function(){
$("h_deptinfo").value = comboDeptInfo.getComboText().trim();
});
}
//操作
function createComboOperator(){//操作
comboOperator = dhtmlXComboFromSelect("sel_operator");
comboOperator.loadXML("../FeeCodes/opseaservices.aspx?handle=user&ctype=xml&pos=1&mask=1&utype=op"+"&uid="+newGuid());
comboOperator.attachEvent("onChange", function(){
comboOperator.setComboText($("h_operator").value);
});
comboOperator.attachEvent("onBlur", function(){
var s1 = comboOperator.getComboText().trim();
var s2 = s1.indexOf("|");
if(s2>0){
s2=s2+2;
}
var s3 = s1.substring(s2);
if(s2>0){
comboOperator.setComboText(s3);
$("comboOperator").value=s3;
}
else
{
comboOperator.setComboText($("h_operator").value);
}
});
comboOperator.setComboText($("h_operator").value);
comboOperator.attachEvent("onKeyPressed", function(keyCode){
if(keyCode!="8"){
var arrayArg = new Array();
setTimeout(function(){
var filterCount = 0;
var is = -1;
var ishd = $("h_operator").value.trim();
if("" != comboOperator.getComboText().trim()){
while("undefined" != typeof comboOperator.getOptionByIndex(filterCount)){
var comboValue = comboOperator.getOptionByIndex(filterCount).text.toUpperCase();//.value;
var enterValue = comboOperator.getComboText().trim().toUpperCase();
$("h_operator").value = comboOperator.getComboText().trim().toUpperCase();
if(comboValue.indexOf(enterValue) == 0){
comboOperator.selectOption(filterCount,true,true);
is=filterCount;
break;
}
++filterCount;
}
if(is==-1){
$("h_operator").value = ishd;
alert("无此内容,请重新选择!");
}
}
},10);
}
});
comboOperator.attachEvent("onSelectionChange", function(){
$("h_operator").value = comboOperator.getComboText().trim();
});
}
//揽货人
function createComboSale(){//揽货人
comboSale = dhtmlXComboFromSelect("sel_sale");
comboSale.loadXML("../FeeCodes/opseaservices.aspx?handle=user&ctype=xml&pos=1&mask=1&utype=sale"+"&uid="+newGuid());
comboSale.attachEvent("onChange", function(){
comboSale.setComboText($("h_sale").value);
});
comboSale.attachEvent("onBlur", function(){
var s1 = comboSale.getComboText().trim();
var s2 = s1.indexOf("|");
if(s2>0){
s2=s2+2;
}
var s3 = s1.substring(s2);
if(s2>0){
comboSale.setComboText(s3);
$("comboSale").value=s3;
}
else
{
comboSale.setComboText($("h_sale").value);
}
});
comboSale.setComboText($("h_sale").value);
comboSale.attachEvent("onKeyPressed", function(keyCode){
if(keyCode!="8"){
var arrayArg = new Array();
setTimeout(function(){
var filterCount = 0;
var is = -1;
var ishd = $("h_sale").value.trim();
if("" != comboSale.getComboText().trim()){
while("undefined" != typeof comboSale.getOptionByIndex(filterCount)){
var comboValue = comboSale.getOptionByIndex(filterCount).text.toUpperCase();//.value;
var enterValue = comboSale.getComboText().trim().toUpperCase();
$("h_sale").value = comboSale.getComboText().trim().toUpperCase();
if(comboValue.indexOf(enterValue) == 0){
comboSale.selectOption(filterCount,true,true);
is=filterCount;
break;
}
++filterCount;
}
if(is==-1){
$("h_sale").value = ishd;
alert("无此内容,请重新选择!");
}
}
},10);
}
});
comboSale.attachEvent("onSelectionChange", function(){
$("h_sale").value = comboSale.getComboText().trim();
});
}
//单证
function createComboDocument(){//单证
comboDoc = dhtmlXComboFromSelect("sel_doc");
comboDoc.loadXML("../FeeCodes/opseaservices.aspx?handle=user&ctype=xml&pos=1&mask=1&utype=doc"+"&uid="+newGuid());
comboDoc.attachEvent("onChange", function(){
comboDoc.setComboText($("h_doc").value);
});
comboDoc.attachEvent("onBlur", function(){
var s1 = comboDoc.getComboText().trim();
var s2 = s1.indexOf("|");
if(s2>0){
s2=s2+2;
}
var s3 = s1.substring(s2);
if(s2>0){
comboDoc.setComboText(s3);
$("comboDoc").value=s3;
}
else
{
comboDoc.setComboText($("h_doc").value);
}
});
comboDoc.setComboText($("h_doc").value);
comboDoc.attachEvent("onKeyPressed", function(keyCode){
if(keyCode!="8"){
var arrayArg = new Array();
setTimeout(function(){
var filterCount = 0;
var is = -1;
var ishd = $("h_doc").value.trim();
if("" != comboDoc.getComboText().trim()){
while("undefined" != typeof comboDoc.getOptionByIndex(filterCount)){
var comboValue = comboDoc.getOptionByIndex(filterCount).text.toUpperCase();//.value;
var enterValue = comboDoc.getComboText().trim().toUpperCase();
$("h_doc").value = comboDoc.getComboText().trim().toUpperCase();
if(comboValue.indexOf(enterValue) == 0){
comboDoc.selectOption(filterCount,true,true);
is=filterCount;
break;
}
++filterCount;
}
if(is==-1){
$("h_doc").value = ishd;
alert("无此内容,请重新选择!");
}
}
},10);
}
});
comboDoc.attachEvent("onSelectionChange", function(){
$("h_doc").value = comboDoc.getComboText().trim();
});
}
//客服
function createComboCustService(){//客服
comboCustService = dhtmlXComboFromSelect("sel_custservice");
comboCustService.loadXML("../FeeCodes/opseaservices.aspx?handle=user&ctype=xml&pos=1&mask=1&utype=cust"+"&uid="+newGuid());
comboCustService.attachEvent("onChange", function(){
comboCustService.setComboText($("h_custservice").value);
});
comboCustService.attachEvent("onBlur", function(){
var s1 = comboCustService.getComboText().trim();
var s2 = s1.indexOf("|");
if(s2>0){
s2=s2+2;
}
var s3 = s1.substring(s2);
if(s2>0){
comboCustService.setComboText(s3);
$("comboCustService").value=s3;
}
else
{
comboCustService.setComboText($("h_custservice").value);
}
});
comboCustService.setComboText($("h_custservice").value);
comboCustService.attachEvent("onKeyPressed", function(keyCode){
if(keyCode!="8"){
var arrayArg = new Array();
setTimeout(function(){
var filterCount = 0;
var is = -1;
var ishd = $("h_custservice").value.trim();
if("" != comboCustService.getComboText().trim()){
while("undefined" != typeof comboCustService.getOptionByIndex(filterCount)){
var comboValue = comboCustService.getOptionByIndex(filterCount).text.toUpperCase();//.value;
var enterValue = comboCustService.getComboText().trim().toUpperCase();
$("h_custservice").value = comboCustService.getComboText().trim().toUpperCase();
if(comboValue.indexOf(enterValue) == 0){
comboCustService.selectOption(filterCount,true,true);
is=filterCount;
break;
}
++filterCount;
}
if(is==-1){
$("h_custservice").value = ishd;
alert("无此内容,请重新选择!");
}
}
},10);
}
});
comboCustService.attachEvent("onSelectionChange", function(){
$("h_custservice").value = comboCustService.getComboText().trim();
});
}
//客户操作
function createComboCustOperator(){//客户操作
comboCustOperator = dhtmlXComboFromSelect("sel_custoperator");
var customerVal = "";
if($("h_customer").value.trim() != ""){
customerVal = $("h_customer").value.trim();
}
comboCustOperator.loadXML("../FeeCodes/opseaservices.aspx?handle=clientcontact&ctype=xml&pos=1&mask=1&utype=op&checkname="+customerVal+"&uid="+newGuid());
comboCustOperator.attachEvent("onChange", function(){
comboCustOperator.setComboText($("h_custoperator").value);
});
comboCustOperator.attachEvent("onBlur", function(){
var s1 = comboCustOperator.getComboText().trim();
var s2 = s1.indexOf("|");
if(s2>0){
s2=s2+2;
}
var s3 = s1.substring(s2);
if(s2>0){
comboCustOperator.setComboText(s3);
$("comboCustOperator").value=s3;
}
else
{
comboCustOperator.setComboText($("h_custoperator").value);
}
});
comboCustOperator.setComboText($("h_custoperator").value);
comboCustOperator.attachEvent("onKeyPressed", function(keyCode){
if(keyCode!="8"){
var arrayArg = new Array();
setTimeout(function(){
var filterCount = 0;
var is = -1;
var ishd = $("h_custoperator").value.trim();
if("" != comboCustOperator.getComboText().trim()){
while("undefined" != typeof comboCustOperator.getOptionByIndex(filterCount)){
var comboValue = comboCustOperator.getOptionByIndex(filterCount).text.toUpperCase();//.value;
var enterValue = comboCustOperator.getComboText().trim().toUpperCase();
$("h_custoperator").value = comboCustOperator.getComboText().trim().toUpperCase();
if(comboValue.indexOf(enterValue) == 0){
comboCustOperator.selectOption(filterCount,true,true);
is=filterCount;
break;
}
++filterCount;
}
if(is==-1){
$("h_custoperator").value = ishd;
alert("无此内容,请重新选择!");
}
}
},10);
}
});
comboCustOperator.attachEvent("onSelectionChange", function(){
$("h_custoperator").value = comboCustOperator.getComboText().trim();
});
}
//客户财务
function createComboCustFinancial(){//客户财务
comboCustFinancial = dhtmlXComboFromSelect("sel_custfinancial");
var customerVal = "";
if($("h_customer").value.trim() != ""){
customerVal = $("h_customer").value.trim();
}
comboCustFinancial.loadXML("../FeeCodes/opseaservices.aspx?handle=clientcontact&ctype=xml&pos=1&mask=1&utype=finan&checkname="+customerVal+"&uid="+newGuid());
comboCustFinancial.attachEvent("onChange", function(){
comboCustFinancial.setComboText($("h_custfinancial").value);
});
comboCustFinancial.attachEvent("onBlur", function(){
var s1 = comboCustFinancial.getComboText().trim();
var s2 = s1.indexOf("|");
if(s2>0){
s2=s2+2;
}
var s3 = s1.substring(s2);
if(s2>0){
comboCustFinancial.setComboText(s3);
$("comboCustFinancial").value=s3;
}
else
{
comboCustFinancial.setComboText($("h_custfinancial").value);
}
});
comboCustFinancial.setComboText($("h_custfinancial").value);
comboCustFinancial.attachEvent("onKeyPressed", function(keyCode){
if(keyCode!="8"){
var arrayArg = new Array();
setTimeout(function(){
var filterCount = 0;
var is = -1;
var ishd = $("h_custfinancial").value.trim();
if("" != comboCustFinancial.getComboText().trim()){
while("undefined" != typeof comboCustFinancial.getOptionByIndex(filterCount)){
var comboValue = comboCustFinancial.getOptionByIndex(filterCount).text.toUpperCase();//.value;
var enterValue = comboCustFinancial.getComboText().trim().toUpperCase();
$("h_custfinancial").value = comboCustFinancial.getComboText().trim().toUpperCase();
if(comboValue.indexOf(enterValue) == 0){
comboCustFinancial.selectOption(filterCount,true,true);
is=filterCount;
break;
}
++filterCount;
}
if(is==-1){
$("h_custfinancial").value = ishd;
alert("无此内容,请重新选择!");
}
}
},10);
}
});
comboCustFinancial.attachEvent("onSelectionChange", function(){
$("h_custfinancial").value = comboCustFinancial.getComboText().trim();
});
}
//发货人Shipper
function createComboShipper(){//客户财务
comboCustFinancial = dhtmlXComboFromSelect("sel_custfinancial");
var customerVal = "";
if($("h_customer").value.trim() != ""){
customerVal = $("h_customer").value.trim();
}
comboCustFinancial.loadXML("../FeeCodes/opseaservices.aspx?handle=clientinfo&ctype=xml&pos=1&mask=1&utype=finan&checkname="+customerVal+"&uid="+newGuid());
comboCustFinancial.attachEvent("onChange", function(){
comboCustFinancial.setComboText($("h_custfinancial").value);
});
comboCustFinancial.attachEvent("onBlur", function(){
var s1 = comboCustFinancial.getComboText().trim();
var s2 = s1.indexOf("|");
if(s2>0){
s2=s2+2;
}
var s3 = s1.substring(s2);
if(s2>0){
comboCustFinancial.setComboText(s3);
$("comboCustFinancial").value=s3;
}
else
{
comboCustFinancial.setComboText($("h_custfinancial").value);
}
});
comboCustFinancial.setComboText($("h_custfinancial").value);
comboCustFinancial.attachEvent("onKeyPressed", function(keyCode){
if(keyCode!="8"){
var arrayArg = new Array();
setTimeout(function(){
var filterCount = 0;
var is = -1;
var ishd = $("h_custfinancial").value.trim();
if("" != comboCustFinancial.getComboText().trim()){
while("undefined" != typeof comboCustFinancial.getOptionByIndex(filterCount)){
var comboValue = comboCustFinancial.getOptionByIndex(filterCount).text.toUpperCase();//.value;
var enterValue = comboCustFinancial.getComboText().trim().toUpperCase();
$("h_custfinancial").value = comboCustFinancial.getComboText().trim().toUpperCase();
if(comboValue.indexOf(enterValue) == 0){
comboCustFinancial.selectOption(filterCount,true,true);
is=filterCount;
break;
}
++filterCount;
}
if(is==-1){
$("h_custfinancial").value = ishd;
alert("无此内容,请重新选择!");
}
}
},10);
}
});
comboCustFinancial.attachEvent("onSelectionChange", function(){
$("h_custfinancial").value = comboCustFinancial.getComboText().trim();
});
}
//获取GUID
function newGuid()
{
var guid = "";
for (var i = 1; i <= 32; i++){
var n = Math.floor(Math.random()*16.0).toString(16);
guid += n;
if((i==8)||(i==12)||(i==16)||(i==20))
guid += "-";
}
return guid.toUpperCase();
}