You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
173 lines
6.5 KiB
173 lines
6.5 KiB
<?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.dxhy.extend.dao.ExtTdxRecordInvoiceDao">
|
|
|
|
<resultMap id="reportStatisticsMap" type="com.dxhy.extend.model.ExtReportStatisticsModel">
|
|
<result column="totalCount" property="totalCount"/>
|
|
<result column="totalAmount" property="totalAmount"/>
|
|
<result column="totalTax" property="totalTax"/>
|
|
</resultMap>
|
|
<!-- 自定义底账表结果集映射-->
|
|
<resultMap id="recordInvoiceMap" type="com.dxhy.extend.model.ExtRecordInvoiceModel">
|
|
<result property="cutApproveDate" column="lastdate"/>
|
|
<result property="invoiceType" column="invoice_type"/>
|
|
<result property="invoiceCode" column="invoice_code"/>
|
|
<result property="invoiceNo" column="invoice_no"/>
|
|
<result property="invoiceDate" column="invoice_date"/>
|
|
<result property="gfName" column="gf_name"/>
|
|
<result property="xfName" column="xf_name"/>
|
|
<result property="gfTaxNo" column="gf_tax_no"/>
|
|
<result property="taxAmount" column="taxAmount"/>
|
|
<result property="invoiceAmount" column="invoiceAmount"/>
|
|
<result property="dkAmount" column="dkAmount"/>
|
|
|
|
</resultMap>
|
|
|
|
<select id="queryInvoice" parameterType="java.util.Map"
|
|
resultMap="recordInvoiceMap" databaseId="mysql">
|
|
SELECT
|
|
t.invoice_type,
|
|
t.gf_tax_no,
|
|
DATE_FORMAT(DATE_ADD(t.invoice_date, INTERVAL 360 DAY), '%Y%m') AS lastdate,
|
|
t.invoice_code,
|
|
t.invoice_no,
|
|
DATE_FORMAT(t.invoice_date , '%Y-%m-%d') invoice_date,
|
|
t.gf_name,
|
|
t.xf_name,
|
|
t.invoice_amount AS invoiceAmount,
|
|
t.tax_amount AS taxAmount ,
|
|
t.dk_tax_amount dxAmount
|
|
FROM
|
|
t_dx_record_invoice t
|
|
LEFT JOIN t_dx_tax_current tdtc ON t.gf_tax_no = tdtc.taxno
|
|
WHERE
|
|
(t.rzh_belong_date IS NULL OR t.rzh_belong_date = '')
|
|
AND t.invoice_amount > 0
|
|
AND invoice_status = 0
|
|
AND t.rzh_yesorno = 0
|
|
AND t.invoice_type IN ('01', '03', '14')
|
|
AND t.confirm_date IS NULL
|
|
AND t.rzh_date IS NULL
|
|
AND t.tax_amount >= 0
|
|
and t.company = #{company}
|
|
AND t.gf_tax_no IN
|
|
<foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
<if test="month !=null and month !=''">
|
|
AND period_add(tdtc.current_tax_period,#{month}) >= DATE_FORMAT(DATE_ADD(invoice_date,
|
|
INTERVAL 360 DAY),
|
|
'%Y%m')
|
|
</if>
|
|
AND DATE_FORMAT(invoice_date, '%Y%m%d') >= tdtc.select_start_date
|
|
ORDER BY
|
|
t.invoice_date ASC
|
|
</select>
|
|
<select id="queryInvoice" parameterType="java.util.Map"
|
|
resultMap="recordInvoiceMap" databaseId="oracle">
|
|
SELECT
|
|
t.invoice_type,
|
|
t.gf_tax_no,
|
|
to_char(t.invoice_date + 360, 'yyyyMM') lastdate,
|
|
t.invoice_code,
|
|
t.invoice_no,
|
|
to_char(t.invoice_date , 'yyyy-MM-dd') invoice_date,
|
|
t.gf_name,
|
|
t.xf_name,
|
|
t.invoice_amount invoiceAmount,
|
|
t.tax_amount taxAmount ,
|
|
t.dk_tax_amount dxAmount
|
|
FROM
|
|
t_dx_record_invoice t
|
|
LEFT JOIN t_dx_tax_current tdtc ON t.gf_tax_no = tdtc.taxno
|
|
WHERE
|
|
valid = 1
|
|
AND (t.rzh_belong_date IS NULL OR t.rzh_belong_date = '')
|
|
AND t.invoice_amount > 0
|
|
AND invoice_status = 0
|
|
AND t.rzh_yesorno = 0
|
|
AND t.invoice_type IN ('01', '03', '14')
|
|
AND t.confirm_date IS NULL
|
|
AND t.rzh_date IS NULL
|
|
AND t.tax_amount >= 0
|
|
and t.company = #{company}
|
|
AND t.gf_tax_no IN
|
|
<foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
<if test="month !=null and month !=''">
|
|
AND add_months(to_date(tdtc.current_tax_period,'yyyyMM'),#{month}) >=
|
|
to_date(to_char(invoice_date + 360,
|
|
'yyyyMM'),'yyyyMM')
|
|
</if>
|
|
AND to_char(invoice_date, 'yyyyMMdd') >= tdtc.select_start_date
|
|
ORDER BY
|
|
t.invoice_date ASC
|
|
</select>
|
|
|
|
<select id="selectInvoiceCount" parameterType="java.util.Map"
|
|
resultMap="reportStatisticsMap" databaseId="mysql">
|
|
SELECT
|
|
count(1) totalCount,
|
|
sum(invoice_amount) totalAmount,
|
|
sum(tax_amount) totalTax
|
|
FROM
|
|
t_dx_record_invoice t
|
|
LEFT JOIN t_dx_tax_current tdtc ON t.gf_tax_no = tdtc.taxno
|
|
WHERE
|
|
valid = 1
|
|
AND (t.rzh_belong_date IS NULL OR t.rzh_belong_date = '')
|
|
AND t.invoice_amount > 0
|
|
AND invoice_status = 0
|
|
AND t.rzh_yesorno = 0
|
|
AND t.invoice_type IN ('01', '03', '14')
|
|
AND t.confirm_date IS NULL
|
|
AND t.rzh_date IS NULL
|
|
AND t.tax_amount >= 0
|
|
and t.company = #{company}
|
|
AND t.gf_tax_no IN
|
|
<foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
<if test="month !=null and month !=''">
|
|
AND period_add(tdtc.current_tax_period,#{month}) >= DATE_FORMAT(DATE_ADD(invoice_date,
|
|
INTERVAL 360 DAY),
|
|
'%Y%m')
|
|
</if>
|
|
AND DATE_FORMAT(invoice_date, '%Y%m%d') >= tdtc.select_start_date
|
|
</select>
|
|
|
|
<select id="selectInvoiceCount" parameterType="java.util.Map"
|
|
resultMap="reportStatisticsMap" databaseId="oracle">
|
|
SELECT
|
|
count(1) totalCount,
|
|
sum(invoice_amount) totalAmount,
|
|
sum(tax_amount) totalTax
|
|
FROM
|
|
t_dx_record_invoice t
|
|
LEFT JOIN t_dx_tax_current tdtc ON t.gf_tax_no = tdtc.taxno
|
|
WHERE
|
|
valid = 1
|
|
AND (t.rzh_belong_date IS NULL OR t.rzh_belong_date = '')
|
|
AND t.invoice_amount > 0
|
|
AND invoice_status = 0
|
|
AND t.rzh_yesorno = 0
|
|
AND t.invoice_type IN ('01', '03', '14')
|
|
AND t.confirm_date IS NULL
|
|
AND t.rzh_date IS NULL
|
|
AND t.tax_amount >= 0
|
|
and t.company = #{company}
|
|
AND t.gf_tax_no IN
|
|
<foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
<if test="month !=null and month !=''">
|
|
AND add_months(to_date(tdtc.current_tax_period,'yyyyMM'),#{month}) >=
|
|
to_date(to_char(invoice_date + 360,
|
|
'yyyyMM') ,'yyyyMM')
|
|
</if>
|
|
AND to_char(invoice_date, 'yyyyMMdd') >= tdtc.select_start_date
|
|
</select>
|
|
|
|
</mapper>
|
|
|