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.
DS7/DSWeb/js/WmsOutLCLEdit.js

1596 lines
63 KiB
JavaScript

2 years ago
var commonGridObj_wmsin;
var comboCustomer;//货主
var comboStorage;//仓库
var comboOutCustomer;//出货对象
var comboTRUCKNAME;
var comboGoods;//品名
var pressRecord
var isLoad = 0;
var pressCount = 0;
var IsChangeCus=0;
var pressRecord;
function $(id){
return document.getElementById(id);
}
function setOutInfo(rId,ischeck){
if(ischeck==true){
if($("txt_outbsno").value == ""){
var cusname=commonGridObj_wmsin.getGridObj().cellById(rId,1).getValue();
if(cusname!=""){
$("h_customer").value=cusname;
//$("h_outcustomer").value=$("h_customer").value; by lcx
comboCustomer.setText($("h_customer").value);
if($("h_Ischange").value=="1"){
comboOutCustomer.setComboText($("h_outcustomer").value); //setText 改为 setComboText by lcx
}
else {
$("h_outcustomer").value = $("h_customer").value;
comboOutCustomer.setComboText($("h_outcustomer").value);
}
}
$("h_goods").value=commonGridObj_wmsin.getGridObj().cellById(rId,4).getValue();
if($("h_goods").value!=""){
comboGoods.setText($("h_goods").value);
}
$("txt_goodsmodel").value=commonGridObj_wmsin.getGridObj().cellById(rId,5).getValue();
$("h_goodsmodel").value=$("txt_goodsmodel").value;
if($("h_storage").value==""){
$("h_storage").value=commonGridObj_wmsin.getGridObj().cellById(rId,14).getValue();
if($("h_storage").value!=""){
comboStorage.setText($("h_storage").value);
}
}
}
}
else{
if($("txt_outbsno").value == ""){
$("h_customer").value="";
$("h_outcustomer").value="";
comboCustomer.setText("");
if($("h_Ischange").value=="1"){
comboOutCustomer.setComboText("");
}
else {
comboOutCustomer.setComboText("");
}
$("h_goods").value="";
comboGoods.setText("");
$("txt_goodsmodel").value="";
$("h_goodsmodel").value="";
$("h_storage").value="";
comboStorage.setText("");
}
}
}
//初始化界面
function initTj(){
$("txt_blno").value="";
$("h_customer").value="";
comboCustomer.setText("");
$("h_storage").value="";
comboStorage.setText("");
$("txt_outbsno").value = ""
$("h_outcustomer").value="";
if($("h_Ischange").value=="1"){
comboOutCustomer.setComboText("");
}
else {
comboOutCustomer.setComboText("");
}
$("h_goods").value="";
comboGoods.setText("");
$("txt_goodsmodel").value="";
$("h_goodsmodel").value="";
$("txt_goodspfsl").value="";
$("h_goodspfsl").value="";
$("txt_packnum").value="";
$("h_goodspfsl").value="";
//
createOrder();
}
function ReShowLabel_2(gridObj) {
var columnCount = gridObj.getGridObj().getColumnsNum();
var rowCount = gridObj.getGridObj().getRowsNum();
if (rowCount > 0) {
for (var i = 0; i < rowCount; i++) {
for (var j = 0; j < columnCount; j++) {
if (j == 6 ) {
var cellCurVal = gridObj.getGridObj().cellByIndex(i, j).getValue();
gridObj.getGridObj().cellByIndex(i, j).setLabel(cellCurVal);
}else if( j == 7 || j == 8 ){
var cellCurVal = gridObj.getGridObj().cellByIndex(i, j).getValue();
gridObj.getGridObj().cellByIndex(i, j).setValue(cellCurVal);
}
}
}
}
}
function SetRate(){
var openSet = "height=490, width=800, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-490)/2 + ",Left= "+(screen.width-800)/2
var openType = "_blank";
if($("h_opseaibsno").value!=null && $("h_opseaibsno").value!="" && $("h_newcust").value!=null && $("h_newcust").value!="" ){
var openUrl = "../SeaiInfoLCL/WmsRateLCLEdit.aspx?handle=edit&id="+$("h_opseaibsno").value+"&cust="+escape($("h_newcust").value);
window.open (openUrl,openType,openSet);
}
else {
alert("货权转移之前,不能编辑仓储费率!");
return;
}
}
function createOrder(){
if($("h_outbsno").value!="" && $("h_outbsno").value!=null)
{
$("dvtable_outtj").style.display="none";
$("outtable_content").style.display="none";
}
else
{
$("dvtable_outtj").style.display="";
$("outtable_content").style.display = "";
}
// if($("h_IsFeeGain").value=="0"){
// $("dvGain").style.display="none";
// }
// else{
// $("dvGain").style.display="";
// }
//
if($("h_IsSetRate").value=="0"){
$("btn_IsSetRate").style.display = "none";
}
else{
if($("h_opseaibsno").value!=null && $("h_opseaibsno").value!="" && $("h_newcust").value!=null && $("h_newcust").value!="" ){
$("btn_IsSetRate").style.display="";
}
else
{
$("btn_IsSetRate").style.display="none";
}
}
// initLoading();
if($("h_outbsno").value!="" && $("h_outbsno").value!=null){
$("hdNAMES").value = "提单号\t入库单号\t出库单号\t转移对象\t应付客户\t仓库名称\t品名\t型号\t入库日期\t出库日期\t入库重量\t剩余库存\t剩余件数\t出库件数\t出库重量\t应收出库费\t应付出库费\t应收仓储费\t应付仓储费\t仓储天数\t计费天数\t车号\t制单人\t制单时间\t备注";
//header
//new Array("<input type=\"checkbox\" id=\"order_checkall\" onclick=\"orderCheckAll()\" />","业务类别","委托单位","委托编号","主提单号","分提单号");
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
var headerArgs_wmsin = new Array("", "提单号", "入库单号", "出库单号", "转移对象", "应付客户", "仓库名称", "品名", "型号", "入库日期", "出库日期", "入库重量", "剩余库存", "剩余件数", "出库件数", "出库重量", "应收出库费", "应付出库费", "应收仓储费", "应付仓储费", "仓储天数", "计费天数", "车号", "制单人", "制单时间", "备注");
//width
var widthArgs_wmsin = new Array("40", "120", "120", "120", "120", "120", "120", "80", "80", "80", "80", "80", "80", "80", "80", "80", "80", "80", "80", "80", "80", "80", "80", "100", "120", "100");
//column align
var colAlignArgs_wmsin = new Array("center","center","center","center","center","center","center","center","center","center","center","center","center","center","center","center","center","center","center","center","center","center","center","center","center","center");
//column sort
var colSortArgs_wmsin = new Array("na","str","str","str","str","str","str","str","str","str","str","str","str","str","str","str","str","str","str","str","str","str","str","str","str","str");
//column type
var colTypeArgs_wmsin = new Array("ch","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro");
commonGridObj_wmsin = new TGridCommon("mygrid_container_wmsin","form1",headerArgs_wmsin,widthArgs_wmsin,colAlignArgs_wmsin,colSortArgs_wmsin,colTypeArgs_wmsin);
commonGridObj_wmsin.setResponseUrl("../SeaiInfoLCL/WmsRateLCLGridSource.aspx");
commonGridObj_wmsin.setRequest("../SeaiInfoLCL/WmsRateLCLGridSource.aspx?handle=wmsoutdetaillist&opseaibsno="+$("h_bsno").value.trim()+"&wmsoutbsno="+$("h_outbsno").value);
commonGridObj_wmsin.setSourceType("json");
commonGridObj_wmsin.setSkin("xp");
commonGridObj_wmsin.setImageUrl("../images/");
commonGridObj_wmsin.initGrid();
commonGridObj_wmsin.bind();
} //END if($("h_outbsno").value!="" && $("h_outbsno").value!=null){
else{
//header
//new Array("<input type=\"checkbox\" id=\"order_checkall\" onclick=\"orderCheckAll()\" />","业务类别","委托单位","委托编号","主提单号","分提单号");
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
var headerArgs_wmsin = new Array("", "货主", "提单号", "入库日期", "品名", "型号", "剩余件数", "剩余库存", "出库件数", "出库重量", "应收出库费", "应付出库费", "车号", "备注", "仓库名称", "进口委托单号", "单件吨数", "原货主");
//width
var widthArgs_wmsin = new Array("40", "100", "100", "100", "100", "100", "100", "100", "100", "100", "100", "100", "500", "100", "0", "0", "0", "0");
//column align
var colAlignArgs_wmsin = new Array("center", "center", "center", "center", "center", "center", "center", "center", "center", "center", "center", "center", "center", "center", "center", "center", "center", "center");
//column sort
var colSortArgs_wmsin = new Array("na", "str", "str", "str", "str", "str", "str", "str", "str", "str", "str", "str", "str", "str", "str", "str", "str", "str");
//column type
var colTypeArgs_wmsin = new Array("ch", "ro", "ro", "ro", "ro", "ro", "ro", "ro", "ed", "ed", "ed", "ed", "txt", "ed", "ro", "ro", "ro", "ro");
commonGridObj_wmsin = new TGridCommon("mygrid_container_wmsin","form1",headerArgs_wmsin,widthArgs_wmsin,colAlignArgs_wmsin,colSortArgs_wmsin,colTypeArgs_wmsin);
commonGridObj_wmsin.setResponseUrl("../SeaiInfoLCL/WmsRateLCLGridSource.aspx");
if($("h_searchJson").value!=""){
commonGridObj_wmsin.setRequest("../SeaiInfoLCL/WmsRateLCLGridSource.aspx?handle=wmsinlist&search="+escape($("h_searchJson").value));
}else{
commonGridObj_wmsin.setRequest("../SeaiInfoLCL/WmsRateLCLGridSource.aspx?handle=wmsinlist&bsno="+$("h_opseaibsno").value);
}
commonGridObj_wmsin.setSourceType("json");
commonGridObj_wmsin.setSkin("xp");
commonGridObj_wmsin.setImageUrl("../images/");
commonGridObj_wmsin.initGrid();
commonGridObj_wmsin.bind();
commonGridObj_wmsin.getGridObj().enableEditEvents(true,false,true);
commonGridObj_wmsin.getGridObj().enableKeyboardSupport(true);
commonGridObj_wmsin.getGridObj().enableMultiselect(true);
// commonGridObj_wmsin.getGridObj().attachEvent("onCheckbox", function(rId,cInd,state){
// if (state==false){
// commonGridObj_wmsin.getGridObj().cellById(rId,8).setLabel(0);
// commonGridObj_wmsin.getGridObj().cellById(rId,9).setLabel(0);
// commonGridObj_wmsin.getGridObj().cellById(rId,10).setLabel(0);
// commonGridObj_wmsin.getGridObj().cellById(rId,11).setLabel(0);
// }
// setOutInfo(rId,state);
// //totalDynamicOutNum();
// });
var txtEdit;
commonGridObj_wmsin.getGridObj().attachEvent("onEditCell", function(stage, rId, cInd, nValue, oValue) {
//初始化状态
if (stage == 0) {
txtEdit = "";
return true;
} //stage == 0
if (stage == 1) {
txtEdit = "";
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 (cInd == 8) {
var Num_Out = commonGridObj_wmsin.getGridObj().cellById(rId, 8).getValue();
if (Num_Out != 0) {
var Num_Kc = parseFloat(ConvertToMoney(commonGridObj_wmsin.getGridObj().cellById(rId, 6).getValue()));
if (Num_Out > Num_Kc) {
commonGridObj_wmsin.getGridObj().cellById(rId, 8).setLabel(Num_Kc);
}
setOutInfo(rId, true);
//totalDynamicOutNum();
}
}
else if (cInd == 12) {
if (txtEdit != null) {
if (txtEdit.value != null) {
if (txtEdit.value != "") {
commonGridObj_wmsin.getGridObj().cellById(rId, cInd).setValue(txtEdit.value);
}
}
}
}
if (stage == 2) {//编辑结束
if (cInd == 12) {
if (txtEdit != null) {
if (txtEdit.value != null && txtEdit.value != "") {
var sdf = txtEdit.value;
commonGridObj_wmsin.getGridObj().cellById(rId, cInd).setValue(txtEdit.value);
}
}
else {
return true;
}
}
if (oValue == null || oValue == "" || oValue == "0") {
return true;
}
if (cInd == 13) {
commonGridObj_wmsin.getGridObj().cellById(rId, cInd).setValue(nValue);
}
else if (cInd == 8) {
commonGridObj_wmsin.getGridObj().cellById(rId, cInd).setLabel(nValue);
}
return true;
} //stage == 2
}); //onEditCell end
//键盘操作事件
commonGridObj_wmsin.getGridObj().attachEvent("onKeyPress", function (code, cFlag, sFlag) {
//onKeyPress begin
//获取当前RowID
var selectedId = commonGridObj_wmsin.getGridObj().getSelectedRowId();
//获取当前RowIndex
var RowIndex = commonGridObj_wmsin.getGridObj().getRowIndex(selectedId);
//获取当前CellIndex(ind)
var ind = commonGridObj_wmsin.getGridObj().getSelectedCellIndex();
//触发操作事件前获取单元值
var oldVal = commonGridObj_wmsin.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 == 8 || ind == 9 || ind == 10 || ind == 11 || ind == 12 || ind == 13) {
return true;
}
} //enter 键 end
//Tab键
if (code == 9) {
//code9 begin
var colCount = commonGridObj_wmsin.getGridObj().getColumnsNum();
//获取当前RowIndex
//触发操作事件前获取单元值
if (ind < colCount) {
isExchange = false;
if (ind == 8 || ind == 9 || ind == 10 || ind == 11) {
var oldVal = commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, ind).getValue();
commonGridObj_wmsin.getGridObj().editStop(true);
commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, ind).setLabel(oldVal);
setOutInfo(selectedId, true);
//totalDynamicOutNum();
commonGridObj_wmsin.getGridObj().selectCell(RowIndex, ind + 1, true, true);
commonGridObj_wmsin.getGridObj().editCell();
}
else if (ind == 12) {
commonGridObj_wmsin.getGridObj().editStop(true);
if (txtEdit.value != null && txtEdit.value != "") {
commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, ind).setValue(txtEdit.value);
}
commonGridObj_wmsin.getGridObj().selectCell(RowIndex, ind + 1, true, true);
commonGridObj_wmsin.getGridObj().editCell();
}
else if (ind == 13) {
commonGridObj_wmsin.getGridObj().editStop(true);
commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, ind).setValue(oldVal);
commonGridObj_wmsin.getGridObj().selectCell(RowIndex, ind + 1, true, true);
commonGridObj_wmsin.getGridObj().editCell();
}
}
} //cdoe9 end
//向下方向键
if (code == 40) {
//code40 begin
if (ind == 8 || ind == 9 || ind == 10 || ind == 11 || ind == 12 || ind == 13) {
var rowCount = commonGridObj_wmsin.getGridObj().getRowsNum();
commonGridObj_wmsin.getGridObj().editStop(true);
if (RowIndex != (rowCount - 1)) {
commonGridObj_wmsin.getGridObj().selectCell(RowIndex + 1, ind, true, true);
commonGridObj_wmsin.getGridObj().editCell();
}
}
else {
return true;
}
} //code40 end
//向上箭头
if (code == 38) {
//code38 begin
if (ind == 8 || ind == 9 || ind == 10 || ind == 11 || ind == 12 || ind == 13) {
if (RowIndex > 0) {
commonGridObj_wmsin.getGridObj().clearSelection();
commonGridObj_wmsin.getGridObj().editStop(true);
commonGridObj_wmsin.getGridObj().selectCell(RowIndex - 1, ind, true, true);
commonGridObj_wmsin.getGridObj().editCell();
}
} else {
return true;
}
} //code38 end
//左箭头
if (code == 37) {
//code37 begin
commonGridObj_wmsin.getGridObj().clearSelection();
commonGridObj_wmsin.getGridObj().editStop(true);
if (ind == 8) {
commonGridObj_wmsin.getGridObj().selectCell(RowIndex, 13, true, true);
}
else {
commonGridObj_wmsin.getGridObj().selectCell(RowIndex, ind - 1, true, true);
}
commonGridObj_wmsin.getGridObj().editCell();
return true;
} //code37 end
//右箭头
if (code == 39) {
//code39 begin
commonGridObj_wmsin.getGridObj().clearSelection();
commonGridObj_wmsin.getGridObj().editStop(true);
if (ind == 13) {
commonGridObj_wmsin.getGridObj().selectCell(RowIndex, 8, true, true);
}
else {
commonGridObj_wmsin.getGridObj().selectCell(RowIndex, ind + 1, true, true);
}
commonGridObj_wmsin.getGridObj().editCell();
return true;
} //code39 end
//键盘输入数字
if (code >= 48 && code <= 57 || code >= 96 && code <= 105 || code == 188 || code == 110 || code == 190 || code == 229) {
if (ind == 8 || ind == 9 || ind == 10 || ind == 11 || ind == 12 || ind == 13) {
return true;
}
}
if (code >= 65 && code <= 90) {//如果是输入英文字符
if (ind == 12 || ind == 13) {
return true;
}
}
//delete
if (code == 8) {
//code8 begin
if (ind == 8 || ind == 9 || ind == 10 || ind == 11 || ind == 12 || ind == 13) {
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++;
}
}
}
//未选中多个字符
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_wmsin.getGridObj().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_wmsin.getGridObj().editStop(true);
commonGridObj_wmsin.getGridObj().cellByIndex(rowIndex, ind).setValue(oldVal);
commonGridObj_wmsin.getGridObj().selectCell(rowIndex, ind, true, true);
commonGridObj_wmsin.getGridObj().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;
}
}
}
}
}, 500);
return true;
} else {
return true;
}
} //code8 end
if (code == 46) {
if (ind == 8 || ind == 9 || ind == 10 || ind == 11) {
commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, ind).setLabel("");
}
else if (ind == 12 || ind == 13) {
commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, ind).setValue("");
}
} //end code == 46
});
}
isLoad = 1;
}// createOrder() end
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 RecreateOrder(){
createOrder();
} //RecreateOrder() end
var newGuid = function(){
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 doCheck(clickObj){
// alert($(clickObj).checked);
//// if($(clickObj).checked){
// $(clickObj).checked = 0;
// return ;
// }else{
// $(clickObj).checked = 1;
// return ;
// }
}
//初始化Combo
function initCombos()
{
if($("h_Mode").value=="0"){
if($("sel_customer")!=null){
initComboCustomer();//货主
}
if($("sel_storage")!=null){
initComboStorage();//仓库名称
}
if($("sel_goods")!=null){
initComboGoods();//品名ok
}
// if($("h_Ischange").value=="1"){
// if($("sel_outcustomer")!=null){
// initComboOutCustomer0();//转移对象
// }
// return;
// }
// else{
// if($("sel_outcustomer")!=null){
// //initcomboOutCustomer();
// initcomboOutCustomer2();
// }
//
//if($("sel_outcustomer")!=null){
initcomboOutCustomer2();
//}
initComboTRUCKNAME2();
}
else if($("h_Mode").value=="1"){
if($("sel_goods")!=null){
initComboGoods();//品名ok
}
// if($("h_Ischange").value=="1"){
// if($("sel_outcustomer")!=null){
// initComboOutCustomer0();//转移对象
// comboOutCustomer.setText($("h_outcustomer").value);
// }
// return;
// }
// else{
// if($("sel_outcustomer")!=null){
// //initcomboOutCustomer();
// initcomboOutCustomer2();
// comboOutCustomer.setComboText($("h_outcustomer").value);
// }
// }
//
//if ($("sel_outcustomer") != null) {
initcomboOutCustomer2();
comboOutCustomer.setComboText($("h_outcustomer").value);
//}
initComboTRUCKNAME2();
}
// finishLoading();
}
function initComboCustomer(){//货主
comboCustomer = new TCombo("sel_customer", "../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0", true, true, false, true, "h_customer");
comboCustomer.initComboEvent();
comboCustomer.bind();
if($("h_customer").value!="" && $("h_customer").value!=null)
{
comboCustomer.setText($("h_customer").value);
}
}
//storage
function initComboStorage() {//仓库名称
comboStorage = new TCombo("sel_storage", "../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0&strIS=ISWAREHOUSE", true, true, false, true, "h_storage");
comboStorage.initComboEvent();
comboStorage.bind();
if($("h_storage").value!="" && $("h_storage").value!=null)
{
comboStorage.setText($("h_storage").value);
}
}
//storage
function initComboTRUCKNAME() {//应付
comboTRUCKNAME = new TCombo("ddlTRUCKNAME", "../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0&strIS=ISWAREHOUSE&strIS2=ISTRUCK", true, true, false, true, "hd_comboTRUCKNAME");
comboTRUCKNAME.initComboEvent();
comboTRUCKNAME.bind();
if ($("hd_comboTRUCKNAME").value != "" && $("hd_comboTRUCKNAME").value != null)
{
comboTRUCKNAME.setText($("hd_comboTRUCKNAME").value);
}
}
//function initComboOutCustomer0(){//转移对象
// comboOutCustomer = new TCombo("sel_outcustomer", "../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0", true, true, false, true, "h_outcustomer");
// comboOutCustomer.initComboEvent();
// comboOutCustomer.bind();
//// if($("h_outcustomer").value!="" && $("h_outcustomer").value!=null)
//// {
//// comboOutCustomer.setText($("h_outcustomer").value);
//// }
//}
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!="" && $("h_goods").value!=null)
{
comboGoods.setText($("h_goods").value);
}
}
function initcomboOutCustomer()//货主
{
comboOutCustomer = dhtmlXComboFromSelect("sel_outcustomer");
comboOutCustomer.loadXML("../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0&strIS=ISCONTROLLER ");
}
function initcomboOutCustomer2()//货主
{
comboOutCustomer.attachEvent("onChange", function() {
comboOutCustomer.setComboText($("h_outcustomer").value);
});
comboOutCustomer.attachEvent("onBlur", function() {
var s1 = comboOutCustomer.getComboText().trim();
var s2 = s1.indexOf("|");
if (s1 == "") {
$("h_outcustomer").value = "";
comboOutCustomer.setComboText($("h_outcustomer").value);
}
else {
if (s2 > 0) {
s2 = s2 + 2;
}
var s3 = s1.substring(s2);
if (s2 > 0) {
comboOutCustomer.setComboText(s3);
$("h_outcustomer").value = s3;
}
else {
comboOutCustomer.setComboText($("h_outcustomer").value);
}
}
});
comboOutCustomer.setOptionWidth(200);
comboOutCustomer.setComboText($("h_outcustomer").value);
comboOutCustomer.attachEvent("onKeyPressed", function(keyCode) {
if (keyCode != "8") {
var arrayArg = new Array();
setTimeout(function() {
var filterCount = 0;
var is = -1;
var ishd = $("h_outcustomer").value.trim();
if ("" != comboOutCustomer.getComboText().trim()) {
while ("undefined" != typeof comboOutCustomer.getOptionByIndex(filterCount)) {
var comboValue = comboOutCustomer.getOptionByIndex(filterCount).text.toUpperCase(); //.value;
var enterValue = comboOutCustomer.getComboText().trim().toUpperCase();
$("h_outcustomer").value = comboOutCustomer.getComboText().trim().toUpperCase();
if (comboValue.indexOf(enterValue) == 0) {
comboOutCustomer.selectOption(filterCount, true, true);
is = filterCount;
break;
}
++filterCount;
}
if (is == -1) {
var sklj = $("h_Ischange").value;
if ($("h_Ischange").value == "1") {
$("h_outcustomer").value = ishd;
alert("无此内容,请重新选择!");
}
//
}
}
}, 10);
}
});
comboOutCustomer.attachEvent("onSelectionChange", function() {
$("h_outcustomer").value = comboOutCustomer.getComboText().trim();
});
}
function initComboTRUCKNAME()//应付账款客户名称
{
comboTRUCKNAME = dhtmlXComboFromSelect("ddlTRUCKNAME");
comboTRUCKNAME.loadXML("../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0&strIS=ISWAREHOUSE&strIS2=ISTRUCK");
}
function initComboTRUCKNAME2()//应付账款客户名称
{
// if ($("hdEnabled").value == "false") {
// comboTRUCKNAME.disable(true);
// }
//
comboTRUCKNAME.setOptionWidth(200);
comboTRUCKNAME.attachEvent("onChange", function () {
comboTRUCKNAME.setComboText($("hd_comboTRUCKNAME").value);
});
comboTRUCKNAME.attachEvent("onBlur", function () {
var s1 = comboTRUCKNAME.getComboText().trim();
var s2 = s1.indexOf("|");
if (s1 == "") {
$("hd_comboTRUCKNAME").value = "";
comboTRUCKNAME.setComboText($("hd_comboTRUCKNAME").value);
//
//$("hd_comboSTORAGECODE").value = "";
//
}
else {
if (s2 > 0) {
s2 = s2 + 2;
}
var s3 = s1.substring(s2);
if (s2 > 0) {
comboTRUCKNAME.setComboText(s3);
$("hd_comboTRUCKNAME").value = s3;
}
else {
comboTRUCKNAME.setComboText($("hd_comboTRUCKNAME").value);
}
//
//$("hd_comboSTORAGECODE").value = comboTRUCKNAME.getSelectedValue();
//
}
});
comboTRUCKNAME.setComboText($("hd_comboTRUCKNAME").value);
comboTRUCKNAME.attachEvent("onKeyPressed", function (keyCode) {
if (keyCode != "8") {
var arrayArg = new Array();
setTimeout(function () {
var filterCount = 0;
var is = -1;
var ishd = $("hd_comboTRUCKNAME").value.trim();
if ("" != comboTRUCKNAME.getComboText().trim()) {
while ("undefined" != typeof comboTRUCKNAME.getOptionByIndex(filterCount)) {
var comboValue = comboTRUCKNAME.getOptionByIndex(filterCount).text.toUpperCase(); //.value;
var enterValue = comboTRUCKNAME.getComboText().trim().toUpperCase();
$("hd_comboTRUCKNAME").value = comboTRUCKNAME.getComboText().trim().toUpperCase();
if (comboValue.indexOf(enterValue) == 0) {
comboTRUCKNAME.selectOption(filterCount, true, true);
is = filterCount;
break;
}
++filterCount;
}
if (is == -1) {
$("hd_comboTRUCKNAME").value = ishd;
alert("无此内容,请重新选择!");
}
}
}, 10);
}
});
comboTRUCKNAME.attachEvent("onSelectionChange", function () {
$("hd_comboTRUCKNAME").value = comboTRUCKNAME.getComboText().trim();
});
}
String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g,""); }
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 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 outputCents(amount)
{
amount = Math.round( ( (amount) - Math.floor(amount) ) *100);
return (amount<10 ? '.0' + amount : '.' + amount);
}
function postEnterFee(){
var myForm = document.getElementById("form1");
myForm.submit() ;
}
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("$#$",".");
if(valObj.indexOf(".") == valObj.length-1){
valObj += "0";
}
return valObj;
}
function isObjNaN(Obj){
if(Obj.toString().toLowerCase() == "nan"){
return 0;
}else{
return Obj;
}
}
function search(){//查询入库wms_in信息
//sel_customer
var opseaibsno=$("h_opseaibsno").value;
var cus = $("h_customer").value;
var blno = $("txt_blno").value;
var store = $("h_storage").value;
if(blno!=null && blno!=""){
$("h_blno").value=blno;
}
var searchJson = "";
searchJson +="{";
searchJson += "[";
searchJson += "\"opseaibsno\":\""+opseaibsno+"\",";
searchJson += "\"cus\":\""+cus+"\",";
searchJson += "\"blno\":\""+blno+"\",";
searchJson += "\"store\":\""+store+"\"";
searchJson += "]";
searchJson +="}";
$("h_searchJson").value = searchJson;
// createOrder();
RecreateOrder();
}
function ChangeStorage(){ //货权转移
IsChangeCus=1;
if($("h_outbsno").value!="" && $("h_outbsno").value!=null)
{
alert("出库单已经生成!");
return;
}
var WoState=0;
WoState=saveWoChange();
var WoDetailState=0;
WoDetailState=saveWoDetailChange();
if($("WoContainer").value.trim() == "" || $("WoDetailContainer").value.trim() == ""){
return;
}
if (WoState==1 && WoDetailState==1){
msgBox();
//定时发送数据
setTimeout(postEnterFee,200);
$("h_post").value = 3;
}
}
function OutStorage() {//生成出库单
IsChangeCus=parseInt($("h_Ischange").value);
if($("h_outbsno").value!="" && $("h_outbsno").value!=null)
{
alert("出库单已经生成!");
return;
}
//保存后录入的数据
var truck;
var id;
for(var i=0;i<commonGridObj_wmsin.getGridObj().getRowsNum();i++){
var Num_Out = commonGridObj_wmsin.getGridObj().cellByIndex(i,8).getValue();
if(Num_Out != 0)
{
var Num_Kc =parseFloat(ConvertToMoney( commonGridObj_wmsin.getGridObj().cellByIndex(i,6).getValue()));
if(Num_Out>Num_Kc)
{
commonGridObj_wmsin.getGridObj().cellByIndex(i,8).setLabel(Num_Kc);
}
id=commonGridObj_wmsin.getGridObj().getRowId(i);
setOutInfo(id,true);
//totalDynamicOutNum();
}
truckno = commonGridObj_wmsin.getGridObj().cellByIndex(i,12).getValue();
}
var WoState=0;
WoState=saveWoChange();
var WoDetailState=0;
WoDetailState=saveWoDetailChange();
if($("WoContainer").value.trim() == "" || $("WoDetailContainer").value.trim() == ""){
return;
}
if (WoState==1 && WoDetailState==1){
msgBox();
//定时发送数据
setTimeout(postEnterFee,200);
if(IsChangeCus==1){
$("h_post").value = 3;
}
else if(IsChangeCus==2){
$("h_post").value = 4;
}
else{
$("h_post").value = 2;
}
}
}
function saveWoChange(){
var jsonFeeObj = null;
var outdate=$("txt_outdate").value;
if(outdate==""){
alert("出库日期不能为空!");
return;
}
var cust=comboCustomer.comboObj.getComboText().trim();
if(cust==""){
alert("转移对象不能为空!");
return;
}
var goodsname = $("h_goods").value;
if(goodsname==""){
alert("品名不能为空!");
return;
}
var goodsmodel = $("txt_goodsmodel").value;
if(goodsname==""){
alert("型号不能为空!");
return;
}
//
var outcus = ""; //转移对象
var oldcustfeedate = $("txt_oldcustFeeDate").value.trim();
if ($("h_Ischange").value == "1") {
outcus = comboOutCustomer.getComboText().trim(); //comboObj. by lcx
if(cust==outcus)
{
alert("货主和货权转移对象不能相同");
return;
}
//
if (oldcustfeedate == "") {
alert("上家承担仓储期限不能为空!");
return;
}
}
else if ($("h_Ischange").value == "2") {
comboOutCustomer.setComboText("盘亏处理");
outcus = "盘亏处理";
}
else {
outcus=comboOutCustomer.getComboText().trim();
}
if(IsChangeCus==1)
{
if(outcus==""){
alert("货权转移对象不能为空!");
return;
}
}
var isJsFee=$("ck_jsfee").checked;
var outnum=0 ;//本次出库量
outnum=parseFloat( $("txt_goodspfsl").value);
if (outnum == 0) {
alert("出库量不能为零!");
return;
}
else {
outnum = 1; //本次出库量
}
var outpacknum = 0; //本次出库件数
outpacknum=parseInt( $("txt_packnum").value);
if(outpacknum==""){
alert("出库件数不能为零!");
return;
}
else {
outpacknum = 1; //本次出库量
}
var truckname = $("hd_comboTRUCKNAME").value.trim();
// if (truckname == "") {
// alert("应付客户不能为空!");
// return;
// }
//
var remark = $("txt_remark").value;
var inspectionno = $("txt_inspectionno").value;
var customno = $("txt_customno").value;
var custparent="";//原货主
var opseaibsno="";
var storage="";
var truckno="";
if(storage==""){
for(var i=0;i<commonGridObj_wmsin.getGridObj().getRowsNum();i++){
// var checkState = commonGridObj_wmsin.getGridObj().cellByIndex(i,0).getValue();
var outnumdetail=clearNoNum(isObjNaN(ConvertToMoney(commonGridObj_wmsin.getGridObj().cellByIndex(i,8).getValue())));
if(outnumdetail>0){
// if(checkState==1){
if(opseaibsno==""){
opseaibsno=commonGridObj_wmsin.getGridObj().cellByIndex(i,15).getValue();
storage=commonGridObj_wmsin.getGridObj().cellByIndex(i,14).getValue();
truckno = commonGridObj_wmsin.getGridObj().cellByIndex(i,12).getValue();
}
else if(opseaibsno!=commonGridObj_wmsin.getGridObj().cellByIndex(i,15).getValue())
{
alert("不能选择两个进口委托单出库");
return 0;
}
if (cust!=commonGridObj_wmsin.getGridObj().cellByIndex(i,1).getValue()){
alert("不能选择两个货主的货物出库");
return 0;
}
}
}
}
//
if (truckno.trim() != "") {
while (truckno.indexOf(" ") > 0) {
truckno = truckno.replace(" ", "");
}
while (truckno.indexOf("\r\n") > 0) {
truckno = truckno.replace("\r\n", "");
}
}
//
var cacheBuffer = "";
cacheBuffer += "{";
cacheBuffer += "\"cust\":\""+cust+"\",";
cacheBuffer += "\"outcus\":\""+outcus+"\",";
cacheBuffer += "\"outdate\":\""+outdate+"\",";
cacheBuffer += "\"goodsname\":\""+goodsname+"\",";
cacheBuffer += "\"goodsmodel\":\""+goodsmodel+"\",";
cacheBuffer += "\"outnum\":\""+outnum+"\","; //outpacknum
cacheBuffer += "\"outpacknum\":\"" + outpacknum + "\",";
cacheBuffer += "\"truckno\":\"" + truckno + "\",";
cacheBuffer += "\"storage\":\""+storage+"\",";
cacheBuffer += "\"opseaibsno\":\""+opseaibsno+"\",";
cacheBuffer += "\"isJsFee\":\""+isJsFee+"\",";
cacheBuffer += "\"remark\":\""+remark+"\",";
cacheBuffer += "\"inspectionno\":\"" + inspectionno + "\",";
cacheBuffer += "\"customno\":\"" + customno + "\",";
cacheBuffer += "\"truckname\":\"" + truckname + "\",";
cacheBuffer += "\"oldcustfeedate\":\"" + oldcustfeedate + "\"";
cacheBuffer += "}";
var result = "";
result += "{\"fees\":[";
result += cacheBuffer;
result += "]}";
jsonFeeObj = eval('(' + result + ')');
$("WoContainer").value=JSON.stringify(jsonFeeObj);
return 1;
}
function saveWoDetailChange(){
var jsonFeeObj = null;
//
//var cust = $("h_outcustomer").value;
var cust = comboCustomer.comboObj.getComboText().trim();
if (cust == "") {
alert("转移对象不能为空!");
return;
}
var outcus = ""; //转移对象
if ($("h_Ischange").value == "1") {
outcus = comboOutCustomer.getComboText().trim(); //comboObj. by lcx
if (cust == outcus) {
alert("货主和货权转移对象不能相同");
return;
}
}
else if ($("h_Ischange").value == "2") {
comboOutCustomer.setComboText("盘亏处理");
outcus = "盘亏处理";
}
else {
outcus = comboOutCustomer.getComboText().trim();
}
//
var farfee=0;
var fapfee=0;
//
for(var i=0;i<commonGridObj_wmsin.getGridObj().getRowsNum();i++){
var rowId = commonGridObj_wmsin.getGridObj().getRowId(i);
var inbsno=rowId;//wms_in.bsno
var RowIndex = commonGridObj_wmsin.getGridObj().getRowIndex(rowId);
var indate=commonGridObj_wmsin.getGridObj().cellByIndex(i,3).getValue();
var goodsname = commonGridObj_wmsin.getGridObj().cellByIndex(i,4).getValue();
var goodsmodel = commonGridObj_wmsin.getGridObj().cellByIndex(i,5).getValue();
var outnum = clearNoNum(isObjNaN(ConvertToMoney(commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex,9).getValue())));
var outpacknum = clearNoNum(isObjNaN(ConvertToMoney(commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex,8).getValue())));
var arfee = clearNoNum(isObjNaN(ConvertToMoney(commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex,10).getValue())));
var apfee = clearNoNum(isObjNaN(ConvertToMoney(commonGridObj_wmsin.getGridObj().cellByIndex(RowIndex, 11).getValue())));
farfee = parseFloat(farfee) + parseFloat(arfee);
fapfee = parseFloat(fapfee) + parseFloat(apfee);
var truckno = commonGridObj_wmsin.getGridObj().cellByIndex(i, 12).getValue();
var remark = commonGridObj_wmsin.getGridObj().cellByIndex(i,13).getValue();
var storage=commonGridObj_wmsin.getGridObj().cellByIndex(i,14).getValue();
var opseaibsno=commonGridObj_wmsin.getGridObj().cellByIndex(i,15).getValue();
var custparent=commonGridObj_wmsin.getGridObj().cellByIndex(i,17).getValue();
var checkState = commonGridObj_wmsin.getGridObj().cellByIndex(i,0).getValue();
if(outnum>0){
//if(checkState==1){
if(jsonFeeObj == null){
var cacheBuffer = "";
cacheBuffer += "{";
cacheBuffer += "\"cust\":\"" + cust + "\",";
cacheBuffer += "\"outcus\":\"" + outcus + "\",";
cacheBuffer += "\"inbsno\":\""+inbsno+"\",";
cacheBuffer += "\"indate\":\""+indate+"\",";
cacheBuffer += "\"goodsname\":\""+goodsname+"\",";
cacheBuffer += "\"goodsmodel\":\"" + goodsmodel + "\",";
//
if (truckno.trim() != "") {
while (truckno.indexOf(" ") > 0) {
truckno = truckno.replace(" ", "");
}
while (truckno.indexOf("\r\n") > 0) {
truckno = truckno.replace("\r\n", "");
}
}
//
cacheBuffer += "\"truckno\":\""+truckno+"\",";
cacheBuffer += "\"storage\":\""+storage+"\",";
cacheBuffer += "\"opseaibsno\":\""+opseaibsno+"\",";
cacheBuffer += "\"outnum\":\""+outnum+"\",";
cacheBuffer += "\"outpacknum\":\"" + outpacknum + "\",";
cacheBuffer += "\"arfee\":\"" + arfee + "\",";
cacheBuffer += "\"apfee\":\"" + apfee + "\",";
cacheBuffer += "\"remark\":\""+remark+"\",";
cacheBuffer += "\"custparent\":\""+custparent+"\"";
cacheBuffer += "}";
var result = "";
result += "{\"fees\":[";
result += cacheBuffer;
result += "]}";
jsonFeeObj = eval('(' + result + ')');
}else{
var newFeeRow = jsonFeeObj.fees;
newFeeRow = { cust: cust, outcus: outcus, inbsno: inbsno, indate: indate, goodsname: goodsname, goodsmodel: goodsmodel, truckno: truckno, storage: storage, opseaibsno: opseaibsno, outnum: outnum, outpacknum: outpacknum, arfee: arfee, apfee: apfee, remark: remark, custparent: custparent };
jsonFeeObj.fees.push(newFeeRow);
}
}
}
if(jsonFeeObj!=null) {
if ($("hd_comboTRUCKNAME").value.trim() == "" && (farfee != 0 || fapfee != 0)) {
$("WoDetailContainer").value = "";
alert("应付客户不能为空!");
return 3;
}
//
$("WoDetailContainer").value=JSON.stringify(jsonFeeObj);
return 1;
}
else
{
$("WoDetailContainer").value="";
alert("请输入本次出库重量!");
return 0;
}
}
//信息提示
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 fomatFloat(src,pos){
return Math.round(src*Math.pow(10, pos))/Math.pow(10, pos);
}
function initLoading(){
$("progressBar").style.display = "";
}
function finishLoading(){
$("progressBar").style.display = "none";
}
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 totalDynamicOutNum(){
//获取出库列表行数
var rowCount_WmsOut = commonGridObj_wmsin.getGridObj().getRowsNum();
var Sum_Out = 0.0;//总吨数合计
var Sum_packOut = 0.0;//
var checkBox = 0;
var amount = 0;
var amountpack = 0;//件数合计
var rownum=0;//明细重量
var djds=0;//单件吨数
//计算应收费用
for(var i = 0;i<rowCount_WmsOut;i++){
// checkBox = commonGridObj_wmsin.getGridObj().cellByIndex(i,0).getValue();
rownum = parseFloat(ConvertToMoney(commonGridObj_wmsin.getGridObj().cellByIndex(i,8).getValue()));
djds=parseFloat(ConvertToMoney(commonGridObj_wmsin.getGridObj().cellByIndex(i,16).getValue()));
if(rownum.toString().toLowerCase() == "nan"){
rownum = 0.0;
}
if(djds.toString().toLowerCase() == "nan"){
djds = 0.0;
}
if(rownum>0){
// if(checkBox == 1){
//获取总金额
if(amountpack.toString().toLowerCase() == "nan"){
amountpack = 0.0;
}
if(amount.toString().toLowerCase() == "nan"){
amount = 0.0;
}
if(Sum_Out.toString().toLowerCase() == "nan"){
Sum_Out = 0.0;
}
var Num_Out = commonGridObj_wmsin.getGridObj().cellByIndex(i,8).getValue();
if(Num_Out != 0)
{
var Num_Kc =parseFloat(ConvertToMoney( commonGridObj_wmsin.getGridObj().cellByIndex(i,6).getValue()));
if(Num_Out>Num_Kc)
{
commonGridObj_wmsin.getGridObj().cellByIndex(i,8).setLabel(Num_Kc);
rownum=Num_Kc;
}
}
amountpack=amountpack+rownum;
//amount = amount + rownum * djds;
amount = rownum * djds;
Sum_Out = Sum_Out + amount;
var tmpjs=rownum*djds;
tmpjs=tmpjs.toFixed(4);
commonGridObj_wmsin.getGridObj().cellByIndex(i,9).setLabel(tmpjs.toString());
}
}
$("txt_goodspfsl").value = outputMoney(Sum_Out.toString());
$("h_goodspfsl").value=$("txt_goodspfsl").value;
$("txt_packnum").value = outputMoney(amountpack.toString());//h_packnum
$("h_packnum").value = $("txt_packnum").value;
}
function AddWmsOut(){ //添加出库单
$("h_outbsno").value="";
$("h_IsFeeGain").value="1";
$("ck_jsfee").checked=1;
$("h_Ischange").Value ="0";
$("btn_Out").InnerHtml = "生成出库单";
$("h_wmsoutbsno").Value = "";
$("h_Mode").value="0";
$("txt_outdate").value="";
$("txt_oldcustfeedate").value = "";
$("txt_outbsno").value="";
$("h_addmode").value="1";
initCombos();
createOrder();
//initGrid();
//initDownFeeName();
//initMenu();
initTj();
}
function DeleteWmsOut(){ //删除出库单
if($("txt_outbsno").value == ""){
return;
}
if(window.confirm("您确定要将选中的出库单删除")){
//
var urlVal = "../SeaiInfoLCL/WmsRateLCLGridSource.aspx?handle=getislock&gids=" + $("txt_outbsno").value + "&val=" + newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var ls = loader.xmlDoc.responseText;
if (ls.trim() != "0") {
alert("已入账的信息,不允许删除!");
return;
}
else {
var strREMARK = commonGridObj_wmsin.getGridObj().cellByIndex(0, 25).getValue();
if (strREMARK.trim() == "货权转移") {
urlVal = "../SeaiInfoLCL/WmsRateLCLGridSource.aspx?handle=getiswmsin&gids=" + $("txt_outbsno").value + "&val=" + newGuid();
loader = dhtmlxAjax.getSync(urlVal);
ls = loader.xmlDoc.responseText;
if (ls.trim() != "0") {
alert("有已入库的货权转移信息,不允许删除!");
return;
}
}
//
var url = "../SeaiInfoLCL/WmsRateLCLGridSource.aspx?handle=deletewmsout&wmsoutgid=" + $("h_outgid").value;
var loader = dhtmlxAjax.getSync(url);
var deleteState = parseInt(loader.xmlDoc.responseText);
if (deleteState == 1) {
alert("成功删除出库单:" + $("txt_outbsno").value);
//AddWmsOut();
window.parent.opener.location.href = window.parent.opener.location.href;
window.close();
}
else {
alert("删除出库单,失败!");
}
}
}
}
function reloadParent(sINBSNO, sASSOCIATEDNO) {
alert('货权转移成功');
window.parent.opener.location.href = window.parent.opener.location.href;
//
var URLs = "../SeaiInfoLCL/WmsLCLInfo.aspx?handle=edit&id=" + sINBSNO + "&associatedno=" + sASSOCIATEDNO + "&val=" + newGuid();
window.open(URLs, "_blank", "height=630px, width=1000px,center:yes,help:no,toolbar=no,menubar=no,scrollbars=no,resizable=0,location=no,status=no,Top= " + (screen.height / 2 - 400) + ",Left= " + (screen.width / 2 - 400));
}
function setislock() {
var checked = $("h_outgid").value;
if (checked != null && checked != "") {
var urlVal = "../SeaiInfoLCL/WmsRateLCLGridSource.aspx?handle=getislock&gids=" + checked + "&val=" + newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var ls = loader.xmlDoc.responseText;
if (ls.trim() != "0") {
alert("已入账的信息,不允许操作!");
return;
}
//
if (confirm('费用确定入账吗?(入账后将不允许修改删除数据!)')) {
var urlVal = "WmsRateLCLGridSource.aspx?handle=islock&gids=" + checked + "&val=" + newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var strDel = loader.xmlDoc.responseText;
if (strDel.trim() != "") {
alert(strDel);
return;
}
createOrder();
window.parent.opener.location.href = window.parent.opener.location.href;
}
}
else {
alert('未选中要操作的数据!');
return;
}
}
function setnotlock() {
var checked = $("h_outgid").value;
if (checked != null && checked != "") {
var urlVal = "../SeaiInfoLCL/WmsRateLCLGridSource.aspx?handle=getislock&gids=" + checked + "&val=" + newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var ls = loader.xmlDoc.responseText;
if (ls.trim() == "0") {
alert("未入账的信息,不允许操作!");
return;
}
//
if (confirm('确定取消入账吗?(只有“未申请开票、未开发票、未对帐”的入账数据允许取消!)')) {
var urlVal = "WmsRateLCLGridSource.aspx?handle=notlock&gids=" + checked + "&val=" + newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var strDel = loader.xmlDoc.responseText;
if (strDel.trim() != "") {
alert(strDel);
return;
}
createOrder();
window.parent.opener.location.href = window.parent.opener.location.href;
}
}
else {
alert('未选中要操作的数据!');
return;
}
}
function PrintWmsOut(){
var strOutBsno = "";
strOutBsno = $("h_outbsno").value;
if(strOutBsno == ""){
return;
}
var strBSNO = "";
strBSNO = $("h_outbsno").value;
var printUrl = "";
var companyID = "";
var typeName = "WMSOUTREPORT";
var dbSourceID = "";
var userID = "";
var url = "../Reports/ReportService.aspx?handle=printwmsout&bsno="+strBSNO+"&val="+newGuid();
typeName = "WMSOUTREPORT";
var loader = dhtmlxAjax.getSync(url);
var reportVal = loader.xmlDoc.responseText;
var reportObj = null;
if(reportVal != ""){
reportObj = eval('(' + reportVal + ')');
if(reportObj.reports.length > 0){
if(reportObj.reports[0].compid != ""){
companyID = reportObj.reports[0].compid;
}
if(reportObj.reports[0].sourceid != ""){
dbSourceID = reportObj.reports[0].sourceid;
}
if(reportObj.reports[0].compid != ""){
userID = reportObj.reports[0].userid;
}
printUrl = "print://?comp="+companyID+"&type="+typeName+"&dbid="+dbSourceID+"&uid="+userID;//alert(printUrl);
window.location.href = window.location.href;
location.href = printUrl;
}
}else{
alert("没有要打印的报表");
return;
}
}