|
|
@@ -185,6 +185,9 @@
|
|
|
<if test='fee.type != null and fee.type != "" and fee.type == "3"'>
|
|
|
acc.src_cn_name corpName,
|
|
|
</if>
|
|
|
+ <if test='fee.type == null or fee.type == ""'>
|
|
|
+ acc.corp_cn_name corpName,
|
|
|
+ </if>
|
|
|
SUM(( CASE acc.account_dc WHEN 'D' THEN acc.amount_dr WHEN 'C' THEN acc.amount_cr ELSE 0 END ) ) AS amount,
|
|
|
SUM(( CASE acc.account_dc WHEN 'D' THEN acc.amount_dr_usd WHEN 'C' THEN acc.amount_cr_usd ELSE 0 END ) ) AS amountUsd,
|
|
|
SUM(( CASE acc.account_dc WHEN 'D' THEN acc.stl_amount_dr_usd WHEN 'C' THEN acc.stl_amount_cr_usd ELSE 0 END ) ) AS amountUsdAlready,
|
|
|
@@ -247,6 +250,9 @@
|
|
|
<if test='fee.type != null and fee.type != "" and fee.type == "3"'>
|
|
|
GROUP BY acc.src_id
|
|
|
</if>
|
|
|
+ <if test='fee.type == null or fee.type == ""'>
|
|
|
+ GROUP BY acc.corp_id
|
|
|
+ </if>
|
|
|
</select>
|
|
|
<select id="feeSummaryExport" resultType="org.springblade.los.statisticAnalysis.FeeSummaryRD">
|
|
|
SELECT
|
|
|
@@ -259,6 +265,9 @@
|
|
|
<if test='fee.type != null and fee.type != "" and fee.type == "3"'>
|
|
|
acc.src_cn_name corpName,
|
|
|
</if>
|
|
|
+ <if test='fee.type == null or fee.type == ""'>
|
|
|
+ acc.corp_cn_name corpName,
|
|
|
+ </if>
|
|
|
SUM(( CASE acc.account_dc WHEN 'D' THEN acc.amount_dr WHEN 'C' THEN acc.amount_cr ELSE 0 END ) ) AS amount,
|
|
|
SUM(( CASE acc.account_dc WHEN 'D' THEN acc.amount_dr_usd WHEN 'C' THEN acc.amount_cr_usd ELSE 0 END ) ) AS amountUsd,
|
|
|
SUM(( CASE acc.account_dc WHEN 'D' THEN acc.stl_amount_dr_usd WHEN 'C' THEN acc.stl_amount_cr_usd ELSE 0 END ) ) AS amountUsdAlready,
|
|
|
@@ -321,6 +330,9 @@
|
|
|
<if test='fee.type != null and fee.type != "" and fee.type == "3"'>
|
|
|
GROUP BY acc.src_id
|
|
|
</if>
|
|
|
+ <if test='fee.type == null or fee.type == ""'>
|
|
|
+ GROUP BY acc.corp_id
|
|
|
+ </if>
|
|
|
</select>
|
|
|
<select id="feeSummaryDetail" resultType="org.springblade.los.statisticAnalysis.FeeSummaryDetailRD">
|
|
|
SELECT
|
|
|
@@ -333,6 +345,9 @@
|
|
|
<if test='fee.type != null and fee.type != "" and fee.type == "3"'>
|
|
|
acc.src_cn_name corpName,
|
|
|
</if>
|
|
|
+ <if test='fee.type == null or fee.type == ""'>
|
|
|
+ acc.corp_cn_name corpName,
|
|
|
+ </if>
|
|
|
acc.bill_no billNo,
|
|
|
acc.mblno mblNo,
|
|
|
acc.etd etdDate,
|
|
|
@@ -393,7 +408,7 @@
|
|
|
and acc.approved_date <= #{fee.etdEnd}
|
|
|
</if>
|
|
|
</if>
|
|
|
- <if test='fee.type != null and fee.type != "" and fee.type == "1"'>
|
|
|
+ <!-- <if test='fee.type != null and fee.type != "" and fee.type == "1"'>
|
|
|
GROUP BY acc.corp_id
|
|
|
</if>
|
|
|
<if test='fee.type != null and fee.type != "" and fee.type == "2"'>
|
|
|
@@ -402,6 +417,11 @@
|
|
|
<if test='fee.type != null and fee.type != "" and fee.type == "3"'>
|
|
|
GROUP BY acc.src_id
|
|
|
</if>
|
|
|
+ <if test='fee.type == null or fee.type == ""'>
|
|
|
+ GROUP BY acc.id
|
|
|
+ </if>-->
|
|
|
+ GROUP BY acc.id
|
|
|
+ ORDER BY acc.corp_id
|
|
|
</select>
|
|
|
<select id="feeSummaryDetailExport" resultType="org.springblade.los.statisticAnalysis.FeeSummaryDetailRD">
|
|
|
SELECT
|
|
|
@@ -414,6 +434,9 @@
|
|
|
<if test='fee.type != null and fee.type != "" and fee.type == "3"'>
|
|
|
acc.src_cn_name corpName,
|
|
|
</if>
|
|
|
+ <if test='fee.type == null or fee.type == ""'>
|
|
|
+ acc.corp_cn_name corpName,
|
|
|
+ </if>
|
|
|
acc.bill_no billNo,
|
|
|
acc.mblno mblNo,
|
|
|
acc.etd etdDate,
|
|
|
@@ -474,7 +497,96 @@
|
|
|
and acc.approved_date <= #{fee.etdEnd}
|
|
|
</if>
|
|
|
</if>
|
|
|
+ <!-- <if test='fee.type != null and fee.type != "" and fee.type == "1"'>
|
|
|
+ GROUP BY acc.corp_id
|
|
|
+ </if>
|
|
|
+ <if test='fee.type != null and fee.type != "" and fee.type == "2"'>
|
|
|
+ GROUP BY acc.bill_corp_id
|
|
|
+ </if>
|
|
|
+ <if test='fee.type != null and fee.type != "" and fee.type == "3"'>
|
|
|
+ GROUP BY acc.src_id
|
|
|
+ </if>
|
|
|
+ <if test='fee.type == null or fee.type == ""'>
|
|
|
+ GROUP BY acc.id
|
|
|
+ </if>-->
|
|
|
+ GROUP BY acc.id
|
|
|
+ ORDER BY acc.corp_id
|
|
|
+ </select>
|
|
|
+ <select id="feeSummaryDetailNot" resultType="org.springblade.los.statisticAnalysis.FeeSummaryDetailNotRD">
|
|
|
+ SELECT
|
|
|
<if test='fee.type != null and fee.type != "" and fee.type == "1"'>
|
|
|
+ acc.corp_cn_name corpName,
|
|
|
+ </if>
|
|
|
+ <if test='fee.type != null and fee.type != "" and fee.type == "2"'>
|
|
|
+ acc.bill_corp_cn_name corpName,
|
|
|
+ </if>
|
|
|
+ <if test='fee.type != null and fee.type != "" and fee.type == "3"'>
|
|
|
+ acc.src_cn_name corpName,
|
|
|
+ </if>
|
|
|
+ <if test='fee.type == null or fee.type == ""'>
|
|
|
+ acc.corp_cn_name corpName,
|
|
|
+ </if>
|
|
|
+ acc.bill_no billNo,
|
|
|
+ acc.vessel_en_name vesselEnName,
|
|
|
+ acc.voyage_no voyageNo,
|
|
|
+ acc.mblno mblNo,
|
|
|
+ acc.etd etdDate,
|
|
|
+ acc.pod_en_name podEnName,
|
|
|
+ acc.pol_en_name polEnName,
|
|
|
+ acc.quantity_cntr_descr quantityCntrDescr,
|
|
|
+ SUM(( CASE acc.account_dc WHEN 'D' THEN (acc.amount_dr_usd-stl_amount_dr_usd) WHEN 'C' THEN (acc.amount_cr_usd-stl_amount_cr_usd) ELSE 0 END ) ) AS amountUsdNot,
|
|
|
+ SUM(( CASE acc.account_dc WHEN 'D' THEN (acc.amount_dr-acc.stl_amount_dr) WHEN 'C' THEN (acc.amount_cr-acc.stl_amount_cr) ELSE 0 END ) ) AS amountNot,
|
|
|
+ SUM(IF(uninvoiced_amount,uninvoiced_amount,0)) AS amountInvoicing,
|
|
|
+ SUM(IF(uninvoiced_amount_usd,uninvoiced_amount_usd,0)) AS amountInvoicingUsd,
|
|
|
+ SUM(acc.amount_dr-IF(uninvoiced_amount,uninvoiced_amount,0)) AS amountInvoicingNot,
|
|
|
+ SUM(acc.amount_dr_usd-IF(uninvoiced_amount_usd,uninvoiced_amount_usd,0)) AS amountInvoicingUsdNot,
|
|
|
+ acc.src_cn_name srcCnName,
|
|
|
+ acc.operator_name operatorName
|
|
|
+ FROM
|
|
|
+ los_fin_acc_bills acc
|
|
|
+ WHERE
|
|
|
+ acc.is_deleted = '0'
|
|
|
+ <if test='fee.tenantId != null and fee.tenantId != ""'>
|
|
|
+ and acc.tenant_id = #{fee.tenantId}
|
|
|
+ </if>
|
|
|
+ <if test='fee.branchId != null and fee.branchId != ""'>
|
|
|
+ and acc.branch_id = #{fee.branchId}
|
|
|
+ </if>
|
|
|
+ <if test='fee.teamId != null and fee.teamId != ""'>
|
|
|
+ and acc.team_id = #{fee.teamId}
|
|
|
+ </if>
|
|
|
+ <if test='fee.dc != null and fee.dc != ""'>
|
|
|
+ and acc.account_dc = #{fee.dc}
|
|
|
+ </if>
|
|
|
+ <if test='fee.businessType != null and fee.businessType != ""'>
|
|
|
+ and acc.business_type = #{fee.businessType}
|
|
|
+ </if>
|
|
|
+ <if test='fee.clientId != null'>
|
|
|
+ and acc.bill_corp_id = #{fee.clientId}
|
|
|
+ </if>
|
|
|
+ <if test='fee.corpId != null'>
|
|
|
+ and acc.corp_id = #{fee.corpId}
|
|
|
+ </if>
|
|
|
+ <if test='fee.srcId != null'>
|
|
|
+ and acc.src_id = #{fee.srcId}
|
|
|
+ </if>
|
|
|
+ <if test='fee.isBusinessDate != null and fee.isBusinessDate != "" and fee.isBusinessDate == "1"'>
|
|
|
+ <if test='fee.etdStart != null and fee.etdStart != ""'>
|
|
|
+ and acc.bill_date >= #{fee.etdStart}
|
|
|
+ </if>
|
|
|
+ <if test='fee.etdEnd != null and fee.etdEnd != ""'>
|
|
|
+ and acc.bill_date <= #{fee.etdEnd}
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test='fee.isToExamineDate != null and fee.isToExamineDate != "" and fee.isToExamineDate == "1"'>
|
|
|
+ <if test='fee.etdStart != null and fee.etdStart != ""'>
|
|
|
+ and acc.approved_date >= #{fee.etdStart}
|
|
|
+ </if>
|
|
|
+ <if test='fee.etdEnd != null and fee.etdEnd != ""'>
|
|
|
+ and acc.approved_date <= #{fee.etdEnd}
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <!-- <if test='fee.type != null and fee.type != "" and fee.type == "1"'>
|
|
|
GROUP BY acc.corp_id
|
|
|
</if>
|
|
|
<if test='fee.type != null and fee.type != "" and fee.type == "2"'>
|
|
|
@@ -483,6 +595,261 @@
|
|
|
<if test='fee.type != null and fee.type != "" and fee.type == "3"'>
|
|
|
GROUP BY acc.src_id
|
|
|
</if>
|
|
|
+ <if test='fee.type == null or fee.type == ""'>
|
|
|
+ GROUP BY acc.id
|
|
|
+ </if>-->
|
|
|
+ GROUP BY acc.id
|
|
|
+ ORDER BY acc.corp_id
|
|
|
+ </select>
|
|
|
+ <select id="feeSummaryDetailExportNot"
|
|
|
+ resultType="org.springblade.los.statisticAnalysis.FeeSummaryDetailNotRD">
|
|
|
+ SELECT
|
|
|
+ <if test='fee.type != null and fee.type != "" and fee.type == "1"'>
|
|
|
+ acc.corp_cn_name corpName,
|
|
|
+ </if>
|
|
|
+ <if test='fee.type != null and fee.type != "" and fee.type == "2"'>
|
|
|
+ acc.bill_corp_cn_name corpName,
|
|
|
+ </if>
|
|
|
+ <if test='fee.type != null and fee.type != "" and fee.type == "3"'>
|
|
|
+ acc.src_cn_name corpName,
|
|
|
+ </if>
|
|
|
+ <if test='fee.type == null or fee.type == ""'>
|
|
|
+ acc.corp_cn_name corpName,
|
|
|
+ </if>
|
|
|
+ acc.bill_no billNo,
|
|
|
+ acc.vessel_en_name vesselEnName,
|
|
|
+ acc.voyage_no voyageNo,
|
|
|
+ acc.mblno mblNo,
|
|
|
+ acc.etd etdDate,
|
|
|
+ acc.pod_en_name podEnName,
|
|
|
+ acc.pol_en_name polEnName,
|
|
|
+ acc.quantity_cntr_descr quantityCntrDescr,
|
|
|
+ SUM(( CASE acc.account_dc WHEN 'D' THEN (acc.amount_dr_usd-stl_amount_dr_usd) WHEN 'C' THEN (acc.amount_cr_usd-stl_amount_cr_usd) ELSE 0 END ) ) AS amountUsdNot,
|
|
|
+ SUM(( CASE acc.account_dc WHEN 'D' THEN (acc.amount_dr-acc.stl_amount_dr) WHEN 'C' THEN (acc.amount_cr-acc.stl_amount_cr) ELSE 0 END ) ) AS amountNot,
|
|
|
+ SUM(IF(uninvoiced_amount,uninvoiced_amount,0)) AS amountInvoicing,
|
|
|
+ SUM(IF(uninvoiced_amount_usd,uninvoiced_amount_usd,0)) AS amountInvoicingUsd,
|
|
|
+ SUM(acc.amount_dr-IF(uninvoiced_amount,uninvoiced_amount,0)) AS amountInvoicingNot,
|
|
|
+ SUM(acc.amount_dr_usd-IF(uninvoiced_amount_usd,uninvoiced_amount_usd,0)) AS amountInvoicingUsdNot,
|
|
|
+ acc.src_cn_name srcCnName,
|
|
|
+ acc.operator_name operatorName
|
|
|
+ FROM
|
|
|
+ los_fin_acc_bills acc
|
|
|
+ WHERE
|
|
|
+ acc.is_deleted = '0'
|
|
|
+ <if test='fee.tenantId != null and fee.tenantId != ""'>
|
|
|
+ and acc.tenant_id = #{fee.tenantId}
|
|
|
+ </if>
|
|
|
+ <if test='fee.branchId != null and fee.branchId != ""'>
|
|
|
+ and acc.branch_id = #{fee.branchId}
|
|
|
+ </if>
|
|
|
+ <if test='fee.teamId != null and fee.teamId != ""'>
|
|
|
+ and acc.team_id = #{fee.teamId}
|
|
|
+ </if>
|
|
|
+ <if test='fee.dc != null and fee.dc != ""'>
|
|
|
+ and acc.account_dc = #{fee.dc}
|
|
|
+ </if>
|
|
|
+ <if test='fee.businessType != null and fee.businessType != ""'>
|
|
|
+ and acc.business_type = #{fee.businessType}
|
|
|
+ </if>
|
|
|
+ <if test='fee.clientId != null'>
|
|
|
+ and acc.bill_corp_id = #{fee.clientId}
|
|
|
+ </if>
|
|
|
+ <if test='fee.corpId != null'>
|
|
|
+ and acc.corp_id = #{fee.corpId}
|
|
|
+ </if>
|
|
|
+ <if test='fee.srcId != null'>
|
|
|
+ and acc.src_id = #{fee.srcId}
|
|
|
+ </if>
|
|
|
+ <if test='fee.isBusinessDate != null and fee.isBusinessDate != "" and fee.isBusinessDate == "1"'>
|
|
|
+ <if test='fee.etdStart != null and fee.etdStart != ""'>
|
|
|
+ and acc.bill_date >= #{fee.etdStart}
|
|
|
+ </if>
|
|
|
+ <if test='fee.etdEnd != null and fee.etdEnd != ""'>
|
|
|
+ and acc.bill_date <= #{fee.etdEnd}
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test='fee.isToExamineDate != null and fee.isToExamineDate != "" and fee.isToExamineDate == "1"'>
|
|
|
+ <if test='fee.etdStart != null and fee.etdStart != ""'>
|
|
|
+ and acc.approved_date >= #{fee.etdStart}
|
|
|
+ </if>
|
|
|
+ <if test='fee.etdEnd != null and fee.etdEnd != ""'>
|
|
|
+ and acc.approved_date <= #{fee.etdEnd}
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <!-- <if test='fee.type != null and fee.type != "" and fee.type == "1"'>
|
|
|
+ GROUP BY acc.corp_id
|
|
|
+ </if>
|
|
|
+ <if test='fee.type != null and fee.type != "" and fee.type == "2"'>
|
|
|
+ GROUP BY acc.bill_corp_id
|
|
|
+ </if>
|
|
|
+ <if test='fee.type != null and fee.type != "" and fee.type == "3"'>
|
|
|
+ GROUP BY acc.src_id
|
|
|
+ </if>
|
|
|
+ <if test='fee.type == null or fee.type == ""'>
|
|
|
+ GROUP BY acc.id
|
|
|
+ </if>-->
|
|
|
+ GROUP BY acc.id
|
|
|
+ ORDER BY acc.corp_id
|
|
|
+ </select>
|
|
|
+ <select id="agingAnalysis" resultType="org.springblade.los.statisticAnalysis.AgingAnalysisRD">
|
|
|
+ SELECT
|
|
|
+ <if test='fee.type != null and fee.type != "" and fee.type == "1"'>
|
|
|
+ acc.corp_cn_name corpName,
|
|
|
+ </if>
|
|
|
+ <if test='fee.type != null and fee.type != "" and fee.type == "2"'>
|
|
|
+ acc.bill_corp_cn_name corpName,
|
|
|
+ </if>
|
|
|
+ <if test='fee.type != null and fee.type != "" and fee.type == "3"'>
|
|
|
+ acc.src_cn_name corpName,
|
|
|
+ </if>
|
|
|
+ <if test='fee.type == null or fee.type == ""'>
|
|
|
+ acc.corp_cn_name corpName,
|
|
|
+ </if>
|
|
|
+ acc.bill_no billNo,
|
|
|
+ acc.mblno mblNo,
|
|
|
+ SUM(( CASE acc.account_dc WHEN 'D' THEN (acc.amount_dr_usd-stl_amount_dr_usd) WHEN 'C' THEN (acc.amount_cr_usd-stl_amount_cr_usd) ELSE 0 END ) ) AS amountUsdArrears,
|
|
|
+ SUM(( CASE acc.account_dc WHEN 'D' THEN (acc.amount_dr-acc.stl_amount_dr) WHEN 'C' THEN (acc.amount_cr-acc.stl_amount_cr) ELSE 0 END ) ) AS amountArrears,
|
|
|
+ SUM(IF(uninvoiced_amount,uninvoiced_amount,0)) AS amountInvoicing,
|
|
|
+ SUM(IF(uninvoiced_amount_usd,uninvoiced_amount_usd,0)) AS amountInvoicingUsd,
|
|
|
+ SUM(( CASE acc.account_dc WHEN 'D' THEN (acc.amount_dr_loc) WHEN 'C' THEN (acc.amount_cr_loc) ELSE 0 END ) ) AS amountAnswer,
|
|
|
+ SUM(( CASE acc.account_dc WHEN 'D' THEN (acc.stl_amount_dr_loc) WHEN 'C' THEN (acc.stl_amount_cr_loc) ELSE 0 END ) ) AS amountSolid,
|
|
|
+ SUM(( CASE acc.account_dc WHEN 'D' THEN (IF(DATE_ADD(acc.bill_date, INTERVAL 1 MONTH)>=CURRENT_DATE(),acc.amount_dr_usd-acc.stl_amount_dr_usd,0)) WHEN 'C' THEN (IF(DATE_ADD(acc.bill_date, INTERVAL 1 MONTH)>=CURRENT_DATE(),acc.amount_cr_usd-acc.stl_amount_cr_usd,0)) ELSE 0 END ) ) AS thirty,
|
|
|
+ SUM(( CASE acc.account_dc WHEN 'D' THEN (IF(DATE_ADD(acc.bill_date, INTERVAL 1 MONTH)<CURRENT_DATE(),IF(DATE_ADD(acc.bill_date, INTERVAL 2 MONTH)>=CURRENT_DATE(),acc.amount_dr_usd-acc.stl_amount_dr_usd,0),0)) WHEN 'C' THEN (IF(DATE_ADD(acc.bill_date, INTERVAL 1 MONTH)<CURRENT_DATE(),IF(DATE_ADD(acc.bill_date, INTERVAL 2 MONTH)>=CURRENT_DATE(),acc.amount_cr_usd-acc.stl_amount_cr_usd,0),0)) ELSE 0 END ) ) AS thirtyToSixty,
|
|
|
+ SUM(( CASE acc.account_dc WHEN 'D' THEN (IF(DATE_ADD(acc.bill_date, INTERVAL 2 MONTH)<=CURRENT_DATE(),IF(DATE_ADD(acc.bill_date, INTERVAL 3 MONTH)>=CURRENT_DATE(),acc.amount_dr_usd-acc.stl_amount_dr_usd,0),0)) WHEN 'C' THEN (IF(DATE_ADD(acc.bill_date, INTERVAL 2 MONTH)>CURRENT_DATE(),IF(DATE_ADD(acc.bill_date, INTERVAL 3 MONTH)>=CURRENT_DATE(),acc.amount_cr_usd-acc.stl_amount_cr_usd,0),0)) ELSE 0 END ) ) AS sixtyToNinety,
|
|
|
+ SUM(( CASE acc.account_dc WHEN 'D' THEN (IF(DATE_ADD(acc.bill_date, INTERVAL 3 MONTH)<=CURRENT_DATE(),IF(DATE_ADD(acc.bill_date, INTERVAL 6 MONTH)>=CURRENT_DATE(),acc.amount_dr_usd-acc.stl_amount_dr_usd,0),0)) WHEN 'C' THEN (IF(DATE_ADD(acc.bill_date, INTERVAL 3 MONTH)>CURRENT_DATE(),IF(DATE_ADD(acc.bill_date, INTERVAL 6 MONTH)>=CURRENT_DATE(),acc.amount_cr_usd-acc.stl_amount_cr_usd,0),0)) ELSE 0 END ) ) AS ninetyToOneHundredAndEighty,
|
|
|
+ SUM(( CASE acc.account_dc WHEN 'D' THEN (IF(DATE_ADD(acc.bill_date, INTERVAL 6 MONTH)<CURRENT_DATE(),acc.amount_dr_usd-acc.stl_amount_dr_usd,0)) WHEN 'C' THEN (IF(DATE_ADD(acc.bill_date, INTERVAL 6 MONTH)<CURRENT_DATE(),acc.amount_cr_usd-acc.stl_amount_cr_usd,0)) ELSE 0 END ) ) AS oneHundredAndEighty,
|
|
|
+ acc.operator_name operatorName,
|
|
|
+ acc.etd etd,
|
|
|
+ acc.create_user_name creatorName
|
|
|
+ FROM
|
|
|
+ los_fin_acc_bills acc
|
|
|
+ WHERE
|
|
|
+ acc.is_deleted = '0'
|
|
|
+ <if test='fee.tenantId != null and fee.tenantId != ""'>
|
|
|
+ and acc.tenant_id = #{fee.tenantId}
|
|
|
+ </if>
|
|
|
+ <if test='fee.branchId != null and fee.branchId != ""'>
|
|
|
+ and acc.branch_id = #{fee.branchId}
|
|
|
+ </if>
|
|
|
+ <if test='fee.teamId != null and fee.teamId != ""'>
|
|
|
+ and acc.team_id = #{fee.teamId}
|
|
|
+ </if>
|
|
|
+ <if test='fee.dc != null and fee.dc != ""'>
|
|
|
+ and acc.account_dc = #{fee.dc}
|
|
|
+ </if>
|
|
|
+ <if test='fee.businessType != null and fee.businessType != ""'>
|
|
|
+ and acc.business_type = #{fee.businessType}
|
|
|
+ </if>
|
|
|
+ <if test='fee.clientId != null'>
|
|
|
+ and acc.bill_corp_id = #{fee.clientId}
|
|
|
+ </if>
|
|
|
+ <if test='fee.corpId != null'>
|
|
|
+ and acc.corp_id = #{fee.corpId}
|
|
|
+ </if>
|
|
|
+ <if test='fee.srcType != null and fee.srcType != ""'>
|
|
|
+ and acc.src_type = #{fee.srcType}
|
|
|
+ </if>
|
|
|
+ <if test='fee.srcId != null'>
|
|
|
+ and acc.src_id = #{fee.srcId}
|
|
|
+ </if>
|
|
|
+ <if test='fee.isBusinessDate != null and fee.isBusinessDate != "" and fee.isBusinessDate == "1"'>
|
|
|
+ <if test='fee.etdStart != null and fee.etdStart != ""'>
|
|
|
+ and acc.bill_date >= #{fee.etdStart}
|
|
|
+ </if>
|
|
|
+ <if test='fee.etdEnd != null and fee.etdEnd != ""'>
|
|
|
+ and acc.bill_date <= #{fee.etdEnd}
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test='fee.isToExamineDate != null and fee.isToExamineDate != "" and fee.isToExamineDate == "1"'>
|
|
|
+ <if test='fee.etdStart != null and fee.etdStart != ""'>
|
|
|
+ and acc.approved_date >= #{fee.etdStart}
|
|
|
+ </if>
|
|
|
+ <if test='fee.etdEnd != null and fee.etdEnd != ""'>
|
|
|
+ and acc.approved_date <= #{fee.etdEnd}
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ GROUP BY acc.id
|
|
|
+ ORDER BY acc.corp_id
|
|
|
+ </select>
|
|
|
+ <select id="agingAnalysisExport" resultType="org.springblade.los.statisticAnalysis.AgingAnalysisRD">
|
|
|
+ SELECT
|
|
|
+ <if test='fee.type != null and fee.type != "" and fee.type == "1"'>
|
|
|
+ acc.corp_cn_name corpName,
|
|
|
+ </if>
|
|
|
+ <if test='fee.type != null and fee.type != "" and fee.type == "2"'>
|
|
|
+ acc.bill_corp_cn_name corpName,
|
|
|
+ </if>
|
|
|
+ <if test='fee.type != null and fee.type != "" and fee.type == "3"'>
|
|
|
+ acc.src_cn_name corpName,
|
|
|
+ </if>
|
|
|
+ <if test='fee.type == null or fee.type == ""'>
|
|
|
+ acc.corp_cn_name corpName,
|
|
|
+ </if>
|
|
|
+ acc.bill_no billNo,
|
|
|
+ acc.mblno mblNo,
|
|
|
+ SUM(( CASE acc.account_dc WHEN 'D' THEN (acc.amount_dr_usd-stl_amount_dr_usd) WHEN 'C' THEN (acc.amount_cr_usd-stl_amount_cr_usd) ELSE 0 END ) ) AS amountUsdArrears,
|
|
|
+ SUM(( CASE acc.account_dc WHEN 'D' THEN (acc.amount_dr-acc.stl_amount_dr) WHEN 'C' THEN (acc.amount_cr-acc.stl_amount_cr) ELSE 0 END ) ) AS amountArrears,
|
|
|
+ SUM(IF(uninvoiced_amount,uninvoiced_amount,0)) AS amountInvoicing,
|
|
|
+ SUM(IF(uninvoiced_amount_usd,uninvoiced_amount_usd,0)) AS amountInvoicingUsd,
|
|
|
+ SUM(( CASE acc.account_dc WHEN 'D' THEN (acc.amount_dr_loc) WHEN 'C' THEN (acc.amount_cr_loc) ELSE 0 END ) ) AS amountAnswer,
|
|
|
+ SUM(( CASE acc.account_dc WHEN 'D' THEN (acc.stl_amount_dr_loc) WHEN 'C' THEN (acc.stl_amount_cr_loc) ELSE 0 END ) ) AS amountSolid,
|
|
|
+ SUM(( CASE acc.account_dc WHEN 'D' THEN (IF(DATE_ADD(acc.bill_date, INTERVAL 1 MONTH)>=CURRENT_DATE(),acc.amount_dr_usd-acc.stl_amount_dr_usd,0)) WHEN 'C' THEN (IF(DATE_ADD(acc.bill_date, INTERVAL 1 MONTH)>=CURRENT_DATE(),acc.amount_cr_usd-acc.stl_amount_cr_usd,0)) ELSE 0 END ) ) AS thirty,
|
|
|
+ SUM(( CASE acc.account_dc WHEN 'D' THEN (IF(DATE_ADD(acc.bill_date, INTERVAL 1 MONTH)<CURRENT_DATE(),IF(DATE_ADD(acc.bill_date, INTERVAL 2 MONTH)>=CURRENT_DATE(),acc.amount_dr_usd-acc.stl_amount_dr_usd,0),0)) WHEN 'C' THEN (IF(DATE_ADD(acc.bill_date, INTERVAL 1 MONTH)<CURRENT_DATE(),IF(DATE_ADD(acc.bill_date, INTERVAL 2 MONTH)>=CURRENT_DATE(),acc.amount_cr_usd-acc.stl_amount_cr_usd,0),0)) ELSE 0 END ) ) AS thirtyToSixty,
|
|
|
+ SUM(( CASE acc.account_dc WHEN 'D' THEN (IF(DATE_ADD(acc.bill_date, INTERVAL 2 MONTH)<=CURRENT_DATE(),IF(DATE_ADD(acc.bill_date, INTERVAL 3 MONTH)>=CURRENT_DATE(),acc.amount_dr_usd-acc.stl_amount_dr_usd,0),0)) WHEN 'C' THEN (IF(DATE_ADD(acc.bill_date, INTERVAL 2 MONTH)>CURRENT_DATE(),IF(DATE_ADD(acc.bill_date, INTERVAL 3 MONTH)>=CURRENT_DATE(),acc.amount_cr_usd-acc.stl_amount_cr_usd,0),0)) ELSE 0 END ) ) AS sixtyToNinety,
|
|
|
+ SUM(( CASE acc.account_dc WHEN 'D' THEN (IF(DATE_ADD(acc.bill_date, INTERVAL 3 MONTH)<=CURRENT_DATE(),IF(DATE_ADD(acc.bill_date, INTERVAL 6 MONTH)>=CURRENT_DATE(),acc.amount_dr_usd-acc.stl_amount_dr_usd,0),0)) WHEN 'C' THEN (IF(DATE_ADD(acc.bill_date, INTERVAL 3 MONTH)>CURRENT_DATE(),IF(DATE_ADD(acc.bill_date, INTERVAL 6 MONTH)>=CURRENT_DATE(),acc.amount_cr_usd-acc.stl_amount_cr_usd,0),0)) ELSE 0 END ) ) AS ninetyToOneHundredAndEighty,
|
|
|
+ SUM(( CASE acc.account_dc WHEN 'D' THEN (IF(DATE_ADD(acc.bill_date, INTERVAL 6 MONTH)<CURRENT_DATE(),acc.amount_dr_usd-acc.stl_amount_dr_usd,0)) WHEN 'C' THEN (IF(DATE_ADD(acc.bill_date, INTERVAL 6 MONTH)<CURRENT_DATE(),acc.amount_cr_usd-acc.stl_amount_cr_usd,0)) ELSE 0 END ) ) AS oneHundredAndEighty,
|
|
|
+ acc.operator_name operatorName,
|
|
|
+ acc.etd etd,
|
|
|
+ acc.create_user_name creatorName
|
|
|
+ FROM
|
|
|
+ los_fin_acc_bills acc
|
|
|
+ WHERE
|
|
|
+ acc.is_deleted = '0'
|
|
|
+ <if test='fee.tenantId != null and fee.tenantId != ""'>
|
|
|
+ and acc.tenant_id = #{fee.tenantId}
|
|
|
+ </if>
|
|
|
+ <if test='fee.branchId != null and fee.branchId != ""'>
|
|
|
+ and acc.branch_id = #{fee.branchId}
|
|
|
+ </if>
|
|
|
+ <if test='fee.teamId != null and fee.teamId != ""'>
|
|
|
+ and acc.team_id = #{fee.teamId}
|
|
|
+ </if>
|
|
|
+ <if test='fee.dc != null and fee.dc != ""'>
|
|
|
+ and acc.account_dc = #{fee.dc}
|
|
|
+ </if>
|
|
|
+ <if test='fee.businessType != null and fee.businessType != ""'>
|
|
|
+ and acc.business_type = #{fee.businessType}
|
|
|
+ </if>
|
|
|
+ <if test='fee.clientId != null'>
|
|
|
+ and acc.bill_corp_id = #{fee.clientId}
|
|
|
+ </if>
|
|
|
+ <if test='fee.corpId != null'>
|
|
|
+ and acc.corp_id = #{fee.corpId}
|
|
|
+ </if>
|
|
|
+ <if test='fee.srcType != null and fee.srcType != ""'>
|
|
|
+ and acc.src_type = #{fee.srcType}
|
|
|
+ </if>
|
|
|
+ <if test='fee.srcId != null'>
|
|
|
+ and acc.src_id = #{fee.srcId}
|
|
|
+ </if>
|
|
|
+ <if test='fee.isBusinessDate != null and fee.isBusinessDate != "" and fee.isBusinessDate == "1"'>
|
|
|
+ <if test='fee.etdStart != null and fee.etdStart != ""'>
|
|
|
+ and acc.bill_date >= #{fee.etdStart}
|
|
|
+ </if>
|
|
|
+ <if test='fee.etdEnd != null and fee.etdEnd != ""'>
|
|
|
+ and acc.bill_date <= #{fee.etdEnd}
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test='fee.isToExamineDate != null and fee.isToExamineDate != "" and fee.isToExamineDate == "1"'>
|
|
|
+ <if test='fee.etdStart != null and fee.etdStart != ""'>
|
|
|
+ and acc.approved_date >= #{fee.etdStart}
|
|
|
+ </if>
|
|
|
+ <if test='fee.etdEnd != null and fee.etdEnd != ""'>
|
|
|
+ and acc.approved_date <= #{fee.etdEnd}
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ GROUP BY acc.id
|
|
|
+ ORDER BY acc.corp_id
|
|
|
</select>
|
|
|
|
|
|
</mapper>
|