src-db/database/model/views/FIN_PAYMENT_DETAIL_V.xml
author Antonio Moreno <antonio.moreno@openbravo.com>
Mon, 04 Feb 2013 09:27:53 +0100
changeset 9910 6767429386d8
parent 9657 d11f2f07dc53
child 9911 444911e2b851
permissions -rw-r--r--
Changes required to support PostgreSQL 9.2
eduardo@6401
     1
<?xml version="1.0"?>
eduardo@6401
     2
  <database name="VIEW FIN_PAYMENT_DETAIL_V">
antonio@9910
     3
    <view name="FIN_PAYMENT_DETAIL_V"><![CDATA[SELECT psd.fin_payment_scheduledetail_id AS fin_payment_detail_v_id,  psd.ad_client_id, psd.ad_org_id, psd.isactive, psd.created, psd.createdby,  psd.updated, psd.updatedby,  psi.fin_payment_schedule_id AS fin_payment_sched_inv_v_id,  pso.fin_payment_schedule_id AS fin_payment_sched_ord_v_id,  i.documentno AS invoiceno, o.documentno AS orderno,  p.documentno AS paymentno, pd.fin_payment_id,  COALESCE(psi.duedate, pso.duedate) AS duedate,  COALESCE(i.grandtotal, o.grandtotal) AS invoicedamt,  COALESCE(psi.amount, pso.amount) AS expected, psd.amount AS paidamt,  p.c_bpartner_id, p.fin_paymentmethod_id, p.fin_financial_account_id,  p.c_currency_id, p.paymentdate, gli.name AS glitemname, pd.writeoffamt,  psd.iscanceled, psd.c_bpartner_id AS c_bpartner_id_dim, psd.c_activity_id,  psd.m_product_id, psd.c_campaign_id, psd.c_project_id, psd.c_salesregion_id FROM fin_payment p,  fin_payment_detail pd JOIN fin_payment_scheduledetail psd ON pd.fin_payment_detail_id = psd.fin_payment_detail_id LEFT JOIN fin_payment_schedule psi ON psd.fin_payment_schedule_invoice = psi.fin_payment_schedule_id LEFT JOIN c_invoice i ON psi.c_invoice_id = i.c_invoice_id LEFT JOIN fin_payment_schedule pso ON psd.fin_payment_schedule_order = pso.fin_payment_schedule_id LEFT JOIN c_order o ON pso.c_order_id = o.c_order_id LEFT JOIN c_glitem gli ON pd.c_glitem_id = gli.c_glitem_id WHERE p.fin_payment_id = pd.fin_payment_id]]></view>
eduardo@6401
     4
  </database>