<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.huimv.getdata.mapper.ErpCenterMapper">

    <select id="getXiaoShouE" resultType="com.huimv.getdata.entity.center.XiaoShouE"
            parameterType="java.util.Date">

        SELECT M.FSETTLEORGID,M.FSALEORGID ,M.FPAYORGID ,M.FDATE,D.FREALRECAMOUNTFOR FROM T_AR_RECEIVABLE M
INNER JOIN T_AR_RECEIVEBILLENTRY D on D.FID = M.FID
        <if test="date !=null">
            where  M.FDATE >= #{date}
        </if>
 ORDER BY M.FDATE

    </select>
    <select id="getDangQianYvQi" resultType="com.huimv.getdata.entity.center.DangQianYvQi"
            parameterType="java.util.Date">
        SELECT M.FSETTLEORGID,M.FSALEORGID ,M.FPAYORGID ,M.FDATE,D.FNOTVERIFICATEAMOUNT FROM T_AR_RECEIVABLE M
INNER JOIN T_AR_RECEIVEBILLENTRY D on D.FID = M.FID
        <if test="date !=null">
            where  M.FDATE >= #{date}
        </if>
 ORDER BY M.FDATE

    </select>
    <select id="getCaiGouJinE" resultType="com.huimv.getdata.entity.center.CaiGouJinE"
            parameterType="java.util.Date">
        SELECT DISTINCT M.FDATE ,M.FPURCHASEDEPTID,M.FPURCHASEORGID ,D.FALLAMOUNT ,C.FNAME FROM T_PUR_CONTRACT M
INNER JOIN T_PUR_CONTRACTENTRY_F D on D.FID = M.FID
INNER JOIN T_BD_DEPARTMENT_L C on C.FDEPTID = M.FPURCHASEDEPTID
WHERE C.FNAME in ( '人力资源部','国内销售部','国际业务部','安环部','研发中心','花园生物','采购部','项目部')
        <if test="date !=null">
            where  M.FDATE >= #{date}
        </if>
 ORDER BY M.FDATE

    </select>
    <select id="getYangMaoZhiCaiGouJinE" resultType="com.huimv.getdata.entity.center.YangMaoZhiCaiGouJinE"
            parameterType="java.util.Date">

        SELECT  DISTINCT  M.FDATE ,M.FPURCHASEDEPTID,M.FPURCHASEORGID ,D.FALLAMOUNT ,C.FNAME ,E.FNUMBER ,B.FQTY FROM T_PUR_CONTRACT M
INNER JOIN T_PUR_CONTRACTENTRY B  on B.FID = M.FID
INNER JOIN T_PUR_CONTRACTENTRY_F D on D.FENTRYID = B.FENTRYID
INNER JOIN T_BD_MATERIAL E on E.FMATERIALID = B.FMATERIALID
INNER JOIN T_BD_DEPARTMENT_L C on C.FDEPTID = M.FPURCHASEDEPTID
WHERE C.FNAME in ( '人力资源部','国内销售部','国际业务部','安环部','研发中心','花园生物','采购部','项目部') AND E.FNUMBER ='10020002'
        <if test="date !=null">
            and  M.FDATE >= #{date}
        </if>
 ORDER BY M.FDATE
    </select>
</mapper>
