huangfuli 2 years ago
parent
commit
8bb9a36866

+ 3 - 5
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/StockSaleReceiptReportServiceImpl.java

@@ -398,15 +398,15 @@ public class StockSaleReceiptReportServiceImpl extends ServiceImpl<StockSaleRece
         }
         }
         String  amonutIn = baseMapper.getAmonutIn(pageView);
         String  amonutIn = baseMapper.getAmonutIn(pageView);
         String  amonutout = baseMapper.getAmonutOut(pageView);
         String  amonutout = baseMapper.getAmonutOut(pageView);
-        String  amonutMao = baseMapper.getAmonutMao(pageView);
+        Double  amonutMao = Double.valueOf(amonutIn) - Double.valueOf(amonutout);
         if(amonutIn == null){
         if(amonutIn == null){
             amonutIn = "0";
             amonutIn = "0";
         }
         }
         if(amonutout == null){
         if(amonutout == null){
             amonutout = "0";
             amonutout = "0";
         }
         }
-        if(amonutMao == null){
-            amonutMao = "0";
+        if(amonutMao < 0){
+            amonutMao = 0d;
         }
         }
         NumberFormat nf = NumberFormat.getNumberInstance();
         NumberFormat nf = NumberFormat.getNumberInstance();
         nf.setMaximumFractionDigits(2);
         nf.setMaximumFractionDigits(2);
@@ -427,8 +427,6 @@ public class StockSaleReceiptReportServiceImpl extends ServiceImpl<StockSaleRece
         biViewInfo.setBiType("利润");
         biViewInfo.setBiType("利润");
         biViewInfo.setBiViewInfoList(biViewInfoList);
         biViewInfo.setBiViewInfoList(biViewInfoList);
         biViewInfos.add(biViewInfo);
         biViewInfos.add(biViewInfo);
-
-
         return biViewInfos;
         return biViewInfos;
     }
     }
 
 

+ 23 - 40
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/StockSaleReceiptReportMapper.xml

@@ -106,69 +106,52 @@
     <select id="getAmonutIn" parameterType="Map"
     <select id="getAmonutIn" parameterType="Map"
             resultType="java.lang.String">
             resultType="java.lang.String">
         SELECT
         SELECT
-        sum(amount_ing_receivable) as amount
+        sum(ei.amount_money) as amount
         FROM
         FROM
-        stock_sale_receipt_report s
-        LEFT JOIN warehouse_in_out_info wioi ON wioi.id = s.warehouse_record_id and wioi.delete_flag = 0
-        LEFT JOIN warehouse_base_info wbi ON wbi.id = wioi.base_id and wbi.delete_flag = 0
+        expense_info ei
+        LEFT JOIN warehouse_base_info wbi ON wbi.comp_id = ei.comp_id and wbi.delete_flag = 0 and wbi.warehouse_name = ei.warehouse_name
+        LEFT JOIN contract_management_info cmi ON cmi.comp_id = ei.comp_id and cmi.delete_flag = 0 and cmi.contract_no = ei.contract_no
         WHERE
         WHERE
-        s.delete_flag = 0
-        AND s.comp_id = #{compId}
-        and s.delivery_date > #{seachMoth}
+        ei.delete_flag = 0
+        AND ei.comp_id = #{compId}
+        and ei.expenses_type = '1'
+        and ei.update_date > #{seachMoth}
         <if test="jointVentureParties != null">
         <if test="jointVentureParties != null">
-            AND wbi.joint_venture_parties = #{jointVentureParties}
+            AND (wbi.joint_venture_parties = #{jointVentureParties} or cmi.joint_venture_parties = #{jointVentureParties})
         </if>
         </if>
     </select>
     </select>
 
 
     <select id="getAmonutOut" parameterType="Map"
     <select id="getAmonutOut" parameterType="Map"
             resultType="java.lang.String">
             resultType="java.lang.String">
         SELECT
         SELECT
-        IFNULL( sum( s.amount_ing_payable ), 0 ) + IFNULL((
+        IFNULL( sum( ei.amount_money ), 0 ) + IFNULL((
         SELECT
         SELECT
         sum( p.amount_ing_payable )
         sum( p.amount_ing_payable )
         FROM
         FROM
         payment_management p
         payment_management p
+        LEFT JOIN warehouse_base_info wbi ON wbi.comp_id = p.comp_id and wbi.delete_flag = 0 and wbi.warehouse_name = p.warehouse_name
         WHERE
         WHERE
         p.delete_flag = 0
         p.delete_flag = 0
         AND p.comp_id = #{compId}
         AND p.comp_id = #{compId}
         AND p.create_date > #{seachMoth}
         AND p.create_date > #{seachMoth}
+        <if test="jointVentureParties != null">
+            AND (wbi.joint_venture_parties = #{jointVentureParties} or cmi.joint_venture_parties = #{jointVentureParties})
+        </if>
         ),
         ),
         0
         0
-        ) + IFNULL((
-        SELECT
-        sum( amount )
-        FROM
-        inventory_cost_info i
-        WHERE
-        i.delete_flag = 0
-        AND i.comp_id = #{compId}
-        AND i.create_date > #{seachMoth}
-        ),
-        0
-        )
-        + IFNULL((
-        SELECT
-        sum( sale_cost )
-        FROM
-        stock_sale_receipt_report s
-        WHERE
-        s.delete_flag = 0
-        AND s.comp_id = #{compId}
-        AND s.delivery_date > #{seachMoth}
-        ),
-        0
-        ) as aa
+        )  as aa
         FROM
         FROM
-        stock_purchase_receipt_report s
-        LEFT JOIN warehouse_in_out_info wioi ON wioi.id = s.warehouse_record_id and wioi.delete_flag = 0
-        LEFT JOIN warehouse_base_info wbi ON wbi.id = wioi.base_id and wbi.delete_flag = 0
+        expense_info ei
+        LEFT JOIN warehouse_base_info wbi ON wbi.comp_id = ei.comp_id and wbi.delete_flag = 0 and wbi.warehouse_name = ei.warehouse_name
+        LEFT JOIN contract_management_info cmi ON cmi.comp_id = ei.comp_id and cmi.delete_flag = 0 and cmi.contract_no = ei.contract_no
         WHERE
         WHERE
-        s.delete_flag = 0
-        AND s.comp_id = #{compId}
+        ei.delete_flag = 0
+        AND ei.comp_id = #{compId}
+        and ei.expenses_type = '2'
+        and ei.update_date > #{seachMoth}
         <if test="jointVentureParties != null">
         <if test="jointVentureParties != null">
-            AND wbi.joint_venture_parties = #{jointVentureParties}
+            AND (wbi.joint_venture_parties = #{jointVentureParties} or cmi.joint_venture_parties = #{jointVentureParties})
         </if>
         </if>
-        AND s.warehousing_date > #{seachMoth}
     </select>
     </select>