Index: ssts-web/src/main/webapp/disinfectsystem/config/ggsrmyy/config.js =================================================================== diff -u -r26863 -r26887 --- ssts-web/src/main/webapp/disinfectsystem/config/ggsrmyy/config.js (.../config.js) (revision 26863) +++ ssts-web/src/main/webapp/disinfectsystem/config/ggsrmyy/config.js (.../config.js) (revision 26887) @@ -223,5 +223,9 @@ //PDA上是否启用器械包签收功能 enablePDATousseSign : true, //启用贵港医院核算月报报表 - enableMonthlyAccountingReportForGuiGang : true + enableMonthlyAccountingReportForGuiGang : true, + //一次性物品盘点单要显示的额外列,配置为如下: + disposableGoodsInventoryShowExtraColumns:["盘点差异","实存金额","差异金额"], + //一次性物品盘点表导出格式(当没有该配置项或者值为1时,格式为原来的格式) + disposableGoodsInventoryExportFormat : 2 } \ No newline at end of file Index: ssts-web/src/main/webapp/disinfectsystem/stocktakerecordmanager/inventoryDisposableGoodsForm.js =================================================================== diff -u -r26533 -r26887 --- ssts-web/src/main/webapp/disinfectsystem/stocktakerecordmanager/inventoryDisposableGoodsForm.js (.../inventoryDisposableGoodsForm.js) (revision 26533) +++ ssts-web/src/main/webapp/disinfectsystem/stocktakerecordmanager/inventoryDisposableGoodsForm.js (.../inventoryDisposableGoodsForm.js) (revision 26887) @@ -1,3 +1,4 @@ +var eventEdit = null; function isExistItem(name,sp,batchNumber,price){ var exist = false; var itemsStore = top.Ext.getCmp('inventoryRecordForm').getStore(); @@ -15,6 +16,38 @@ return exist; } +function setTotal(grid){ + var totalAmount = 0; + var totalInventoryAmount = 0; + var totalAmountDifferent = 0; + var totalRealityMoney = 0; + var totalDifferencMoney = 0; + + grid.getStore().each(function(record){ + totalAmount = add(totalAmount,record.data.amount); + + if(!(record.data.inventoryAmount === "")){ + var inventoryAmount = Number(record.data.inventoryAmount); + totalInventoryAmount = add(inventoryAmount,totalInventoryAmount);//计算精度 + + var amountDifferenceResult = sub(record.data.inventoryAmount,record.data.amount); + totalAmountDifferent = add(totalAmountDifferent,amountDifferenceResult); + + + var realityMoneyResult = mul(record.data.inventoryAmount,record.data.cost); + totalRealityMoney = add(totalRealityMoney,realityMoneyResult); + + var differencMoneyResult = mul(amountDifferenceResult,record.data.cost); + totalDifferencMoney = add(totalDifferencMoney,differencMoneyResult); + } + }); + + top.Ext.getCmp('amountTotal').setValue(totalAmount); + top.Ext.getCmp('inventoryAmountTotal').setValue(totalInventoryAmount); + top.Ext.getCmp('amountDifferentTotal').setValue(totalAmountDifferent); + top.Ext.getCmp('realityMoneyTotal').setValue(totalRealityMoney); + top.Ext.getCmp('differencMoneyTotal').setValue(totalDifferencMoney); +} function addItem(batchId,name,specification,amount,batchNumber,cost,supplierName,expDateStr,externalCode,goodsType,sequence,type,unit){ var itemsStore = top.Ext.getCmp('inventoryRecordForm').getStore(); var inventoryItem = new inventoryRecordItem({ @@ -35,6 +68,7 @@ unit : unit }); itemsStore.insert(0 , inventoryItem); + setTotal(top.Ext.getCmp('inventoryRecordForm')); } //一次性物品盘点记录 @@ -55,7 +89,9 @@ {name : 'name'}, {name : 'amount'}, {name : 'inventoryAmount'}, - {name : 'amountDifferent'}, + {name : 'amountDifferent'}, + {name : 'realityMoney'}, + {name : 'differencMoney'}, {name : 'batchNumber'}, {name : 'cost'}, {name : 'specification'}, @@ -113,15 +149,22 @@ ] }) }); + + itemsStore.load({ + params:{id:recordId}, + callback: function(records,options,success) { + setTotal(top.Ext.getCmp('inventoryRecordForm')); + } + } + ); - itemsStore.load({params:{id:recordId}}); - form = new top.Ext.FormPanel({ id : 'godownEntryForm', frame : true, labelSeparator : ':', bodyStyle : 'padding:5px 5px 0px 5px', - width : 985, + width:top.screen.width > 1600 ? 1600 : top.screen.width-10, + //width : 1366, height : 547, autoScroll : true, labelAlign : 'left', @@ -187,7 +230,7 @@ sm : selectModel, // height : 460, height : top.screen.height > 800 ? 465 : 375, - width :1150, + width:1566, viewConfig: { forceFit:true }, @@ -203,16 +246,55 @@ {header : "批次",width : 40,dataIndex : 'batchNumber',menuDisabled : true}, {header : "生产日期",hidden : !sstsConfig.showProduceDateOfDisposableGoods, width : 48,dataIndex : 'produceDate',menuDisabled : true}, {header : "失效日期",width : 42,dataIndex : 'expDate',menuDisabled : true}, - {header : "账面数量",dataIndex : 'amount',width : 35,menuDisabled : true,renderer : isChange}, - {header : "盘点数量",dataIndex : 'inventoryAmount',css: 'background: #F0F0F0;',width : 35,menuDisabled : true, - editor : new top.Ext.form.TextField({ - regex: /^\d+$/, - regexText:'只能输入数字', - allowBlank : false + {header : "账面数量",dataIndex : 'amount',width : 42,menuDisabled : true,renderer : isChange}, + {header : "盘点数量",dataIndex : 'inventoryAmount',width : 42,css: 'background: #F0F0F0;',menuDisabled : true, + editor : new top.Ext.form.NumberField({ + //regex: /^\d+$/, + //regexText:'只能输入数字', + allowBlank : false, + listeners : { + specialKey : function(field,event){ + var eventKey = event.getKey(); + if(eventKey == 13){ + var editRecord = top.Ext.getCmp('inventoryRecordForm').getStore().getAt(eventEdit.row); + editRecord.data.inventoryAmount = field.getValue(); + var amount = editRecord.data.amount;//账面数量 + var inventoryVal = sub(field.getValue(),amount); //盘点差异 + var cost = editRecord.data.cost; + var realityMoneys = mul(editRecord.data.inventoryAmount,cost);//实存金额 + var differencMoneys = mul(inventoryVal,cost);//差异金额 + + editRecord.data.amountDifferent = inventoryVal; + editRecord.data.realityMoney = realityMoneys; + editRecord.data.differencMoney = differencMoneys; + top.Ext.getCmp('inventoryRecordForm').getView().refresh(); + setTotal(top.Ext.getCmp('inventoryRecordForm')); + return false; + } + }, + change: function(v,n,o) { + var editRecord = top.Ext.getCmp('inventoryRecordForm').getStore().getAt(eventEdit.row); + editRecord.data.inventoryAmount = n; + var amount = editRecord.data.amount;//账面数量 + var inventoryVal = sub(n,amount); //盘点差异 + var cost = editRecord.data.cost; + var realityMoneys = mul(editRecord.data.inventoryAmount,cost);//实存金额 + var differencMoneys = mul(inventoryVal,cost);//差异金额 + + editRecord.data.amountDifferent = inventoryVal; + editRecord.data.realityMoney = realityMoneys; + editRecord.data.differencMoney = differencMoneys; + + top.Ext.getCmp('inventoryRecordForm').getView().refresh(); + setTotal(top.Ext.getCmp('inventoryRecordForm')); + } + } }) }, - {header : "盘点差异",dataIndex : 'amountDifferent',hidden: status=="已更新"?false:true,sortable : true,width : 35,menuDisabled : false,renderer : amountDifferenceChange}, - {header : "单价",dataIndex : 'cost',width : 30,menuDisabled : true}, + {header : "盘点差异",width :70,dataIndex : 'amountDifferent',hidden:status=="已更新"?false:true,sortable : true,menuDisabled : false,renderer : amountDifferenceChange2}, + {header : "实存金额",width :65,dataIndex : 'realityMoney',menuDisabled : true,hidden:true,renderer : realityMoneyChange}, + {header : "差异金额",width :65,dataIndex : 'differencMoney',menuDisabled : true,hidden:true,renderer : differencMoneyChange}, + {header : "单价",dataIndex : 'cost',width : 30,menuDisabled : true}, {header : "单位",dataIndex : 'unit',width : 22,menuDisabled : true}, {header : "供应商",width : 55,dataIndex : 'supplierName',menuDisabled : true}, {header : "高值耗材操作",dataIndex : 'goodsType',width : 48,menuDisabled : true, @@ -394,7 +476,60 @@ } } } - }] + }], + bbar : [{ + text : '合计:' + },{ + text : '账面数量:' + },{ + xtype : 'numberfield', + id : 'amountTotal', + name : 'amountTotal', + allowNegative : true, + readOnly : true, + width : 100 + },{ + text : '盘点数量:' + },{ + xtype : 'numberfield', + id : 'inventoryAmountTotal', + name : 'inventoryAmountTotal', + allowNegative : true, + readOnly : true, + width : 100 + },{ + text : '盘点差异:' + },{ + xtype : 'numberfield', + id : 'amountDifferentTotal', + name : 'amountDifferentTotal', + allowNegative : true, + readOnly : true, + width : 100 + },{ + text : '实存金额:' + },{ + xtype : 'numberfield', + id : 'realityMoneyTotal', + name : 'realityMoneyTotal', + allowNegative : true, + readOnly : true, + width : 100 + },{ + text : '差异金额:' + },{ + xtype : 'numberfield', + id : 'differencMoneyTotal', + name : 'differencMoneyTotal', + allowNegative : true, + readOnly : true, + width : 100 + }], + listeners: { + beforeedit: function(obj){ + eventEdit = obj; + } + } })], buttons : [{ text : '导入盘点数量', @@ -471,7 +606,7 @@ id : 'inventoryItemWin', layout : 'fit', title : '盘点信息', - width : 1020, + width : top.screen.width > 1600 ? 1600 : top.screen.width-10, height : top.screen.height > 800 ? 600 : 520, // height :680, modal : true, @@ -495,7 +630,22 @@ } }) }); + window.show(); + //一次性物品盘点单要显示的额外列,配置了就显示 + if(sstsConfig.disposableGoodsInventoryShowExtraColumns && sstsConfig.disposableGoodsInventoryShowExtraColumns.length > 0){ + var columns = top.Ext.getCmp('inventoryRecordForm').getColumnModel(); + for(var i = 0;i < sstsConfig.disposableGoodsInventoryShowExtraColumns.length;i++){ + var columnList = sstsConfig.disposableGoodsInventoryShowExtraColumns[i]; + var columnArry = columns.config; + for(var j = 2;j < columnArry.length;j++){ + var headerList = columnArry[j].header; + if(columnList == headerList){ + top.Ext.getCmp('inventoryRecordForm').getColumnModel().setHidden(j ,false); + } + } + } + } function cleanSelect(){ top.Ext.getCmp('name').setValue(""); @@ -591,6 +741,7 @@ // } } } + setTotal(top.Ext.getCmp('inventoryRecordForm')); } } //匹配导入盘点单 @@ -657,7 +808,8 @@ frame : true, labelSeparator : ':', bodyStyle : 'padding:5px 5px 0px 5px', - width : 985, + width : top.screen.width > 1600 ? 1600 : top.screen.width-10, + //width : 985, height : 547, autoScroll : true, labelAlign : 'left', @@ -722,7 +874,7 @@ frame :false, autoScroll : false, sm : selectModel2, - height : top.screen.height > 800 ? 490 : 380, + height : top.screen.height > 800 ? 480 : 380, viewConfig: { forceFit:true }, Index: ssts-web/src/main/webapp/disinfectsystem/stocktakerecordmanager/inventoryrecordView.js =================================================================== diff -u -r26757 -r26887 --- ssts-web/src/main/webapp/disinfectsystem/stocktakerecordmanager/inventoryrecordView.js (.../inventoryrecordView.js) (revision 26757) +++ ssts-web/src/main/webapp/disinfectsystem/stocktakerecordmanager/inventoryrecordView.js (.../inventoryrecordView.js) (revision 26887) @@ -47,6 +47,28 @@ return v; } } + +//盘点差值渲染 盘点数量-账面数量 +function amountDifferenceChange2(v, p, record){ + var amountDifferenceChange = record.get("amountDifferent"); + var inventoryAmount = record.get("inventoryAmount"); + if(inventoryAmount == ""){ + return; + } + var amount = record.get("amount"); + var amountDifferenceVal = sub(inventoryAmount,amount); + + if(amountDifferenceVal > 0){ + return "

" + amountDifferenceVal + "

"; + }else if(amountDifferenceVal < 0){ + return "

" + amountDifferenceVal + "

" + }else if(amountDifferenceChange == "" || amountDifferenceChange == undefined || amountDifferenceChange == null){ + return 0; + }else{ + return v; + } +} + //盘点差值渲染 function amountDifferenceChange(v, p, record){ var amountDifferenceChange = record.get("amountDifferent"); @@ -58,6 +80,34 @@ return v; } } + +// 实存金额 = 盘点数量*单价 +function realityMoneyChange(v, p, record){ + var inventoryAmount = record.get("inventoryAmount"); + if(!(inventoryAmount === "")){ + var cost = record.get("cost"); + var realityMoney = mul(inventoryAmount,cost); + return realityMoney; + }else{ + return v; + } +} + +// 差异金额 = 盘点差异*单价 +function differencMoneyChange(v, p, record){ + var inventoryAmount = record.get("inventoryAmount"); + if(!(inventoryAmount === "")){ + var amount = record.get("amount"); + var inventoryVal = sub(inventoryAmount,amount); + + var cost = record.get("cost"); + var differencMoney = mul(inventoryVal,cost); + return differencMoney; + }else{ + return v; + } +} + var inventoryRecordItem = Ext.data.Record.create([ {name : 'id'}, {name : 'disposableGoodsBatchId'},