Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java =================================================================== diff -u -r13079 -r13085 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 13079) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 13085) @@ -4180,6 +4180,20 @@ + nameFilterSql + " group by i.settleaccountsdepart,d.name,d.batch) "; } + // 材料发货 + String materialInvoiceSql = " union all (select i.settleAccountsDepart,ii.materialName,sum(ii.amount),sum(ii.settlementPrice),'材料' as type,'' " + + " from MaterialInvoice i," + + "MaterialInvoiceItem ii where i.id = ii.materialInvoiceId " + + monthFilterSql + + departFilterSql + + " group by i.settleaccountsdepart,ii.materialName) "; + // 材料退货 + String materialReturnSql = " union all (select i.depart as settleaccountsdepart,ii.materialName,-sum(ii.amount),-sum(ii.settlementPrice),'材料' as type,'' " + + " from ReturnMaterialRecord i," + + "ReturnMaterialItem ii where i.id = ii.returnMaterialRecord_ID " + + monthFilterSql + + departFilterSql + + " group by i.settleaccountsdepart,ii.materialName) "; String returnGoodsSql = " union all (select rr.depart as settleaccountsdepart,ri.toussename as name," + "-sum(ri.amount) as amount,-sum(ri.settlementPrice) as settlementprice,rr.type as type" @@ -4188,11 +4202,11 @@ +" and "+returnGoodsItemPredicate + " group by rr.depart,ri.toussename,rr.type,ri.batchNumber)"; - String lostMaterial = " union all (select r.depart,r.materialName,sum(r.amount),sum(r.amount*r.materialCost),'新增器械' as type,'' " + String lostMaterial = " union all (select r.depart,r.materialName,sum(r.amount),sum(r.amount*r.materialCost),'材料' as type,'' " + " from RecyclingError r where r.packingTask_ID is null and r.errorType = '缺失' and r.handleDepartCode = '"+handleDeptCode+"' " + lostMaterialFilterSql + "group by r.depart,r.materialName )"; - String damageMaterial = " union all (select r.depart,i.materialName,sum(i.additionalAmount),sum(i.materialCost*i.additionalAmount),'新增器械','' " + String damageMaterial = " union all (select r.depart,i.materialName,sum(i.additionalAmount),sum(i.materialCost*i.additionalAmount),'材料','' " + "from RecyclingDamageRecord r,RecyclingDamageItem i where r.id = i.RecyclingDamageRecord_ID " + "and r.status != '未补充' and r.additionalDeptCode = '"+handleDeptCode+"' and i.additionalTime is not null " + damageFilterSql + " group by r.departCoding,r.depart,i.materialName )"; @@ -4204,7 +4218,7 @@ +" and "+receiveRecordItemPredicate + " group by rri.goodsName,rri.amount,rri.type,dbs.batchNumber) "; - String sql = tousseSql + diposableGoodsSql + returnGoodsSql + supplyRoomDiposableGoodsSql; + String sql = tousseSql + diposableGoodsSql +materialInvoiceSql+ returnGoodsSql +materialReturnSql+ supplyRoomDiposableGoodsSql;