优化单据的代码结构
This commit is contained in:
@@ -439,30 +439,6 @@
|
||||
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,
|
||||
@@ -482,8 +458,7 @@
|
||||
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,
|
||||
{ title: '仓库名称', field: 'DepotId', editor: 'validatebox', width: 90,
|
||||
formatter: function (value, row, index) {
|
||||
return row.DepotName;
|
||||
},
|
||||
@@ -491,9 +466,9 @@
|
||||
type: 'combobox',
|
||||
options: {
|
||||
valueField: 'id',
|
||||
textField: depotTextField,
|
||||
textField: 'depotName',
|
||||
method: 'get',
|
||||
url: depotUrl,
|
||||
url: '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid,
|
||||
onSelect:function(rec){
|
||||
var depotId = rec.id;
|
||||
body =$("#depotHeadFM .datagrid-body");
|
||||
@@ -553,7 +528,7 @@
|
||||
}
|
||||
},
|
||||
{ title: '库存',field: 'Stock',editor:'validatebox',width:50},
|
||||
{ title: anotherDepotHeadName, field: 'AnotherDepotId',editor:'validatebox',hidden:isShowAnotherDepot,width:90,
|
||||
{ title: '调入仓库', field: 'AnotherDepotId',editor:'validatebox',width:90,
|
||||
formatter: function (value, row, index) {
|
||||
return row.AnotherDepotName;
|
||||
},
|
||||
@@ -561,20 +536,16 @@
|
||||
type: 'combobox',
|
||||
options: {
|
||||
valueField: 'id',
|
||||
textField: anotherDepotTextField,
|
||||
textField: 'depotName',
|
||||
method: 'get',
|
||||
url: anotherDepotUrl
|
||||
url: '/depot/findDepotByUserId?UBType=UserDepot&UBKeyId='+kid
|
||||
}
|
||||
}
|
||||
},
|
||||
{ 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:[
|
||||
@@ -663,22 +634,6 @@
|
||||
//初始化表格数据-商品列表-查看状态
|
||||
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,
|
||||
@@ -693,19 +648,14 @@
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
columns:[[
|
||||
{ title: '商品类型',field: 'MType',width:80, hidden:isShowMaterialTypeColumn},
|
||||
{ title: depotHeadName,field: 'DepotName',editor:'validatebox',width:90},
|
||||
{ title: '仓库名称',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: 'AnotherDepotName',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() {
|
||||
@@ -741,20 +691,6 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
//订单转采购或销售
|
||||
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')){
|
||||
@@ -795,36 +731,8 @@
|
||||
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;
|
||||
@@ -853,9 +761,6 @@
|
||||
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){
|
||||
|
||||
Reference in New Issue
Block a user