yxh
8 小时以前 e61966a89350cf11940d5bd538a5dda06cb6b437
ruoyi-project/src/main/resources/mapper/project/ServiceFunddetailMapper.xml
@@ -37,6 +37,10 @@
        <result property="amount" column="Amount"/>
        <result property="taxamount" column="TaxAmount"/>
        <result property="taxedamount" column="TaxedAmount"/>
        <result property="vatAmount" column="vat_amount"/>
        <result property="cityTaxAmount" column="city_tax_amount"/>
        <result property="laborPretaxAmount" column="labor_pretax_amount"/>
        <result property="taxVersion" column="tax_version"/>
        <result property="prepaidamount" column="PrepaidAmount"/>
        <result property="invoicecount" column="InvoiceCount"/>
        <result property="attachcount" column="AttachCount"/>
@@ -108,6 +112,10 @@
               TaxAmount,
               InvoiceCount,
               TaxedAmount,
               vat_amount,
               city_tax_amount,
               labor_pretax_amount,
               tax_version,
               AttachCount,
               Quantity,
               Price,
@@ -232,6 +240,10 @@
        a.TaxAmount,
        a.InvoiceCount,
        a.TaxedAmount,
        a.vat_amount,
        a.city_tax_amount,
        a.labor_pretax_amount,
        a.tax_version,
        a.AttachCount,
        a.Quantity,
        a.Price,
@@ -279,9 +291,34 @@
        where fundID = #{fundid}
    </update>
    <!-- 2026-12-03:删除个税汇总单时,清空该批次明细的算税时间与顺序号,
         与汇总单页“删除单行”(updateTaxTime 传 null)的行为保持一致。
         注意:本语句依赖 service_fund.fund_tax_id,必须在解绑(clearFundTaxRelationByFundTaxIds)之前执行。 -->
    <update id="clearTaxTimeByFundTaxIds">
        update service_funddetail d
        join service_fund f on d.FundID = f.id
        set d.tax_time = null,
            d.xh = null
        where f.fund_tax_id in
        <foreach item="item" index="index" collection="fundTaxIds" open="(" separator="," close=")">
            #{item}
        </foreach>
    </update>
    <select id="getTaxSum" parameterType="com.ruoyi.project.domain.vo.TaxMoneyByItemEO"
            resultType="com.ruoyi.project.domain.vo.TaxMoneySumEO">
        SELECT sum(a.Amount) amounts, sum(a.TaxAmount) taxAmounts, sum(a.TaxedAmount) taxedAmounts, max(a.xh) as xh,a.IDCardNo
        SELECT sum(a.Amount)                                                     amounts,
               sum(COALESCE(a.labor_pretax_amount, a.Amount))                     laborPretaxAmounts,
               sum(COALESCE(a.TaxAmount, 0))                                      taxAmounts,
               sum(COALESCE(a.TaxedAmount, 0))                                    taxedAmounts,
               sum(COALESCE(a.vat_amount, 0))                                     vatAmounts,
               sum(COALESCE(a.city_tax_amount, 0))                                cityTaxAmounts,
               sum(CASE WHEN a.tax_version IS NOT NULL AND a.tax_version &lt;&gt; #{taxVersion}
                        THEN 1 ELSE 0 END)                                        otherVersionCount,
               max(CASE WHEN a.tax_version IS NOT NULL AND a.tax_version &lt;&gt; #{taxVersion}
                        THEN a.tax_version END)                                   otherVersion,
               max(a.xh)                                                          xh,
               a.IDCardNo
        FROM service_funddetail a,
             service_fund b
        where a.FundID = b.id