|
@ -776,4 +776,320 @@ |
|
|
ORDER BY a.purchaseSystemSid desc, a.brandSid DESC; |
|
|
ORDER BY a.purchaseSystemSid desc, a.brandSid DESC; |
|
|
|
|
|
|
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<select id="pcSybList" resultType="com.yxt.anrui.reportcenter.api.factoryDailyReport.PcSybVo"> |
|
|
|
|
|
SELECT |
|
|
|
|
|
a.year, |
|
|
|
|
|
so.name sybName, |
|
|
|
|
|
so.sid sybSid, |
|
|
|
|
|
ROUND(SUM(a.estimateRebate), 2) AS estimate, |
|
|
|
|
|
ROUND(SUM(a.uploadMoney), 2) AS upload, |
|
|
|
|
|
ROUND(SUM(a.adjustmentMoney), 2) AS adjust, |
|
|
|
|
|
ROUND(SUM(a.notUploadMoney), 2) AS notUploadMoney, |
|
|
|
|
|
ROUND(SUM(a.fee), 2) AS fee, |
|
|
|
|
|
ROUND(SUM(a.expense_payment), 2) AS expense_payment, |
|
|
|
|
|
ROUND(SUM(a.pending_payment), 2) AS pending_payment, |
|
|
|
|
|
ROUND(SUM(a.offset_payment), 2) AS offset_payment, |
|
|
|
|
|
ROUND(SUM(a.remaining_payment), 2) AS remaining_payment, |
|
|
|
|
|
ROUND(SUM(a.unuploaded_rebate), 2) AS unuploaded_rebate |
|
|
|
|
|
FROM ( |
|
|
|
|
|
SELECT |
|
|
|
|
|
LEFT(palceGenDate, 4) AS year, |
|
|
|
|
|
SUBSTRING_INDEX(SUBSTRING_INDEX(orgPath, '/', 2), '/', -1) AS division_name, |
|
|
|
|
|
SUM(estimateRebate) estimateRebate, |
|
|
|
|
|
SUM(uploadMoney) uploadMoney, |
|
|
|
|
|
SUM(adjustmentMoney) adjustmentMoney, |
|
|
|
|
|
SUM( |
|
|
|
|
|
estimateRebate + |
|
|
|
|
|
IFNULL(CASE WHEN isAdjustment = '是' AND adjustmentState = 1 THEN adjustmentMoney ELSE 0 END, 0) |
|
|
|
|
|
- IFNULL(uploadMoney, 0) - IFNULL(secondaryUploadMoney, 0) |
|
|
|
|
|
) AS notUploadMoney, |
|
|
|
|
|
SUM( |
|
|
|
|
|
estimateRebate + |
|
|
|
|
|
IFNULL(CASE WHEN isAdjustment = '是' AND adjustmentState = 1 THEN adjustmentMoney ELSE 0 END, 0) |
|
|
|
|
|
- (uploadMoney + secondaryUploadMoney) |
|
|
|
|
|
) AS unuploaded_rebate, |
|
|
|
|
|
SUM(onceTreatCost + secondTreatCost + tempTreatCost + expectTreatCost + expectSuppCost + |
|
|
|
|
|
onceSuppCost + secondSuppCost + tempSuppCost) AS fee, |
|
|
|
|
|
SUM(onceTreatCost + secondTreatCost + tempTreatCost) AS expense_payment, |
|
|
|
|
|
SUM(expectTreatCost) AS pending_payment, |
|
|
|
|
|
SUM(expectSuppCost + onceSuppCost + secondSuppCost + tempSuppCost) AS offset_payment, |
|
|
|
|
|
SUM( |
|
|
|
|
|
estimateRebate - (uploadMoney + secondaryUploadMoney) |
|
|
|
|
|
- (onceTreatCost + secondTreatCost + tempTreatCost) |
|
|
|
|
|
- expectTreatCost |
|
|
|
|
|
- (expectSuppCost + onceSuppCost + secondSuppCost + tempSuppCost) |
|
|
|
|
|
) AS remaining_payment |
|
|
|
|
|
FROM anrui_scm.scm_veh_rebate |
|
|
|
|
|
GROUP BY LEFT(palceGenDate, 4), SUBSTRING_INDEX(SUBSTRING_INDEX(orgPath, '/', 2), '/', -1) |
|
|
|
|
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
|
|
|
|
SELECT |
|
|
|
|
|
LEFT(palceGenDate, 4) AS year, |
|
|
|
|
|
SUBSTRING_INDEX(SUBSTRING_INDEX(orgPath, '/', 2), '/', -1) AS division_name, |
|
|
|
|
|
SUM(estimateRebate) estimateRebate, |
|
|
|
|
|
SUM(uploadMoney) uploadMoney, |
|
|
|
|
|
SUM(adjustmentMoney) adjustmentMoney, |
|
|
|
|
|
SUM( |
|
|
|
|
|
estimateRebate + |
|
|
|
|
|
IFNULL(CASE WHEN isAdjustment = '是' AND adjustmentState = 1 THEN adjustmentMoney ELSE 0 END, 0) |
|
|
|
|
|
- IFNULL(uploadMoney, 0) - IFNULL(secondaryUploadMoney, 0) |
|
|
|
|
|
) AS notUploadMoney, |
|
|
|
|
|
SUM( |
|
|
|
|
|
estimateRebate + |
|
|
|
|
|
IFNULL(CASE WHEN isAdjustment = '是' AND adjustmentState = 1 THEN adjustmentMoney ELSE 0 END, 0) |
|
|
|
|
|
- (uploadMoney + secondaryUploadMoney) |
|
|
|
|
|
) AS unuploaded_rebate, |
|
|
|
|
|
SUM(onceTreatCost + secondTreatCost + tempTreatCost + expectTreatCost + expectSuppCost + |
|
|
|
|
|
onceSuppCost + secondSuppCost + tempSuppCost) AS fee, |
|
|
|
|
|
SUM(onceTreatCost + secondTreatCost + tempTreatCost) AS expense_payment, |
|
|
|
|
|
SUM(expectTreatCost) AS pending_payment, |
|
|
|
|
|
SUM(expectSuppCost + onceSuppCost + secondSuppCost + tempSuppCost) AS offset_payment, |
|
|
|
|
|
SUM( |
|
|
|
|
|
estimateRebate - (uploadMoney + secondaryUploadMoney) |
|
|
|
|
|
- (onceTreatCost + secondTreatCost + tempTreatCost) |
|
|
|
|
|
- expectTreatCost |
|
|
|
|
|
- (expectSuppCost + onceSuppCost + secondSuppCost + tempSuppCost) |
|
|
|
|
|
) AS remaining_payment |
|
|
|
|
|
FROM anrui_scm.scm_special_rebate |
|
|
|
|
|
GROUP BY LEFT(palceGenDate, 4), SUBSTRING_INDEX(SUBSTRING_INDEX(orgPath, '/', 2), '/', -1) |
|
|
|
|
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
|
|
|
|
SELECT |
|
|
|
|
|
LEFT(collectionDate, 4) AS year, |
|
|
|
|
|
SUBSTRING_INDEX(SUBSTRING_INDEX(orgPath, '/', 2), '/', -1) AS division_name, |
|
|
|
|
|
SUM(estimateRebate) estimateRebate, |
|
|
|
|
|
SUM(uploadMoney) uploadMoney, |
|
|
|
|
|
SUM(adjustmentMoney) adjustmentMoney, |
|
|
|
|
|
SUM(estimateRebate + IFNULL(adjustmentMoney, 0) - IFNULL(uploadMoney, 0)) AS notUploadMoney, |
|
|
|
|
|
SUM(estimateRebate + IFNULL(adjustmentMoney, 0) - uploadMoney) AS unuploaded_rebate, |
|
|
|
|
|
0 AS fee, |
|
|
|
|
|
0 AS expense_payment, |
|
|
|
|
|
0 AS pending_payment, |
|
|
|
|
|
0 AS offset_payment, |
|
|
|
|
|
SUM(estimateRebate - uploadMoney) AS remaining_payment |
|
|
|
|
|
FROM anrui_scm.scm_collection_rebate |
|
|
|
|
|
GROUP BY LEFT(collectionDate, 4), SUBSTRING_INDEX(SUBSTRING_INDEX(orgPath, '/', 2), '/', -1) |
|
|
|
|
|
) a |
|
|
|
|
|
left join anrui_portal.sys_organization so on so.sid = a.division_name |
|
|
|
|
|
WHERE a.year IS NOT NULL AND a.year != '' |
|
|
|
|
|
GROUP BY a.year, a.division_name |
|
|
|
|
|
ORDER BY a.division_name desc, a.year DESC; |
|
|
|
|
|
|
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<select id="pcBrandList" resultType="com.yxt.anrui.reportcenter.api.factoryDailyReport.PcBrandVo"> |
|
|
|
|
|
SELECT |
|
|
|
|
|
a.year, |
|
|
|
|
|
a.brandSid, |
|
|
|
|
|
a.brandName, |
|
|
|
|
|
ROUND(SUM(a.estimateRebate), 2) AS estimate, |
|
|
|
|
|
ROUND(SUM(a.uploadMoney), 2) AS upload, |
|
|
|
|
|
ROUND(SUM(a.adjustmentMoney), 2) AS adjust, |
|
|
|
|
|
ROUND(SUM(a.notUploadMoney), 2) AS notUploadMoney, |
|
|
|
|
|
ROUND(SUM(a.fee), 2) AS fee, |
|
|
|
|
|
ROUND(SUM(a.expense_payment), 2) AS expense_payment, |
|
|
|
|
|
ROUND(SUM(a.pending_payment), 2) AS pending_payment, |
|
|
|
|
|
ROUND(SUM(a.offset_payment), 2) AS offset_payment, |
|
|
|
|
|
ROUND(SUM(a.remaining_payment), 2) AS remaining_payment, |
|
|
|
|
|
ROUND(SUM(a.unuploaded_rebate), 2) AS unuploaded_rebate |
|
|
|
|
|
FROM ( |
|
|
|
|
|
SELECT |
|
|
|
|
|
brandSid, |
|
|
|
|
|
brandName, |
|
|
|
|
|
LEFT(palceGenDate, 4) AS year, |
|
|
|
|
|
SUM(estimateRebate) estimateRebate, |
|
|
|
|
|
SUM(uploadMoney) uploadMoney, |
|
|
|
|
|
SUM(adjustmentMoney) adjustmentMoney, |
|
|
|
|
|
SUM( |
|
|
|
|
|
estimateRebate + |
|
|
|
|
|
IFNULL(CASE WHEN isAdjustment = '是' AND adjustmentState = 1 THEN adjustmentMoney ELSE 0 END, 0) |
|
|
|
|
|
- IFNULL(uploadMoney, 0) - IFNULL(secondaryUploadMoney, 0) |
|
|
|
|
|
) AS notUploadMoney, |
|
|
|
|
|
SUM( |
|
|
|
|
|
estimateRebate + |
|
|
|
|
|
IFNULL(CASE WHEN isAdjustment = '是' AND adjustmentState = 1 THEN adjustmentMoney ELSE 0 END, 0) |
|
|
|
|
|
- (uploadMoney + secondaryUploadMoney) |
|
|
|
|
|
) AS unuploaded_rebate, |
|
|
|
|
|
SUM(onceTreatCost + secondTreatCost + tempTreatCost + expectTreatCost + expectSuppCost + |
|
|
|
|
|
onceSuppCost + secondSuppCost + tempSuppCost) AS fee, |
|
|
|
|
|
SUM(onceTreatCost + secondTreatCost + tempTreatCost) AS expense_payment, |
|
|
|
|
|
SUM(expectTreatCost) AS pending_payment, |
|
|
|
|
|
SUM(expectSuppCost + onceSuppCost + secondSuppCost + tempSuppCost) AS offset_payment, |
|
|
|
|
|
SUM( |
|
|
|
|
|
estimateRebate - (uploadMoney + secondaryUploadMoney) |
|
|
|
|
|
- (onceTreatCost + secondTreatCost + tempTreatCost) |
|
|
|
|
|
- expectTreatCost |
|
|
|
|
|
- (expectSuppCost + onceSuppCost + secondSuppCost + tempSuppCost) |
|
|
|
|
|
) AS remaining_payment |
|
|
|
|
|
FROM anrui_scm.scm_veh_rebate |
|
|
|
|
|
where SUBSTRING_INDEX(SUBSTRING_INDEX(orgPath, '/', 2), '/', -1) = #{sybSid} |
|
|
|
|
|
GROUP BY LEFT(palceGenDate, 4),brandSid |
|
|
|
|
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
|
|
|
|
SELECT |
|
|
|
|
|
brandSid, |
|
|
|
|
|
brandName, |
|
|
|
|
|
LEFT(palceGenDate, 4) AS year, |
|
|
|
|
|
SUM(estimateRebate) estimateRebate, |
|
|
|
|
|
SUM(uploadMoney) uploadMoney, |
|
|
|
|
|
SUM(adjustmentMoney) adjustmentMoney, |
|
|
|
|
|
SUM( |
|
|
|
|
|
estimateRebate + |
|
|
|
|
|
IFNULL(CASE WHEN isAdjustment = '是' AND adjustmentState = 1 THEN adjustmentMoney ELSE 0 END, 0) |
|
|
|
|
|
- IFNULL(uploadMoney, 0) - IFNULL(secondaryUploadMoney, 0) |
|
|
|
|
|
) AS notUploadMoney, |
|
|
|
|
|
SUM( |
|
|
|
|
|
estimateRebate + |
|
|
|
|
|
IFNULL(CASE WHEN isAdjustment = '是' AND adjustmentState = 1 THEN adjustmentMoney ELSE 0 END, 0) |
|
|
|
|
|
- (uploadMoney + secondaryUploadMoney) |
|
|
|
|
|
) AS unuploaded_rebate, |
|
|
|
|
|
SUM(onceTreatCost + secondTreatCost + tempTreatCost + expectTreatCost + expectSuppCost + |
|
|
|
|
|
onceSuppCost + secondSuppCost + tempSuppCost) AS fee, |
|
|
|
|
|
SUM(onceTreatCost + secondTreatCost + tempTreatCost) AS expense_payment, |
|
|
|
|
|
SUM(expectTreatCost) AS pending_payment, |
|
|
|
|
|
SUM(expectSuppCost + onceSuppCost + secondSuppCost + tempSuppCost) AS offset_payment, |
|
|
|
|
|
SUM( |
|
|
|
|
|
estimateRebate - (uploadMoney + secondaryUploadMoney) |
|
|
|
|
|
- (onceTreatCost + secondTreatCost + tempTreatCost) |
|
|
|
|
|
- expectTreatCost |
|
|
|
|
|
- (expectSuppCost + onceSuppCost + secondSuppCost + tempSuppCost) |
|
|
|
|
|
) AS remaining_payment |
|
|
|
|
|
FROM anrui_scm.scm_special_rebate |
|
|
|
|
|
where SUBSTRING_INDEX(SUBSTRING_INDEX(orgPath, '/', 2), '/', -1) = #{sybSid} |
|
|
|
|
|
GROUP BY LEFT(palceGenDate, 4), brandSid |
|
|
|
|
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
|
|
|
|
SELECT |
|
|
|
|
|
brandSid, |
|
|
|
|
|
brandName, |
|
|
|
|
|
LEFT(collectionDate, 4) AS year, |
|
|
|
|
|
SUM(estimateRebate) estimateRebate, |
|
|
|
|
|
SUM(uploadMoney) uploadMoney, |
|
|
|
|
|
SUM(adjustmentMoney) adjustmentMoney, |
|
|
|
|
|
SUM(estimateRebate + IFNULL(adjustmentMoney, 0) - IFNULL(uploadMoney, 0)) AS notUploadMoney, |
|
|
|
|
|
SUM(estimateRebate + IFNULL(adjustmentMoney, 0) - uploadMoney) AS unuploaded_rebate, |
|
|
|
|
|
0 AS fee, |
|
|
|
|
|
0 AS expense_payment, |
|
|
|
|
|
0 AS pending_payment, |
|
|
|
|
|
0 AS offset_payment, |
|
|
|
|
|
SUM(estimateRebate - uploadMoney) AS remaining_payment |
|
|
|
|
|
FROM anrui_scm.scm_collection_rebate |
|
|
|
|
|
where SUBSTRING_INDEX(SUBSTRING_INDEX(orgPath, '/', 2), '/', -1) = #{sybSid} |
|
|
|
|
|
GROUP BY LEFT(collectionDate, 4), brandSid |
|
|
|
|
|
) a |
|
|
|
|
|
WHERE a.year IS NOT NULL AND a.year != '' |
|
|
|
|
|
GROUP BY a.year, a.brandSid |
|
|
|
|
|
ORDER BY a.brandSid desc, a.year DESC; |
|
|
|
|
|
|
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<select id="pcFgsList" resultType="com.yxt.anrui.reportcenter.api.factoryDailyReport.PcFgsVo"> |
|
|
|
|
|
SELECT |
|
|
|
|
|
a.year, |
|
|
|
|
|
a.division_name fgsSid, |
|
|
|
|
|
so.name fgsName, |
|
|
|
|
|
ROUND(SUM(a.estimateRebate), 2) AS estimate, |
|
|
|
|
|
ROUND(SUM(a.uploadMoney), 2) AS upload, |
|
|
|
|
|
ROUND(SUM(a.adjustmentMoney), 2) AS adjust, |
|
|
|
|
|
ROUND(SUM(a.notUploadMoney), 2) AS notUploadMoney, |
|
|
|
|
|
ROUND(SUM(a.fee), 2) AS fee, |
|
|
|
|
|
ROUND(SUM(a.expense_payment), 2) AS expense_payment, |
|
|
|
|
|
ROUND(SUM(a.pending_payment), 2) AS pending_payment, |
|
|
|
|
|
ROUND(SUM(a.offset_payment), 2) AS offset_payment, |
|
|
|
|
|
ROUND(SUM(a.remaining_payment), 2) AS remaining_payment, |
|
|
|
|
|
ROUND(SUM(a.unuploaded_rebate), 2) AS unuploaded_rebate |
|
|
|
|
|
FROM ( |
|
|
|
|
|
SELECT |
|
|
|
|
|
LEFT(palceGenDate, 4) AS year, |
|
|
|
|
|
SUBSTRING_INDEX(SUBSTRING_INDEX(orgPath, '/', 3), '/', -1) AS division_name, |
|
|
|
|
|
SUM(estimateRebate) estimateRebate, |
|
|
|
|
|
SUM(uploadMoney) uploadMoney, |
|
|
|
|
|
SUM(adjustmentMoney) adjustmentMoney, |
|
|
|
|
|
SUM( |
|
|
|
|
|
estimateRebate + |
|
|
|
|
|
IFNULL(CASE WHEN isAdjustment = '是' AND adjustmentState = 1 THEN adjustmentMoney ELSE 0 END, 0) |
|
|
|
|
|
- IFNULL(uploadMoney, 0) - IFNULL(secondaryUploadMoney, 0) |
|
|
|
|
|
) AS notUploadMoney, |
|
|
|
|
|
SUM( |
|
|
|
|
|
estimateRebate + |
|
|
|
|
|
IFNULL(CASE WHEN isAdjustment = '是' AND adjustmentState = 1 THEN adjustmentMoney ELSE 0 END, 0) |
|
|
|
|
|
- (uploadMoney + secondaryUploadMoney) |
|
|
|
|
|
) AS unuploaded_rebate, |
|
|
|
|
|
SUM(onceTreatCost + secondTreatCost + tempTreatCost + expectTreatCost + expectSuppCost + |
|
|
|
|
|
onceSuppCost + secondSuppCost + tempSuppCost) AS fee, |
|
|
|
|
|
SUM(onceTreatCost + secondTreatCost + tempTreatCost) AS expense_payment, |
|
|
|
|
|
SUM(expectTreatCost) AS pending_payment, |
|
|
|
|
|
SUM(expectSuppCost + onceSuppCost + secondSuppCost + tempSuppCost) AS offset_payment, |
|
|
|
|
|
SUM( |
|
|
|
|
|
estimateRebate - (uploadMoney + secondaryUploadMoney) |
|
|
|
|
|
- (onceTreatCost + secondTreatCost + tempTreatCost) |
|
|
|
|
|
- expectTreatCost |
|
|
|
|
|
- (expectSuppCost + onceSuppCost + secondSuppCost + tempSuppCost) |
|
|
|
|
|
) AS remaining_payment |
|
|
|
|
|
FROM anrui_scm.scm_veh_rebate |
|
|
|
|
|
where SUBSTRING_INDEX(SUBSTRING_INDEX(orgPath, '/', 2), '/', -1) = #{divisionSid} |
|
|
|
|
|
GROUP BY LEFT(palceGenDate, 4),SUBSTRING_INDEX(SUBSTRING_INDEX(orgPath, '/', 3), '/', -1) |
|
|
|
|
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
|
|
|
|
SELECT |
|
|
|
|
|
LEFT(palceGenDate, 4) AS year, |
|
|
|
|
|
SUBSTRING_INDEX(SUBSTRING_INDEX(orgPath, '/', 3), '/', -1) AS division_name, |
|
|
|
|
|
SUM(estimateRebate) estimateRebate, |
|
|
|
|
|
SUM(uploadMoney) uploadMoney, |
|
|
|
|
|
SUM(adjustmentMoney) adjustmentMoney, |
|
|
|
|
|
SUM( |
|
|
|
|
|
estimateRebate + |
|
|
|
|
|
IFNULL(CASE WHEN isAdjustment = '是' AND adjustmentState = 1 THEN adjustmentMoney ELSE 0 END, 0) |
|
|
|
|
|
- IFNULL(uploadMoney, 0) - IFNULL(secondaryUploadMoney, 0) |
|
|
|
|
|
) AS notUploadMoney, |
|
|
|
|
|
SUM( |
|
|
|
|
|
estimateRebate + |
|
|
|
|
|
IFNULL(CASE WHEN isAdjustment = '是' AND adjustmentState = 1 THEN adjustmentMoney ELSE 0 END, 0) |
|
|
|
|
|
- (uploadMoney + secondaryUploadMoney) |
|
|
|
|
|
) AS unuploaded_rebate, |
|
|
|
|
|
SUM(onceTreatCost + secondTreatCost + tempTreatCost + expectTreatCost + expectSuppCost + |
|
|
|
|
|
onceSuppCost + secondSuppCost + tempSuppCost) AS fee, |
|
|
|
|
|
SUM(onceTreatCost + secondTreatCost + tempTreatCost) AS expense_payment, |
|
|
|
|
|
SUM(expectTreatCost) AS pending_payment, |
|
|
|
|
|
SUM(expectSuppCost + onceSuppCost + secondSuppCost + tempSuppCost) AS offset_payment, |
|
|
|
|
|
SUM( |
|
|
|
|
|
estimateRebate - (uploadMoney + secondaryUploadMoney) |
|
|
|
|
|
- (onceTreatCost + secondTreatCost + tempTreatCost) |
|
|
|
|
|
- expectTreatCost |
|
|
|
|
|
- (expectSuppCost + onceSuppCost + secondSuppCost + tempSuppCost) |
|
|
|
|
|
) AS remaining_payment |
|
|
|
|
|
FROM anrui_scm.scm_special_rebate |
|
|
|
|
|
where SUBSTRING_INDEX(SUBSTRING_INDEX(orgPath, '/', 2), '/', -1) = #{divisionSid} |
|
|
|
|
|
GROUP BY LEFT(palceGenDate, 4), SUBSTRING_INDEX(SUBSTRING_INDEX(orgPath, '/', 3), '/', -1) |
|
|
|
|
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
|
|
|
|
SELECT |
|
|
|
|
|
LEFT(collectionDate, 4) AS year, |
|
|
|
|
|
SUBSTRING_INDEX(SUBSTRING_INDEX(orgPath, '/', 3), '/', -1) AS division_name, |
|
|
|
|
|
SUM(estimateRebate) estimateRebate, |
|
|
|
|
|
SUM(uploadMoney) uploadMoney, |
|
|
|
|
|
SUM(adjustmentMoney) adjustmentMoney, |
|
|
|
|
|
SUM(estimateRebate + IFNULL(adjustmentMoney, 0) - IFNULL(uploadMoney, 0)) AS notUploadMoney, |
|
|
|
|
|
SUM(estimateRebate + IFNULL(adjustmentMoney, 0) - uploadMoney) AS unuploaded_rebate, |
|
|
|
|
|
0 AS fee, |
|
|
|
|
|
0 AS expense_payment, |
|
|
|
|
|
0 AS pending_payment, |
|
|
|
|
|
0 AS offset_payment, |
|
|
|
|
|
SUM(estimateRebate - uploadMoney) AS remaining_payment |
|
|
|
|
|
FROM anrui_scm.scm_collection_rebate |
|
|
|
|
|
where SUBSTRING_INDEX(SUBSTRING_INDEX(orgPath, '/', 2), '/', -1) = #{divisionSid} |
|
|
|
|
|
GROUP BY LEFT(collectionDate, 4), SUBSTRING_INDEX(SUBSTRING_INDEX(orgPath, '/', 3), '/', -1) |
|
|
|
|
|
) a |
|
|
|
|
|
left join anrui_portal.sys_organization so on so.sid = a.division_name |
|
|
|
|
|
WHERE a.year IS NOT NULL AND a.year != '' |
|
|
|
|
|
GROUP BY a.year,a.division_name |
|
|
|
|
|
ORDER BY a.division_name desc, a.year DESC; |
|
|
|
|
|
</select> |
|
|
</mapper> |
|
|
</mapper> |