Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java =================================================================== diff -u -r13077 -r13079 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 13077) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 13079) @@ -3714,8 +3714,7 @@ // 材料发货价格 String materialInvoicePriceSql = "select '' as coding,min(i.settleAccountsDepart) " + "as depart,sum(ii.settlementPrice) as price from MaterialInvoice i," - + "MaterialInvoiceItem ii where i.id = ii.materialInvoiceId and i.orgUnitCoding = '" + handleDeptCode + "' and (i.status ='收货签收' or " - + "i.status = '已发货') " + invoiceWheresql + " group by i.settleAccountsDepart"; + + "MaterialInvoiceItem ii where i.id = ii.materialInvoiceId and i.orgUnitCoding = '" + handleDeptCode + "' " + invoiceWheresql + " group by i.settleAccountsDepart"; ResultSet materialInvoicePriceResultSet = objectDao.executeSql(materialInvoicePriceSql); try { while(rs.next()){ @@ -3754,10 +3753,10 @@ } // 材料发货数量 String materialInvoiceAmountSql = "select '' as coding,i.settleAccountsDepart " - + "as depart,i.tousseAmount from MaterialInvoice i " + + "as depart,mi.amount from MaterialInvoice i inner join MaterialInvoice mi on i.id=mi.materialInvoiceId " + "where i.orgUnitCoding = '" + handleDeptCode + "' " - + " and (i.tousseAmount is not null and i.tousseAmount>0) " - + "and (i.status ='收货签收' or i.status = '已发货') " + invoiceWheresql; + + " and (mi.amount is not null and mi.amount>0) " + + " " + invoiceWheresql; ResultSet materialInvoiceAmountResultSet = objectDao.executeSql(materialInvoiceAmountSql); try { @@ -3766,7 +3765,7 @@ String dept = materialInvoiceAmountResultSet.getString(2); Double tousseAmount = materialInvoiceAmountResultSet.getDouble(3); if(tousseAmount > 0){ - newMonthReport(code, dept,"2","数量统计", "器械包数量",tousseAmount,list); + newMonthReport(code, dept,"2","数量统计", "材料数量",tousseAmount,list); } } } catch (SQLException e) { @@ -3905,7 +3904,29 @@ }finally { DatabaseUtil.closeResultSetAndStatement(rs5); } - // 一次性退货 + // 材料退货 + String materialReturnSql = "select '',r.depart , (-i.settlementPrice),-i.amount " + + "from ReturnMaterialRecord r,ReturnMaterialItem i where r.id = i.returnMaterialRecord_ID" + + " and r.handleDepartCode = '"+handleDeptCode+"' and r.returnTime " + betweenSql; + if(StringUtils.isNotBlank(department)){ + returnSql += " and r.depart = '" + department + "'"; + } + ResultSet materialReturnResultSet = objectDao.executeSql(materialReturnSql); + try { + while(rs5.next()){ + String code = materialReturnResultSet.getString(1); + String dept = materialReturnResultSet.getString(2); + Double price = materialReturnResultSet.getDouble(3); + Double amount = materialReturnResultSet.getDouble(4); + + newMonthReport(code, dept, "1", "价格统计", "材料价格", price, list); + newMonthReport(code, dept, "2", "数量统计", "材料数量", amount, list); + } + }catch(Exception e){ + e.printStackTrace(); + }finally { + DatabaseUtil.closeResultSetAndStatement(materialReturnResultSet); + } return list; }