case date_format(t.invoice_date,'%Y%m%d') between c.select_start_date and c.select_end_date when
true then 1
else 2 end authStatus,
@ -64,13 +64,12 @@
from t_dx_record_invoice t left join t_dx_tax_current c on t.gf_tax_no = c.taxno
left join t_dx_dk_count d on c.taxno = d.taxno and c.current_tax_period = d.skssq
WHERE date_format(t.invoice_date,'%Y-%m-%d') between #{kpksrq} and #{kpjsrq}
and t.invoice_type in('01','03','08','14','31','283','161','183','185') or (t.invoice_type ='32' and t.lq_tdyslxDm='08')
and (t.invoice_type in('01','03','08','14','31','283','161','183','185') or (t.invoice_type ='32' and t.lq_tdyslxDm='08'))
and t.rzh_yesorno = '0'
and t.auth_status in('0','5','6')
and t.export_mark = '0'
and t.company = #{company}
<if
test="sfkrz != '99' and sfkrz != null and sfkrz != '' and sfkrz != 'null' and sfkrz == '1'.toString()">
<iftest="sfkrz != '99' and sfkrz != null and sfkrz != '' and sfkrz != 'null' and sfkrz == '1'.toString()">
and t.invoice_status in ('0','7')
and t.invoice_amount>0
and t.tax_amount>=0
@ -78,8 +77,7 @@
and d.tj_status in('0','3')
</if>
<if
test="sfkrz != '99' and sfkrz != null and sfkrz != '' and sfkrz != 'null' and sfkrz == '0'.toString()">
<iftest="sfkrz != '99' and sfkrz != null and sfkrz != '' and sfkrz != 'null' and sfkrz == '0'.toString()">
and (t.invoice_status in ('1','2','3','4','8','80') or t.invoice_amount <0 or t.tax_amount <0 or
date_format(t.invoice_date,'%Y%m%d') <= c.select_start_date or
date_format(t.invoice_date,'%Y%m%d') >=
@ -93,8 +91,7 @@
<iftest="qszt != null and qszt != '' and qszt != 'null' ">
and t.qs_status = #{qszt}
</if>
<if
test="qsksrq != null and qsksrq != '' and qsksrq != 'null' and qsjsrq != null and qsjsrq != '' and qsjsrq != 'null'">
<iftest="qsksrq != null and qsksrq != '' and qsksrq != 'null' and qsjsrq != null and qsjsrq != '' and qsjsrq != 'null'">
and date_format(t.qs_date,'%Y-%m-%d') between #{qsksrq} and #{qsjsrq}
</if>
<iftest="voucherNumber != null and voucherNumber != ''">
@ -121,8 +118,7 @@
<iftest="fpzt != null and fpzt != '' and fpzt != 'null'">
and t.invoice_status = #{fpzt}
</if>
<if
test="qsfs != null and qsfs != '' and qsfs != 'null' ">
<iftest="qsfs != null and qsfs != '' and qsfs != 'null' ">
and t.qs_type = #{qsfs}
</if>
<iftest="xfmc != null and xfmc != '' and xfmc != 'null' ">
@ -134,18 +130,15 @@
<iftest="settlementNo != null and settlementNo != ''">
and t.settlement_no like concat(#{settlementNo},'%')
</if>
<if
test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
<iftest="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
and t.invoice_no = #{invoiceNo}
</if>
<!-- 按签收人查询 -->
<if
test="position != null and position != '' and position != 'null' and position == '1'.toString()">
<iftest="position != null and position != '' and position != 'null' and position == '1'.toString()">
and t.qs_name = #{username}
</if>
<if
test="businessCode != '99' and businessCode != null and businessCode != '' and businessCode != 'null' ">
<iftest="businessCode != '99' and businessCode != null and businessCode != '' and businessCode != 'null' ">
and t.dept_id = #{businessCode}
</if>
<iftest="businessCode==''">
@ -167,8 +160,8 @@
<iftest="snVoucherNumber != null and snVoucherNumber != '' and snVoucherNumber != 'null' and snVoucherNumber != '99'">
and t.sn_voucher_number = #{snVoucherNumber}
</if>
<iftest="postingTime != null and postingTime != '' and postingTime != 'null' and postingTime != '99'">
and t.postingTime = #{postingTime}
<iftest="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>
<iftest="imageId != null and imageId != '' and imageId != 'null' and imageId != '99'">
<iftest="snVoucherNumber != null and snVoucherNumber != '' and snVoucherNumber != 'null' and snVoucherNumber != '99'">
and t.sn_voucher_number = #{snVoucherNumber}
</if>
<iftest="postingTime != null and postingTime != '' and postingTime != 'null' and postingTime != '99'">
and t.posting_time = #{postingTime}
<iftest="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>
<iftest="imageId != null and imageId != '' and imageId != 'null' and imageId != '99'">
test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType != '99' ">
<iftest="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'">
<iftest="invoiceStatus != null and invoiceStatus != '' and invoiceStatus != 'null' and invoiceStatus != '99'">
and t.invoice_status = #{invoiceStatus}
</if>
<iftest="qszt != null and qszt != '' and qszt != 'null' and qszt != '99'">
@ -223,26 +224,27 @@
<iftest="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'">
<iftest="inAccountStatus != null and inAccountStatus != '' and inAccountStatus != 'null' and inAccountStatus != '99'">
and t.payment_status = #{inAccountStatus}
</if>
<iftest="postingTime != null and postingTime != '' and postingTime != 'null' and postingTime != '99'">
and t.posting_time = #{postingTime}
<iftest="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>
<iftest="imageId != null and imageId != '' and imageId != 'null' and imageId != '99'">
and t.image_id = #{imageId}
<iftest="imageNumber != null and imageNumber != '' and imageNumber != 'null' and imageNumber != '99'">
and t.image_id = #{imageNumber}
</if>
<iftest="accountPeriod != null and accountPeriod != '' and accountPeriod != 'null' and accountPeriod != '99'">
and t.account_period = #{accountPeriod}
</if>
<if
test="inAccountMonth != null and inAccountMonth != null and inAccountMonth != '' and inAccountMonth != ''">
<iftest="inAccountMonth != null and inAccountMonth != null and inAccountMonth != '' and inAccountMonth != ''">
and DATE_FORMAT(t.payment_date,'%Y-%m') = #{inAccountMonth}
</if>
<iftest="invoiceSource!=null and invoiceSource!='' and invoiceSource!='99'">
and t.invoice_source = #{invoiceSource}
</if>
<iftest="snVoucherNumber !=null and snVoucherNumber !='' and snVoucherNumber !='99'">
test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType != '999' ">
<iftest="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType != '999' ">
AND invoice_type = #{invoiceType}
</if>
<iftest="qszt != null and qszt != '' and qszt != 'null' and qszt != '99'">
@ -337,17 +338,29 @@
<iftest="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 t.sn_voucher_number = #{snVoucherNumber}-->
<!-- </if>-->
<iftest="snVoucherNumber != null and snVoucherNumber != '' and snVoucherNumber != 'null' and snVoucherNumber != '99'">
and t.sn_voucher_number = #{snVoucherNumber}
</if>
<iftest="postingTime != null and postingTime != '' and postingTime != 'null' and postingTime != '99'">
and t.posting_time = #{postingTime}
</if>
<iftest="imageId != null and imageId != '' and imageId != 'null' and imageId != '99'">
and t.image_id = #{imageId}
</if>
and sn_voucher_number = #{snVoucherNumber}
</if>
<!-- <if test="postingTime != null and postingTime != '' and postingTime != 'null' and postingTime != '99'">-->
<!-- and t.posting_time = #{postingTime}-->
<!-- </if>-->
<iftest="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="imageId != null and imageId != '' and imageId != 'null' and imageId != '99'">-->
<!-- and t.image_id = #{imageId}-->
<!-- </if>-->
<iftest="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 t.account_period = #{accountPeriod}-->
<!-- </if>-->
<iftest="accountPeriod != null and accountPeriod != '' and accountPeriod != 'null' and accountPeriod != '99'">
test="kpksrq != null and kpksrq != '' and kpksrq != 'null' and kpjsrq != null and kpjsrq != '' and kpjsrq != 'null'">
<iftest="kpksrq != null and kpksrq != '' and kpksrq != 'null' and kpjsrq != null and kpjsrq != '' and kpjsrq != 'null'">
and t.invoice_date between #{kpksrq} and #{kpjsrq}
</if>
<if
test="cjksyf != null and cjksyf != '' and cjksyf != 'null' and cjjsyf != null and cjjsyf != '' and cjjsyf != 'null'">
<iftest="cjksyf != null and cjksyf != '' and cjksyf != 'null' and cjjsyf != null and cjjsyf != '' and cjjsyf != 'null'">
and t.create_date between #{cjksyf} and #{cjjsyf}
</if>
<iftest="keyWord != null and keyWord != '' and keyWord != 'null' ">
@ -117,11 +115,14 @@
<iftest="snVoucherNumber != null and snVoucherNumber != '' and snVoucherNumber != 'null' and snVoucherNumber != '99'">
and t.sn_voucher_number = #{snVoucherNumber}
</if>
<iftest="postingTime != null and postingTime != '' and postingTime != 'null' and postingTime != '99'">
and t.posting_time = #{postingTime}
<iftest="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>
<iftest="imageId != null and imageId != '' and imageId != 'null' and imageId != '99'">
and t.image_id = #{imageId}
<iftest="imageNumber != null and imageNumber != '' and imageNumber != 'null' and imageNumber != '99'">
and t.image_id = #{imageNumber}
</if>
<iftest="accountPeriod != null and accountPeriod != '' and accountPeriod != 'null' and accountPeriod != '99'">