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'
<?xml version="1.0"?>
  <database name="VIEW FIN_PAYMENT_SCHED_INV_V">
    <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
FROM fin_payment p
LEFT JOIN fin_payment_detail pd ON pd.fin_payment_id = p.fin_payment_id
LEFT JOIN fin_payment_scheduledetail psd ON pd.fin_payment_detail_id = psd.fin_payment_detail_id
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
FROM fin_payment_detail pd, fin_payment_scheduledetail psd
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 
CASE
WHEN to_number(max(pdv.paymentdate) - min(ops.duedate)) > 0 THEN to_number(max(pdv.paymentdate) - min(ops.duedate))
ELSE 0
END AS "case"
FROM fin_orig_paym_scheddetail opsd
LEFT JOIN fin_orig_payment_schedule ops ON opsd.fin_orig_payment_schedule_id = ops.fin_orig_payment_schedule_id
LEFT JOIN fin_payment_scheduledetail psd ON psd.fin_payment_scheduledetail_id = opsd.fin_payment_scheduledetail_id
LEFT JOIN fin_payment_detail_v pdv ON pdv.fin_payment_detail_v_id = psd.fin_payment_scheduledetail_id
WHERE psd.fin_payment_schedule_invoice = ps.fin_payment_schedule_id) AS daysoverdue, COALESCE((SELECT sum(psd.amount) AS sum
FROM fin_payment_scheduledetail psd, fin_payment_detail pd
LEFT JOIN fin_payment p ON pd.fin_payment_id = p.fin_payment_id
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
FROM fin_payment_schedule ps]]></view>
  </database>