src-db/database/model/views/FIN_PAYMENT_SCHED_INV_V.xml
author Naiara Martinez <naiara.martinez@openbravo.com>
Tue, 08 May 2012 13:21:36 +0200
changeset 16484 e3eca21395e5
parent 15453 0d5c7c2a2352
child 18240 b4f0be311a54
child 18377 823d12b0362f
permissions -rw-r--r--
fixed bug 20400 Move 'Modify Payment Plan' button to child tab
the button was in invoice Header tab and it has been moved to 'Payment Plan'
gorkaion@6824
     1
<?xml version="1.0"?>
gorkaion@6824
     2
  <database name="VIEW FIN_PAYMENT_SCHED_INV_V">
antonio@7022
     3
    <view name="FIN_PAYMENT_SCHED_INV_V"><![CDATA[SELECT ps.fin_payment_schedule_id AS fin_payment_sched_inv_v_id, ps.ad_client_id, ps.ad_org_id, ps.isactive, ps.created, ps.createdby, ps.updated, ps.updatedby, ps.c_invoice_id, ps.c_order_id, ps.duedate, ps.fin_paymentmethod_id, ps.amount AS expected, ps.paidamt AS received, ps.outstandingamt AS outstanding, ps.c_currency_id, (SELECT max(p.paymentdate) AS max
antonio@7022
     4
FROM fin_payment p
antonio@7022
     5
LEFT JOIN fin_payment_detail pd ON pd.fin_payment_id = p.fin_payment_id
antonio@7022
     6
LEFT JOIN fin_payment_scheduledetail psd ON pd.fin_payment_detail_id = psd.fin_payment_detail_id
antonio@7022
     7
WHERE ps.c_invoice_id IS NOT NULL AND psd.fin_payment_schedule_invoice = ps.fin_payment_schedule_id) AS lastpayment, (SELECT count(*) AS count
antonio@7022
     8
FROM fin_payment_detail pd, fin_payment_scheduledetail psd
david@15453
     9
WHERE pd.fin_payment_detail_id = psd.fin_payment_detail_id AND ps.c_invoice_id IS NOT NULL AND psd.fin_payment_schedule_invoice = ps.fin_payment_schedule_id) AS numberofpayments, ps.fin_payment_priority_id, ps.update_payment_plan, to_char('Y') AS ob_selected, (SELECT 
david@15453
    10
CASE
david@15453
    11
WHEN to_number(max(pdv.paymentdate) - min(ops.duedate)) > 0 THEN to_number(max(pdv.paymentdate) - min(ops.duedate))
david@15453
    12
ELSE 0
david@15453
    13
END AS "case"
david@15453
    14
FROM fin_orig_paym_scheddetail opsd
david@15453
    15
LEFT JOIN fin_orig_payment_schedule ops ON opsd.fin_orig_payment_schedule_id = ops.fin_orig_payment_schedule_id
david@15453
    16
LEFT JOIN fin_payment_scheduledetail psd ON psd.fin_payment_scheduledetail_id = opsd.fin_payment_scheduledetail_id
david@15453
    17
LEFT JOIN fin_payment_detail_v pdv ON pdv.fin_payment_detail_v_id = psd.fin_payment_scheduledetail_id
david@15453
    18
WHERE psd.fin_payment_schedule_invoice = ps.fin_payment_schedule_id) AS daysoverdue, COALESCE((SELECT sum(psd.amount) AS sum
david@15453
    19
FROM fin_payment_scheduledetail psd, fin_payment_detail pd
david@15453
    20
LEFT JOIN fin_payment p ON pd.fin_payment_id = p.fin_payment_id
naiara@16484
    21
WHERE psd.fin_payment_schedule_invoice = ps.fin_payment_schedule_id AND psd.fin_payment_detail_id = pd.fin_payment_detail_id AND p.status = 'RPAE'), 0) AS awaiting_execution, 'Y' AS em_aprm_modif_paym_sched, 'Y' AS em_aprm_modif_paym_out_sched
antonio@7031
    22
FROM fin_payment_schedule ps]]></view>
gorkaion@6824
    23
  </database>