Index: ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/godownOutToSupplyRoomView.js =================================================================== diff -u -r33204 -r34182 --- ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/godownOutToSupplyRoomView.js (.../godownOutToSupplyRoomView.js) (revision 33204) +++ ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/godownOutToSupplyRoomView.js (.../godownOutToSupplyRoomView.js) (revision 34182) @@ -23,6 +23,7 @@ {name : 'type'}, {name : 'amount'}, {name : 'price'}, + {name : 'totalPrice'}, {name : 'batchNumber'}, {name : 'expDate'}, {name : 'supplierName'}, @@ -32,6 +33,15 @@ //弹窗提示管理器 var tipManager = {}; +//设置总金额 +var sumPriceText = new top.Ext.Toolbar.TextItem({ + text : '总金额:' +}); + +var sumPrice = new top.Ext.Toolbar.TextItem({ + text : '0' +}); + // 清除表单数据 function clearFormData(){ diposableGoodsBatchNumStore.removeAll(); @@ -88,6 +98,12 @@ } } } +//设置总金额 +function setSumPrice(totalPrice){ + var element = top.Ext.get(sumPrice.el); + var sum = parseFloat(element.dom.innerText); + element.update((sum + parseFloat(totalPrice)).toFixed(2)); +} //获取当前选中的批次 function getSelectedBatch(){ @@ -264,11 +280,13 @@ type : '一次性物品', amount : 1, price : price, + totalPrice : totalPrice, batchNumber : batchNumber, expDate : expDate, supplierName : supplierName }); top.Ext.getCmp('receiveRecordItemGrid').getStore().add(receiveRecordItem); + setSumPrice(totalPrice); } //往发货详情添加一次性物品记录 function addDiposableGoods() { @@ -306,7 +324,7 @@ } var objID = batch.disposableGoodsBatchID; - var price = priceAmount.price; + var price = parseFloat(priceAmount.price); var batchNumber = batch.batchNumber; var expDate = batch.expDate; var supplierName = batch.supplierName; @@ -320,6 +338,8 @@ return false; } } + + var totalPrice = parseFloat(price * amount).toFixed(2); var receiveRecordItem = new ReceiveRecordItem({ id : "", @@ -332,6 +352,7 @@ type : '一次性物品', amount : amount, price : price, + totalPrice : totalPrice, batchNumber : batchNumber, expDate : expDate, supplierName : supplierName @@ -344,6 +365,8 @@ // top.Ext.getCmp('diposableGoodsCost').setValue('');// 清除数量输入域 clearBatchNumberAndPrice();// 清空批次和价格 + + setSumPrice(totalPrice); // top.Ext.getCmp('batchNumber1').setValue(''); // top.Ext.getCmp('diposableGoodsExpDate').setValue(''); @@ -397,6 +420,8 @@ } } + var totalPrice = parseFloat(amount * price).toFixed(2); + var receiveRecordItem = new ReceiveRecordItem({ id : '', objID : materialId, @@ -406,6 +431,7 @@ price : price, batchNumber : '', expDate : '', + totalPrice: totalPrice, supplierName : '' }); top.Ext.getCmp('receiveRecordItemGrid').getStore().add(receiveRecordItem); @@ -417,6 +443,8 @@ top.Ext.getCmp('materialCost').setValue(''); top.Ext.getCmp('materialCombo').setValue(''); top.Ext.getCmp('materialCombo').focus(); + + setSumPrice(totalPrice); } //删除按钮 @@ -638,6 +666,7 @@ {header : "批次",width : 100,dataIndex : 'batchNumber',menuDisabled : true}, {header : "失效日期",width : 100,dataIndex : 'expDate',menuDisabled : true}, {header : "单价",dataIndex : 'price',width : 50,menuDisabled : true}, + {header : "金额",dataIndex : 'totalPrice',width : 80,menuDisabled : true}, {id : 'expandColumn',header : "供应商",width : 100,dataIndex : 'supplierName',menuDisabled : true}, {header : "删除",width : 100,menuDisabled : true,dataIndex : 'deleteButton', renderer:renderDeleteButton} ]), @@ -835,6 +864,7 @@ addDiposableGoods(); } }], + bbar:[sumPriceText,sumPrice], listeners: { render : function() { var tbar = new top.Ext.Toolbar ({ @@ -977,6 +1007,8 @@ top.Ext.getCmp('btnSave').setDisabled(false); //加载仓库 cssdWareHouseStore.load(); + var element = top.Ext.get(sumPrice.el); + element.update(0); } // 删除 @@ -1050,7 +1082,11 @@ top.Ext.getCmp('cssdWareHouse').setRawValue(action.result.data.warehouseName); top.Ext.getCmp("diposableGoodsName").setDisabled(false); top.Ext.getCmp("materialCombo").setDisabled(false); + var sumPrice = 0; for(var i = 0 ;i < action.result.data.items.length ;i++){ + var cost = parseFloat(action.result.data.items[i].cost).toFixed(2); + var amount = parseInt(action.result.data.items[i].amount); + var totalPrice = parseFloat(cost * amount).toFixed(2); var godownOutItem = new ReceiveRecordItem({ id : action.result.data.items[i].id, diposableGoodsID : action.result.data.items[i].diposableGoodsID, @@ -1062,15 +1098,20 @@ objID : action.result.data.items[i].objID, type : action.result.data.items[i].type, name : action.result.data.items[i].name, - amount : action.result.data.items[i].amount, - price : action.result.data.items[i].cost, + amount : amount, + price : cost, + totalPrice: totalPrice, batchNumber : action.result.data.items[i].batchNumber, expDate : action.result.data.items[i].expDate, supplierName : action.result.data.items[i].supplierName }); top.Ext.getCmp('receiveRecordItemGrid').getStore().add(godownOutItem); + + sumPrice += parseFloat(totalPrice).toFixed(2); } + + setSumPrice(sumPrice); // 保存原始数据,只需要保存需要修改的属性 setOriginalFormParams(form,['id','remark','time']); var originalItems = buildJSONStringFromStore(top.Ext.getCmp('receiveRecordItemGrid').getStore()); @@ -1129,7 +1170,8 @@ } var columns = [ {header : "领用时间",width : 200,dataIndex : 'time' , renderer : editLink}, - {header: "物品明细", width: 500, dataIndex: 'brief', hidden : !sstsConfig.showGoodDetail}, + {header: "物品明细", width: 500, dataIndex: 'brief', hidden : !sstsConfig.showGoodDetail,sortable :false}, + {header : "总金额",width : 100,dataIndex : 'totalPriceStr',sortable :false}, {header : "领用科室",width : 200,dataIndex : 'depart'}, {header : "领取仓库",width : 200,dataIndex : 'warehouseName'}, {header : "操作员",width : 200,dataIndex : 'operator'}, @@ -1141,6 +1183,7 @@ {name : 'depart'}, {name : 'warehouseName'}, {name : 'operator'}, + {name : 'totalPriceStr'}, {name: 'brief'}, {name : 'time'}, {name : 'remark'} @@ -1218,6 +1261,7 @@ columns : columns, plugins: filters, autoExpandColumn : 'operationRemark', + searchDisableIndexes:['totalPriceStr','brief'], renderTo : 'gridDiv', frame : false }, readerDetail,