Index: ssts-web/src/main/webapp/disinfectsystem/invoice/operationReservationInvoiceView.js =================================================================== diff -u -r27343 -r32399 --- ssts-web/src/main/webapp/disinfectsystem/invoice/operationReservationInvoiceView.js (.../operationReservationInvoiceView.js) (revision 27343) +++ ssts-web/src/main/webapp/disinfectsystem/invoice/operationReservationInvoiceView.js (.../operationReservationInvoiceView.js) (revision 32399) @@ -881,6 +881,60 @@ } } } +function printInvoiceAfterInvoice(invoiceIds){ + if(!isUndefinedOrNull(invoiceIds)){ + var invoicePrintModule = new InvoicePrintModule(grid,$Id('userName').value); + invoicePrintModule.batchPrintInvoiceWithType(invoiceIds.join(","),'全部'); + } +} +function doSaveAction(form,window,printInvoiceCallback){ + if (!form.getForm().isValid()) { + showResult('请正确填写表单各值'); + return false; + } + //验证发货物品表格 + if(!sendOutGoodsStore || sendOutGoodsStore.getCount() == 0){ + showResult('发货物品不能为空!'); + return false; + } + /*var b = validTousseGridData(); + if(!b){ + return false; + }*/ + var bool = validGridAmount(); + if(!bool){ + return false; + } + + getTousseGridData(); + form.form.submit( { + //url : WWWROOT + '/disinfectSystem/invoiceAction!saveDepartInvoice.do', + url : WWWROOT + '/disinfectSystem/invoiceAction!saveInvoiceByDepartOrInvoicePlanId.do', + method : 'POST', + waitMsg : '正在保存数据,请稍候', + waitTitle : '提交表单', + success : function(form, action) { + // 一定要事务提交成功才返回发货计划列表界面 + showResult(action.result.message); + if(action.result.success){ + if(printInvoiceCallback != null){ + printInvoiceCallback(action.result.invoiceIds); + } + window.close(); + grid.getStore().reload(); + } + }, + failure : function(form, action) { + if(!isUndefinedOrNullOrEmpty(action.result) && !isUndefinedOrNullOrEmpty(action.result.message)){ + showResult(action.result.message); + }else{ + showResult("发货超时,请稍后查看发货单以确定发货是否成功,避免重复发货!"); + window.close(); + grid.getStore().reload(); + } + } + }); +} /** * 发货单窗口 * @param orgUnitCoding 科室编码 @@ -1572,50 +1626,16 @@ disabled : committedStatus ? false : true,//未提交则保存按钮置灰 id:'saveButton', handler : function() { - if (!form.getForm().isValid()) { - showResult('请正确填写表单各值'); - return false; - } - //验证发货物品表格 - if(!sendOutGoodsStore || sendOutGoodsStore.getCount() == 0){ - showResult('发货物品不能为空!'); - return false; - } - /*var b = validTousseGridData(); - if(!b){ - return false; - }*/ - var bool = validGridAmount(); - if(!bool){ - return false; - } - - getTousseGridData(); - form.form.submit( { - //url : WWWROOT + '/disinfectSystem/invoiceAction!saveDepartInvoice.do', - url : WWWROOT + '/disinfectSystem/invoiceAction!saveInvoiceByDepartOrInvoicePlanId.do', - method : 'POST', - waitMsg : '正在保存数据,请稍候', - waitTitle : '提交表单', - success : function(form, action) { - // 一定要事务提交成功才返回发货计划列表界面 - showResult(action.result.message); - if(action.result.success){ - window.close(); - grid.getStore().reload(); - } - }, - failure : function(form, action) { - if(!isUndefinedOrNullOrEmpty(action.result) && !isUndefinedOrNullOrEmpty(action.result.message)){ - showResult(action.result.message); - }else{ - showResult("发货超时,请稍后查看发货单以确定发货是否成功,避免重复发货!"); - window.close(); - grid.getStore().reload(); - } - } - }); + doSaveAction(form,window); } + },{ + text : '保存并打印', + disabled : committedStatus ? false : true,//未提交则保存按钮置灰 + id:'saveAndPrintButton', + hidden:!sstsConfig.enableSaveAndPrintWhenInvoice, + handler : function() { + doSaveAction(form,window,printInvoiceAfterInvoice); + } }, { text : '取消', handler : function() {