Index: ssts-web/src/main/webapp/disinfectsystem/invoice/customInvoiceForm.js =================================================================== diff -u -r22953 -r24559 --- ssts-web/src/main/webapp/disinfectsystem/invoice/customInvoiceForm.js (.../customInvoiceForm.js) (revision 22953) +++ ssts-web/src/main/webapp/disinfectsystem/invoice/customInvoiceForm.js (.../customInvoiceForm.js) (revision 24559) @@ -93,20 +93,58 @@ var name = rows[i].data['name']; var amount = rows[i].data['count']; sendOutGoodsStore.remove(rows[i]); - updateAmount1(name,amount); + refreshSumInfo(); sendDeleteScannedGoodsLog(rows[i].data); } } } +// 刷新汇总信息 +function refreshSumInfo(){ + var map = {}; + var submitItems = []; + recyclingapplicationStore.removeAll(); + for ( var i = 0; i < sendOutGoodsStore.getCount(); i++) { + var scanItem = sendOutGoodsStore.getAt(i).data; + var showTousseName = scanItem.showTousseName; + var amount = scanItem.count; + var fluctuationPrice = parseFloat(scanItem.fluctuationPrice); + var item = map[showTousseName]; + if(item){ + item.fluctuationPrice += fluctuationPrice; + item.amount += amount; + }else{ + item = { + showTousseName:showTousseName, + fluctuationPrice:fluctuationPrice, + amount:amount + } + map[showTousseName] = item; + } + } + var totalFluctuationPrice = 0; + var totalAmount = 0; + for( var showTousseName in map ){ + if(map.hasOwnProperty(showTousseName)){ + totalFluctuationPrice += map[showTousseName].fluctuationPrice; + totalAmount += map[showTousseName].amount; + + var record = new SumGridItem(map[showTousseName]); + recyclingapplicationStore.insert(0,record); + } + } + top.Ext.getCmp('sum_price').setText("总价:"+totalFluctuationPrice); + top.Ext.getCmp('sum_amount').setText("数量:"+totalAmount); +} //删除发货明细项 function removeSendOutTousseByBarcode(barcode){ var record = findRecordByNameAndValueFromStore(sendOutGoodsStore,'barcode',barcode); if(record != null){ var name = record.data['name']; sendOutGoodsStore.remove(record); - updateAmount1(name,1); + + refreshSumInfo(); } } @@ -166,6 +204,15 @@ {name : 'tousseDefinitionId'} ]); +var SumGridItem = Ext.data.Record.create([ + {name : 'id'}, + {name : 'name'}, + {name : 'showTousseName'}, + {name : 'amount'}, + {name : 'price'}, + {name : 'fluctuationPrice'} + ]); + // 根据条码获取发送项 function getSendOutGoodsRecordByBarcode(barcode){ if(isUndefinedOrNullOrEmpty(barcode)){ @@ -265,7 +312,7 @@ } speakBasket.addGoods('',goods.showTousseName,totalAmount); - + refreshSumInfo(); // clearScanText(); } @@ -508,33 +555,23 @@ ] }); + //申请物品 + recyclingapplicationStore = new Ext.data.Store({ + reader : new Ext.data.JsonReader({ + fields : [ + {name : 'id'}, + {name : 'showTousseName'}, + {name : 'amount'}, + {name : 'fluctuationPrice'} + ] + }) + }); + var recyclingapplicationCm = new Ext.grid.ColumnModel([ - {header : "申请的物品",dataIndex : 'showTousseName',width : 180,menuDisabled: true}, - {header : "name",dataIndex : 'name',hidden : true,menuDisabled: true}, - {header : "待发",dataIndex : 'count',width : 50, menuDisabled: true/*, - editor : new Ext.form.TextField( { - allowBlank : false, - listeners : { - focus : function(thiz){ - thiz.selectText(); - } - } - })*/ - }, - {header : '加急',id : 'urgentAmount',dataIndex : 'urgentAmount',width : 50,value : 0, menuDisabled: true,renderer:getDefaultAmount}, - {header : '实发',id : 'tempAmount',dataIndex : 'tempAmount',width : 50,value : 0, menuDisabled: true,renderer:getDefaultAmount}, - {header : '误差',id : 'errorAmount',dataIndex : 'errorAmount',width : 50,value : 0, menuDisabled: true,renderer:getDefaultAmount}, - {header : '库存',id : 'storage',dataIndex : 'storage',width : 50,value : 0, menuDisabled: true,renderer:formatStorage}, - {id : 'diposable',header : "是否一次性材料",dataIndex : 'diposable',hidden :true}, - {id :'applicationAmount',header : "最大发货数量",dataIndex : 'applicationAmount',hidden : true,width :150} -// {id : 'deleteItem',header:'删除',hidden :true,width :40,menuDisabled: true, -// renderer: function(v,p,record){ -// var str = ""; -// return str; -// }, -// dataIndex:'button' -// } + {id : 'sum_tousseName',header : "物品名称",dataIndex : 'showTousseName',width : 100,menuDisabled: true}, + {header : '单价',dataIndex : 'fluctuationPrice',width : 50,value : 0, menuDisabled: true}, + {header : '数量',dataIndex : 'amount',width : 50,value : 0, menuDisabled: true} ]); var recyclingErrorCm = new Ext.grid.ColumnModel([ @@ -735,8 +772,9 @@ layout : 'form', labelWidth :70, columnWidth :.33, + hidden: !getSystemSetConfig('showInvoiceAssistantSender',true), items : [{ - xtype : 'textfield', + xtype : 'textfield', fieldLabel : '核对员条码', maxLength : '16', id : 'senderBarcode', @@ -752,7 +790,7 @@ var resultArray = userName.split(":"); if(resultArray[0] == "success"){ top.Ext.getCmp('sender').setValue(resultArray[1]); - Ext.state.Manager.getProvider().set('cookieSender',resultArray[1]); + Ext.state.Manager.getProvider().set('cookieAssistantSender',resultArray[1]); }else{ showResult(resultArray[1]); top.Ext.getCmp('sender').setValue(""); @@ -770,6 +808,7 @@ layout : 'form', labelWidth :70, columnWidth :.33, + hidden: !getSystemSetConfig('showInvoiceAssistantSender',true), items : [{ xtype : 'textfield', fieldLabel : '核对员', @@ -778,13 +817,15 @@ name : 'sender', readOnly:true, allowBlank : false, + allowBlank : !getSystemSetConfig('showInvoiceAssistantSender',true) || !getSystemSetConfig('invoiceAssistantSenderRequired',true), anchor : '99%', cls:'x-item-disabled' }] },{ layout : 'form', labelWidth :90, columnWidth :.33, + hidden: !getSystemSetConfig('showInvoicePersonInCharge',true), items : [{ xtype : 'textfield', fieldLabel : '下送责任人条码', @@ -820,13 +861,15 @@ layout : 'form', labelWidth :70, columnWidth :.33, + hidden: !getSystemSetConfig('showInvoicePersonInCharge',true), items : [{ xtype : 'textfield', fieldLabel : '下送责任人', maxLength : '41', id : 'personInCharge', name : 'personInCharge', readOnly:true, + allowBlank : !getSystemSetConfig('showInvoicePersonInCharge',true) || !getSystemSetConfig('invoicePersonInChargeRequired',false), anchor : '99%', cls:'x-item-disabled' }] @@ -1042,7 +1085,49 @@ } } )] - } + },{ + layout : 'form', + columnWidth : 0.43, + items:[new top.Ext.grid.EditorGridPanel({ + id : 'sendOutGoodsDetail', + title : '发货单明细', + store : recyclingapplicationStore, + cm : recyclingapplicationCm, + enableHdMenu : false, + width :423, + height :425, + loadMask : true, + tbar:[{ + text:'发货汇总' + },{ + text: "", + id : 'tousseAmountInfo' + }], + bbar:[{ + text:'合计' + },{ + id : 'sum_price', + text:'总价:0.0' + },{ + id : 'sum_amount', + text:'数量:0' + }], +// autoExpandColumn : 'sum_tousseName', + frame : false, + bodyStyle : 'border:1px solid #afd7af', + viewConfig: { + forceFit:true + }, + selModel : new top.Ext.grid.RowSelectionModel({ + singleSelect : false + }), + listeners:{ + validateedit : function(o){ + if(!isPositiveInteger(o.value))return false; + } + } + })] + } ] }], buttons : [{ @@ -1098,9 +1183,10 @@ }] }); - var cookieSender = Ext.state.Manager.getProvider().get('cookieSender'); - if(cookieSender){ - top.Ext.getCmp('sender').setValue(cookieSender); + + var cookieAssistantSender = Ext.state.Manager.getProvider().get('cookieAssistantSender'); + if(getSystemSetConfig('rememberLastInvoiceAssistantSender',false) && cookieAssistantSender){ + top.Ext.getCmp('sender').setValue(cookieAssistantSender); } var window = new top.Ext.Window( {