Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/javabeansource/DepartmentMonthDetailItem.java =================================================================== diff -u -r12331 -r13077 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/javabeansource/DepartmentMonthDetailItem.java (.../DepartmentMonthDetailItem.java) (revision 12331) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/javabeansource/DepartmentMonthDetailItem.java (.../DepartmentMonthDetailItem.java) (revision 13077) @@ -11,6 +11,10 @@ */ public class DepartmentMonthDetailItem { + public static final int ORDER_DISPOSABLEGOODS = 0; + public static final int ORDER_TOUSSE = 1; + public static final int ORDER_MATERIAL = 2; + private String goodsName; private String type; @@ -29,6 +33,8 @@ private String expDate; + private int typeOrder = ORDER_TOUSSE; + public String getGoodsName() { return goodsName; } @@ -43,6 +49,13 @@ public void setType(String type) { this.type = type; + if ("一次性物品".equals(type)){ + typeOrder = ORDER_DISPOSABLEGOODS; + }else if ("材料".equals(type)){ + typeOrder = ORDER_MATERIAL; + }else{ + typeOrder = ORDER_TOUSSE; + } } public String getDiposable() { @@ -100,5 +113,13 @@ public void setExpDate(String expDate) { this.expDate = expDate; } + + public int getTypeOrder() { + return typeOrder; + } + + public void setTypeOrder(int typeOrder) { + this.typeOrder = typeOrder; + } } Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java =================================================================== diff -u -r13074 -r13077 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 13074) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 13077) @@ -3711,7 +3711,26 @@ }finally { DatabaseUtil.closeResultSetAndStatement(rs); } - + // 材料发货价格 + 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"; + ResultSet materialInvoicePriceResultSet = objectDao.executeSql(materialInvoicePriceSql); + try { + while(rs.next()){ + String code = materialInvoicePriceResultSet.getString(1); + String dept = materialInvoicePriceResultSet.getString(2); + Double price = materialInvoicePriceResultSet.getDouble(3); + String columnName = "材料价格"; + + newMonthReport(code, dept,"1", "价格统计",columnName,price, list); + } + } catch (SQLException e) { + e.printStackTrace(); + }finally { + DatabaseUtil.closeResultSetAndStatement(materialInvoicePriceResultSet); + } String invoiceAmountSql = "select '' as coding,i.settleAccountsDepart " + "as depart,i.tousseAmount from Invoice i " + "where i.orgUnitCoding = '" + handleDeptCode + "' " @@ -3733,6 +3752,28 @@ }finally { DatabaseUtil.closeResultSetAndStatement(rs2); } + // 材料发货数量 + String materialInvoiceAmountSql = "select '' as coding,i.settleAccountsDepart " + + "as depart,i.tousseAmount from MaterialInvoice i " + + "where i.orgUnitCoding = '" + handleDeptCode + "' " + + " and (i.tousseAmount is not null and i.tousseAmount>0) " + + "and (i.status ='收货签收' or i.status = '已发货') " + invoiceWheresql; + + ResultSet materialInvoiceAmountResultSet = objectDao.executeSql(materialInvoiceAmountSql); + try { + while(materialInvoiceAmountResultSet.next()){ + String code = materialInvoiceAmountResultSet.getString(1); + String dept = materialInvoiceAmountResultSet.getString(2); + Double tousseAmount = materialInvoiceAmountResultSet.getDouble(3); + if(tousseAmount > 0){ + newMonthReport(code, dept,"2","数量统计", "器械包数量",tousseAmount,list); + } + } + } catch (SQLException e) { + e.printStackTrace(); + }finally { + DatabaseUtil.closeResultSetAndStatement(materialInvoiceAmountResultSet); + } // 一次性发货统计 String disposableGoodsInvoiceAmountSql = "select '' as coding,i.settleAccountsDepart " + "as depart,ii.amount from Invoice i inner join InvoiceItem ii on i.id = ii.invoice_id " @@ -3772,8 +3813,8 @@ Double money = rs3.getDouble(4); Double amount = rs3.getDouble(5); - newMonthReport(code, dept,"2", "数量统计","器械包数量",amount, list); - newMonthReport(code, dept,"1", "价格统计","器械包价格",money, list); + newMonthReport(code, dept,"2", "数量统计","材料数量",amount, list); + newMonthReport(code, dept,"1", "价格统计","材料价格",money, list); } } }catch(Exception e){ @@ -3801,8 +3842,8 @@ Double money = rs33.getDouble(4); Double amount = rs33.getDouble(5); - newMonthReport(code, dept, "2", "数量统计", "器械包数量", amount, list); - newMonthReport(code, dept, "1", "价格统计", "器械包价格", money, list); + newMonthReport(code, dept, "2", "数量统计", "材料数量", amount, list); + newMonthReport(code, dept, "1", "价格统计", "材料价格", money, list); } } }catch(Exception e){ @@ -3827,8 +3868,8 @@ newMonthReport(code, config.getOrgUnitName(), "1", "价格统计", "一次性物品总价", price, list); newMonthReport(code, config.getOrgUnitName(), "2", "数量统计", "一次性物品数量", amount, list); }else{ - newMonthReport(code, config.getOrgUnitName(), "1", "价格统计", "器械包价格", price, list); - newMonthReport(code, config.getOrgUnitName(), "2", "数量统计", "器械包数量", amount, list); + newMonthReport(code, config.getOrgUnitName(), "1", "价格统计", "材料价格", price, list); + newMonthReport(code, config.getOrgUnitName(), "2", "数量统计", "材料数量", amount, list); } } }catch(Exception e){ @@ -4316,13 +4357,17 @@ else{ o2.setDiposable("否"); } - - int value1 = ObjectUtils.compare(o1.getDiposable(), o2.getDiposable()); - if (value1 == 0) { - int value2 = ObjectUtils.compare(o1.getGoodsName(), o2.getGoodsName()); - return value2; + int compareType = o1.getTypeOrder() - o2.getTypeOrder(); + if(compareType == 0){ + int compareName = ObjectUtils.compare(o1.getGoodsName(), o2.getGoodsName()); + return compareName; } - return value1; +// int value1 = ObjectUtils.compare(o1.getDiposable(), o2.getDiposable()); +// if (value1 == 0) { +// int value2 = ObjectUtils.compare(o1.getGoodsName(), o2.getGoodsName()); +// return value2; +// } + return compareType; } }); }