src-util/modulescript/src/org/openbravo/modulescript/UpdateBpPaymentLine_data.xsql
changeset 25593 f5b23fe2295b
child 25772 5ef45cfcb9a5
equal deleted inserted replaced
25592:dd9596bfd555 25593:f5b23fe2295b
       
     1 <?xml version="1.0" encoding="UTF-8" ?>
       
     2 <!--
       
     3  *************************************************************************
       
     4  * The contents of this file are subject to the Openbravo  Public  License
       
     5  * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
       
     6  * Version 1.1  with a permitted attribution clause; you may not  use this
       
     7  * file except in compliance with the License. You  may  obtain  a copy of
       
     8  * the License at http://www.openbravo.com/legal/license.html
       
     9  * Software distributed under the License  is  distributed  on  an "AS IS"
       
    10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
       
    11  * License for the specific  language  governing  rights  and  limitations
       
    12  * under the License.
       
    13  * The Original Code is Openbravo ERP.
       
    14  * The Initial Developer of the Original Code is Openbravo SLU
       
    15  * All portions are Copyright (C) 2014 Openbravo SLU
       
    16  * All Rights Reserved.
       
    17  * Contributor(s):  ______________________________________.
       
    18  ************************************************************************
       
    19 -->
       
    20 <SqlClass name="UpdateBpPaymentLineData" package="org.openbravo.modulescript">
       
    21    <SqlClassComment></SqlClassComment>
       
    22   <SqlMethod name="select" type="preparedStatement" return="multiple">
       
    23     <SqlMethodComment></SqlMethodComment>
       
    24     <Sql><![CDATA[
       
    25       SELECT '' as exist FROM DUAL
       
    26       ]]>
       
    27     </Sql>
       
    28   </SqlMethod>
       
    29   <SqlMethod name="updateBpPaymentLineInvoice" type="preparedStatement" return="rowcount">
       
    30     <SqlMethodComment></SqlMethodComment>
       
    31     <Sql>
       
    32       <![CDATA[
       
    33 				update fin_payment_scheduledetail psd
       
    34 				set c_bpartner_id = (select c_bpartner_id from c_invoice i, fin_payment_schedule ps
       
    35 				                     where ps.fin_payment_schedule_id = fin_payment_schedule_invoice 
       
    36 				                     and ps.c_invoice_id = i.c_invoice_id)
       
    37 				where c_bpartner_id is null and fin_payment_schedule_invoice is not null 
       
    38 					and fin_payment_schedule_order is null
       
    39       ]]>
       
    40     </Sql>
       
    41   </SqlMethod>
       
    42   <SqlMethod name="updateBpPaymentLineOrder" type="preparedStatement" return="rowcount">
       
    43     <SqlMethodComment></SqlMethodComment>
       
    44     <Sql>
       
    45       <![CDATA[
       
    46 				update fin_payment_scheduledetail psd
       
    47 				set c_bpartner_id = (select c_bpartner_id from c_order o, fin_payment_schedule ps
       
    48 				                     where ps.fin_payment_schedule_id = fin_payment_schedule_order 
       
    49 				                     and ps.c_order_id = o.c_order_id)
       
    50 				where c_bpartner_id is null and fin_payment_schedule_order is not null
       
    51 					and fin_payment_schedule_invoice is null
       
    52       ]]>
       
    53     </Sql>
       
    54   </SqlMethod>
       
    55    <SqlMethod name="isModuleScriptExecuted" type="preparedStatement" return="boolean">
       
    56     <SqlMethodComment></SqlMethodComment>
       
    57     <Sql>
       
    58       <![CDATA[
       
    59     SELECT count(*) as exist
       
    60     FROM ad_preference
       
    61     WHERE attribute = 'UpdateBpPaymentLine' and isactive = 'Y'
       
    62       ]]>
       
    63     </Sql>
       
    64   </SqlMethod>
       
    65    <SqlMethod name="createPreference" type="preparedStatement" return="rowcount">
       
    66     <SqlMethodComment></SqlMethodComment>
       
    67     <Sql>
       
    68       <![CDATA[
       
    69     INSERT INTO ad_preference (
       
    70     ad_preference_id, ad_client_id, ad_org_id, isactive,
       
    71     createdby, created, updatedby, updated, attribute
       
    72     ) VALUES (
       
    73     get_uuid(), '0', '0', 'Y', 
       
    74     '0', NOW(), '0', NOW(), 'UpdateBpPaymentLine')
       
    75       ]]>
       
    76     </Sql>
       
    77   </SqlMethod>
       
    78 </SqlClass>