|
|
|
|
var commonGridObj_invoiceApp;
|
|
|
|
|
var comboCustomer;//委托单位
|
|
|
|
|
var pressRecord;
|
|
|
|
|
|
|
|
|
|
function $(id){
|
|
|
|
|
return document.getElementById(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function SearchJson(id) {//编辑费率条件
|
|
|
|
|
var bsno=commonGridObj_invoiceApp.getGridObj().cellById(id,2).getValue();
|
|
|
|
|
var cust=commonGridObj_invoiceApp.getGridObj().cellById(id,4).getValue();
|
|
|
|
|
var outdate=commonGridObj_invoiceApp.getGridObj().cellById(id,5).getValue();
|
|
|
|
|
var storage = "";// commonGridObj_invoiceApp.getGridObj().cellById(id,4).getValue().trim();
|
|
|
|
|
var goodsname = ""; // commonGridObj_invoiceApp.getGridObj().cellById(id,5).getValue().trim();
|
|
|
|
|
var goodsmodel = ""; // commonGridObj_invoiceApp.getGridObj().cellById(id,6).getValue().trim();
|
|
|
|
|
var outnum=commonGridObj_invoiceApp.getGridObj().cellById(id,6).getValue().trim();
|
|
|
|
|
var outfee = ""; // commonGridObj_invoiceApp.getGridObj().cellById(id,8).getValue().trim();
|
|
|
|
|
var truckno=commonGridObj_invoiceApp.getGridObj().cellById(id,7).getValue().trim();
|
|
|
|
|
var remark=commonGridObj_invoiceApp.getGridObj().cellById(id,8).getValue().trim();
|
|
|
|
|
var wmsgid = ""; // commonGridObj_invoiceApp.getGridObj().cellById(id,14).getValue().trim();
|
|
|
|
|
var newcust = ""; // commonGridObj_invoiceApp.getGridObj().cellById(id,15).getValue().trim();
|
|
|
|
|
var packnum = ""; // commonGridObj_invoiceApp.getGridObj().cellById(id,9).getValue()
|
|
|
|
|
var searchJson = "";
|
|
|
|
|
searchJson +="{";
|
|
|
|
|
searchJson += "[";
|
|
|
|
|
searchJson += "\"id\":\""+id+"\",";
|
|
|
|
|
searchJson += "\"bsno\":\""+bsno+"\",";
|
|
|
|
|
searchJson += "\"cust\":\""+cust+"\",";
|
|
|
|
|
searchJson += "\"outdate\":\""+outdate+"\",";
|
|
|
|
|
searchJson += "\"storage\":\""+storage+"\",";
|
|
|
|
|
searchJson += "\"goodsname\":\""+goodsname+"\",";
|
|
|
|
|
searchJson += "\"goodsmodel\":\""+goodsmodel+"\",";
|
|
|
|
|
searchJson += "\"outnum\":\""+outnum+"\",";
|
|
|
|
|
searchJson += "\"outfee\":\""+outfee+"\",";
|
|
|
|
|
searchJson += "\"truckno\":\""+truckno+"\",";
|
|
|
|
|
searchJson += "\"remark\":\""+remark+"\",";
|
|
|
|
|
searchJson += "\"packnum\":\""+packnum+"\",";
|
|
|
|
|
searchJson += "\"wmsgid\":\""+wmsgid+"\",";
|
|
|
|
|
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(){
|
|
|
|
|
//header
|
|
|
|
|
$("hdNAMES").value = "出库单号\t客户单号\t出货客户\t出库日期\t出库件数\t车号\t备注\t开单人\t开单时间";
|
|
|
|
|
// 1 2 3 4 5 6 7 8 9 10
|
|
|
|
|
var headerArgs_invoiceapp = new Array("<input type=\"checkbox\" id=\"ck_all\" onclick=\"checkall()\" />", "是否锁定", "出库单号", "客户单号", "出货客户", "出库日期", "出库件数", "车号", "备注", "开单人", "开单时间");
|
|
|
|
|
//width
|
|
|
|
|
var widthArgs_invoiceapp = new Array("40", "60", "100", "100", "100", "100", "80", "80", "100", "80", "100");
|
|
|
|
|
//column align
|
|
|
|
|
var colAlignArgs_invoiceapp = new Array("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");
|
|
|
|
|
//column type
|
|
|
|
|
var colTypeArgs_invoiceapp = new Array("ch", "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("../WMS_ZX/WmsZXOutListGridSource.aspx");
|
|
|
|
|
if($("h_searchJson").value!="" && $("h_searchJson").value!=null){
|
|
|
|
|
commonGridObj_invoiceApp.setRequest("../WMS_ZX/WmsZXOutListGridSource.aspx?handle=wmsoutlist&show_page=15&cur_page=1&search="+escape($("h_searchJson").value)+"&uid="+commonGridObj_invoiceApp.newGuid());
|
|
|
|
|
commonGridObj_invoiceApp.setMultiple("&search=" +escape($("h_searchJson").value));
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
commonGridObj_invoiceApp.setRequest("../WMS_ZX/WmsZXOutListGridSource.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;
|
|
|
|
|
//window.open (self.openUrl+rId,self.openType,self.);
|
|
|
|
|
//commonGridObj_invoiceApp.openUrl = "../WMS_ZX/WmsZXOutEdit.aspx?handle=edit&outgid=";
|
|
|
|
|
//commonGridObj_invoiceApp.openType = "_blank";
|
|
|
|
|
//commonGridObj_invoiceApp.openSet ="height=500, width=1200, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " + (screen.height - 490) / 2 + ",Left= " + (screen.width - 900) / 2;
|
|
|
|
|
//commonGridObj_invoiceApp.dbclickPop(); //双击
|
|
|
|
|
|
|
|
|
|
commonGridObj_invoiceApp.getGridObj().attachEvent("onRowDblClicked", function(rId,cInd){
|
|
|
|
|
var openSet = "height=500, width=1200, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-490)/2 + ",Left= "+(screen.width-900)/2;
|
|
|
|
|
var openType = "_blank";
|
|
|
|
|
var openUrl = "../WMS_ZX/WmsZXOutEdit.aspx?handle=edit&outgid=" + rId;
|
|
|
|
|
//
|
|
|
|
|
var urlVal = "WmsZXOutListGridSource.aspx?handle=getislock&gids=" + rId + "&val=" + newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
var ls = loader.xmlDoc.responseText;
|
|
|
|
|
if (ls.trim() != "0") {
|
|
|
|
|
openUrl = "../WMS_ZX/WmsZXOutEdit.aspx?handle=edit&isenabled=false&outgid=" + rId;
|
|
|
|
|
}
|
|
|
|
|
window.open(openUrl, openType, openSet);
|
|
|
|
|
});
|
|
|
|
|
//
|
|
|
|
|
getFPK("");
|
|
|
|
|
}// createGrid() end
|
|
|
|
|
|
|
|
|
|
function getFPK(lsurl) {
|
|
|
|
|
var urlVal = "";
|
|
|
|
|
if (lsurl.trim() != "") {
|
|
|
|
|
urlVal = lsurl+"&handle=getfpk2&uid=" + commonGridObj_invoiceApp.newGuid();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if ($("h_searchJson").value != "" && $("h_searchJson").value != null) {
|
|
|
|
|
urlVal = "../WMS_ZX/WmsZXOutListGridSource.aspx?handle=getfpk2&show_page=15&cur_page=1&search=" + escape($("h_searchJson").value) + "&uid=" + commonGridObj_invoiceApp.newGuid();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
urlVal = "../WMS_ZX/WmsZXOutListGridSource.aspx?handle=getfpk2&show_page=15&cur_page=1&bsno=" + $("h_bsno").value + "&uid=" + commonGridObj_invoiceApp.newGuid();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
|
|
|
var selGroup2 = new Array();
|
|
|
|
|
selGroup2 = loadVal.split(",");
|
|
|
|
|
$("divPACKV").innerHTML = selGroup2[0].toString().trim();
|
|
|
|
|
$("divFeeV").innerHTML = selGroup2[1].toString().trim();
|
|
|
|
|
$("divKGSV").innerHTML = selGroup2[2].toString().trim();
|
|
|
|
|
|
|
|
|
|
//all
|
|
|
|
|
urlVal = "";
|
|
|
|
|
if ($("h_searchJson").value != "" && $("h_searchJson").value != null) {
|
|
|
|
|
urlVal = "../WMS_ZX/WmsZXOutListGridSource.aspx?handle=getfpk&search=" + escape($("h_searchJson").value) + "&uid=" + commonGridObj_invoiceApp.newGuid();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
urlVal = "../WMS_ZX/WmsZXOutListGridSource.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(",");
|
|
|
|
|
$("divPACKVH").innerHTML = selGroup[0].toString().trim();
|
|
|
|
|
$("divFeeVH").innerHTML = selGroup[1].toString().trim();
|
|
|
|
|
$("divKGSVH").innerHTML = selGroup[2].toString().trim();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function initCombo(){
|
|
|
|
|
createComboCustomer();//结算单位
|
|
|
|
|
createComboGoods();//货物描述类型
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function ShowDetailUpdate() {
|
|
|
|
|
var rId = commonGridObj_invoiceApp.getGridObj().getSelectedRowId();
|
|
|
|
|
var openUrl = "../WMS_ZX/WmsZXOutEdit.aspx?handle=edit&outgid=" + rId;
|
|
|
|
|
//
|
|
|
|
|
var urlVal = "../WMS_ZX/WmsZXOutListGridSource.aspx?handle=getislock&gids=" + rId + "&val=" + newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
var ls = loader.xmlDoc.responseText;
|
|
|
|
|
if (ls.trim() != "0") {
|
|
|
|
|
openUrl = "../WMS_ZX/WmsZXOutEdit.aspx?handle=edit&isenabled=false&outgid=" + rId;
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
var openSet = "height=500, width=1200, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-490)/2 + ",Left= "+(screen.width-900)/2
|
|
|
|
|
var openType = "_blank";
|
|
|
|
|
window.open (openUrl,openType,openSet);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function addApplication(){
|
|
|
|
|
// //异步执行操作
|
|
|
|
|
// var url = "../WMS_ZX/WmsZXOutListGridSource.aspx?handle=validateinvoiceapp&uid="+commonGridObj_invoiceApp.newGuid();
|
|
|
|
|
// var loader = dhtmlxAjax.getSync(url);
|
|
|
|
|
// var postStatus = loader.xmlDoc.responseText;
|
|
|
|
|
//
|
|
|
|
|
// var status = parseInt(postStatus);
|
|
|
|
|
//
|
|
|
|
|
// if(status > 0){
|
|
|
|
|
var rId = commonGridObj_invoiceApp.getGridObj().getSelectedRowId();
|
|
|
|
|
var openSet = "height=500, width=1085, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-630)/2 + ",Left= "+(screen.width-970)/2
|
|
|
|
|
var openType = "_blank";
|
|
|
|
|
//height=630, width=970,
|
|
|
|
|
|
|
|
|
|
var openUrl = "../WMS_ZX/WmsZXOutEdit.aspx?handle=addwmsout";
|
|
|
|
|
window.open (openUrl,openType,openSet);
|
|
|
|
|
// }else{
|
|
|
|
|
// alert("没有权限添加发票申请");
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function refreshList(){
|
|
|
|
|
createGrid();
|
|
|
|
|
}
|
|
|
|
|
//提交发票申请
|
|
|
|
|
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 = "../WMS_ZX/WmsZXOutListGridSource.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();
|
|
|
|
|
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 iSuccess = 0;
|
|
|
|
|
// var iNoExist = 0;
|
|
|
|
|
// var iIsPost = 0;
|
|
|
|
|
// var iError = 0;
|
|
|
|
|
// var iNoPower = 0;
|
|
|
|
|
//
|
|
|
|
|
// var strNotes = "";
|
|
|
|
|
// if(commonGridObj_invoiceApp != null){
|
|
|
|
|
// if(window.confirm("您确定要将选中的出库单删除吗?")){
|
|
|
|
|
// alert("出库单有费用信息,不能删除!");
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
var iCount = 0;
|
|
|
|
|
var iDelCount = 0;
|
|
|
|
|
var iFailure = 0;
|
|
|
|
|
var alt = "";
|
|
|
|
|
if (commonGridObj_invoiceApp != null) {
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
if(isCheckState == 1){
|
|
|
|
|
//
|
|
|
|
|
var urlVal = "../WMS_ZX/WmsZXOutListGridSource.aspx?handle=getislock&gids=" + gID + "&val=" + newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
var ls = loader.xmlDoc.responseText;
|
|
|
|
|
if (ls.trim() != "0") {
|
|
|
|
|
iFailure++;
|
|
|
|
|
alt = "已入账的信息,不允许删除!";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
var url = "../WMS_ZX/WmsZXOutListGridSource.aspx?handle=deletewmsout&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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
createGrid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//根据条件查询付费申请信息
|
|
|
|
|
function search(){
|
|
|
|
|
GetSearchJoin();//检查查询条件
|
|
|
|
|
createGrid();
|
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
$("h_bsno").value = $("txt_bsno").value;
|
|
|
|
|
|
|
|
|
|
var cus = $("h_customer").value;
|
|
|
|
|
var goods = $("h_goods").value;
|
|
|
|
|
var bsno = $("h_bsno").value;
|
|
|
|
|
var cbISLOCK = $("cbISLOCK").checked;
|
|
|
|
|
|
|
|
|
|
var searchJson = "";
|
|
|
|
|
searchJson +="{";
|
|
|
|
|
searchJson += "[";
|
|
|
|
|
searchJson += "\"cus\":\""+cus+"\",";
|
|
|
|
|
searchJson += "\"bt\":\""+beginetd+"\",";
|
|
|
|
|
searchJson += "\"et\":\""+endetd+"\",";
|
|
|
|
|
searchJson += "\"goods\":\""+goods+"\",";
|
|
|
|
|
searchJson += "\"cbISLOCK\":\"" + cbISLOCK + "\",";
|
|
|
|
|
searchJson += "\"bsno\":\""+bsno+"\"";
|
|
|
|
|
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 initComboGoods(){//货物描述类型ok
|
|
|
|
|
comboCustomer = new TCombo("sel_goods", "../WMS_ZX/WmsZXOutListGridSource.aspx?handle=goodslist", true, true, false, true, "h_goods");
|
|
|
|
|
comboCustomer.initComboEvent();
|
|
|
|
|
comboCustomer.bind();
|
|
|
|
|
}
|
|
|
|
|
function createComboGoods(){//货物描述类型ok
|
|
|
|
|
comboGoods = dhtmlXComboFromSelect("sel_goods");
|
|
|
|
|
comboGoods.loadXML("../WMS_ZX/WmsZXOutListGridSource.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);
|
|
|
|
|
$("txt_beginDate").value = "";
|
|
|
|
|
$("txt_endDate").value = "";
|
|
|
|
|
$("h_goods").value="";
|
|
|
|
|
comboGoods.setComboText($("h_goods").value);
|
|
|
|
|
$("txt_bsno").value = "";
|
|
|
|
|
$("cbISLOCK").value = "";
|
|
|
|
|
$("h_searchJson").value="";
|
|
|
|
|
createGrid();//重新填充数据
|
|
|
|
|
}
|
|
|
|
|
function printInvoice(){
|
|
|
|
|
var strBSNO = "";
|
|
|
|
|
strBSNO = $("h_bsno").value;
|
|
|
|
|
var printUrl = "";
|
|
|
|
|
var companyID = "";
|
|
|
|
|
var typeName = "WMSOUTLISTREPORT";
|
|
|
|
|
var dbSourceID = "";
|
|
|
|
|
var userID = "";
|
|
|
|
|
GetSearchJoin();
|
|
|
|
|
var url = "../Reports/ReportService.aspx?handle=printwmsoutlist&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 GetRange(RangeName, strgid) {
|
|
|
|
|
//var strgid = mygrid_log.getCheckedRows(0); //所有选中的grid的id编号 modWmsFeeLock modWmsFeeRejected
|
|
|
|
|
var loader = dhtmlxAjax.getSync("../FeeCodes/RangeAdapter.aspx?RangeName=" + RangeName + "&strGID=" + strgid + "&val=" + newGuid());
|
|
|
|
|
var dates = loader.xmlDoc.responseText;
|
|
|
|
|
if (dates == "") {
|
|
|
|
|
alert("您没有操作此数据的权限!");
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function setislock() {
|
|
|
|
|
if ($("tbislockdate").value.trim() == "") {
|
|
|
|
|
alert('入账日期不允许为空!');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
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("modWmsFeeLock", checked);
|
|
|
|
|
if (ii == 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
if (confirm('装卸费确定入账吗?(入账后将不允许修改删除数据!)')) {
|
|
|
|
|
var urlVal = "WmsZXOutListGridSource.aspx?handle=islock&gids=" + checked + "&islockdate=" + $("tbislockdate").value.trim() + "&val=" + 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("modWmsFeeRejected", checked);
|
|
|
|
|
if (ii == 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
if (confirm('确定取消入账吗?(只有“未申请开票、未开发票、未对帐”的入账数据允许取消!)')) {
|
|
|
|
|
var urlVal = "WmsZXOutListGridSource.aspx?handle=notlock&gids=" + checked + "&val=" + newGuid();
|
|
|
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
|
|
|
var strDel = loader.xmlDoc.responseText;
|
|
|
|
|
if (strDel.trim() != "") {
|
|
|
|
|
alert(strDel);
|
|
|
|
|
}
|
|
|
|
|
createGrid();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
alert('未选中要操作的数据!');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|