Index: ssts-web/src/main/webapp/disinfectsystem/invoice/materialInvoiceView.js =================================================================== diff -u -r25124 -r25222 --- ssts-web/src/main/webapp/disinfectsystem/invoice/materialInvoiceView.js (.../materialInvoiceView.js) (revision 25124) +++ ssts-web/src/main/webapp/disinfectsystem/invoice/materialInvoiceView.js (.../materialInvoiceView.js) (revision 25222) @@ -84,7 +84,7 @@ url : WWWROOT + '/disinfectSystem/baseData/wareHouseAction!getWareHouseData.do', root: 'data', fields: [ - {name : 'id',mapping : 'id'}, + {name : 'id',mapping : 'id'}, {name : 'name',mapping : 'name'} ], listeners : { @@ -128,6 +128,7 @@ }, [ {name : 'id',mapping : 'id'}, {name : 'name',mapping : 'name'}, + {name : 'cost',mapping : 'cost'}, {name : 'displayName',mapping : 'displayName'}, {name : 'spelling',mapping : 'spelling'}, {name : 'storage',mapping : 'storage'} @@ -162,7 +163,7 @@ }); //添加明细 - function addItems(materialDefinitionId,name,amount,storage,userecordId,userecordName,userecordDepartCoding){ + function addItems(materialDefinitionId,name,cost,amount,storage,userecordId,userecordName,userecordDepartCoding){ if(name == null || name == ''){ showResult("请填写物品名称!"); return false; @@ -196,14 +197,15 @@ id : "", materialDefinitionId : materialDefinitionId, materialName : name, + singlePrice : cost, amount : amount, userecordId : userecordId, userecordName : userecordName, userecordDepartCoding : userecordDepartCoding }); top.Ext.getCmp('materialInvoiceItemGrid').getStore().add(materialInvoiceItem); - top.Ext.getCmp('name1').setValue(''); + top.Ext.getCmp('cost').setValue(''); top.Ext.getCmp('amount1').setValue(''); top.Ext.getCmp('materialDefinitionId').setValue(''); top.Ext.getCmp('userecordId').setValue(''); @@ -221,7 +223,7 @@ autoHeight : true, autoScroll : true, labelAlign : 'left', - items:[{ + items:[{ layout : 'column', items : [{ xtype : 'hidden', @@ -268,7 +270,7 @@ readOnly : true, anchor : '95%' }] - }, { + },{ columnWidth : .22, layout : 'form', labelWidth : 50, @@ -284,7 +286,7 @@ value : $Id('userName').value, anchor : '95%' }] - }, { + },{ columnWidth : .28, layout : 'form', labelWidth : 60, @@ -333,7 +335,7 @@ layout : 'form', labelWidth : 40, items : [{ - xtype : 'combo', + xtype : 'combo', id : 'departSearch', name : 'departSearch', queryParam : 'spell', @@ -356,7 +358,7 @@ } } }] - }, { + },{ columnWidth : 1, layout : 'form', labelWidth : 50, @@ -376,7 +378,7 @@ bodyStyle : 'border:1px solid #afd7af', frame :false, viewConfig: { - forceFit:true + forceFit:true }, store : new Ext.data.Store({ proxy : new Ext.data.HttpProxy({ @@ -385,71 +387,71 @@ }), reader : new Ext.data.JsonReader({ fields : [ - {name : 'id'}, - {name : 'materialDefinitionId'}, - {name : 'materialName'}, - {name : 'userecordId'}, - {name : 'userecordName'}, - {name : 'userecordDepartCoding'}, - {name : 'amount'}, - {name : 'deleteButton'} - ] + {name : 'id'}, + {name : 'materialDefinitionId'}, + {name : 'materialName'}, + {name : 'userecordId'}, + {name : 'userecordName'}, + {name : 'userecordDepartCoding'}, + {name : 'amount'}, + {name : 'deleteButton'} + ] }) }), cm : new Ext.grid.ColumnModel([new Ext.grid.RowNumberer(), - {header : "id",dataIndex : 'id',hidden : true}, - {header : "materialDefinitionId",dataIndex : 'materialDefinitionId',hidden : true}, - {header : "名称",dataIndex : 'materialName',width : 210,menuDisabled : true, - editor : new top.Ext.form.ComboBox({ - queryParam : 'spell', - minChars : 0, - valueField : 'id', - displayField : 'displayName', - store : materialStore, - forceSelection : true, - lazyInit : false, - triggerAction : 'all', - hideTrigger : true, - typeAhead : false, - allowBlank : true, - width : 100, - listeners : { - select : function(combo, record, index) { - combo.setValue(record.data.name); - } - } - }) - }, - {header : "使用记录id",dataIndex : 'userecordId',hidden : true}, - {header : "使用记录的科室编码",dataIndex : 'userecordDepartCoding',hidden : true}, - {header : "使用记录",dataIndex : 'userecordName',width : 120/*,menuDisabled : true, - editor : new Ext.form.TextField({ - readOnly : true, - listeners : { - render : function(p) { - p.getEl().on('click', function(q){ - if(top.Ext.getCmp('departCoding').getValue() == ''){ - alert('请先选择科室!'); - return; - } + {header : "id",dataIndex : 'id',hidden : true}, + {header : "materialDefinitionId",dataIndex : 'materialDefinitionId',hidden : true}, + {header : "名称",dataIndex : 'materialName',width : 210,menuDisabled : true, + editor : new top.Ext.form.ComboBox({ + queryParam : 'spell', + minChars : 0, + valueField : 'id', + displayField : 'displayName', + store : materialStore, + forceSelection : true, + lazyInit : false, + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + allowBlank : true, + width : 100, + listeners : { + select : function(combo, record, index) { + combo.setValue(record.data.name); + } + } + }) + }, + {header : "使用记录id",dataIndex : 'userecordId',hidden : true}, + {header : "使用记录的科室编码",dataIndex : 'userecordDepartCoding',hidden : true}, + {header : "使用记录",dataIndex : 'userecordName',width : 120/*,menuDisabled : true, + editor : new Ext.form.TextField({ + readOnly : true, + listeners : { + render : function(p) { + p.getEl().on('click', function(q){ + if(top.Ext.getCmp('departCoding').getValue() == ''){ + alert('请先选择科室!'); + return; + } - //点击时弹出window显示使用记录列表进行选择 - openUserecordWindow(p.getEl()); - }); - } - } - })*/ - }, - {header : "单价",width : 40,menuDisabled : true,dataIndex : 'price', id:'price'}, - {header : " 数量",dataIndex : 'amount',width : 40,menuDisabled : true, - editor : new Ext.form.TextField({ - regex: /^\d+$/, - regexText:'只能输入数字', - allowBlank : false - }) - }, - {header : "删除",width : 40,menuDisabled : true,dataIndex : 'deleteButton', id:'expandColumn', renderer:renderDeleteButton} - ]), + //点击时弹出window显示使用记录列表进行选择 + openUserecordWindow(p.getEl()); + }); + } + } + })*/ + }, + {header : "单价",width : 40,menuDisabled : true,dataIndex : 'singlePrice', id:'singlePrice'}, + {header : " 数量",dataIndex : 'amount',width : 40,menuDisabled : true, + editor : new Ext.form.TextField({ + regex: /^\d+$/, + regexText:'只能输入数字', + allowBlank : false + }) + }, + {header : "删除",width : 40,menuDisabled : true,dataIndex : 'deleteButton', id:'expandColumn', renderer:renderDeleteButton} + ]), width :735, height : 250, autoExpandColumn : 'expandColumn', @@ -466,6 +468,10 @@ name : 'storage', id : 'storage' },{ + xtype : 'hidden', + name : 'cost', + id : 'cost' + },{ text : ' 材料:' },{ xtype : 'combo', @@ -490,6 +496,7 @@ top.Ext.getCmp('name1').setValue(record.data.name); top.Ext.getCmp('materialDefinitionId').setValue(record.data.id); top.Ext.getCmp('storage').setValue(record.data.storage); + top.Ext.getCmp('cost').setValue(record.data.cost); }, specialkey : function(field, ee) { if (ee.getKey() == Ext.EventObject.ENTER) { @@ -535,31 +542,32 @@ specialkey : function(field, e) { if (e.getKey() == Ext.EventObject.ENTER) { var materialDefinitionId = top.Ext.getCmp('materialDefinitionId').getValue(); - var name = top.Ext.getCmp('name1').getValue(); - var amount = top.Ext.getCmp('amount1').getValue(); - var storage = top.Ext.getCmp('storage').getValue(); - var userecordId = top.Ext.getCmp('userecordId').getValue(); - var userecordName = top.Ext.getCmp('userecordName').getValue(); - var userecordDepartCoding = top.Ext.getCmp('departCoding').getValue(); - addItems(materialDefinitionId,name,amount,storage,userecordId,userecordName,userecordDepartCoding); + var name = top.Ext.getCmp('name1').getValue(); + var amount = top.Ext.getCmp('amount1').getValue(); + var storage = top.Ext.getCmp('storage').getValue(); + var userecordId = top.Ext.getCmp('userecordId').getValue(); + var userecordName = top.Ext.getCmp('userecordName').getValue(); + var userecordDepartCoding = top.Ext.getCmp('departCoding').getValue(); + addItems(materialDefinitionId,name,amount,storage,userecordId,userecordName,userecordDepartCoding); } } } },{ - text : '添加', - iconCls : 'btn_ext_add', - handler : function() { - var materialDefinitionId = top.Ext.getCmp('materialDefinitionId').getValue(); - var name = top.Ext.getCmp('name1').getValue(); - var amount = top.Ext.getCmp('amount1').getValue(); - var storage = top.Ext.getCmp('storage').getValue(); - var userecordId = top.Ext.getCmp('userecordId').getValue(); - var userecordName = top.Ext.getCmp('userecordName').getValue(); - var userecordDepartCoding = top.Ext.getCmp('departCoding').getValue(); - addItems(materialDefinitionId,name,amount,storage,userecordId,userecordName,userecordDepartCoding); - } - } - ] + text : '添加', + iconCls : 'btn_ext_add', + handler : function() { + var materialDefinitionId = top.Ext.getCmp('materialDefinitionId').getValue(); + var name = top.Ext.getCmp('name1').getValue(); + + var amount = top.Ext.getCmp('amount1').getValue(); + var storage = top.Ext.getCmp('storage').getValue(); + var userecordId = top.Ext.getCmp('userecordId').getValue(); + var userecordName = top.Ext.getCmp('userecordName').getValue(); + var userecordDepartCoding = top.Ext.getCmp('departCoding').getValue(); + var cost = top.Ext.getCmp('cost').getValue(); + addItems(materialDefinitionId,name,cost,amount,storage,userecordId,userecordName,userecordDepartCoding); + } + }] })], buttons : [{ id : 'btnSave', @@ -626,7 +634,7 @@ }] }); - var invoiceWindow = new top.Ext.Window( { + var invoiceWindow = new top.Ext.Window({ id : 'materialInvoiceWin', layout : 'fit', title : '材料发货单信息', @@ -802,7 +810,8 @@ } printMaterialInvoice(result, printType); } - +//添加和查看按钮的弹窗: 表头的单价的字段为singlePrice,查看和添加的单价获取的字段不一样, +//查看的是settlementPrice,添加的是cost,只因表头的对象都是共用的,只能在传值的时候改一下参数字段 //查看加载材料发货单明细信息 var loadFormData = function(grid) { var records = grid.getSelectionModel().getSelections(); @@ -823,7 +832,7 @@ top.Ext.getCmp("btnSave").setDisabled(true); top.Ext.getCmp("serialNum").show(); top.Ext.getCmp('materialInvoiceForm').form.load({ - url : WWWROOT + '/disinfectSystem/materialInvoiceAction!loadMaterialInvoice.do', + url : WWWROOT + '/disinfectSystem/materialInvoiceAction!loadMaterialInvoiceById.do', method : 'GET', waitMsg : '正在加载数据,请稍候', params : {id : id}, @@ -837,12 +846,12 @@ id : action.result.data.materialInvoiceItemList[i].id, materialDefinitionId : action.result.data.materialInvoiceItemList[i].materialDefinitionId, materialName : materialName, + singlePrice : action.result.data.materialInvoiceItemList[i].price, amount : action.result.data.materialInvoiceItemList[i].amount, userecordId : action.result.data.materialInvoiceItemList[i].userecordId, userecordName : action.result.data.materialInvoiceItemList[i].userecordName, userecordDepartCoding : action.result.data.materialInvoiceItemList[i].userecordDepartCoding }); - top.Ext.getCmp('materialInvoiceItemGrid').getStore().add(materialInvoiceItem); } }, @@ -1110,12 +1119,14 @@ MaterialInvoiceTableManager.obtainMaterialInvoiceDetails(record.data['id'],function(voItems){ for(var i=0;i" + voItems[i].amount +""; + content += " " + voItems[i].name +"" ; + content += " " + voItems[i].price +""; + content += "" + voItems[i].amount +""; content += ""; } }); DWREngine.setAsync(true); - tableContent = (""); + tableContent = ("

材料名称

数量

"); tableContent += "" + content + "

材料名称

单价

数量


"; record.set("htmlContent",tableContent); }