优化单据的代码结构
This commit is contained in:
@@ -415,7 +415,7 @@
|
||||
}
|
||||
|
||||
function turnBillDetailPage(number, type) {
|
||||
js.addTabPage(null, "单据明细", "/pages/materials/bill_detail.html?n="+ number + "&type=" + type);
|
||||
js.addTabPage(null, "单据明细", "/pages/bill/bill_detail.html?n="+ number + "&type=" + type);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
333
erp_web/js/pages/bill/add_temp.js
Normal file
333
erp_web/js/pages/bill/add_temp.js
Normal file
@@ -0,0 +1,333 @@
|
||||
$.get("../../pages/template/base.html?7891", function(tem) {
|
||||
if(tem) {
|
||||
var template = Handlebars.compile(tem);
|
||||
/**
|
||||
* 加载供应商、客户模块
|
||||
*/
|
||||
$("#supplier").html(template({
|
||||
supplierSelect: true
|
||||
}));
|
||||
$('#supplierDlg').dialog({
|
||||
closed: true,
|
||||
modal: true,
|
||||
collapsible: false,
|
||||
closable: true
|
||||
});
|
||||
$("#supplierDlg #supplier").textbox({
|
||||
required: true,
|
||||
validType: 'length[2,30]'
|
||||
});
|
||||
$("#supplierDlg #email").textbox({
|
||||
validType: 'email'
|
||||
});
|
||||
$("#BeginNeedGet,#BeginNeedPay,#AllNeedGet,#AllNeedPay").numberbox({
|
||||
min:0,
|
||||
precision:2
|
||||
});
|
||||
$("#taxRate").textbox({
|
||||
validType: 'length[1,2]'
|
||||
});
|
||||
$("#saveSupplier").linkbutton({
|
||||
iconCls: 'icon-ok'
|
||||
});
|
||||
$("#cancelSupplier").linkbutton({
|
||||
iconCls: 'icon-cancel'
|
||||
});
|
||||
$("#contacts,#telephone,#email,#phonenum,#fax,#taxNum,#bankName,#accountNumber,#address").textbox();
|
||||
$("#description").textbox({
|
||||
multiline:true
|
||||
});
|
||||
|
||||
/**
|
||||
* 加载仓库
|
||||
*/
|
||||
$("#depot").html(template({
|
||||
depotSelect: true
|
||||
}));
|
||||
$('#depotDlg').dialog({
|
||||
closed: true,
|
||||
modal: true,
|
||||
collapsible: false,
|
||||
closable: true
|
||||
});
|
||||
$("#depotDlg #name").textbox({
|
||||
required: true,
|
||||
validType: 'length[2,30]'
|
||||
});
|
||||
$("#depotDlg #address").textbox({
|
||||
validType: 'length[2,30]'
|
||||
});
|
||||
$("#depotDlg #warehousing,#depotDlg #truckage").numberbox({
|
||||
min:0,
|
||||
precision:2
|
||||
});
|
||||
$("#saveDepot").linkbutton({
|
||||
iconCls: 'icon-ok'
|
||||
});
|
||||
$("#cancelDepot").linkbutton({
|
||||
iconCls: 'icon-cancel'
|
||||
});
|
||||
$("#sort").textbox();
|
||||
$("#depotDlg #remark").textbox({
|
||||
multiline:true
|
||||
});
|
||||
|
||||
/**
|
||||
* 加载账户
|
||||
*/
|
||||
$("#account").html(template({
|
||||
accountSelect: true
|
||||
}));
|
||||
$('#accountDlg').dialog({
|
||||
closed: true,
|
||||
modal: true,
|
||||
collapsible: false,
|
||||
closable: true
|
||||
});
|
||||
$("#accountDlg #name,#accountDlg #serialNo").textbox({
|
||||
required: true,
|
||||
validType: 'length[2,30]'
|
||||
});
|
||||
$("#accountDlg #initialAmount").numberbox({
|
||||
min:0,
|
||||
precision:2
|
||||
});
|
||||
$("#saveAccount").linkbutton({
|
||||
iconCls: 'icon-ok'
|
||||
});
|
||||
$("#cancelAccount").linkbutton({
|
||||
iconCls: 'icon-cancel'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//绑定供应商、客户事件
|
||||
function bindSupplierEvent() {
|
||||
if(listTitle === "采购入库列表" || listTitle === "其它入库列表" || listTitle === "采购订单列表"
|
||||
|| listTitle === "零售出库列表"|| listTitle === "销售出库列表"|| listTitle === "销售订单列表"){
|
||||
var supplierType = "供应商";
|
||||
if(listTitle === "零售出库列表"){
|
||||
supplierType = "会员";
|
||||
}else if(listTitle === "销售出库列表" || listTitle === "销售订单列表"){
|
||||
supplierType = "客户";
|
||||
}
|
||||
//检查单位名称是否存在 ++ 重名无法提示问题需要跟进
|
||||
function checkSupplierName() {
|
||||
var supplierName = $.trim($("#supplier").val());
|
||||
var orgSupplier = "";
|
||||
//表示是否存在 true == 存在 false = 不存在
|
||||
var flag = false;
|
||||
//开始ajax名称检验,不能重名
|
||||
if(supplierName.length > 0 &&( orgSupplier.length ==0 || supplierName != orgSupplier))
|
||||
{
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/supplier/checkIsNameExist",
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
id : 0,
|
||||
name : supplierName
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
if(res.data && res.data.status) {
|
||||
flag = res.data.status;
|
||||
if (flag) {
|
||||
$.messager.alert('提示', '单位名称已经存在', 'info');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('提示','检查单位名称是否存在异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
//保存供应商信息
|
||||
$("#saveSupplier").off("click").on("click",function() {
|
||||
if(validateForm("supplierFM")) {
|
||||
return;
|
||||
}
|
||||
if(checkSupplierName()){
|
||||
return;
|
||||
}
|
||||
var reg = /^([0-9])+$/;
|
||||
var phonenum = $.trim($("#phonenum").val());
|
||||
if(phonenum.length>0 && !reg.test(phonenum))
|
||||
{
|
||||
$.messager.alert('提示','电话号码只能是数字','info');
|
||||
$("#phonenum").val("").focus();
|
||||
return;
|
||||
}
|
||||
var beginNeedGet = $.trim($("#BeginNeedGet").val());
|
||||
var beginNeedPay = $.trim($("#BeginNeedPay").val());
|
||||
if(beginNeedGet && beginNeedPay) {
|
||||
$.messager.alert('提示','期初应收和期初应付不能同时输入','info');
|
||||
return;
|
||||
}
|
||||
var url = '/supplier/add';
|
||||
var supObj = $("#supplierFM").serializeObject();
|
||||
supObj.type = supplierType;
|
||||
supObj.enabled = 1;
|
||||
$.ajax({
|
||||
url: url,
|
||||
type:"post",
|
||||
dataType: "json",
|
||||
data:{
|
||||
info: JSON.stringify(supObj)
|
||||
},
|
||||
success: function(res) {
|
||||
if (res) {
|
||||
$('#supplierDlg').dialog('close');
|
||||
initSupplier(); //刷新供应商
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//绑定仓库事件
|
||||
function bindDepotEvent() {
|
||||
$("#depotFM #name").focus();
|
||||
$("#selectType").val("principal");
|
||||
//检查名称是否存在 ++ 重名无法提示问题需要跟进
|
||||
function checkDepotName() {
|
||||
var name = $.trim($("#depotDlg #name").val());
|
||||
//表示是否存在 true == 存在 false = 不存在
|
||||
var flag = false;
|
||||
//开始ajax名称检验,不能重名
|
||||
if (name.length > 0) {
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "/depot/checkIsNameExist",
|
||||
dataType: "json",
|
||||
async: false,
|
||||
data: ({
|
||||
id: 0,
|
||||
name: name
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
if(res.data && res.data.status) {
|
||||
flag = res.data.status;
|
||||
if (flag) {
|
||||
$.messager.alert('提示', '仓库名称已经存在', 'info');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error: function () {
|
||||
$.messager.alert('提示', '检查仓库名称是否存在异常,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
$("#saveDepot").off("click").on("click", function () {
|
||||
if(!$('#depotFM').form('validate')){
|
||||
return;
|
||||
}
|
||||
var infoObj = $("#depotFM").serializeObject();
|
||||
infoObj.type = 0;
|
||||
if (checkDepotName()) {
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
url: "/depot/add",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
info: JSON.stringify(infoObj)
|
||||
}),
|
||||
success: function(res) {
|
||||
if(res && res.code === 200) {
|
||||
$('#depotDlg').dialog('close');
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error: function () {
|
||||
$.messager.alert('提示', '保存仓库信息异常,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//绑定账户事件
|
||||
function bindAccountEvent() {
|
||||
function checkAccountName() {
|
||||
var accountName = $.trim($("#accountDlg #name").val());
|
||||
//表示是否存在 true == 存在 false = 不存在
|
||||
var flag = false;
|
||||
//开始ajax名称检验,不能重名
|
||||
if (accountName.length > 0) {
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "/account/checkIsNameExist",
|
||||
dataType: "json",
|
||||
async: false,
|
||||
data: ({
|
||||
id: 0,
|
||||
name: accountName
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
if(res.data && res.data.status) {
|
||||
flag = res.data.status;
|
||||
if (flag) {
|
||||
$.messager.alert('提示', '结算账户名称已经存在', 'info');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error: function () {
|
||||
$.messager.alert('提示', '检查结算账户名称是否存在异常,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
//保存结算账户
|
||||
$("#saveAccount").off("click").on("click", function () {
|
||||
if (checkAccountName()) {
|
||||
return;
|
||||
}
|
||||
if(!$('#accountFM').form('validate')){
|
||||
return;
|
||||
} else {
|
||||
$.ajax({
|
||||
url: '/account/add',
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
info: JSON.stringify($("#accountFM").serializeObject())
|
||||
}),
|
||||
success: function(res) {
|
||||
if(res && res.code === 200) {
|
||||
$('#accountDlg').dialog('close');
|
||||
initSystemData_account(); //刷新账户
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error: function () {
|
||||
$.messager.alert('提示', '保存结算账户异常,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
560
erp_web/js/pages/bill/bill_detail.js
Normal file
560
erp_web/js/pages/bill/bill_detail.js
Normal file
@@ -0,0 +1,560 @@
|
||||
var accountList; //账户列表
|
||||
var listSubType = ""; //采购 销售等
|
||||
var depotHeadID = 0; //主表id
|
||||
var mPropertyList = ""; //商品属性列表
|
||||
var outItemList; //支出项目列表
|
||||
var otherColumns = true; //明细中的‘别名’列是否显示
|
||||
var payTypeTitle = "";//收入 支出
|
||||
var itemType = true; //隐藏当前列
|
||||
var moneyType = true; //隐藏当前列
|
||||
|
||||
$(function() {
|
||||
initSystemData_account(); //获取账户信息
|
||||
initMProperty(); //初始化商品属性
|
||||
initOutItemList(); //初始化支出项目
|
||||
initialize();//初始化系统基础信息
|
||||
|
||||
});
|
||||
|
||||
//获取账户信息
|
||||
function initSystemData_account(){
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/account/getAccount",
|
||||
//设置为同步
|
||||
async:false,
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200){
|
||||
accountList = res.data.accountList;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//初始化商品属性
|
||||
function initMProperty(){
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "/materialProperty/list",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
search: JSON.stringify({
|
||||
name: ""
|
||||
}),
|
||||
currentPage: 1,
|
||||
pageSize: 100
|
||||
}),
|
||||
//设置为同步
|
||||
async:false,
|
||||
success: function (res) {
|
||||
if(res && res.code === 200){
|
||||
if(res.data && res.data.page) {
|
||||
var thisRows = res.data.page.rows;
|
||||
for (var i = 0; i < thisRows.length; i++) {
|
||||
if (thisRows[i].enabled) {
|
||||
mPropertyList += thisRows[i].nativename + ",";
|
||||
}
|
||||
}
|
||||
if (mPropertyList) {
|
||||
mPropertyList = mPropertyList.substring(0, mPropertyList.length - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
//初始化收入项目列表
|
||||
function initOutItemList(){
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/inOutItem/findBySelect?type=out",
|
||||
//设置为同步
|
||||
async:false,
|
||||
dataType: "json",
|
||||
success: function (res){
|
||||
if(res){
|
||||
outItemList = res;
|
||||
}
|
||||
},
|
||||
error:function(){
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
function initialize() {
|
||||
var url = location.href; //获取浏览器地址
|
||||
var params = url.substring(url.indexOf("?")+1);
|
||||
var number = params.substring(params.indexOf("n=")+2, params.indexOf("&"));
|
||||
var billType = "";
|
||||
var listSubType = params.substring(params.indexOf("&type=")+6);
|
||||
if(listSubType) {
|
||||
listSubType = decodeURI(listSubType);
|
||||
}
|
||||
if(listSubType == "采购入库") {
|
||||
billType = "material";
|
||||
$("#bill .purchase_in").show();
|
||||
tableString = $(".purchase_in").html();
|
||||
}
|
||||
else if(listSubType == "采购退货出库") {
|
||||
billType = "material";
|
||||
$("#bill .purchase_back").show();
|
||||
tableString = $(".purchase_back").html();
|
||||
}
|
||||
else if(listSubType == "销售出库") {
|
||||
billType = "material";
|
||||
$("#bill .sale_out").show();
|
||||
tableString = $(".sale_out").html();
|
||||
}
|
||||
else if(listSubType == "销售退货入库") {
|
||||
billType = "material";
|
||||
$("#bill .sale_back").show();
|
||||
tableString = $(".sale_back").html();
|
||||
}
|
||||
else if(listSubType == "零售出库") {
|
||||
billType = "material";
|
||||
$("#bill .retail_out").show();
|
||||
tableString = $(".retail_out").html();
|
||||
}
|
||||
else if(listSubType == "零售退货入库") {
|
||||
billType = "material";
|
||||
$("#bill .retail_back").show();
|
||||
tableString = $(".retail_back").html();
|
||||
}
|
||||
else if(listSubType == "其它入库") {
|
||||
billType = "material";
|
||||
$("#bill .other_in").show();
|
||||
tableString = $(".other_in").html();
|
||||
}
|
||||
else if(listSubType == "其它出库") {
|
||||
billType = "material";
|
||||
$("#bill .other_out").show();
|
||||
tableString = $(".other_out").html();
|
||||
}
|
||||
else if(listSubType == "调拨出库") {
|
||||
billType = "material";
|
||||
$("#bill .allocation_out").show();
|
||||
tableString = $(".allocation_out").html();
|
||||
}
|
||||
else if(listSubType == "组装单") {
|
||||
billType = "material";
|
||||
$("#bill .allocation_out").show();
|
||||
tableString = $(".allocation_out").html();
|
||||
}
|
||||
else if(listSubType == "拆卸单") {
|
||||
billType = "material";
|
||||
$("#bill .allocation_out").show();
|
||||
tableString = $(".allocation_out").html();
|
||||
}
|
||||
else if(listSubType == "盘点复盘") {
|
||||
billType = "material";
|
||||
$("#bill .stock_check_replay").show();
|
||||
tableString = $(".stock_check_replay").html();
|
||||
}
|
||||
else if(listSubType == "收入") {
|
||||
billType = "account";
|
||||
payTypeTitle = "收入项目";
|
||||
itemType = false; //显示当前列
|
||||
moneyType = true; //隐藏当前列
|
||||
$("#bill .item_in").show();
|
||||
tableString = $(".item_in").html();
|
||||
}
|
||||
else if(listSubType == "支出") {
|
||||
billType = "account";
|
||||
payTypeTitle = "支出项目";
|
||||
itemType = false; //显示当前列
|
||||
moneyType = true; //隐藏当前列
|
||||
$("#bill .item_out").show();
|
||||
tableString = $(".item_out").html();
|
||||
}
|
||||
else if(listSubType == "收款") {
|
||||
billType = "account";
|
||||
payTypeTitle = "无标题";
|
||||
itemType = true; //隐藏当前列
|
||||
moneyType = false; //显示当前列
|
||||
$("#bill .money_in").show();
|
||||
tableString = $(".money_in").html();
|
||||
}
|
||||
else if(listSubType == "付款") {
|
||||
billType = "account";
|
||||
payTypeTitle = "无标题";
|
||||
itemType = true; //隐藏当前列
|
||||
moneyType = false; //显示当前列
|
||||
$("#bill .money_out").show();
|
||||
tableString = $(".money_out").html();
|
||||
}
|
||||
else if(listSubType == "转账") {
|
||||
billType = "account";
|
||||
payTypeTitle = "无标题";
|
||||
itemType = true; //隐藏当前列
|
||||
moneyType = false; //显示当前列
|
||||
$("#bill .giro").show();
|
||||
tableString = $(".giro").html();
|
||||
}
|
||||
else if(listSubType == "收预付款") {
|
||||
billType = "account";
|
||||
payTypeTitle = "无标题";
|
||||
itemType = true; //隐藏当前列
|
||||
moneyType = false; //显示当前列
|
||||
$("#bill .advance_in").show();
|
||||
tableString = $(".advance_in").html();
|
||||
}
|
||||
|
||||
//如果是进货、销售
|
||||
if(billType == "material"){
|
||||
$.ajax({
|
||||
url: "/depotHead/getDetailByNumber",
|
||||
data: {
|
||||
number: number
|
||||
},
|
||||
type: "get",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200){
|
||||
var data = res.data;
|
||||
var manyAccountMoney = 0; //多账户合计-零售
|
||||
if(data.accountName){
|
||||
$("#bill .AccountIdShow").text(data.accountName); //结算账户
|
||||
}
|
||||
else if(data.accountIdList && data.accountMoneyList) {
|
||||
var accountArr = data.accountIdList.split(","); //账户id列表
|
||||
var accountMoneyArr = data.accountMoneyList.split(","); //账户金额列表
|
||||
var accountIdShow = "";
|
||||
for (var j = 0; j < accountArr.length; j++) {
|
||||
if (accountList != null) {
|
||||
for (var i = 0; i < accountList.length; i++) {
|
||||
var account = accountList[i];
|
||||
if (accountArr[j] == account.id) {
|
||||
var currentAccountMoney = accountMoneyArr[j] - 0;
|
||||
if (currentAccountMoney < 0) {
|
||||
currentAccountMoney = 0 - currentAccountMoney;
|
||||
}
|
||||
accountIdShow = accountIdShow + account.name + "(" + currentAccountMoney + "元) ";
|
||||
manyAccountMoney += accountMoneyArr[j] - 0; //多账户合计-零售
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$("#bill .AccountIdShow").text(accountIdShow);
|
||||
}
|
||||
$("#bill .OrganIdShow").text(data.organName);
|
||||
$("#bill .OperTimeShow").text(data.operTimeStr);
|
||||
$("#bill .NumberShow").text(data.number);
|
||||
$("#bill .LinkNumberShow").text(data.linkNumber? data.linkNumber : "");
|
||||
$("#bill .RemarkShow").text(data.remark);
|
||||
$("#bill .DiscountShow").text(data.discount);
|
||||
$("#bill .DiscountMoneyShow").text(data.discountMoney);
|
||||
$("#bill .DiscountLastMoneyShow").text(data.discountLastMoney);
|
||||
$("#bill .ChangeAmountShow").text(data.changeAmount==null ? "":data.changeAmount);
|
||||
$("#bill .DebtShow").text((data.discountLastMoney+data.otherMoney-data.changeAmount).toFixed(2));
|
||||
$("#bill .OtherMoneyShow").text(data.otherMoney==null ? "": data.otherMoney);
|
||||
$("#bill .AccountDayShow").text(data.accountDay==null ? "": data.accountDay); //结算天数
|
||||
if(data.otherMoney && data.otherMoneyList && data.otherMoneyItem) {
|
||||
var itemArr = data.otherMoneyList.split(","); //支出项目id列表
|
||||
var itemMoneyArr = null;
|
||||
if (data.otherMoneyItem != null) {
|
||||
itemMoneyArr = eval("([" + data.otherMoneyItem + "])"); //支出项目金额列表
|
||||
}
|
||||
var otherMoneyShow = "";
|
||||
for(var j =0;j<itemArr.length; j++) {
|
||||
if (outItemList != null) {
|
||||
for (var i = 0; i < outItemList.length; i++) {
|
||||
var money = outItemList[i];
|
||||
if(itemArr[j] == money.Id) {
|
||||
for(var k =0;k<itemMoneyArr.length; k++) {
|
||||
if(itemMoneyArr[k].otherId == money.Id) {
|
||||
otherMoneyShow += money.InOutItemName;
|
||||
if(itemMoneyArr[k].otherMoney) {
|
||||
otherMoneyShow +="(" + itemMoneyArr[k].otherMoney +"元)";
|
||||
}
|
||||
otherMoneyShow+=",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$("#bill .OtherMoneyShow:visible").text(otherMoneyShow +"总计:"+ data.otherMoney + "元 "); //其它费用
|
||||
}
|
||||
$("#bill .payTypeShow").text(data.payType);
|
||||
var TotalPrice = data.totalPrice;
|
||||
depotHeadID = data.id;
|
||||
initTableData_material_show(TotalPrice,listSubType); //商品列表-查看状态
|
||||
|
||||
//零售单据展示数据
|
||||
if(listSubType == "零售出库" || listSubType == "零售退货入库"){
|
||||
$("#bill .change-amount-show").text(data.changeAmount);
|
||||
var changeAccount = $("#bill .change-amount-show:visible").text() - 0;
|
||||
if(manyAccountMoney!==0){
|
||||
$("#bill .get-amount-show").text((manyAccountMoney).toFixed(2));
|
||||
$("#bill .back-amount-show").text((manyAccountMoney -changeAccount).toFixed(2));
|
||||
}
|
||||
else {
|
||||
$("#bill .get-amount-show").text((changeAccount).toFixed(2));
|
||||
$("#bill .back-amount-show").text(0);
|
||||
}
|
||||
}
|
||||
if(listSubType === "销售出库" || listSubType === "销售退货"){
|
||||
var salesManInfo = data.salesMan;
|
||||
if(salesManInfo){
|
||||
var arr = salesManInfo.split(",");
|
||||
var salesmanStr = "";
|
||||
for(var i=0;i<arr.length;i++){
|
||||
if(arr[i]){
|
||||
if(i === arr.length-1){
|
||||
salesmanStr += arr[i].replace("<","").replace(">","");
|
||||
}
|
||||
else {
|
||||
salesmanStr += arr[i].replace("<","").replace(">","") + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "/person/getPersonByIds",
|
||||
data: {
|
||||
personIDs: salesmanStr
|
||||
},
|
||||
success:function(res){
|
||||
if(res && res.code === 200 && res.data){
|
||||
$("#bill .SalesmanShow").text(res.data.names); //销售人员列表
|
||||
}
|
||||
},
|
||||
error:function(){
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//如果是财务单据
|
||||
else if(billType == "account"){
|
||||
$.ajax({
|
||||
url: "/accountHead/getDetailByNumber",
|
||||
data: {
|
||||
billNo: number
|
||||
},
|
||||
type: "get",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200){
|
||||
var data = res.data;
|
||||
$("#bill .BillNoShow").text(data.billNo);
|
||||
$("#bill .BillTimeShow").text(data.billTimeStr);
|
||||
$("#bill .RemarkShow").text(data.remark);
|
||||
$("#bill .AccountIdShow").text(data.accountName);
|
||||
$('#bill .OrganIdShow').text(data.organName);
|
||||
$("#bill .HandsPersonIdShow").text(data.handsPersonName);
|
||||
$("#bill .ChangeAmountShow").text(data.changeAmount==null ? "":data.changeAmount);
|
||||
var totalprice = data.totalPrice;
|
||||
var accountHeadID = data.id;
|
||||
initTableData_account_show(totalprice, accountHeadID); //明细列表-查看状态
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//打印table
|
||||
$("#print_bill_detail").off("click").on("click",function(){
|
||||
var tableString = "";//打印table
|
||||
if(listSubType == "采购入库") {
|
||||
tableString = $(".purchase_in").html();
|
||||
}
|
||||
else if(listSubType == "采购退货出库") {
|
||||
tableString = $(".purchase_back").html();
|
||||
}
|
||||
else if(listSubType == "销售出库") {
|
||||
tableString = $(".sale_out").html();
|
||||
}
|
||||
else if(listSubType == "销售退货入库") {
|
||||
tableString = $(".sale_back").html();
|
||||
}
|
||||
else if(listSubType == "零售出库") {
|
||||
tableString = $(".retail_out").html();
|
||||
}
|
||||
else if(listSubType == "零售退货入库") {
|
||||
tableString = $(".retail_back").html();
|
||||
}
|
||||
else if(listSubType == "其它入库") {
|
||||
tableString = $(".other_in").html();
|
||||
}
|
||||
else if(listSubType == "其它出库") {
|
||||
tableString = $(".other_out").html();
|
||||
}
|
||||
else if(listSubType == "调拨出库") {
|
||||
tableString = $(".allocation_out").html();
|
||||
}
|
||||
else if(listSubType == "盘点复盘") {
|
||||
tableString = $(".stock_check_replay").html();
|
||||
}
|
||||
else if(listSubType == "收入") {
|
||||
tableString = $(".item_in").html();
|
||||
}
|
||||
else if(listSubType == "支出") {
|
||||
tableString = $(".item_out").html();
|
||||
}
|
||||
else if(listSubType == "收款") {
|
||||
tableString = $(".money_in").html();
|
||||
}
|
||||
else if(listSubType == "付款") {
|
||||
tableString = $(".money_out").html();
|
||||
}
|
||||
else if(listSubType == "转账") {
|
||||
tableString = $(".giro").html();
|
||||
}
|
||||
else if(listSubType == "收预付款") {
|
||||
tableString = $(".advance_in").html();
|
||||
}
|
||||
localStorage.setItem("tableString",tableString);
|
||||
window.open("../../js/print/print_form.html","location:No;status:No;help:No;dialogWidth:800px;dialogHeight:600px;scroll:auto;");
|
||||
});
|
||||
}
|
||||
|
||||
//初始化表格数据-商品列表-查看状态
|
||||
function initTableData_material_show(TotalPrice,listSubType){
|
||||
var isShowAnotherDepot = true; //显示对方仓库,true为隐藏,false为显示
|
||||
var anotherDepotHeadName = ""; //对方仓库的列的标题
|
||||
var depotHeadName = ""; //仓库的列的标题
|
||||
if(listSubType == "调拨出库"){
|
||||
isShowAnotherDepot = false; //调拨时候显示对方仓库
|
||||
anotherDepotHeadName = "调入仓库";
|
||||
} else {
|
||||
depotHeadName = "仓库名称";
|
||||
}
|
||||
var isShowTaxColumn = false; //是否显示税率相关的列,true为隐藏,false为显示
|
||||
if(listSubType == "调拨出库" || listSubType == "其它出库" || listSubType == "其它入库" ||
|
||||
listSubType == "零售出库" || listSubType == "零售退货入库" || listSubType == "盘点复盘"){
|
||||
isShowTaxColumn = true; //隐藏
|
||||
}
|
||||
var isShowMaterialTypeColumn = true; //是否显示商品类型相关的列,true为隐藏,false为显示
|
||||
if(listSubType == "组装单" || listSubType == "拆卸单"){
|
||||
isShowMaterialTypeColumn = false; //显示
|
||||
}
|
||||
$('#bill .materialDataShow').datagrid({
|
||||
height:245,
|
||||
rownumbers: true,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
pagination: false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
columns:[[
|
||||
{ title: '商品类型',field: 'MType',width:80, hidden:isShowMaterialTypeColumn},
|
||||
{ title: depotHeadName,field: 'DepotName',editor:'validatebox',width:90},
|
||||
{ title: '名称(型号)(扩展信息)(单位)',field: 'MaterialName',width:230},
|
||||
{ title: anotherDepotHeadName,field: 'AnotherDepotName',hidden:isShowAnotherDepot,width:90},
|
||||
{ title: '单位',field: 'Unit',editor:'validatebox',width:60},
|
||||
{ title: '数量',field: 'OperNumber',editor:'validatebox',width:60},
|
||||
{ title: '单价',field: 'UnitPrice',editor:'validatebox',width:60},
|
||||
{ title: '含税单价',field: 'TaxUnitPrice',editor:'validattebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '金额',field: 'AllPrice',editor:'validatebox',width:75},
|
||||
{ title: '税率',field: 'TaxRate',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '税额',field: 'TaxMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '价税合计',field: 'TaxLastMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:120},
|
||||
{ title: '名称-别',field: 'OtherField1',editor:'validatebox',hidden:otherColumns,width:60},
|
||||
{ title: '型号-别',field: 'OtherField2',editor:'validatebox',hidden:otherColumns,width:60},
|
||||
{ title: '颜色-别',field: 'OtherField3',editor:'validatebox',hidden:otherColumns,width:60},
|
||||
{ title: '备注1',field: 'OtherField4',editor:'validatebox',hidden:true,width:60},
|
||||
{ title: '备注2',field: 'OtherField5',editor:'validatebox',hidden:true,width:60}
|
||||
]],
|
||||
onLoadError:function() {
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: '/depotItem/getDetailList',
|
||||
data: {
|
||||
headerId: depotHeadID,
|
||||
mpList: mPropertyList
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
var data = res.data;
|
||||
var AllPrice = TotalPrice;
|
||||
var DiscountMoney = $("#bill .DiscountMoneyShow:visible").text() - 0; //优惠金额
|
||||
var DiscountLastMoney = $("#bill .DiscountLastMoneyShow:visible").text() - 0; //优惠后金额
|
||||
var array = [];
|
||||
array.push({
|
||||
"AllPrice": AllPrice,
|
||||
"TaxLastMoney": DiscountMoney + DiscountLastMoney
|
||||
});
|
||||
data.footer = array;
|
||||
$("#bill .materialDataShow").datagrid('loadData', data);
|
||||
}
|
||||
},
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//初始化表格数据-明细列表-查看状态
|
||||
function initTableData_account_show(totalprice, accountHeadID){
|
||||
$('#bill .accountDataShow').datagrid({
|
||||
height:280,
|
||||
rownumbers: true,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//单击行是否选中
|
||||
checkOnSelect : false,
|
||||
pagination: false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
columns:[[
|
||||
{ title: payTypeTitle, field: 'InOutItemName', width:230, hidden:itemType},
|
||||
{ title: '账户名称', field: 'AccountName', width:230, hidden:moneyType},
|
||||
{ title: '金额',field: 'EachAmount',width:70},
|
||||
{ title: '备注',field: 'Remark',width:150}
|
||||
]],
|
||||
onLoadError:function()
|
||||
{
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: '/accountItem/getDetailList',
|
||||
data: {
|
||||
headerId: accountHeadID
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
var data = res.data;
|
||||
var EachAmount = totalprice;
|
||||
var array = [];
|
||||
array.push({
|
||||
"EachAmount": EachAmount
|
||||
});
|
||||
data.footer = array;
|
||||
$("#bill .accountDataShow").datagrid('loadData', data);
|
||||
}
|
||||
},
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function print(){
|
||||
alert(listSubType);
|
||||
}
|
||||
1486
erp_web/js/pages/bill/in_out.js
Normal file
1486
erp_web/js/pages/bill/in_out.js
Normal file
File diff suppressed because it is too large
Load Diff
868
erp_web/pages/bill/allocation_out_list.html
Normal file
868
erp_web/pages/bill/allocation_out_list.html
Normal file
@@ -0,0 +1,868 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>调拨出库</title>
|
||||
<meta charset="utf-8">
|
||||
<!-- 指定以IE8的方式来渲染 -->
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
|
||||
<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon"/>
|
||||
<link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="/css/jsherp.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="/js/easyui/themes/default/easyui.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="/js/easyui/themes/icon.css"/>
|
||||
<link type="text/css" rel="stylesheet" href="/css/common.css"/>
|
||||
<link type="text/css" rel="stylesheet" href="/css/in_out.css"/>
|
||||
<script src="/js/jquery-1.8.0.min.js"></script>
|
||||
<script src="/js/easyui/jquery.easyui.min.js"></script>
|
||||
<script src="/js/easyui/locale/easyui-lang-zh_CN.js"></script>
|
||||
<script src="/js/handlebars.js"></script>
|
||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="/js/common/common.js"></script>
|
||||
<script src="/js/common/jsherp.js"></script>
|
||||
<script src="/js/pages/bill/add_temp.js"></script>
|
||||
<script src="/js/pages/bill/in_out.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 数据显示table -->
|
||||
<div id="tablePanel" class="easyui-panel" data-options="fit:true" style="padding:1px;top:300px;" title="调拨出库列表" iconCls="icon-list">
|
||||
<div class="box-body form-inline">
|
||||
<div class="form-group">
|
||||
<label class="control-label">单据编号:</label>
|
||||
<div class="control-inline">
|
||||
<input type="text" id="searchNumber" name="searchNumber" value="" maxlength="100" class="easyui-textbox width-90"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">商品信息:</label>
|
||||
<div class="control-inline">
|
||||
<input type="text" id="searchMaterial" name="searchMaterial" placeholder="名称,型号" maxlength="100" class="easyui-textbox width-90"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">单据日期:</label>
|
||||
<div class="control-inline">
|
||||
<input type="text" id="searchBeginTime" name="searchBeginTime" value="" maxlength="100" class="easyui-datebox width-120"/>
|
||||
-
|
||||
<input type="text" id="searchEndTime" name="searchEndTime" value="" maxlength="100" class="easyui-datebox width-120"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" id="searchBtn">查询</a>
|
||||
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-redo" id="searchResetBtn">重置</a>
|
||||
</div>
|
||||
</div>
|
||||
<table id="tableData" style="top:300px;border-bottom-color:#FFFFFF"></table>
|
||||
</div>
|
||||
|
||||
<div id="depotHeadDlg" class="easyui-dialog" style="padding:10px 20px;" fit="true"
|
||||
closed="true" buttons="#dlg-buttons" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<form id="depotHeadFM" method="post" novalidate>
|
||||
<table width="100%" style="min-width:1100px;">
|
||||
<tr>
|
||||
<td style="width:70px;">单据日期</td>
|
||||
<td style="padding:5px">
|
||||
<input type="text" name="OperTime" id="OperTime"
|
||||
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="txt Wdate radius-ui"
|
||||
style="width:155px;" readonly/>
|
||||
</td>
|
||||
<td style="width:70px;">单据编号</td>
|
||||
<td style="padding:5px">
|
||||
<input name="Number" id="Number" class="easyui-validatebox radius-ui"
|
||||
data-options="validType:'length[2,30]'" style="width:150px;" readonly/>
|
||||
</td>
|
||||
<td style="width:80px;"></td>
|
||||
<td style="padding:5px;"></td>
|
||||
<td style="width:70px;"></td>
|
||||
<td style="padding:5px"></td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9">
|
||||
<!-- 商品列表table -->
|
||||
<table id="materialData" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9">
|
||||
<textarea name="Remark" id="Remark" rows="2" cols="2" class="radius-ui" placeholder="暂无备注信息"
|
||||
style="width: 100%; height:35px;"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="clientIp" id="clientIp" value="<%=clientIp %>"/>
|
||||
</form>
|
||||
</div>
|
||||
<div id="dlg-buttons">
|
||||
<a href="javascript:void(0)" id="saveDepotHead" class="easyui-linkbutton" iconCls="icon-ok">保存</a>
|
||||
<a href="javascript:void(0)" id="cancelDepotHead" class="easyui-linkbutton" iconCls="icon-cancel"
|
||||
onclick="javascript:$('#depotHeadDlg').dialog('close')">取消</a>
|
||||
</div>
|
||||
<div id="depotHeadDlgShow" class="easyui-dialog" style="padding:10px 20px;" fit="true"
|
||||
closed="true" buttons="#dlg-buttons-show" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<table width="100%" style="min-width:1100px;">
|
||||
<tr>
|
||||
<td style="width:60px;">单据日期:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span id="OperTimeShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">单据编号:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span id="NumberShow"></span>
|
||||
</td>
|
||||
<td style="width:80px;"></td>
|
||||
<td style="padding:5px;width:140px;"></td>
|
||||
<td style="width:70px;"></td>
|
||||
<td style="padding:5px;width:140px;"></td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9" style="width: 1130px;">
|
||||
<!-- 商品列表table -->
|
||||
<table id="materialDataShow" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:60px;">单据备注:</td>
|
||||
<td colspan="8" style="height:35px;">
|
||||
<span id="RemarkShow" style="width: 100%; height:35px;"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="dlg-buttons-show">
|
||||
<a href="javascript:void(0)" id="printDepotHeadShow" class="easyui-linkbutton" iconCls="icon-print">打印</a>
|
||||
<a href="javascript:void(0)" id="cancelDepotHeadShow" class="easyui-linkbutton" iconCls="icon-cancel"
|
||||
onclick="javascript:$('#depotHeadDlgShow').dialog('close')">取消</a>
|
||||
</div>
|
||||
<div id="depot"></div>
|
||||
<script>
|
||||
$(function(){
|
||||
//初始化系统基础信息
|
||||
getType();
|
||||
inOutService.getRoleType();
|
||||
inOutService.initSystemData_UB();
|
||||
inOutService.initSystemData_depot();
|
||||
inOutService.initSystemData_account();
|
||||
inOutService.initSupplier(); //供应商
|
||||
inOutService.initSalesman(); //销售人员
|
||||
inOutService.initOutItemList(); //初始化支出项目
|
||||
inOutService.initMProperty(); //初始化商品属性
|
||||
initTableData();
|
||||
inOutService.ininPager();
|
||||
inOutService.initForm();
|
||||
inOutService.bindEvent();//绑定操作事件
|
||||
});
|
||||
//根据单据名称获取类型
|
||||
function getType() {
|
||||
listTitle = $("#tablePanel").prev().text();
|
||||
//改变宽度和高度
|
||||
$("#searchPanel").panel({width:webW-2});
|
||||
$("#tablePanel").panel({width:webW-2});
|
||||
var supUrl = "/supplier/findBySelect_sup"; //供应商接口
|
||||
listType = "出库";
|
||||
listSubType = "调拨";
|
||||
organUrl = supUrl;
|
||||
amountNum = "DBCK";
|
||||
}
|
||||
//初始化表格数据
|
||||
function initTableData(){
|
||||
if(pageType === "skip") {
|
||||
addDepotHead(); //自动弹出编辑框,带缓存数据
|
||||
}
|
||||
var tableToolBar = [
|
||||
{
|
||||
id:'addDepotHead',
|
||||
text:'增加',
|
||||
iconCls:'icon-add',
|
||||
handler:function() {
|
||||
addDepotHead();
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'deleteDepotHead',
|
||||
text:'删除',
|
||||
iconCls:'icon-remove',
|
||||
handler:function() {
|
||||
inOutService.batDeleteDepotHead();
|
||||
}
|
||||
}
|
||||
];
|
||||
$('#tableData').datagrid({
|
||||
height:heightInfo,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
pageSize: 10,
|
||||
pageList: initPageNum,
|
||||
columns:[[
|
||||
{ field: 'id',width:35,align:"center",checkbox:true},
|
||||
{ title: '操作',field: 'op',align:"center", width:90,
|
||||
formatter:function(value,rec,index) {
|
||||
var str = '';
|
||||
var orgId = rec.organId? rec.organId:0;
|
||||
str += '<img title="查看" src="/js/easyui/themes/icons/list.png" style="cursor: pointer;" onclick="showDepotHead(\'' + index + '\');"/> ';
|
||||
if(isShowOpFun()){
|
||||
str += '<img title="编辑" src="/js/easyui/themes/icons/pencil.png" style="cursor: pointer;" onclick="editDepotHead(\'' + index + '\');"/> ';
|
||||
str += '<img title="删除" src="/js/easyui/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="inOutService.deleteDepotHead('+ rec.id +',' + orgId +',' + rec.totalPrice+',' + rec.status + ');"/>';
|
||||
}
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{ title: '单据编号',field: 'number',width:155, formatter:function (value,rec) {
|
||||
if(rec.linknumber) {
|
||||
return value + "[转]";
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '商品信息',field: 'materialsList',width:200,formatter:function(value){
|
||||
if(value) {
|
||||
return value.replace(",",",");
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '单据日期',field: 'operTimeStr',width:145},
|
||||
{ title: '操作员',field: 'userName',width:60},
|
||||
{ title: '金额合计',field: 'totalPrice',width:70}
|
||||
]],
|
||||
toolbar:tableToolBar,
|
||||
onLoadError:function() {
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
dgResize();
|
||||
toolbarStatus();
|
||||
}
|
||||
//新增信息
|
||||
function addDepotHead() {
|
||||
if(checkPower()){
|
||||
return;
|
||||
}
|
||||
$('#depotHeadFM').form('clear');
|
||||
var thisDateTime = getNowFormatDateTime(); //当前时间
|
||||
$("#OperTime").val(thisDateTime);
|
||||
inOutService.buildNumber(); //生成单据编号
|
||||
//初始化优惠率、优惠金额、优惠后金额、本次付|收款、本次欠款 为0
|
||||
$("#Discount").val(0);
|
||||
$("#DiscountMoney").val(0);
|
||||
$("#DiscountLastMoney").val(0);
|
||||
$("#ChangeAmount").val(0);
|
||||
$("#Debt").val(0);
|
||||
$("#AccountId").val(defaultAccountId); //初始化默认的账户Id
|
||||
var addTitle = listTitle.replace("列表","信息");
|
||||
$('#depotHeadDlg').show().dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/edit_add.png"/> 增加' + addTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
depotHeadID = 0;
|
||||
var res = sessionStorage.getItem("rowInfo");
|
||||
if(pageType == "skip" && res) { //从订单跳转过来
|
||||
res = JSON.parse(res);
|
||||
$('#OrganId').combobox('setValue', res.organId);
|
||||
$("#LinkNumber").val(res.number); //关联订单号
|
||||
$("#DiscountLastMoney").val(res.totalPrice); //优惠后金额
|
||||
$("#ChangeAmount").val(res.totalPrice).attr("data-changeamount", res.totalPrice);
|
||||
depotHeadID = res.id;
|
||||
initTableData_material("edit",res.totalPrice); //商品列表
|
||||
} else {
|
||||
initTableData_material("add"); //商品列表
|
||||
}
|
||||
inOutService.reject(); //撤销下、刷新商品列表
|
||||
function supplierDlgFun(type) {
|
||||
$('#supplierDlg').dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/edit_add.png"/> 增加' + type + '信息');
|
||||
$('#supplierFM').form('clear');
|
||||
bindSupplierEvent();
|
||||
}
|
||||
$("#addOrgan").off("click").on("click",function(){
|
||||
supplierDlgFun("供应商");
|
||||
});
|
||||
$("#addMember").off("click").on("click",function(){
|
||||
supplierDlgFun("会员");
|
||||
});
|
||||
$("#addCustomer").off("click").on("click",function(){
|
||||
supplierDlgFun("客户");
|
||||
});
|
||||
$("#addAccount").off("click").on("click",function(){
|
||||
$('#accountDlg').dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/edit_add.png"/> 增加结算账户');
|
||||
$('#accountFM').form('clear');
|
||||
bindAccountEvent();
|
||||
});
|
||||
url = '/depotHead/addDepotHeadAndDetail';
|
||||
}
|
||||
//编辑信息
|
||||
function editDepotHead(index) {
|
||||
var res = $("#tableData").datagrid("getRows")[index];
|
||||
if (res.status == "1" || res.status == "2") {
|
||||
$.messager.alert('编辑提示', '已审核和已转的单据不能编辑!', 'warning');
|
||||
return;
|
||||
}
|
||||
var TotalPrice = res.totalPrice; //合计金额
|
||||
$("#Number").val(res.number).attr("data-defaultNumber",res.number);
|
||||
$("#OperTime").val(res.operTimeStr);
|
||||
$("#LinkNumber").val(res.linkNumber); //关联订单号
|
||||
$("#AccountId").val(res.accountId); //账户Id
|
||||
$("#DiscountLastMoney").val(res.discountLastMoney); //优惠后金额
|
||||
$("#ChangeAmount").val(res.changeAmount).attr("data-changeamount", res.changeAmount);
|
||||
$('#OrganId').combobox('setValue', res.organId);
|
||||
$("#Remark").val(res.remark);
|
||||
$("#Discount").val(res.discount?res.discount:0);
|
||||
$("#DiscountMoney").val(res.discountMoney?res.discountMoney:0);
|
||||
var discountlastmoney = res.discountLastMoney?res.discountLastMoney:0;
|
||||
$("#Debt").val(discountlastmoney-res.changeAmount);
|
||||
$("#AccountDay").val(res.accountDay); //结算天数
|
||||
preTotalPrice = res.totalPrice; //记录前一次合计金额,用于扣预付款
|
||||
oldNumber = res.number; //记录编辑前的单据编号
|
||||
oldId = res.id; //记录单据Id
|
||||
var editTitle = listTitle.replace("列表","信息");
|
||||
$('#depotHeadDlg').show().dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/pencil.png"/> 编辑' + editTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
depotHeadID = res.id;
|
||||
//采购入库、销售出库的多账户加载
|
||||
if(res.accountIdList && res.accountMoneyList){
|
||||
$("#AccountId").val("many"); //下拉框选中多账户
|
||||
var accountArr = res.accountIdList.split(",");
|
||||
var accountMoneyArr = res.accountMoneyList.split(",");
|
||||
accountMoneyArr = changeListFmtPlus(accountMoneyArr) //将数组单个金额中的数值转为正数
|
||||
$("#AccountId").attr("data-accountArr", JSON.stringify(accountArr)).attr("data-accountMoneyArr", JSON.stringify(accountMoneyArr)); //json数据存储
|
||||
$(".many-account-ico").show(); //显示多账户的ico图标
|
||||
} else {
|
||||
$(".many-account-ico").hide(); //隐藏多账户的ico图标
|
||||
}
|
||||
|
||||
//采购入库、销售出库的费用数据加载
|
||||
if(res.otherMoneyList && res.otherMoneyItem){
|
||||
$("#OtherMoney").val(res.otherMoney); //其它费用
|
||||
var itemArr = res.otherMoneyList.split(",");
|
||||
var itemMoneyArr = res.otherMoneyItem.split(",");
|
||||
$("#OtherMoney").attr("data-itemArr",JSON.stringify(itemArr)).attr("data-itemMoneyArr",itemMoneyArr); //json数据存储
|
||||
}
|
||||
initTableData_material("edit",TotalPrice); //商品列表
|
||||
inOutService.reject(); //撤销下、刷新商品列表
|
||||
url = '/depotHead/updateDepotHeadAndDetail?id=' + res.id; //更新接口
|
||||
}
|
||||
//查看信息
|
||||
function showDepotHead(index) {
|
||||
var res = $("#tableData").datagrid("getRows")[index];
|
||||
var manyAccountMoney = 0; //多账户合计-零售
|
||||
$("#NumberShow").text(res.number);
|
||||
$("#OperTimeShow").text(res.operTimeStr);
|
||||
$('#OrganIdShow').text(res.organName);
|
||||
if(res.accountName){
|
||||
$("#AccountIdShow").text(res.accountName); //结算账户
|
||||
} else {
|
||||
if (res.accountIdList) {
|
||||
var accountArr = res.accountIdList.split(","); //账户id列表
|
||||
var accountMoneyArr = res.accountMoneyList.split(","); //账户金额列表
|
||||
var accountIdShow = "";
|
||||
for (var j = 0; j < accountArr.length; j++) {
|
||||
if (accountList != null) {
|
||||
for (var i = 0; i < accountList.length; i++) {
|
||||
var account = accountList[i];
|
||||
if (accountArr[j] == account.id) {
|
||||
var currentAccountMoney = accountMoneyArr[j] - 0;
|
||||
if (currentAccountMoney < 0) {
|
||||
currentAccountMoney = 0 - currentAccountMoney;
|
||||
}
|
||||
accountIdShow = accountIdShow + account.name + "(" + currentAccountMoney + "元) ";
|
||||
manyAccountMoney += accountMoneyArr[j] - 0; //多账户合计-零售
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$("#AccountIdShow").text(accountIdShow);
|
||||
}
|
||||
}
|
||||
$("#ChangeAmountShow").text(res.changeAmount);
|
||||
$("#RemarkShow").text(res.remark);
|
||||
$("#DiscountShow").text(res.discount);
|
||||
$("#DiscountMoneyShow").text(res.discountMoney);
|
||||
$("#DiscountLastMoneyShow").text(res.discountLastMoney);
|
||||
var debt = 0;
|
||||
if(res.otherMoney){
|
||||
debt = (res.discountLastMoney+res.otherMoney-res.changeAmount).toFixed(2);
|
||||
} else {
|
||||
debt = (res.discountLastMoney-res.changeAmount).toFixed(2);
|
||||
}
|
||||
$("#DebtShow").text(debt);
|
||||
$("#AccountDayShow").text(res.accountDay); //结算天数
|
||||
$("#LinkNumberShow").text(res.linkNumber); //关联订单号
|
||||
var otherMoney = res.otherMoney?res.otherMoney:0;
|
||||
if(otherMoney!=0 && res.otherMoneyList && res.otherMoneyItem){
|
||||
var itemArr = res.otherMoneyList.split(","); //支出项目id列表
|
||||
var itemMoneyArr = null;
|
||||
if(res.otherMoneyItem!=null) {
|
||||
itemMoneyArr = eval ("(" + res.otherMoneyItem + ")"); //支出项目金额列表
|
||||
}
|
||||
var otherMoneyShow = "";
|
||||
for(var j =0;j<itemArr.length; j++) {
|
||||
if (outItemList != null) {
|
||||
for (var i = 0; i < outItemList.length; i++) {
|
||||
var money = outItemList[i];
|
||||
if(itemArr[j] == money.Id) {
|
||||
for(var k =0;k<itemMoneyArr.length; k++) {
|
||||
if(itemMoneyArr[k].otherId == money.Id) {
|
||||
otherMoneyShow += money.InOutItemName;
|
||||
if(itemMoneyArr[k].otherMoney) {
|
||||
otherMoneyShow +="(" + itemMoneyArr[k].otherMoney +"元)";
|
||||
}
|
||||
otherMoneyShow+=",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$("#OtherMoneyShow").text(otherMoneyShow +"总计:"+ otherMoney + "元 "); //其它费用
|
||||
}
|
||||
else {
|
||||
$("#OtherMoneyShow").text(otherMoney); //其它费用
|
||||
}
|
||||
$("#payTypeShow").text(res.payType);
|
||||
var TotalPrice = res.totalPrice;
|
||||
var showTitle = listTitle.replace("列表","信息");
|
||||
$('#depotHeadDlgShow').show().dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/list.png"/> 查看' + showTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
|
||||
depotHeadID = res.id;
|
||||
initTableData_material_show(TotalPrice); //商品列表-查看状态
|
||||
}
|
||||
//初始化表格数据-商品列表-编辑状态
|
||||
function initTableData_material(type,TotalPrice) {
|
||||
var self = this;
|
||||
var body,footer,input; //定义表格和文本框
|
||||
var ratioDepot = 1; //比例-仓库用
|
||||
var monthTime = getNowFormatMonth();
|
||||
var isShowAnotherDepot = true; //显示对方仓库,true为隐藏,false为显示
|
||||
var depotHeadName = ""; //仓库名称
|
||||
var depotUrl = ""; //仓库接口地址
|
||||
var depotTextField = ""; //仓库下拉名称
|
||||
var anotherDepotHeadName = ""; //对方仓库的列的标题
|
||||
var anotherDepotUrl = ""; //对方仓库接口地址
|
||||
var anotherDepotTextField = "";
|
||||
if(listSubType == "调拨"){
|
||||
isShowAnotherDepot = false; //调拨时候显示对方仓库
|
||||
anotherDepotHeadName = "调入仓库";
|
||||
anotherDepotUrl = '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid;
|
||||
anotherDepotTextField = "depotName";
|
||||
}
|
||||
depotHeadName = "仓库名称";
|
||||
depotUrl = '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid;
|
||||
depotTextField = "depotName";
|
||||
var isShowTaxColumn = false; //是否显示税率相关的列,true为隐藏,false为显示
|
||||
if(listSubType == "调拨" || listSubType == "其它" || listSubType == "零售" || listSubType == "零售退货" || listSubType == "采购订单" || listSubType == "销售订单" || listSubType == "组装单" || listSubType == "拆卸单"){
|
||||
isShowTaxColumn = true; //隐藏
|
||||
}
|
||||
var isShowMaterialTypeColumn = true; //是否显示商品类型相关的列,true为隐藏,false为显示
|
||||
if(listSubType == "组装单" || listSubType == "拆卸单"){
|
||||
isShowMaterialTypeColumn = false; //显示
|
||||
}
|
||||
$('#materialData').datagrid({
|
||||
height:345,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//单击行是否选中
|
||||
checkOnSelect : false,
|
||||
pagination: false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
//loadFilter: pagerFilter,
|
||||
onClickRow: onClickRow,
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{ title: '商品类型',field: 'MType',editor:'validatebox',hidden:isShowMaterialTypeColumn,width:80},
|
||||
{ title: depotHeadName, field: 'DepotId', editor: 'validatebox', width: 90,
|
||||
formatter: function (value, row, index) {
|
||||
return row.DepotName;
|
||||
},
|
||||
editor: {
|
||||
type: 'combobox',
|
||||
options: {
|
||||
valueField: 'id',
|
||||
textField: depotTextField,
|
||||
method: 'get',
|
||||
url: depotUrl,
|
||||
onSelect:function(rec){
|
||||
var depotId = rec.id;
|
||||
body =$("#depotHeadFM .datagrid-body");
|
||||
footer =$("#depotHeadFM .datagrid-footer");
|
||||
input = ".datagrid-editable-input";
|
||||
var mId = body.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
||||
if(mId){
|
||||
var type = "select"; //type 类型:点击 click,选择 select
|
||||
inOutService.findStockNumById(depotId, mId, monthTime, body, input, ratioDepot, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '条码_名称(规格)(型号)(扩展信息)(单位)',field: 'MaterialExtendId',width:270,
|
||||
formatter:function(value,row,index){
|
||||
return row.MaterialName;
|
||||
},
|
||||
editor:{
|
||||
type:'combogrid',
|
||||
options:{
|
||||
url: "/material/findBySelect",
|
||||
idField:'Id',
|
||||
textField:'MaterialName',
|
||||
method:'get',
|
||||
pagination: true,
|
||||
mode: 'remote',
|
||||
hasDownArrow: false,
|
||||
panelWidth: 630, //下拉框的宽度
|
||||
panelHeight: 380,//下拉框的高度
|
||||
columns:[[
|
||||
{field:'mBarCode',title:'条码',width:120},
|
||||
{field:'name',title:'名称',width:140},
|
||||
{field:'standard',title:'规格',width:80},
|
||||
{field:'model',title:'型号',width:80},
|
||||
{field:'unit',title:'单位',width:60},
|
||||
{field:'stock',title:'库存',width:50},
|
||||
{field:'expand',title:'扩展信息',width:80}
|
||||
]],
|
||||
onBeforeLoad: function(param){
|
||||
var edDepot = $('#materialData').datagrid('getEditor', {index:editIndex,field:'DepotId'});
|
||||
if(edDepot) {
|
||||
param.depotId = $(edDepot.target).combobox('getValue');
|
||||
}
|
||||
param.mpList = mPropertyList; //商品属性
|
||||
},
|
||||
onLoadSuccess: function (rec) {
|
||||
if(rec && rec.total==1) {
|
||||
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
||||
$("#depotHeadFM .datagrid-body").find("[field='OperNumber']").find(".datagrid-editable-input").focus().select();
|
||||
}
|
||||
},
|
||||
onSelect:function(index, rowData){
|
||||
inOutService.materialSelect(rowData,monthTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '库存',field: 'Stock',editor:'validatebox',width:50},
|
||||
{ title: anotherDepotHeadName, field: 'AnotherDepotId',editor:'validatebox',hidden:isShowAnotherDepot,width:90,
|
||||
formatter: function (value, row, index) {
|
||||
return row.AnotherDepotName;
|
||||
},
|
||||
editor: {
|
||||
type: 'combobox',
|
||||
options: {
|
||||
valueField: 'id',
|
||||
textField: anotherDepotTextField,
|
||||
method: 'get',
|
||||
url: anotherDepotUrl
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '单位',field: 'Unit',editor:'validatebox',width:60},
|
||||
{ title: '数量',field: 'OperNumber',editor:'validatebox',width:60},
|
||||
{ title: '单价',field: 'UnitPrice',editor:'validatebox',width:60},
|
||||
{ title: '含税单价',field: 'TaxUnitPrice',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '金额',field: 'AllPrice',editor:'validatebox',width:75},
|
||||
{ title: '税率(%)',field: 'TaxRate',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '税额',field: 'TaxMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '价税合计',field: 'TaxLastMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:100}
|
||||
]],
|
||||
toolbar:[
|
||||
{
|
||||
id:'append',
|
||||
text:'新增行',
|
||||
iconCls:'icon-add',
|
||||
handler:function() {
|
||||
inOutService.append(); //新增行
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'delete',
|
||||
text:'删除行',
|
||||
iconCls:'icon-remove',
|
||||
handler:function() {
|
||||
inOutService.batchDel(); //删除行
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'reject',
|
||||
text:'撤销',
|
||||
iconCls:'icon-undo',
|
||||
handler:function() {
|
||||
inOutService.reject(); //撤销
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'appendDepot',
|
||||
text:'新增仓库',
|
||||
iconCls:'icon-add',
|
||||
handler:function() {
|
||||
inOutService.appendDepot(); //新增仓库
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'appendMaterial',
|
||||
text:'新增商品',
|
||||
iconCls:'icon-add',
|
||||
handler:function() {
|
||||
js.addTabPage(null, "商品信息", "/pages/materials/material.html");
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadError:function() {
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: '/depotItem/getDetailList',
|
||||
data: {
|
||||
headerId: depotHeadID,
|
||||
mpList: mPropertyList
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
var data = res.data;
|
||||
var AllPrice = 0;
|
||||
var TaxLastMoney = 0;
|
||||
var DiscountMoney = $("#DiscountMoney").val()-0; //优惠金额
|
||||
var DiscountLastMoney = $("#DiscountLastMoney").val()-0; //优惠后金额
|
||||
if(type === "edit") {
|
||||
AllPrice = TotalPrice;
|
||||
TaxLastMoney = DiscountMoney + DiscountLastMoney;
|
||||
}
|
||||
var array = [];
|
||||
array.push({
|
||||
"AllPrice": AllPrice,
|
||||
"TaxLastMoney": TaxLastMoney
|
||||
});
|
||||
data.footer = array;
|
||||
$("#materialData").datagrid('loadData',data);
|
||||
if(type === "add") {
|
||||
$("#depotHeadDlg #append").click(); //新增行
|
||||
}
|
||||
}
|
||||
},
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
}
|
||||
});
|
||||
}
|
||||
//初始化表格数据-商品列表-查看状态
|
||||
function initTableData_material_show(TotalPrice) {
|
||||
var self = this;
|
||||
var isShowAnotherDepot = true; //显示对方仓库,true为隐藏,false为显示
|
||||
var anotherDepotHeadName = ""; //对方仓库的列的标题
|
||||
var depotHeadName = ""; //仓库的列的标题
|
||||
if(listSubType == "调拨"){
|
||||
isShowAnotherDepot = false; //调拨时候显示对方仓库
|
||||
anotherDepotHeadName = "调入仓库";
|
||||
}
|
||||
depotHeadName = "仓库名称";
|
||||
var isShowTaxColumn = false; //是否显示税率相关的列,true为隐藏,false为显示
|
||||
if(listSubType == "调拨" || listSubType == "其它" || listSubType == "零售" || listSubType == "零售退货" || listSubType == "采购订单" || listSubType == "销售订单" || listSubType == "组装单" || listSubType == "拆卸单"){
|
||||
isShowTaxColumn = true; //隐藏
|
||||
}
|
||||
var isShowMaterialTypeColumn = true; //是否显示商品类型相关的列,true为隐藏,false为显示
|
||||
if(listSubType == "组装单" || listSubType == "拆卸单"){
|
||||
isShowMaterialTypeColumn = false; //显示
|
||||
}
|
||||
$('#materialDataShow').datagrid({
|
||||
height:345,
|
||||
rownumbers: true,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
pagination: false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
columns:[[
|
||||
{ title: '商品类型',field: 'MType',width:80, hidden:isShowMaterialTypeColumn},
|
||||
{ title: depotHeadName,field: 'DepotName',editor:'validatebox',width:90},
|
||||
{ title: '条码_名称(规格)(型号)(扩展信息)(单位)',field: 'MaterialName',width:270},
|
||||
{ title: '库存',field: 'Stock',width:50},
|
||||
{ title: anotherDepotHeadName,field: 'AnotherDepotName',hidden:isShowAnotherDepot,width:90},
|
||||
{ title: '单位',field: 'Unit',editor:'validatebox',width:60},
|
||||
{ title: '数量',field: 'OperNumber',editor:'validatebox',width:60},
|
||||
{ title: '单价',field: 'UnitPrice',editor:'validatebox',width:60},
|
||||
{ title: '含税单价',field: 'TaxUnitPrice',editor:'validattebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '金额',field: 'AllPrice',editor:'validatebox',width:75},
|
||||
{ title: '税率(%)',field: 'TaxRate',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '税额',field: 'TaxMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '价税合计',field: 'TaxLastMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:100}
|
||||
]],
|
||||
onLoadError:function() {
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: '/depotItem/getDetailList',
|
||||
data: {
|
||||
headerId: depotHeadID,
|
||||
mpList: mPropertyList
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
var data = res.data;
|
||||
var AllPrice = TotalPrice;
|
||||
var DiscountMoney = $("#DiscountMoneyShow").text() - 0; //优惠金额
|
||||
var DiscountLastMoney = $("#DiscountLastMoneyShow").text() - 0; //优惠后金额
|
||||
var array = [];
|
||||
array.push({
|
||||
"AllPrice": AllPrice,
|
||||
"TaxLastMoney": DiscountMoney + DiscountLastMoney
|
||||
});
|
||||
data.footer = array;
|
||||
$("#materialDataShow").datagrid('loadData', data);
|
||||
}
|
||||
},
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
}
|
||||
});
|
||||
}
|
||||
//订单转采购或销售
|
||||
function skipDepotHead(index) {
|
||||
var res = $("#tableData").datagrid("getRows")[index];
|
||||
if(res.status == "0" || res.status == "2") {
|
||||
$.messager.alert('提示','未审核和已转的单据禁止操作!','warning');
|
||||
} else {
|
||||
sessionStorage.setItem("rowInfo", JSON.stringify(res)); //将单据信息存入缓存中
|
||||
if(listTitle == "采购订单列表") {
|
||||
js.addTabPage(null, "订单转采购", "/pages/materials/purchase_in_list.html?t=skip");
|
||||
} else if(listTitle == "销售订单列表") {
|
||||
js.addTabPage(null, "订单转销售", "/pages/materials/sale_out_list.html?t=skip");
|
||||
}
|
||||
}
|
||||
}
|
||||
//保存信息
|
||||
$("#saveDepotHead").off("click").on("click",function(){
|
||||
if(!$('#depotHeadFM').form('validate')){
|
||||
return;
|
||||
}
|
||||
else {
|
||||
//如果初始编号被修改了,就要判断单据编号是否存在
|
||||
if($.trim($("#Number").val()) != $('#Number').attr("data-defaultNumber")){
|
||||
//调用查询单据编号是否重名的方法
|
||||
if(inOutService.checkDepotHeadNumber()){
|
||||
return;
|
||||
}
|
||||
}
|
||||
//进行明细的校验
|
||||
if(depotHeadID ==0) {
|
||||
//新增模式下
|
||||
if (!inOutService.CheckData("add")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//编辑模式下
|
||||
if (!inOutService.CheckData("edit")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
var OrganId = null;
|
||||
var ChangeAmount = $.trim($("#ChangeAmount").val())-0;
|
||||
var TotalPrice = $("#depotHeadFM .datagrid-footer [field='AllPrice'] div").text();
|
||||
if($('#OrganId').length){
|
||||
OrganId = $('#OrganId').combobox('getValue');
|
||||
}
|
||||
var accountMoneyList = $("#AccountId").attr("data-accountmoneyarr"); //账户金额列表-多账户
|
||||
var accountMoneyArr;
|
||||
if(accountMoneyList) {
|
||||
accountMoneyList = accountMoneyList.replace("[","").replace("]","").toString();
|
||||
var reg=new RegExp("\"","g"); //创建正则RegExp对象
|
||||
accountMoneyList = accountMoneyList.replace(reg,""); //替换所有的双引号
|
||||
accountMoneyArr = accountMoneyList.split(","); //转为数组
|
||||
}
|
||||
if(listSubType === "采购订单"||listSubType === "采购"||listSubType === "零售退货"||listSubType === "销售退货"){
|
||||
//付款为负数
|
||||
ChangeAmount = 0 - ChangeAmount;
|
||||
TotalPrice = 0 - TotalPrice;
|
||||
if(accountMoneyArr) {
|
||||
accountMoneyArr = changeListFmtMinus(accountMoneyArr); //将数组单个金额中的数值转为负数
|
||||
}
|
||||
}
|
||||
//零售时候,可以从会员预付款中扣款
|
||||
var thisPayType = "现付";
|
||||
if(listSubType === "零售") {
|
||||
if($("#payType").val() ==="预付款") {
|
||||
thisPayType = "预付款";
|
||||
}
|
||||
}
|
||||
var SalesmanStr = "";
|
||||
if(listSubType === "销售" || listSubType === "销售退货" || listSubType === "销售订单"){
|
||||
var Salesman = $('#Salesman').combobox('getValues').toString(); //销售人员
|
||||
if(Salesman) {
|
||||
var SalesmanArray = Salesman.split(",");
|
||||
for (var i = 0; i < SalesmanArray.length; i++) {
|
||||
if (i === SalesmanArray.length - 1) {
|
||||
SalesmanStr += "<" + SalesmanArray[i] + ">";
|
||||
}
|
||||
else {
|
||||
SalesmanStr += "<" + SalesmanArray[i] + ">,";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var getAccountID = $.trim($("#AccountId").val());
|
||||
if($("#AccountId").val() === "many"){ //多账户
|
||||
getAccountID = null;
|
||||
}
|
||||
var infoStr=JSON.stringify({
|
||||
Type: listType,
|
||||
SubType: listSubType,
|
||||
DefaultNumber: $.trim($("#Number").attr("data-defaultNumber")),//初始编号
|
||||
Number: $.trim($("#Number").val()),
|
||||
LinkNumber: $.trim($("#LinkNumber").val()),
|
||||
OperTime: $("#OperTime").val(),
|
||||
OrganId: OrganId,
|
||||
Salesman: SalesmanStr, //销售人员
|
||||
AccountId: getAccountID,
|
||||
ChangeAmount: ChangeAmount, //付款/收款
|
||||
TotalPrice: TotalPrice, //合计
|
||||
PayType: thisPayType, //现付/预付款
|
||||
Remark: $.trim($("#Remark").val()),
|
||||
AccountIdList: $("#AccountId").attr("data-accountarr"), //账户列表-多账户
|
||||
AccountMoneyList: accountMoneyArr ? JSON.stringify(accountMoneyArr) : "", //账户金额列表-多账户
|
||||
Discount: $.trim($("#Discount").val()),
|
||||
DiscountMoney: $.trim($("#DiscountMoney").val()),
|
||||
DiscountLastMoney: $.trim($("#DiscountLastMoney").val()),
|
||||
OtherMoney: $.trim($("#OtherMoney").val()), //其它费用
|
||||
OtherMoneyList: $("#OtherMoney").attr("data-itemarr"), //支出项目列表-涉及费用
|
||||
OtherMoneyItem: $("#OtherMoney").attr("data-itemmoneyarr"), //支出项目金额列表-涉及费用
|
||||
AccountDay: $("#AccountDay").val() //结算天数
|
||||
});
|
||||
/**
|
||||
* 零售出库,单独操作
|
||||
* */
|
||||
if(url.indexOf("/depotHead/addDepotHeadAndDetail")>=0){
|
||||
inOutService.addDepotHeadAndDetail(url,infoStr);
|
||||
} else if(url.indexOf("/depotHead/updateDepotHeadAndDetail")>=0){
|
||||
inOutService.updateDepotHeadAndDetail(url,infoStr,preTotalPrice);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
865
erp_web/pages/bill/assemble_list.html
Normal file
865
erp_web/pages/bill/assemble_list.html
Normal file
@@ -0,0 +1,865 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>组装单</title>
|
||||
<meta charset="utf-8">
|
||||
<!-- 指定以IE8的方式来渲染 -->
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
|
||||
<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon"/>
|
||||
<link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="/css/jsherp.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="/js/easyui/themes/default/easyui.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="/js/easyui/themes/icon.css"/>
|
||||
<link type="text/css" rel="stylesheet" href="/css/common.css"/>
|
||||
<link type="text/css" rel="stylesheet" href="/css/in_out.css"/>
|
||||
<script src="/js/jquery-1.8.0.min.js"></script>
|
||||
<script src="/js/easyui/jquery.easyui.min.js"></script>
|
||||
<script src="/js/easyui/locale/easyui-lang-zh_CN.js"></script>
|
||||
<script src="/js/handlebars.js"></script>
|
||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="/js/common/common.js"></script>
|
||||
<script src="/js/common/jsherp.js"></script>
|
||||
<script src="/js/pages/bill/add_temp.js"></script>
|
||||
<script src="/js/pages/bill/in_out.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 数据显示table -->
|
||||
<div id="tablePanel" class="easyui-panel" data-options="fit:true" style="padding:1px;top:300px;" title="组装单列表" iconCls="icon-list">
|
||||
<div class="box-body form-inline">
|
||||
<div class="form-group">
|
||||
<label class="control-label">单据编号:</label>
|
||||
<div class="control-inline">
|
||||
<input type="text" id="searchNumber" name="searchNumber" value="" maxlength="100" class="easyui-textbox width-90"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">商品信息:</label>
|
||||
<div class="control-inline">
|
||||
<input type="text" id="searchMaterial" name="searchMaterial" placeholder="名称,型号" maxlength="100" class="easyui-textbox width-90"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">单据日期:</label>
|
||||
<div class="control-inline">
|
||||
<input type="text" id="searchBeginTime" name="searchBeginTime" value="" maxlength="100" class="easyui-datebox width-120"/>
|
||||
-
|
||||
<input type="text" id="searchEndTime" name="searchEndTime" value="" maxlength="100" class="easyui-datebox width-120"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" id="searchBtn">查询</a>
|
||||
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-redo" id="searchResetBtn">重置</a>
|
||||
</div>
|
||||
</div>
|
||||
<table id="tableData" style="top:300px;border-bottom-color:#FFFFFF"></table>
|
||||
</div>
|
||||
|
||||
<div id="depotHeadDlg" class="easyui-dialog" style="padding:10px 20px;" fit="true"
|
||||
closed="true" buttons="#dlg-buttons" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<form id="depotHeadFM" method="post" novalidate>
|
||||
<table width="100%" style="min-width:1100px;">
|
||||
<tr>
|
||||
<td style="width:70px;">单据日期</td>
|
||||
<td style="padding:5px;width:170px;">
|
||||
<input type="text" name="OperTime" id="OperTime"
|
||||
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="txt Wdate radius-ui"
|
||||
style="width:155px;" readonly/>
|
||||
</td>
|
||||
<td style="width:70px;">单据编号</td>
|
||||
<td style="padding:5px">
|
||||
<input name="Number" id="Number" class="easyui-validatebox radius-ui"
|
||||
data-options="validType:'length[2,30]'" style="width:150px;" readonly/>
|
||||
</td>
|
||||
<td style="width:80px;"></td>
|
||||
<td style="padding:5px;width:170px;"></td>
|
||||
<td style="width:70px;"></td>
|
||||
<td style="padding:5px"></td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9">
|
||||
<!-- 商品列表table -->
|
||||
<table id="materialData" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9">
|
||||
<textarea name="Remark" id="Remark" rows="2" cols="2" class="radius-ui" placeholder="暂无备注信息"
|
||||
style="width: 100%; height:35px;"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<div id="dlg-buttons">
|
||||
<a href="javascript:void(0)" id="saveDepotHead" class="easyui-linkbutton" iconCls="icon-ok">保存</a>
|
||||
<a href="javascript:void(0)" id="cancelDepotHead" class="easyui-linkbutton" iconCls="icon-cancel"
|
||||
onclick="javascript:$('#depotHeadDlg').dialog('close')">取消</a>
|
||||
</div>
|
||||
<div id="depotHeadDlgShow" class="easyui-dialog" style="padding:10px 20px;" fit="true"
|
||||
closed="true" buttons="#dlg-buttons-show" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<table width="100%" style="min-width:1100px;">
|
||||
<tr>
|
||||
<td style="width:60px;">单据日期:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span id="OperTimeShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">单据编号:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span id="NumberShow"></span>
|
||||
</td>
|
||||
<td style="width:80px;"></td>
|
||||
<td style="padding:5px;width:140px;"></td>
|
||||
<td style="width:70px;"></td>
|
||||
<td style="padding:5px;width:140px;"></td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9" style="width: 1130px;">
|
||||
<!-- 商品列表table -->
|
||||
<table id="materialDataShow" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:60px;">单据备注:</td>
|
||||
<td colspan="8" style="height:35px;">
|
||||
<span id="RemarkShow" style="width: 1070px; height:35px;"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="dlg-buttons-show">
|
||||
<a href="javascript:void(0)" id="printDepotHeadShow" class="easyui-linkbutton" iconCls="icon-print">打印</a>
|
||||
<a href="javascript:void(0)" id="cancelDepotHeadShow" class="easyui-linkbutton" iconCls="icon-cancel"
|
||||
onclick="javascript:$('#depotHeadDlgShow').dialog('close')">取消</a>
|
||||
</div>
|
||||
<div id="depot"></div>
|
||||
<script>
|
||||
$(function(){
|
||||
//初始化系统基础信息
|
||||
getType();
|
||||
inOutService.getRoleType();
|
||||
inOutService.initSystemData_UB();
|
||||
inOutService.initSystemData_depot();
|
||||
inOutService.initSystemData_account();
|
||||
inOutService.initSupplier(); //供应商
|
||||
inOutService.initSalesman(); //销售人员
|
||||
inOutService.initOutItemList(); //初始化支出项目
|
||||
inOutService.initMProperty(); //初始化商品属性
|
||||
initTableData();
|
||||
inOutService.ininPager();
|
||||
inOutService.initForm();
|
||||
inOutService.bindEvent();//绑定操作事件
|
||||
});
|
||||
//根据单据名称获取类型
|
||||
function getType() {
|
||||
listTitle = $("#tablePanel").prev().text();
|
||||
//改变宽度和高度
|
||||
$("#searchPanel").panel({width:webW-2});
|
||||
$("#tablePanel").panel({width:webW-2});
|
||||
var supUrl = "/supplier/findBySelect_sup"; //供应商接口
|
||||
listType = "其它";
|
||||
listSubType = "组装单";
|
||||
organUrl = supUrl;
|
||||
amountNum = "ZZD";
|
||||
}
|
||||
//初始化表格数据
|
||||
function initTableData(){
|
||||
if(pageType === "skip") {
|
||||
addDepotHead(); //自动弹出编辑框,带缓存数据
|
||||
}
|
||||
var tableToolBar = [
|
||||
{
|
||||
id:'addDepotHead',
|
||||
text:'增加',
|
||||
iconCls:'icon-add',
|
||||
handler:function() {
|
||||
addDepotHead();
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'deleteDepotHead',
|
||||
text:'删除',
|
||||
iconCls:'icon-remove',
|
||||
handler:function() {
|
||||
inOutService.batDeleteDepotHead();
|
||||
}
|
||||
}
|
||||
];
|
||||
$('#tableData').datagrid({
|
||||
height:heightInfo,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
pageSize: 10,
|
||||
pageList: initPageNum,
|
||||
columns:[[
|
||||
{ field: 'id',width:35,align:"center",checkbox:true},
|
||||
{ title: '操作',field: 'op',align:"center", width:90,
|
||||
formatter:function(value,rec,index) {
|
||||
var str = '';
|
||||
var orgId = rec.organId? rec.organId:0;
|
||||
str += '<img title="查看" src="/js/easyui/themes/icons/list.png" style="cursor: pointer;" onclick="showDepotHead(\'' + index + '\');"/> ';
|
||||
if(isShowOpFun()){
|
||||
str += '<img title="编辑" src="/js/easyui/themes/icons/pencil.png" style="cursor: pointer;" onclick="editDepotHead(\'' + index + '\');"/> ';
|
||||
str += '<img title="删除" src="/js/easyui/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="inOutService.deleteDepotHead('+ rec.id +',' + orgId +',' + rec.totalPrice+',' + rec.status + ');"/>';
|
||||
}
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{ title: '单据编号',field: 'number',width:155, formatter:function (value,rec) {
|
||||
if(rec.linknumber) {
|
||||
return value + "[转]";
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '商品信息',field: 'materialsList',width:200,formatter:function(value){
|
||||
if(value) {
|
||||
return value.replace(",",",");
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '单据日期',field: 'operTimeStr',width:145},
|
||||
{ title: '操作员',field: 'userName',width:60},
|
||||
{ title: '金额合计',field: 'totalPrice',width:70}
|
||||
]],
|
||||
toolbar:tableToolBar,
|
||||
onLoadError:function() {
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
dgResize();
|
||||
toolbarStatus();
|
||||
}
|
||||
//新增信息
|
||||
function addDepotHead() {
|
||||
if(checkPower()){
|
||||
return;
|
||||
}
|
||||
$('#depotHeadFM').form('clear');
|
||||
var thisDateTime = getNowFormatDateTime(); //当前时间
|
||||
$("#OperTime").val(thisDateTime);
|
||||
inOutService.buildNumber(); //生成单据编号
|
||||
//初始化优惠率、优惠金额、优惠后金额、本次付|收款、本次欠款 为0
|
||||
$("#Discount").val(0);
|
||||
$("#DiscountMoney").val(0);
|
||||
$("#DiscountLastMoney").val(0);
|
||||
$("#ChangeAmount").val(0);
|
||||
$("#Debt").val(0);
|
||||
$("#AccountId").val(defaultAccountId); //初始化默认的账户Id
|
||||
var addTitle = listTitle.replace("列表","信息");
|
||||
$('#depotHeadDlg').show().dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/edit_add.png"/> 增加' + addTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
depotHeadID = 0;
|
||||
var res = sessionStorage.getItem("rowInfo");
|
||||
if(pageType == "skip" && res) { //从订单跳转过来
|
||||
res = JSON.parse(res);
|
||||
$('#OrganId').combobox('setValue', res.organId);
|
||||
$("#LinkNumber").val(res.number); //关联订单号
|
||||
$("#DiscountLastMoney").val(res.totalPrice); //优惠后金额
|
||||
$("#ChangeAmount").val(res.totalPrice).attr("data-changeamount", res.totalPrice);
|
||||
depotHeadID = res.id;
|
||||
initTableData_material("edit",res.totalPrice); //商品列表
|
||||
} else {
|
||||
initTableData_material("add"); //商品列表
|
||||
}
|
||||
inOutService.reject(); //撤销下、刷新商品列表
|
||||
function supplierDlgFun(type) {
|
||||
$('#supplierDlg').dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/edit_add.png"/> 增加' + type + '信息');
|
||||
$('#supplierFM').form('clear');
|
||||
bindSupplierEvent();
|
||||
}
|
||||
$("#addOrgan").off("click").on("click",function(){
|
||||
supplierDlgFun("供应商");
|
||||
});
|
||||
$("#addMember").off("click").on("click",function(){
|
||||
supplierDlgFun("会员");
|
||||
});
|
||||
$("#addCustomer").off("click").on("click",function(){
|
||||
supplierDlgFun("客户");
|
||||
});
|
||||
$("#addAccount").off("click").on("click",function(){
|
||||
$('#accountDlg').dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/edit_add.png"/> 增加结算账户');
|
||||
$('#accountFM').form('clear');
|
||||
bindAccountEvent();
|
||||
});
|
||||
url = '/depotHead/addDepotHeadAndDetail';
|
||||
}
|
||||
//编辑信息
|
||||
function editDepotHead(index) {
|
||||
var res = $("#tableData").datagrid("getRows")[index];
|
||||
if (res.status == "1" || res.status == "2") {
|
||||
$.messager.alert('编辑提示', '已审核和已转的单据不能编辑!', 'warning');
|
||||
return;
|
||||
}
|
||||
var TotalPrice = res.totalPrice; //合计金额
|
||||
$("#Number").val(res.number).attr("data-defaultNumber",res.number);
|
||||
$("#OperTime").val(res.operTimeStr);
|
||||
$("#LinkNumber").val(res.linkNumber); //关联订单号
|
||||
$("#AccountId").val(res.accountId); //账户Id
|
||||
$("#DiscountLastMoney").val(res.discountLastMoney); //优惠后金额
|
||||
$("#ChangeAmount").val(res.changeAmount).attr("data-changeamount", res.changeAmount);
|
||||
$('#OrganId').combobox('setValue', res.organId);
|
||||
$("#Remark").val(res.remark);
|
||||
$("#Discount").val(res.discount?res.discount:0);
|
||||
$("#DiscountMoney").val(res.discountMoney?res.discountMoney:0);
|
||||
var discountlastmoney = res.discountLastMoney?res.discountLastMoney:0;
|
||||
$("#Debt").val(discountlastmoney-res.changeAmount);
|
||||
$("#AccountDay").val(res.accountDay); //结算天数
|
||||
preTotalPrice = res.totalPrice; //记录前一次合计金额,用于扣预付款
|
||||
oldNumber = res.number; //记录编辑前的单据编号
|
||||
oldId = res.id; //记录单据Id
|
||||
var editTitle = listTitle.replace("列表","信息");
|
||||
$('#depotHeadDlg').show().dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/pencil.png"/> 编辑' + editTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
depotHeadID = res.id;
|
||||
//采购入库、销售出库的多账户加载
|
||||
if(res.accountIdList && res.accountMoneyList){
|
||||
$("#AccountId").val("many"); //下拉框选中多账户
|
||||
var accountArr = res.accountIdList.split(",");
|
||||
var accountMoneyArr = res.accountMoneyList.split(",");
|
||||
accountMoneyArr = changeListFmtPlus(accountMoneyArr) //将数组单个金额中的数值转为正数
|
||||
$("#AccountId").attr("data-accountArr", JSON.stringify(accountArr)).attr("data-accountMoneyArr", JSON.stringify(accountMoneyArr)); //json数据存储
|
||||
$(".many-account-ico").show(); //显示多账户的ico图标
|
||||
} else {
|
||||
$(".many-account-ico").hide(); //隐藏多账户的ico图标
|
||||
}
|
||||
//采购入库、销售出库的费用数据加载
|
||||
if(res.otherMoneyList && res.otherMoneyItem){
|
||||
$("#OtherMoney").val(res.otherMoney); //其它费用
|
||||
var itemArr = res.otherMoneyList.split(",");
|
||||
var itemMoneyArr = res.otherMoneyItem.split(",");
|
||||
$("#OtherMoney").attr("data-itemArr",JSON.stringify(itemArr)).attr("data-itemMoneyArr",itemMoneyArr); //json数据存储
|
||||
}
|
||||
initTableData_material("edit",TotalPrice); //商品列表
|
||||
inOutService.reject(); //撤销下、刷新商品列表
|
||||
url = '/depotHead/updateDepotHeadAndDetail?id=' + res.id; //更新接口
|
||||
}
|
||||
//查看信息
|
||||
function showDepotHead(index) {
|
||||
var res = $("#tableData").datagrid("getRows")[index];
|
||||
var manyAccountMoney = 0; //多账户合计-零售
|
||||
$("#NumberShow").text(res.number);
|
||||
$("#OperTimeShow").text(res.operTimeStr);
|
||||
$('#OrganIdShow').text(res.organName);
|
||||
if(res.accountName){
|
||||
$("#AccountIdShow").text(res.accountName); //结算账户
|
||||
} else {
|
||||
if (res.accountIdList) {
|
||||
var accountArr = res.accountIdList.split(","); //账户id列表
|
||||
var accountMoneyArr = res.accountMoneyList.split(","); //账户金额列表
|
||||
var accountIdShow = "";
|
||||
for (var j = 0; j < accountArr.length; j++) {
|
||||
if (accountList != null) {
|
||||
for (var i = 0; i < accountList.length; i++) {
|
||||
var account = accountList[i];
|
||||
if (accountArr[j] == account.id) {
|
||||
var currentAccountMoney = accountMoneyArr[j] - 0;
|
||||
if (currentAccountMoney < 0) {
|
||||
currentAccountMoney = 0 - currentAccountMoney;
|
||||
}
|
||||
accountIdShow = accountIdShow + account.name + "(" + currentAccountMoney + "元) ";
|
||||
manyAccountMoney += accountMoneyArr[j] - 0; //多账户合计-零售
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$("#AccountIdShow").text(accountIdShow);
|
||||
}
|
||||
}
|
||||
$("#ChangeAmountShow").text(res.changeAmount);
|
||||
$("#RemarkShow").text(res.remark);
|
||||
$("#DiscountShow").text(res.discount);
|
||||
$("#DiscountMoneyShow").text(res.discountMoney);
|
||||
$("#DiscountLastMoneyShow").text(res.discountLastMoney);
|
||||
var debt = 0;
|
||||
if(res.otherMoney){
|
||||
debt = (res.discountLastMoney+res.otherMoney-res.changeAmount).toFixed(2);
|
||||
} else {
|
||||
debt = (res.discountLastMoney-res.changeAmount).toFixed(2);
|
||||
}
|
||||
$("#DebtShow").text(debt);
|
||||
$("#AccountDayShow").text(res.accountDay); //结算天数
|
||||
$("#LinkNumberShow").text(res.linkNumber); //关联订单号
|
||||
var otherMoney = res.otherMoney?res.otherMoney:0;
|
||||
if(otherMoney!=0 && res.otherMoneyList && res.otherMoneyItem){
|
||||
var itemArr = res.otherMoneyList.split(","); //支出项目id列表
|
||||
var itemMoneyArr = null;
|
||||
if(res.otherMoneyItem!=null) {
|
||||
itemMoneyArr = eval ("(" + res.otherMoneyItem + ")"); //支出项目金额列表
|
||||
}
|
||||
var otherMoneyShow = "";
|
||||
for(var j =0;j<itemArr.length; j++) {
|
||||
if (outItemList != null) {
|
||||
for (var i = 0; i < outItemList.length; i++) {
|
||||
var money = outItemList[i];
|
||||
if(itemArr[j] == money.Id) {
|
||||
for(var k =0;k<itemMoneyArr.length; k++) {
|
||||
if(itemMoneyArr[k].otherId == money.Id) {
|
||||
otherMoneyShow += money.InOutItemName;
|
||||
if(itemMoneyArr[k].otherMoney) {
|
||||
otherMoneyShow +="(" + itemMoneyArr[k].otherMoney +"元)";
|
||||
}
|
||||
otherMoneyShow+=",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$("#OtherMoneyShow").text(otherMoneyShow +"总计:"+ otherMoney + "元 "); //其它费用
|
||||
}
|
||||
else {
|
||||
$("#OtherMoneyShow").text(otherMoney); //其它费用
|
||||
}
|
||||
$("#payTypeShow").text(res.payType);
|
||||
var TotalPrice = res.totalPrice;
|
||||
var showTitle = listTitle.replace("列表","信息");
|
||||
$('#depotHeadDlgShow').show().dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/list.png"/> 查看' + showTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
depotHeadID = res.id;
|
||||
initTableData_material_show(TotalPrice); //商品列表-查看状态
|
||||
}
|
||||
//初始化表格数据-商品列表-编辑状态
|
||||
function initTableData_material(type,TotalPrice) {
|
||||
var self = this;
|
||||
var body,footer,input; //定义表格和文本框
|
||||
var ratioDepot = 1; //比例-仓库用
|
||||
var monthTime = getNowFormatMonth();
|
||||
var isShowAnotherDepot = true; //显示对方仓库,true为隐藏,false为显示
|
||||
var depotHeadName = ""; //仓库名称
|
||||
var depotUrl = ""; //仓库接口地址
|
||||
var depotTextField = ""; //仓库下拉名称
|
||||
var anotherDepotHeadName = ""; //对方仓库的列的标题
|
||||
var anotherDepotUrl = ""; //对方仓库接口地址
|
||||
var anotherDepotTextField = "";
|
||||
if(listSubType == "调拨"){
|
||||
isShowAnotherDepot = false; //调拨时候显示对方仓库
|
||||
anotherDepotHeadName = "调入仓库";
|
||||
anotherDepotUrl = '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid;
|
||||
anotherDepotTextField = "depotName";
|
||||
}
|
||||
depotHeadName = "仓库名称";
|
||||
depotUrl = '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid;
|
||||
depotTextField = "depotName";
|
||||
var isShowTaxColumn = false; //是否显示税率相关的列,true为隐藏,false为显示
|
||||
if(listSubType == "调拨" || listSubType == "其它" || listSubType == "零售" || listSubType == "零售退货" || listSubType == "采购订单" || listSubType == "销售订单" || listSubType == "组装单" || listSubType == "拆卸单"){
|
||||
isShowTaxColumn = true; //隐藏
|
||||
}
|
||||
var isShowMaterialTypeColumn = true; //是否显示商品类型相关的列,true为隐藏,false为显示
|
||||
if(listSubType == "组装单" || listSubType == "拆卸单"){
|
||||
isShowMaterialTypeColumn = false; //显示
|
||||
}
|
||||
$('#materialData').datagrid({
|
||||
height:345,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//单击行是否选中
|
||||
checkOnSelect : false,
|
||||
pagination: false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
//loadFilter: pagerFilter,
|
||||
onClickRow: onClickRow,
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{ title: '商品类型',field: 'MType',editor:'validatebox',hidden:isShowMaterialTypeColumn,width:80},
|
||||
{ title: depotHeadName, field: 'DepotId', editor: 'validatebox', width: 90,
|
||||
formatter: function (value, row, index) {
|
||||
return row.DepotName;
|
||||
},
|
||||
editor: {
|
||||
type: 'combobox',
|
||||
options: {
|
||||
valueField: 'id',
|
||||
textField: depotTextField,
|
||||
method: 'get',
|
||||
url: depotUrl,
|
||||
onSelect:function(rec){
|
||||
var depotId = rec.id;
|
||||
body =$("#depotHeadFM .datagrid-body");
|
||||
footer =$("#depotHeadFM .datagrid-footer");
|
||||
input = ".datagrid-editable-input";
|
||||
var mId = body.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
||||
if(mId){
|
||||
var type = "select"; //type 类型:点击 click,选择 select
|
||||
inOutService.findStockNumById(depotId, mId, monthTime, body, input, ratioDepot, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '条码_名称(规格)(型号)(扩展信息)(单位)',field: 'MaterialExtendId',width:270,
|
||||
formatter:function(value,row,index){
|
||||
return row.MaterialName;
|
||||
},
|
||||
editor:{
|
||||
type:'combogrid',
|
||||
options:{
|
||||
url: "/material/findBySelect",
|
||||
idField:'Id',
|
||||
textField:'MaterialName',
|
||||
method:'get',
|
||||
pagination: true,
|
||||
mode: 'remote',
|
||||
hasDownArrow: false,
|
||||
panelWidth: 630, //下拉框的宽度
|
||||
panelHeight: 380,//下拉框的高度
|
||||
columns:[[
|
||||
{field:'mBarCode',title:'条码',width:120},
|
||||
{field:'name',title:'名称',width:140},
|
||||
{field:'standard',title:'规格',width:80},
|
||||
{field:'model',title:'型号',width:80},
|
||||
{field:'unit',title:'单位',width:60},
|
||||
{field:'stock',title:'库存',width:50},
|
||||
{field:'expand',title:'扩展信息',width:80}
|
||||
]],
|
||||
onBeforeLoad: function(param){
|
||||
var edDepot = $('#materialData').datagrid('getEditor', {index:editIndex,field:'DepotId'});
|
||||
if(edDepot) {
|
||||
param.depotId = $(edDepot.target).combobox('getValue');
|
||||
}
|
||||
param.mpList = mPropertyList; //商品属性
|
||||
},
|
||||
onLoadSuccess: function (rec) {
|
||||
if(rec && rec.total==1) {
|
||||
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
||||
$("#depotHeadFM .datagrid-body").find("[field='OperNumber']").find(".datagrid-editable-input").focus().select();
|
||||
}
|
||||
},
|
||||
onSelect:function(index, rowData){
|
||||
inOutService.materialSelect(rowData,monthTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '库存',field: 'Stock',editor:'validatebox',width:50},
|
||||
{ title: anotherDepotHeadName, field: 'AnotherDepotId',editor:'validatebox',hidden:isShowAnotherDepot,width:90,
|
||||
formatter: function (value, row, index) {
|
||||
return row.AnotherDepotName;
|
||||
},
|
||||
editor: {
|
||||
type: 'combobox',
|
||||
options: {
|
||||
valueField: 'id',
|
||||
textField: anotherDepotTextField,
|
||||
method: 'get',
|
||||
url: anotherDepotUrl
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '单位',field: 'Unit',editor:'validatebox',width:60},
|
||||
{ title: '数量',field: 'OperNumber',editor:'validatebox',width:60},
|
||||
{ title: '单价',field: 'UnitPrice',editor:'validatebox',width:60},
|
||||
{ title: '含税单价',field: 'TaxUnitPrice',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '金额',field: 'AllPrice',editor:'validatebox',width:75},
|
||||
{ title: '税率(%)',field: 'TaxRate',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '税额',field: 'TaxMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '价税合计',field: 'TaxLastMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:100}
|
||||
]],
|
||||
toolbar:[
|
||||
{
|
||||
id:'append',
|
||||
text:'新增行',
|
||||
iconCls:'icon-add',
|
||||
handler:function() {
|
||||
inOutService.append(); //新增行
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'delete',
|
||||
text:'删除行',
|
||||
iconCls:'icon-remove',
|
||||
handler:function() {
|
||||
inOutService.batchDel(); //删除行
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'reject',
|
||||
text:'撤销',
|
||||
iconCls:'icon-undo',
|
||||
handler:function() {
|
||||
inOutService.reject(); //撤销
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'appendDepot',
|
||||
text:'新增仓库',
|
||||
iconCls:'icon-add',
|
||||
handler:function() {
|
||||
inOutService.appendDepot(); //新增仓库
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'appendMaterial',
|
||||
text:'新增商品',
|
||||
iconCls:'icon-add',
|
||||
handler:function() {
|
||||
js.addTabPage(null, "商品信息", "/pages/materials/material.html");
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadError:function() {
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: '/depotItem/getDetailList',
|
||||
data: {
|
||||
headerId: depotHeadID,
|
||||
mpList: mPropertyList
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
var data = res.data;
|
||||
var AllPrice = 0;
|
||||
var TaxLastMoney = 0;
|
||||
var DiscountMoney = $("#DiscountMoney").val()-0; //优惠金额
|
||||
var DiscountLastMoney = $("#DiscountLastMoney").val()-0; //优惠后金额
|
||||
if(type === "edit") {
|
||||
AllPrice = TotalPrice;
|
||||
TaxLastMoney = DiscountMoney + DiscountLastMoney;
|
||||
}
|
||||
var array = [];
|
||||
array.push({
|
||||
"AllPrice": AllPrice,
|
||||
"TaxLastMoney": TaxLastMoney
|
||||
});
|
||||
data.footer = array;
|
||||
$("#materialData").datagrid('loadData',data);
|
||||
if(type === "add") {
|
||||
$("#depotHeadDlg #append").click(); //新增行
|
||||
}
|
||||
}
|
||||
},
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
}
|
||||
});
|
||||
}
|
||||
//初始化表格数据-商品列表-查看状态
|
||||
function initTableData_material_show(TotalPrice) {
|
||||
var self = this;
|
||||
var isShowAnotherDepot = true; //显示对方仓库,true为隐藏,false为显示
|
||||
var anotherDepotHeadName = ""; //对方仓库的列的标题
|
||||
var depotHeadName = ""; //仓库的列的标题
|
||||
if(listSubType == "调拨"){
|
||||
isShowAnotherDepot = false; //调拨时候显示对方仓库
|
||||
anotherDepotHeadName = "调入仓库";
|
||||
}
|
||||
depotHeadName = "仓库名称";
|
||||
var isShowTaxColumn = false; //是否显示税率相关的列,true为隐藏,false为显示
|
||||
if(listSubType == "调拨" || listSubType == "其它" || listSubType == "零售" || listSubType == "零售退货" || listSubType == "采购订单" || listSubType == "销售订单" || listSubType == "组装单" || listSubType == "拆卸单"){
|
||||
isShowTaxColumn = true; //隐藏
|
||||
}
|
||||
var isShowMaterialTypeColumn = true; //是否显示商品类型相关的列,true为隐藏,false为显示
|
||||
if(listSubType == "组装单" || listSubType == "拆卸单"){
|
||||
isShowMaterialTypeColumn = false; //显示
|
||||
}
|
||||
$('#materialDataShow').datagrid({
|
||||
height:345,
|
||||
rownumbers: true,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
pagination: false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
columns:[[
|
||||
{ title: '商品类型',field: 'MType',width:80, hidden:isShowMaterialTypeColumn},
|
||||
{ title: depotHeadName,field: 'DepotName',editor:'validatebox',width:90},
|
||||
{ title: '条码_名称(规格)(型号)(扩展信息)(单位)',field: 'MaterialName',width:270},
|
||||
{ title: '库存',field: 'Stock',width:50},
|
||||
{ title: anotherDepotHeadName,field: 'AnotherDepotName',hidden:isShowAnotherDepot,width:90},
|
||||
{ title: '单位',field: 'Unit',editor:'validatebox',width:60},
|
||||
{ title: '数量',field: 'OperNumber',editor:'validatebox',width:60},
|
||||
{ title: '单价',field: 'UnitPrice',editor:'validatebox',width:60},
|
||||
{ title: '含税单价',field: 'TaxUnitPrice',editor:'validattebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '金额',field: 'AllPrice',editor:'validatebox',width:75},
|
||||
{ title: '税率(%)',field: 'TaxRate',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '税额',field: 'TaxMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '价税合计',field: 'TaxLastMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:100}
|
||||
]],
|
||||
onLoadError:function() {
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: '/depotItem/getDetailList',
|
||||
data: {
|
||||
headerId: depotHeadID,
|
||||
mpList: mPropertyList
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
var data = res.data;
|
||||
var AllPrice = TotalPrice;
|
||||
var DiscountMoney = $("#DiscountMoneyShow").text() - 0; //优惠金额
|
||||
var DiscountLastMoney = $("#DiscountLastMoneyShow").text() - 0; //优惠后金额
|
||||
var array = [];
|
||||
array.push({
|
||||
"AllPrice": AllPrice,
|
||||
"TaxLastMoney": DiscountMoney + DiscountLastMoney
|
||||
});
|
||||
data.footer = array;
|
||||
$("#materialDataShow").datagrid('loadData', data);
|
||||
}
|
||||
},
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
}
|
||||
});
|
||||
}
|
||||
//订单转采购或销售
|
||||
function skipDepotHead(index) {
|
||||
var res = $("#tableData").datagrid("getRows")[index];
|
||||
if(res.status == "0" || res.status == "2") {
|
||||
$.messager.alert('提示','未审核和已转的单据禁止操作!','warning');
|
||||
} else {
|
||||
sessionStorage.setItem("rowInfo", JSON.stringify(res)); //将单据信息存入缓存中
|
||||
if(listTitle == "采购订单列表") {
|
||||
js.addTabPage(null, "订单转采购", "/pages/materials/purchase_in_list.html?t=skip");
|
||||
} else if(listTitle == "销售订单列表") {
|
||||
js.addTabPage(null, "订单转销售", "/pages/materials/sale_out_list.html?t=skip");
|
||||
}
|
||||
}
|
||||
}
|
||||
//保存信息
|
||||
$("#saveDepotHead").off("click").on("click",function(){
|
||||
if(!$('#depotHeadFM').form('validate')){
|
||||
return;
|
||||
}
|
||||
else {
|
||||
//如果初始编号被修改了,就要判断单据编号是否存在
|
||||
if($.trim($("#Number").val()) != $('#Number').attr("data-defaultNumber")){
|
||||
//调用查询单据编号是否重名的方法
|
||||
if(inOutService.checkDepotHeadNumber()){
|
||||
return;
|
||||
}
|
||||
}
|
||||
//进行明细的校验
|
||||
if(depotHeadID ==0) {
|
||||
//新增模式下
|
||||
if (!inOutService.CheckData("add")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//编辑模式下
|
||||
if (!inOutService.CheckData("edit")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
var OrganId = null;
|
||||
var ChangeAmount = $.trim($("#ChangeAmount").val())-0;
|
||||
var TotalPrice = $("#depotHeadFM .datagrid-footer [field='AllPrice'] div").text();
|
||||
if($('#OrganId').length){
|
||||
OrganId = $('#OrganId').combobox('getValue');
|
||||
}
|
||||
var accountMoneyList = $("#AccountId").attr("data-accountmoneyarr"); //账户金额列表-多账户
|
||||
var accountMoneyArr;
|
||||
if(accountMoneyList) {
|
||||
accountMoneyList = accountMoneyList.replace("[","").replace("]","").toString();
|
||||
var reg=new RegExp("\"","g"); //创建正则RegExp对象
|
||||
accountMoneyList = accountMoneyList.replace(reg,""); //替换所有的双引号
|
||||
accountMoneyArr = accountMoneyList.split(","); //转为数组
|
||||
}
|
||||
if(listSubType === "采购订单"||listSubType === "采购"||listSubType === "零售退货"||listSubType === "销售退货"){
|
||||
//付款为负数
|
||||
ChangeAmount = 0 - ChangeAmount;
|
||||
TotalPrice = 0 - TotalPrice;
|
||||
if(accountMoneyArr) {
|
||||
accountMoneyArr = changeListFmtMinus(accountMoneyArr); //将数组单个金额中的数值转为负数
|
||||
}
|
||||
}
|
||||
//零售时候,可以从会员预付款中扣款
|
||||
var thisPayType = "现付";
|
||||
if(listSubType === "零售") {
|
||||
if($("#payType").val() ==="预付款") {
|
||||
thisPayType = "预付款";
|
||||
}
|
||||
}
|
||||
var SalesmanStr = "";
|
||||
if(listSubType === "销售" || listSubType === "销售退货" || listSubType === "销售订单"){
|
||||
var Salesman = $('#Salesman').combobox('getValues').toString(); //销售人员
|
||||
if(Salesman) {
|
||||
var SalesmanArray = Salesman.split(",");
|
||||
for (var i = 0; i < SalesmanArray.length; i++) {
|
||||
if (i === SalesmanArray.length - 1) {
|
||||
SalesmanStr += "<" + SalesmanArray[i] + ">";
|
||||
}
|
||||
else {
|
||||
SalesmanStr += "<" + SalesmanArray[i] + ">,";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var getAccountID = $.trim($("#AccountId").val());
|
||||
if($("#AccountId").val() === "many"){ //多账户
|
||||
getAccountID = null;
|
||||
}
|
||||
var infoStr=JSON.stringify({
|
||||
Type: listType,
|
||||
SubType: listSubType,
|
||||
DefaultNumber: $.trim($("#Number").attr("data-defaultNumber")),//初始编号
|
||||
Number: $.trim($("#Number").val()),
|
||||
LinkNumber: $.trim($("#LinkNumber").val()),
|
||||
OperTime: $("#OperTime").val(),
|
||||
OrganId: OrganId,
|
||||
Salesman: SalesmanStr, //销售人员
|
||||
AccountId: getAccountID,
|
||||
ChangeAmount: ChangeAmount, //付款/收款
|
||||
TotalPrice: TotalPrice, //合计
|
||||
PayType: thisPayType, //现付/预付款
|
||||
Remark: $.trim($("#Remark").val()),
|
||||
AccountIdList: $("#AccountId").attr("data-accountarr"), //账户列表-多账户
|
||||
AccountMoneyList: accountMoneyArr ? JSON.stringify(accountMoneyArr) : "", //账户金额列表-多账户
|
||||
Discount: $.trim($("#Discount").val()),
|
||||
DiscountMoney: $.trim($("#DiscountMoney").val()),
|
||||
DiscountLastMoney: $.trim($("#DiscountLastMoney").val()),
|
||||
OtherMoney: $.trim($("#OtherMoney").val()), //其它费用
|
||||
OtherMoneyList: $("#OtherMoney").attr("data-itemarr"), //支出项目列表-涉及费用
|
||||
OtherMoneyItem: $("#OtherMoney").attr("data-itemmoneyarr"), //支出项目金额列表-涉及费用
|
||||
AccountDay: $("#AccountDay").val() //结算天数
|
||||
});
|
||||
/**
|
||||
* 零售出库,单独操作
|
||||
* */
|
||||
if(url.indexOf("/depotHead/addDepotHeadAndDetail")>=0){
|
||||
inOutService.addDepotHeadAndDetail(url,infoStr);
|
||||
} else if(url.indexOf("/depotHead/updateDepotHeadAndDetail")>=0){
|
||||
inOutService.updateDepotHeadAndDetail(url,infoStr,preTotalPrice);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
869
erp_web/pages/bill/bill_detail.html
Normal file
869
erp_web/pages/bill/bill_detail.html
Normal file
@@ -0,0 +1,869 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>单据明细</title>
|
||||
<meta charset="utf-8">
|
||||
<!-- 指定以IE8的方式来渲染 -->
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
|
||||
<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon"/>
|
||||
<link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="/css/jsherp.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="/js/easyui/themes/default/easyui.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="/js/easyui/themes/icon.css"/>
|
||||
<link type="text/css" rel="stylesheet" href="/css/common.css"/>
|
||||
<link type="text/css" rel="stylesheet" href="/css/bill_detail.css"/>
|
||||
<script src="/js/jquery-1.8.0.min.js"></script>
|
||||
<script src="/js/easyui/jquery.easyui.min.js"></script>
|
||||
<script src="/js/easyui/locale/easyui-lang-zh_CN.js"></script>
|
||||
<script src="/js/common/common.js"></script>
|
||||
<script src="/js/pages/bill/bill_detail.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div id="bill" class="easyui-panel" style="padding:10px;height:550px;" title="单据明细" iconCls="icon-list"
|
||||
collapsible="true" closable="false">
|
||||
<!--零售出库-->
|
||||
<div class="retail_out" style="width:1300px;padding:10px 20px;top:50px"
|
||||
closed="true" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width:80px;height:50px;">会员卡号:</td>
|
||||
<td style="padding:5px;width:200px;">
|
||||
<span class="OrganIdShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">单据日期:</td>
|
||||
<td style="padding:5px;width:200px;">
|
||||
<span class="OperTimeShow"></span>
|
||||
</td>
|
||||
<td style="width:80px;">单据编号:</td>
|
||||
<td style="padding:5px;width:200px;">
|
||||
<span class="NumberShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">付款类型:</td>
|
||||
<td style="padding:5px;width:150px;">
|
||||
<span class="payTypeShow"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<!-- 商品列表table -->
|
||||
<table class="materialDataShow" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
<td colspan="2" valign="top">
|
||||
<table width="100%" class="retail-amount-show">
|
||||
<tr>
|
||||
<td colspan="2">实收金额</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<b><span class="change-amount-show"></span></b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">收款金额</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<b><span class="get-amount-show"></span></b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">找零</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<b><span class="back-amount-show"></span></b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>收款账户:</td>
|
||||
<td align="left" style="width:110px;">
|
||||
<span class="AccountIdShow"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="8" style="width: 1130px; height:35px;">
|
||||
<span class="RemarkShow"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!--零售退货-->
|
||||
<div class="retail_back" style="width:1300px;padding:10px 20px;top:50px"
|
||||
closed="true" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width:80px;height:50px;">会员卡号:</td>
|
||||
<td style="padding:5px;width:200px;">
|
||||
<span class="OrganIdShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">单据日期:</td>
|
||||
<td style="padding:5px;width:200px;">
|
||||
<span class="OperTimeShow"></span>
|
||||
</td>
|
||||
<td style="width:80px;">单据编号:</td>
|
||||
<td style="padding:5px;width:200px;">
|
||||
<span class="NumberShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;"></td>
|
||||
<td style="padding:5px;width:150px;">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<!-- 商品列表table -->
|
||||
<table class="materialDataShow" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
<td colspan="2" valign="top">
|
||||
<table width="100%" class="retail-amount-show">
|
||||
<tr>
|
||||
<td colspan="2">实付金额</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<b><span class="change-amount-show"></span></b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">付款金额</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<b><span class="get-amount-show"></span></b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">找零</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<b><span class="back-amount-show"></span></b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>付款账户:</td>
|
||||
<td align="left" style="width:110px;">
|
||||
<span class="AccountIdShow"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="8" style="width: 1130px; height:35px;">
|
||||
<span class="RemarkShow"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!--采购入库-->
|
||||
<div class="purchase_in" style="width:1300px;padding:10px 20px;top:20px"
|
||||
closed="true" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width:60px;">供应商:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="OrganIdShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">单据日期:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="OperTimeShow"></span>
|
||||
</td>
|
||||
<td style="width:80px;">单据编号:</td>
|
||||
<td style="padding:5px;width:140px;">
|
||||
<span class="NumberShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">关联订单:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="LinkNumberShow"></span>
|
||||
</td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9" style="width: 1300px;">
|
||||
<!-- 商品列表table -->
|
||||
<table class="materialDataShow" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:60px;">单据备注:</td>
|
||||
<td colspan="8" style="height:35px;">
|
||||
<span class="RemarkShow" style="width: 1070px; height:35px;"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>优惠率:</td>
|
||||
<td>
|
||||
<span class="DiscountShow" style="width: 110px;"></span>
|
||||
%
|
||||
</td>
|
||||
<td>付款优惠:</td>
|
||||
<td>
|
||||
<span class="DiscountMoneyShow" style="width: 120px;"></span>
|
||||
</td>
|
||||
<td>优惠后金额:</td>
|
||||
<td>
|
||||
<span class="DiscountLastMoneyShow" style="width: 120px;"></span>
|
||||
</td>
|
||||
<td>其它费用:</td>
|
||||
<td style="padding:5px">
|
||||
<span class="OtherMoneyShow"></span>
|
||||
</td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>结算账户:</td>
|
||||
<td style="padding:5px">
|
||||
<span class="AccountIdShow"></span>
|
||||
</td>
|
||||
<td>本次付款:</td>
|
||||
<td style="padding:5px">
|
||||
<span class="ChangeAmountShow"></span>
|
||||
</td>
|
||||
<td>本次欠款:</td>
|
||||
<td style="padding:5px">
|
||||
<span class="DebtShow"></span>
|
||||
</td>
|
||||
<td></td>
|
||||
<td style="padding:5px"></td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!--采购退货-->
|
||||
<div class="purchase_back" style="width:1300px;padding:10px 20px;top:20px"
|
||||
closed="true" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width:60px;">供应商:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="OrganIdShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">单据日期:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="OperTimeShow"></span>
|
||||
</td>
|
||||
<td style="width:80px;">单据编号:</td>
|
||||
<td style="padding:5px;width:140px;">
|
||||
<span class="NumberShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;"></td>
|
||||
<td style="padding:5px;width:140px;"></td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9" style="width: 1300px;">
|
||||
<!-- 商品列表table -->
|
||||
<table class="materialDataShow" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:60px;">单据备注:</td>
|
||||
<td colspan="8" style="height:35px;">
|
||||
<span class="RemarkShow" style="width: 1070px; height:35px;"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>优惠率:</td>
|
||||
<td>
|
||||
<span class="DiscountShow" style="width: 110px;"></span>
|
||||
%
|
||||
</td>
|
||||
<td>付款优惠:</td>
|
||||
<td>
|
||||
<span class="DiscountMoneyShow" style="width: 120px;"></span>
|
||||
</td>
|
||||
<td>优惠后金额:</td>
|
||||
<td>
|
||||
<span class="DiscountLastMoneyShow" style="width: 120px;"></span>
|
||||
</td>
|
||||
<td>其它费用:</td>
|
||||
<td style="padding:5px">
|
||||
<span class="OtherMoneyShow"></span>
|
||||
</td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>结算账户:</td>
|
||||
<td style="padding:5px">
|
||||
<span class="AccountIdShow"></span>
|
||||
</td>
|
||||
<td>本次付款:</td>
|
||||
<td style="padding:5px">
|
||||
<span class="ChangeAmountShow"></span>
|
||||
</td>
|
||||
<td>本次欠款:</td>
|
||||
<td style="padding:5px">
|
||||
<span class="DebtShow"></span>
|
||||
</td>
|
||||
<td></td>
|
||||
<td style="padding:5px">
|
||||
</td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!--销售出库-->
|
||||
<div class="sale_out" style="width:1300px;padding:10px 20px;top:20px"
|
||||
closed="true" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width:60px;">客户:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="OrganIdShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">单据日期:</td>
|
||||
<td style="padding:5px;width:140px;">
|
||||
<span class="OperTimeShow"></span>
|
||||
</td>
|
||||
<td style="width:80px;">单据编号:</td>
|
||||
<td style="padding:5px;width:140px;">
|
||||
<span class="NumberShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">关联订单:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="LinkNumberShow"></span>
|
||||
</td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9" style="width: 1300px;">
|
||||
<!-- 商品列表table -->
|
||||
<table class="materialDataShow" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:60px;">单据备注:</td>
|
||||
<td colspan="8" style="height:35px;">
|
||||
<span class="RemarkShow" style="width: 1070px; height:35px;"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>优惠率:</td>
|
||||
<td>
|
||||
<span class="DiscountShow" style="width: 110px;"></span>
|
||||
%
|
||||
</td>
|
||||
<td>收款优惠:</td>
|
||||
<td>
|
||||
<span class="DiscountMoneyShow" style="width: 120px;"></span>
|
||||
</td>
|
||||
<td>优惠后金额:</td>
|
||||
<td>
|
||||
<span class="DiscountLastMoneyShow" style="width: 120px;"></span>
|
||||
</td>
|
||||
<td>其它费用:</td>
|
||||
<td style="padding:5px">
|
||||
<span class="OtherMoneyShow"></span>
|
||||
</td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>结算账户:</td>
|
||||
<td style="padding:5px">
|
||||
<span class="AccountIdShow"></span>
|
||||
</td>
|
||||
<td>本次收款:</td>
|
||||
<td style="padding:5px">
|
||||
<span class="ChangeAmountShow"></span>
|
||||
</td>
|
||||
<td>本次欠款:</td>
|
||||
<td style="padding:5px">
|
||||
<span class="DebtShow"></span>
|
||||
</td>
|
||||
<td>销售人员:</td>
|
||||
<td style="padding:5px">
|
||||
<span class="SalesmanShow"></span>
|
||||
</td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!--销售退货-->
|
||||
<div class="sale_back" style="width:1300px;padding:10px 20px;top:20px"
|
||||
closed="true" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width:60px;">客户:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="OrganIdShow"></span>
|
||||
</td>
|
||||
<td style="width:80px;">单据日期:</td>
|
||||
<td style="padding:5px;width:140px;">
|
||||
<span class="OperTimeShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">单据编号:</td>
|
||||
<td style="padding:5px;width:140px;">
|
||||
<span class="NumberShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;"></td>
|
||||
<td style="padding:5px;width:130px;"></td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9" style="width: 1300px;">
|
||||
<!-- 商品列表table -->
|
||||
<table class="materialDataShow" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:60px;">单据备注:</td>
|
||||
<td colspan="8" style="height:35px;">
|
||||
<span class="RemarkShow" style="width: 1070px; height:35px;"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>优惠率:</td>
|
||||
<td>
|
||||
<span class="DiscountShow" style="width: 110px;"></span>
|
||||
%
|
||||
</td>
|
||||
<td>退款优惠:</td>
|
||||
<td>
|
||||
<span class="DiscountMoneyShow" style="width: 120px;"></span>
|
||||
</td>
|
||||
<td>优惠后金额:</td>
|
||||
<td>
|
||||
<span class="DiscountLastMoneyShow" style="width: 120px;"></span>
|
||||
</td>
|
||||
<td>其它费用:</td>
|
||||
<td style="padding:5px">
|
||||
<span class="OtherMoneyShow"></span>
|
||||
</td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>结算账户:</td>
|
||||
<td style="padding:5px">
|
||||
<span class="AccountIdShow"></span>
|
||||
</td>
|
||||
<td>本次退款:</td>
|
||||
<td style="padding:5px">
|
||||
<span class="ChangeAmountShow"></span>
|
||||
</td>
|
||||
<td>本次欠款:</td>
|
||||
<td style="padding:5px">
|
||||
<span class="DebtShow"></span>
|
||||
</td>
|
||||
<td>销售人员:</td>
|
||||
<td style="padding:5px">
|
||||
<span class="SalesmanShow"></span>
|
||||
</td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!--其它入库-->
|
||||
<div class="other_in" style="width:1300px;padding:10px 20px;top:70px"
|
||||
closed="true" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width:60px;">供应商:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="OrganIdShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">单据日期:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="OperTimeShow"></span>
|
||||
</td>
|
||||
<td style="width:80px;">单据编号:</td>
|
||||
<td style="padding:5px;width:140px;">
|
||||
<span class="NumberShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;"></td>
|
||||
<td style="padding:5px;width:140px;"></td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9" style="width: 1300px;">
|
||||
<!-- 商品列表table -->
|
||||
<table class="materialDataShow" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:60px;">单据备注:</td>
|
||||
<td colspan="8" style="height:35px;">
|
||||
<span class="RemarkShow" style="width: 1070px; height:35px;"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!--其它出库-->
|
||||
<div class="other_out" style="width:1300px;padding:10px 20px;top:70px"
|
||||
closed="true" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width:60px;">客户:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="OrganIdShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">单据日期:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="OperTimeShow"></span>
|
||||
</td>
|
||||
<td style="width:80px;">单据编号:</td>
|
||||
<td style="padding:5px;width:140px;">
|
||||
<span class="NumberShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;"></td>
|
||||
<td style="padding:5px;width:140px;"></td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9" style="width: 1300px;">
|
||||
<!-- 商品列表table -->
|
||||
<table class="materialDataShow" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:60px;">单据备注:</td>
|
||||
<td colspan="8" style="height:35px;">
|
||||
<span class="RemarkShow" style="width: 1070px; height:35px;"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!--调拨出库-->
|
||||
<div class="allocation_out" style="width:1300px;padding:10px 20px;top:70px"
|
||||
closed="true" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width:60px;">单据日期:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="OperTimeShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">单据编号:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="NumberShow"></span>
|
||||
</td>
|
||||
<td style="width:80px;"></td>
|
||||
<td style="padding:5px;width:140px;"></td>
|
||||
<td style="width:70px;"></td>
|
||||
<td style="padding:5px;width:140px;"></td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9" style="width: 1300px;">
|
||||
<!-- 商品列表table -->
|
||||
<table class="materialDataShow" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:60px;">单据备注:</td>
|
||||
<td colspan="8" style="height:35px;">
|
||||
<span class="RemarkShow" style="width: 1070px; height:35px;"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!--盘点复盘-->
|
||||
<div class="stock_check_replay" style="width:1100px;padding:10px 20px;top:70px"
|
||||
closed="true" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width:70px;">单据日期:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="OperTimeShow"></span>
|
||||
</td>
|
||||
<td style="width:80px;">单据编号:</td>
|
||||
<td style="padding:5px;width:140px;">
|
||||
<span class="NumberShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">关联订单:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="LinkNumberShow"></span>
|
||||
</td>
|
||||
<td style="width:60px;"></td>
|
||||
<td style="padding:5px;width:130px;"></td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9" style="width: 1130px;">
|
||||
<!-- 商品列表table -->
|
||||
<table class="materialDataShow" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:60px;">单据备注:</td>
|
||||
<td colspan="8" style="height:35px;">
|
||||
<span class="RemarkShow" style="width: 1070px; height:35px;"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!--收入单-->
|
||||
<div class="item_in" style="width:1300px;padding:10px 20px;top:20px"
|
||||
closed="true" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width:60px;">往来单位:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="OrganIdShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">经手人:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="HandsPersonIdShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">单据日期:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="BillTimeShow"></span>
|
||||
</td>
|
||||
<td style="width:80px;">单据编号:</td>
|
||||
<td style="padding:5px;width:140px;">
|
||||
<span class="BillNoShow"></span>
|
||||
</td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9" style="width: 1300px;">
|
||||
<!-- 单据列表table -->
|
||||
<table class="accountDataShow" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:60px;">单据备注:</td>
|
||||
<td colspan="8" style="height:35px;">
|
||||
<span class="RemarkShow" style="width: 1070px; height:35px;"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>收款账户:</td>
|
||||
<td style="padding:5px;">
|
||||
<span class="AccountIdShow"></span>
|
||||
</td>
|
||||
<td>收款金额:</td>
|
||||
<td style="padding:5px;">
|
||||
<span class="ChangeAmountShow"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!--支出单-->
|
||||
<div class="item_out" style="width:1300px;padding:10px 20px;top:20px"
|
||||
closed="true" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width:60px;">往来单位:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="OrganIdShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">单据日期:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="BillTimeShow"></span>
|
||||
</td>
|
||||
<td style="width:80px;">单据编号:</td>
|
||||
<td style="padding:5px;width:140px;">
|
||||
<span class="BillNoShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;"></td>
|
||||
<td style="width:140px;"></td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9" style="width: 1300px;">
|
||||
<!-- 单据列表table -->
|
||||
<table class="accountDataShow" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:60px;">单据备注:</td>
|
||||
<td colspan="8" style="height:35px;">
|
||||
<span class="RemarkShow" style="width: 1070px; height:35px;"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>付款账户:</td>
|
||||
<td style="padding:5px;">
|
||||
<span class="AccountIdShow"></span>
|
||||
</td>
|
||||
<td>付款金额:</td>
|
||||
<td style="padding:5px;">
|
||||
<span class="ChangeAmountShow"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!--收款单-->
|
||||
<div class="money_in" style="width:1300px;padding:10px 20px;top:20px"
|
||||
closed="true" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width:60px;">付款单位:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="OrganIdShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">经手人:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="HandsPersonIdShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">单据日期:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="BillTimeShow"></span>
|
||||
</td>
|
||||
<td style="width:80px;">单据编号:</td>
|
||||
<td style="padding:5px;width:140px;">
|
||||
<span class="BillNoShow"></span>
|
||||
</td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9" style="width: 1300px;">
|
||||
<!-- 单据列表table -->
|
||||
<table class="accountDataShow" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:60px;">单据备注:</td>
|
||||
<td colspan="8" style="height:35px;">
|
||||
<span class="RemarkShow" style="width: 1070px; height:35px;"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>优惠金额:</td>
|
||||
<td style="padding:5px;width:120px;">
|
||||
<span class="ChangeAmountShow"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!--付款单-->
|
||||
<div class="money_out" style="width:1300px;padding:10px 20px;top:20px"
|
||||
closed="true" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width:60px;">收款单位:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="OrganIdShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">经手人:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="HandsPersonIdShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">单据日期:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="BillTimeShow"></span>
|
||||
</td>
|
||||
<td style="width:80px;">单据编号:</td>
|
||||
<td style="padding:5px;width:140px;">
|
||||
<span class="BillNoShow"></span>
|
||||
</td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9" style="width: 1300px;">
|
||||
<!-- 单据列表table -->
|
||||
<table class="accountDataShow" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:60px;">单据备注:</td>
|
||||
<td colspan="8" style="height:35px;">
|
||||
<span class="RemarkShow" style="width: 1070px; height:35px;"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>优惠金额:</td>
|
||||
<td style="padding:5px;width:120px;">
|
||||
<span class="ChangeAmountShow"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!--转账单-->
|
||||
<div class="giro" style="width:1300px;padding:10px 20px;top:20px"
|
||||
closed="true" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width:60px;">经手人:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="HandsPersonIdShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">单据日期:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="BillTimeShow"></span>
|
||||
</td>
|
||||
<td style="width:80px;">单据编号:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="BillNoShow"></span>
|
||||
</td>
|
||||
<td style="width:50px;"></td>
|
||||
<td style="padding:5px;width:110px;"></td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9" style="width: 1300px;">
|
||||
<!-- 单据列表table -->
|
||||
<table class="accountDataShow" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:60px;">单据备注:</td>
|
||||
<td colspan="8" style="height:35px;">
|
||||
<span class="RemarkShow" style="width: 1070px; height:35px;"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>付款账户:</td>
|
||||
<td style="padding:5px">
|
||||
<span class="AccountIdShow"></span>
|
||||
</td>
|
||||
<td>实付金额:</td>
|
||||
<td style="padding:5px">
|
||||
<span class="ChangeAmountShow"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!--收预付款-->
|
||||
<div class="advance_in" style="width:1300px;padding:10px 20px;top:20px"
|
||||
closed="true" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width:60px;">付款会员:</td>
|
||||
<td style="padding:5px;width:140px;">
|
||||
<span class="OrganIdShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">经手人:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="HandsPersonIdShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">单据日期:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="BillTimeShow"></span>
|
||||
</td>
|
||||
<td style="width:80px;">单据编号:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span class="BillNoShow"></span>
|
||||
</td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9" style="width: 1300px;">
|
||||
<!-- 单据列表table -->
|
||||
<table class="accountDataShow" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:60px;">单据备注:</td>
|
||||
<td colspan="8" style="height:35px;">
|
||||
<span class="RemarkShow" style="width: 1070px; height:35px;"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>优惠金额:</td>
|
||||
<td style="padding:5px;width:120px;">
|
||||
<span class="ChangeAmountShow"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="dlg-buttons-show" style="width:1100px;padding:10px 20px;top:20px">
|
||||
<a href="javascript:void(0)" id="print_bill_detail" class="easyui-linkbutton" iconCls="icon-print">打印</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
866
erp_web/pages/bill/disassemble_list.html
Normal file
866
erp_web/pages/bill/disassemble_list.html
Normal file
@@ -0,0 +1,866 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>拆卸单</title>
|
||||
<meta charset="utf-8">
|
||||
<!-- 指定以IE8的方式来渲染 -->
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
|
||||
<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon"/>
|
||||
<link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="/css/jsherp.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="/js/easyui/themes/default/easyui.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="/js/easyui/themes/icon.css"/>
|
||||
<link type="text/css" rel="stylesheet" href="/css/common.css"/>
|
||||
<link type="text/css" rel="stylesheet" href="/css/in_out.css"/>
|
||||
<script src="/js/jquery-1.8.0.min.js"></script>
|
||||
<script src="/js/easyui/jquery.easyui.min.js"></script>
|
||||
<script src="/js/easyui/locale/easyui-lang-zh_CN.js"></script>
|
||||
<script src="/js/handlebars.js"></script>
|
||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="/js/common/common.js"></script>
|
||||
<script src="/js/pages/bill/add_temp.js"></script>
|
||||
<script src="/js/pages/bill/in_out.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 数据显示table -->
|
||||
<div id="tablePanel" class="easyui-panel" data-options="fit:true" style="padding:1px;top:300px;" title="拆卸单列表" iconCls="icon-list">
|
||||
<div class="box-body form-inline">
|
||||
<div class="form-group">
|
||||
<label class="control-label">单据编号:</label>
|
||||
<div class="control-inline">
|
||||
<input type="text" id="searchNumber" name="searchNumber" value="" maxlength="100" class="easyui-textbox width-90"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">商品信息:</label>
|
||||
<div class="control-inline">
|
||||
<input type="text" id="searchMaterial" name="searchMaterial" placeholder="名称,型号" maxlength="100" class="easyui-textbox width-90"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">单据日期:</label>
|
||||
<div class="control-inline">
|
||||
<input type="text" id="searchBeginTime" name="searchBeginTime" value="" maxlength="100" class="easyui-datebox width-120"/>
|
||||
-
|
||||
<input type="text" id="searchEndTime" name="searchEndTime" value="" maxlength="100" class="easyui-datebox width-120"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" id="searchBtn">查询</a>
|
||||
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-redo" id="searchResetBtn">重置</a>
|
||||
</div>
|
||||
</div>
|
||||
<table id="tableData" style="top:300px;border-bottom-color:#FFFFFF"></table>
|
||||
</div>
|
||||
|
||||
<div id="depotHeadDlg" class="easyui-dialog" style="padding:10px 20px;" fit="true"
|
||||
closed="true" buttons="#dlg-buttons" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<form id="depotHeadFM" method="post" novalidate>
|
||||
<table width="100%" style="min-width:1100px;">
|
||||
<tr>
|
||||
<td style="width:70px;">单据日期</td>
|
||||
<td style="padding:5px;width:170px;">
|
||||
<input type="text" name="OperTime" id="OperTime"
|
||||
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="txt Wdate radius-ui"
|
||||
style="width:155px;" readonly/>
|
||||
</td>
|
||||
<td style="width:70px;">单据编号</td>
|
||||
<td style="padding:5px">
|
||||
<input name="Number" id="Number" class="easyui-validatebox radius-ui"
|
||||
data-options="validType:'length[2,30]'" style="width:150px;" readonly/>
|
||||
</td>
|
||||
<td style="width:80px;"></td>
|
||||
<td style="padding:5px;width:170px;"></td>
|
||||
<td style="width:70px;"></td>
|
||||
<td style="padding:5px"></td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9">
|
||||
<!-- 商品列表table -->
|
||||
<table id="materialData" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9">
|
||||
<textarea name="Remark" id="Remark" rows="2" cols="2" class="radius-ui" placeholder="暂无备注信息"
|
||||
style="width: 100%; height:35px;"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="clientIp" id="clientIp" value="<%=clientIp %>"/>
|
||||
</form>
|
||||
</div>
|
||||
<div id="dlg-buttons">
|
||||
<a href="javascript:void(0)" id="saveDepotHead" class="easyui-linkbutton" iconCls="icon-ok">保存</a>
|
||||
<a href="javascript:void(0)" id="cancelDepotHead" class="easyui-linkbutton" iconCls="icon-cancel"
|
||||
onclick="javascript:$('#depotHeadDlg').dialog('close')">取消</a>
|
||||
</div>
|
||||
<div id="depotHeadDlgShow" class="easyui-dialog" style="padding:10px 20px;" fit="true"
|
||||
closed="true" buttons="#dlg-buttons-show" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<table width="100%" style="min-width:1100px;">
|
||||
<tr>
|
||||
<td style="width:60px;">单据日期:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span id="OperTimeShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">单据编号:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span id="NumberShow"></span>
|
||||
</td>
|
||||
<td style="width:80px;"></td>
|
||||
<td style="padding:5px;width:140px;"></td>
|
||||
<td style="width:70px;"></td>
|
||||
<td style="padding:5px;width:140px;"></td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9" style="width: 1130px;">
|
||||
<!-- 商品列表table -->
|
||||
<table id="materialDataShow" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:60px;">单据备注:</td>
|
||||
<td colspan="8" style="height:35px;">
|
||||
<span id="RemarkShow" style="width: 100%; height:35px;"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="dlg-buttons-show">
|
||||
<a href="javascript:void(0)" id="printDepotHeadShow" class="easyui-linkbutton" iconCls="icon-print">打印</a>
|
||||
<a href="javascript:void(0)" id="cancelDepotHeadShow" class="easyui-linkbutton" iconCls="icon-cancel"
|
||||
onclick="javascript:$('#depotHeadDlgShow').dialog('close')">取消</a>
|
||||
</div>
|
||||
<div id="depot"></div>
|
||||
<script>
|
||||
$(function(){
|
||||
//初始化系统基础信息
|
||||
getType();
|
||||
inOutService.getRoleType();
|
||||
inOutService.initSystemData_UB();
|
||||
inOutService.initSystemData_depot();
|
||||
inOutService.initSystemData_account();
|
||||
inOutService.initSupplier(); //供应商
|
||||
inOutService.initSalesman(); //销售人员
|
||||
inOutService.initOutItemList(); //初始化支出项目
|
||||
inOutService.initMProperty(); //初始化商品属性
|
||||
initTableData();
|
||||
inOutService.ininPager();
|
||||
inOutService.initForm();
|
||||
inOutService.bindEvent();//绑定操作事件
|
||||
});
|
||||
//根据单据名称获取类型
|
||||
function getType() {
|
||||
listTitle = $("#tablePanel").prev().text();
|
||||
//改变宽度和高度
|
||||
$("#searchPanel").panel({width:webW-2});
|
||||
$("#tablePanel").panel({width:webW-2});
|
||||
var supUrl = "/supplier/findBySelect_sup"; //供应商接口
|
||||
listType = "其它";
|
||||
listSubType = "拆卸单";
|
||||
organUrl = supUrl;
|
||||
amountNum = "CXD";
|
||||
}
|
||||
//初始化表格数据
|
||||
function initTableData(){
|
||||
if(pageType === "skip") {
|
||||
addDepotHead(); //自动弹出编辑框,带缓存数据
|
||||
}
|
||||
var tableToolBar = [
|
||||
{
|
||||
id:'addDepotHead',
|
||||
text:'增加',
|
||||
iconCls:'icon-add',
|
||||
handler:function() {
|
||||
addDepotHead();
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'deleteDepotHead',
|
||||
text:'删除',
|
||||
iconCls:'icon-remove',
|
||||
handler:function() {
|
||||
inOutService.batDeleteDepotHead();
|
||||
}
|
||||
}
|
||||
];
|
||||
$('#tableData').datagrid({
|
||||
height:heightInfo,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
pageSize: 10,
|
||||
pageList: initPageNum,
|
||||
columns:[[
|
||||
{ field: 'id',width:35,align:"center",checkbox:true},
|
||||
{ title: '操作',field: 'op',align:"center", width:90,
|
||||
formatter:function(value,rec,index) {
|
||||
var str = '';
|
||||
var orgId = rec.organId? rec.organId:0;
|
||||
str += '<img title="查看" src="/js/easyui/themes/icons/list.png" style="cursor: pointer;" onclick="showDepotHead(\'' + index + '\');"/> ';
|
||||
if(isShowOpFun()){
|
||||
str += '<img title="编辑" src="/js/easyui/themes/icons/pencil.png" style="cursor: pointer;" onclick="editDepotHead(\'' + index + '\');"/> ';
|
||||
str += '<img title="删除" src="/js/easyui/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="inOutService.deleteDepotHead('+ rec.id +',' + orgId +',' + rec.totalPrice+',' + rec.status + ');"/>';
|
||||
}
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{ title: '单据编号',field: 'number',width:155, formatter:function (value,rec) {
|
||||
if(rec.linknumber) {
|
||||
return value + "[转]";
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '商品信息',field: 'materialsList',width:200,formatter:function(value){
|
||||
if(value) {
|
||||
return value.replace(",",",");
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '单据日期',field: 'operTimeStr',width:145},
|
||||
{ title: '操作员',field: 'userName',width:60},
|
||||
{ title: '金额合计',field: 'totalPrice',width:70}
|
||||
]],
|
||||
toolbar:tableToolBar,
|
||||
onLoadError:function() {
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
dgResize();
|
||||
toolbarStatus();
|
||||
}
|
||||
//新增信息
|
||||
function addDepotHead() {
|
||||
if(checkPower()){
|
||||
return;
|
||||
}
|
||||
$('#depotHeadFM').form('clear');
|
||||
var thisDateTime = getNowFormatDateTime(); //当前时间
|
||||
$("#OperTime").val(thisDateTime);
|
||||
inOutService.buildNumber(); //生成单据编号
|
||||
//初始化优惠率、优惠金额、优惠后金额、本次付|收款、本次欠款 为0
|
||||
$("#Discount").val(0);
|
||||
$("#DiscountMoney").val(0);
|
||||
$("#DiscountLastMoney").val(0);
|
||||
$("#ChangeAmount").val(0);
|
||||
$("#Debt").val(0);
|
||||
$("#AccountId").val(defaultAccountId); //初始化默认的账户Id
|
||||
var addTitle = listTitle.replace("列表","信息");
|
||||
$('#depotHeadDlg').show().dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/edit_add.png"/> 增加' + addTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
depotHeadID = 0;
|
||||
var res = sessionStorage.getItem("rowInfo");
|
||||
if(pageType == "skip" && res) { //从订单跳转过来
|
||||
res = JSON.parse(res);
|
||||
$('#OrganId').combobox('setValue', res.organId);
|
||||
$("#LinkNumber").val(res.number); //关联订单号
|
||||
$("#DiscountLastMoney").val(res.totalPrice); //优惠后金额
|
||||
$("#ChangeAmount").val(res.totalPrice).attr("data-changeamount", res.totalPrice);
|
||||
depotHeadID = res.id;
|
||||
initTableData_material("edit",res.totalPrice); //商品列表
|
||||
} else {
|
||||
initTableData_material("add"); //商品列表
|
||||
}
|
||||
inOutService.reject(); //撤销下、刷新商品列表
|
||||
function supplierDlgFun(type) {
|
||||
$('#supplierDlg').dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/edit_add.png"/> 增加' + type + '信息');
|
||||
$('#supplierFM').form('clear');
|
||||
bindSupplierEvent();
|
||||
}
|
||||
$("#addOrgan").off("click").on("click",function(){
|
||||
supplierDlgFun("供应商");
|
||||
});
|
||||
$("#addMember").off("click").on("click",function(){
|
||||
supplierDlgFun("会员");
|
||||
});
|
||||
$("#addCustomer").off("click").on("click",function(){
|
||||
supplierDlgFun("客户");
|
||||
});
|
||||
$("#addAccount").off("click").on("click",function(){
|
||||
$('#accountDlg').dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/edit_add.png"/> 增加结算账户');
|
||||
$('#accountFM').form('clear');
|
||||
bindAccountEvent();
|
||||
});
|
||||
url = '/depotHead/addDepotHeadAndDetail';
|
||||
}
|
||||
//编辑信息
|
||||
function editDepotHead(index) {
|
||||
var res = $("#tableData").datagrid("getRows")[index];
|
||||
if (res.status == "1" || res.status == "2") {
|
||||
$.messager.alert('编辑提示', '已审核和已转的单据不能编辑!', 'warning');
|
||||
return;
|
||||
}
|
||||
var TotalPrice = res.totalPrice; //合计金额
|
||||
$("#Number").val(res.number).attr("data-defaultNumber",res.number);
|
||||
$("#OperTime").val(res.operTimeStr);
|
||||
$("#LinkNumber").val(res.linkNumber); //关联订单号
|
||||
$("#AccountId").val(res.accountId); //账户Id
|
||||
$("#DiscountLastMoney").val(res.discountLastMoney); //优惠后金额
|
||||
$("#ChangeAmount").val(res.changeAmount).attr("data-changeamount", res.changeAmount);
|
||||
$('#OrganId').combobox('setValue', res.organId);
|
||||
$("#Remark").val(res.remark);
|
||||
$("#Discount").val(res.discount?res.discount:0);
|
||||
$("#DiscountMoney").val(res.discountMoney?res.discountMoney:0);
|
||||
var discountlastmoney = res.discountLastMoney?res.discountLastMoney:0;
|
||||
$("#Debt").val(discountlastmoney-res.changeAmount);
|
||||
$("#AccountDay").val(res.accountDay); //结算天数
|
||||
preTotalPrice = res.totalPrice; //记录前一次合计金额,用于扣预付款
|
||||
oldNumber = res.number; //记录编辑前的单据编号
|
||||
oldId = res.id; //记录单据Id
|
||||
var editTitle = listTitle.replace("列表","信息");
|
||||
$('#depotHeadDlg').show().dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/pencil.png"/> 编辑' + editTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
depotHeadID = res.id;
|
||||
//采购入库、销售出库的多账户加载
|
||||
if(res.accountIdList && res.accountMoneyList){
|
||||
$("#AccountId").val("many"); //下拉框选中多账户
|
||||
var accountArr = res.accountIdList.split(",");
|
||||
var accountMoneyArr = res.accountMoneyList.split(",");
|
||||
accountMoneyArr = changeListFmtPlus(accountMoneyArr) //将数组单个金额中的数值转为正数
|
||||
$("#AccountId").attr("data-accountArr", JSON.stringify(accountArr)).attr("data-accountMoneyArr", JSON.stringify(accountMoneyArr)); //json数据存储
|
||||
$(".many-account-ico").show(); //显示多账户的ico图标
|
||||
} else {
|
||||
$(".many-account-ico").hide(); //隐藏多账户的ico图标
|
||||
}
|
||||
|
||||
//采购入库、销售出库的费用数据加载
|
||||
if(res.otherMoneyList && res.otherMoneyItem){
|
||||
$("#OtherMoney").val(res.otherMoney); //其它费用
|
||||
var itemArr = res.otherMoneyList.split(",");
|
||||
var itemMoneyArr = res.otherMoneyItem.split(",");
|
||||
$("#OtherMoney").attr("data-itemArr",JSON.stringify(itemArr)).attr("data-itemMoneyArr",itemMoneyArr); //json数据存储
|
||||
}
|
||||
initTableData_material("edit",TotalPrice); //商品列表
|
||||
inOutService.reject(); //撤销下、刷新商品列表
|
||||
url = '/depotHead/updateDepotHeadAndDetail?id=' + res.id; //更新接口
|
||||
}
|
||||
//查看信息
|
||||
function showDepotHead(index) {
|
||||
var res = $("#tableData").datagrid("getRows")[index];
|
||||
var manyAccountMoney = 0; //多账户合计-零售
|
||||
$("#NumberShow").text(res.number);
|
||||
$("#OperTimeShow").text(res.operTimeStr);
|
||||
$('#OrganIdShow').text(res.organName);
|
||||
if(res.accountName){
|
||||
$("#AccountIdShow").text(res.accountName); //结算账户
|
||||
} else {
|
||||
if (res.accountIdList) {
|
||||
var accountArr = res.accountIdList.split(","); //账户id列表
|
||||
var accountMoneyArr = res.accountMoneyList.split(","); //账户金额列表
|
||||
var accountIdShow = "";
|
||||
for (var j = 0; j < accountArr.length; j++) {
|
||||
if (accountList != null) {
|
||||
for (var i = 0; i < accountList.length; i++) {
|
||||
var account = accountList[i];
|
||||
if (accountArr[j] == account.id) {
|
||||
var currentAccountMoney = accountMoneyArr[j] - 0;
|
||||
if (currentAccountMoney < 0) {
|
||||
currentAccountMoney = 0 - currentAccountMoney;
|
||||
}
|
||||
accountIdShow = accountIdShow + account.name + "(" + currentAccountMoney + "元) ";
|
||||
manyAccountMoney += accountMoneyArr[j] - 0; //多账户合计-零售
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$("#AccountIdShow").text(accountIdShow);
|
||||
}
|
||||
}
|
||||
$("#ChangeAmountShow").text(res.changeAmount);
|
||||
$("#RemarkShow").text(res.remark);
|
||||
$("#DiscountShow").text(res.discount);
|
||||
$("#DiscountMoneyShow").text(res.discountMoney);
|
||||
$("#DiscountLastMoneyShow").text(res.discountLastMoney);
|
||||
var debt = 0;
|
||||
if(res.otherMoney){
|
||||
debt = (res.discountLastMoney+res.otherMoney-res.changeAmount).toFixed(2);
|
||||
} else {
|
||||
debt = (res.discountLastMoney-res.changeAmount).toFixed(2);
|
||||
}
|
||||
$("#DebtShow").text(debt);
|
||||
$("#AccountDayShow").text(res.accountDay); //结算天数
|
||||
$("#LinkNumberShow").text(res.linkNumber); //关联订单号
|
||||
var otherMoney = res.otherMoney?res.otherMoney:0;
|
||||
if(otherMoney!=0 && res.otherMoneyList && res.otherMoneyItem){
|
||||
var itemArr = res.otherMoneyList.split(","); //支出项目id列表
|
||||
var itemMoneyArr = null;
|
||||
if(res.otherMoneyItem!=null) {
|
||||
itemMoneyArr = eval ("(" + res.otherMoneyItem + ")"); //支出项目金额列表
|
||||
}
|
||||
var otherMoneyShow = "";
|
||||
for(var j =0;j<itemArr.length; j++) {
|
||||
if (outItemList != null) {
|
||||
for (var i = 0; i < outItemList.length; i++) {
|
||||
var money = outItemList[i];
|
||||
if(itemArr[j] == money.Id) {
|
||||
for(var k =0;k<itemMoneyArr.length; k++) {
|
||||
if(itemMoneyArr[k].otherId == money.Id) {
|
||||
otherMoneyShow += money.InOutItemName;
|
||||
if(itemMoneyArr[k].otherMoney) {
|
||||
otherMoneyShow +="(" + itemMoneyArr[k].otherMoney +"元)";
|
||||
}
|
||||
otherMoneyShow+=",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$("#OtherMoneyShow").text(otherMoneyShow +"总计:"+ otherMoney + "元 "); //其它费用
|
||||
}
|
||||
else {
|
||||
$("#OtherMoneyShow").text(otherMoney); //其它费用
|
||||
}
|
||||
$("#payTypeShow").text(res.payType);
|
||||
var TotalPrice = res.totalPrice;
|
||||
var showTitle = listTitle.replace("列表","信息");
|
||||
$('#depotHeadDlgShow').show().dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/list.png"/> 查看' + showTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
depotHeadID = res.id;
|
||||
initTableData_material_show(TotalPrice); //商品列表-查看状态
|
||||
}
|
||||
//初始化表格数据-商品列表-编辑状态
|
||||
function initTableData_material(type,TotalPrice) {
|
||||
var self = this;
|
||||
var body,footer,input; //定义表格和文本框
|
||||
var ratioDepot = 1; //比例-仓库用
|
||||
var monthTime = getNowFormatMonth();
|
||||
var isShowAnotherDepot = true; //显示对方仓库,true为隐藏,false为显示
|
||||
var depotHeadName = ""; //仓库名称
|
||||
var depotUrl = ""; //仓库接口地址
|
||||
var depotTextField = ""; //仓库下拉名称
|
||||
var anotherDepotHeadName = ""; //对方仓库的列的标题
|
||||
var anotherDepotUrl = ""; //对方仓库接口地址
|
||||
var anotherDepotTextField = "";
|
||||
if(listSubType == "调拨"){
|
||||
isShowAnotherDepot = false; //调拨时候显示对方仓库
|
||||
anotherDepotHeadName = "调入仓库";
|
||||
anotherDepotUrl = '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid;
|
||||
anotherDepotTextField = "depotName";
|
||||
}
|
||||
depotHeadName = "仓库名称";
|
||||
depotUrl = '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid;
|
||||
depotTextField = "depotName";
|
||||
var isShowTaxColumn = false; //是否显示税率相关的列,true为隐藏,false为显示
|
||||
if(listSubType == "调拨" || listSubType == "其它" || listSubType == "零售" || listSubType == "零售退货" || listSubType == "采购订单" || listSubType == "销售订单" || listSubType == "组装单" || listSubType == "拆卸单"){
|
||||
isShowTaxColumn = true; //隐藏
|
||||
}
|
||||
var isShowMaterialTypeColumn = true; //是否显示商品类型相关的列,true为隐藏,false为显示
|
||||
if(listSubType == "组装单" || listSubType == "拆卸单"){
|
||||
isShowMaterialTypeColumn = false; //显示
|
||||
}
|
||||
$('#materialData').datagrid({
|
||||
height:345,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//单击行是否选中
|
||||
checkOnSelect : false,
|
||||
pagination: false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
//loadFilter: pagerFilter,
|
||||
onClickRow: onClickRow,
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{ title: '商品类型',field: 'MType',editor:'validatebox',hidden:isShowMaterialTypeColumn,width:80},
|
||||
{ title: depotHeadName, field: 'DepotId', editor: 'validatebox', width: 90,
|
||||
formatter: function (value, row, index) {
|
||||
return row.DepotName;
|
||||
},
|
||||
editor: {
|
||||
type: 'combobox',
|
||||
options: {
|
||||
valueField: 'id',
|
||||
textField: depotTextField,
|
||||
method: 'get',
|
||||
url: depotUrl,
|
||||
onSelect:function(rec){
|
||||
var depotId = rec.id;
|
||||
body =$("#depotHeadFM .datagrid-body");
|
||||
footer =$("#depotHeadFM .datagrid-footer");
|
||||
input = ".datagrid-editable-input";
|
||||
var mId = body.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
||||
if(mId){
|
||||
var type = "select"; //type 类型:点击 click,选择 select
|
||||
inOutService.findStockNumById(depotId, mId, monthTime, body, input, ratioDepot, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '条码_名称(规格)(型号)(扩展信息)(单位)',field: 'MaterialExtendId',width:270,
|
||||
formatter:function(value,row,index){
|
||||
return row.MaterialName;
|
||||
},
|
||||
editor:{
|
||||
type:'combogrid',
|
||||
options:{
|
||||
url: "/material/findBySelect",
|
||||
idField:'Id',
|
||||
textField:'MaterialName',
|
||||
method:'get',
|
||||
pagination: true,
|
||||
mode: 'remote',
|
||||
hasDownArrow: false,
|
||||
panelWidth: 630, //下拉框的宽度
|
||||
panelHeight: 380,//下拉框的高度
|
||||
columns:[[
|
||||
{field:'mBarCode',title:'条码',width:120},
|
||||
{field:'name',title:'名称',width:140},
|
||||
{field:'standard',title:'规格',width:80},
|
||||
{field:'model',title:'型号',width:80},
|
||||
{field:'unit',title:'单位',width:60},
|
||||
{field:'stock',title:'库存',width:50},
|
||||
{field:'expand',title:'扩展信息',width:80}
|
||||
]],
|
||||
onBeforeLoad: function(param){
|
||||
var edDepot = $('#materialData').datagrid('getEditor', {index:editIndex,field:'DepotId'});
|
||||
if(edDepot) {
|
||||
param.depotId = $(edDepot.target).combobox('getValue');
|
||||
}
|
||||
param.mpList = mPropertyList; //商品属性
|
||||
},
|
||||
onLoadSuccess: function (rec) {
|
||||
if(rec && rec.total==1) {
|
||||
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
||||
$("#depotHeadFM .datagrid-body").find("[field='OperNumber']").find(".datagrid-editable-input").focus().select();
|
||||
}
|
||||
},
|
||||
onSelect:function(index, rowData){
|
||||
inOutService.materialSelect(rowData,monthTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '库存',field: 'Stock',editor:'validatebox',width:50},
|
||||
{ title: anotherDepotHeadName, field: 'AnotherDepotId',editor:'validatebox',hidden:isShowAnotherDepot,width:90,
|
||||
formatter: function (value, row, index) {
|
||||
return row.AnotherDepotName;
|
||||
},
|
||||
editor: {
|
||||
type: 'combobox',
|
||||
options: {
|
||||
valueField: 'id',
|
||||
textField: anotherDepotTextField,
|
||||
method: 'get',
|
||||
url: anotherDepotUrl
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '单位',field: 'Unit',editor:'validatebox',width:60},
|
||||
{ title: '数量',field: 'OperNumber',editor:'validatebox',width:60},
|
||||
{ title: '单价',field: 'UnitPrice',editor:'validatebox',width:60},
|
||||
{ title: '含税单价',field: 'TaxUnitPrice',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '金额',field: 'AllPrice',editor:'validatebox',width:75},
|
||||
{ title: '税率(%)',field: 'TaxRate',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '税额',field: 'TaxMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '价税合计',field: 'TaxLastMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:100}
|
||||
]],
|
||||
toolbar:[
|
||||
{
|
||||
id:'append',
|
||||
text:'新增行',
|
||||
iconCls:'icon-add',
|
||||
handler:function() {
|
||||
inOutService.append(); //新增行
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'delete',
|
||||
text:'删除行',
|
||||
iconCls:'icon-remove',
|
||||
handler:function() {
|
||||
inOutService.batchDel(); //删除行
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'reject',
|
||||
text:'撤销',
|
||||
iconCls:'icon-undo',
|
||||
handler:function() {
|
||||
inOutService.reject(); //撤销
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'appendDepot',
|
||||
text:'新增仓库',
|
||||
iconCls:'icon-add',
|
||||
handler:function() {
|
||||
inOutService.appendDepot(); //新增仓库
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'appendMaterial',
|
||||
text:'新增商品',
|
||||
iconCls:'icon-add',
|
||||
handler:function() {
|
||||
js.addTabPage(null, "商品信息", "/pages/materials/material.html");
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadError:function() {
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: '/depotItem/getDetailList',
|
||||
data: {
|
||||
headerId: depotHeadID,
|
||||
mpList: mPropertyList
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
var data = res.data;
|
||||
var AllPrice = 0;
|
||||
var TaxLastMoney = 0;
|
||||
var DiscountMoney = $("#DiscountMoney").val()-0; //优惠金额
|
||||
var DiscountLastMoney = $("#DiscountLastMoney").val()-0; //优惠后金额
|
||||
if(type === "edit") {
|
||||
AllPrice = TotalPrice;
|
||||
TaxLastMoney = DiscountMoney + DiscountLastMoney;
|
||||
}
|
||||
var array = [];
|
||||
array.push({
|
||||
"AllPrice": AllPrice,
|
||||
"TaxLastMoney": TaxLastMoney
|
||||
});
|
||||
data.footer = array;
|
||||
$("#materialData").datagrid('loadData',data);
|
||||
if(type === "add") {
|
||||
$("#depotHeadDlg #append").click(); //新增行
|
||||
}
|
||||
}
|
||||
},
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
}
|
||||
});
|
||||
}
|
||||
//初始化表格数据-商品列表-查看状态
|
||||
function initTableData_material_show(TotalPrice) {
|
||||
var self = this;
|
||||
var isShowAnotherDepot = true; //显示对方仓库,true为隐藏,false为显示
|
||||
var anotherDepotHeadName = ""; //对方仓库的列的标题
|
||||
var depotHeadName = ""; //仓库的列的标题
|
||||
if(listSubType == "调拨"){
|
||||
isShowAnotherDepot = false; //调拨时候显示对方仓库
|
||||
anotherDepotHeadName = "调入仓库";
|
||||
}
|
||||
depotHeadName = "仓库名称";
|
||||
var isShowTaxColumn = false; //是否显示税率相关的列,true为隐藏,false为显示
|
||||
if(listSubType == "调拨" || listSubType == "其它" || listSubType == "零售" || listSubType == "零售退货" || listSubType == "采购订单" || listSubType == "销售订单" || listSubType == "组装单" || listSubType == "拆卸单"){
|
||||
isShowTaxColumn = true; //隐藏
|
||||
}
|
||||
var isShowMaterialTypeColumn = true; //是否显示商品类型相关的列,true为隐藏,false为显示
|
||||
if(listSubType == "组装单" || listSubType == "拆卸单"){
|
||||
isShowMaterialTypeColumn = false; //显示
|
||||
}
|
||||
$('#materialDataShow').datagrid({
|
||||
height:345,
|
||||
rownumbers: true,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
pagination: false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
columns:[[
|
||||
{ title: '商品类型',field: 'MType',width:80, hidden:isShowMaterialTypeColumn},
|
||||
{ title: depotHeadName,field: 'DepotName',editor:'validatebox',width:90},
|
||||
{ title: '条码_名称(规格)(型号)(扩展信息)(单位)',field: 'MaterialName',width:270},
|
||||
{ title: '库存',field: 'Stock',width:50},
|
||||
{ title: anotherDepotHeadName,field: 'AnotherDepotName',hidden:isShowAnotherDepot,width:90},
|
||||
{ title: '单位',field: 'Unit',editor:'validatebox',width:60},
|
||||
{ title: '数量',field: 'OperNumber',editor:'validatebox',width:60},
|
||||
{ title: '单价',field: 'UnitPrice',editor:'validatebox',width:60},
|
||||
{ title: '含税单价',field: 'TaxUnitPrice',editor:'validattebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '金额',field: 'AllPrice',editor:'validatebox',width:75},
|
||||
{ title: '税率(%)',field: 'TaxRate',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '税额',field: 'TaxMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '价税合计',field: 'TaxLastMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:100}
|
||||
]],
|
||||
onLoadError:function() {
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: '/depotItem/getDetailList',
|
||||
data: {
|
||||
headerId: depotHeadID,
|
||||
mpList: mPropertyList
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
var data = res.data;
|
||||
var AllPrice = TotalPrice;
|
||||
var DiscountMoney = $("#DiscountMoneyShow").text() - 0; //优惠金额
|
||||
var DiscountLastMoney = $("#DiscountLastMoneyShow").text() - 0; //优惠后金额
|
||||
var array = [];
|
||||
array.push({
|
||||
"AllPrice": AllPrice,
|
||||
"TaxLastMoney": DiscountMoney + DiscountLastMoney
|
||||
});
|
||||
data.footer = array;
|
||||
$("#materialDataShow").datagrid('loadData', data);
|
||||
}
|
||||
},
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
}
|
||||
});
|
||||
}
|
||||
//订单转采购或销售
|
||||
function skipDepotHead(index) {
|
||||
var res = $("#tableData").datagrid("getRows")[index];
|
||||
if(res.status == "0" || res.status == "2") {
|
||||
$.messager.alert('提示','未审核和已转的单据禁止操作!','warning');
|
||||
} else {
|
||||
sessionStorage.setItem("rowInfo", JSON.stringify(res)); //将单据信息存入缓存中
|
||||
if(listTitle == "采购订单列表") {
|
||||
js.addTabPage(null, "订单转采购", "/pages/materials/purchase_in_list.html?t=skip");
|
||||
} else if(listTitle == "销售订单列表") {
|
||||
js.addTabPage(null, "订单转销售", "/pages/materials/sale_out_list.html?t=skip");
|
||||
}
|
||||
}
|
||||
}
|
||||
//保存信息
|
||||
$("#saveDepotHead").off("click").on("click",function(){
|
||||
if(!$('#depotHeadFM').form('validate')){
|
||||
return;
|
||||
}
|
||||
else {
|
||||
//如果初始编号被修改了,就要判断单据编号是否存在
|
||||
if($.trim($("#Number").val()) != $('#Number').attr("data-defaultNumber")){
|
||||
//调用查询单据编号是否重名的方法
|
||||
if(inOutService.checkDepotHeadNumber()){
|
||||
return;
|
||||
}
|
||||
}
|
||||
//进行明细的校验
|
||||
if(depotHeadID ==0) {
|
||||
//新增模式下
|
||||
if (!inOutService.CheckData("add")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//编辑模式下
|
||||
if (!inOutService.CheckData("edit")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
var OrganId = null;
|
||||
var ChangeAmount = $.trim($("#ChangeAmount").val())-0;
|
||||
var TotalPrice = $("#depotHeadFM .datagrid-footer [field='AllPrice'] div").text();
|
||||
if($('#OrganId').length){
|
||||
OrganId = $('#OrganId').combobox('getValue');
|
||||
}
|
||||
var accountMoneyList = $("#AccountId").attr("data-accountmoneyarr"); //账户金额列表-多账户
|
||||
var accountMoneyArr;
|
||||
if(accountMoneyList) {
|
||||
accountMoneyList = accountMoneyList.replace("[","").replace("]","").toString();
|
||||
var reg=new RegExp("\"","g"); //创建正则RegExp对象
|
||||
accountMoneyList = accountMoneyList.replace(reg,""); //替换所有的双引号
|
||||
accountMoneyArr = accountMoneyList.split(","); //转为数组
|
||||
}
|
||||
if(listSubType === "采购订单"||listSubType === "采购"||listSubType === "零售退货"||listSubType === "销售退货"){
|
||||
//付款为负数
|
||||
ChangeAmount = 0 - ChangeAmount;
|
||||
TotalPrice = 0 - TotalPrice;
|
||||
if(accountMoneyArr) {
|
||||
accountMoneyArr = changeListFmtMinus(accountMoneyArr); //将数组单个金额中的数值转为负数
|
||||
}
|
||||
}
|
||||
//零售时候,可以从会员预付款中扣款
|
||||
var thisPayType = "现付";
|
||||
if(listSubType === "零售") {
|
||||
if($("#payType").val() ==="预付款") {
|
||||
thisPayType = "预付款";
|
||||
}
|
||||
}
|
||||
var SalesmanStr = "";
|
||||
if(listSubType === "销售" || listSubType === "销售退货" || listSubType === "销售订单"){
|
||||
var Salesman = $('#Salesman').combobox('getValues').toString(); //销售人员
|
||||
if(Salesman) {
|
||||
var SalesmanArray = Salesman.split(",");
|
||||
for (var i = 0; i < SalesmanArray.length; i++) {
|
||||
if (i === SalesmanArray.length - 1) {
|
||||
SalesmanStr += "<" + SalesmanArray[i] + ">";
|
||||
}
|
||||
else {
|
||||
SalesmanStr += "<" + SalesmanArray[i] + ">,";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var getAccountID = $.trim($("#AccountId").val());
|
||||
if($("#AccountId").val() === "many"){ //多账户
|
||||
getAccountID = null;
|
||||
}
|
||||
var infoStr=JSON.stringify({
|
||||
Type: listType,
|
||||
SubType: listSubType,
|
||||
DefaultNumber: $.trim($("#Number").attr("data-defaultNumber")),//初始编号
|
||||
Number: $.trim($("#Number").val()),
|
||||
LinkNumber: $.trim($("#LinkNumber").val()),
|
||||
OperTime: $("#OperTime").val(),
|
||||
OrganId: OrganId,
|
||||
Salesman: SalesmanStr, //销售人员
|
||||
AccountId: getAccountID,
|
||||
ChangeAmount: ChangeAmount, //付款/收款
|
||||
TotalPrice: TotalPrice, //合计
|
||||
PayType: thisPayType, //现付/预付款
|
||||
Remark: $.trim($("#Remark").val()),
|
||||
AccountIdList: $("#AccountId").attr("data-accountarr"), //账户列表-多账户
|
||||
AccountMoneyList: accountMoneyArr ? JSON.stringify(accountMoneyArr) : "", //账户金额列表-多账户
|
||||
Discount: $.trim($("#Discount").val()),
|
||||
DiscountMoney: $.trim($("#DiscountMoney").val()),
|
||||
DiscountLastMoney: $.trim($("#DiscountLastMoney").val()),
|
||||
OtherMoney: $.trim($("#OtherMoney").val()), //其它费用
|
||||
OtherMoneyList: $("#OtherMoney").attr("data-itemarr"), //支出项目列表-涉及费用
|
||||
OtherMoneyItem: $("#OtherMoney").attr("data-itemmoneyarr"), //支出项目金额列表-涉及费用
|
||||
AccountDay: $("#AccountDay").val() //结算天数
|
||||
});
|
||||
/**
|
||||
* 零售出库,单独操作
|
||||
* */
|
||||
if(url.indexOf("/depotHead/addDepotHeadAndDetail")>=0){
|
||||
inOutService.addDepotHeadAndDetail(url,infoStr);
|
||||
} else if(url.indexOf("/depotHead/updateDepotHeadAndDetail")>=0){
|
||||
inOutService.updateDepotHeadAndDetail(url,infoStr,preTotalPrice);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
883
erp_web/pages/bill/other_in_list.html
Normal file
883
erp_web/pages/bill/other_in_list.html
Normal file
@@ -0,0 +1,883 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>其它入库</title>
|
||||
<meta charset="utf-8">
|
||||
<!-- 指定以IE8的方式来渲染 -->
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
|
||||
<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon"/>
|
||||
<link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="/css/jsherp.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="/js/easyui/themes/default/easyui.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="/js/easyui/themes/icon.css"/>
|
||||
<link type="text/css" rel="stylesheet" href="/css/common.css"/>
|
||||
<link type="text/css" rel="stylesheet" href="/css/in_out.css"/>
|
||||
<script src="/js/jquery-1.8.0.min.js"></script>
|
||||
<script src="/js/easyui/jquery.easyui.min.js"></script>
|
||||
<script src="/js/easyui/locale/easyui-lang-zh_CN.js"></script>
|
||||
<script src="/js/handlebars.js"></script>
|
||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="/js/common/common.js"></script>
|
||||
<script src="/js/common/jsherp.js"></script>
|
||||
<script src="/js/pages/bill/add_temp.js"></script>
|
||||
<script src="/js/pages/bill/in_out.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 数据显示table -->
|
||||
<div id="tablePanel" class="easyui-panel" data-options="fit:true" style="padding:1px; top:300px;" title="其它入库列表" iconCls="icon-list">
|
||||
<div class="box-body form-inline">
|
||||
<div class="form-group">
|
||||
<label class="control-label">单据编号:</label>
|
||||
<div class="control-inline">
|
||||
<input type="text" id="searchNumber" name="searchNumber" value="" maxlength="100" class="easyui-textbox width-90"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">商品信息:</label>
|
||||
<div class="control-inline">
|
||||
<input type="text" id="searchMaterial" name="searchMaterial" placeholder="名称,型号" maxlength="100" class="easyui-textbox width-90"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">单据日期:</label>
|
||||
<div class="control-inline">
|
||||
<input type="text" id="searchBeginTime" name="searchBeginTime" value="" maxlength="100" class="easyui-datebox width-120"/>
|
||||
-
|
||||
<input type="text" id="searchEndTime" name="searchEndTime" value="" maxlength="100" class="easyui-datebox width-120"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" id="searchBtn">查询</a>
|
||||
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-redo" id="searchResetBtn">重置</a>
|
||||
</div>
|
||||
</div>
|
||||
<table id="tableData" style="top:300px;border-bottom-color:#FFFFFF"></table>
|
||||
</div>
|
||||
|
||||
<div id="depotHeadDlg" class="easyui-dialog" style="padding:10px 20px;" fit="true"
|
||||
closed="true" buttons="#dlg-buttons" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<form id="depotHeadFM" method="post" novalidate>
|
||||
<table width="100%" style="min-width:1100px;">
|
||||
<tr>
|
||||
<td style="width:70px;">供应商</td>
|
||||
<td style="padding:5px;width:170px;">
|
||||
<div class="org-list">
|
||||
<input id="OrganId" name="OrganId" style="width:130px;"/>
|
||||
</div>
|
||||
<div class="add-org-btn">
|
||||
<img id="addOrgan" src="/js/easyui/themes/icons/edit_add.png"
|
||||
style="cursor: pointer;" alt="增加供应商" title="增加供应商"/>
|
||||
</div>
|
||||
</td>
|
||||
<td style="width:70px;">单据日期</td>
|
||||
<td style="padding:5px">
|
||||
<input type="text" name="OperTime" id="OperTime"
|
||||
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="txt Wdate radius-ui"
|
||||
style="width:155px;" readonly/>
|
||||
</td>
|
||||
<td style="width:80px;">单据编号</td>
|
||||
<td style="padding:5px">
|
||||
<input name="Number" id="Number" class="easyui-validatebox radius-ui"
|
||||
data-options="validType:'length[2,30]'" style="width: 150px;" readonly/>
|
||||
</td>
|
||||
<td style="width:70px;"></td>
|
||||
<td style="padding:5px">
|
||||
</td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9">
|
||||
<!-- 商品列表table -->
|
||||
<table id="materialData" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9">
|
||||
<textarea name="Remark" id="Remark" rows="2" cols="2" class="radius-ui" placeholder="暂无备注信息"
|
||||
style="width:100%; height:35px;"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<div id="dlg-buttons">
|
||||
<a href="javascript:void(0)" id="saveDepotHead" class="easyui-linkbutton" iconCls="icon-ok">保存</a>
|
||||
<a href="javascript:void(0)" id="cancelDepotHead" class="easyui-linkbutton" iconCls="icon-cancel"
|
||||
onclick="javascript:$('#depotHeadDlg').dialog('close')">取消</a>
|
||||
</div>
|
||||
<div id="depotHeadDlgShow" class="easyui-dialog" style="padding:10px 20px;" fit="true"
|
||||
closed="true" buttons="#dlg-buttons-show" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<table width="100%" style="min-width:1100px;">
|
||||
<tr>
|
||||
<td style="width:60px;">供应商:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span id="OrganIdShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">单据日期:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span id="OperTimeShow"></span>
|
||||
</td>
|
||||
<td style="width:80px;">单据编号:</td>
|
||||
<td style="padding:5px;width:140px;">
|
||||
<span id="NumberShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;"></td>
|
||||
<td style="padding:5px;width:140px;"></td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9" style="width: 1130px;">
|
||||
<!-- 商品列表table -->
|
||||
<table id="materialDataShow" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:60px;">单据备注:</td>
|
||||
<td colspan="8" style="height:35px;">
|
||||
<span id="RemarkShow" style="width: 100%; height:35px;"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="dlg-buttons-show">
|
||||
<a href="javascript:void(0)" id="printDepotHeadShow" class="easyui-linkbutton" iconCls="icon-print">打印</a>
|
||||
<a href="javascript:void(0)" id="cancelDepotHeadShow" class="easyui-linkbutton" iconCls="icon-cancel"
|
||||
onclick="javascript:$('#depotHeadDlgShow').dialog('close')">取消</a>
|
||||
</div>
|
||||
<div id="supplier"></div>
|
||||
<div id="depot"></div>
|
||||
<script>
|
||||
$(function(){
|
||||
//初始化系统基础信息
|
||||
getType();
|
||||
inOutService.getRoleType();
|
||||
inOutService.initSystemData_UB();
|
||||
inOutService.initSystemData_depot();
|
||||
inOutService.initSystemData_account();
|
||||
inOutService.initSupplier(); //供应商
|
||||
inOutService.initSalesman(); //销售人员
|
||||
inOutService.initOutItemList(); //初始化支出项目
|
||||
inOutService.initMProperty(); //初始化商品属性
|
||||
initTableData();
|
||||
inOutService.ininPager();
|
||||
inOutService.initForm();
|
||||
inOutService.bindEvent();//绑定操作事件
|
||||
});
|
||||
//根据单据名称获取类型
|
||||
function getType() {
|
||||
listTitle = $("#tablePanel").prev().text();
|
||||
//改变宽度和高度
|
||||
$("#searchPanel").panel({width:webW-2});
|
||||
$("#tablePanel").panel({width:webW-2});
|
||||
var supUrl = "/supplier/findBySelect_sup"; //供应商接口
|
||||
listType = "入库";
|
||||
listSubType = "其它";
|
||||
organUrl = supUrl;
|
||||
amountNum = "QTRK";
|
||||
}
|
||||
//初始化表格数据
|
||||
function initTableData(){
|
||||
if(pageType === "skip") {
|
||||
addDepotHead(); //自动弹出编辑框,带缓存数据
|
||||
}
|
||||
var tableToolBar = [
|
||||
{
|
||||
id:'addDepotHead',
|
||||
text:'增加',
|
||||
iconCls:'icon-add',
|
||||
handler:function() {
|
||||
addDepotHead();
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'deleteDepotHead',
|
||||
text:'删除',
|
||||
iconCls:'icon-remove',
|
||||
handler:function() {
|
||||
inOutService.batDeleteDepotHead();
|
||||
}
|
||||
}
|
||||
];
|
||||
$('#tableData').datagrid({
|
||||
height:heightInfo,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
pageSize: 10,
|
||||
pageList: initPageNum,
|
||||
columns:[[
|
||||
{ field: 'id',width:35,align:"center",checkbox:true},
|
||||
{ title: '操作',field: 'op',align:"center", width:90,
|
||||
formatter:function(value,rec,index) {
|
||||
var str = '';
|
||||
var orgId = rec.organId? rec.organId:0;
|
||||
str += '<img title="查看" src="/js/easyui/themes/icons/list.png" style="cursor: pointer;" onclick="showDepotHead(\'' + index + '\');"/> ';
|
||||
if(isShowOpFun()){
|
||||
str += '<img title="编辑" src="/js/easyui/themes/icons/pencil.png" style="cursor: pointer;" onclick="editDepotHead(\'' + index + '\');"/> ';
|
||||
str += '<img title="删除" src="/js/easyui/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="inOutService.deleteDepotHead('+ rec.id +',' + orgId +',' + rec.totalPrice+',' + rec.status + ');"/>';
|
||||
}
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{ title: '供应商名称', field: 'organName',width:120},
|
||||
{ title: '单据编号',field: 'number',width:155, formatter:function (value,rec) {
|
||||
if(rec.linknumber) {
|
||||
return value + "[转]";
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '商品信息',field: 'materialsList',width:200,formatter:function(value){
|
||||
if(value) {
|
||||
return value.replace(",",",");
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '单据日期',field: 'operTimeStr',width:145},
|
||||
{ title: '操作员',field: 'userName',width:60},
|
||||
{ title: '金额合计',field: 'totalPrice',width:70}
|
||||
]],
|
||||
toolbar:tableToolBar,
|
||||
onLoadError:function() {
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
dgResize();
|
||||
toolbarStatus();
|
||||
}
|
||||
//新增信息
|
||||
function addDepotHead() {
|
||||
if(checkPower()){
|
||||
return;
|
||||
}
|
||||
$('#depotHeadFM').form('clear');
|
||||
var thisDateTime = getNowFormatDateTime(); //当前时间
|
||||
$("#OperTime").val(thisDateTime);
|
||||
inOutService.buildNumber(); //生成单据编号
|
||||
//初始化优惠率、优惠金额、优惠后金额、本次付|收款、本次欠款 为0
|
||||
$("#Discount").val(0);
|
||||
$("#DiscountMoney").val(0);
|
||||
$("#DiscountLastMoney").val(0);
|
||||
$("#ChangeAmount").val(0);
|
||||
$("#Debt").val(0);
|
||||
$("#AccountId").val(defaultAccountId); //初始化默认的账户Id
|
||||
var addTitle = listTitle.replace("列表","信息");
|
||||
$('#depotHeadDlg').show().dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/edit_add.png"/> 增加' + addTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
depotHeadID = 0;
|
||||
var res = sessionStorage.getItem("rowInfo");
|
||||
if(pageType == "skip" && res) { //从订单跳转过来
|
||||
res = JSON.parse(res);
|
||||
$('#OrganId').combobox('setValue', res.organId);
|
||||
$("#LinkNumber").val(res.number); //关联订单号
|
||||
$("#DiscountLastMoney").val(res.totalPrice); //优惠后金额
|
||||
$("#ChangeAmount").val(res.totalPrice).attr("data-changeamount", res.totalPrice);
|
||||
depotHeadID = res.id;
|
||||
initTableData_material("edit",res.totalPrice); //商品列表
|
||||
} else {
|
||||
initTableData_material("add"); //商品列表
|
||||
}
|
||||
inOutService.reject(); //撤销下、刷新商品列表
|
||||
function supplierDlgFun(type) {
|
||||
$('#supplierDlg').dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/edit_add.png"/> 增加' + type + '信息');
|
||||
$('#supplierFM').form('clear');
|
||||
bindSupplierEvent();
|
||||
}
|
||||
$("#addOrgan").off("click").on("click",function(){
|
||||
supplierDlgFun("供应商");
|
||||
});
|
||||
$("#addMember").off("click").on("click",function(){
|
||||
supplierDlgFun("会员");
|
||||
});
|
||||
$("#addCustomer").off("click").on("click",function(){
|
||||
supplierDlgFun("客户");
|
||||
});
|
||||
$("#addAccount").off("click").on("click",function(){
|
||||
$('#accountDlg').dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/edit_add.png"/> 增加结算账户');
|
||||
$('#accountFM').form('clear');
|
||||
bindAccountEvent();
|
||||
});
|
||||
url = '/depotHead/addDepotHeadAndDetail';
|
||||
}
|
||||
//编辑信息
|
||||
function editDepotHead(index) {
|
||||
var res = $("#tableData").datagrid("getRows")[index];
|
||||
if (res.status == "1" || res.status == "2") {
|
||||
$.messager.alert('编辑提示', '已审核和已转的单据不能编辑!', 'warning');
|
||||
return;
|
||||
}
|
||||
var TotalPrice = res.totalPrice; //合计金额
|
||||
$("#Number").val(res.number).attr("data-defaultNumber",res.number);
|
||||
$("#OperTime").val(res.operTimeStr);
|
||||
$("#LinkNumber").val(res.linkNumber); //关联订单号
|
||||
$("#AccountId").val(res.accountId); //账户Id
|
||||
$("#DiscountLastMoney").val(res.discountLastMoney); //优惠后金额
|
||||
$("#ChangeAmount").val(res.changeAmount).attr("data-changeamount", res.changeAmount);
|
||||
$('#OrganId').combobox('setValue', res.organId);
|
||||
$("#Remark").val(res.remark);
|
||||
$("#Discount").val(res.discount?res.discount:0);
|
||||
$("#DiscountMoney").val(res.discountMoney?res.discountMoney:0);
|
||||
var discountlastmoney = res.discountLastMoney?res.discountLastMoney:0;
|
||||
$("#Debt").val(discountlastmoney-res.changeAmount);
|
||||
$("#AccountDay").val(res.accountDay); //结算天数
|
||||
preTotalPrice = res.totalPrice; //记录前一次合计金额,用于扣预付款
|
||||
oldNumber = res.number; //记录编辑前的单据编号
|
||||
oldId = res.id; //记录单据Id
|
||||
var editTitle = listTitle.replace("列表","信息");
|
||||
$('#depotHeadDlg').show().dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/pencil.png"/> 编辑' + editTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
depotHeadID = res.id;
|
||||
//采购入库、销售出库的多账户加载
|
||||
if(res.accountIdList && res.accountMoneyList){
|
||||
$("#AccountId").val("many"); //下拉框选中多账户
|
||||
var accountArr = res.accountIdList.split(",");
|
||||
var accountMoneyArr = res.accountMoneyList.split(",");
|
||||
accountMoneyArr = changeListFmtPlus(accountMoneyArr) //将数组单个金额中的数值转为正数
|
||||
$("#AccountId").attr("data-accountArr", JSON.stringify(accountArr)).attr("data-accountMoneyArr", JSON.stringify(accountMoneyArr)); //json数据存储
|
||||
$(".many-account-ico").show(); //显示多账户的ico图标
|
||||
} else {
|
||||
$(".many-account-ico").hide(); //隐藏多账户的ico图标
|
||||
}
|
||||
//采购入库、销售出库的费用数据加载
|
||||
if(res.otherMoneyList && res.otherMoneyItem){
|
||||
$("#OtherMoney").val(res.otherMoney); //其它费用
|
||||
var itemArr = res.otherMoneyList.split(",");
|
||||
var itemMoneyArr = res.otherMoneyItem.split(",");
|
||||
$("#OtherMoney").attr("data-itemArr",JSON.stringify(itemArr)).attr("data-itemMoneyArr",itemMoneyArr); //json数据存储
|
||||
}
|
||||
initTableData_material("edit",TotalPrice); //商品列表
|
||||
inOutService.reject(); //撤销下、刷新商品列表
|
||||
url = '/depotHead/updateDepotHeadAndDetail?id=' + res.id; //更新接口
|
||||
}
|
||||
//查看信息
|
||||
function showDepotHead(index) {
|
||||
var res = $("#tableData").datagrid("getRows")[index];
|
||||
var manyAccountMoney = 0; //多账户合计-零售
|
||||
$("#NumberShow").text(res.number);
|
||||
$("#OperTimeShow").text(res.operTimeStr);
|
||||
$('#OrganIdShow').text(res.organName);
|
||||
if(res.accountName){
|
||||
$("#AccountIdShow").text(res.accountName); //结算账户
|
||||
} else {
|
||||
if (res.accountIdList) {
|
||||
var accountArr = res.accountIdList.split(","); //账户id列表
|
||||
var accountMoneyArr = res.accountMoneyList.split(","); //账户金额列表
|
||||
var accountIdShow = "";
|
||||
for (var j = 0; j < accountArr.length; j++) {
|
||||
if (accountList != null) {
|
||||
for (var i = 0; i < accountList.length; i++) {
|
||||
var account = accountList[i];
|
||||
if (accountArr[j] == account.id) {
|
||||
var currentAccountMoney = accountMoneyArr[j] - 0;
|
||||
if (currentAccountMoney < 0) {
|
||||
currentAccountMoney = 0 - currentAccountMoney;
|
||||
}
|
||||
accountIdShow = accountIdShow + account.name + "(" + currentAccountMoney + "元) ";
|
||||
manyAccountMoney += accountMoneyArr[j] - 0; //多账户合计-零售
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$("#AccountIdShow").text(accountIdShow);
|
||||
}
|
||||
}
|
||||
$("#ChangeAmountShow").text(res.changeAmount);
|
||||
$("#RemarkShow").text(res.remark);
|
||||
$("#DiscountShow").text(res.discount);
|
||||
$("#DiscountMoneyShow").text(res.discountMoney);
|
||||
$("#DiscountLastMoneyShow").text(res.discountLastMoney);
|
||||
var debt = 0;
|
||||
if(res.otherMoney){
|
||||
debt = (res.discountLastMoney+res.otherMoney-res.changeAmount).toFixed(2);
|
||||
} else {
|
||||
debt = (res.discountLastMoney-res.changeAmount).toFixed(2);
|
||||
}
|
||||
$("#DebtShow").text(debt);
|
||||
$("#AccountDayShow").text(res.accountDay); //结算天数
|
||||
$("#LinkNumberShow").text(res.linkNumber); //关联订单号
|
||||
var otherMoney = res.otherMoney?res.otherMoney:0;
|
||||
if(otherMoney!=0 && res.otherMoneyList && res.otherMoneyItem){
|
||||
var itemArr = res.otherMoneyList.split(","); //支出项目id列表
|
||||
var itemMoneyArr = null;
|
||||
if(res.otherMoneyItem!=null) {
|
||||
itemMoneyArr = eval ("(" + res.otherMoneyItem + ")"); //支出项目金额列表
|
||||
}
|
||||
var otherMoneyShow = "";
|
||||
for(var j =0;j<itemArr.length; j++) {
|
||||
if (outItemList != null) {
|
||||
for (var i = 0; i < outItemList.length; i++) {
|
||||
var money = outItemList[i];
|
||||
if(itemArr[j] == money.Id) {
|
||||
for(var k =0;k<itemMoneyArr.length; k++) {
|
||||
if(itemMoneyArr[k].otherId == money.Id) {
|
||||
otherMoneyShow += money.InOutItemName;
|
||||
if(itemMoneyArr[k].otherMoney) {
|
||||
otherMoneyShow +="(" + itemMoneyArr[k].otherMoney +"元)";
|
||||
}
|
||||
otherMoneyShow+=",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$("#OtherMoneyShow").text(otherMoneyShow +"总计:"+ otherMoney + "元 "); //其它费用
|
||||
}
|
||||
else {
|
||||
$("#OtherMoneyShow").text(otherMoney); //其它费用
|
||||
}
|
||||
$("#payTypeShow").text(res.payType);
|
||||
var TotalPrice = res.totalPrice;
|
||||
var showTitle = listTitle.replace("列表","信息");
|
||||
$('#depotHeadDlgShow').show().dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/list.png"/> 查看' + showTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
depotHeadID = res.id;
|
||||
initTableData_material_show(TotalPrice); //商品列表-查看状态
|
||||
}
|
||||
//初始化表格数据-商品列表-编辑状态
|
||||
function initTableData_material(type,TotalPrice) {
|
||||
var self = this;
|
||||
var body,footer,input; //定义表格和文本框
|
||||
var ratioDepot = 1; //比例-仓库用
|
||||
var monthTime = getNowFormatMonth();
|
||||
var isShowAnotherDepot = true; //显示对方仓库,true为隐藏,false为显示
|
||||
var depotHeadName = ""; //仓库名称
|
||||
var depotUrl = ""; //仓库接口地址
|
||||
var depotTextField = ""; //仓库下拉名称
|
||||
var anotherDepotHeadName = ""; //对方仓库的列的标题
|
||||
var anotherDepotUrl = ""; //对方仓库接口地址
|
||||
var anotherDepotTextField = "";
|
||||
if(listSubType == "调拨"){
|
||||
isShowAnotherDepot = false; //调拨时候显示对方仓库
|
||||
anotherDepotHeadName = "调入仓库";
|
||||
anotherDepotUrl = '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid;
|
||||
anotherDepotTextField = "depotName";
|
||||
}
|
||||
depotHeadName = "仓库名称";
|
||||
depotUrl = '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid;
|
||||
depotTextField = "depotName";
|
||||
var isShowTaxColumn = false; //是否显示税率相关的列,true为隐藏,false为显示
|
||||
if(listSubType == "调拨" || listSubType == "其它" || listSubType == "零售" || listSubType == "零售退货" || listSubType == "采购订单" || listSubType == "销售订单" || listSubType == "组装单" || listSubType == "拆卸单"){
|
||||
isShowTaxColumn = true; //隐藏
|
||||
}
|
||||
var isShowMaterialTypeColumn = true; //是否显示商品类型相关的列,true为隐藏,false为显示
|
||||
if(listSubType == "组装单" || listSubType == "拆卸单"){
|
||||
isShowMaterialTypeColumn = false; //显示
|
||||
}
|
||||
$('#materialData').datagrid({
|
||||
height:345,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//单击行是否选中
|
||||
checkOnSelect : false,
|
||||
pagination: false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
//loadFilter: pagerFilter,
|
||||
onClickRow: onClickRow,
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{ title: '商品类型',field: 'MType',editor:'validatebox',hidden:isShowMaterialTypeColumn,width:80},
|
||||
{ title: depotHeadName, field: 'DepotId', editor: 'validatebox', width: 90,
|
||||
formatter: function (value, row, index) {
|
||||
return row.DepotName;
|
||||
},
|
||||
editor: {
|
||||
type: 'combobox',
|
||||
options: {
|
||||
valueField: 'id',
|
||||
textField: depotTextField,
|
||||
method: 'get',
|
||||
url: depotUrl,
|
||||
onSelect:function(rec){
|
||||
var depotId = rec.id;
|
||||
body =$("#depotHeadFM .datagrid-body");
|
||||
footer =$("#depotHeadFM .datagrid-footer");
|
||||
input = ".datagrid-editable-input";
|
||||
var mId = body.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
||||
if(mId){
|
||||
var type = "select"; //type 类型:点击 click,选择 select
|
||||
inOutService.findStockNumById(depotId, mId, monthTime, body, input, ratioDepot, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '条码_名称(规格)(型号)(扩展信息)(单位)',field: 'MaterialExtendId',width:270,
|
||||
formatter:function(value,row,index){
|
||||
return row.MaterialName;
|
||||
},
|
||||
editor:{
|
||||
type:'combogrid',
|
||||
options:{
|
||||
url: "/material/findBySelect",
|
||||
idField:'Id',
|
||||
textField:'MaterialName',
|
||||
method:'get',
|
||||
pagination: true,
|
||||
mode: 'remote',
|
||||
hasDownArrow: false,
|
||||
panelWidth: 630, //下拉框的宽度
|
||||
panelHeight: 380,//下拉框的高度
|
||||
columns:[[
|
||||
{field:'mBarCode',title:'条码',width:120},
|
||||
{field:'name',title:'名称',width:140},
|
||||
{field:'standard',title:'规格',width:80},
|
||||
{field:'model',title:'型号',width:80},
|
||||
{field:'unit',title:'单位',width:60},
|
||||
{field:'stock',title:'库存',width:50},
|
||||
{field:'expand',title:'扩展信息',width:80}
|
||||
]],
|
||||
onBeforeLoad: function(param){
|
||||
var edDepot = $('#materialData').datagrid('getEditor', {index:editIndex,field:'DepotId'});
|
||||
if(edDepot) {
|
||||
param.depotId = $(edDepot.target).combobox('getValue');
|
||||
}
|
||||
param.mpList = mPropertyList; //商品属性
|
||||
},
|
||||
onLoadSuccess: function (rec) {
|
||||
if(rec && rec.total==1) {
|
||||
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
||||
$("#depotHeadFM .datagrid-body").find("[field='OperNumber']").find(".datagrid-editable-input").focus().select();
|
||||
}
|
||||
},
|
||||
onSelect:function(index, rowData){
|
||||
inOutService.materialSelect(rowData,monthTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '库存',field: 'Stock',editor:'validatebox',width:50},
|
||||
{ title: anotherDepotHeadName, field: 'AnotherDepotId',editor:'validatebox',hidden:isShowAnotherDepot,width:90,
|
||||
formatter: function (value, row, index) {
|
||||
return row.AnotherDepotName;
|
||||
},
|
||||
editor: {
|
||||
type: 'combobox',
|
||||
options: {
|
||||
valueField: 'id',
|
||||
textField: anotherDepotTextField,
|
||||
method: 'get',
|
||||
url: anotherDepotUrl
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '单位',field: 'Unit',editor:'validatebox',width:60},
|
||||
{ title: '数量',field: 'OperNumber',editor:'validatebox',width:60},
|
||||
{ title: '单价',field: 'UnitPrice',editor:'validatebox',width:60},
|
||||
{ title: '含税单价',field: 'TaxUnitPrice',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '金额',field: 'AllPrice',editor:'validatebox',width:75},
|
||||
{ title: '税率(%)',field: 'TaxRate',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '税额',field: 'TaxMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '价税合计',field: 'TaxLastMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:100}
|
||||
]],
|
||||
toolbar:[
|
||||
{
|
||||
id:'append',
|
||||
text:'新增行',
|
||||
iconCls:'icon-add',
|
||||
handler:function() {
|
||||
inOutService.append(); //新增行
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'delete',
|
||||
text:'删除行',
|
||||
iconCls:'icon-remove',
|
||||
handler:function() {
|
||||
inOutService.batchDel(); //删除行
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'reject',
|
||||
text:'撤销',
|
||||
iconCls:'icon-undo',
|
||||
handler:function() {
|
||||
inOutService.reject(); //撤销
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'appendDepot',
|
||||
text:'新增仓库',
|
||||
iconCls:'icon-add',
|
||||
handler:function() {
|
||||
inOutService.appendDepot(); //新增仓库
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'appendMaterial',
|
||||
text:'新增商品',
|
||||
iconCls:'icon-add',
|
||||
handler:function() {
|
||||
js.addTabPage(null, "商品信息", "/pages/materials/material.html");
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadError:function() {
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: '/depotItem/getDetailList',
|
||||
data: {
|
||||
headerId: depotHeadID,
|
||||
mpList: mPropertyList
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
var data = res.data;
|
||||
var AllPrice = 0;
|
||||
var TaxLastMoney = 0;
|
||||
var DiscountMoney = $("#DiscountMoney").val()-0; //优惠金额
|
||||
var DiscountLastMoney = $("#DiscountLastMoney").val()-0; //优惠后金额
|
||||
if(type === "edit") {
|
||||
AllPrice = TotalPrice;
|
||||
TaxLastMoney = DiscountMoney + DiscountLastMoney;
|
||||
}
|
||||
var array = [];
|
||||
array.push({
|
||||
"AllPrice": AllPrice,
|
||||
"TaxLastMoney": TaxLastMoney
|
||||
});
|
||||
data.footer = array;
|
||||
$("#materialData").datagrid('loadData',data);
|
||||
if(type === "add") {
|
||||
$("#depotHeadDlg #append").click(); //新增行
|
||||
}
|
||||
}
|
||||
},
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
}
|
||||
});
|
||||
}
|
||||
//初始化表格数据-商品列表-查看状态
|
||||
function initTableData_material_show(TotalPrice) {
|
||||
var self = this;
|
||||
var isShowAnotherDepot = true; //显示对方仓库,true为隐藏,false为显示
|
||||
var anotherDepotHeadName = ""; //对方仓库的列的标题
|
||||
var depotHeadName = ""; //仓库的列的标题
|
||||
if(listSubType == "调拨"){
|
||||
isShowAnotherDepot = false; //调拨时候显示对方仓库
|
||||
anotherDepotHeadName = "调入仓库";
|
||||
}
|
||||
depotHeadName = "仓库名称";
|
||||
var isShowTaxColumn = false; //是否显示税率相关的列,true为隐藏,false为显示
|
||||
if(listSubType == "调拨" || listSubType == "其它" || listSubType == "零售" || listSubType == "零售退货" || listSubType == "采购订单" || listSubType == "销售订单" || listSubType == "组装单" || listSubType == "拆卸单"){
|
||||
isShowTaxColumn = true; //隐藏
|
||||
}
|
||||
var isShowMaterialTypeColumn = true; //是否显示商品类型相关的列,true为隐藏,false为显示
|
||||
if(listSubType == "组装单" || listSubType == "拆卸单"){
|
||||
isShowMaterialTypeColumn = false; //显示
|
||||
}
|
||||
$('#materialDataShow').datagrid({
|
||||
height:345,
|
||||
rownumbers: true,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
pagination: false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
columns:[[
|
||||
{ title: '商品类型',field: 'MType',width:80, hidden:isShowMaterialTypeColumn},
|
||||
{ title: depotHeadName,field: 'DepotName',editor:'validatebox',width:90},
|
||||
{ title: '条码_名称(规格)(型号)(扩展信息)(单位)',field: 'MaterialName',width:270},
|
||||
{ title: '库存',field: 'Stock',width:50},
|
||||
{ title: anotherDepotHeadName,field: 'AnotherDepotName',hidden:isShowAnotherDepot,width:90},
|
||||
{ title: '单位',field: 'Unit',editor:'validatebox',width:60},
|
||||
{ title: '数量',field: 'OperNumber',editor:'validatebox',width:60},
|
||||
{ title: '单价',field: 'UnitPrice',editor:'validatebox',width:60},
|
||||
{ title: '含税单价',field: 'TaxUnitPrice',editor:'validattebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '金额',field: 'AllPrice',editor:'validatebox',width:75},
|
||||
{ title: '税率(%)',field: 'TaxRate',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '税额',field: 'TaxMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '价税合计',field: 'TaxLastMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:100}
|
||||
]],
|
||||
onLoadError:function() {
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: '/depotItem/getDetailList',
|
||||
data: {
|
||||
headerId: depotHeadID,
|
||||
mpList: mPropertyList
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
var data = res.data;
|
||||
var AllPrice = TotalPrice;
|
||||
var DiscountMoney = $("#DiscountMoneyShow").text() - 0; //优惠金额
|
||||
var DiscountLastMoney = $("#DiscountLastMoneyShow").text() - 0; //优惠后金额
|
||||
var array = [];
|
||||
array.push({
|
||||
"AllPrice": AllPrice,
|
||||
"TaxLastMoney": DiscountMoney + DiscountLastMoney
|
||||
});
|
||||
data.footer = array;
|
||||
$("#materialDataShow").datagrid('loadData', data);
|
||||
}
|
||||
},
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
}
|
||||
});
|
||||
}
|
||||
//订单转采购或销售
|
||||
function skipDepotHead(index) {
|
||||
var res = $("#tableData").datagrid("getRows")[index];
|
||||
if(res.status == "0" || res.status == "2") {
|
||||
$.messager.alert('提示','未审核和已转的单据禁止操作!','warning');
|
||||
} else {
|
||||
sessionStorage.setItem("rowInfo", JSON.stringify(res)); //将单据信息存入缓存中
|
||||
if(listTitle == "采购订单列表") {
|
||||
js.addTabPage(null, "订单转采购", "/pages/materials/purchase_in_list.html?t=skip");
|
||||
} else if(listTitle == "销售订单列表") {
|
||||
js.addTabPage(null, "订单转销售", "/pages/materials/sale_out_list.html?t=skip");
|
||||
}
|
||||
}
|
||||
}
|
||||
//保存信息
|
||||
$("#saveDepotHead").off("click").on("click",function(){
|
||||
if(!$('#depotHeadFM').form('validate')){
|
||||
return;
|
||||
}
|
||||
else {
|
||||
//如果初始编号被修改了,就要判断单据编号是否存在
|
||||
if($.trim($("#Number").val()) != $('#Number').attr("data-defaultNumber")){
|
||||
//调用查询单据编号是否重名的方法
|
||||
if(inOutService.checkDepotHeadNumber()){
|
||||
return;
|
||||
}
|
||||
}
|
||||
//输入框提示
|
||||
if(!$('#OrganId').combobox('getValue')){
|
||||
$.messager.alert('提示','请选择往来单位!','warning');
|
||||
return;
|
||||
}
|
||||
//进行明细的校验
|
||||
if(depotHeadID ==0) {
|
||||
//新增模式下
|
||||
if (!inOutService.CheckData("add")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//编辑模式下
|
||||
if (!inOutService.CheckData("edit")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
var OrganId = null;
|
||||
var ChangeAmount = $.trim($("#ChangeAmount").val())-0;
|
||||
var TotalPrice = $("#depotHeadFM .datagrid-footer [field='AllPrice'] div").text();
|
||||
if($('#OrganId').length){
|
||||
OrganId = $('#OrganId').combobox('getValue');
|
||||
}
|
||||
var accountMoneyList = $("#AccountId").attr("data-accountmoneyarr"); //账户金额列表-多账户
|
||||
var accountMoneyArr;
|
||||
if(accountMoneyList) {
|
||||
accountMoneyList = accountMoneyList.replace("[","").replace("]","").toString();
|
||||
var reg=new RegExp("\"","g"); //创建正则RegExp对象
|
||||
accountMoneyList = accountMoneyList.replace(reg,""); //替换所有的双引号
|
||||
accountMoneyArr = accountMoneyList.split(","); //转为数组
|
||||
}
|
||||
if(listSubType === "采购订单"||listSubType === "采购"||listSubType === "零售退货"||listSubType === "销售退货"){
|
||||
//付款为负数
|
||||
ChangeAmount = 0 - ChangeAmount;
|
||||
TotalPrice = 0 - TotalPrice;
|
||||
if(accountMoneyArr) {
|
||||
accountMoneyArr = changeListFmtMinus(accountMoneyArr); //将数组单个金额中的数值转为负数
|
||||
}
|
||||
}
|
||||
//零售时候,可以从会员预付款中扣款
|
||||
var thisPayType = "现付";
|
||||
if(listSubType === "零售") {
|
||||
if($("#payType").val() ==="预付款") {
|
||||
thisPayType = "预付款";
|
||||
}
|
||||
}
|
||||
var SalesmanStr = "";
|
||||
if(listSubType === "销售" || listSubType === "销售退货" || listSubType === "销售订单"){
|
||||
var Salesman = $('#Salesman').combobox('getValues').toString(); //销售人员
|
||||
if(Salesman) {
|
||||
var SalesmanArray = Salesman.split(",");
|
||||
for (var i = 0; i < SalesmanArray.length; i++) {
|
||||
if (i === SalesmanArray.length - 1) {
|
||||
SalesmanStr += "<" + SalesmanArray[i] + ">";
|
||||
}
|
||||
else {
|
||||
SalesmanStr += "<" + SalesmanArray[i] + ">,";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var getAccountID = $.trim($("#AccountId").val());
|
||||
if($("#AccountId").val() === "many"){ //多账户
|
||||
getAccountID = null;
|
||||
}
|
||||
var infoStr=JSON.stringify({
|
||||
Type: listType,
|
||||
SubType: listSubType,
|
||||
DefaultNumber: $.trim($("#Number").attr("data-defaultNumber")),//初始编号
|
||||
Number: $.trim($("#Number").val()),
|
||||
LinkNumber: $.trim($("#LinkNumber").val()),
|
||||
OperTime: $("#OperTime").val(),
|
||||
OrganId: OrganId,
|
||||
Salesman: SalesmanStr, //销售人员
|
||||
AccountId: getAccountID,
|
||||
ChangeAmount: ChangeAmount, //付款/收款
|
||||
TotalPrice: TotalPrice, //合计
|
||||
PayType: thisPayType, //现付/预付款
|
||||
Remark: $.trim($("#Remark").val()),
|
||||
AccountIdList: $("#AccountId").attr("data-accountarr"), //账户列表-多账户
|
||||
AccountMoneyList: accountMoneyArr ? JSON.stringify(accountMoneyArr) : "", //账户金额列表-多账户
|
||||
Discount: $.trim($("#Discount").val()),
|
||||
DiscountMoney: $.trim($("#DiscountMoney").val()),
|
||||
DiscountLastMoney: $.trim($("#DiscountLastMoney").val()),
|
||||
OtherMoney: $.trim($("#OtherMoney").val()), //其它费用
|
||||
OtherMoneyList: $("#OtherMoney").attr("data-itemarr"), //支出项目列表-涉及费用
|
||||
OtherMoneyItem: $("#OtherMoney").attr("data-itemmoneyarr"), //支出项目金额列表-涉及费用
|
||||
AccountDay: $("#AccountDay").val() //结算天数
|
||||
});
|
||||
/**
|
||||
* 零售出库,单独操作
|
||||
* */
|
||||
if(url.indexOf("/depotHead/addDepotHeadAndDetail")>=0){
|
||||
inOutService.addDepotHeadAndDetail(url,infoStr);
|
||||
} else if(url.indexOf("/depotHead/updateDepotHeadAndDetail")>=0){
|
||||
inOutService.updateDepotHeadAndDetail(url,infoStr,preTotalPrice);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
876
erp_web/pages/bill/other_out_list.html
Normal file
876
erp_web/pages/bill/other_out_list.html
Normal file
@@ -0,0 +1,876 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>其它出库</title>
|
||||
<meta charset="utf-8">
|
||||
<!-- 指定以IE8的方式来渲染 -->
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
|
||||
<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon"/>
|
||||
<link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="/css/jsherp.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="/js/easyui/themes/default/easyui.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="/js/easyui/themes/icon.css"/>
|
||||
<link type="text/css" rel="stylesheet" href="/css/common.css"/>
|
||||
<link type="text/css" rel="stylesheet" href="/css/in_out.css"/>
|
||||
<script src="/js/jquery-1.8.0.min.js"></script>
|
||||
<script src="/js/easyui/jquery.easyui.min.js"></script>
|
||||
<script src="/js/easyui/locale/easyui-lang-zh_CN.js"></script>
|
||||
<script src="/js/handlebars.js"></script>
|
||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="/js/common/common.js"></script>
|
||||
<script src="/js/common/jsherp.js"></script>
|
||||
<script src="/js/pages/bill/add_temp.js"></script>
|
||||
<script src="/js/pages/bill/in_out.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 数据显示table -->
|
||||
<div id="tablePanel" class="easyui-panel" data-options="fit:true" style="padding:1px; top:300px;" title="其它出库列表" iconCls="icon-list">
|
||||
<div class="box-body form-inline">
|
||||
<div class="form-group">
|
||||
<label class="control-label">单据编号:</label>
|
||||
<div class="control-inline">
|
||||
<input type="text" id="searchNumber" name="searchNumber" value="" maxlength="100" class="easyui-textbox width-90"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">商品信息:</label>
|
||||
<div class="control-inline">
|
||||
<input type="text" id="searchMaterial" name="searchMaterial" placeholder="名称,型号" maxlength="100" class="easyui-textbox width-90"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">单据日期:</label>
|
||||
<div class="control-inline">
|
||||
<input type="text" id="searchBeginTime" name="searchBeginTime" value="" maxlength="100" class="easyui-datebox width-120"/>
|
||||
-
|
||||
<input type="text" id="searchEndTime" name="searchEndTime" value="" maxlength="100" class="easyui-datebox width-120"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" id="searchBtn">查询</a>
|
||||
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-redo" id="searchResetBtn">重置</a>
|
||||
</div>
|
||||
</div>
|
||||
<table id="tableData" style="top:300px;border-bottom-color:#FFFFFF"></table>
|
||||
</div>
|
||||
|
||||
<div id="depotHeadDlg" class="easyui-dialog" style="padding:10px 20px;" fit="true"
|
||||
closed="true" buttons="#dlg-buttons" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<form id="depotHeadFM" method="post" novalidate>
|
||||
<table width="100%" style="min-width:1100px;">
|
||||
<tr>
|
||||
<td style="width:70px;">客户</td>
|
||||
<td style="padding:5px;width:170px;">
|
||||
<input id="OrganId" name="OrganId" style="width:130px;"/>
|
||||
</td>
|
||||
<td style="width:70px;">单据日期</td>
|
||||
<td style="padding:5px">
|
||||
<input type="text" name="OperTime" id="OperTime"
|
||||
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="txt Wdate radius-ui"
|
||||
style="width:155px;" readonly/>
|
||||
</td>
|
||||
<td style="width:80px;">单据编号</td>
|
||||
<td style="padding:5px">
|
||||
<input name="Number" id="Number" class="easyui-validatebox radius-ui"
|
||||
data-options="validType:'length[2,30]'" style="width: 150px;" readonly/>
|
||||
</td>
|
||||
<td style="width:70px;"></td>
|
||||
<td style="padding:5px">
|
||||
</td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9">
|
||||
<!-- 商品列表table -->
|
||||
<table id="materialData" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9">
|
||||
<textarea name="Remark" id="Remark" rows="2" cols="2" class="radius-ui" placeholder="暂无备注信息"
|
||||
style="width:100%; height:35px;"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<div id="dlg-buttons">
|
||||
<a href="javascript:void(0)" id="saveDepotHead" class="easyui-linkbutton" iconCls="icon-ok">保存</a>
|
||||
<a href="javascript:void(0)" id="cancelDepotHead" class="easyui-linkbutton" iconCls="icon-cancel"
|
||||
onclick="javascript:$('#depotHeadDlg').dialog('close')">取消</a>
|
||||
</div>
|
||||
<div id="depotHeadDlgShow" class="easyui-dialog" style="padding:10px 20px;" fit="true"
|
||||
closed="true" buttons="#dlg-buttons-show" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<table width="100%" style="min-width:1100px;">
|
||||
<tr>
|
||||
<td style="width:60px;">客户:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span id="OrganIdShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">单据日期:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span id="OperTimeShow"></span>
|
||||
</td>
|
||||
<td style="width:80px;">单据编号:</td>
|
||||
<td style="padding:5px;width:140px;">
|
||||
<span id="NumberShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;"></td>
|
||||
<td style="padding:5px;width:140px;"></td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9" style="width: 1130px;">
|
||||
<!-- 商品列表table -->
|
||||
<table id="materialDataShow" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:60px;">单据备注:</td>
|
||||
<td colspan="8" style="height:35px;">
|
||||
<span id="RemarkShow" style="width:100%; height:35px;"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="dlg-buttons-show">
|
||||
<a href="javascript:void(0)" id="printDepotHeadShow" class="easyui-linkbutton" iconCls="icon-print">打印</a>
|
||||
<a href="javascript:void(0)" id="cancelDepotHeadShow" class="easyui-linkbutton" iconCls="icon-cancel"
|
||||
onclick="javascript:$('#depotHeadDlgShow').dialog('close')">取消</a>
|
||||
</div>
|
||||
<div id="depot"></div>
|
||||
<script>
|
||||
$(function(){
|
||||
//初始化系统基础信息
|
||||
getType();
|
||||
inOutService.getRoleType();
|
||||
inOutService.initSystemData_UB();
|
||||
inOutService.initSystemData_depot();
|
||||
inOutService.initSystemData_account();
|
||||
inOutService.initSupplier(); //供应商
|
||||
inOutService.initSalesman(); //销售人员
|
||||
inOutService.initOutItemList(); //初始化支出项目
|
||||
inOutService.initMProperty(); //初始化商品属性
|
||||
initTableData();
|
||||
inOutService.ininPager();
|
||||
inOutService.initForm();
|
||||
inOutService.bindEvent();//绑定操作事件
|
||||
});
|
||||
//根据单据名称获取类型
|
||||
function getType() {
|
||||
listTitle = $("#tablePanel").prev().text();
|
||||
//改变宽度和高度
|
||||
$("#searchPanel").panel({width:webW-2});
|
||||
$("#tablePanel").panel({width:webW-2});
|
||||
var cusUrl = "/supplier/findBySelect_cus?UBType=UserCustomer&UBKeyId=" + kid; //客户接口
|
||||
listType = "出库";
|
||||
listSubType = "其它";
|
||||
organUrl = cusUrl;
|
||||
amountNum = "QTCK";
|
||||
}
|
||||
//初始化表格数据
|
||||
function initTableData(){
|
||||
if(pageType === "skip") {
|
||||
addDepotHead(); //自动弹出编辑框,带缓存数据
|
||||
}
|
||||
var tableToolBar = [
|
||||
{
|
||||
id:'addDepotHead',
|
||||
text:'增加',
|
||||
iconCls:'icon-add',
|
||||
handler:function() {
|
||||
addDepotHead();
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'deleteDepotHead',
|
||||
text:'删除',
|
||||
iconCls:'icon-remove',
|
||||
handler:function() {
|
||||
inOutService.batDeleteDepotHead();
|
||||
}
|
||||
}
|
||||
];
|
||||
$('#tableData').datagrid({
|
||||
height:heightInfo,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
pageSize: 10,
|
||||
pageList: initPageNum,
|
||||
columns:[[
|
||||
{ field: 'id',width:35,align:"center",checkbox:true},
|
||||
{ title: '操作',field: 'op',align:"center", width:90,
|
||||
formatter:function(value,rec,index) {
|
||||
var str = '';
|
||||
var orgId = rec.organId? rec.organId:0;
|
||||
str += '<img title="查看" src="/js/easyui/themes/icons/list.png" style="cursor: pointer;" onclick="showDepotHead(\'' + index + '\');"/> ';
|
||||
if(isShowOpFun()){
|
||||
str += '<img title="编辑" src="/js/easyui/themes/icons/pencil.png" style="cursor: pointer;" onclick="editDepotHead(\'' + index + '\');"/> ';
|
||||
str += '<img title="删除" src="/js/easyui/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="inOutService.deleteDepotHead('+ rec.id +',' + orgId +',' + rec.totalPrice+',' + rec.status + ');"/>';
|
||||
}
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{ title: '客户名称', field: 'organName',width:120},
|
||||
{ title: '单据编号',field: 'number',width:155, formatter:function (value,rec) {
|
||||
if(rec.linknumber) {
|
||||
return value + "[转]";
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '商品信息',field: 'materialsList',width:200,formatter:function(value){
|
||||
if(value) {
|
||||
return value.replace(",",",");
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '单据日期',field: 'operTimeStr',width:145},
|
||||
{ title: '操作员',field: 'userName',width:60},
|
||||
{ title: '金额合计',field: 'totalPrice',width:70}
|
||||
]],
|
||||
toolbar:tableToolBar,
|
||||
onLoadError:function() {
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
dgResize();
|
||||
toolbarStatus();
|
||||
}
|
||||
//新增信息
|
||||
function addDepotHead() {
|
||||
if(checkPower()){
|
||||
return;
|
||||
}
|
||||
$('#depotHeadFM').form('clear');
|
||||
var thisDateTime = getNowFormatDateTime(); //当前时间
|
||||
$("#OperTime").val(thisDateTime);
|
||||
inOutService.buildNumber(); //生成单据编号
|
||||
//初始化优惠率、优惠金额、优惠后金额、本次付|收款、本次欠款 为0
|
||||
$("#Discount").val(0);
|
||||
$("#DiscountMoney").val(0);
|
||||
$("#DiscountLastMoney").val(0);
|
||||
$("#ChangeAmount").val(0);
|
||||
$("#Debt").val(0);
|
||||
$("#AccountId").val(defaultAccountId); //初始化默认的账户Id
|
||||
var addTitle = listTitle.replace("列表","信息");
|
||||
$('#depotHeadDlg').show().dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/edit_add.png"/> 增加' + addTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
depotHeadID = 0;
|
||||
var res = sessionStorage.getItem("rowInfo");
|
||||
if(pageType == "skip" && res) { //从订单跳转过来
|
||||
res = JSON.parse(res);
|
||||
$('#OrganId').combobox('setValue', res.organId);
|
||||
$("#LinkNumber").val(res.number); //关联订单号
|
||||
$("#DiscountLastMoney").val(res.totalPrice); //优惠后金额
|
||||
$("#ChangeAmount").val(res.totalPrice).attr("data-changeamount", res.totalPrice);
|
||||
depotHeadID = res.id;
|
||||
initTableData_material("edit",res.totalPrice); //商品列表
|
||||
} else {
|
||||
initTableData_material("add"); //商品列表
|
||||
}
|
||||
inOutService.reject(); //撤销下、刷新商品列表
|
||||
function supplierDlgFun(type) {
|
||||
$('#supplierDlg').dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/edit_add.png"/> 增加' + type + '信息');
|
||||
$('#supplierFM').form('clear');
|
||||
bindSupplierEvent();
|
||||
}
|
||||
$("#addOrgan").off("click").on("click",function(){
|
||||
supplierDlgFun("供应商");
|
||||
});
|
||||
$("#addMember").off("click").on("click",function(){
|
||||
supplierDlgFun("会员");
|
||||
});
|
||||
$("#addCustomer").off("click").on("click",function(){
|
||||
supplierDlgFun("客户");
|
||||
});
|
||||
$("#addAccount").off("click").on("click",function(){
|
||||
$('#accountDlg').dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/edit_add.png"/> 增加结算账户');
|
||||
$('#accountFM').form('clear');
|
||||
bindAccountEvent();
|
||||
});
|
||||
url = '/depotHead/addDepotHeadAndDetail';
|
||||
}
|
||||
//编辑信息
|
||||
function editDepotHead(index) {
|
||||
var res = $("#tableData").datagrid("getRows")[index];
|
||||
if (res.status == "1" || res.status == "2") {
|
||||
$.messager.alert('编辑提示', '已审核和已转的单据不能编辑!', 'warning');
|
||||
return;
|
||||
}
|
||||
var TotalPrice = res.totalPrice; //合计金额
|
||||
$("#Number").val(res.number).attr("data-defaultNumber",res.number);
|
||||
$("#OperTime").val(res.operTimeStr);
|
||||
$("#LinkNumber").val(res.linkNumber); //关联订单号
|
||||
$("#AccountId").val(res.accountId); //账户Id
|
||||
$("#DiscountLastMoney").val(res.discountLastMoney); //优惠后金额
|
||||
$("#ChangeAmount").val(res.changeAmount).attr("data-changeamount", res.changeAmount);
|
||||
$('#OrganId').combobox('setValue', res.organId);
|
||||
$("#Remark").val(res.remark);
|
||||
$("#Discount").val(res.discount?res.discount:0);
|
||||
$("#DiscountMoney").val(res.discountMoney?res.discountMoney:0);
|
||||
var discountlastmoney = res.discountLastMoney?res.discountLastMoney:0;
|
||||
$("#Debt").val(discountlastmoney-res.changeAmount);
|
||||
$("#AccountDay").val(res.accountDay); //结算天数
|
||||
preTotalPrice = res.totalPrice; //记录前一次合计金额,用于扣预付款
|
||||
oldNumber = res.number; //记录编辑前的单据编号
|
||||
oldId = res.id; //记录单据Id
|
||||
var editTitle = listTitle.replace("列表","信息");
|
||||
$('#depotHeadDlg').show().dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/pencil.png"/> 编辑' + editTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
depotHeadID = res.id;
|
||||
//采购入库、销售出库的多账户加载
|
||||
if(res.accountIdList && res.accountMoneyList){
|
||||
$("#AccountId").val("many"); //下拉框选中多账户
|
||||
var accountArr = res.accountIdList.split(",");
|
||||
var accountMoneyArr = res.accountMoneyList.split(",");
|
||||
accountMoneyArr = changeListFmtPlus(accountMoneyArr) //将数组单个金额中的数值转为正数
|
||||
$("#AccountId").attr("data-accountArr", JSON.stringify(accountArr)).attr("data-accountMoneyArr", JSON.stringify(accountMoneyArr)); //json数据存储
|
||||
$(".many-account-ico").show(); //显示多账户的ico图标
|
||||
} else {
|
||||
$(".many-account-ico").hide(); //隐藏多账户的ico图标
|
||||
}
|
||||
//采购入库、销售出库的费用数据加载
|
||||
if(res.otherMoneyList && res.otherMoneyItem){
|
||||
$("#OtherMoney").val(res.otherMoney); //其它费用
|
||||
var itemArr = res.otherMoneyList.split(",");
|
||||
var itemMoneyArr = res.otherMoneyItem.split(",");
|
||||
$("#OtherMoney").attr("data-itemArr",JSON.stringify(itemArr)).attr("data-itemMoneyArr",itemMoneyArr); //json数据存储
|
||||
}
|
||||
initTableData_material("edit",TotalPrice); //商品列表
|
||||
inOutService.reject(); //撤销下、刷新商品列表
|
||||
url = '/depotHead/updateDepotHeadAndDetail?id=' + res.id; //更新接口
|
||||
}
|
||||
//查看信息
|
||||
function showDepotHead(index) {
|
||||
var res = $("#tableData").datagrid("getRows")[index];
|
||||
var manyAccountMoney = 0; //多账户合计-零售
|
||||
$("#NumberShow").text(res.number);
|
||||
$("#OperTimeShow").text(res.operTimeStr);
|
||||
$('#OrganIdShow').text(res.organName);
|
||||
if(res.accountName){
|
||||
$("#AccountIdShow").text(res.accountName); //结算账户
|
||||
} else {
|
||||
if (res.accountIdList) {
|
||||
var accountArr = res.accountIdList.split(","); //账户id列表
|
||||
var accountMoneyArr = res.accountMoneyList.split(","); //账户金额列表
|
||||
var accountIdShow = "";
|
||||
for (var j = 0; j < accountArr.length; j++) {
|
||||
if (accountList != null) {
|
||||
for (var i = 0; i < accountList.length; i++) {
|
||||
var account = accountList[i];
|
||||
if (accountArr[j] == account.id) {
|
||||
var currentAccountMoney = accountMoneyArr[j] - 0;
|
||||
if (currentAccountMoney < 0) {
|
||||
currentAccountMoney = 0 - currentAccountMoney;
|
||||
}
|
||||
accountIdShow = accountIdShow + account.name + "(" + currentAccountMoney + "元) ";
|
||||
manyAccountMoney += accountMoneyArr[j] - 0; //多账户合计-零售
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$("#AccountIdShow").text(accountIdShow);
|
||||
}
|
||||
}
|
||||
$("#ChangeAmountShow").text(res.changeAmount);
|
||||
$("#RemarkShow").text(res.remark);
|
||||
$("#DiscountShow").text(res.discount);
|
||||
$("#DiscountMoneyShow").text(res.discountMoney);
|
||||
$("#DiscountLastMoneyShow").text(res.discountLastMoney);
|
||||
var debt = 0;
|
||||
if(res.otherMoney){
|
||||
debt = (res.discountLastMoney+res.otherMoney-res.changeAmount).toFixed(2);
|
||||
} else {
|
||||
debt = (res.discountLastMoney-res.changeAmount).toFixed(2);
|
||||
}
|
||||
$("#DebtShow").text(debt);
|
||||
$("#AccountDayShow").text(res.accountDay); //结算天数
|
||||
$("#LinkNumberShow").text(res.linkNumber); //关联订单号
|
||||
var otherMoney = res.otherMoney?res.otherMoney:0;
|
||||
if(otherMoney!=0 && res.otherMoneyList && res.otherMoneyItem){
|
||||
var itemArr = res.otherMoneyList.split(","); //支出项目id列表
|
||||
var itemMoneyArr = null;
|
||||
if(res.otherMoneyItem!=null) {
|
||||
itemMoneyArr = eval ("(" + res.otherMoneyItem + ")"); //支出项目金额列表
|
||||
}
|
||||
var otherMoneyShow = "";
|
||||
for(var j =0;j<itemArr.length; j++) {
|
||||
if (outItemList != null) {
|
||||
for (var i = 0; i < outItemList.length; i++) {
|
||||
var money = outItemList[i];
|
||||
if(itemArr[j] == money.Id) {
|
||||
for(var k =0;k<itemMoneyArr.length; k++) {
|
||||
if(itemMoneyArr[k].otherId == money.Id) {
|
||||
otherMoneyShow += money.InOutItemName;
|
||||
if(itemMoneyArr[k].otherMoney) {
|
||||
otherMoneyShow +="(" + itemMoneyArr[k].otherMoney +"元)";
|
||||
}
|
||||
otherMoneyShow+=",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$("#OtherMoneyShow").text(otherMoneyShow +"总计:"+ otherMoney + "元 "); //其它费用
|
||||
}
|
||||
else {
|
||||
$("#OtherMoneyShow").text(otherMoney); //其它费用
|
||||
}
|
||||
$("#payTypeShow").text(res.payType);
|
||||
var TotalPrice = res.totalPrice;
|
||||
var showTitle = listTitle.replace("列表","信息");
|
||||
$('#depotHeadDlgShow').show().dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/list.png"/> 查看' + showTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
depotHeadID = res.id;
|
||||
initTableData_material_show(TotalPrice); //商品列表-查看状态
|
||||
}
|
||||
//初始化表格数据-商品列表-编辑状态
|
||||
function initTableData_material(type,TotalPrice) {
|
||||
var self = this;
|
||||
var body,footer,input; //定义表格和文本框
|
||||
var ratioDepot = 1; //比例-仓库用
|
||||
var monthTime = getNowFormatMonth();
|
||||
var isShowAnotherDepot = true; //显示对方仓库,true为隐藏,false为显示
|
||||
var depotHeadName = ""; //仓库名称
|
||||
var depotUrl = ""; //仓库接口地址
|
||||
var depotTextField = ""; //仓库下拉名称
|
||||
var anotherDepotHeadName = ""; //对方仓库的列的标题
|
||||
var anotherDepotUrl = ""; //对方仓库接口地址
|
||||
var anotherDepotTextField = "";
|
||||
if(listSubType == "调拨"){
|
||||
isShowAnotherDepot = false; //调拨时候显示对方仓库
|
||||
anotherDepotHeadName = "调入仓库";
|
||||
anotherDepotUrl = '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid;
|
||||
anotherDepotTextField = "depotName";
|
||||
}
|
||||
depotHeadName = "仓库名称";
|
||||
depotUrl = '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid;
|
||||
depotTextField = "depotName";
|
||||
var isShowTaxColumn = false; //是否显示税率相关的列,true为隐藏,false为显示
|
||||
if(listSubType == "调拨" || listSubType == "其它" || listSubType == "零售" || listSubType == "零售退货" || listSubType == "采购订单" || listSubType == "销售订单" || listSubType == "组装单" || listSubType == "拆卸单"){
|
||||
isShowTaxColumn = true; //隐藏
|
||||
}
|
||||
var isShowMaterialTypeColumn = true; //是否显示商品类型相关的列,true为隐藏,false为显示
|
||||
if(listSubType == "组装单" || listSubType == "拆卸单"){
|
||||
isShowMaterialTypeColumn = false; //显示
|
||||
}
|
||||
$('#materialData').datagrid({
|
||||
height:345,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//单击行是否选中
|
||||
checkOnSelect : false,
|
||||
pagination: false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
//loadFilter: pagerFilter,
|
||||
onClickRow: onClickRow,
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{ title: '商品类型',field: 'MType',editor:'validatebox',hidden:isShowMaterialTypeColumn,width:80},
|
||||
{ title: depotHeadName, field: 'DepotId', editor: 'validatebox', width: 90,
|
||||
formatter: function (value, row, index) {
|
||||
return row.DepotName;
|
||||
},
|
||||
editor: {
|
||||
type: 'combobox',
|
||||
options: {
|
||||
valueField: 'id',
|
||||
textField: depotTextField,
|
||||
method: 'get',
|
||||
url: depotUrl,
|
||||
onSelect:function(rec){
|
||||
var depotId = rec.id;
|
||||
body =$("#depotHeadFM .datagrid-body");
|
||||
footer =$("#depotHeadFM .datagrid-footer");
|
||||
input = ".datagrid-editable-input";
|
||||
var mId = body.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
||||
if(mId){
|
||||
var type = "select"; //type 类型:点击 click,选择 select
|
||||
inOutService.findStockNumById(depotId, mId, monthTime, body, input, ratioDepot, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '条码_名称(规格)(型号)(扩展信息)(单位)',field: 'MaterialExtendId',width:270,
|
||||
formatter:function(value,row,index){
|
||||
return row.MaterialName;
|
||||
},
|
||||
editor:{
|
||||
type:'combogrid',
|
||||
options:{
|
||||
url: "/material/findBySelect",
|
||||
idField:'Id',
|
||||
textField:'MaterialName',
|
||||
method:'get',
|
||||
pagination: true,
|
||||
mode: 'remote',
|
||||
hasDownArrow: false,
|
||||
panelWidth: 630, //下拉框的宽度
|
||||
panelHeight: 380,//下拉框的高度
|
||||
columns:[[
|
||||
{field:'mBarCode',title:'条码',width:120},
|
||||
{field:'name',title:'名称',width:140},
|
||||
{field:'standard',title:'规格',width:80},
|
||||
{field:'model',title:'型号',width:80},
|
||||
{field:'unit',title:'单位',width:60},
|
||||
{field:'stock',title:'库存',width:50},
|
||||
{field:'expand',title:'扩展信息',width:80}
|
||||
]],
|
||||
onBeforeLoad: function(param){
|
||||
var edDepot = $('#materialData').datagrid('getEditor', {index:editIndex,field:'DepotId'});
|
||||
if(edDepot) {
|
||||
param.depotId = $(edDepot.target).combobox('getValue');
|
||||
}
|
||||
param.mpList = mPropertyList; //商品属性
|
||||
},
|
||||
onLoadSuccess: function (rec) {
|
||||
if(rec && rec.total==1) {
|
||||
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
||||
$("#depotHeadFM .datagrid-body").find("[field='OperNumber']").find(".datagrid-editable-input").focus().select();
|
||||
}
|
||||
},
|
||||
onSelect:function(index, rowData){
|
||||
inOutService.materialSelect(rowData,monthTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '库存',field: 'Stock',editor:'validatebox',width:50},
|
||||
{ title: anotherDepotHeadName, field: 'AnotherDepotId',editor:'validatebox',hidden:isShowAnotherDepot,width:90,
|
||||
formatter: function (value, row, index) {
|
||||
return row.AnotherDepotName;
|
||||
},
|
||||
editor: {
|
||||
type: 'combobox',
|
||||
options: {
|
||||
valueField: 'id',
|
||||
textField: anotherDepotTextField,
|
||||
method: 'get',
|
||||
url: anotherDepotUrl
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '单位',field: 'Unit',editor:'validatebox',width:60},
|
||||
{ title: '数量',field: 'OperNumber',editor:'validatebox',width:60},
|
||||
{ title: '单价',field: 'UnitPrice',editor:'validatebox',width:60},
|
||||
{ title: '含税单价',field: 'TaxUnitPrice',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '金额',field: 'AllPrice',editor:'validatebox',width:75},
|
||||
{ title: '税率(%)',field: 'TaxRate',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '税额',field: 'TaxMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '价税合计',field: 'TaxLastMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:100}
|
||||
]],
|
||||
toolbar:[
|
||||
{
|
||||
id:'append',
|
||||
text:'新增行',
|
||||
iconCls:'icon-add',
|
||||
handler:function() {
|
||||
inOutService.append(); //新增行
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'delete',
|
||||
text:'删除行',
|
||||
iconCls:'icon-remove',
|
||||
handler:function() {
|
||||
inOutService.batchDel(); //删除行
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'reject',
|
||||
text:'撤销',
|
||||
iconCls:'icon-undo',
|
||||
handler:function() {
|
||||
inOutService.reject(); //撤销
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'appendDepot',
|
||||
text:'新增仓库',
|
||||
iconCls:'icon-add',
|
||||
handler:function() {
|
||||
inOutService.appendDepot(); //新增仓库
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'appendMaterial',
|
||||
text:'新增商品',
|
||||
iconCls:'icon-add',
|
||||
handler:function() {
|
||||
js.addTabPage(null, "商品信息", "/pages/materials/material.html");
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadError:function() {
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: '/depotItem/getDetailList',
|
||||
data: {
|
||||
headerId: depotHeadID,
|
||||
mpList: mPropertyList
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
var data = res.data;
|
||||
var AllPrice = 0;
|
||||
var TaxLastMoney = 0;
|
||||
var DiscountMoney = $("#DiscountMoney").val()-0; //优惠金额
|
||||
var DiscountLastMoney = $("#DiscountLastMoney").val()-0; //优惠后金额
|
||||
if(type === "edit") {
|
||||
AllPrice = TotalPrice;
|
||||
TaxLastMoney = DiscountMoney + DiscountLastMoney;
|
||||
}
|
||||
var array = [];
|
||||
array.push({
|
||||
"AllPrice": AllPrice,
|
||||
"TaxLastMoney": TaxLastMoney
|
||||
});
|
||||
data.footer = array;
|
||||
$("#materialData").datagrid('loadData',data);
|
||||
if(type === "add") {
|
||||
$("#depotHeadDlg #append").click(); //新增行
|
||||
}
|
||||
}
|
||||
},
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
}
|
||||
});
|
||||
}
|
||||
//初始化表格数据-商品列表-查看状态
|
||||
function initTableData_material_show(TotalPrice) {
|
||||
var self = this;
|
||||
var isShowAnotherDepot = true; //显示对方仓库,true为隐藏,false为显示
|
||||
var anotherDepotHeadName = ""; //对方仓库的列的标题
|
||||
var depotHeadName = ""; //仓库的列的标题
|
||||
if(listSubType == "调拨"){
|
||||
isShowAnotherDepot = false; //调拨时候显示对方仓库
|
||||
anotherDepotHeadName = "调入仓库";
|
||||
}
|
||||
depotHeadName = "仓库名称";
|
||||
var isShowTaxColumn = false; //是否显示税率相关的列,true为隐藏,false为显示
|
||||
if(listSubType == "调拨" || listSubType == "其它" || listSubType == "零售" || listSubType == "零售退货" || listSubType == "采购订单" || listSubType == "销售订单" || listSubType == "组装单" || listSubType == "拆卸单"){
|
||||
isShowTaxColumn = true; //隐藏
|
||||
}
|
||||
var isShowMaterialTypeColumn = true; //是否显示商品类型相关的列,true为隐藏,false为显示
|
||||
if(listSubType == "组装单" || listSubType == "拆卸单"){
|
||||
isShowMaterialTypeColumn = false; //显示
|
||||
}
|
||||
$('#materialDataShow').datagrid({
|
||||
height:345,
|
||||
rownumbers: true,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
pagination: false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
columns:[[
|
||||
{ title: '商品类型',field: 'MType',width:80, hidden:isShowMaterialTypeColumn},
|
||||
{ title: depotHeadName,field: 'DepotName',editor:'validatebox',width:90},
|
||||
{ title: '条码_名称(规格)(型号)(扩展信息)(单位)',field: 'MaterialName',width:270},
|
||||
{ title: '库存',field: 'Stock',width:50},
|
||||
{ title: anotherDepotHeadName,field: 'AnotherDepotName',hidden:isShowAnotherDepot,width:90},
|
||||
{ title: '单位',field: 'Unit',editor:'validatebox',width:60},
|
||||
{ title: '数量',field: 'OperNumber',editor:'validatebox',width:60},
|
||||
{ title: '单价',field: 'UnitPrice',editor:'validatebox',width:60},
|
||||
{ title: '含税单价',field: 'TaxUnitPrice',editor:'validattebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '金额',field: 'AllPrice',editor:'validatebox',width:75},
|
||||
{ title: '税率(%)',field: 'TaxRate',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '税额',field: 'TaxMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '价税合计',field: 'TaxLastMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:100}
|
||||
]],
|
||||
onLoadError:function() {
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: '/depotItem/getDetailList',
|
||||
data: {
|
||||
headerId: depotHeadID,
|
||||
mpList: mPropertyList
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
var data = res.data;
|
||||
var AllPrice = TotalPrice;
|
||||
var DiscountMoney = $("#DiscountMoneyShow").text() - 0; //优惠金额
|
||||
var DiscountLastMoney = $("#DiscountLastMoneyShow").text() - 0; //优惠后金额
|
||||
var array = [];
|
||||
array.push({
|
||||
"AllPrice": AllPrice,
|
||||
"TaxLastMoney": DiscountMoney + DiscountLastMoney
|
||||
});
|
||||
data.footer = array;
|
||||
$("#materialDataShow").datagrid('loadData', data);
|
||||
}
|
||||
},
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
}
|
||||
});
|
||||
}
|
||||
//订单转采购或销售
|
||||
function skipDepotHead(index) {
|
||||
var res = $("#tableData").datagrid("getRows")[index];
|
||||
if(res.status == "0" || res.status == "2") {
|
||||
$.messager.alert('提示','未审核和已转的单据禁止操作!','warning');
|
||||
} else {
|
||||
sessionStorage.setItem("rowInfo", JSON.stringify(res)); //将单据信息存入缓存中
|
||||
if(listTitle == "采购订单列表") {
|
||||
js.addTabPage(null, "订单转采购", "/pages/materials/purchase_in_list.html?t=skip");
|
||||
} else if(listTitle == "销售订单列表") {
|
||||
js.addTabPage(null, "订单转销售", "/pages/materials/sale_out_list.html?t=skip");
|
||||
}
|
||||
}
|
||||
}
|
||||
//保存信息
|
||||
$("#saveDepotHead").off("click").on("click",function(){
|
||||
if(!$('#depotHeadFM').form('validate')){
|
||||
return;
|
||||
}
|
||||
else {
|
||||
//如果初始编号被修改了,就要判断单据编号是否存在
|
||||
if($.trim($("#Number").val()) != $('#Number').attr("data-defaultNumber")){
|
||||
//调用查询单据编号是否重名的方法
|
||||
if(inOutService.checkDepotHeadNumber()){
|
||||
return;
|
||||
}
|
||||
}
|
||||
//输入框提示
|
||||
if(!$('#OrganId').combobox('getValue')){
|
||||
$.messager.alert('提示','请选择往来单位!','warning');
|
||||
return;
|
||||
}
|
||||
//进行明细的校验
|
||||
if(depotHeadID ==0) {
|
||||
//新增模式下
|
||||
if (!inOutService.CheckData("add")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//编辑模式下
|
||||
if (!inOutService.CheckData("edit")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
var OrganId = null;
|
||||
var ChangeAmount = $.trim($("#ChangeAmount").val())-0;
|
||||
var TotalPrice = $("#depotHeadFM .datagrid-footer [field='AllPrice'] div").text();
|
||||
if($('#OrganId').length){
|
||||
OrganId = $('#OrganId').combobox('getValue');
|
||||
}
|
||||
var accountMoneyList = $("#AccountId").attr("data-accountmoneyarr"); //账户金额列表-多账户
|
||||
var accountMoneyArr;
|
||||
if(accountMoneyList) {
|
||||
accountMoneyList = accountMoneyList.replace("[","").replace("]","").toString();
|
||||
var reg=new RegExp("\"","g"); //创建正则RegExp对象
|
||||
accountMoneyList = accountMoneyList.replace(reg,""); //替换所有的双引号
|
||||
accountMoneyArr = accountMoneyList.split(","); //转为数组
|
||||
}
|
||||
if(listSubType === "采购订单"||listSubType === "采购"||listSubType === "零售退货"||listSubType === "销售退货"){
|
||||
//付款为负数
|
||||
ChangeAmount = 0 - ChangeAmount;
|
||||
TotalPrice = 0 - TotalPrice;
|
||||
if(accountMoneyArr) {
|
||||
accountMoneyArr = changeListFmtMinus(accountMoneyArr); //将数组单个金额中的数值转为负数
|
||||
}
|
||||
}
|
||||
//零售时候,可以从会员预付款中扣款
|
||||
var thisPayType = "现付";
|
||||
if(listSubType === "零售") {
|
||||
if($("#payType").val() ==="预付款") {
|
||||
thisPayType = "预付款";
|
||||
}
|
||||
}
|
||||
var SalesmanStr = "";
|
||||
if(listSubType === "销售" || listSubType === "销售退货" || listSubType === "销售订单"){
|
||||
var Salesman = $('#Salesman').combobox('getValues').toString(); //销售人员
|
||||
if(Salesman) {
|
||||
var SalesmanArray = Salesman.split(",");
|
||||
for (var i = 0; i < SalesmanArray.length; i++) {
|
||||
if (i === SalesmanArray.length - 1) {
|
||||
SalesmanStr += "<" + SalesmanArray[i] + ">";
|
||||
}
|
||||
else {
|
||||
SalesmanStr += "<" + SalesmanArray[i] + ">,";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var getAccountID = $.trim($("#AccountId").val());
|
||||
if($("#AccountId").val() === "many"){ //多账户
|
||||
getAccountID = null;
|
||||
}
|
||||
var infoStr=JSON.stringify({
|
||||
Type: listType,
|
||||
SubType: listSubType,
|
||||
DefaultNumber: $.trim($("#Number").attr("data-defaultNumber")),//初始编号
|
||||
Number: $.trim($("#Number").val()),
|
||||
LinkNumber: $.trim($("#LinkNumber").val()),
|
||||
OperTime: $("#OperTime").val(),
|
||||
OrganId: OrganId,
|
||||
Salesman: SalesmanStr, //销售人员
|
||||
AccountId: getAccountID,
|
||||
ChangeAmount: ChangeAmount, //付款/收款
|
||||
TotalPrice: TotalPrice, //合计
|
||||
PayType: thisPayType, //现付/预付款
|
||||
Remark: $.trim($("#Remark").val()),
|
||||
AccountIdList: $("#AccountId").attr("data-accountarr"), //账户列表-多账户
|
||||
AccountMoneyList: accountMoneyArr ? JSON.stringify(accountMoneyArr) : "", //账户金额列表-多账户
|
||||
Discount: $.trim($("#Discount").val()),
|
||||
DiscountMoney: $.trim($("#DiscountMoney").val()),
|
||||
DiscountLastMoney: $.trim($("#DiscountLastMoney").val()),
|
||||
OtherMoney: $.trim($("#OtherMoney").val()), //其它费用
|
||||
OtherMoneyList: $("#OtherMoney").attr("data-itemarr"), //支出项目列表-涉及费用
|
||||
OtherMoneyItem: $("#OtherMoney").attr("data-itemmoneyarr"), //支出项目金额列表-涉及费用
|
||||
AccountDay: $("#AccountDay").val() //结算天数
|
||||
});
|
||||
/**
|
||||
* 零售出库,单独操作
|
||||
* */
|
||||
if(url.indexOf("/depotHead/addDepotHeadAndDetail")>=0){
|
||||
inOutService.addDepotHeadAndDetail(url,infoStr);
|
||||
} else if(url.indexOf("/depotHead/updateDepotHeadAndDetail")>=0){
|
||||
inOutService.updateDepotHeadAndDetail(url,infoStr,preTotalPrice);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
1018
erp_web/pages/bill/purchase_back_list.html
Normal file
1018
erp_web/pages/bill/purchase_back_list.html
Normal file
File diff suppressed because it is too large
Load Diff
1036
erp_web/pages/bill/purchase_in_list.html
Normal file
1036
erp_web/pages/bill/purchase_in_list.html
Normal file
File diff suppressed because it is too large
Load Diff
970
erp_web/pages/bill/purchase_orders_list.html
Normal file
970
erp_web/pages/bill/purchase_orders_list.html
Normal file
@@ -0,0 +1,970 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>采购订单</title>
|
||||
<meta charset="utf-8">
|
||||
<!-- 指定以IE8的方式来渲染 -->
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
|
||||
<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon"/>
|
||||
<link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="/css/jsherp.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="/js/easyui/themes/default/easyui.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="/js/easyui/themes/icon.css"/>
|
||||
<link type="text/css" rel="stylesheet" href="/css/common.css"/>
|
||||
<link type="text/css" rel="stylesheet" href="/css/in_out.css"/>
|
||||
<script src="/js/jquery-1.8.0.min.js"></script>
|
||||
<script src="/js/easyui/jquery.easyui.min.js"></script>
|
||||
<script src="/js/easyui/locale/easyui-lang-zh_CN.js"></script>
|
||||
<script src="/js/handlebars.js"></script>
|
||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="/js/common/common.js"></script>
|
||||
<script src="/js/common/jsherp.js"></script>
|
||||
<script src="/js/pages/bill/add_temp.js"></script>
|
||||
<script src="/js/pages/bill/in_out.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 数据显示table -->
|
||||
<div id="tablePanel" class="easyui-panel" data-options="fit:true" style="padding:1px; top:300px;" title="采购订单列表" iconCls="icon-list">
|
||||
<div class="box-body form-inline">
|
||||
<div class="form-group">
|
||||
<label class="control-label">单据编号:</label>
|
||||
<div class="control-inline">
|
||||
<input type="text" id="searchNumber" name="searchNumber" value="" maxlength="100" class="easyui-textbox width-90"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">商品信息:</label>
|
||||
<div class="control-inline">
|
||||
<input type="text" id="searchMaterial" name="searchMaterial" placeholder="名称,型号" maxlength="100" class="easyui-textbox width-90"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">单据日期:</label>
|
||||
<div class="control-inline">
|
||||
<input type="text" id="searchBeginTime" name="searchBeginTime" value="" maxlength="100" class="easyui-datebox width-120"/>
|
||||
-
|
||||
<input type="text" id="searchEndTime" name="searchEndTime" value="" maxlength="100" class="easyui-datebox width-120"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" id="searchBtn">查询</a>
|
||||
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-redo" id="searchResetBtn">重置</a>
|
||||
</div>
|
||||
</div>
|
||||
<table id="tableData" style="top:300px;border-bottom-color:#FFFFFF"></table>
|
||||
</div>
|
||||
|
||||
<div id="depotHeadDlg" class="easyui-dialog" style="padding:10px 20px;" fit="true"
|
||||
closed="true" buttons="#dlg-buttons" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<form id="depotHeadFM" method="post" novalidate>
|
||||
<table width="100%" style="min-width:1100px;">
|
||||
<tr>
|
||||
<td style="width:70px;">供应商</td>
|
||||
<td style="padding:5px;width:170px;">
|
||||
<div class="org-list">
|
||||
<input id="OrganId" name="OrganId" style="width:130px;"/>
|
||||
</div>
|
||||
<div class="add-org-btn">
|
||||
<img id="addOrgan" src="/js/easyui/themes/icons/edit_add.png"
|
||||
style="cursor: pointer;" alt="增加供应商" title="增加供应商"/>
|
||||
</div>
|
||||
</td>
|
||||
<td style="width:70px;">单据日期</td>
|
||||
<td style="padding:5px;width:170px;">
|
||||
<input type="text" name="OperTime" id="OperTime"
|
||||
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="txt Wdate radius-ui"
|
||||
style="width:155px;" readonly/>
|
||||
</td>
|
||||
<td style="width:80px;">单据编号</td>
|
||||
<td style="padding:5px">
|
||||
<input name="Number" id="Number" class="easyui-validatebox radius-ui"
|
||||
data-options="validType:'length[2,30]'" style="width: 150px;" readonly/>
|
||||
</td>
|
||||
<td style="width:70px;"></td>
|
||||
<td style="padding:5px">
|
||||
</td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9">
|
||||
<!-- 商品列表table -->
|
||||
<table id="materialData" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9">
|
||||
<textarea name="Remark" id="Remark" rows="2" cols="2" class="radius-ui" placeholder="暂无备注信息"
|
||||
style="width:100%; height:35px;"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="clientIp" id="clientIp" value="<%=clientIp %>"/>
|
||||
</form>
|
||||
</div>
|
||||
<div id="dlg-buttons">
|
||||
<a href="javascript:void(0)" id="saveDepotHead" class="easyui-linkbutton" iconCls="icon-ok">保存</a>
|
||||
<a href="javascript:void(0)" id="cancelDepotHead" class="easyui-linkbutton" iconCls="icon-cancel"
|
||||
onclick="javascript:$('#depotHeadDlg').dialog('close')">取消</a>
|
||||
</div>
|
||||
<div id="depotHeadDlgShow" class="easyui-dialog" style="padding:10px 20px;" fit="true"
|
||||
closed="true" buttons="#dlg-buttons-show" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<table width="100%" style="min-width:1100px;">
|
||||
<tr>
|
||||
<td style="width:60px;">供应商:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span id="OrganIdShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;">单据日期:</td>
|
||||
<td style="padding:5px;width:130px;">
|
||||
<span id="OperTimeShow"></span>
|
||||
</td>
|
||||
<td style="width:80px;">单据编号:</td>
|
||||
<td style="padding:5px;width:140px;">
|
||||
<span id="NumberShow"></span>
|
||||
</td>
|
||||
<td style="width:70px;"></td>
|
||||
<td style="padding:5px;width:140px;"></td>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9" style="width: 1130px;">
|
||||
<!-- 商品列表table -->
|
||||
<table id="materialDataShow" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:60px;">单据备注:</td>
|
||||
<td colspan="8" style="height:35px;">
|
||||
<span id="RemarkShow" style="width:100%; height:35px;"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="dlg-buttons-show">
|
||||
<a href="javascript:void(0)" id="printDepotHeadShow" class="easyui-linkbutton" iconCls="icon-print">打印</a>
|
||||
<a href="javascript:void(0)" id="cancelDepotHeadShow" class="easyui-linkbutton" iconCls="icon-cancel"
|
||||
onclick="javascript:$('#depotHeadDlgShow').dialog('close')">取消</a>
|
||||
</div>
|
||||
<div id="depotHeadAccountDlg" class="easyui-dialog" style="width:380px;padding:10px 20px;top:80px"
|
||||
closed="true" modal="true" buttons="#accountDlgButtons" cache="false" collapsible="false" closable="true">
|
||||
<table class="account-dlg">
|
||||
<tr class="account-head-tmp">
|
||||
<td style="width:30px;"></td>
|
||||
<td style="width:140px; padding:5px;">结算账户</td>
|
||||
<td style="width:100px; padding:5px;">金额</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:30px;"></td>
|
||||
<td style="width:140px;text-align: center;">合计:</td>
|
||||
<td style="width:100px;"><span id="accountMoneyTotalDlg"></span></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="tabs-tmp">
|
||||
<tr class="account-content-tmp">
|
||||
<td style="width:30px;"></td>
|
||||
<td style="width:140px; padding:3px;"><select class="account-id-dlg" style="width:140px;"></select></td>
|
||||
<td style="width:100px; padding:3px;"><input class="account-money-dlg" style="width:100px;"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="accountDlgButtons">
|
||||
<a href="javascript:void(0)" id="saveDepotHeadAccountDlg" class="easyui-linkbutton" iconCls="icon-ok">保存</a>
|
||||
<a href="javascript:void(0)" id="cancelDepotHeadAccountDlg" class="easyui-linkbutton" iconCls="icon-cancel">取消</a>
|
||||
</div>
|
||||
<div id="otherMoneyDlg" class="easyui-dialog" style="width:380px;padding:10px 20px;top:80px"
|
||||
closed="true" modal="true" buttons="#otherMoneyDlgBtn" cache="false" collapsible="false" closable="true">
|
||||
<table class="money-dlg">
|
||||
<tr class="money-head-tmp">
|
||||
<td style="width:30px;"></td>
|
||||
<td style="width:140px; padding:5px;">支出项目</td>
|
||||
<td style="width:100px; padding:5px;">金额</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:30px;"></td>
|
||||
<td style="width:140px;text-align: center;">合计:</td>
|
||||
<td style="width:100px;"><span id="otherMoneyTotalDlg"></span></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="tabs-tmp">
|
||||
<tr class="money-content-tmp">
|
||||
<td style="width:30px;"></td>
|
||||
<td style="width:140px; padding:3px;"><select class="money-id-dlg" style="width:140px;"></select></td>
|
||||
<td style="width:100px; padding:3px;"><input class="other-money-dlg" style="width:100px;"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="otherMoneyDlgBtn">
|
||||
<a href="javascript:void(0)" id="saveOtherMoneyDlg" class="easyui-linkbutton" iconCls="icon-ok">保存</a>
|
||||
<a href="javascript:void(0)" id="cancelOtherMoneyDlg" class="easyui-linkbutton" iconCls="icon-cancel">取消</a>
|
||||
</div>
|
||||
<div id="supplier"></div>
|
||||
<div id="depot"></div>
|
||||
<script>
|
||||
$(function(){
|
||||
//初始化系统基础信息
|
||||
getType();
|
||||
inOutService.getRoleType();
|
||||
inOutService.initSystemData_UB();
|
||||
inOutService.initSystemData_depot();
|
||||
inOutService.initSystemData_account();
|
||||
inOutService.initSupplier(); //供应商
|
||||
inOutService.initSalesman(); //销售人员
|
||||
inOutService.initOutItemList(); //初始化支出项目
|
||||
inOutService.initMProperty(); //初始化商品属性
|
||||
initTableData();
|
||||
inOutService.ininPager();
|
||||
inOutService.initForm();
|
||||
inOutService.bindEvent();//绑定操作事件
|
||||
});
|
||||
//根据单据名称获取类型
|
||||
function getType() {
|
||||
listTitle = $("#tablePanel").prev().text();
|
||||
//改变宽度和高度
|
||||
$("#searchPanel").panel({width:webW-2});
|
||||
$("#tablePanel").panel({width:webW-2});
|
||||
var supUrl = "/supplier/findBySelect_sup"; //供应商接口
|
||||
listType = "其它";
|
||||
listSubType = "采购订单";
|
||||
organUrl = supUrl;
|
||||
amountNum = "CGDD";
|
||||
}
|
||||
//初始化表格数据
|
||||
function initTableData(){
|
||||
if(pageType === "skip") {
|
||||
addDepotHead(); //自动弹出编辑框,带缓存数据
|
||||
}
|
||||
var tableToolBar = [
|
||||
{
|
||||
id:'addDepotHead',
|
||||
text:'增加',
|
||||
iconCls:'icon-add',
|
||||
handler:function() {
|
||||
addDepotHead();
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'deleteDepotHead',
|
||||
text:'删除',
|
||||
iconCls:'icon-remove',
|
||||
handler:function() {
|
||||
inOutService.batDeleteDepotHead();
|
||||
}
|
||||
}
|
||||
];
|
||||
//如果允许的按钮列表中存在就显示,2-代表审核|反审核的权限
|
||||
if(btnEnableList && btnEnableList.indexOf(2)>-1){
|
||||
isHiddenStatus = false; //显示
|
||||
tableToolBar.push({
|
||||
id:'okDepotHead',
|
||||
text:'审核',
|
||||
iconCls:'icon-ok',
|
||||
handler:function() {
|
||||
inOutService.setStatusFun("1");
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'undoDepotHead',
|
||||
text:'反审核',
|
||||
iconCls:'icon-undo',
|
||||
handler:function() {
|
||||
inOutService.setStatusFun("0");
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
isHiddenStatus = true; //隐藏
|
||||
}
|
||||
$('#tableData').datagrid({
|
||||
height:heightInfo,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
pageSize: 10,
|
||||
pageList: initPageNum,
|
||||
columns:[[
|
||||
{ field: 'id',width:35,align:"center",checkbox:true},
|
||||
{ title: '操作',field: 'op',align:"center", width:120,
|
||||
formatter:function(value,rec,index) {
|
||||
var str = '';
|
||||
var orgId = rec.organId? rec.organId:0;
|
||||
str += '<img title="查看" src="/js/easyui/themes/icons/list.png" style="cursor: pointer;" onclick="showDepotHead(\'' + index + '\');"/> ';
|
||||
if(isShowOpFun()){
|
||||
str += '<img title="编辑" src="/js/easyui/themes/icons/pencil.png" style="cursor: pointer;" onclick="editDepotHead(\'' + index + '\');"/> ';
|
||||
str += '<img title="删除" src="/js/easyui/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="inOutService.deleteDepotHead('+ rec.id +',' + orgId +',' + rec.totalPrice+',' + rec.status + ');"/>';
|
||||
}
|
||||
str += ' <img title="转采购入库" src="/js/easyui/themes/icons/redo.png" style="cursor: pointer;" onclick="skipDepotHead(\'' + index + '\');"/>';
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{ title: '供应商名称', field: 'organName',width:120},
|
||||
{ title: '单据编号',field: 'number',width:155, formatter:function (value,rec) {
|
||||
if(rec.linknumber) {
|
||||
return value + "[转]";
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '商品信息',field: 'materialsList',width:200,formatter:function(value){
|
||||
if(value) {
|
||||
return value.replace(",",",");
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '单据日期',field: 'operTimeStr',width:145},
|
||||
{ title: '操作员',field: 'userName',width:60},
|
||||
{ title: '金额合计',field: 'totalPrice',width:70},
|
||||
{ title: '状态',field: 'status',hidden:isHiddenStatus, width:70,align:"center",formatter:function(value){
|
||||
if(value === "0") {
|
||||
return "<span style='color:red;'>未审核</span>";
|
||||
} else if(value === "1") {
|
||||
return "<span style='color:green;'>已审核</span>";
|
||||
} else if(value === "2") {
|
||||
return "<span style='color:blue;'>已转采购</span>";
|
||||
}
|
||||
}
|
||||
}
|
||||
]],
|
||||
toolbar:tableToolBar,
|
||||
onLoadError:function() {
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
dgResize();
|
||||
toolbarStatus();
|
||||
}
|
||||
//新增信息
|
||||
function addDepotHead() {
|
||||
if(checkPower()){
|
||||
return;
|
||||
}
|
||||
$('#depotHeadFM').form('clear');
|
||||
var thisDateTime = getNowFormatDateTime(); //当前时间
|
||||
$("#OperTime").val(thisDateTime);
|
||||
inOutService.buildNumber(); //生成单据编号
|
||||
//初始化优惠率、优惠金额、优惠后金额、本次付|收款、本次欠款 为0
|
||||
$("#Discount").val(0);
|
||||
$("#DiscountMoney").val(0);
|
||||
$("#DiscountLastMoney").val(0);
|
||||
$("#ChangeAmount").val(0);
|
||||
$("#Debt").val(0);
|
||||
$("#AccountId").val(defaultAccountId); //初始化默认的账户Id
|
||||
var addTitle = listTitle.replace("列表","信息");
|
||||
$('#depotHeadDlg').show().dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/edit_add.png"/> 增加' + addTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
depotHeadID = 0;
|
||||
var res = sessionStorage.getItem("rowInfo");
|
||||
if(pageType == "skip" && res) { //从订单跳转过来
|
||||
res = JSON.parse(res);
|
||||
$('#OrganId').combobox('setValue', res.organId);
|
||||
$("#LinkNumber").val(res.number); //关联订单号
|
||||
$("#DiscountLastMoney").val(res.totalPrice); //优惠后金额
|
||||
$("#ChangeAmount").val(res.totalPrice).attr("data-changeamount", res.totalPrice);
|
||||
depotHeadID = res.id;
|
||||
initTableData_material("edit",res.totalPrice); //商品列表
|
||||
} else {
|
||||
initTableData_material("add"); //商品列表
|
||||
}
|
||||
inOutService.reject(); //撤销下、刷新商品列表
|
||||
function supplierDlgFun(type) {
|
||||
$('#supplierDlg').dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/edit_add.png"/> 增加' + type + '信息');
|
||||
$('#supplierFM').form('clear');
|
||||
bindSupplierEvent();
|
||||
}
|
||||
$("#addOrgan").off("click").on("click",function(){
|
||||
supplierDlgFun("供应商");
|
||||
});
|
||||
$("#addMember").off("click").on("click",function(){
|
||||
supplierDlgFun("会员");
|
||||
});
|
||||
$("#addCustomer").off("click").on("click",function(){
|
||||
supplierDlgFun("客户");
|
||||
});
|
||||
$("#addAccount").off("click").on("click",function(){
|
||||
$('#accountDlg').dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/edit_add.png"/> 增加结算账户');
|
||||
$('#accountFM').form('clear');
|
||||
bindAccountEvent();
|
||||
});
|
||||
url = '/depotHead/addDepotHeadAndDetail';
|
||||
}
|
||||
//编辑信息
|
||||
function editDepotHead(index) {
|
||||
var res = $("#tableData").datagrid("getRows")[index];
|
||||
if (res.status == "1" || res.status == "2") {
|
||||
$.messager.alert('编辑提示', '已审核和已转的单据不能编辑!', 'warning');
|
||||
return;
|
||||
}
|
||||
var TotalPrice = res.totalPrice; //合计金额
|
||||
$("#Number").val(res.number).attr("data-defaultNumber",res.number);
|
||||
$("#OperTime").val(res.operTimeStr);
|
||||
$("#LinkNumber").val(res.linkNumber); //关联订单号
|
||||
$("#AccountId").val(res.accountId); //账户Id
|
||||
$("#DiscountLastMoney").val(res.discountLastMoney); //优惠后金额
|
||||
$("#ChangeAmount").val(res.changeAmount).attr("data-changeamount", res.changeAmount);
|
||||
$('#OrganId').combobox('setValue', res.organId);
|
||||
$("#Remark").val(res.remark);
|
||||
$("#Discount").val(res.discount?res.discount:0);
|
||||
$("#DiscountMoney").val(res.discountMoney?res.discountMoney:0);
|
||||
var discountlastmoney = res.discountLastMoney?res.discountLastMoney:0;
|
||||
$("#Debt").val(discountlastmoney-res.changeAmount);
|
||||
$("#AccountDay").val(res.accountDay); //结算天数
|
||||
preTotalPrice = res.totalPrice; //记录前一次合计金额,用于扣预付款
|
||||
oldNumber = res.number; //记录编辑前的单据编号
|
||||
oldId = res.id; //记录单据Id
|
||||
var editTitle = listTitle.replace("列表","信息");
|
||||
$('#depotHeadDlg').show().dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/pencil.png"/> 编辑' + editTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
depotHeadID = res.id;
|
||||
//采购入库、销售出库的多账户加载
|
||||
if(res.accountIdList && res.accountMoneyList){
|
||||
$("#AccountId").val("many"); //下拉框选中多账户
|
||||
var accountArr = res.accountIdList.split(",");
|
||||
var accountMoneyArr = res.accountMoneyList.split(",");
|
||||
accountMoneyArr = changeListFmtPlus(accountMoneyArr) //将数组单个金额中的数值转为正数
|
||||
$("#AccountId").attr("data-accountArr", JSON.stringify(accountArr)).attr("data-accountMoneyArr", JSON.stringify(accountMoneyArr)); //json数据存储
|
||||
$(".many-account-ico").show(); //显示多账户的ico图标
|
||||
} else {
|
||||
$(".many-account-ico").hide(); //隐藏多账户的ico图标
|
||||
}
|
||||
//采购入库、销售出库的费用数据加载
|
||||
if(res.otherMoneyList && res.otherMoneyItem){
|
||||
$("#OtherMoney").val(res.otherMoney); //其它费用
|
||||
var itemArr = res.otherMoneyList.split(",");
|
||||
var itemMoneyArr = res.otherMoneyItem.split(",");
|
||||
$("#OtherMoney").attr("data-itemArr",JSON.stringify(itemArr)).attr("data-itemMoneyArr",itemMoneyArr); //json数据存储
|
||||
}
|
||||
initTableData_material("edit",TotalPrice); //商品列表
|
||||
inOutService.reject(); //撤销下、刷新商品列表
|
||||
url = '/depotHead/updateDepotHeadAndDetail?id=' + res.id; //更新接口
|
||||
}
|
||||
//查看信息
|
||||
function showDepotHead(index) {
|
||||
var res = $("#tableData").datagrid("getRows")[index];
|
||||
var manyAccountMoney = 0; //多账户合计-零售
|
||||
$("#NumberShow").text(res.number);
|
||||
$("#OperTimeShow").text(res.operTimeStr);
|
||||
$('#OrganIdShow').text(res.organName);
|
||||
if(res.accountName){
|
||||
$("#AccountIdShow").text(res.accountName); //结算账户
|
||||
} else {
|
||||
if (res.accountIdList) {
|
||||
var accountArr = res.accountIdList.split(","); //账户id列表
|
||||
var accountMoneyArr = res.accountMoneyList.split(","); //账户金额列表
|
||||
var accountIdShow = "";
|
||||
for (var j = 0; j < accountArr.length; j++) {
|
||||
if (accountList != null) {
|
||||
for (var i = 0; i < accountList.length; i++) {
|
||||
var account = accountList[i];
|
||||
if (accountArr[j] == account.id) {
|
||||
var currentAccountMoney = accountMoneyArr[j] - 0;
|
||||
if (currentAccountMoney < 0) {
|
||||
currentAccountMoney = 0 - currentAccountMoney;
|
||||
}
|
||||
accountIdShow = accountIdShow + account.name + "(" + currentAccountMoney + "元) ";
|
||||
manyAccountMoney += accountMoneyArr[j] - 0; //多账户合计-零售
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$("#AccountIdShow").text(accountIdShow);
|
||||
}
|
||||
}
|
||||
$("#ChangeAmountShow").text(res.changeAmount);
|
||||
$("#RemarkShow").text(res.remark);
|
||||
$("#DiscountShow").text(res.discount);
|
||||
$("#DiscountMoneyShow").text(res.discountMoney);
|
||||
$("#DiscountLastMoneyShow").text(res.discountLastMoney);
|
||||
var debt = 0;
|
||||
if(res.otherMoney){
|
||||
debt = (res.discountLastMoney+res.otherMoney-res.changeAmount).toFixed(2);
|
||||
} else {
|
||||
debt = (res.discountLastMoney-res.changeAmount).toFixed(2);
|
||||
}
|
||||
$("#DebtShow").text(debt);
|
||||
$("#AccountDayShow").text(res.accountDay); //结算天数
|
||||
$("#LinkNumberShow").text(res.linkNumber); //关联订单号
|
||||
var otherMoney = res.otherMoney?res.otherMoney:0;
|
||||
if(otherMoney!=0 && res.otherMoneyList && res.otherMoneyItem){
|
||||
var itemArr = res.otherMoneyList.split(","); //支出项目id列表
|
||||
var itemMoneyArr = null;
|
||||
if(res.otherMoneyItem!=null) {
|
||||
itemMoneyArr = eval ("(" + res.otherMoneyItem + ")"); //支出项目金额列表
|
||||
}
|
||||
var otherMoneyShow = "";
|
||||
for(var j =0;j<itemArr.length; j++) {
|
||||
if (outItemList != null) {
|
||||
for (var i = 0; i < outItemList.length; i++) {
|
||||
var money = outItemList[i];
|
||||
if(itemArr[j] == money.Id) {
|
||||
for(var k =0;k<itemMoneyArr.length; k++) {
|
||||
if(itemMoneyArr[k].otherId == money.Id) {
|
||||
otherMoneyShow += money.InOutItemName;
|
||||
if(itemMoneyArr[k].otherMoney) {
|
||||
otherMoneyShow +="(" + itemMoneyArr[k].otherMoney +"元)";
|
||||
}
|
||||
otherMoneyShow+=",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$("#OtherMoneyShow").text(otherMoneyShow +"总计:"+ otherMoney + "元 "); //其它费用
|
||||
}
|
||||
else {
|
||||
$("#OtherMoneyShow").text(otherMoney); //其它费用
|
||||
}
|
||||
$("#payTypeShow").text(res.payType);
|
||||
var TotalPrice = res.totalPrice;
|
||||
var showTitle = listTitle.replace("列表","信息");
|
||||
$('#depotHeadDlgShow').show().dialog('open').dialog('setTitle','<img src="/js/easyui/themes/icons/list.png"/> 查看' + showTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
depotHeadID = res.id;
|
||||
initTableData_material_show(TotalPrice); //商品列表-查看状态
|
||||
}
|
||||
//初始化表格数据-商品列表-编辑状态
|
||||
function initTableData_material(type,TotalPrice) {
|
||||
var self = this;
|
||||
var body,footer,input; //定义表格和文本框
|
||||
var ratioDepot = 1; //比例-仓库用
|
||||
var monthTime = getNowFormatMonth();
|
||||
var isShowAnotherDepot = true; //显示对方仓库,true为隐藏,false为显示
|
||||
var depotHeadName = ""; //仓库名称
|
||||
var depotUrl = ""; //仓库接口地址
|
||||
var depotTextField = ""; //仓库下拉名称
|
||||
var anotherDepotHeadName = ""; //对方仓库的列的标题
|
||||
var anotherDepotUrl = ""; //对方仓库接口地址
|
||||
var anotherDepotTextField = "";
|
||||
if(listSubType == "调拨"){
|
||||
isShowAnotherDepot = false; //调拨时候显示对方仓库
|
||||
anotherDepotHeadName = "调入仓库";
|
||||
anotherDepotUrl = '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid;
|
||||
anotherDepotTextField = "depotName";
|
||||
}
|
||||
depotHeadName = "仓库名称";
|
||||
depotUrl = '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid;
|
||||
depotTextField = "depotName";
|
||||
var isShowTaxColumn = false; //是否显示税率相关的列,true为隐藏,false为显示
|
||||
if(listSubType == "调拨" || listSubType == "其它" || listSubType == "零售" || listSubType == "零售退货" || listSubType == "采购订单" || listSubType == "销售订单" || listSubType == "组装单" || listSubType == "拆卸单"){
|
||||
isShowTaxColumn = true; //隐藏
|
||||
}
|
||||
var isShowMaterialTypeColumn = true; //是否显示商品类型相关的列,true为隐藏,false为显示
|
||||
if(listSubType == "组装单" || listSubType == "拆卸单"){
|
||||
isShowMaterialTypeColumn = false; //显示
|
||||
}
|
||||
$('#materialData').datagrid({
|
||||
height:345,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//单击行是否选中
|
||||
checkOnSelect : false,
|
||||
pagination: false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
//loadFilter: pagerFilter,
|
||||
onClickRow: onClickRow,
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{ title: '商品类型',field: 'MType',editor:'validatebox',hidden:isShowMaterialTypeColumn,width:80},
|
||||
{ title: depotHeadName, field: 'DepotId', editor: 'validatebox', width: 90,
|
||||
formatter: function (value, row, index) {
|
||||
return row.DepotName;
|
||||
},
|
||||
editor: {
|
||||
type: 'combobox',
|
||||
options: {
|
||||
valueField: 'id',
|
||||
textField: depotTextField,
|
||||
method: 'get',
|
||||
url: depotUrl,
|
||||
onSelect:function(rec){
|
||||
var depotId = rec.id;
|
||||
body =$("#depotHeadFM .datagrid-body");
|
||||
footer =$("#depotHeadFM .datagrid-footer");
|
||||
input = ".datagrid-editable-input";
|
||||
var mId = body.find("[field='MaterialExtendId']").find(".textbox-value").val();
|
||||
if(mId){
|
||||
var type = "select"; //type 类型:点击 click,选择 select
|
||||
inOutService.findStockNumById(depotId, mId, monthTime, body, input, ratioDepot, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '条码_名称(规格)(型号)(扩展信息)(单位)',field: 'MaterialExtendId',width:270,
|
||||
formatter:function(value,row,index){
|
||||
return row.MaterialName;
|
||||
},
|
||||
editor:{
|
||||
type:'combogrid',
|
||||
options:{
|
||||
url: "/material/findBySelect",
|
||||
idField:'Id',
|
||||
textField:'MaterialName',
|
||||
method:'get',
|
||||
pagination: true,
|
||||
mode: 'remote',
|
||||
hasDownArrow: false,
|
||||
panelWidth: 630, //下拉框的宽度
|
||||
panelHeight: 380,//下拉框的高度
|
||||
columns:[[
|
||||
{field:'mBarCode',title:'条码',width:120},
|
||||
{field:'name',title:'名称',width:140},
|
||||
{field:'standard',title:'规格',width:80},
|
||||
{field:'model',title:'型号',width:80},
|
||||
{field:'unit',title:'单位',width:60},
|
||||
{field:'stock',title:'库存',width:50},
|
||||
{field:'expand',title:'扩展信息',width:80}
|
||||
]],
|
||||
onBeforeLoad: function(param){
|
||||
var edDepot = $('#materialData').datagrid('getEditor', {index:editIndex,field:'DepotId'});
|
||||
if(edDepot) {
|
||||
param.depotId = $(edDepot.target).combobox('getValue');
|
||||
}
|
||||
param.mpList = mPropertyList; //商品属性
|
||||
},
|
||||
onLoadSuccess: function (rec) {
|
||||
if(rec && rec.total==1) {
|
||||
$(".datagrid-body [field='mBarCode']").click(); //在只有单个商品的时候自动选中
|
||||
$("#depotHeadFM .datagrid-body").find("[field='OperNumber']").find(".datagrid-editable-input").focus().select();
|
||||
}
|
||||
},
|
||||
onSelect:function(index, rowData){
|
||||
inOutService.materialSelect(rowData,monthTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '库存',field: 'Stock',editor:'validatebox',width:50},
|
||||
{ title: anotherDepotHeadName, field: 'AnotherDepotId',editor:'validatebox',hidden:isShowAnotherDepot,width:90,
|
||||
formatter: function (value, row, index) {
|
||||
return row.AnotherDepotName;
|
||||
},
|
||||
editor: {
|
||||
type: 'combobox',
|
||||
options: {
|
||||
valueField: 'id',
|
||||
textField: anotherDepotTextField,
|
||||
method: 'get',
|
||||
url: anotherDepotUrl
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '单位',field: 'Unit',editor:'validatebox',width:60},
|
||||
{ title: '数量',field: 'OperNumber',editor:'validatebox',width:60},
|
||||
{ title: '单价',field: 'UnitPrice',editor:'validatebox',width:60},
|
||||
{ title: '含税单价',field: 'TaxUnitPrice',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '金额',field: 'AllPrice',editor:'validatebox',width:75},
|
||||
{ title: '税率(%)',field: 'TaxRate',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '税额',field: 'TaxMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '价税合计',field: 'TaxLastMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:100}
|
||||
]],
|
||||
toolbar:[
|
||||
{
|
||||
id:'append',
|
||||
text:'新增行',
|
||||
iconCls:'icon-add',
|
||||
handler:function() {
|
||||
inOutService.append(); //新增行
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'delete',
|
||||
text:'删除行',
|
||||
iconCls:'icon-remove',
|
||||
handler:function() {
|
||||
inOutService.batchDel(); //删除行
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'reject',
|
||||
text:'撤销',
|
||||
iconCls:'icon-undo',
|
||||
handler:function() {
|
||||
inOutService.reject(); //撤销
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'appendDepot',
|
||||
text:'新增仓库',
|
||||
iconCls:'icon-add',
|
||||
handler:function() {
|
||||
inOutService.appendDepot(); //新增仓库
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'appendMaterial',
|
||||
text:'新增商品',
|
||||
iconCls:'icon-add',
|
||||
handler:function() {
|
||||
js.addTabPage(null, "商品信息", "/pages/materials/material.html");
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadError:function() {
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: '/depotItem/getDetailList',
|
||||
data: {
|
||||
headerId: depotHeadID,
|
||||
mpList: mPropertyList
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
var data = res.data;
|
||||
var AllPrice = 0;
|
||||
var TaxLastMoney = 0;
|
||||
var DiscountMoney = $("#DiscountMoney").val()-0; //优惠金额
|
||||
var DiscountLastMoney = $("#DiscountLastMoney").val()-0; //优惠后金额
|
||||
if(type === "edit") {
|
||||
AllPrice = TotalPrice;
|
||||
TaxLastMoney = DiscountMoney + DiscountLastMoney;
|
||||
}
|
||||
var array = [];
|
||||
array.push({
|
||||
"AllPrice": AllPrice,
|
||||
"TaxLastMoney": TaxLastMoney
|
||||
});
|
||||
data.footer = array;
|
||||
$("#materialData").datagrid('loadData',data);
|
||||
if(type === "add") {
|
||||
$("#depotHeadDlg #append").click(); //新增行
|
||||
}
|
||||
}
|
||||
},
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
}
|
||||
});
|
||||
}
|
||||
//初始化表格数据-商品列表-查看状态
|
||||
function initTableData_material_show(TotalPrice) {
|
||||
var self = this;
|
||||
var isShowAnotherDepot = true; //显示对方仓库,true为隐藏,false为显示
|
||||
var anotherDepotHeadName = ""; //对方仓库的列的标题
|
||||
var depotHeadName = ""; //仓库的列的标题
|
||||
if(listSubType == "调拨"){
|
||||
isShowAnotherDepot = false; //调拨时候显示对方仓库
|
||||
anotherDepotHeadName = "调入仓库";
|
||||
}
|
||||
depotHeadName = "仓库名称";
|
||||
var isShowTaxColumn = false; //是否显示税率相关的列,true为隐藏,false为显示
|
||||
if(listSubType == "调拨" || listSubType == "其它" || listSubType == "零售" || listSubType == "零售退货" || listSubType == "采购订单" || listSubType == "销售订单" || listSubType == "组装单" || listSubType == "拆卸单"){
|
||||
isShowTaxColumn = true; //隐藏
|
||||
}
|
||||
var isShowMaterialTypeColumn = true; //是否显示商品类型相关的列,true为隐藏,false为显示
|
||||
if(listSubType == "组装单" || listSubType == "拆卸单"){
|
||||
isShowMaterialTypeColumn = false; //显示
|
||||
}
|
||||
$('#materialDataShow').datagrid({
|
||||
height:345,
|
||||
rownumbers: true,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
pagination: false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
columns:[[
|
||||
{ title: '商品类型',field: 'MType',width:80, hidden:isShowMaterialTypeColumn},
|
||||
{ title: depotHeadName,field: 'DepotName',editor:'validatebox',width:90},
|
||||
{ title: '条码_名称(规格)(型号)(扩展信息)(单位)',field: 'MaterialName',width:270},
|
||||
{ title: '库存',field: 'Stock',width:50},
|
||||
{ title: anotherDepotHeadName,field: 'AnotherDepotName',hidden:isShowAnotherDepot,width:90},
|
||||
{ title: '单位',field: 'Unit',editor:'validatebox',width:60},
|
||||
{ title: '数量',field: 'OperNumber',editor:'validatebox',width:60},
|
||||
{ title: '单价',field: 'UnitPrice',editor:'validatebox',width:60},
|
||||
{ title: '含税单价',field: 'TaxUnitPrice',editor:'validattebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '金额',field: 'AllPrice',editor:'validatebox',width:75},
|
||||
{ title: '税率(%)',field: 'TaxRate',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '税额',field: 'TaxMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '价税合计',field: 'TaxLastMoney',editor:'validatebox',hidden:isShowTaxColumn,width:75},
|
||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:100}
|
||||
]],
|
||||
onLoadError:function() {
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: '/depotItem/getDetailList',
|
||||
data: {
|
||||
headerId: depotHeadID,
|
||||
mpList: mPropertyList
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
var data = res.data;
|
||||
var AllPrice = TotalPrice;
|
||||
var DiscountMoney = $("#DiscountMoneyShow").text() - 0; //优惠金额
|
||||
var DiscountLastMoney = $("#DiscountLastMoneyShow").text() - 0; //优惠后金额
|
||||
var array = [];
|
||||
array.push({
|
||||
"AllPrice": AllPrice,
|
||||
"TaxLastMoney": DiscountMoney + DiscountLastMoney
|
||||
});
|
||||
data.footer = array;
|
||||
$("#materialDataShow").datagrid('loadData', data);
|
||||
}
|
||||
},
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
}
|
||||
});
|
||||
}
|
||||
//订单转采购或销售
|
||||
function skipDepotHead(index) {
|
||||
var res = $("#tableData").datagrid("getRows")[index];
|
||||
if(res.status == "0" || res.status == "2") {
|
||||
$.messager.alert('提示','未审核和已转的单据禁止操作!','warning');
|
||||
} else {
|
||||
sessionStorage.setItem("rowInfo", JSON.stringify(res)); //将单据信息存入缓存中
|
||||
if(listTitle == "采购订单列表") {
|
||||
js.addTabPage(null, "订单转采购", "/pages/materials/purchase_in_list.html?t=skip");
|
||||
} else if(listTitle == "销售订单列表") {
|
||||
js.addTabPage(null, "订单转销售", "/pages/materials/sale_out_list.html?t=skip");
|
||||
}
|
||||
}
|
||||
}
|
||||
//保存信息
|
||||
$("#saveDepotHead").off("click").on("click",function(){
|
||||
if(!$('#depotHeadFM').form('validate')){
|
||||
return;
|
||||
}
|
||||
else {
|
||||
//如果初始编号被修改了,就要判断单据编号是否存在
|
||||
if($.trim($("#Number").val()) != $('#Number').attr("data-defaultNumber")){
|
||||
//调用查询单据编号是否重名的方法
|
||||
if(inOutService.checkDepotHeadNumber()){
|
||||
return;
|
||||
}
|
||||
}
|
||||
//输入框提示
|
||||
if(!$('#OrganId').combobox('getValue')){
|
||||
$.messager.alert('提示','请选择供应商!','warning');
|
||||
return;
|
||||
}
|
||||
//进行明细的校验
|
||||
if(depotHeadID ==0) {
|
||||
//新增模式下
|
||||
if (!inOutService.CheckData("add")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//编辑模式下
|
||||
if (!inOutService.CheckData("edit")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
var OrganId = null;
|
||||
var ChangeAmount = $.trim($("#ChangeAmount").val())-0;
|
||||
var TotalPrice = $("#depotHeadFM .datagrid-footer [field='AllPrice'] div").text();
|
||||
if($('#OrganId').length){
|
||||
OrganId = $('#OrganId').combobox('getValue');
|
||||
}
|
||||
var accountMoneyList = $("#AccountId").attr("data-accountmoneyarr"); //账户金额列表-多账户
|
||||
var accountMoneyArr;
|
||||
if(accountMoneyList) {
|
||||
accountMoneyList = accountMoneyList.replace("[","").replace("]","").toString();
|
||||
var reg=new RegExp("\"","g"); //创建正则RegExp对象
|
||||
accountMoneyList = accountMoneyList.replace(reg,""); //替换所有的双引号
|
||||
accountMoneyArr = accountMoneyList.split(","); //转为数组
|
||||
}
|
||||
if(listSubType === "采购订单"||listSubType === "采购"||listSubType === "零售退货"||listSubType === "销售退货"){
|
||||
//付款为负数
|
||||
ChangeAmount = 0 - ChangeAmount;
|
||||
TotalPrice = 0 - TotalPrice;
|
||||
if(accountMoneyArr) {
|
||||
accountMoneyArr = changeListFmtMinus(accountMoneyArr); //将数组单个金额中的数值转为负数
|
||||
}
|
||||
}
|
||||
//零售时候,可以从会员预付款中扣款
|
||||
var thisPayType = "现付";
|
||||
if(listSubType === "零售") {
|
||||
if($("#payType").val() ==="预付款") {
|
||||
thisPayType = "预付款";
|
||||
}
|
||||
}
|
||||
var SalesmanStr = "";
|
||||
if(listSubType === "销售" || listSubType === "销售退货" || listSubType === "销售订单"){
|
||||
var Salesman = $('#Salesman').combobox('getValues').toString(); //销售人员
|
||||
if(Salesman) {
|
||||
var SalesmanArray = Salesman.split(",");
|
||||
for (var i = 0; i < SalesmanArray.length; i++) {
|
||||
if (i === SalesmanArray.length - 1) {
|
||||
SalesmanStr += "<" + SalesmanArray[i] + ">";
|
||||
}
|
||||
else {
|
||||
SalesmanStr += "<" + SalesmanArray[i] + ">,";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var getAccountID = $.trim($("#AccountId").val());
|
||||
if($("#AccountId").val() === "many"){ //多账户
|
||||
getAccountID = null;
|
||||
}
|
||||
var infoStr=JSON.stringify({
|
||||
Type: listType,
|
||||
SubType: listSubType,
|
||||
DefaultNumber: $.trim($("#Number").attr("data-defaultNumber")),//初始编号
|
||||
Number: $.trim($("#Number").val()),
|
||||
LinkNumber: $.trim($("#LinkNumber").val()),
|
||||
OperTime: $("#OperTime").val(),
|
||||
OrganId: OrganId,
|
||||
Salesman: SalesmanStr, //销售人员
|
||||
AccountId: getAccountID,
|
||||
ChangeAmount: ChangeAmount, //付款/收款
|
||||
TotalPrice: TotalPrice, //合计
|
||||
PayType: thisPayType, //现付/预付款
|
||||
Remark: $.trim($("#Remark").val()),
|
||||
AccountIdList: $("#AccountId").attr("data-accountarr"), //账户列表-多账户
|
||||
AccountMoneyList: accountMoneyArr ? JSON.stringify(accountMoneyArr) : "", //账户金额列表-多账户
|
||||
Discount: $.trim($("#Discount").val()),
|
||||
DiscountMoney: $.trim($("#DiscountMoney").val()),
|
||||
DiscountLastMoney: $.trim($("#DiscountLastMoney").val()),
|
||||
OtherMoney: $.trim($("#OtherMoney").val()), //其它费用
|
||||
OtherMoneyList: $("#OtherMoney").attr("data-itemarr"), //支出项目列表-涉及费用
|
||||
OtherMoneyItem: $("#OtherMoney").attr("data-itemmoneyarr"), //支出项目金额列表-涉及费用
|
||||
AccountDay: $("#AccountDay").val() //结算天数
|
||||
});
|
||||
/**
|
||||
* 零售出库,单独操作
|
||||
* */
|
||||
if(url.indexOf("/depotHead/addDepotHeadAndDetail")>=0){
|
||||
inOutService.addDepotHeadAndDetail(url,infoStr);
|
||||
} else if(url.indexOf("/depotHead/updateDepotHeadAndDetail")>=0){
|
||||
inOutService.updateDepotHeadAndDetail(url,infoStr,preTotalPrice);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
1035
erp_web/pages/bill/retail_back_list.html
Normal file
1035
erp_web/pages/bill/retail_back_list.html
Normal file
File diff suppressed because it is too large
Load Diff
1075
erp_web/pages/bill/retail_out_list.html
Normal file
1075
erp_web/pages/bill/retail_out_list.html
Normal file
File diff suppressed because it is too large
Load Diff
1063
erp_web/pages/bill/sale_back_list.html
Normal file
1063
erp_web/pages/bill/sale_back_list.html
Normal file
File diff suppressed because it is too large
Load Diff
1018
erp_web/pages/bill/sale_orders_list.html
Normal file
1018
erp_web/pages/bill/sale_orders_list.html
Normal file
File diff suppressed because it is too large
Load Diff
1099
erp_web/pages/bill/sale_out_list.html
Normal file
1099
erp_web/pages/bill/sale_out_list.html
Normal file
File diff suppressed because it is too large
Load Diff
453
erp_web/pages/manage/person.html
Normal file
453
erp_web/pages/manage/person.html
Normal file
@@ -0,0 +1,453 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>经手人管理</title>
|
||||
<meta charset="utf-8">
|
||||
<!-- 指定以IE8的方式来渲染 -->
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
|
||||
<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon"/>
|
||||
<link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="/css/jsherp.css"/>
|
||||
<script type="text/javascript" src="/js/jquery-1.8.0.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/js/easyui/themes/default/easyui.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="/js/easyui/themes/icon.css"/>
|
||||
<link type="text/css" rel="stylesheet" href="/css/common.css"/>
|
||||
<script type="text/javascript" src="/js/easyui/jquery.easyui.min.js"></script>
|
||||
<script type="text/javascript" src="/js/easyui/locale/easyui-lang-zh_CN.js"></script>
|
||||
<script type="text/javascript" src="/js/common/common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 数据显示table -->
|
||||
<div id="tablePanel" class="easyui-panel" data-options="fit:true" style="padding:1px;top:300px;" title="经手人列表" iconCls="icon-list">
|
||||
<div class="box-body form-inline">
|
||||
<div class="form-group">
|
||||
<label class="control-label">姓名:</label>
|
||||
<div class="control-inline">
|
||||
<input type="text" id="searchName" name="searchName" value="" maxlength="100" class="easyui-textbox width-90"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">类型:</label>
|
||||
<div class="control-inline">
|
||||
<select name="searchType" id="searchType" class="easyui-combobox width-90"
|
||||
data-options="panelHeight:'auto'">
|
||||
<option value="">全部</option>
|
||||
<option value="业务员">业务员</option>
|
||||
<option value="仓管员">仓管员</option>
|
||||
<option value="财务员">财务员</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" id="searchBtn">查询</a>
|
||||
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-redo" id="searchResetBtn">重置</a>
|
||||
</div>
|
||||
</div>
|
||||
<table id="tableData" style="top:300px;border-bottom-color:#FFFFFF"></table>
|
||||
</div>
|
||||
|
||||
<div id="personDlg" class="easyui-dialog" style="width:380px;padding:10px 20px"
|
||||
closed="true" buttons="#dlg-buttons" modal="true" cache="false" collapsible="false" closable="true">
|
||||
<form id="personFM" method="post" novalidate>
|
||||
<table>
|
||||
<tr>
|
||||
<td>姓名</td>
|
||||
<td style="padding:5px">
|
||||
<input name="Name" id="Name" class="easyui-textbox"
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 230px;"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>类型</td>
|
||||
<td style="padding:5px">
|
||||
<select name="Type" id="Type" class="easyui-combobox"
|
||||
data-options="panelHeight:'auto'" style="width:230px;">
|
||||
<option value="业务员">业务员</option>
|
||||
<option value="仓管员">仓管员</option>
|
||||
<option value="财务员">财务员</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<div id="dlg-buttons">
|
||||
<a href="javascript:void(0)" id="savePerson" class="easyui-linkbutton" iconCls="icon-ok">保存</a>
|
||||
<a href="javascript:void(0)" id="cancelPerson" class="easyui-linkbutton" iconCls="icon-cancel"
|
||||
onclick="javascript:$('#personDlg').dialog('close')">取消</a>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
//初始化界面
|
||||
$(function () {
|
||||
initTableData();
|
||||
ininPager();
|
||||
initForm();
|
||||
});
|
||||
|
||||
//防止表单提交重复
|
||||
function initForm() {
|
||||
$('#personFM').form({
|
||||
onSubmit: function () {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//初始化表格数据
|
||||
function initTableData() {
|
||||
$('#tableData').datagrid({
|
||||
//title:'经手人列表',
|
||||
//iconCls:'icon-save',
|
||||
//width:700,
|
||||
height: heightInfo,
|
||||
nowrap: false,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate: false,
|
||||
//选中单行
|
||||
singleSelect: true,
|
||||
collapsible: false,
|
||||
selectOnCheck: false,
|
||||
//fitColumns:true,
|
||||
//单击行是否选中
|
||||
//checkOnSelect : false,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped: true,
|
||||
//loadFilter: pagerFilter,
|
||||
pageSize: initPageSize,
|
||||
pageList: initPageNum,
|
||||
columns: [[
|
||||
{field: 'id', width: 35, align: "center", checkbox: true},
|
||||
{title: '姓名', field: 'name', width: 180},
|
||||
{title: '类型', field: 'type', width: 180},
|
||||
{
|
||||
title: '操作', field: 'op', align: "center", width: 130, formatter: function (value, rec, index) {
|
||||
var str = '';
|
||||
str += '<img src="/js/easyui/themes/icons/pencil.png" style="cursor: pointer;" onclick="editPerson(\'' + index + '\');"/> <a onclick="editPerson(\'' + index + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||
if(isShowOpFun()) {
|
||||
str += '<img src="/js/easyui/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deletePerson(' + rec.id + ');"/> <a onclick="deletePerson(' + rec.id + ');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a> ';
|
||||
}
|
||||
return str;
|
||||
}
|
||||
}
|
||||
]],
|
||||
toolbar: [
|
||||
{
|
||||
id: 'addPerson',
|
||||
text: '增加',
|
||||
iconCls: 'icon-add',
|
||||
handler: function () {
|
||||
addPerson();
|
||||
}
|
||||
},'-',
|
||||
{
|
||||
id: 'deletePerson',
|
||||
text: '删除',
|
||||
iconCls: 'icon-remove',
|
||||
handler: function () {
|
||||
batDeletePerson();
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadError: function () {
|
||||
$.messager.alert('页面加载提示', '页面加载异常,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
dgResize();
|
||||
toolbarStatus();
|
||||
showPersonDetails(1, initPageSize);
|
||||
}
|
||||
|
||||
//初始化键盘enter事件
|
||||
$(document).keydown(function (event) {
|
||||
//兼容 IE和firefox 事件
|
||||
var e = window.event || event;
|
||||
var k = e.keyCode || e.which || e.charCode;
|
||||
//兼容 IE,firefox 兼容
|
||||
var obj = e.srcElement ? e.srcElement : e.target;
|
||||
//绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件 ---遗留问题 enter键效验 对话框会关闭问题
|
||||
if (k == "13" && (obj.id == "Type" || obj.id == "Name")) {
|
||||
$("#savePerson").click();
|
||||
}
|
||||
//搜索按钮添加快捷键
|
||||
if (k == "13" && (obj.id == "searchType")) {
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
|
||||
//分页信息处理
|
||||
function ininPager() {
|
||||
try {
|
||||
var opts = $("#tableData").datagrid('options');
|
||||
var pager = $("#tableData").datagrid('getPager');
|
||||
pager.pagination({
|
||||
onSelectPage: function (pageNum, pageSize) {
|
||||
opts.pageNumber = pageNum;
|
||||
opts.pageSize = pageSize;
|
||||
pager.pagination('refresh', {
|
||||
pageNumber: pageNum,
|
||||
pageSize: pageSize
|
||||
});
|
||||
showPersonDetails(pageNum, pageSize);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
$.messager.alert('异常处理提示', "分页信息异常 : " + e.name + ": " + e.message, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
//删除经手人信息
|
||||
function deletePerson(personID) {
|
||||
$.messager.confirm('删除确认', '确定要删除此经手人信息吗?', function (r) {
|
||||
if (r) {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "/person/batchDeletePersonByIds",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
ids: personID
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code == 200) {
|
||||
$("#searchBtn").click();
|
||||
} else {
|
||||
if(res && res.code == 601){
|
||||
var jsondata={};
|
||||
jsondata.ids=personID;
|
||||
jsondata.deleteType='2';
|
||||
var type='single';
|
||||
batDeletePersonForceConfirm(res,"/person/batchDeletePersonByIds",jsondata,type);
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
}else{
|
||||
$.messager.alert('删除提示', '删除经手人信息失败,请稍后再试!', 'error');
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error: function () {
|
||||
$.messager.alert('删除提示', '删除经手人信息异常,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//批量删除经手人
|
||||
function batDeletePerson() {
|
||||
var row = $('#tableData').datagrid('getChecked');
|
||||
if (row.length == 0) {
|
||||
$.messager.alert('删除提示', '没有记录被选中!', 'info');
|
||||
return;
|
||||
}
|
||||
if (row.length > 0) {
|
||||
$.messager.confirm('删除确认', '确定要删除选中的' + row.length + '条经手人信息吗?', function (r) {
|
||||
if (r) {
|
||||
var ids = "";
|
||||
for (var i = 0; i < row.length; i++) {
|
||||
if (i == row.length - 1) {
|
||||
ids += row[i].id;
|
||||
break;
|
||||
}
|
||||
//alert(row[i].id);
|
||||
ids += row[i].id + ",";
|
||||
}
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "/person/batchDeletePersonByIds",
|
||||
dataType: "json",
|
||||
async: false,
|
||||
data: ({
|
||||
ids: ids
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
$("#searchBtn").click();
|
||||
$(":checkbox").attr("checked", false);
|
||||
} else {
|
||||
if(res && res.code == 601){
|
||||
var jsondata={};
|
||||
jsondata.ids=ids;
|
||||
jsondata.deleteType='2';
|
||||
var type='batch';
|
||||
batDeletePersonForceConfirm(res,"/person/batchDeletePersonByIds",jsondata,type);
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
}else{
|
||||
$.messager.alert('删除提示', '删除经手人信息失败,请稍后再试!', 'error');
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error: function () {
|
||||
$.messager.alert('删除提示', '删除经手人信息异常,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 确认强制删除
|
||||
* */
|
||||
function batDeletePersonForceConfirm(res,url,jsondata,type) {
|
||||
$.messager.confirm('删除确认', res.msg, function (r) {
|
||||
if (r) {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
data: (jsondata),
|
||||
success: function (res) {
|
||||
if(res && res.code == 200) {
|
||||
$("#searchBtn").click();
|
||||
if(type=='batch'){
|
||||
$(":checkbox").attr("checked", false);
|
||||
}
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
}else {
|
||||
$.messager.alert('删除提示', '删除经手人信息异常,请稍后再试!', 'error');
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error: function () {
|
||||
$.messager.alert('删除提示', '删除经手人信息异常,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//增加
|
||||
var url;
|
||||
var personID = 0;
|
||||
//保存编辑前的名称
|
||||
var oldPerson = "";
|
||||
|
||||
function addPerson() {
|
||||
if(checkPower()){
|
||||
return;
|
||||
}
|
||||
$('#personFM').form('clear');
|
||||
$('#personDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui/themes/icons/edit_add.png"/> 增加经手人信息');
|
||||
$(".window-mask").css({width: webW, height: webH});
|
||||
$("#name").val("").focus();
|
||||
|
||||
oldPerson = "";
|
||||
personID = 0;
|
||||
url = '/person/add';
|
||||
}
|
||||
|
||||
//保存信息
|
||||
$("#savePerson").off("click").on("click", function () {
|
||||
if(!$('#personFM').form('validate')){
|
||||
return;
|
||||
}
|
||||
if (!$("#Type").val()) {
|
||||
$.messager.alert('提示', '请选择类型!', 'warning');
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
async: false,
|
||||
data: ({
|
||||
info: JSON.stringify($("#personFM").serializeObject())
|
||||
}),
|
||||
success: function(res) {
|
||||
if(res && res.code === 200) {
|
||||
$('#personDlg').dialog('close');
|
||||
//加载完以后重新初始化
|
||||
var opts = $("#tableData").datagrid('options');
|
||||
showPersonDetails(opts.pageNumber, opts.pageSize);
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error: function () {
|
||||
$.messager.alert('提示', '保存经手人信息异常,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//编辑信息
|
||||
function editPerson(index) {
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
$("#Name").textbox("setValue", rowsdata.name);
|
||||
$("#Type").combobox("setValue", rowsdata.type);
|
||||
$('#personDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui/themes/icons/pencil.png"/> 编辑经手人信息');
|
||||
$(".window-mask").css({width: webW, height: webH});
|
||||
if(!isShowOpFun()){
|
||||
$("#savePerson").hide();
|
||||
}
|
||||
personID = rowsdata.id;
|
||||
url = '/person/update?id=' + rowsdata.id;
|
||||
}
|
||||
|
||||
//搜索处理
|
||||
$("#searchBtn").unbind().bind({
|
||||
click: function () {
|
||||
showPersonDetails(1, initPageSize);
|
||||
var opts = $("#tableData").datagrid('options');
|
||||
var pager = $("#tableData").datagrid('getPager');
|
||||
opts.pageNumber = 1;
|
||||
opts.pageSize = initPageSize;
|
||||
pager.pagination('refresh', {
|
||||
pageNumber: 1,
|
||||
pageSize: initPageSize
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function showPersonDetails(pageNo, pageSize) {
|
||||
var name = $.trim($("#searchName").val());
|
||||
var type = $.trim($("#searchType").val());
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "/person/list",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
search: JSON.stringify({
|
||||
name: name,
|
||||
type: type
|
||||
}),
|
||||
currentPage: pageNo,
|
||||
pageSize: pageSize
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200){
|
||||
if(res.data && res.data.page) {
|
||||
$("#tableData").datagrid('loadData', res.data.page);
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error: function () {
|
||||
$.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//重置按钮
|
||||
$("#searchResetBtn").unbind().bind({
|
||||
click: function () {
|
||||
$("#searchName").textbox("clear");
|
||||
$("#searchType").combobox("clear");
|
||||
//加载完以后重新初始化
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user