src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_Invoice_data.xsql
changeset 15683 a77ef04bc81c
parent 15164 30a7643fa5b0
child 15687 0f4211de14eb
equal deleted inserted replaced
15682:b4ce2c15d515 15683:a77ef04bc81c
   361         AND l.isinvoiced = 'N')
   361         AND l.isinvoiced = 'N')
   362         AND NOT EXISTS (SELECT 1 FROM C_INVOICE_CANDIDATE_V ic, C_ORDER o 
   362         AND NOT EXISTS (SELECT 1 FROM C_INVOICE_CANDIDATE_V ic, C_ORDER o 
   363         WHERE o.C_ORDER_ID = s.C_ORDER_ID
   363         WHERE o.C_ORDER_ID = s.C_ORDER_ID
   364         AND o.C_ORDER_ID = ic.C_ORDER_ID
   364         AND o.C_ORDER_ID = ic.C_ORDER_ID
   365         AND ic.term = 'N')
   365         AND ic.term = 'N')
   366         AND EXISTS (SELECT 1
   366         AND NOT EXISTS (SELECT 1
   367         FROM C_ORDER o , C_ORDERLINE ol
   367         FROM C_ORDER o , C_ORDERLINE ol
   368         WHERE o.C_ORDER_ID = s.C_ORDER_ID
   368         WHERE o.C_ORDER_ID = s.C_ORDER_ID
   369         AND o.C_ORDER_ID = ol.C_ORDER_ID
   369         AND o.C_ORDER_ID = ol.C_ORDER_ID
   370         GROUP BY o.INVOICERULE
   370         GROUP BY o.INVOICERULE
   371         HAVING o.INVOICERULE <> 'O' OR (SUM(ol.qtyordered) = SUM(ol.qtydelivered)))
   371         HAVING (o.INVOICERULE = 'O' AND SUM(ol.qtyordered) <> SUM(ol.qtydelivered)))
   372         ORDER BY NAME
   372         ORDER BY NAME
   373       ]]>
   373       ]]>
   374     </Sql>
   374     </Sql>
   375     <Parameter name="adLanguage"/>
   375     <Parameter name="adLanguage"/>
   376     <Parameter name="adUserClient" type="replace" optional="true" after="s.AD_Client_ID IN (" text="'1'"/>
   376     <Parameter name="adUserClient" type="replace" optional="true" after="s.AD_Client_ID IN (" text="'1'"/>