-
Notifications
You must be signed in to change notification settings - Fork 567
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#6511 repair pay selection trx type calculation
- Loading branch information
Showing
3 changed files
with
24 additions
and
3 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
.../system/10-de.metas.adempiere/555967_sys_gh6511_RepairC_Invoice_PaySelectionTrxType_V.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
DROP VIEW IF EXISTS C_Invoice_PaySelectionTrxType_V; | ||
CREATE OR REPLACE VIEW C_Invoice_PaySelectionTrxType_V AS | ||
SELECT C_Invoice_ID, | ||
CASE | ||
WHEN /* CREDIT_TRANSFER_TO_VENDOR - "OUT" */ i.IsSOTrx='N' AND i.PaymentRule IN ('T'/*DirectDeposit*/, 'P'/*OnCredit*/) AND i.DocStatus IN ('CO', 'CL') THEN 'CT' | ||
WHEN /* DIRECT_DEBIT_FROM_CUSTOMER - "CDD" */ i.IsSOTrx='Y' AND dt.DocBaseType != 'ARC' AND i.PaymentRule IN ('D'/*DirectDebit*/, 'P'/*OnCredit*/) AND i.DocStatus IN ('CO', 'CL') THEN 'DD' | ||
WHEN /* CREDIT_TRANSFER_TO_CUSTOMER - "CRE" */ i.IsSOTrx='Y' AND dt.DocBaseType = 'ARC' AND i.PaymentRule IN ('T'/*DirectDeposit*/, 'P'/*OnCredit*/) AND i.DocStatus IN ('CO', 'CL') THEN 'CT' | ||
ELSE /* not compatible to any type */ 'XX' | ||
END AS PaySelectionTrxType, | ||
i.IsSOTrx, | ||
i.PaymentRule, | ||
i.DocStatus, | ||
i.DocumentNo, | ||
dt.DocBaseType | ||
FROM C_Invoice i | ||
JOIN C_DocType dt ON dt.C_DocType_ID=i.C_DocType_ID; | ||
COMMENT ON VIEW C_Invoice_PaySelectionTrxType_V IS | ||
'Selects C_Invoice_IDs together with their respective PaySelectionTrxTypes. XX means "none". | ||
The other columns are just for diagnostics/troubleshooting. | ||
Please keep in sync with the code at de.metas.banking.payment.impl.PaySelectionUpdater.buildSelectSQL_MatchRequirement()'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters