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.

880 lines
36 KiB
JavaScript

12 months ago
var commonGridObj_invoiceApp;
var comboCustomer;//委托单位
var pressRecord;
function $(id){
return document.getElementById(id);
}
function SearchJson(id) {//编辑费率条件
var bsno=commonGridObj_invoiceApp.getGridObj().cellById(id,4).getValue();
var cust=commonGridObj_invoiceApp.getGridObj().cellById(id,5).getValue();
var newcust=commonGridObj_invoiceApp.getGridObj().cellById(id,6).getValue().trim()
var outdate=commonGridObj_invoiceApp.getGridObj().cellById(id,8).getValue();
//var storage=commonGridObj_invoiceApp.getGridObj().cellById(id,4).getValue().trim();
var goodsname=commonGridObj_invoiceApp.getGridObj().cellById(id,10).getValue().trim();
var goodsmodel=commonGridObj_invoiceApp.getGridObj().cellById(id,11).getValue().trim();
var outnum=commonGridObj_invoiceApp.getGridObj().cellById(id,12).getValue().trim();
var packnum=commonGridObj_invoiceApp.getGridObj().cellById(id,13).getValue();
var outfee=commonGridObj_invoiceApp.getGridObj().cellById(id,14).getValue().trim();
//var truckno=commonGridObj_invoiceApp.getGridObj().cellById(id,15).getValue().trim();
//var remark=commonGridObj_invoiceApp.getGridObj().cellById(id,16).getValue().trim();
var opseaibsno=commonGridObj_invoiceApp.getGridObj().cellById(id,17).getValue().trim();
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 += "\"packnum\":\""+packnum+"\",";
searchJson += "\"outfee\":\""+outfee+"\",";
//searchJson += "\"truckno\":\""+truckno+"\",";
//searchJson += "\"remark\":\""+remark+"\",";
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(){
if($("h_showPm").value=="1"){
$("Pm1").style.display="";
$("Pm2").style.display="";
$("Bh1").style.display="";
$("Bh2").style.display="";
}
else {
$("Pm1").style.display="none";
$("Pm2").style.display="none";
$("Bh1").style.display="none";
$("Bh2").style.display="none";
}
//header
$("hdNAMES").value = "是否入账\t货权转移\t提单号\t出库单号\t货主\t转移对象\t应付客户\t出库日期\t上家承担仓储期限\t品名\t型号\t出库重量\t出库件数\t仓储费\t开单人\t开单时间\t车号"; //\t进口委托单号、仓库名称\t、备注\t
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
var headerArgs_invoiceapp = new Array("<input type=\"checkbox\" id=\"ck_all\" onclick=\"checkall()\" />", "是否入账", "货权转移", "提单号", "出库单号", "货主", "转移对象", "应付客户", "出库日期", "上家承担仓储期限", "品名", "型号", "出库重量", "出库件数", "仓储费", "开单人", "开单时间", "进口委托单号", "车号"); //,"仓库名称","备注"
//width
var widthArgs_invoiceapp = new Array("40", "70", "100", "100", "150", "100", "100", "120", "120", "120", "80", "80", "80", "80", "80", "80", "120", "0", "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");
//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");
//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");
commonGridObj_invoiceApp = new TGridCommon("mygrid_container_invoiceapp","form1",headerArgs_invoiceapp,widthArgs_invoiceapp,colAlignArgs_invoiceapp,colSortArgs_invoiceapp,colTypeArgs_invoiceapp);
commonGridObj_invoiceApp.setResponseUrl("../SeaiInfoLCL/WmsRateLCLGridSource.aspx");
if($("h_searchJson").value!="" && $("h_searchJson").value!=null){
commonGridObj_invoiceApp.setRequest("../SeaiInfoLCL/WmsRateLCLGridSource.aspx?handle=wmsoutlist&show_page=15&cur_page=1&search="+escape($("h_searchJson").value)+"&uid="+commonGridObj_invoiceApp.newGuid());
// commonGridObj_invoiceApp.setSearch($("h_searchJson").value);
commonGridObj_invoiceApp.setMultiple("&search=" +escape($("h_searchJson").value));
}
else{
commonGridObj_invoiceApp.setRequest("../SeaiInfoLCL/WmsRateLCLGridSource.aspx?handle=wmsoutlist&show_page=15&cur_page=1&bsno="+$("h_bsno").value+"&uid="+commonGridObj_invoiceApp.newGuid());
// commonGridObj_invoiceApp.setSearch($("h_bsno").value);
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 rId = commonGridObj_invoiceApp.getGridObj().getSelectedRowId();
var openSet = "height=500, width=1200, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " + (screen.height - 500) / 2 + ",Left= 100";// +(screen.width - 1500) / 2
var openType = "_blank";
var strsearch = SearchJson(rId);
var openUrl = "../SeaiInfoLCL/WmsOutLCLEdit.aspx?handle=edit&search=" + escape(strsearch);
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 = "../SeaiInfoLCL/WmsRateLCLGridSource.aspx?handle=getfpk2&show_page=15&cur_page=1&search=" + escape($("h_searchJson").value) + "&uid=" + commonGridObj_invoiceApp.newGuid();
}
else {
urlVal = "../SeaiInfoLCL/WmsRateLCLGridSource.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(",");
$("divFeeV").innerHTML = selGroup2[0].toString().trim();
$("divFeeV2").innerHTML = selGroup2[1].toString().trim();
$("divFeeV3").innerHTML = selGroup2[2].toString().trim();
$("divFeeV4").innerHTML = selGroup2[3].toString().trim();
$("divPACKV").innerHTML = selGroup2[4].toString().trim();
$("divKGSV").innerHTML = selGroup2[5].toString().trim();
//all
urlVal = "";
if ($("h_searchJson").value != "" && $("h_searchJson").value != null) {
urlVal = "../SeaiInfoLCL/WmsRateLCLGridSource.aspx?handle=getfpk&search=" + escape($("h_searchJson").value) + "&uid=" + commonGridObj_invoiceApp.newGuid();
}
else {
urlVal = "../SeaiInfoLCL/WmsRateLCLGridSource.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();//结算单位
createComboGoods();//货物描述类型
}
function addApplication(){
// //异步执行操作
// var url = "../SeaiInfoLCL/WmsRateLCLGridSource.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 - 500) / 2 + ",Left=100"; //"+(screen.width-970)/2
var openType = "_blank";
//height=630, width=970,
var openUrl = "../SeaiInfoLCL/WmsOutLCLEdit.aspx?handle=addwmsout&ischangecust=0&bsno=" + $("h_bsno").value;
window.open (openUrl,openType,openSet);
// }else{
// alert("没有权限添加发票申请");
// return;
// }
}
function changecustomer(){
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 - 500) / 2 + ",Left=100"; // "+(screen.width-970)/2
var openType = "_blank";
//height=630, width=970,
var openUrl = "../SeaiInfoLCL/WmsOutLCLEdit.aspx?handle=addwmsout&ischangecust=1&bsno=" + $("h_bsno").value;
window.open (openUrl,openType,openSet);
}
function setLosses() {
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 - 500) / 2 + ",Left=100"; // "+(screen.width-970)/2
var openType = "_blank";
//height=630, width=970,
var openUrl = "../SeaiInfoLCL/WmsOutLCLEdit.aspx?handle=addwmsout&ischangecust=2&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 = "../SeaiInfoLCL/WmsRateLCLGridSource.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 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 = "../SeaiInfoLCL/WmsRateLCLGridSource.aspx?handle=getislock&gids=" + gID + "&val=" + newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var ls = loader.xmlDoc.responseText;
if (ls.trim() != "0") {
iFailure++;
alt += "已入账的信息,不允许删除!";
}
else {
urlVal = "../SeaiInfoLCL/WmsRateLCLGridSource.aspx?handle=getiswmsin&gids=" + gID + "&val=" + newGuid();
loader = dhtmlxAjax.getSync(urlVal);
ls = loader.xmlDoc.responseText;
if (ls.trim() != "0") {
iFailure++;
alt += "已入库的货权转移信息,不允许删除!";
}
else {
var url = "../SeaiInfoLCL/WmsRateLCLGridSource.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);
}
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;
$("h_bsno").value = $("txt_bsno").value;
var cus = $("h_customer").value;
var goods = $("h_goods").value;
var bsno = $("h_bsno").value;
var searchJson = "";
searchJson +="{";
searchJson += "[";
searchJson += "\"cus\":\""+cus+"\",";
searchJson += "\"bt\":\""+beginetd+"\",";
searchJson += "\"et\":\""+endetd+"\",";
searchJson += "\"goods\":\""+goods+"\",";
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", "../SeaiInfoLCL/WmsRateLCLGridSource.aspx?handle=goodslist", true, true, false, true, "h_goods");
comboCustomer.initComboEvent();
comboCustomer.bind();
}
function createComboGoods(){//货物描述类型ok
comboGoods = dhtmlXComboFromSelect("sel_goods");
comboGoods.loadXML("../SeaiInfoLCL/WmsRateLCLGridSource.aspx?handle=goodslist");
comboGoods.setOptionWidth(200);
comboGoods.attachEvent("onChange", function(){
comboGoods.setComboText($("h_goods").value);
});
comboGoods.attachEvent("onBlur", function(){
var s1 = comboGoods.getComboText().trim();
var s2 = s1.indexOf("|");
if(s2>0){
s2=s2+2;
}
var s3 = s1.substring(s2);
if(s2>0){
comboGoods.setComboText(s3);
$("h_goods").value=s3;
}
else
{
comboGoods.setComboText($("h_goods").value);
}
});
comboGoods.setComboText($("h_goods").value);
comboGoods.attachEvent("onKeyPressed", function(keyCode){
if(keyCode!="8"){
var arrayArg = new Array();
setTimeout(function(){
var filterCount = 0;
var is = -1;
var ishd = $("h_goods").value.trim();
if("" != comboGoods.getComboText().trim()){
while("undefined" != typeof comboGoods.getOptionByIndex(filterCount)){
var comboValue = comboGoods.getOptionByIndex(filterCount).text.toUpperCase();//.value;
var enterValue = comboGoods.getComboText().trim().toUpperCase();
$("h_goods").value = comboGoods.getComboText().trim().toUpperCase();
if(comboValue.indexOf(enterValue) == 0){
comboGoods.selectOption(filterCount,true,true);
is=filterCount;
break;
}
++filterCount;
}
if(is==-1){
$("h_goods").value = ishd;
alert("无此内容,请重新选择!");
}
}
},10);
}
});
comboGoods.attachEvent("onSelectionChange", function(){
$("h_goods").value = comboGoods.getComboText().trim();
});
}
//初始化界面
function 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 = "";
$("h_searchJson").value="";
createGrid(); //重新填充数据
getFPK("");
}
function printInvoice(){
var strBSNO = "";
strBSNO = commonGridObj_invoiceApp.getGridObj().getCheckedRows(0); //所有选中的grid的id编号
var printUrl = "";
var companyID = "";
var typeName = "WMSOUTLCLLISTREPORT";
var dbSourceID = "";
var userID = "";
GetSearchJoin();
var url = "../Reports/ReportService.aspx?handle=printwmsoutlcllist&bsno=" + strBSNO + "&search=" + escape($("h_searchJson").value) + "&val=" + commonGridObj_invoiceApp.newGuid();
typeName = "WMSOUTLCLLISTREPORT";
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 != "") {
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);
}
createGrid();
}
}
else {
alert('未选中要操作的数据!');
return;
}
}
function setnotlock() {
var checked = commonGridObj_invoiceApp.getGridObj().getCheckedRows(0); //所有选中的grid的id编号
if (checked != null && checked != "") {
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);
}
createGrid();
}
}
else {
alert('未选中要操作的数据!');
return;
}
}
//function printInvoice(){ //打印出库单
//// if(!validOperatePower("",1,"print")){
//// alert("没有权限");
//// return;
//// }
// printMessageBox(event,1);
//}
//function printMessageBox(ev,type)
//{
// var customerName ="";
// var selectCustomerOptions = "";
// var CusNameArg = new Array();
// for(var j=0;j<commonGridObj_invoiceApp.getGridObj().getRowsNum();j++){
// customerName = commonGridObj_invoiceApp.getGridObj().cellByIndex(j,2).getValue();
// var iCount = 0;
// for(var i=0;i<CusNameArg.length;i++){
// if(CusNameArg[i] == customerName){
// iCount++;
// break;
// }
// }
// if(iCount == 0){
// CusNameArg.push(customerName);
// }
// }
//
// for(var k=0;k<CusNameArg.length;k++){
// selectCustomerOptions += "<option value=\""+CusNameArg[k]+"\">"+CusNameArg[k]+"</options>";
// }
//
// var objPos = mousePosition(ev);
// messContent = "<div style=\"padding:20px 0 20px 0;text-align:center\">"
// +"<div style=\"float:left;width:100%\"><select id=\"reportType\" onchange=\"onReportTypeChange('reportType')\"><option value=\"1\">打印出库单列表</option></select></div> "
//// +"<div style=\"float:left;width:100%;text-align:center;display:none;\" id=\"dvGainCheck\"><div style=\"float:left\"><input type=\"radio\" id=\"ra_recv\" name=\"gain\" title=\"打印应收利润\"/>应收利润</div> "
//// +"<div style=\"float:left\"><input type=\"radio\" id=\"ra_recv\" name=\"gain\" title=\"打印应付利润\"/>应付利润</div><div style=\"float:left\"> "
//// +"<input type=\"radio\" id=\"ra_recv\" name=\"gain\" title=\"打印利润\"/>利润</div></div> "
// +"<div style=\"float:left;width:100%;padding-left:80px;\"> "
// +"<table style=\"width:350px;\"><tr><td><select id=\"sel_customer\" multiple style=\"width:150px; height:60px;\">"+selectCustomerOptions+"</select></td><td> "
// +"<table style=\"height:60px; width:20px;\"><tr><td height=\"20px\"><div id=\"dvRemove\"><img src=\"../images/icons/edit_left.gif\" "
// +"onmouseover=\"mouseMoveImg(this,1)\" onmouseout=\"mouseMoveImg(this,1)\" title=\"移除\" onclick=\"removeCustomer()\"/></div></td> "
// +"</tr><tr><td height=\"20px\"><div id=\"dvAdd\"><img src=\"../images/icons/edit_right.gif\" onmouseover=\"mouseMoveImg(this,2)\" "
// +"onmouseout=\"mouseMoveImg(this,2)\" title=\"添加\" onclick=\"addCustomer()\"/></div></td> "
// +"</tr></table></td><td><select id=\"sel_print\" multiple style=\"width:150px; height:60px;\" class=\"select\"></select></td></tr></table></div>"
// +"<input type=\"button\" id=\"btn_print_report\" value=\"打印\" class=\"btn\" onclick=\"printReport()\"/></div> ";
//
// showMessageBox('费用打印',messContent,objPos,350);
//}
////打印报表
//function printReport(){
// var strBSNO = "";
// var typeName = "";
// strBSNO = $("h_bsno").value;
// var printUrl = "";
// var companyID = "";
// var typeName = "WMSOUTLCLLISTREPORT";
// var dbSourceID = "";
// var userID = "";
//
// var selectObj = $("reportType");
// var selVal = parseInt(selectObj.options[selectObj.selectedIndex].value);
//
// var url = "";
// var searchCustomer = "";
// var selectedObj = $("sel_print");
//
// for(var j=0;j<selectedObj.options.length;j++){
// if(j == selectedObj.options.length - 1){
// searchCustomer += "'"+selectedObj.options[j].value+"'";
// }else{
// searchCustomer += "'"+selectedObj.options[j].value+"',";
// }
// }
// if(selVal == 1){//打印出库单返回JSON对象
// url = "../Reports/ReportService.aspx?handle=printwmsoutlcllist&bsno="+strBSNO+"&search="+escape($("h_searchJson").value)+"&val="+newGuid();
// typeName = "WMSOUTLCLLISTREPORT";
// }
//
// 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 onReportTypeChange(id){
// var selectObj = $(id);
//
// var selVal = parseInt(selectObj.options[selectObj.selectedIndex].value);
// pageShowCount = selVal;
//}
////鼠标移过图标变化
//function mouseMoveImg(obj,type){
// var imgUrl = obj.src;
// var urlArg = imgUrl.split("/");
//
// if(type == 1){
// if(urlArg[urlArg.length-1] == "edit_left.gif"){
// var newUrl = "";
// for(var i=0;i<urlArg.length;i++){
// if(i == urlArg.length - 1){
// newUrl += "edit_lefthover.gif";
// }else{
// newUrl += urlArg[i]+"/";
// }
// }
//
// obj.src = newUrl;
// }else{
// var newUrl = "";
// for(var i=0;i<urlArg.length;i++){
// if(i == urlArg.length - 1){
// newUrl += "edit_left.gif";
// }else{
// newUrl += urlArg[i]+"/";
// }
// }
//
// obj.src = newUrl;
// }
// }else{
// if(urlArg[urlArg.length-1] == "edit_right.gif"){
// var newUrl = "";
// for(var i=0;i<urlArg.length;i++){
// if(i == urlArg.length - 1){
// newUrl += "edit_righthover.gif";
// }else{
// newUrl += urlArg[i]+"/";
// }
// }
//
// obj.src = newUrl;
// }else{
// var newUrl = "";
// for(var i=0;i<urlArg.length;i++){
// if(i == urlArg.length - 1){
// newUrl += "edit_right.gif";
// }else{
// newUrl += urlArg[i]+"/";
// }
// }
//
// obj.src = newUrl;
// }
// }
//}
////移除结算单位
//function removeCustomer(){
// var selectedObj = $("sel_print");
// var selectedCount = selectedObj.options.length;
// for(var j=0;j<selectedCount;j++){
// if(selectedObj[j].selected){
// selectedObj.options.remove(j);
// if(selectedCount == 1){
// break;
// }
// j=-1;
// continue;
// }
// }
//}
////添加结算单位
//function addCustomer(){
// var customerObj = $("sel_customer");
// var selectedObj = $("sel_print");
//
// for(var i=0;i<customerObj.options.length;i++){
// if(customerObj[i].selected){
// var sameCount = 0;
// var selectedCount = selectedObj.options.length;
// for(var j=0;j<selectedCount;j++){
// if(selectedObj.options[j].value.trim() == customerObj.options[i].value.trim()){
// sameCount++;
// break;
// }
// }
//
// if(sameCount == 0){
// var varItem = new Option(customerObj.options[i].value.trim(), customerObj.options[i].value.trim());
// selectedObj.options.add(varItem);
// }
// }
// }
//}