|
@@ -58,49 +58,68 @@
|
|
|
ORDER BY t1.sort ASC
|
|
|
</select>
|
|
|
<select id="getRemitDetailPage" resultType="com.fjhx.form.entity.RemitDetailVo">
|
|
|
- SELECT arw.transaction_time AS transactionTime,
|
|
|
- am.`alias` AS accountAliasName,
|
|
|
- t1.contract_remarks AS remark,
|
|
|
- NULL AS oppositeSubjectName1,
|
|
|
- NULL AS saleGroupExpenseCategory,
|
|
|
- IF(arw.`status` = 10, arw.amount, 0) AS incomeAmount,
|
|
|
- IF(arw.`status` = 20, arw.amount, 0) AS expenditureAmount,
|
|
|
- arw.account_remainder AS balanceAmount,
|
|
|
- t2.supplier_names AS supplierName,
|
|
|
- t1.customerShortName AS customerShortName,
|
|
|
- t1.contract_codes AS contractCode,
|
|
|
- t2.subject_name AS subjectName,
|
|
|
- t2.calculate_item_type1 AS calculateItemType1,
|
|
|
- t2.calculate_item_type2 AS calculateItemType2,
|
|
|
- t2.calculate_item_name1 AS calculateItemName1,
|
|
|
- t2.calculate_item_name2 AS calculateItemName2,
|
|
|
- t2.opposite_subject_code AS oppositeSubjectCode,
|
|
|
- t2.opposite_subject_name AS oppositeSubjectName,
|
|
|
- t2.calculate_item_str AS calculateItemStr,
|
|
|
- am.jd_subject_code AS bankSubjectCode,
|
|
|
- am.jd_subject_name AS bankSubjectName,
|
|
|
- t2.subject_calculate_item_str AS subjectCalculateItemStr,
|
|
|
- cc.voucher_no AS voucherNo,
|
|
|
- t1.belongType AS belongType
|
|
|
+ SELECT arw.id,
|
|
|
+ arw.transaction_time AS transactionTime,
|
|
|
+ am.`alias` AS accountAliasName,
|
|
|
+ IF(NOT t1.remarks IS NULL, t1.remarks, t2.remarks) AS remark,
|
|
|
+ arw.opposite_subject_name AS oppositeSubjectName1,
|
|
|
+ arw.sale_expense_category AS saleGroupExpenseCategory,
|
|
|
+ IF(arw.`status` = 10, arw.amount, 0) AS incomeAmount,
|
|
|
+ IF(arw.`status` = 20, arw.amount, 0) AS expenditureAmount,
|
|
|
+ arw.account_remainder AS balanceAmount,
|
|
|
+ t2.supplier_names AS supplierName,
|
|
|
+ t1.customerShortName AS customerShortName,
|
|
|
+ t1.contract_codes AS contractCode,
|
|
|
+ t2.subject_name AS subjectName,
|
|
|
+ t2.calculate_item_type1 AS calculateItemType1,
|
|
|
+ t2.calculate_item_type2 AS calculateItemType2,
|
|
|
+ t2.calculate_item_name1 AS calculateItemName1,
|
|
|
+ t2.calculate_item_name2 AS calculateItemName2,
|
|
|
+ t2.opposite_subject_code AS oppositeSubjectCode,
|
|
|
+ t2.opposite_subject_name AS oppositeSubjectName,
|
|
|
+ t2.calculate_item_str AS calculateItemStr,
|
|
|
+ am.jd_subject_code AS bankSubjectCode,
|
|
|
+ am.jd_subject_name AS bankSubjectName,
|
|
|
+ t2.subject_calculate_item_str AS subjectCalculateItemStr,
|
|
|
+ cc.voucher_no AS voucherNo,
|
|
|
+ t1.belongType AS belongType
|
|
|
FROM account_running_water arw
|
|
|
JOIN account_management am ON arw.account_management_id = am.id
|
|
|
LEFT JOIN cost_control cc ON arw.cost_control_id = cc.id
|
|
|
LEFT JOIN (SELECT cod.cost_control_id,
|
|
|
- GROUP_CONCAT(DISTINCT sui.`name` ) AS supplier_names,
|
|
|
- GROUP_CONCAT(asj.jd_subject_code) AS opposite_subject_code,
|
|
|
- GROUP_CONCAT(asj.jd_subject_name) AS opposite_subject_name,
|
|
|
- GROUP_CONCAT(asj.subjects_name) AS subject_name,
|
|
|
- GROUP_CONCAT(cod.calculate_item_type1) AS calculate_item_type1,
|
|
|
- GROUP_CONCAT(cod.calculate_item_name1) AS calculate_item_name1,
|
|
|
- GROUP_CONCAT(cod.calculate_item_type2) AS calculate_item_type2,
|
|
|
- GROUP_CONCAT(cod.calculate_item_name2) AS calculate_item_name2,
|
|
|
- GROUP_CONCAT(cod.calculate_item_str) AS calculate_item_str,
|
|
|
- GROUP_CONCAT(asj.subjects_name, CONCAT(' - ', cod.calculate_item_name1),
|
|
|
- IF(cod.calculate_item_name2 is null, '',
|
|
|
- CONCAT(' - ', cod.calculate_item_name2))) AS subject_calculate_item_str
|
|
|
+ GROUP_CONCAT(DISTINCT sui.`name` ) AS supplier_names,
|
|
|
+ GROUP_CONCAT(DISTINCT asj.jd_subject_code) AS opposite_subject_code,
|
|
|
+ GROUP_CONCAT(DISTINCT asj.jd_subject_name) AS opposite_subject_name,
|
|
|
+ GROUP_CONCAT(DISTINCT asj.subjects_name) AS subject_name,
|
|
|
+ GROUP_CONCAT(DISTINCT cci_1.calculate_item_type1) AS calculate_item_type1,
|
|
|
+ GROUP_CONCAT(DISTINCT cci_1.calculate_item_name1) AS calculate_item_name1,
|
|
|
+ GROUP_CONCAT(DISTINCT cci_1.calculate_item_type2) AS calculate_item_type2,
|
|
|
+ GROUP_CONCAT(DISTINCT cci_1.calculate_item_name2) AS calculate_item_name2,
|
|
|
+ GROUP_CONCAT(DISTINCT cci_1.calculate_item_str) AS calculate_item_str,
|
|
|
+ GROUP_CONCAT(DISTINCT asj.subjects_name, CONCAT(' - ', cci_1.calculate_item_name1),
|
|
|
+ IF(cci_1.calculate_item_name2 is null, '',
|
|
|
+ CONCAT(' - ', cci_1.calculate_item_name2))) AS subject_calculate_item_str,
|
|
|
+ GROUP_CONCAT(cod.remark) AS remarks
|
|
|
FROM cost_control_detail cod
|
|
|
LEFT JOIN supplier_info sui ON cod.supplier_id = sui.id
|
|
|
LEFT JOIN account_subjects asj ON cod.account_subjects_id = asj.id
|
|
|
+ LEFT JOIN (SELECT cci.cost_control_detail_id,
|
|
|
+ GROUP_CONCAT(CONCAT_WS('---', cci.type,
|
|
|
+ IFNULL(civ.calculate_item_code, ''),
|
|
|
+ civ.calculate_item_name) SEPARATOR '||') AS calculate_item_str,
|
|
|
+ GROUP_CONCAT(CASE WHEN cci.sort = 1 THEN cci.business_id END) AS calculate_item_id1,
|
|
|
+ GROUP_CONCAT(CASE WHEN cci.sort = 1 THEN cci.type END) AS calculate_item_type1,
|
|
|
+ GROUP_CONCAT(CASE WHEN cci.sort = 1 THEN civ.calculate_item_name END) AS calculate_item_name1,
|
|
|
+ GROUP_CONCAT(CASE WHEN cci.sort = 2 THEN cci.business_id END) AS calculate_item_id2,
|
|
|
+ GROUP_CONCAT(CASE WHEN cci.sort = 2 THEN cci.type END) AS calculate_item_type2,
|
|
|
+ GROUP_CONCAT(CASE WHEN cci.sort = 2 THEN civ.calculate_item_name END) AS calculate_item_name2
|
|
|
+ FROM cost_calculate_item cci
|
|
|
+ LEFT JOIN calculate_item_view civ
|
|
|
+ ON cci.business_id = civ.calculate_item_id
|
|
|
+ AND
|
|
|
+ FIND_IN_SET(cci.type, civ.calculate_item_type)
|
|
|
+ GROUP BY cci.cost_control_detail_id) cci_1
|
|
|
+ on cci_1.cost_control_detail_id = cod.id
|
|
|
GROUP BY cod.cost_control_id) t2 ON t2.cost_control_id = cc.id
|
|
|
LEFT JOIN (SELECT cl.business_id,
|
|
|
cl.amount,
|
|
@@ -109,7 +128,9 @@
|
|
|
cu.short_name AS customerShortName,
|
|
|
GROUP_CONCAT(c.remark) AS contract_remarks,
|
|
|
GROUP_CONCAT(IF(c.belong_type = 1, "归属工厂",
|
|
|
- IF(c.belong_type = 2, "归属业务", c.belong_type))) AS belongType
|
|
|
+ IF(c.belong_type = 2, "归属业务", c.belong_type))) AS belongType,
|
|
|
+ GROUP_CONCAT(cu.`name`, ' 订单号:', c.`code`, ' 订单金额:', c.currency, ' ',
|
|
|
+ c.amount) AS remarks
|
|
|
FROM claim cl
|
|
|
JOIN claim_contract clo ON clo.claim_id = cl.id
|
|
|
LEFT JOIN contract c ON clo.contract_id = c.id
|