Bladeren bron

发票打印修复

hurugang 5 jaren geleden
bovenliggende
commit
d7d96792fb

+ 32 - 16
src/main/java/cn/hnthyy/thmz/service/impl/his/MzChargeDetailServiceImpl.java

@@ -621,8 +621,8 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         mzChargeDetailMapper.updatePayMakAndPrintFlag(updateMzChargeDetail);
         List<MzReceiptSerial> mzReceiptSerials = mzReceiptSerialMapper.selectSerialForThisTime(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes());
         if (mzReceiptSerials != null && mzReceiptSerials.size() > 0) {
-            formatRefundReceiptSerial(mzReceiptSerials,opId);
-            mzReceiptSerialMapper.batchInsertMzReceiptSerial(mzReceiptSerials);
+            List<MzReceiptSerial> newReceiptSerials  = formatRefundReceiptSerial(mzReceiptSerials,opId);
+            mzReceiptSerialMapper.batchInsertMzReceiptSerial(newReceiptSerials);
         }
         MzReceiptSerial updateMzReceiptSerial = new MzReceiptSerial(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes());
         //updateMzReceiptSerial.setPayMark(PayMarkEnum.RETURN_PREMIUM.code);
@@ -689,8 +689,19 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         }
     }
 
-    private void formatRefundReceiptSerial(List<MzReceiptSerial> mzReceiptSerials,String opId) {
+    private List<MzReceiptSerial> formatRefundReceiptSerial(List<MzReceiptSerial> mzReceiptSerials,String opId) {
+        Set<String> tempSet = new HashSet<>();
+        List<MzReceiptSerial> newReceiptSerials  = new ArrayList<>();
         for (MzReceiptSerial mz : mzReceiptSerials) {
+            //退过费的发票表记录
+            if(mz.getSerialNo()<0 && mz.getReceiptNo()<0){
+                Integer tempSerialNo =-mz.getSerialNo();
+                tempSet.add(mz.getChequeType()+"_"+tempSerialNo);
+                continue;
+            }
+            if(tempSet.contains(mz.getChequeType()+"_"+mz.getSerialNo())){
+                continue;
+            }
             mz.setOperatorId(opId);
             mz.setReceiptNo(-mz.getReceiptNo());
             mz.setPayId(opId);
@@ -723,7 +734,9 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
             mz.setChequeType(Constants.CASH);
             mz.setChargeDcountDate(null);
             mz.setChargeDcountNo(YesNoEnum.NO.code);
+            newReceiptSerials.add(mz);
         }
+        return newReceiptSerials;
     }
 
     private void fromatRefundDetail(String opId, List<MzChargeDetail> mzChargeDetails, List<String> chargeItemCodeList, List<MzChargeDetail> oriMzChargeDetails, Date now, List<MzChargeDetail> tcMzChargeDetails, List<MzChargeDetail> removeMzChargeDetails) {
@@ -776,26 +789,29 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
     private String getDeposFiles(String opId, MzDepositFileVo mzDepositFileVo, Date now, int times, int serialNo, BigDecimal totalPayable, String payWay, List<MzDepositFile> newMzDepositFiles, boolean allRefund) {
         List<MzDepositFile> mzDepositFiles = mzDepositFileMapper.selectMzDepositFileByTimes(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(),mzDepositFileVo.getReceiptNo());
         if (mzDepositFiles != null || mzDepositFiles.size() > 0) {
+            MzDepositFile temp = CloneUtil.clone(mzDepositFiles.get(0));
+            temp.setReceiptNo(-temp.getReceiptNo());
+            temp.setAmount(BigDecimal.ZERO.subtract(temp.getAmount()));
+            temp.setReceiptSn(-temp.getReceiptSn());
+            temp.setSerialNo(-temp.getSerialNo());
+            temp.setDeptNo(null);
+            temp.setChargeDate(now);
+            temp.setPayMark(PayMarkEnum.RETURN_PREMIUM.code);
+            temp.setOpId(opId);
+            temp.setChequeType(Constants.CASH);
+            temp.setDcountNo(YesNoEnum.NO.code);
+            temp.setDcountDate(null);
+            newMzDepositFiles.add(temp);
+            BigDecimal amount=BigDecimal.ZERO;
             for (MzDepositFile ms : mzDepositFiles) {
                 if (ms != null) {
                     if (StringUtils.isNotBlank(ms.getChequeType())) {
                         payWay = ms.getChequeType();
                     }
-                    MzDepositFile temp = CloneUtil.clone(ms);
-                    temp.setReceiptNo(-temp.getReceiptNo());
-                    temp.setAmount(BigDecimal.ZERO.subtract(temp.getAmount()));
-                    temp.setReceiptSn(-temp.getReceiptSn());
-                    temp.setSerialNo(-temp.getSerialNo());
-                    temp.setDeptNo(null);
-                    temp.setChargeDate(now);
-                    temp.setPayMark(PayMarkEnum.RETURN_PREMIUM.code);
-                    temp.setOpId(opId);
-                    temp.setChequeType(Constants.CASH);
-                    temp.setDcountNo(YesNoEnum.NO.code);
-                    temp.setDcountDate(null);
-                    newMzDepositFiles.add(temp);
+                    amount=amount.add(ms.getAmount());
                 }
             }
+            temp.setAmount(amount);
             if (!allRefund) {
                 MzDepositFile m = mzDepositFiles.get(0);
                 m.setTimes(times);

+ 3 - 3
src/main/resources/static/js/registration.js

@@ -1650,12 +1650,12 @@ function prn1Print(patientId, times) {
                 }
                 LODOP = getLodop();
                 var temp = res.data;
-                LODOP.PRINT_INITA(6, 0, "120mm", "93mm", "泰和门诊发票打印");
+                LODOP.PRINT_INITA(6, 0, "120mm", "93.5mm", "泰和门诊发票打印");
                 //设置默认打印机
                 LODOP.SET_PRINTER_INDEX(printIndex);
                 LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "120mm");
-                LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "93mm");
-                LODOP.SET_PRINT_PAGESIZE(1, "120mm", "93mm", "CreateCustomPage");
+                LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "93.5mm");
+                LODOP.SET_PRINT_PAGESIZE(1, "120mm", "93.5mm", "CreateCustomPage");
                 LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊发票");//对新建的纸张重命名
                 LODOP.SET_PRINT_STYLE("FontSize", 11); //字体大小
                 LODOP.ADD_PRINT_TEXT("6mm", "0mm", "45mm", "3mm", "湖南泰和医院管理有限公司");

+ 3 - 3
src/main/resources/static/js/toll_administration.js

@@ -1281,12 +1281,12 @@ function printCommon(url,patientId, times,name) {
                 for (var i = 0; i < res.data.length; i++) {
                     LODOP = getLodop();
                     var temp = res.data[i].mzReceiptSerial;
-                    LODOP.PRINT_INITA(6, 0, "120mm", "93mm", "泰和门诊发票打印");
+                    LODOP.PRINT_INITA(6, 0, "120mm", "93.5mm", "泰和门诊发票打印");
                     //设置默认打印机
                     LODOP.SET_PRINTER_INDEX(printIndex);
                     LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "120mm");
-                    LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "93mm");
-                    LODOP.SET_PRINT_PAGESIZE(1, "120mm", "93mm", "CreateCustomPage");
+                    LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "93.5mm");
+                    LODOP.SET_PRINT_PAGESIZE(1, "120mm", "93.5mm", "CreateCustomPage");
                     LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊发票");//对新建的纸张重命名
                     LODOP.SET_PRINT_STYLE("FontSize", 11); //字体大小
                     LODOP.ADD_PRINT_TEXT("6mm", "0mm", "45mm", "3mm", "湖南泰和医院管理有限公司");