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.

792 lines
28 KiB
JavaScript

10 months ago

var commonGridObj_WmsRatelist;
var comboGoods;//货物
var strbsno="";
var changeRateCount = 0;
var newRateCount;//
var pressRecord;
var pressCount=0;
function $(id){
return document.getElementById(id);
}
function initGrid()
{
//屏蔽onclick事件
//header
var headerArgs_fee = new Array("<input type=\"checkbox\" id=\"ck_all\" onclick=\"checkAll('ck_all')\" />","级别","计费区间","单价","单位","备注","创建人","创建时间","委托单号");
//width
var widthArgs_fee= new Array("40","60","60","150","100","150","100","100","0");
//column align
var colAlignArgs_fee = new Array("center","center","center","center","center","center","center","center","center");
//column sort
var colSortArgs_fee = new Array("na","str","str","str","str","str","str","str","str");
//column type
var colTypeArgs_fee = new Array("ch","ro","ed","ed","ro","ed","ro","ro","ro");
commonGridObj_WmsRatelist = new TGridCommon("mygrid_container_rate","form1",headerArgs_fee,widthArgs_fee,colAlignArgs_fee,colSortArgs_fee,colTypeArgs_fee);
commonGridObj_WmsRatelist.setResponseUrl("../SeaiInfoLCL/WmsRateLCLGridSource.aspx");
strbsno=$("h_bsno").value;
commonGridObj_WmsRatelist.setRequest("../SeaiInfoLCL/WmsRateLCLGridSource.aspx?handle=getrate&bsno="+strbsno+"&cus="+escape($("h_cust").value)+"&show_page=15&cur_page=1");
commonGridObj_WmsRatelist.setSourceType("json");
commonGridObj_WmsRatelist.setSkin("xp");
commonGridObj_WmsRatelist.setImageUrl("../images/");
commonGridObj_WmsRatelist.initGrid();
commonGridObj_WmsRatelist.bind();
commonGridObj_WmsRatelist.getGridObj().enableEditEvents(true,false,true);
commonGridObj_WmsRatelist.getGridObj().enableKeyboardSupport(true);
commonGridObj_WmsRatelist.getGridObj().enableMultiselect(true);
commonGridObj_WmsRatelist.getGridObj().attachEvent("onEditCell",function(stage,rId,cInd,nValue,oValue){
var newCheckValue = false;
//初始化状态
if(stage == 0){
return true;
}//stage == 0
var txtEdit;
if(stage == 1){
for(i = 0; i < document.all.length; i++){
if(document.all(i).tagName == "TEXTAREA"){
txtEdit = document.all(i);
txtEdit.focus();
txtEdit.select();
break;
}
}
} //stage == 1
if(stage == 2){
if(oValue==null || oValue=="" || oValue=="0"){
return true;
}
if( cInd == 2 || cInd == 3 ){ //
commonGridObj_WmsRatelist.getGridObj().cellById(rId,cInd).setLabel(nValue);
return true;
}
else if( cInd == 5 ){
commonGridObj_WmsRatelist.getGridObj().cellById(rId,cInd).setValue(nValue);
return true;
}
}//stage == 2
}); //onEditCell end
//键盘操作事件
commonGridObj_WmsRatelist.getGridObj().attachEvent("onKeyPress", function(code,cFlag,sFlag){
//onKeyPress begin
//获取当前RowID
var selectedId = commonGridObj_WmsRatelist.getGridObj().getSelectedRowId();
//获取当前RowIndex
var rowIndex = commonGridObj_WmsRatelist.getGridObj().getRowIndex(selectedId);
//获取当前CellIndex(ind)
var ind = commonGridObj_WmsRatelist.getGridObj().getSelectedCellIndex();
//触发操作事件前获取单元值
var oldVal = commonGridObj_WmsRatelist.getGridObj().cellByIndex(rowIndex,ind).getValue();
//获取编辑单元
var txtEdit;
for(i = 0; i < document.all.length; i++){
if(document.all(i).tagName == "TEXTAREA"){
txtEdit = document.all(i);
break;
}
}
//enter 键
if(code == 13){
if(ind == 2 || ind == 3 || ind == 5){
return true;
}
}//enter 键 end
//Tab键
if(code == 9){
//code9 begin
commonGridObj_WmsRatelist.getGridObj().editStop(true);
if(ind==2){
commonGridObj_WmsRatelist.getGridObj().cellByIndex(rowIndex,ind).setLabel(oldVal);
commonGridObj_WmsRatelist.getGridObj().selectCell(rowIndex,3,true,true);
commonGridObj_WmsRatelist.getGridObj().editCell();
}
else if(ind==3){
commonGridObj_WmsRatelist.getGridObj().cellByIndex(rowIndex,ind).setLabel(oldVal);
commonGridObj_WmsRatelist.getGridObj().selectCell(rowIndex,5,true,true);
commonGridObj_WmsRatelist.getGridObj().editCell();
}
else if(ind==5){
commonGridObj_WmsRatelist.getGridObj().cellByIndex(rowIndex,ind).setValue(oldVal);
commonGridObj_WmsRatelist.getGridObj().selectCell(rowIndex,2,true,true);
commonGridObj_WmsRatelist.getGridObj().editCell();
}
} //cdoe9 end
//向下方向键
if(code == 40){
//code40 begin
if(ind == 0 || ind == 2 || ind == 3 || ind == 5){
var rowCount = commonGridObj_WmsRatelist.getGridObj().getRowsNum();
commonGridObj_WmsRatelist.getGridObj().editStop(true);
if(ind == 2 || ind==3){
commonGridObj_WmsRatelist.getGridObj().cellByIndex(rowIndex,ind).setLabel(oldVal);
}
else if(ind == 5){
commonGridObj_WmsRatelist.getGridObj().cellByIndex(rowIndex,ind).setValue(oldVal);
}
var grade=commonGridObj_WmsRatelist.getGridObj().cellByIndex(rowIndex,1).getValue();
var rownum=commonGridObj_WmsRatelist.getGridObj().cellByIndex(rowIndex,3).getValue();
if(rowIndex == rowCount-1){
if( rownum!=0 || grade==1){
addRecvRow_2();
}
}else{
commonGridObj_WmsRatelist.getGridObj().selectCell(rowIndex+1,2,true,true);
commonGridObj_WmsRatelist.getGridObj().editCell();
}
}
return true;
}//code40 end
//向上箭头
if(code == 38){
//code38 begin
if(ind == 0 || ind == 2 || ind == 3 || ind == 5){
if(rowIndex > 0){
commonGridObj_WmsRatelist.getGridObj().editStop(true);
if(ind == 2 || ind==3){
commonGridObj_WmsRatelist.getGridObj().cellByIndex(rowIndex,ind).setLabel(oldVal);
commonGridObj_WmsRatelist.getGridObj().selectCell(rowIndex-1,2,true,true);
commonGridObj_WmsRatelist.getGridObj().editCell();
}
else if(ind == 5){
commonGridObj_WmsRatelist.getGridObj().cellByIndex(rowIndex,ind).setValue(oldVal);
commonGridObj_WmsRatelist.getGridObj().selectCell(rowIndex-1,2,true,true);
commonGridObj_WmsRatelist.getGridObj().editCell();
}
var rownum=commonGridObj_WmsRatelist.getGridObj().cellByIndex(rowIndex,3).getValue();
if(rownum==0)
{
commonGridObj_WmsRatelist.getGridObj().deleteRow(selectedId)
newRateCount--;
}
}
}
return true;
}//code38 end
//左箭头
if(code == 37){
//code37 begin
commonGridObj_WmsRatelist.getGridObj().editStop(true);
if(ind == 2){
commonGridObj_WmsRatelist.getGridObj().cellByIndex(rowIndex,ind).setLabel(oldVal);
commonGridObj_WmsRatelist.getGridObj().selectCell(rowIndex,5,true,true);
commonGridObj_WmsRatelist.getGridObj().editCell();
}
else if(ind == 3){
commonGridObj_WmsRatelist.getGridObj().cellByIndex(rowIndex,ind).setLabel(oldVal);
commonGridObj_WmsRatelist.getGridObj().selectCell(rowIndex,2,true,true);
commonGridObj_WmsRatelist.getGridObj().editCell();
}
else if(ind == 5){
commonGridObj_WmsRatelist.getGridObj().cellByIndex(rowIndex,ind).setValue(oldVal);
commonGridObj_WmsRatelist.getGridObj().selectCell(rowIndex,3,true,true);
commonGridObj_WmsRatelist.getGridObj().editCell();
}
}//code37 end
//右箭头
if(code == 39){
//code39 begin
commonGridObj_WmsRatelist.getGridObj().editStop(true);
if(ind == 2){
commonGridObj_WmsRatelist.getGridObj().cellByIndex(rowIndex,ind).setLabel(oldVal);
commonGridObj_WmsRatelist.getGridObj().selectCell(rowIndex,3,true,true);
commonGridObj_WmsRatelist.getGridObj().editCell();
}
else if(ind == 3){
commonGridObj_WmsRatelist.getGridObj().cellByIndex(rowIndex,ind).setLabel(oldVal);
commonGridObj_WmsRatelist.getGridObj().selectCell(rowIndex,5,true,true);
commonGridObj_WmsRatelist.getGridObj().editCell();
}
else if(ind == 5){
commonGridObj_WmsRatelist.getGridObj().cellByIndex(rowIndex,ind).setValue(oldVal);
commonGridObj_WmsRatelist.getGridObj().selectCell(rowIndex,2,true,true);
commonGridObj_WmsRatelist.getGridObj().editCell();
}
}//code39 end
//键盘输入数字
if(code >= 48 && code <= 57|| code >= 96 && code <= 105 || code == 188|| code == 110|| code == 190 || code == 229){
if( ind == 2 || ind == 3 || ind == 5){
return true;
}
}
if (code >= 65 && code <= 90) {//如果是输入英文字符
if( ind == 2 || ind==3 || ind==5 ){
return true;
}
}
if(code == 8){
//code8 begin
if(ind == 2 || ind == 3 || ind == 5){
var start=0;
var end=0;
if(document.selection){
var range = document.selection.createRange();
if(range.parentElement().className == txtEdit.className){
var range_all = document.body.createTextRange();
range_all.moveToElementText(txtEdit);
for (start=0; range_all.compareEndPoints("StartToStart", range) < 0; start++){
range_all.moveStart('character', 1);
}
for (var i = 0; i <= start; i ++){
if (txtEdit.value.charAt(i) == '\n')
start++;
}
var range_all = document.body.createTextRange();
range_all.moveToElementText(txtEdit);
for (end = 0; range_all.compareEndPoints('StartToEnd', range) < 0; end ++)
range_all.moveStart('character', 1);
for (var i = 0; i <= end; i ++){
if (txtEdit.value.charAt(i) == '\n')
end ++;
}
}
}
// alert(start);alert(end);
//未选中多个字符
if(start == end){
if(start != 0){
if(pressRecord!=null){
var firstVal = pressRecord.substring(0,start - 1);
var endVal = pressRecord.substring(start + 1,txtEdit.value.length - 1);
pressRecord = firstVal;
}
}
}
//选中多个字符
if(start != end){
if(pressRecord!=null){
var firstVal = pressRecord.substring(0,start);
var endVal = pressRecord.substring(end - 1,txtEdit.value.length - 1);
pressRecord = firstVal+endVal;
}
}
setTimeout(function(){
if(pressRecord!=null){
if(pressRecord.trim().length > 0){
var combo = commonGridObj_WmsRatelist.getCustomCombo(selectedId,ind);
var comboArg = combo.getKeys();
var count = 0;
for(var i = 0;i<comboArg.length;i++){
if(combo.get(comboArg[i]).toUpperCase().trim().indexOf(pressRecord) == 0){
count++;
var oldVal = comboArg[i];
var oldLab = combo.get(comboArg[i]);
pressCount = 3;
commonGridObj_WmsRatelist.editStop(true);
commonGridObj_WmsRatelist.cellByIndex(rowIndex,ind).setValue(oldVal);
commonGridObj_WmsRatelist.selectCell(rowIndex,ind,true,true);
commonGridObj_WmsRatelist.editCell();
var old_length = oldLab.length;
for(i = 0; i < document.all.length; i++){
if(document.all(i).tagName == "TEXTAREA"){
txtEdit = document.all(i);
var rt = txtEdit.createTextRange();
rt.collapse();
rt.select();//光标置最前
var r = document.selection.createRange();
r.collapse(false);
r.moveStart("character", pressRecord.length);//从m位开始
r.moveEnd("character", old_length);//选取n位
//txtEdit.focus();
r.select();
}
}
break;
}
}
}}
},1000);
return true;
}else{
return true;
}
//code8 end
}
});
}//end initGrid()
function initCombo(){//初始化Combo
initComboGoods();//货物描述类型
}
//function createComboBsType(){//业务类型
// comboBsType = dhtmlXComboFromSelect("sel_bstype");
//}
function initComboGoods(){//货物描述类型ok
comboGoods = new TCombo("sel_goods", "../SeaiInfoLCL/WmsRateLCLGridSource.aspx?handle=goodslist", true, true, false, true, "h_goods");
comboGoods.initComboEvent();
comboGoods.bind();
if($("h_goods").value!=null && $("h_goods").value!=""){
comboGoods.setText($("h_goods").value);
}
}
function createComboGoods(){//货物描述类型ok
comboGoods = dhtmlXComboFromSelect("sel_goods");
comboGoods.loadXML("../SeaiInfoLCL/WmsRateLCLGridSource.aspx?handle=goodslist");
comboGoods.setOptionWidth(200);
comboGoods.attachEvent("onChange", function(){
comboGoods.setComboText($("h_goods").value);
});
comboGoods.attachEvent("onBlur", function(){
var s1 = comboGoods.getComboText().trim();
var s2 = s1.indexOf("|");
if(s2>0){
s2=s2+2;
}
var s3 = s1.substring(s2);
if(s2>0){
comboGoods.setComboText(s3);
$("h_goods").value=s3;
}
else
{
comboGoods.setComboText($("h_goods").value);
}
});
comboGoods.setComboText($("h_goods").value);
comboGoods.attachEvent("onKeyPressed", function(keyCode){
if(keyCode!="8"){
var arrayArg = new Array();
setTimeout(function(){
var filterCount = 0;
var is = -1;
var ishd = $("h_goods").value.trim();
if("" != comboGoods.getComboText().trim()){
while("undefined" != typeof comboGoods.getOptionByIndex(filterCount)){
var comboValue = comboGoods.getOptionByIndex(filterCount).text.toUpperCase();//.value;
var enterValue = comboGoods.getComboText().trim().toUpperCase();
$("h_goods").value = comboGoods.getComboText().trim().toUpperCase();
if(comboValue.indexOf(enterValue) == 0){
comboGoods.selectOption(filterCount,true,true);
is=filterCount;
break;
}
++filterCount;
}
if(is==-1){
$("h_goods").value = ishd;
alert("无此内容,请重新选择!");
}
}
},10);
}
});
comboGoods.attachEvent("onSelectionChange", function(){
$("h_goods").value = comboGoods.getComboText().trim();
});
}
function newGuid(){//生成GID
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();
}
//function refreshOrder(){//刷新页面
// window.location.href = window.location.href;
//}
function checkAll(id){
if($(id).checked){
for(var i=0;i<commonGridObj_WmsRatelist.getGridObj().getRowsNum();i++){
commonGridObj_WmsRatelist.getGridObj().cellByIndex(i,0).setValue(1);
}
}else{
for(var i=0;i<commonGridObj_WmsRatelist.getGridObj().getRowsNum();i++){
commonGridObj_WmsRatelist.getGridObj().cellByIndex(i,0).setValue(0);
}
}
}
function clickNull(){}
function addRate()//添加费率
{
var newId = newGuid();
//获取插入新纪录位置
var rowCount = commonGridObj_WmsRatelist.getGridObj().getRowsNum();
var preindex = 0;
var FEEGRADE = 0;
var FEESCALE = 0;
if(rowCount>0)
{
preindex=rowCount-1;
FEEGRADE = parseInt(commonGridObj_WmsRatelist.getGridObj().cellByIndex(preindex,1).getValue());
FEEGRADE=FEEGRADE+1;
commonGridObj_WmsRatelist.getGridObj().addRow(newId,[0,FEEGRADE,0,0,"吨天","","","",strbsno],rowCount);
}
else
{
commonGridObj_WmsRatelist.getGridObj().addRow(newId,[0,1,0,0,"吨天","","","",strbsno],rowCount);
}
newRateCount++;
setTimeout(function(){
commonGridObj_WmsRatelist.getGridObj().editStop(true);
commonGridObj_WmsRatelist.getGridObj().selectCell(commonGridObj_WmsRatelist.getGridObj().getRowIndex(newId),2,true,true);
commonGridObj_WmsRatelist.getGridObj().editCell();
},150);
}
function deleteRate()//删除费率
{
//newRateCount--;
var createname="";
var iCount = 0;
var iDelCount = 0;
var iFailure = 0;
if (newRateCount!=0)
{
alert("仓储费率未保存,先保存仓储费率-再进行删除操作");
return;
}
if(commonGridObj_WmsRatelist != null){
if(window.confirm("您确定要将选中的仓储费率删除")){
for(var i=0;i<commonGridObj_WmsRatelist.getGridObj().getRowsNum();i++){
var gID = commonGridObj_WmsRatelist.getGridObj().getRowId(i);
createname=commonGridObj_WmsRatelist.getGridObj().cellByIndex(i,6).getValue();
var isCheckState = commonGridObj_WmsRatelist.getGridObj().cellByIndex(i,0).getValue();
if(isCheckState == 1){
if(createname!="")
{
var url = "../SeaiInfoLCL/WmsRateLCLGridSource.aspx?handle=deleterate&gid="+gID;
var loader = dhtmlxAjax.getSync(url);
var deleteState = parseInt(loader.xmlDoc.responseText);
if(deleteState == 1){
iDelCount++;
}
else{
iFailure++;
}
}
else{
commonGridObj_WmsRatelist.getGridObj().deleteRow(gID);
newRateCount--;
iDelCount++;
}
iCount++;
}
}
if (iCount>0){
alert("提交费率删除 "+iCount+" 条 成功 "+iDelCount+" 条 失败 "+iFailure+" 条");
}
}
initGrid();
}
}
function saveRate()//保存费率
{
var RateState = 0;
RateState = saveRateChange();//保存应收费用
if($("RateContainer").value.trim() == "" ){
return;
}
if(RateState == 1){
msgBox();
//定时发送数据
setTimeout(postEnterFee,200);
newRateCount = 0;
changeRateCount = 0;
$("h_post").value = 1;
}
}
function refreshList()//刷新grid
{
initGrid();
}
function enableedit()//锁定条件,开始编辑费率
{
initGrid();
}
function postEnterFee(){//post数据到后台处理
var myForm = document.getElementById("form1");
myForm.submit() ;
initGrid();
}
function saveRateChange()//将费率信息打包为json格式存入变量RateContainer
{
var jsonRateObj = null;
var cus=$("h_cust").value;
for(var i=0;i<commonGridObj_WmsRatelist.getGridObj().getRowsNum();i++){
var rowId=commonGridObj_WmsRatelist.getGridObj().getRowId(i);
var REMARK="";
var FEEGRADE="";
REMARK = commonGridObj_WmsRatelist.getGridObj().cellByIndex(i,5).getValue();
FEEGRADE = commonGridObj_WmsRatelist.getGridObj().cellByIndex(i,1).getValue();
var FEESCALE = commonGridObj_WmsRatelist.getGridObj().cellByIndex(i,2).getValue();
var FEEPRICE = commonGridObj_WmsRatelist.getGridObj().cellByIndex(i,3).getValue();
var FEEUNIT = commonGridObj_WmsRatelist.getGridObj().cellByIndex(i,4).getValue();
if(i==0 && FEEPRICE=="")
{
FEEPRICE=0;
}
if(parseInt(FEESCALE) ==0){
$("RateContainer").value="";
alert("计费区间不能为零");
return -1;
}
if(i!=0 && parseFloat(FEEPRICE) == 0){
$("RateContainer").value="";
alert("单价不能为零");
return -1;
}
if(FEEUNIT.trim() == ""){
$("RateContainer").value="";
alert("计费单位不能为空");
return -1;
}
if(jsonRateObj == null){
var cacheBuffer = "";
cacheBuffer += "{";
cacheBuffer += "\"id\":\""+rowId+"\",";
cacheBuffer += "\"cus\":\""+cus+"\",";
cacheBuffer += "\"bsno\":\""+strbsno+"\",";
cacheBuffer += "\"fgrade\":\""+FEEGRADE+"\",";
cacheBuffer += "\"fscale\":\""+FEESCALE+"\",";
cacheBuffer += "\"fprice\":\""+FEEPRICE+"\",";
cacheBuffer += "\"funit\":\""+FEEUNIT+"\",";
cacheBuffer += "\"remark\":\""+REMARK+"\"";
cacheBuffer += "}";
var result = "";
result += "{\"rates\":[";
result += cacheBuffer;
result += "]}";
jsonRateObj = eval('(' + result + ')');
}else{
var newRateRow = jsonRateObj.rates;
newRateRow = {id:rowId,cus:cus,bsno:strbsno,
fgrade:FEEGRADE,fscale:FEESCALE,fprice:FEEPRICE,
funit:FEEUNIT,remark:REMARK};
jsonRateObj.rates.push(newRateRow);
}
}
$("RateContainer").value = JSON.stringify(jsonRateObj);
return 1;
}
function isObjNaN(Obj){
if(Obj.toString().toLowerCase() == "nan"){
return 0;
}else{
return Obj;
}
}
function ConvertToMoney(strObj){
var result = strObj.replace(",","");
return result;
}
function clearNoNum(valObj)
{
//先把非数字的都替换掉,除了数字和.
valObj = valObj.replace(/[^\d.]/g,"");
//必须保证第一个为数字而不是.
valObj = valObj.replace(/^\./g,"");
//保证只有出现一个.而没有多个.
valObj = valObj.replace(/\.{2,}/g,".");
//保证.只出现一次,而不能出现两次以上
valObj = valObj.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
return valObj;
}
//信息提示
function msgBox(){
var dg=new dialog();
dg.html="费费正在保存中,请稍等……";//"<input type=button onclick='new dialog().close();' value='确定'>";
dg.width=200;
dg.height=100;
dg.title="";
dg.show();
}
//对话框
function dialog()
{
// alert("打开dialog");
this.width=450;
this.height=360;
this.title_height=20;
this.html='';
this.title='';
var self = this;
var bgObj,msgObj,titleObj;
this.close=function()
{
document.body.removeChild(document.getElementById("bgDiv"));
document.getElementById("msgDiv").removeChild(document.getElementById("msgTitle"));
document.body.removeChild(document.getElementById("msgDiv"));
}
this.show=function()
{
var msgw,msgh,bordercolor;
msgw=self.width;
msgh=self.height;
bordercolor="#336699";
titlecolor="#99CCFF";
var sWidth,sHeight;
sWidth=document.body.offsetWidth;
sHeight=screen.height;
bgObj=document.createElement("div");
bgObj.setAttribute('id','bgDiv');
bgObj.style.position="absolute";
bgObj.style.top="0";
bgObj.style.background="#777";
bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
bgObj.style.opacity="0.6";
bgObj.style.left="0";
bgObj.style.width=sWidth + "px";
bgObj.style.height=sHeight + "px";
bgObj.style.zIndex = "10000";
document.body.appendChild(bgObj);
msgObj=document.createElement("div")
msgObj.setAttribute("id","msgDiv");
msgObj.setAttribute("align","center");
msgObj.style.background="white";
msgObj.style.border="1px solid " + bordercolor;
msgObj.style.position = "absolute";
msgObj.style.left = "50%";
msgObj.style.top = "30%";
msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
msgObj.style.marginLeft = "-225px" ;
msgObj.style.marginTop = -75+document.documentElement.scrollTop+"px";
msgObj.style.width = msgw + "px";
msgObj.style.height =msgh + "px";
msgObj.style.textAlign = "center";
msgObj.style.lineHeight ="25px";
msgObj.style.zIndex = "10001";
titleObj=document.createElement("h4");
titleObj.setAttribute("id","msgTitle");
titleObj.setAttribute("align","center");
titleObj.style.margin="0";
titleObj.style.padding="3px";
titleObj.style.background=bordercolor;
titleObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);";
titleObj.style.opacity="0.75";
titleObj.style.border="1px solid " + bordercolor;
titleObj.style.height=self.title_height+"px";
titleObj.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif";
titleObj.style.color="white";
titleObj.style.cursor="pointer";
titleObj.innerHTML=self.title;
//titleObj.onclick=function(){self.close();}
document.body.appendChild(msgObj);
document.getElementById("msgDiv").appendChild(titleObj);
var txt=document.createElement("div");
txt.style.margin="1em 0"
txt.setAttribute("id","msgTxt");
txt.innerHTML=self.html;
document.getElementById("msgDiv").appendChild(txt);
}
}
function outputMoney(number) {
number= number.replace(/\,/g,"");
if (isNaN(number)||number=="") return "";
number = Math.round( number*100) /100;
// if(number<0){
// return '-'+outputDollars(Math.floor(Math.abs(number)-0) + '') + outputCents(Math.abs(number) - 0);
// }
// else
// {
// return outputDollars(Math.floor(number-0) + '') + outputCents(number - 0);
// }
}
//function outputCents(amount)
//{
// amount = Math.round( ( (amount) - Math.floor(amount) ) *100);
// return (amount<10 ? '.0' + amount : '.' + amount);
//}
//function outputDollars(number)
//{
// if (number.length<= 3)
// return (number == '' ? '0' : number);
// else
// {
// var mod = number.length%3;
// var output = (mod == 0 ? '' : (number.substring(0,mod)));
// for (i=0 ; i< Math.floor(number.length/3) ; i++)
// {
// if ((mod ==0) && (i ==0))
// output+= number.substring(mod+3*i,mod+3*i+3);
//
// else
// output+= ',' + number.substring(mod+3*i,mod+3*i+3);
// }
//
// return (output);
// }
//校验时间格式
function validateDateTime(dateTimeObj){
var isValid = false;
var parseToObj = new Date(dateTimeObj.replace(/-/g, "/"));
if(!isNaN(parseToObj)){
isValid = true;
}
return isValid;
}
function DateTimeEqual(beginObj,endObj){
var isEqual = 0;
var begin = new Date(beginObj.replace(/-/g, "/"));
var end = new Date(endObj.replace(/-/g, "/"));
if(Date.parse(begin) - Date.parse(end) > 0){
isEqual = -1;//起始时间大于结束时间
}else if(Date.parse(begin) - Date.parse(end) == 0){
isEqual = -2;//起始时间与结束时间相等
}
return isEqual;
}