src/org/openbravo/erpCommon/info/Account_data.xsql
changeset 712 aa0c40278c5a
parent 423 ecf368072c48
child 1605 8a0fe0193bef
--- a/src/org/openbravo/erpCommon/info/Account_data.xsql	Mon Apr 21 19:03:40 2008 +0000
+++ b/src/org/openbravo/erpCommon/info/Account_data.xsql	Mon Apr 21 19:06:47 2008 +0000
@@ -27,25 +27,29 @@
    <SqlMethod name="select" type="preparedStatement" return="multiple">
       <SqlMethodComment></SqlMethodComment>
       <Sql> <![CDATA[
-            SELECT C.C_VALIDCOMBINATION_ID, C.ALIAS, C.COMBINATION, C.DESCRIPTION, 
-            C.AD_ORG_ID, (O.VALUE || ' - ' || O.NAME) AS AD_ORG_ID_D, 
-            C.ACCOUNT_ID, (E.VALUE || ' - ' || E.NAME) AS ACCOUNT_ID_D, 
-            C.M_PRODUCT_ID, (P.NAME) AS M_PRODUCT_ID_D, 
-            C.C_BPARTNER_ID, (B.NAME) AS C_BPARTNER_ID_D, 
-            C.C_PROJECT_ID, (J.NAME || ' - ' || J.VALUE) AS C_PROJECT_ID_D, 
-            C.C_CAMPAIGN_ID, (M.NAME) AS C_CAMPAIGN_ID_D 
-            FROM C_VALIDCOMBINATION C left join M_PRODUCT P on C.M_PRODUCT_ID = P.M_PRODUCT_ID 
-                                      left join C_BPARTNER B on C.C_BPARTNER_ID = B.C_BPARTNER_ID 
-                                      left join C_PROJECT J on C.C_PROJECT_ID = J.C_PROJECT_ID
-                                      left join C_CAMPAIGN M on C.C_CAMPAIGN_ID = M.C_CAMPAIGN_ID,
-            AD_ORG O, C_ELEMENTVALUE E
-            WHERE C.AD_ORG_ID = O.AD_ORG_ID 
-            AND C.ACCOUNT_ID = E.C_ELEMENTVALUE_ID 
-            AND C.ISACTIVE = 'Y' 
-            AND C.AD_Client_ID IN ('1') 
-            AND C.AD_Org_ID IN ('1') 
+      		SELECT * FROM ( SELECT '0' AS RN1, A.* FROM (
+	            SELECT C.C_VALIDCOMBINATION_ID, C.ALIAS, C.COMBINATION, C.DESCRIPTION, 
+	            C.AD_ORG_ID, (O.VALUE || ' - ' || O.NAME) AS AD_ORG_ID_D, 
+	            C.ACCOUNT_ID, (E.VALUE || ' - ' || E.NAME) AS ACCOUNT_ID_D, 
+	            C.M_PRODUCT_ID, (P.NAME) AS M_PRODUCT_ID_D, 
+	            C.C_BPARTNER_ID, (B.NAME) AS C_BPARTNER_ID_D, 
+	            C.C_PROJECT_ID, (J.NAME || ' - ' || J.VALUE) AS C_PROJECT_ID_D, 
+	            C.C_CAMPAIGN_ID, (M.NAME) AS C_CAMPAIGN_ID_D, C.C_VALIDCOMBINATION_ID || '#' || C.COMBINATION AS ROWKEY
+	            FROM C_VALIDCOMBINATION C left join M_PRODUCT P on C.M_PRODUCT_ID = P.M_PRODUCT_ID 
+	                                      left join C_BPARTNER B on C.C_BPARTNER_ID = B.C_BPARTNER_ID 
+	                                      left join C_PROJECT J on C.C_PROJECT_ID = J.C_PROJECT_ID
+	                                      left join C_CAMPAIGN M on C.C_CAMPAIGN_ID = M.C_CAMPAIGN_ID,
+	            AD_ORG O, C_ELEMENTVALUE E
+	            WHERE C.AD_ORG_ID = O.AD_ORG_ID 
+	            AND C.ACCOUNT_ID = E.C_ELEMENTVALUE_ID 
+	            AND C.ISACTIVE = 'Y' 
+	            AND C.AD_Client_ID IN ('1') 
+	            AND C.AD_Org_ID IN ('1')
+	            ORDER BY C.ALIAS
+	        	) A ) B
+			WHERE 1=1
       ]]></Sql>
-        <Field name="position" value="count"/>
+        <Parameter name="rownum" type="replace" optional="true" after="FROM ( SELECT " text="'0'" />
         <Parameter name="acctschema" optional="true" after="WHERE "><![CDATA[ C.C_ACCTSCHEMA_ID = TO_NUMBER(?) AND ]]></Parameter>
         <Parameter name="alias" optional="true" after="WHERE "><![CDATA[ (C.ALIAS IS NULL  OR UPPER(C.ALIAS) LIKE UPPER(?)) AND ]]></Parameter>
         <Parameter name="combination" optional="true" after="WHERE "><![CDATA[ UPPER(C.COMBINATION) LIKE UPPER(?) AND ]]></Parameter>
@@ -58,6 +62,9 @@
         <Parameter name="validcombination" optional="true" after="WHERE "><![CDATA[ C.C_VALIDCOMBINATION_ID = TO_NUMBER(?) AND ]]></Parameter>
         <Parameter name="adUserClient" type="replace" optional="true" after="C.AD_Client_ID IN (" text="'1'"/>
         <Parameter name="adUserOrg" type="replace" optional="true" after="C.AD_Org_ID IN (" text="'1'"/>
+        <Parameter name="orderBy" type="replace" optional="true" after="ORDER BY " text="C.ALIAS" />
+        <Parameter name="oraLimit" type="argument" optional="true" after="WHERE 1=1"><![CDATA[AND RN1 BETWEEN ]]></Parameter>
+        <Parameter name="pgLimit" type="argument" optional="true" after="WHERE 1=1"><![CDATA[LIMIT ]]></Parameter>
    </SqlMethod>
    <SqlMethod name="set" type="constant" return="multiple">
       <SqlMethodComment></SqlMethodComment>