Merge branch 'master' into 6861_triggerItemShelving
gitea/salix/pipeline/pr-master This commit looks good
Details
gitea/salix/pipeline/pr-master This commit looks good
Details
This commit is contained in:
commit
94d89f9c99
|
@ -25,32 +25,37 @@ BEGIN
|
|||
AND NOT t.isDeleted
|
||||
AND IFNULL(t.totalWithVat, 0) <> 0
|
||||
AND t.shipped > (util.VN_CURDATE() - INTERVAL cc.riskScope MONTH)
|
||||
), balance AS (
|
||||
SELECT SUM(amount)amount, companyFk
|
||||
FROM (
|
||||
SELECT amount, companyFk
|
||||
FROM vn.clientRisk
|
||||
WHERE clientFk = vClientFk
|
||||
UNION ALL
|
||||
SELECT -(SUM(amount) / 100) amount, tm.companyFk
|
||||
FROM hedera.tpvTransaction t
|
||||
JOIN hedera.tpvMerchant tm ON t.id = t.merchantFk
|
||||
WHERE clientFk = vClientFk
|
||||
AND receiptFk IS NULL
|
||||
AND `status` = 'ok'
|
||||
) sub
|
||||
WHERE companyFk
|
||||
GROUP BY companyFk
|
||||
), uninvoiced AS (
|
||||
SELECT companyFk, dated, SUM(totalWithVat) amount
|
||||
FROM ticket
|
||||
GROUP BY companyFk, dated
|
||||
), companies AS (
|
||||
SELECT DISTINCT companyFk FROM uninvoiced
|
||||
), balance AS (
|
||||
SELECT SUM(IFNULL(amount, 0))amount, companyFk
|
||||
FROM (
|
||||
SELECT cr.amount, c.companyFk
|
||||
FROM companies c
|
||||
LEFT JOIN vn.clientRisk cr ON cr.companyFk = c.companyFk
|
||||
AND cr.clientFk = vClientFk
|
||||
UNION ALL
|
||||
SELECT -(SUM(t.amount) / 100) amount, c.companyFk
|
||||
FROM companies c
|
||||
LEFT JOIN hedera.tpvMerchant tm ON tm.companyFk = c.companyFk
|
||||
LEFT JOIN hedera.tpvTransaction t ON t.merchantFk = tm.id
|
||||
AND t.clientFk = vClientFk
|
||||
AND t.receiptFk IS NULL
|
||||
AND t.`status` = 'ok'
|
||||
) sub
|
||||
WHERE companyFk
|
||||
GROUP BY companyFk
|
||||
), receipt AS (
|
||||
SELECT companyFk, DATE(payed) dated, SUM(amountPaid) amount
|
||||
FROM vn.receipt
|
||||
WHERE clientFk = vClientFk
|
||||
AND payed > util.VN_CURDATE()
|
||||
GROUP BY companyFk, DATE(payed)
|
||||
SELECT r.companyFk, DATE(r.payed) dated, SUM(r.amountPaid) amount
|
||||
FROM vn.receipt r
|
||||
JOIN companies c ON c.companyFk = r.companyFk
|
||||
WHERE r.clientFk = vClientFk
|
||||
AND r.payed > util.VN_CURDATE()
|
||||
GROUP BY r.companyFk, DATE(r.payed)
|
||||
), risk AS (
|
||||
SELECT b.companyFk,
|
||||
ui.dated,
|
||||
|
|
|
@ -101,7 +101,8 @@ module.exports = Self => {
|
|||
'groupingMode',
|
||||
'inkFk',
|
||||
'originFk',
|
||||
'producerFk'
|
||||
'producerFk',
|
||||
'comment'
|
||||
],
|
||||
include: [
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue