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.
691 lines
32 KiB
691 lines
32 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.core.dao.PoolPaperDao">
|
|
<sql id="sql_fields_added">
|
|
t
|
|
.
|
|
invoice_code
|
|
invoiceCode,
|
|
t.image_id imageId,
|
|
t.account_period accountPeriod,
|
|
t.posting_time postingTime,
|
|
t.invoice_no invoiceNo,
|
|
t.invoice_status invoiceStatus,
|
|
t.invoice_type invoiceType,
|
|
DATE_FORMAT(t.invoice_date,'%Y-%m-%d') invoiceDate,
|
|
t.xf_tax_no xfsh,
|
|
t.xf_name xfmc,
|
|
t.invoice_amount invoiceAmount,
|
|
t.tax_amount taxAmount,
|
|
t.total_amount totalAmount,
|
|
t.gf_tax_no gfsh,
|
|
t.gf_name gfmc,
|
|
t.dk_tax_amount yxse,
|
|
t.rzh_yesorno rzzt,
|
|
t.rzlx rzlx,
|
|
DATE_FORMAT(t.rzh_date,'%Y-%m-%d') rzrq,
|
|
t.rzh_type rzfs,
|
|
t.gx_user_name rzr,
|
|
DATE_FORMAT(t.create_date,'%Y-%m-%d') createDate,
|
|
t.collect_status collectStatus,
|
|
t.qs_type qsfs,
|
|
t.qs_status qszt,
|
|
DATE_FORMAT(t.qs_date,'%Y-%m-%d') qsrq,
|
|
t.qs_name qsr,
|
|
DATE_FORMAT(t.payment_date,'%Y-%m') inAccountMonth,
|
|
t.voucher_number voucherNo,
|
|
t.amortize_status amortizeStatus,
|
|
t.amortize_amount amortizeAmount,
|
|
t.remain_amortize_amount remainAmortizeAmount,
|
|
t.amortize_document_number amortizeDocumentNumber,
|
|
t.source_system sourceSystem,
|
|
t.list_status listStatus,
|
|
t.remark remark,
|
|
t.document_number documentNumber,
|
|
DATE_FORMAT(t.collect_date,'%Y-%m-%d') collectDate,
|
|
t.collect_from collectFrom
|
|
</sql>
|
|
<select id="listPaperInvoice" parameterType="java.util.Map"
|
|
resultType="com.dxhy.core.entity.InvoicePaperEntity" databaseId="mysql">
|
|
SELECT
|
|
invoice_type invoiceType,
|
|
invoice_code invoiceCode,
|
|
invoice_no invoiceNo,
|
|
DATE_FORMAT(invoice_date,'%Y-%m-%d') invoiceDate,
|
|
gf_name buyerName,
|
|
xf_name saleName,
|
|
invoice_amount invoiceAmount,
|
|
tax_amount taxAmount,
|
|
total_amount totalAmount,
|
|
DATE_FORMAT(collect_date,'%Y-%m-%d') collectDate,
|
|
source_system sourceSystem,
|
|
in_pool_reason inPoolReason,
|
|
collect_from collectFrom
|
|
FROM
|
|
<if test="dataType == 1">
|
|
t_dx_record_invoice t
|
|
WHERE t.detail_yesorno = '1' and collect_status='1'
|
|
AND t.gf_tax_no IN
|
|
<foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test="dataType == 2">
|
|
t_dx_sale_record_invoice t
|
|
WHERE t.detail_yesorno = '1' and collect_status='1'
|
|
AND t.xf_tax_no IN
|
|
<foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test="cjksrq != null and cjksrq!= '' and cjjsrq != null and cjjsrq != ''">
|
|
AND t.collect_date BETWEEN #{cjksrq} and #{cjjsrq}
|
|
</if>
|
|
ORDER BY t.collect_date DESC
|
|
</select>
|
|
<!--其他发票-->
|
|
<select id="listOtherInvoice" parameterType="java.util.Map"
|
|
resultType="com.dxhy.core.entity.ExtOtherInvoice" databaseId="mysql">
|
|
SELECT
|
|
invoice_type invoiceType,
|
|
invoice_code invoiceCode,
|
|
invoice_no invoiceNo,
|
|
DATE_FORMAT(invoice_date,'%Y-%m-%d') invoiceDate,
|
|
DATE_FORMAT(create_date,'%Y-%m-%d') createDate,
|
|
total_amount invoiceAmount,
|
|
qs_status qszt,
|
|
DATE_FORMAT(qs_date,'%Y-%m-%d') qsrq,
|
|
qs_type qsfs,
|
|
qs_name qsr,
|
|
source_system sourceSystem,
|
|
uuid,
|
|
select_id selectId,
|
|
business_document_number businessDocumentNumber,
|
|
bzdh,
|
|
bzr,
|
|
inaccount_status inAccountStatus,
|
|
comp_code compCode
|
|
FROM
|
|
t_dx_invoice_reimburse
|
|
where invoice_type in
|
|
('91','94','95','00','97','98','101','102','103','99')
|
|
<if test="cjksyf != null and cjksyf!= '' and cjjsyf != null and cjjsyf != ''">
|
|
AND create_date between #{cjksyf} and #{cjjsyf}
|
|
</if>
|
|
<if test="kpksrq != null and kpksrq!= '' and kpjsrq != null and kpjsrq != ''">
|
|
AND invoice_date between #{kpksrq} and #{kpjsrq}
|
|
</if>
|
|
<if test="keyWord != null and keyWord != '' and keyWord != 'null' ">
|
|
AND CONCAT(IFNULL(invoice_code,''),IFNULL(invoice_no,'')) like CONCAT('%',#{keyWord},'%')
|
|
</if>
|
|
<!-- and gf_tax_no in-->
|
|
<!-- <foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">-->
|
|
<!-- #{item}-->
|
|
<!-- </foreach>-->
|
|
<if test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType != '999' ">
|
|
and invoice_type = #{invoiceType}
|
|
</if>
|
|
<if test="qszt != null and qszt != '' and qszt != 'null' and qszt != '99'">
|
|
and qs_status = #{qszt}
|
|
</if>
|
|
<if test="qsyf != null and qsyf != null and qsyf != '' and qsyf != ''">
|
|
and DATE_FORMAT(qs_date,'%Y-%m') = #{qsyf}
|
|
</if>
|
|
<if test="qsr != null and qsr != '' and qsr != 'null' ">
|
|
and qs_name like CONCAT(#{qsr},'%')
|
|
</if>
|
|
<if test="qsfs != null and qsfs != '' and qsfs != 'null' and qsfs != '99'">
|
|
and qs_type = #{qsfs}
|
|
</if>
|
|
<if test="snVoucherNumber != null and snVoucherNumber != '' and snVoucherNumber != 'null' and snVoucherNumber != '99'">
|
|
and sn_voucher_number = #{snVoucherNumber}
|
|
</if>
|
|
|
|
<if test="postingTimeStart != null and postingTimeStart != '' and postingTimeStart != 'null' and postingTimeStart != '99' and postingTimeEnd != null and postingTimeEnd != '' and postingTimeEnd != 'null' and postingTimeEnd != '99'">
|
|
and posting_time between #{postingTimeStart} and #{postingTimeEnd}
|
|
</if>
|
|
|
|
<if test="imageNumber != null and imageNumber != '' and imageNumber != 'null' and imageNumber != '99'">
|
|
and image_id = #{imageNumber}
|
|
</if>
|
|
|
|
<if test="accountPeriod != null and accountPeriod != '' and accountPeriod != 'null' and accountPeriod != '99'">
|
|
and account_period = #{accountPeriod}
|
|
</if>
|
|
<if test="inAccountStatus != null and inAccountStatus != '' and inAccountStatus != 'null' and inAccountStatus != '99' and inAccountStatus == '1'.toString()">
|
|
and inaccount_status = #{inAccountStatus}
|
|
</if>
|
|
<if test="inAccountStatus != null and inAccountStatus != '' and inAccountStatus != 'null' and inAccountStatus != '99' and inAccountStatus == '0'.toString()">
|
|
and (inaccount_status = '0' or inaccount_status = '' or inaccount_status is null)
|
|
</if>
|
|
<if test="bzdh != null and bzdh != '' and bzdh != 'null' and badh != '99'">
|
|
and bzdh = #{bzdh}
|
|
</if>
|
|
<if test="bzr != null and bzr != '' and bzr != 'null'">
|
|
and bzr like concat('%',#{bzr},'%')
|
|
</if>
|
|
<if test="companyCode != null and companyCode != '' and companyCode != 'null' and companyCode == '99'">
|
|
and (comp_code in
|
|
<foreach collection="companyCodes" index="index" item="companyCode" separator="," open="(" close=")">
|
|
#{companyCode}
|
|
</foreach>
|
|
or comp_code is null or comp_code = ''
|
|
)
|
|
</if>
|
|
<if test="companyCode != null and companyCode != '' and companyCode != 'null' and companyCode != '99' and companyCode != '88'">
|
|
and comp_code = #{companyCode}
|
|
</if>
|
|
<if test="companyCode != null and companyCode != '' and companyCode != 'null' and companyCode != '99' and companyCode == '88'">
|
|
and (comp_code is null or comp_code = '')
|
|
</if>
|
|
GROUP BY uuid having min(create_date)
|
|
ORDER BY create_date DESC
|
|
</select>
|
|
<!-- 其他发票数量-->
|
|
<select id="selectCountByParamsMap" parameterType="java.util.Map"
|
|
resultType="com.dxhy.core.entity.ExtOtherInvoice" databaseId="mysql">
|
|
SELECT count(*)
|
|
FROM
|
|
t_dx_invoice_reimburse
|
|
where invoice_type in
|
|
('91','94','95','00','97','98','101','102','103','99')
|
|
<if test="cjksyf != null and cjksyf!= '' and cjjsyf != null and cjjsyf != ''">
|
|
AND create_date between #{cjksyf} and #{cjjsyf}
|
|
</if>
|
|
<if test="kpksrq != null and kpksrq!= '' and kpjsrq != null and kpjsrq != ''">
|
|
AND invoice_date between #{kpksrq} and #{kpjsrq}
|
|
</if>
|
|
<if test="keyWord != null and keyWord != '' and keyWord != 'null' ">
|
|
AND CONCAT(IFNULL(invoice_code,''),IFNULL(invoice_no,'')) like CONCAT('%',#{keyWord},'%')
|
|
</if>
|
|
|
|
<if test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType != '999' ">
|
|
and invoice_type = #{invoiceType}
|
|
</if>
|
|
<if test="qszt != null and qszt != '' and qszt != 'null' and qszt != '99'">
|
|
and qs_status = #{qszt}
|
|
</if>
|
|
<if test="qsyf != null and qsyf != null and qsyf != '' and qsyf != ''">
|
|
and DATE_FORMAT(qs_date,'%Y-%m') = #{qsyf}
|
|
</if>
|
|
<if test="qsr != null and qsr != '' and qsr != 'null' ">
|
|
and qs_name like CONCAT(#{qsr},'%')
|
|
</if>
|
|
<if test="qsfs != null and qsfs != '' and qsfs != 'null' and qsfs != '99'">
|
|
and qs_type = #{qsfs}
|
|
</if>
|
|
<if test="companyCode != null and companyCode != '' and companyCode != 'null' and companyCode == '99'">
|
|
and (comp_code in
|
|
<foreach collection="companyCodes" index="index" item="companyCode" separator="," open="(" close=")">
|
|
#{companyCode}
|
|
</foreach>
|
|
or comp_code is null or comp_code = ''
|
|
)
|
|
</if>
|
|
<if test="companyCode != null and companyCode != '' and companyCode != 'null' and companyCode != '99' and companyCode != '88'">
|
|
and comp_code = #{companyCode}
|
|
</if>
|
|
<if test="companyCode != null and companyCode != '' and companyCode != 'null' and companyCode != '99' and companyCode == '88'">
|
|
and (comp_code is null or comp_code = '')
|
|
</if>
|
|
GROUP BY uuid having min(create_date)
|
|
ORDER BY create_date DESC
|
|
</select>
|
|
<!--增值税票-->
|
|
<select id="listAddTaxInvoice" parameterType="java.util.Map"
|
|
resultType="com.dxhy.core.entity.ExtAddTaxInvoice" databaseId="mysql">
|
|
select
|
|
t.invoice_code invoiceCode,
|
|
t.invoice_no invoiceNo,
|
|
t.invoice_status invoiceStatus,
|
|
t.invoice_type invoiceType,
|
|
DATE_FORMAT(t.invoice_date,'%Y-%m-%d') invoiceDate,
|
|
t.xf_tax_no xfsh,
|
|
t.xf_name xfmc,
|
|
t.invoice_amount invoiceAmount,
|
|
t.tax_amount taxAmount,
|
|
t.total_amount totalAmount,
|
|
t.gf_tax_no gfsh,
|
|
t.gf_name gfmc,
|
|
t.dk_tax_amount yxse,
|
|
t.rzh_yesorno rzzt,
|
|
t.rzlx rzlx,
|
|
DATE_FORMAT(t.rzh_date,'%Y-%m-%d') rzrq,
|
|
t.rzh_type rzfs,
|
|
t.gx_user_name rzr,
|
|
DATE_FORMAT(t.create_date,'%Y-%m-%d') createDate,
|
|
t.collect_status collectStatus,
|
|
t.qs_type qsfs,
|
|
t.qs_status qszt,
|
|
DATE_FORMAT(t.qs_date,'%Y-%m-%d') qsrq,
|
|
t.qs_name qsr,
|
|
DATE_FORMAT(t.payment_date,'%Y-%m') inAccountMonth,
|
|
t.voucher_number voucherNo,
|
|
t.amortize_status amortizeStatus,
|
|
t.amortize_amount amortizeAmount,
|
|
t.remain_amortize_amount remainAmortizeAmount,
|
|
t.amortize_document_number amortizeDocumentNumber,
|
|
t.source_system sourceSystem,
|
|
t.is_sale_list listStatus,
|
|
t.remark remark,
|
|
t.sn_voucher_number snVoucherNumber,
|
|
t.posting_time,
|
|
t.image_id imageId,
|
|
t.account_period accountPeriod,
|
|
t.document_number documentNumber,
|
|
DATE_FORMAT(t.collect_date,'%Y-%m-%d') collectDate,
|
|
t.collect_from collectFrom,
|
|
t.bzdh bzdh,
|
|
t.bzr bzr,
|
|
t.inaccount_status inAccountStatus,
|
|
t.comp_code compCode
|
|
from t_dx_record_invoice t
|
|
where 1 = 1
|
|
<if test="cjksyf != null and cjksyf!= '' and cjjsyf != null and cjjsyf != ''">
|
|
AND t.create_date BETWEEN #{cjksyf} and #{cjjsyf}
|
|
</if>
|
|
<if test="kpksrq != null and kpksrq!= '' and kpjsrq != null and kpjsrq != ''">
|
|
AND t.invoice_date between #{kpksrq} and #{kpjsrq}
|
|
</if>
|
|
<if test="keyWord != null and keyWord != '' and keyWord != 'null' ">
|
|
and CONCAT(IFNULL(t.invoice_code,''),IFNULL(t.invoice_no,''),IFNULL(t.xf_name,''),IFNULL(t.xf_tax_no,''))
|
|
like
|
|
CONCAT('%',#{keyWord},'%')
|
|
</if>
|
|
<!-- and t.gf_tax_no in-->
|
|
<!-- <foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">-->
|
|
<!-- #{item}-->
|
|
<!-- </foreach>-->
|
|
<if test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType != '99' ">
|
|
and t.invoice_type = #{invoiceType}
|
|
</if>
|
|
<if test="fpzt != null and fpzt != '' and fpzt != 'null' and fpzt != '99'">
|
|
and t.invoice_status = #{fpzt}
|
|
</if>
|
|
<if test="qszt != null and qszt != '' and qszt != 'null' and qszt != '99'">
|
|
and t.qs_status = #{qszt}
|
|
</if>
|
|
<if test="rzzt != null and rzzt != '' and rzzt != 'null' and rzzt != '99'">
|
|
and t.rzh_yesorno = #{rzzt}
|
|
</if>
|
|
<if test='rzzt == "99"'>
|
|
and t.rzh_yesorno in ('1','2','0')
|
|
</if>
|
|
<if test="rzlx != null and rzlx != '' and rzlx != 'null' and rzlx != '99'">
|
|
and t.rzlx = #{rzlx}
|
|
</if>
|
|
<if test="skssq != null and skssq != '' and skssq != 'null' ">
|
|
and t.rzh_belong_date = #{skssq}
|
|
</if>
|
|
<if test="qsyf != null and qsyf != null and qsyf != '' and qsyf != ''">
|
|
and DATE_FORMAT(t.qs_date,'%Y-%m') = #{qsyf}
|
|
</if>
|
|
<if test="qsr != null and qsr != '' and qsr != 'null' ">
|
|
and t.qs_name like CONCAT(#{qsr},'%')
|
|
</if>
|
|
<if test="rzr != null and rzr != '' and rzr != 'null' ">
|
|
and t.gx_user_name like CONCAT(#{rzr},'%')
|
|
</if>
|
|
<if test="qsfs != null and qsfs != '' and qsfs != 'null' and qsfs != '99'">
|
|
and t.qs_type = #{qsfs}
|
|
</if>
|
|
<if test="inAccountStatus != null and inAccountStatus != '' and inAccountStatus != 'null' and inAccountStatus != '99' and inAccountStatus == '1'.toString()">
|
|
and t.inaccount_status = #{inAccountStatus}
|
|
</if>
|
|
<if test="inAccountStatus != null and inAccountStatus != '' and inAccountStatus != 'null' and inAccountStatus != '99' and inAccountStatus == '0'.toString()">
|
|
and (t.inaccount_status = '0' or t.inaccount_status = '' or t.inaccount_status is null)
|
|
</if>
|
|
<if test="inAccountMonth != null and inAccountMonth != null and inAccountMonth != '' and inAccountMonth != ''">
|
|
and DATE_FORMAT(t.payment_date,'%Y-%m') = #{inAccountMonth}
|
|
</if>
|
|
<if test="invoiceSource!=null and invoiceSource!='' and invoiceSource!='99'">
|
|
and t.invoice_source = #{invoiceSource}
|
|
</if>
|
|
<if test="bzdh != null and bzdh != '' and bzdh != 'null' and badh != '99'">
|
|
and t.bzdh = #{bzdh}
|
|
</if>
|
|
<if test="bzr != null and bzr != '' and bzr != 'null'">
|
|
and t.bzr like concat('%',#{bzr},'%')
|
|
</if>
|
|
<if test="snVoucherNumber != null and snVoucherNumber != '' and snVoucherNumber != 'null' and snVoucherNumber != '99'">
|
|
and t.sn_voucher_number = #{snVoucherNumber}
|
|
</if>
|
|
<if test="postingTimeEnd != null and postingTimeEnd != '' and postingTimeEnd != 'null' and postingTimeEnd != '99' and postingTimeStart != null and postingTimeStart != '' and postingTimeStart != 'null' and postingTimeStart != '99'">
|
|
and t.posting_time between #{postingTimeStart} and #{postingTimeEnd}
|
|
</if>
|
|
<if test="imageNumber != null and imageNumber != '' and imageNumber != 'null' and imageNumber != '99'">
|
|
and t.image_id = #{imageNumber}
|
|
</if>
|
|
<if test="accountPeriod != null and accountPeriod != '' and accountPeriod != 'null' and accountPeriod != '99'">
|
|
and t.account_period = #{accountPeriod}
|
|
</if>
|
|
<if test="companyCode != null and companyCode != '' and companyCode != 'null' and companyCode == '99'">
|
|
and (t.comp_code in
|
|
<foreach collection="companyCodes" index="index" item="companyCode" separator="," open="(" close=")">
|
|
#{companyCode}
|
|
</foreach>
|
|
or t.comp_code is null or t.comp_code = ''
|
|
)
|
|
</if>
|
|
<if test="companyCode != null and companyCode != '' and companyCode != 'null' and companyCode != '99' and companyCode != '88'">
|
|
and t.comp_code = #{companyCode}
|
|
</if>
|
|
<if test="companyCode != null and companyCode != '' and companyCode != 'null' and companyCode != '99' and companyCode == '88'">
|
|
and (t.comp_code = '' or t.comp_code is null)
|
|
</if>
|
|
</select>
|
|
<!--销项票池查询-->
|
|
<select id="listSaleInvoice" parameterType="java.util.Map"
|
|
resultType="com.dxhy.core.entity.ExtAddTaxInvoice" databaseId="mysql">
|
|
select
|
|
<include refid="sql_fields_added"/>
|
|
,t.incentive_flag incentiveFlag
|
|
,t.sn_voucher_number snVoucherNumber
|
|
,t.system_name systemName
|
|
,t.bzdh
|
|
,t.bzr
|
|
,t.inaccount_status inAccountStatus
|
|
,t.comp_code compCode
|
|
from t_dx_sale_record_invoice t
|
|
where 1 = 1
|
|
<if test="cjksyf != null and cjksyf!= '' and cjjsyf != null and cjjsyf != ''">
|
|
AND t.create_date between #{cjksyf} and #{cjjsyf}
|
|
</if>
|
|
<if test="kpksrq != null and kpksrq!= '' and kpjsrq != null and kpjsrq != ''">
|
|
AND t.invoice_date between #{kpksrq} and #{kpjsrq}
|
|
</if>
|
|
<if test="keyWord != null and keyWord != '' and keyWord != 'null' ">
|
|
and CONCAT(IFNULL(t.invoice_code,''),IFNULL(t.invoice_no,''),IFNULL(t.gf_name,''),IFNULL(t.gf_tax_no,''))
|
|
like
|
|
CONCAT('%',#{keyWord},'%')
|
|
</if>
|
|
<!-- and t.xf_tax_no in-->
|
|
<!-- <foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">-->
|
|
<!-- #{item}-->
|
|
<!-- </foreach>-->
|
|
<if test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType != '99' ">
|
|
and t.invoice_type = #{invoiceType}
|
|
</if>
|
|
<if test="invoiceStatus != null and invoiceStatus != '' and invoiceStatus != 'null' and invoiceStatus != '99'">
|
|
and t.invoice_status = #{invoiceStatus}
|
|
</if>
|
|
<if test="qszt != null and qszt != '' and qszt != 'null' and qszt != '99'">
|
|
and t.qs_status = #{qszt}
|
|
</if>
|
|
<if test="qsyf != null and qsyf != null and qsyf != '' and qsyf != ''">
|
|
and DATE_FORMAT(t.qs_date,'%Y-%m') = #{qsyf}
|
|
</if>
|
|
<if test="qsr != null and qsr != '' and qsr != 'null' ">
|
|
and t.qs_name like CONCAT(#{qsr},'%')
|
|
</if>
|
|
<if test="qsfs != null and qsfs != '' and qsfs != 'null' and qsfs != '99'">
|
|
and t.qs_type = #{qsfs}
|
|
</if>
|
|
<if test="remark != null and remark != '' and remark != 'null' ">
|
|
and t.remark like CONCAT(#{remark},'%')
|
|
</if>
|
|
<if test="listMark != null and listMark != '' and listMark != 'null' and listMark != '99'">
|
|
and t.list_status = #{listMark}
|
|
</if>
|
|
<if test="inAccountStatus != null and inAccountStatus != '' and inAccountStatus != 'null' and inAccountStatus != '99' and inAccountStatus == '1'.toString()">
|
|
and t.inaccount_status = #{inAccountStatus}
|
|
</if>
|
|
<if test="inAccountStatus != null and inAccountStatus != '' and inAccountStatus != 'null' and inAccountStatus != '99' and inAccountStatus == '0'.toString()">
|
|
and (t.inaccount_status = '' or t.inaccount_status is null or t.inaccount_status = '0')
|
|
</if>
|
|
<if test="snVoucherNumber != null and snVoucherNumber != '' and snVoucherNumber != 'null' and snVoucherNumber != '99'">
|
|
and t.sn_voucher_number = #{snVoucherNumber}
|
|
</if>
|
|
|
|
<if test="postingTimeStart != null and postingTimeStart != '' and postingTimeStart != 'null' and postingTimeStart != '99' and postingTimeEnd != null and postingTimeEnd != '' and postingTimeEnd != 'null' and postingTimeEnd != '99'">
|
|
and t.posting_time between #{postingTimeStart} and #{postingTimeEnd}
|
|
</if>
|
|
|
|
<if test="bzdh != null and bzdh != '' and bzdh != 'null' and badh != '99'">
|
|
and t.bzdh = #{bzdh}
|
|
</if>
|
|
|
|
<if test="bzr != null and bzr != '' and bzr != 'null'">
|
|
and t.bzr like concat('%',#{bzr},'%')
|
|
</if>
|
|
|
|
<if test="accountPeriod != null and accountPeriod != '' and accountPeriod != 'null' and accountPeriod != '99'">
|
|
and t.account_period = #{accountPeriod}
|
|
</if>
|
|
|
|
<if test="imageNumber != null and imageNumber != '' and imageNumber != 'null' and imageNumber != '99'">
|
|
and t.image_id = #{imageNumber}
|
|
</if>
|
|
<if test="inAccountMonth != null and inAccountMonth != null and inAccountMonth != '' and inAccountMonth != ''">
|
|
and DATE_FORMAT(t.payment_date,'%Y-%m') = #{inAccountMonth}
|
|
</if>
|
|
<if test="incentiveFlag !=null and incentiveFlag !='' and incentiveFlag!= '99'">
|
|
and t.incentive_flag like CONCAT('%',#{incentiveFlag},'%')
|
|
</if>
|
|
<if test="invoiceSource!=null and invoiceSource!='' and invoiceSource!='99'">
|
|
and t.invoice_source = #{invoiceSource}
|
|
</if>
|
|
<if test="companyCode != null and companyCode != '' and companyCode != 'null' and companyCode == '99'">
|
|
and (t.comp_code in
|
|
<foreach collection="companyCodes" index="index" item="companyCode" separator="," open="(" close=")">
|
|
#{companyCode}
|
|
</foreach>
|
|
or t.comp_code is null or t.comp_code = ''
|
|
)
|
|
</if>
|
|
<if test="companyCode != null and companyCode != '' and companyCode != 'null' and companyCode != '99' and companyCode != '88'">
|
|
and t.comp_code = #{companyCode}
|
|
</if>
|
|
<if test="companyCode != null and companyCode != '' and companyCode != 'null' and companyCode != '99' and companyCode == '88'">
|
|
and (t.comp_code = '' or t.comp_code is null)
|
|
</if>
|
|
GROUP BY t.uuid
|
|
ORDER BY t.create_date DESC
|
|
</select>
|
|
|
|
<select id="getGfName" resultType="java.lang.String">
|
|
select taxname
|
|
from sys_dept
|
|
where taxno = #{gfsh}
|
|
and org_type = '5'
|
|
</select>
|
|
|
|
<select id="getBlocName" resultType="java.lang.String">
|
|
select taxname
|
|
from sys_dept
|
|
where company = (select company from sys_dept where taxno = #{gfsh} and org_type = '5')
|
|
and org_type = '1' limit 1
|
|
</select>
|
|
|
|
|
|
<resultMap id="BaseResultMap"
|
|
type="com.dxhy.core.model.CompanyPoolJxVO">
|
|
<result column="invoice_code" property="invoiceCode"/>
|
|
<result column="invoice_no" property="invoiceNo"/>
|
|
<result column="kprq" property="invoiceDate"/>
|
|
<result column="invoice_type" property="invoiceType"/>
|
|
<result column="gfsh" property="gfsh"/>
|
|
<result column="gfmc" property="gfmc"/>
|
|
<result column="gfdzdh" property="gfdzdh"/>
|
|
<result column="gfkhhzh" property="gfkhhzh"/>
|
|
<result column="xfsh" property="xfsh"/>
|
|
<result column="xfmc" property="xfmc"/>
|
|
<result column="xfdzdh" property="xfdzdh"/>
|
|
<result column="xfkhhzh" property="xfkhhzh"/>
|
|
<result column="invoice_amount" property="invoiceAmount"/>
|
|
<result column="tax_amount" property="taxAmount"/>
|
|
<result column="jshj" property="jshj"/>
|
|
<result column="hlmc" property="hlmc"/>
|
|
<result column="ggxh" property="ggxh"/>
|
|
<result column="dw" property="dw"/>
|
|
<result column="num" property="num"/>
|
|
<result column="dj" property="dj"/>
|
|
<result column="je" property="je"/>
|
|
<result column="se" property="se"/>
|
|
<result column="sl" property="sl"/>
|
|
<result column="bz" property="bz"/>
|
|
<result column="uuid" property="uuid"/>
|
|
<result column="cph" property="cph"/>
|
|
<result column="lx" property="lx"/>
|
|
<result column="txrqq" property="txrqq"/>
|
|
<result column="txrqz" property="txrqz"/>
|
|
<result column="in_account_status" property="inAccountStatus"/>
|
|
</resultMap>
|
|
|
|
<select id="listAddTaxInvoiceDetail" parameterType="java.util.Map"
|
|
resultMap="BaseResultMap" databaseId="mysql">
|
|
select
|
|
t.invoice_code,t.invoice_no,DATE_FORMAT(t.invoice_date,'%Y-%m-%d')
|
|
kprq,t.gf_tax_no gfsh,t.gf_name gfmc,t.gf_address_and_phone gfdzdh,t.gf_bank_and_no gfkhhzh,
|
|
t.invoice_type,
|
|
t.xf_tax_no xfsh,t.xf_name xfmc,t.xf_address_and_phone xfdzdh,t.xf_bank_and_no
|
|
xfkhhzh,t.tax_amount,t.invoice_amount,t.rzh_belong_date skssq,
|
|
t.total_amount jshj,t.remark bz,t.uuid,b.goods_name hlmc,b.model ggxh,b.unit dw,b.num num,b.unit_price
|
|
dj,b.detail_amount je,b.tax_amount se,b.tax_rate sl,b.cph cph, b.lx lx,b.txrqq txrqq,b.txrqz txrqz,
|
|
t.in_account_status
|
|
from
|
|
${dxhyTertiary}.t_dx_record_invoice t
|
|
left JOIN ${dxhyDetail}.t_dx_record_invoice_detail b ON t.uuid = b.uuid
|
|
where t.detail_yesorno = '1'
|
|
<if test="cjksyf != null and cjksyf!= '' and cjjsyf != null and cjjsyf != ''">
|
|
AND t.create_date BETWEEN #{cjksyf} and #{cjjsyf}
|
|
</if>
|
|
<if test="kpksrq != null and kpksrq!= '' and kpjsrq != null and kpjsrq != ''">
|
|
AND t.invoice_date between #{kpksrq} and #{kpjsrq}
|
|
</if>
|
|
<if test="keyWord != null and keyWord != '' and keyWord != 'null' ">
|
|
and CONCAT(IFNULL(t.invoice_code,''),IFNULL(t.invoice_no,''),IFNULL(t.xf_name,'')) like
|
|
CONCAT('%',#{keyWord},'%')
|
|
</if>
|
|
and t.gf_tax_no in
|
|
<foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
<if test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType != '99' ">
|
|
and t.invoice_type = #{invoiceType}
|
|
</if>
|
|
<if test="fpzt != null and fpzt != '' and fpzt != 'null' and fpzt != '99'">
|
|
and t.invoice_status = #{fpzt}
|
|
</if>
|
|
<if test="qszt != null and qszt != '' and qszt != 'null' and qszt != '99'">
|
|
and t.qs_status = #{qszt}
|
|
</if>
|
|
<if test="rzzt != null and rzzt != '' and rzzt != 'null' and rzzt != '99'">
|
|
and t.rzh_yesorno = #{rzzt}
|
|
</if>
|
|
<if test='rzzt == "99"'>
|
|
and t.rzh_yesorno in ('1','2','0')
|
|
</if>
|
|
<if test="rzlx != null and rzlx != '' and rzlx != 'null' and rzlx != '99'">
|
|
and t.rzlx = #{rzlx}
|
|
</if>
|
|
<if test="skssq != null and skssq != '' and skssq != 'null' ">
|
|
and t.rzh_belong_date = #{skssq}
|
|
</if>
|
|
<if test="qsyf != null and qsyf != null and qsyf != '' and qsyf != ''">
|
|
and DATE_FORMAT(t.qs_date,'%Y-%m') = #{qsyf}
|
|
</if>
|
|
<if test="qsr != null and qsr != '' and qsr != 'null' ">
|
|
and t.qs_name like CONCAT(#{qsr},'%')
|
|
</if>
|
|
<if test="rzr != null and rzr != '' and rzr != 'null' ">
|
|
and t.confirm_user like CONCAT(#{rzr},'%')
|
|
</if>
|
|
<if test="qsfs != null and qsfs != '' and qsfs != 'null' and qsfs != '99'">
|
|
and t.qs_type = #{qsfs}
|
|
</if>
|
|
<if test="inAccountStatus != null and inAccountStatus != '' and inAccountStatus != 'null' and inAccountStatus != '99'">
|
|
and t.payment_status = #{inAccountStatus}
|
|
</if>
|
|
<if test="inAccountMonth != null and inAccountMonth != null and inAccountMonth != '' and inAccountMonth != ''">
|
|
and DATE_FORMAT(t.payment_date,'%Y-%m') = #{inAccountMonth}
|
|
</if>
|
|
<if test="invoiceSource!=null and invoiceSource!='' and invoiceSource!='99'">
|
|
and t.invoice_source = #{invoiceSource}
|
|
</if>
|
|
</select>
|
|
|
|
|
|
<select id="listSaleInvoiceDetail" parameterType="java.util.Map"
|
|
resultMap="BaseResultMap" databaseId="mysql">
|
|
select
|
|
t.invoice_code,t.invoice_no,DATE_FORMAT(t.invoice_date,'%Y-%m-%d')
|
|
kprq,t.gf_tax_no gfsh,t.gf_name gfmc,t.gf_address_and_phone gfdzdh,t.gf_bank_and_no gfkhhzh,
|
|
t.invoice_type,
|
|
t.xf_tax_no xfsh,t.xf_name xfmc,t.xf_address_and_phone xfdzdh,t.xf_bank_and_no
|
|
xfkhhzh,t.tax_amount,t.invoice_amount,t.rzh_belong_date skssq,
|
|
t.total_amount jshj,t.remark bz,t.uuid,b.goods_name hlmc,b.model ggxh,b.unit dw,b.num num,b.unit_price
|
|
dj,b.detail_amount je,b.tax_amount se,b.tax_rate sl,b.cph cph, b.lx lx,b.txrqq txrqq,b.txrqz txrqz,
|
|
t.in_account_status,b.incentive_flag incentiveFlag
|
|
from
|
|
${dxhyTertiary}.t_dx_sale_record_invoice t
|
|
left JOIN ${dxhyDetail}.t_dx_record_invoice_detail_sales b ON t.uuid = b.uuid
|
|
where t.detail_yesorno = '1'
|
|
<if test="cjksyf != null and cjksyf!= '' and cjjsyf != null and cjjsyf != ''">
|
|
AND t.create_date BETWEEN #{cjksyf} and #{cjjsyf}
|
|
</if>
|
|
<if test="kpksrq != null and kpksrq!= '' and kpjsrq != null and kpjsrq != ''">
|
|
AND t.invoice_date between #{kpksrq} and #{kpjsrq}
|
|
</if>
|
|
<if test="keyWord != null and keyWord != '' and keyWord != 'null' ">
|
|
and CONCAT(IFNULL(t.invoice_code,''),IFNULL(t.invoice_no,''),IFNULL(t.xf_name,'')) like
|
|
CONCAT('%',#{keyWord},'%')
|
|
</if>
|
|
and t.xf_tax_no in
|
|
<foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
<if test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType != '99' ">
|
|
and t.invoice_type = #{invoiceType}
|
|
</if>
|
|
<if test="fpzt != null and fpzt != '' and fpzt != 'null' and fpzt != '99'">
|
|
and t.invoice_status = #{fpzt}
|
|
</if>
|
|
<if test="qszt != null and qszt != '' and qszt != 'null' and qszt != '99'">
|
|
and t.qs_status = #{qszt}
|
|
</if>
|
|
<if test="rzzt != null and rzzt != '' and rzzt != 'null' and rzzt != '99'">
|
|
and t.rzh_yesorno = #{rzzt}
|
|
</if>
|
|
<if test='rzzt == "99"'>
|
|
and t.rzh_yesorno in ('1','2','0')
|
|
</if>
|
|
<if test="rzlx != null and rzlx != '' and rzlx != 'null' and rzlx != '99'">
|
|
and t.rzlx = #{rzlx}
|
|
</if>
|
|
<if test="skssq != null and skssq != '' and skssq != 'null' ">
|
|
and t.rzh_belong_date = #{skssq}
|
|
</if>
|
|
<if test="qsyf != null and qsyf != null and qsyf != '' and qsyf != ''">
|
|
and DATE_FORMAT(t.qs_date,'%Y-%m') = #{qsyf}
|
|
</if>
|
|
<if test="qsr != null and qsr != '' and qsr != 'null' ">
|
|
and t.qs_name like CONCAT(#{qsr},'%')
|
|
</if>
|
|
<if test="rzr != null and rzr != '' and rzr != 'null' ">
|
|
and t.confirm_user like CONCAT(#{rzr},'%')
|
|
</if>
|
|
<if test="qsfs != null and qsfs != '' and qsfs != 'null' and qsfs != '99'">
|
|
and t.qs_type = #{qsfs}
|
|
</if>
|
|
<if test="inAccountStatus != null and inAccountStatus != '' and inAccountStatus != 'null' and inAccountStatus != '99'">
|
|
and t.payment_status = #{inAccountStatus}
|
|
</if>
|
|
<if test="inAccountMonth != null and inAccountMonth != null and inAccountMonth != '' and inAccountMonth != ''">
|
|
and DATE_FORMAT(t.payment_date,'%Y-%m') = #{inAccountMonth}
|
|
</if>
|
|
<if test="incentiveFlag !=null and incentiveFlag !='' and incentiveFlag!= '99'">
|
|
and t.incentive_flag like CONCAT('%',#{incentiveFlag},'%')
|
|
</if>
|
|
<if test="listMark != null and listMark != '' and listMark != 'null' and listMark != '99'">
|
|
and t.list_status = #{listMark}
|
|
</if>
|
|
<if test="remark != null and remark != '' and remark != 'null' ">
|
|
and t.remark like CONCAT(#{remark},'%')
|
|
</if>
|
|
<if test="invoiceSource!=null and invoiceSource!='' and invoiceSource!='99'">
|
|
and t.invoice_source = #{invoiceSource}
|
|
</if>
|
|
</select>
|
|
</mapper>
|
|
|