md
This commit is contained in:
parent
067c4be61a
commit
413643c967
@ -13,6 +13,8 @@ package com.xdadan.erp.emis.mapper;
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.xdadan.erp.emis.domain.EmisSettleInvoiceRecord;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @ClassName EmisSettleInvoiceRecordMapper
|
||||
* @Description <p> 开票记录表 Mapper 接口 </p>
|
||||
@ -68,6 +70,8 @@ public interface EmisSettleInvoiceRecordMapper extends BaseMapper<EmisSettleInvo
|
||||
*/
|
||||
public int insertEmisSettleInvoiceRecord(EmisSettleInvoiceRecord emisSettleInvoiceRecord);
|
||||
|
||||
public int insertInvoiceRecordBillRel(@Param("applySeqNo") String applySeqNo,@Param("settleBillNo") String settleBillNo);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
|
||||
@ -165,6 +165,8 @@ public class EmisSettleInvoiceRecordServiceImpl extends EmisBaseService implemen
|
||||
|
||||
totalFee=totalFee.add(emisSettleBill.getRecMoney());
|
||||
|
||||
// 插入开票记录与账单的关系
|
||||
emisSettleInvoiceRecordMapper.insertInvoiceRecordBillRel(applySeqNo,billNo);
|
||||
}
|
||||
|
||||
if(BigDecimal.ZERO.compareTo(emisSettleInvoiceRecord.getApplyMoney())>=0){
|
||||
@ -177,9 +179,10 @@ public class EmisSettleInvoiceRecordServiceImpl extends EmisBaseService implemen
|
||||
emisSettleInvoiceRecord.setApplyManCode(getCurrentUser().getEmpCode());
|
||||
emisSettleInvoiceRecord.setApplySiteCode(getCurrentUser().getOwnerSiteCode());
|
||||
emisSettleInvoiceRecord.setApplyDate(new Date());
|
||||
// 插入发票记录
|
||||
// 插入开票记录
|
||||
emisSettleInvoiceRecordMapper.insertEmisSettleInvoiceRecord(emisSettleInvoiceRecord);
|
||||
|
||||
|
||||
// 重算账单已开票金额
|
||||
for(int i=0;i<settBillNoArr.length;i++) {
|
||||
String billNo=settBillNoArr[i];
|
||||
@ -196,7 +199,6 @@ public class EmisSettleInvoiceRecordServiceImpl extends EmisBaseService implemen
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 修改开票记录表
|
||||
*
|
||||
|
||||
@ -68,8 +68,10 @@
|
||||
</sql>
|
||||
|
||||
<select id="selectEmisSettleInvoiceRecordList" parameterType="EmisSettleInvoiceRecord" resultMap="EmisSettleInvoiceRecordResult">
|
||||
|
||||
select id, apply_seq_no, apply_date, apply_man_code, apply_site_code, customer_code, customer_name, settle_bill_no, settle_bill_name, apply_money, invoice_type, openbill_scope, company_name, company_tax_no, company_tel, company_address, invioce_remark, bank_name, bank_acc_no, contact, phone, real_tax_type, orig_open_money, add_tax_rate, add_open_money, open_money_max, open_money, invoice_no, invoice_status, invoice_status_desc, recieve_address, email, file_path, remark, bl_audit, audit_date, audit_man_code, audit_site_code, audit_note, op_man_code, op_date, op_site_code, open_ch_id, open_ch_status, open_ch_status_desc, open_com_code, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
from emis_settle_invoice_record a
|
||||
|
||||
<where>
|
||||
del_flag='0'
|
||||
<if test="id != null "> and id = #{id}</if>
|
||||
@ -119,9 +121,11 @@
|
||||
<if test="createSite != null and createSite != ''"> and create_site like concat('%', #{createSite}, '%')</if>
|
||||
<if test="updateSite != null and updateSite != ''"> and update_site like concat('%', #{updateSite}, '%')</if>
|
||||
|
||||
|
||||
<if test="settleBillNo != null and settleBillNo != ''">
|
||||
AND exists (
|
||||
SELECT 1 FROM
|
||||
<!--
|
||||
AND apply_seq_no IN (
|
||||
SELECT x1.apply_seq_no FROM
|
||||
emis_settle_invoice_record x1,
|
||||
emis_settle_bill x2
|
||||
WHERE
|
||||
@ -129,29 +133,46 @@
|
||||
AND x2.del_flag = '0'
|
||||
AND FIND_IN_SET( x2.settle_bill_no, x1.settle_bill_no )
|
||||
AND FIND_IN_SET( x2.settle_bill_no, #{settleBillNo})
|
||||
and a.apply_seq_no=x1.apply_seq_no
|
||||
) -->
|
||||
|
||||
and EXISTS(
|
||||
select 1 from emis_settle_bill x2,emis_settle_invoice_bill_rel x3
|
||||
where x2.del_flag = '0' and x3.del_flag = '0'
|
||||
and a.apply_seq_no=x3.apply_seq_no and x2.settle_bill_no=x3.settle_bill_no
|
||||
)
|
||||
</if>
|
||||
|
||||
</if>
|
||||
|
||||
|
||||
<if test="params.billCode != null and params.billCode != ''">
|
||||
|
||||
AND exists IN (
|
||||
and EXISTS(
|
||||
select 1 from emis_settle_bill x2,emis_settle_invoice_bill_rel x3,emis_settle_sub_bill x4
|
||||
where x2.del_flag = '0' and x3.del_flag = '0' and x4.del_flag='0'
|
||||
and a.apply_seq_no=x3.apply_seq_no
|
||||
and x2.settle_bill_no=x3.settle_bill_no
|
||||
and x4.settle_bill_no=x2.settle_bill_no
|
||||
and and FIND_IN_SET(x4.`bill_code`,#{params.billCode})
|
||||
)
|
||||
|
||||
|
||||
<!--
|
||||
AND apply_seq_no IN (
|
||||
SELECT x1.apply_seq_no FROM
|
||||
emis_settle_invoice_record x1,
|
||||
emis_settle_bill x2
|
||||
WHERE
|
||||
x1.del_flag = '0'
|
||||
AND x2.del_flag = '0'
|
||||
and a.apply_seq_no=x1.apply_seq_no
|
||||
AND FIND_IN_SET( x2.settle_bill_no, x1.settle_bill_no )
|
||||
AND exists (
|
||||
select 1 from emis_settle_sub_bill b
|
||||
where x2.settle_bill_no=b.settle_bill_no
|
||||
and ( FIND_IN_SET(b.`bill_code`,#{params.billCode}) )
|
||||
)
|
||||
|
||||
)
|
||||
-->
|
||||
|
||||
|
||||
</if>
|
||||
|
||||
@ -169,19 +190,37 @@
|
||||
and create_time <![CDATA[ <= ]]> #{params.endCreateTime}
|
||||
</if>
|
||||
|
||||
|
||||
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
|
||||
AND exists (
|
||||
SELECT 1 FROM
|
||||
|
||||
and EXISTS(
|
||||
select 1 from emis_settle_bill x2,emis_settle_invoice_bill_rel x3
|
||||
where x2.del_flag = '0' and x3.del_flag = '0'
|
||||
and a.apply_seq_no=x3.apply_seq_no and x2.settle_bill_no=x3.settle_bill_no
|
||||
AND (
|
||||
x2.salesmen = #{params.privEmpName}
|
||||
OR x2.payee = #{params.privEmpName}
|
||||
OR x2.salesmen IN (
|
||||
SELECT salesmen
|
||||
FROM emis_salesmen_rel esr
|
||||
where esr.del_flag='0' and esr.bl_open='1'
|
||||
and now() <![CDATA[ >= ]]> esr.start_date and now() <![CDATA[ <= ]]> esr.end_date
|
||||
and esr.sales_ass = #{params.privEmpName}
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
<!--
|
||||
AND apply_seq_no IN (
|
||||
SELECT x1.apply_seq_no FROM
|
||||
emis_settle_invoice_record x1,
|
||||
emis_settle_bill x2
|
||||
WHERE
|
||||
x1.del_flag = '0'
|
||||
AND x2.del_flag = '0'
|
||||
and a.apply_seq_no=x1.apply_seq_no
|
||||
AND FIND_IN_SET( x2.settle_bill_no, x1.settle_bill_no )
|
||||
AND ( x2.salesmen = #{params.privEmpName} OR x2.payee = #{params.privEmpName} OR x2.salesmen IN ( SELECT salesmen FROM emis_salesmen_rel esr where esr.del_flag='0' and esr.bl_open='1' and now() <![CDATA[ >= ]]> esr.start_date and now() <![CDATA[ <= ]]> esr.end_date and esr.sales_ass = #{params.privEmpName} ) )
|
||||
)
|
||||
-->
|
||||
</if>
|
||||
|
||||
</where>
|
||||
@ -386,6 +425,13 @@
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
||||
<insert id="insertInvoiceRecordBillRel">
|
||||
insert into emis_settle_invoice_bill_rel(apply_seq_no,settle_bill_no)
|
||||
values(#{applySeqNo},#{settleBillNo})
|
||||
</insert>
|
||||
|
||||
|
||||
<update id="updateEmisSettleInvoiceRecord" parameterType="EmisSettleInvoiceRecord">
|
||||
update emis_settle_invoice_record
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user