-- Group: apOpenItems
-- Name: selectedpayments
--- Notes:
--- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
--- See www.xtuple.com/CPAL for the full text of the software license.
+-- Notes:
+-- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
+-- See www.xtuple.com/CPAL for the full text of the software license.
SELECT *,
CASE WHEN (apopen_doctype='V') THEN <? value("voucher") ?>
SELECT apopen_id, apselect_id,
(bankaccnt_name || '-' || bankaccnt_descrip) AS f_bank,
(vend_number || '-' || vend_name) AS f_vendor,
- apopen_docnumber, apopen_ponumber, apselect_amount,
+ apopen_docnumber, apopen_ponumber, -apselect_amount,
apopen_invcnumber, apopen_doctype,
- currToBase(apselect_curr_id, apselect_amount, CURRENT_DATE) AS apselect_amount_base,
+ currToBase(apselect_curr_id, apselect_amount, CURRENT_DATE) * -1.0 AS apselect_amount_base,
currToBase(apselect_curr_id, apselect_amount, CURRENT_DATE) * -1.0 AS apselect_running_base,
currConcat(apselect_curr_id) AS currAbbr
FROM apopen, apselect, vendinfo, bankaccnt
-- Group: apOpenItems
-- Name: selectpayments
--- Notes:
--- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
--- See www.xtuple.com/CPAL for the full text of the software license.
+-- Notes:
+-- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
+-- See www.xtuple.com/CPAL for the full text of the software license.
SELECT *,
CASE WHEN (apopen_doctype='V') THEN <? value("voucher") ?>
(vend_number || '-' || vend_name) AS vendor,
apopen_doctype, apopen_docnumber, apopen_ponumber, apopen_invcnumber,
apopen_duedate, apopen_terms_id, apopen_docdate, apopen_status,
- (apopen_amount - apopen_paid - apCheckPending(apopen_id)) AS amount,
- ((apopen_amount - apopen_paid - apCheckPending(apopen_id)) / apopen_curr_rate) AS base_amount,
+ (apopen_amount - apopen_paid - apCheckPending(apopen_id)) * -1.0 AS amount,
+ ((apopen_amount - apopen_paid - apCheckPending(apopen_id)) / apopen_curr_rate) * -1.0 AS base_amount,
((apopen_amount - apopen_paid - apCheckPending(apopen_id)) / apopen_curr_rate) * -1.0 AS running_amount,
- COALESCE(apselect_amount, 0.0) AS selected,
- (COALESCE(apselect_amount, 0.0) / apopen_curr_rate) AS base_selected,
+ COALESCE(apselect_amount, 0.0) * -1.0 AS selected,
+ (COALESCE(apselect_amount, 0.0) / apopen_curr_rate) * -1.0 AS base_selected,
(COALESCE(apselect_amount, 0.0) / apopen_curr_rate) * -1.0 AS running_selected,
COALESCE(apselect_discount,0.0) AS discount,
(COALESCE(apselect_discount,0.0) / apopen_curr_rate)AS base_discount,