Index: ssts-web/src/main/webapp/disinfectsystem/materialmanager/materialEntryView.js =================================================================== diff -u -r13151 -r13257 --- ssts-web/src/main/webapp/disinfectsystem/materialmanager/materialEntryView.js (.../materialEntryView.js) (revision 13151) +++ ssts-web/src/main/webapp/disinfectsystem/materialmanager/materialEntryView.js (.../materialEntryView.js) (revision 13257) @@ -1,5 +1,9 @@ var entityName = "器械入库管理"; var grid; +/** + * 材料公共方法的处理 + */ +var materialEntry = new MaterialEntry(); var diposableGoodsStore = new Ext.data.Store({ proxy : new Ext.data.HttpProxy({ @@ -43,14 +47,19 @@ mapping : 'name' }]) }); - +var hasTypeStore = new Ext.data.SimpleStore({ + fields : ['hasType'], + data : [[HAS_TYPE_NO],[HAS_TYPE_YES]] +}); var GodownEntryItemRecord = Ext.data.Record.create([ {name : 'id'}, {name : 'materialId'}, {name : 'name'}, {name : 'amount'}, {name : 'cost'}, - {name : 'supplierName'} + {name : 'supplierName'}, + {name : 'certification'}, + {name : 'hasInvoice'} ]); function addItems(materialId,name,count,cost,supplierName){ @@ -83,22 +92,31 @@ showResult("请填写供应商!"); return false; } + var hasInvoice = top.Ext.getCmp("hasInvoice").getValue(); + if(hasInvoice == null || hasInvoice == ''){ + if(sstsConfig.godownEntryShowInvoice){ + showResult("请选择是否有发票"); + return false; + } + } + var certification = top.Ext.getCmp('certification').getValue(); for(var i = 0;i < top.Ext.getCmp('materialEntryItemGrid').getStore().getCount();i++){ if(top.Ext.getCmp('materialEntryItemGrid').getStore().getAt(i).data.materialId == materialId){ showResult("该物品已经存在,不能重复添加!"); return false; } } - //添加操作 var godownEntryItem = new GodownEntryItemRecord({ id : "", materialId : materialId, name : name, amount : count, cost : cost, - supplierName : supplierName + supplierName : supplierName, + certification : certification, + hasInvoice : hasInvoice }); top.Ext.getCmp('materialEntryItemGrid').getStore().add(godownEntryItem); @@ -107,6 +125,8 @@ top.Ext.getCmp('cost1').setValue(''); top.Ext.getCmp('materialId').setValue(''); top.Ext.getCmp('supplier1').setValue(''); + top.Ext.getCmp('hasInvoice').setValue(''); + top.Ext.getCmp('certification').setValue(''); top.Ext.getCmp('name1').focus(); } @@ -279,43 +299,45 @@ {name : 'batchNumber'}, {name : 'cost'}, {name : 'supplierName'}, - {name : 'deleteButton'} + {name : 'deleteButton'}, + {name : 'certification'}, + {name : 'hasInvoice'} ] }) }), - cm : new Ext.grid.ColumnModel([new Ext.grid.RowNumberer(), + cm : new top.Ext.grid.ColumnModel([new Ext.grid.RowNumberer(), {header : "id",dataIndex : 'id',hidden : true}, {header : "materialId",dataIndex : 'materialId',hidden : true}, - {header : "名称",dataIndex : 'name',width : 180,menuDisabled : true, - editor : new top.Ext.form.ComboBox({ - queryParam : 'spell', - minChars : 0, - valueField : 'id', - displayField : 'name', - store : diposableGoodsStore, - 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 : "名称",dataIndex : 'name',width : 180,menuDisabled : true +// editor : new top.Ext.form.ComboBox({ +// queryParam : 'spell', +// minChars : 0, +// valueField : 'id', +// displayField : 'name', +// store : diposableGoodsStore, +// 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 : "数量",dataIndex : 'amount',width : 80,menuDisabled : true, - editor : new Ext.form.TextField({ + editor : new top.Ext.form.TextField({ regex: /^\d+$/, regexText:'只能输入数字', allowBlank : false }) }, {header : "单价",dataIndex : 'cost',width : 80,menuDisabled : true, - editor : new Ext.form.TextField({ + editor : new top.Ext.form.TextField({ regex: /^(([1-9]+[0-9]*.{1}[0-9]+)|([0].{1}[1-9]+[0-9]*)|([1-9][0-9]*)|([0][.][0-9]+[1-9]*))$/, regexText:'只能输入正数', allowBlank : false @@ -341,8 +363,34 @@ } } }) - }, - {header : "删除",width : 100,menuDisabled : true,dataIndex : 'deleteButton', renderer:renderDeleteButton} + },{ + header : "注册证号",width : 100,menuDisabled : true,dataIndex : 'certification', + editor : new top.Ext.form.TextField({ + maxLength : 30, + allowBlank : true + }) + },{ + header : "有无发票",width : 100,menuDisabled : true,dataIndex : 'hasInvoice', + editor : new top.Ext.form.ComboBox({ + minChars : 0, + store : hasTypeStore, + forceSelection : true, + lazyInit : false, + valueField : 'hasType', + displayField : 'hasType', + mode : 'local', + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + allowBlank : false, + width : 100, + listeners : { + select : function(combo, record, index) { + combo.setValue(record.data.hasType); + } + } + }),hidden:!sstsConfig.godownEntryShowInvoice + },{header : "删除",width : 100,menuDisabled : true,dataIndex : 'deleteButton', renderer:renderDeleteButton} ]), width :735, height : 250, @@ -432,41 +480,101 @@ } } },{ - text : '单价:' - },{ - xtype : 'textfield', - maxLength : '16', - id : 'cost1', - name : 'cost1', - width : 70, - regex: /^(([1-9]+[0-9]*.{1}[0-9]+)|([0].{1}[1-9]+[0-9]*)|([1-9][0-9]*)|([0][.][0-9]+[1-9]*))$/, - regexText:'只能输入正数', - anchor : '95%', - listeners : { - specialkey : function(field, e) { - if (e.getKey() == Ext.EventObject.ENTER) { - var materialId = top.Ext.getCmp('materialId').getValue(); - var name = top.Ext.getCmp('name1').getValue(); - var count = top.Ext.getCmp('amount1').getValue(); - var cost = top.Ext.getCmp('cost1').getValue(); - var supplierName = top.Ext.getCmp('supplier1').getValue(); - addItems(materialId,name,count,cost,supplierName); - } - } - } - },{ - text : '添加', - iconCls : 'btn_ext_add', - handler : function() { - var materialId = top.Ext.getCmp('materialId').getValue(); - var name = top.Ext.getCmp('name1').getValue(); - var count = top.Ext.getCmp('amount1').getValue(); - var cost = top.Ext.getCmp('cost1').getValue(); - var supplierName = top.Ext.getCmp('supplier1').getValue(); - addItems(materialId,name,count,cost,supplierName); - } - } - ] + text : '单价:' + },{ + xtype : 'textfield', + maxLength : '16', + id : 'cost1', + name : 'cost1', + width : 70, + regex: /^(([1-9]+[0-9]*.{1}[0-9]+)|([0].{1}[1-9]+[0-9]*)|([1-9][0-9]*)|([0][.][0-9]+[1-9]*))$/, + regexText:'只能输入正数', + anchor : '95%', + listeners : { + specialkey : function(field, e) { + if (e.getKey() == Ext.EventObject.ENTER) { + var materialId = top.Ext.getCmp('materialId').getValue(); + var name = top.Ext.getCmp('name1').getValue(); + var count = top.Ext.getCmp('amount1').getValue(); + var cost = top.Ext.getCmp('cost1').getValue(); + var supplierName = top.Ext.getCmp('supplier1').getValue(); + addItems(materialId,name,count,cost,supplierName); + } + } + } + }], + listeners: { + render : function() { + var tbar = new top.Ext.Toolbar ({ + items:[{ + text:'有无发票:', + hidden:!sstsConfig.godownEntryShowInvoice + },{ + xtype : 'combo', + id : 'hasInvoice', + name : 'hasInvoice', + minChars : 0, + valueField : 'hasType', + displayField : 'hasType', + mode : 'local', + store : hasTypeStore, + forceSelection : true, + lazyInit : false, + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + selectOnFocus :true, + allowBlank : true, + width : 80, + tabIndex : 9, + hidden:!sstsConfig.godownEntryShowInvoice, + listeners : { + select : function(field, r) { + top.Ext.getCmp('manufacturer').focus(); + }, + specialKey:function(f,e){ + if (e.getKey() == Ext.EventObject.ENTER) { + top.Ext.getCmp('manufacturer').focus(); + top.Ext.getCmp('manufacturer').selectText(); + } + } + } + },{ + text : '注册证号:' + },{ + xtype : 'textfield', + id : 'certification', + name : 'certification', + width : 190, + tabIndex : 12, + allowBlank:true, + anchor : '100%', + listeners : { + specialkey : function(field, e) { + var key = e.getKey(); + if (key == Ext.EventObject.ENTER) { + addGodown(); + top.Ext.getCmp('name1').focus(); + top.Ext.getCmp('name1').selectText(); + } + } + } + },{ + text : '添加', + iconCls : 'btn_ext_add', + handler : function() { + var materialId = top.Ext.getCmp('materialId').getValue(); + var name = top.Ext.getCmp('name1').getValue(); + var count = top.Ext.getCmp('amount1').getValue(); + var cost = top.Ext.getCmp('cost1').getValue(); + var supplierName = top.Ext.getCmp('supplier1').getValue(); + addItems(materialId,name,count,cost,supplierName); + } + }] + }); + tbar.render(top.Ext.getCmp('materialEntryItemGrid').tbar); + } + } })], buttons : [{ id : 'btnSave', @@ -490,6 +598,8 @@ jsonArray[len].amount = record.data.amount; jsonArray[len].cost = record.data.cost; jsonArray[len].supplierName = record.data.supplierName; + jsonArray[len].certification = record.data.certification; + jsonArray[len].hasInvoice = record.data.hasInvoice; } top.Ext.getCmp("items").setValue(Ext.encode(jsonArray)); @@ -611,7 +721,9 @@ name : materialName, amount : action.result.data.itemsList[i].amount, cost : action.result.data.itemsList[i].cost, - supplierName : action.result.data.itemsList[i].supplierName + supplierName : action.result.data.itemsList[i].supplierName, + certification : action.result.data.itemsList[i].certification, + hasInvoice : action.result.data.itemsList[i].hasInvoice }); top.Ext.getCmp('materialEntryItemGrid').getStore().add(godownEntryItem); @@ -638,6 +750,7 @@ {header : "单号",width : 200,dataIndex : 'serialNumber', renderer : modifyRecord}, {header : "操作员",width : 200,dataIndex : 'operator'}, {header : "入库时间",width : 200,dataIndex : 'time' , renderer : myDateFormatByMinute}, + {header : "金额",width:200,dataIndex:'totalPrice'}, {id : 'operationRemark',header : "备注",width : 120,dataIndex : 'remark'} ]; @@ -646,7 +759,8 @@ {name : 'serialNumber'}, {name : 'operator'}, {name : 'time'}, - {name : 'remark'} + {name : 'remark'}, + {name : 'totalPrice'} ]; var filters = new Ext.grid.GridFilters({ @@ -666,6 +780,15 @@ handler : function() { addGodownEntry(""); } + },'-',{ + + text : '打印', +// hidden : SSTS_WarehouseEntry_Delete, + iconCls : 'icon_print', + handler : function() { + materialEntry.onPrintEntryDetail(grid,'入库单'); + } + }/*, '-', { text : '修改', hidden : SSTS_WarehouseEntry_Update,