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/WmsOutList.js

983 lines
42 KiB
JavaScript

3 years ago
var commonGridObj_invoiceApp;
var comboCustomer;//委托单位
var comboSTORAGENAME; //仓库
var pressRecord;
function $(id){
return document.getElementById(id);
}
function SearchJson(id) {//编辑费率条件
var bsno=commonGridObj_invoiceApp.getGridObj().cellById(id,17).getValue();
var cust=commonGridObj_invoiceApp.getGridObj().cellById(id,9).getValue();
var newcust=commonGridObj_invoiceApp.getGridObj().cellById(id,10).getValue().trim()
var outdate=commonGridObj_invoiceApp.getGridObj().cellById(id,12).getValue();
var goodsname=commonGridObj_invoiceApp.getGridObj().cellById(id,6).getValue().trim();
var goodsmodel=commonGridObj_invoiceApp.getGridObj().cellById(id,7).getValue().trim();
var outnum=commonGridObj_invoiceApp.getGridObj().cellById(id,4).getValue().trim();
var packnum=commonGridObj_invoiceApp.getGridObj().cellById(id,5).getValue();
var outfee=commonGridObj_invoiceApp.getGridObj().cellById(id,21).getValue().trim();
var opseaibsno=commonGridObj_invoiceApp.getGridObj().cellById(id,24).getValue().trim();
var searchJson = "";
searchJson +="{";
searchJson += "[";
searchJson += "\"id\":\""+id+"\",";
searchJson += "\"bsno\":\""+bsno+"\",";
searchJson += "\"cust\":\""+cust+"\",";
searchJson += "\"outdate\":\""+outdate+"\",";
searchJson += "\"goodsname\":\""+goodsname+"\",";
searchJson += "\"goodsmodel\":\""+goodsmodel+"\",";
searchJson += "\"outnum\":\""+outnum+"\",";
searchJson += "\"packnum\":\""+packnum+"\",";
searchJson += "\"outfee\":\""+outfee+"\",";
searchJson += "\"opseaibsno\":\""+opseaibsno+"\",";
searchJson += "\"newcust\":\""+newcust+"\"";
searchJson += "]";
searchJson +="}";
return searchJson;
}
//全选框
function checkall() {
var checkStatus = $("ck_all").checked;
if (checkStatus == 1) {
var iCount = commonGridObj_invoiceApp.getGridObj().getRowsNum();
for (var i = 0; i < iCount; i++) {
commonGridObj_invoiceApp.getGridObj().cellByIndex(i, 0).setValue(1);
}
}
else {
var iCount = commonGridObj_invoiceApp.getGridObj().getRowsNum();
for (var i = 0; i < iCount; i++) {
commonGridObj_invoiceApp.getGridObj().cellByIndex(i, 0).setValue(0);
}
}
}
function createGrid() {
$("Pm1").style.display="";
$("Pm2").style.display="";
$("Bh1").style.display="";
$("Bh2").style.display = "";
$("Td1").style.display = "";
$("Td2").style.display = "";
//header
$("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是否代理收费";
// 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_invoiceapp = new Array("<input type=\"checkbox\" id=\"ck_all\" onclick=\"checkall()\" />", "入账", "货转", "提单号", "重量", "件数", "品名", "牌号", "备案清单号", "货主", "转移对象", "入库日期", "出库日期", "开始计费日期", "结束计费日期", "车号", "转移单号", "出库单号", "应收客户", "应付客户", "计费单位", "仓储费", "开单人", "开单时间", "进口委托单号", "批次号", "是否代理收费");
var widthArgs_invoiceapp = new Array("30", "30", "60", "120", "80", "80", "80", "80", "80", "100", "100", "80", "80", "80", "80", "100", "120", "100", "80", "80", "60", "80", "80", "120", "0", "100", "100");
//column align
var colAlignArgs_invoiceapp = 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", "center", "center");
//column sort
var colSortArgs_invoiceapp = 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", "str", "str");
//column type
var colTypeArgs_invoiceapp = 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", "ro", "ro");
commonGridObj_invoiceApp = new TGridCommon("mygrid_container_invoiceapp","form1",headerArgs_invoiceapp,widthArgs_invoiceapp,colAlignArgs_invoiceapp,colSortArgs_invoiceapp,colTypeArgs_invoiceapp);
commonGridObj_invoiceApp.setResponseUrl("../SeaiFee/WmsRateGridSource.aspx");
if ($("h_searchJson").value != "" && $("h_searchJson").value != null) {
var kd = $("h_bsno").value;
var kddd = $("h_searchJson").value;
commonGridObj_invoiceApp.setRequest("../SeaiFee/WmsRateGridSource.aspx?handle=wmsoutlist&show_page=15&cur_page=1&search=" + escape($("h_searchJson").value) + "&bsno=" + $("h_bsno").value + "&uid=" + commonGridObj_invoiceApp.newGuid());
commonGridObj_invoiceApp.setSearch($("h_searchJson").value);
commonGridObj_invoiceApp.setMultiple("&search=" +escape($("h_searchJson").value));
}
else {
var kd = $("h_bsno").value;
var kddd = $("h_searchJson").value;
commonGridObj_invoiceApp.setRequest("../SeaiFee/WmsRateGridSource.aspx?handle=wmsoutlist&show_page=15&cur_page=1&bsno=" + $("h_bsno").value + "&uid=" + commonGridObj_invoiceApp.newGuid());
commonGridObj_invoiceApp.setMultiple("&bsno=" + $("h_bsno").value);
}
commonGridObj_invoiceApp.setSourceType("json");
commonGridObj_invoiceApp.setSkin("xp");
commonGridObj_invoiceApp.setImageUrl("../images/");
commonGridObj_invoiceApp.initGrid();
commonGridObj_invoiceApp.bind();
commonGridObj_invoiceApp.setPageShowCount("15");
commonGridObj_invoiceApp.isSort = true;
commonGridObj_invoiceApp.initPageByHandle("wmsoutlist");
commonGridObj_invoiceApp.isDBClickEvent = true;
commonGridObj_invoiceApp.getGridObj().attachEvent("onRowDblClicked", function (rId, cInd) {
var isdisabled = false;
var islock = false;
var urlVal = "../SeaiFee/WmsRateGridSource.aspx?handle=getislock&gids=" + rId + "&bsno=" + $("h_bsno").value + "&val=" + commonGridObj_invoiceApp.newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var ls = loader.xmlDoc.responseText;
if (ls.trim() != "0") {
alt = "已入账的信息,不允许修改!";
isdisabled = true;
islock = true;
}
else {
urlVal = "../SeaiFee/WmsRateGridSource.aspx?handle=getiswmsin&gids=" + rId + "&bsno=" + $("h_bsno").value + "&val=" + commonGridObj_invoiceApp.newGuid();
loader = dhtmlxAjax.getSync(urlVal);
ls = loader.xmlDoc.responseText;
if (ls.trim() != "0") {
alt = "已入库的货权转移信息,不允许修改!";
isdisabled = true;
}
}
//
//获取当前RowIndex
var RowIndex = commonGridObj_invoiceApp.getGridObj().getRowIndex(rId);
//触发操作事件前获取单元值
var ischangecust = commonGridObj_invoiceApp.getGridObj().cellByIndex(RowIndex, 2).getValue();
if (ischangecust == "货权转移") {
ischangecust = 1;
}
else {
ischangecust = 0;
}
//
var openSet = "height=700, width=1200, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top=10,Left=100";
var openType = "_blank";
//获取当前RowIndex
var rowIndex = commonGridObj_invoiceApp.getGridObj().getRowIndex(rId);
//触发操作事件前获取单元值
var strCBM = commonGridObj_invoiceApp.getGridObj().cellByIndex(rowIndex, 20).getValue();
if (strCBM.trim() == "CBM")
{
var openUrl = "../SeaiFee/WmsOutEditCBM.aspx?handle=edit&outgid=" + rId + "&ischangecust=" + ischangecust + "&isdisabled=" + isdisabled + "&islock=" + islock;
window.open(openUrl, openType, openSet);
}
else
{
var openUrl = "../SeaiFee/WmsOutEdit.aspx?handle=edit&outgid=" + rId + "&ischangecust=" + ischangecust + "&isdisabled=" + isdisabled + "&islock=" + islock;
window.open(openUrl, openType, openSet);
}
});
//
commonGridObj_invoiceApp.dbclickEvent = function () {
commonGridObj_invoiceApp.getGridObj().attachEvent("onRowDblClicked", function (rId, cInd) {
var isdisabled = false;
var islock = false;
var urlVal = "../SeaiFee/WmsRateGridSource.aspx?handle=getislock&gids=" + rId + "&bsno=" + $("h_bsno").value + "&val=" + commonGridObj_invoiceApp.newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var ls = loader.xmlDoc.responseText;
if (ls.trim() != "0") {
alt = "已入账的信息,不允许修改!";
isdisabled = true;
islock = true;
}
else {
urlVal = "../SeaiFee/WmsRateGridSource.aspx?handle=getiswmsin&gids=" + rId + "&bsno=" + $("h_bsno").value + "&val=" + commonGridObj_invoiceApp.newGuid();
loader = dhtmlxAjax.getSync(urlVal);
ls = loader.xmlDoc.responseText;
if (ls.trim() != "0") {
alt = "已入库的货权转移信息,不允许修改!";
isdisabled = true;
}
}
//获取当前RowIndex
var RowIndex = commonGridObj_invoiceApp.getGridObj().getRowIndex(rId);
//触发操作事件前获取单元值
var ischangecust = commonGridObj_invoiceApp.getGridObj().cellByIndex(RowIndex, 2).getValue();
if (ischangecust == "货权转移") {
ischangecust = 1;
}
else {
ischangecust = 0;
}
//
var openSet = "height=700, width=1200, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top=10,Left=100";
var openType = "_blank";
//获取当前RowIndex
var rowIndex = commonGridObj_invoiceApp.getGridObj().getRowIndex(rId);
//触发操作事件前获取单元值
var strCBM = commonGridObj_invoiceApp.getGridObj().cellByIndex(rowIndex, 20).getValue();
if (strCBM.trim() == "CBM")
{
var openUrl = "../SeaiFee/WmsOutEditCBM.aspx?handle=edit&outgid=" + rId + "&ischangecust=" + ischangecust + "&islock=" + islock;
window.open(openUrl, openType, openSet);
}
else
{
var openUrl = "../SeaiFee/WmsOutEdit.aspx?handle=edit&outgid=" + rId + "&ischangecust=" + ischangecust + "&islock=" + islock;
window.open(openUrl, openType, openSet);
}
});
}
//根据货权转移状态设置行颜色
setTimeout(function () {
markStatusColor(commonGridObj_invoiceApp);
},300);
//
getFPK();
}// createGrid() end
function markStatusColor(gridObj) {
var count = gridObj.getGridObj().getRowsNum();
for (var i = 0; i < count; i++) {
var status = gridObj.getGridObj().cellByIndex(i, 2).getValue();
var rowId = gridObj.getGridObj().getRowId(i);
switch (status) {
case "货权转移":
gridObj.getGridObj().setRowColor(rowId, "#FF8C00");
break;
default:
break;
}
}
}
function getFPK() {
var urlVal = "";
if ($("h_searchJson").value != "" && $("h_searchJson").value != null) {
urlVal = "../SeaiFee/WmsRateGridSource.aspx?handle=getfpk&search=" + escape($("h_searchJson").value) + "&bsno=" + $("h_bsno").value + "&uid=" + commonGridObj_invoiceApp.newGuid();
}
else {
urlVal = "../SeaiFee/WmsRateGridSource.aspx?handle=getfpk&bsno=" + $("h_bsno").value + "&uid=" + commonGridObj_invoiceApp.newGuid();
}
loader = dhtmlxAjax.getSync(urlVal);
loadVal = loader.xmlDoc.responseText;
//
var selGroup = new Array();
selGroup = loadVal.split(",");
$("divFeeVH").innerHTML = selGroup[0].toString().trim();
$("divFeeVH2").innerHTML = selGroup[1].toString().trim();
$("divFeeVH3").innerHTML = selGroup[2].toString().trim();
$("divFeeVH4").innerHTML = selGroup[3].toString().trim();
$("divPACKVH").innerHTML = selGroup[4].toString().trim();
$("divKGSVH").innerHTML = selGroup[5].toString().trim();
}
function initCombo() {
createComboCustomer(); //结算单位
createComboSTORAGENAME(); //仓库
createComboGoods(); //货物描述类型
createComboCLIENTNAMEOLD(); //货权转移的客户名称
}
function addApplication(){
//异步执行操作
var rId = commonGridObj_invoiceApp.getGridObj().getSelectedRowId();
var openSet = "height=700, width=1200, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top=10,Left=100";
var openType = "_blank";
var openUrl = "../SeaiFee/WmsOutEdit.aspx?handle=addwmsout&ischangecust=0&bsno="+$("h_bsno").value;
window.open (openUrl,openType,openSet);
}
function addApplication2() {
var rId = commonGridObj_invoiceApp.getGridObj().getSelectedRowId();
var openSet = "height=700, width=1200, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top=10,Left=100";
var openType = "_blank";
var openUrl = "../SeaiFee/WmsOutEditCBM.aspx?handle=addwmsout&ischangecust=0&bsno=" + $("h_bsno").value;
window.open(openUrl, openType, openSet);
}
function changecustomer(){
var rId = commonGridObj_invoiceApp.getGridObj().getSelectedRowId();
var openSet = "height=700, width=1200, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top=10,Left=100";
var openType = "_blank";
var openUrl = "../SeaiFee/WmsOutEdit.aspx?handle=addwmsout&ischangecust=1&bsno=" + $("h_bsno").value;
window.open (openUrl,openType,openSet);
}
function changecustomer2() {
var rId = commonGridObj_invoiceApp.getGridObj().getSelectedRowId();
var openSet = "height=700, width=1200, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top=10,Left=100";
var openType = "_blank";
var openUrl = "../SeaiFee/WmsOutEditCBM.aspx?handle=addwmsout&ischangecust=1&bsno=" + $("h_bsno").value;
window.open(openUrl, openType, openSet);
}
function refreshList(){
createGrid();
getFPK();
}
//提交发票申请
function postApplication(){
var iCount = 0;
var iSuccess = 0;
var iNoExist = 0;
var iIsPost = 0;
var iError = 0;
var iNoPower = 0;
var strNotes = "";
if(commonGridObj_invoiceApp != null){
for(var i = 0;i<commonGridObj_invoiceApp.getGridObj().getRowsNum();i++){
var rowId = commonGridObj_invoiceApp.getGridObj().getRowId(i);
var chBox = commonGridObj_invoiceApp.getGridObj().cellByIndex(i,0).getValue();
//如果选中,则将保存的开发票申请提交,提交前先判断当前发票申请是否已经提交申请
if(chBox == 1){
iCount++;
//异步执行操作
var url = "../SeaiFee/WmsRateGridSource.aspx?appid="+rowId+"&handle=postApply&uid="+commonGridObj_invoiceApp.newGuid();
var loader = dhtmlxAjax.getSync(url);
var postStatus = loader.xmlDoc.responseText;
var status = parseInt(postStatus);
switch(status){
case 1:
createGrid();
getFPK();
strNotes = "开票申请提交成功";
iSuccess++;
break;
case -1:
strNotes = "开票申请不存在";
iNoExist++;
break;
case -2:
strNotes = "开票申请已提交,不能重复提交";
iIsPost++;
break;
case -3:
strNotes = "开票申请提交异常";
iError++;
break;
case -4:
strNotes = "没有权限提交发票申请";
iNoPower++;
break;
}
}
}
if(iCount == 0){
alert("您没有选择要提交的开票申请");
}else if(iCount == 1){
alert(strNotes);
}else if(iCount > 1){
alert("共操作"+iCount+"条 成功"+iSuccess+"条 不存在记录"+iNoExist+"条 已提交不能删除"+iIsPost+"条 异常"+iError+"条 无权限删除"+iNoPower+"条");
}
}
}
function deleteUnpostApplication()
{
//删除出库单
var iCount = 0;
var iDelCount = 0;
var iFailure = 0;
var alt = "";
if (commonGridObj_invoiceApp != null) {
var ii = GetRange();
if (ii == 0) {
return;
}
//
if (window.confirm("您确定要将选中的出库单删除")) {
for(var i=0;i<commonGridObj_invoiceApp.getGridObj().getRowsNum();i++){
var gID = commonGridObj_invoiceApp.getGridObj().getRowId(i);
var isCheckState = commonGridObj_invoiceApp.getGridObj().cellByIndex(i, 0).getValue();
var isCBM = commonGridObj_invoiceApp.getGridObj().cellByIndex(i, 20).getValue();
//
if(isCheckState == 1){
//
var urlVal = "../SeaiFee/WmsRateGridSource.aspx?handle=getislock&gids=" + gID + "&bsno=" + $("h_bsno").value + "&val=" + commonGridObj_invoiceApp.newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var ls = loader.xmlDoc.responseText;
if (ls.trim() != "0") {
iFailure++;
alt += "已入账的信息,不允许删除!";
}
else {
urlVal = "../SeaiFee/WmsRateGridSource.aspx?handle=getiswmsin&gids=" + gID + "&bsno=" + $("h_bsno").value + "&val=" + commonGridObj_invoiceApp.newGuid();
loader = dhtmlxAjax.getSync(urlVal);
ls = loader.xmlDoc.responseText;
if (ls.trim() != "0") {
iFailure++;
alt += "已入库的货权转移信息,不允许删除!";
}
else {
var url = "";
if (isCBM.trim() == "CBM") {
url = "../SeaiFee/WmsOutEditCBMGridSource.aspx?handle=deletewmsout&bsno=" + $("h_bsno").value + "&wmsoutgid=" + gID;
}
else {
url = "../SeaiFee/WmsRateGridSource.aspx?handle=deletewmsout&bsno=" + $("h_bsno").value + "&wmsoutgid=" + gID;
}
var loader = dhtmlxAjax.getSync(url);
var deleteState = parseInt(loader.xmlDoc.responseText);
if (deleteState == 1) {
iDelCount++;
}
else {
iFailure++;
}
}
iCount++;
}
}
}
if (iCount>0){
alert("提交出库单删除 "+iCount+" 条 成功 "+iDelCount+" 条 失败 "+iFailure+" 条!" + alt);
}
else {
if (iFailure > 0) {
alert("提交出库单删除失败 " + iFailure + " 条!" + alt);
}
}
}
}
createGrid();
getFPK();
}
//根据条件查询付费申请信息
function search(){
GetSearchJoin();//检查查询条件
createGrid();
getFPK();
}
function GetSearchJoin(){
var beginetd = $("txt_beginDate").value.trim();
if(beginetd.trim() != ""){
if(!validateDateTime(beginetd)){
alert("起始时间格式错误");
return;
}
}
var endetd = $("txt_endDate").value.trim();
if(endetd.trim() != ""){
if(!validateDateTime(endetd)){
alert("结束时间格式错误");
return;
}
}
//如果查询条件设置了起始时间和结束时间则判断结束时间是否大于起始时间
if(beginetd != "" && endetd != ""){
if(beginetd.length > 9 && endetd.length > 9){
var status = DateTimeEqual(beginetd,endetd);
if(status == 0){
searchJson += "\"btime\":\""+beginetd+"\","
searchJson += "\"etime\":\""+endetd+"\","
}else if(status == -1){
alert("时间设置错误,起始时间不能大于结束时间,请修改!");
return;
}
// else if(status == -2){
// alert("时间设置错误,起始时间不能等于结束时间,请修改!");
// return;
// }
}
else{
alert("时间格式有问题,长度应大于9个字符,请修改!");
return;
}
}
$("h_beginetd").value = $("txt_beginDate").value;
$("h_endetd").value = $("txt_endDate").value;
var cus = $("h_customer").value;
var goods = $("h_goods").value;
var bsno = $("h_bsno").value;
var storagename = $("h_STORAGENAME").value;
var CLIENTNAMEOLD = $("h_CLIENTNAMEOLD").value;
var ischange = $("ddlISCHANGE").value;
var searchJson = "";
searchJson +="{";
searchJson += "[";
searchJson += "\"cus\":\""+cus+"\",";
searchJson += "\"clientnameold\":\"" + CLIENTNAMEOLD + "\",";
searchJson += "\"storagename\":\"" + storagename + "\",";
searchJson += "\"ischange\":\"" + ischange + "\",";
searchJson += "\"bt\":\""+beginetd+"\",";
searchJson += "\"et\":\""+endetd+"\",";
searchJson += "\"goods\":\""+goods+"\",";
searchJson += "\"associatedno\":\"" + $("h_bsno").value + "\",";
searchJson += "\"bsno\":\"" + $("txt_bsno").value + "\",";
searchJson += "\"goodsstandard\":\"" + $("txt_goodsstandard").value + "\"";
searchJson += "]";
searchJson +="}";
$("h_searchJson").value=searchJson;
}
//校验时间格式
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;
}
String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g,""); }
function createComboCustomer(){//委托单位
comboCustomer = dhtmlXComboFromSelect("sel_customer");
comboCustomer.loadXML("../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0");
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();
});
}
function createComboCLIENTNAMEOLD() {//货权转移的客户名称
comboCLIENTNAMEOLD = dhtmlXComboFromSelect("sel_CLIENTNAMEOLD");
comboCLIENTNAMEOLD.loadXML("../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0");
comboCLIENTNAMEOLD.attachEvent("onChange", function () { comboCLIENTNAMEOLD.setComboText($("h_CLIENTNAMEOLD").value); });
comboCLIENTNAMEOLD.attachEvent("onBlur", function () {
var s1 = comboCLIENTNAMEOLD.getComboText().trim();
var s2 = s1.indexOf("|");
if (s2 > 0) {
s2 = s2 + 2;
}
var s3 = s1.substring(s2);
if (s2 > 0) {
comboCLIENTNAMEOLD.setComboText(s3);
$("h_CLIENTNAMEOLD").value = s3;
}
else {
comboCLIENTNAMEOLD.setComboText($("h_CLIENTNAMEOLD").value);
}
});
comboCLIENTNAMEOLD.setComboText($("h_CLIENTNAMEOLD").value);
comboCLIENTNAMEOLD.attachEvent("onKeyPressed", function (keyCode) {
if (keyCode != "8") {
var arrayArg = new Array();
setTimeout(function () {
var filterCount = 0;
var is = -1;
var ishd = $("h_CLIENTNAMEOLD").value.trim();
if ("" != comboCLIENTNAMEOLD.getComboText().trim()) {
while ("undefined" != typeof comboCLIENTNAMEOLD.getOptionByIndex(filterCount)) {
var comboValue = comboCLIENTNAMEOLD.getOptionByIndex(filterCount).text.toUpperCase(); //.value;
var enterValue = comboCLIENTNAMEOLD.getComboText().trim().toUpperCase();
$("h_CLIENTNAMEOLD").value = comboCLIENTNAMEOLD.getComboText().trim().toUpperCase();
if (comboValue.indexOf(enterValue) == 0) {
comboCLIENTNAMEOLD.selectOption(filterCount, true, true);
is = filterCount;
break;
}
++filterCount;
}
if (is == -1) {
$("h_CLIENTNAMEOLD").value = ishd;
alert("无此内容,请重新选择!");
}
}
}, 10);
}
});
comboCLIENTNAMEOLD.attachEvent("onSelectionChange", function () {
$("h_CLIENTNAMEOLD").value = comboCLIENTNAMEOLD.getComboText().trim();
});
}
function createComboSTORAGENAME(){//仓库
comboSTORAGENAME = dhtmlXComboFromSelect("sel_STORAGENAME");
comboSTORAGENAME.loadXML("../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0");
comboSTORAGENAME.attachEvent("onChange", function(){ comboSTORAGENAME.setComboText($("h_STORAGENAME").value); });
comboSTORAGENAME.attachEvent("onBlur", function(){
var s1 = comboSTORAGENAME.getComboText().trim();
var s2 = s1.indexOf("|");
if(s2>0){
s2=s2+2;
}
var s3 = s1.substring(s2);
if(s2>0){
comboSTORAGENAME.setComboText(s3);
$("h_STORAGENAME").value=s3;
}
else
{
comboSTORAGENAME.setComboText($("h_STORAGENAME").value);
}
});
comboSTORAGENAME.setComboText($("h_STORAGENAME").value);
comboSTORAGENAME.attachEvent("onKeyPressed", function(keyCode){
if(keyCode!="8"){
var arrayArg = new Array();
setTimeout(function(){
var filterCount = 0;
var is = -1;
var ishd = $("h_STORAGENAME").value.trim();
if("" != comboSTORAGENAME.getComboText().trim()){
while("undefined" != typeof comboSTORAGENAME.getOptionByIndex(filterCount)){
var comboValue = comboSTORAGENAME.getOptionByIndex(filterCount).text.toUpperCase();//.value;
var enterValue = comboSTORAGENAME.getComboText().trim().toUpperCase();
$("h_STORAGENAME").value = comboSTORAGENAME.getComboText().trim().toUpperCase();
if(comboValue.indexOf(enterValue) == 0){
comboSTORAGENAME.selectOption(filterCount,true,true);
is=filterCount;
break;
}
++filterCount;
}
if(is==-1){
$("h_STORAGENAME").value = ishd;
alert("无此内容,请重新选择!");
}
}
},10);
}
});
comboSTORAGENAME.attachEvent("onSelectionChange", function(){ $("h_STORAGENAME").value = comboSTORAGENAME.getComboText().trim(); });
}
function initComboGoods(){//货物描述类型ok
comboCustomer = new TCombo("sel_goods", "../SeaiFee/WmsRateGridSource.aspx?handle=goodslist", true, true, false, true, "h_goods");
comboCustomer.initComboEvent();
comboCustomer.bind();
}
function createComboGoods(){//货物描述类型ok
comboGoods = dhtmlXComboFromSelect("sel_goods");
comboGoods.loadXML("../SeaiFee/WmsRateGridSource.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 initGrid(){
$("h_customer").value = "";
comboCustomer.setComboText($("h_customer").value);
$("h_STORAGENAME").value = "";
comboSTORAGENAME.setComboText($("h_STORAGENAME").value);
$("ddlISCHANGE").value = "";
$("txt_beginDate").value = "";
$("txt_endDate").value = "";
$("h_goods").value="";
comboGoods.setComboText($("h_goods").value);
$("txt_bsno").value = "";
$("txt_goodsstandard").value = "";
$("h_searchJson").value = "";
createGrid(); //重新填充数据
getFPK();
}
//导出Excel
function setExcel() {
if (confirm('确定要导出报表吗?')) {
var strBSNO = commonGridObj_invoiceApp.getGridObj().getCheckedRows(0); //所有选中的grid的id编号
var loader = dhtmlxAjax.getSync("WmsRateGridSource.aspx?handle=setexcel&gids=" + strBSNO + "&search=" + escape($("h_searchJson").value) + "&bsno=" + $("h_bsno").value + "&uid=" + commonGridObj_invoiceApp.newGuid());
$("hdSQL").value = loader.xmlDoc.responseText;
document.getElementById("btExcel1").click();
}
}
function printInvoice(){
var strBSNO = "";
strBSNO = commonGridObj_invoiceApp.getGridObj().getCheckedRows(0); //所有选中的grid的id编号
var printUrl = "";
var companyID = "";
var typeName = "WMSOUTLISTREPORT";
var dbSourceID = "";
var userID = "";
GetSearchJoin();
var url = "../Reports/ReportService.aspx?handle=printwmsoutlist&associatedno=" + $("h_bsno").value + "&bsno=" + strBSNO + "&search=" + escape($("h_searchJson").value) + "&val=" + commonGridObj_invoiceApp.newGuid();
typeName = "WMSOUTLISTREPORT";
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;
}
}
function printInvoice2() {
var strBSNO = "";
strBSNO = commonGridObj_invoiceApp.getGridObj().getCheckedRows(0); //所有选中的grid的id编号
var printUrl = "";
var companyID = "";
var typeName = "WMSOUTLISTREPORT2";
var dbSourceID = "";
var userID = "";
GetSearchJoin();
var url = "../Reports/ReportService.aspx?handle=printwmsoutlist2&associatedno=" + $("h_bsno").value + "&bsno=" + strBSNO + "&search=" + escape($("h_searchJson").value) + "&val=" + commonGridObj_invoiceApp.newGuid();
typeName = "WMSOUTLISTREPORT2";
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;
}
}
function setislock() {
var sGID = "";
var checked = commonGridObj_invoiceApp.getGridObj().getCheckedRows(0); //所有选中的grid的id编号
var arrtmp = checked.split(","); //将各参数分离形成参数数组
for (i = 0; i < arrtmp.length; i++) {
var selectedId = arrtmp[i].toString().trim();
var rowIndex = commonGridObj_invoiceApp.getGridObj().getRowIndex(selectedId);
var oldVal = commonGridObj_invoiceApp.getGridObj().cellByIndex(rowIndex, 1).getValue().trim();
if (oldVal != "是") {
sGID += "," + arrtmp[i].toString().trim()
}
}
checked = sGID.substr(1);
//
if (checked != null && checked != "") {
var ii = GetRange();
if (ii == 0) {
return;
}
//
if (confirm('费用确定入账吗?(入账后将不允许修改删除数据!)')) {
var urlVal = "WmsRateGridSource.aspx?handle=islock&gids=" + checked + "&bsno=" + $("h_bsno").value + "&val=" + commonGridObj_invoiceApp.newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var strDel = loader.xmlDoc.responseText;
if (strDel.trim() != "") {
alert(strDel);
}
createGrid();
}
}
else {
alert('未选中要操作的数据!');
return;
}
}
function setnotlock() {
var checked = commonGridObj_invoiceApp.getGridObj().getCheckedRows(0); //所有选中的grid的id编号
if (checked != null && checked != "") {
var ii = GetRange();
if (ii == 0) {
return;
}
//
if (confirm('确定取消入账吗?(只有“未申请开票、未开发票、未对帐”的入账数据允许取消!)')) {
var urlVal = "WmsRateGridSource.aspx?handle=notlock&gids=" + checked + "&bsno=" + $("h_bsno").value + "&val=" + commonGridObj_invoiceApp.newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var strDel = loader.xmlDoc.responseText;
if (strDel.trim() != "") {
alert(strDel);
}
createGrid();
}
}
else {
alert('未选中要操作的数据!');
return;
}
}
function GetRange() {
var loader;
var dates;
var strR = "";
//var strgid = commonGridObj_invoiceApp.getGridObj().getSelectedRowId();
var checked = commonGridObj_invoiceApp.getGridObj().getCheckedRows(0); //所有选中的grid的id编号
if (checked != null && checked != "") {
if ($("hdRangeV").value != $("hdRangeO").value) {
if ($("hdRangeO").value == "1")//分公司
{
loader = dhtmlxAjax.getSync("../FeeCodes/RangeAdapter.aspx?RangeID=1&strGID=" + checked + "&RangeName=modWmsOutList&val=" + commonGridObj_invoiceApp.newGuid());
dates = loader.xmlDoc.responseText;
if (dates == "") {
alert("您没有操作此数据的权限!");
return 0;
}
}
else if ($("hdRangeO").value == "2")//部门
{
loader = dhtmlxAjax.getSync("../FeeCodes/RangeAdapter.aspx?RangeID=2&strGID=" + checked + "&RangeName=modWmsOutList&val=" + commonGridObj_invoiceApp.newGuid());
dates = loader.xmlDoc.responseText;
if (dates == "") {
alert("您没有操作此数据的权限!");
return 0;
}
}
else if ($("hdRangeO").value == "3")//个人
{
loader = dhtmlxAjax.getSync("../FeeCodes/RangeAdapter.aspx?RangeID=3&strGID=" + checked + "&RangeName=modWmsOutList&val=" + commonGridObj_invoiceApp.newGuid());
dates = loader.xmlDoc.responseText;
if (dates == "") {
alert("您没有操作此数据的权限!");
return 0;
}
}
}
}
}
//var ii = GetRange();
//if (ii == 0) {
// return;
//}
function getOnload() {
//新框架传值
try {
var parentWin = window.parent.opener;
var opStatus = 'edit';
var storeList = null;
var editRecord = null;
var sdsd = "";
if (parentWin) {
var ret = parentWin.OprationSwap();
opStatus = ret[0];
storeList = ret[1];
editRecord = ret[2];
$("h_bsno").value = editRecord.internalId.toString();
$("h_showPm").value = "0";
}
} catch (err) { }
//
resizeGrid('mygrid_container_invoiceapp', 'gridContain', 'dvContainer', 230);
createGrid();
initCombo();
}