[Production-Development] Create Work Effort and changes in several process
authorrafaeldemiguel <rdm@openbravo.com>
Wed, 14 Sep 2011 09:49:11 +0200
changeset 14980 91be7a8ff363
parent 14979 da3863fa640f
child 14981 d60d2439880f
[Production-Development] Create Work Effort and changes in several process
src-db/database/model/functions/MA_COPY_VERSION.xml
src-db/database/model/functions/MA_PRODUCTIONRUN_STANDARD.xml
src-db/database/model/functions/MA_WORKREQUIREMENT_PROCESS.xml
src-db/database/model/tables/MA_SEQUENCE.xml
src-db/database/model/tables/MA_WORKREQUIREMENT.xml
src-db/database/model/tables/MA_WRPHASE.xml
src-db/database/sourcedata/AD_COLUMN.xml
src-db/database/sourcedata/AD_ELEMENT.xml
src-db/database/sourcedata/AD_FIELD.xml
src-db/database/sourcedata/AD_MESSAGE.xml
src-db/database/sourcedata/AD_MODEL_OBJECT.xml
src-db/database/sourcedata/AD_PROCESS.xml
src-db/database/sourcedata/AD_PROCESS_PARA.xml
src/org/openbravo/erpCommon/ad_actionButton/CreateWorkEffort.java
src/org/openbravo/erpCommon/ad_callouts/SL_SequenceProduct_Product_Attribute.java
--- a/src-db/database/model/functions/MA_COPY_VERSION.xml	Thu Sep 08 13:45:46 2011 +0200
+++ b/src-db/database/model/functions/MA_COPY_VERSION.xml	Wed Sep 14 09:49:11 2011 +0200
@@ -129,7 +129,8 @@
           Created, Createdby, Updated, Updatedby,
           MA_Processplan_Version_ID, MA_Process_ID, Value, Name,
           Description, CostCenterUse, Preptime, Multiplier,
-          Seqno, Noqty, Groupuse, Calculated, Estimatedtime, Divisiongroupqty
+          Seqno, Noqty, Groupuse, Calculated, Estimatedtime, 
+          Divisiongroupqty, Usedmaterial
         )
         VALUES
         (
@@ -137,7 +138,8 @@
           now(), COALESCE(v_User_ID, '0'), now(), COALESCE(v_User_ID, '0'),
           v_ProcessPlanVersion_ID, Cur_Sequence.MA_Process_ID, Cur_Sequence.Value, Cur_Sequence.Name,
           Cur_Sequence.Description, Cur_Sequence.CostCenterUse, Cur_Sequence.Preptime, Cur_Sequence.Multiplier,
-          Cur_Sequence.Seqno, Cur_Sequence.Noqty, Cur_Sequence.Groupuse, Cur_Sequence.Calculated, Cur_Sequence.Estimatedtime, Cur_Sequence.Divisiongroupqty
+          Cur_Sequence.Seqno, Cur_Sequence.Noqty, Cur_Sequence.Groupuse, Cur_Sequence.Calculated, Cur_Sequence.Estimatedtime, 
+          Cur_Sequence.Divisiongroupqty, Cur_Sequence.Usedmaterial
         )
         ;
       FOR Cur_Product IN
--- a/src-db/database/model/functions/MA_PRODUCTIONRUN_STANDARD.xml	Thu Sep 08 13:45:46 2011 +0200
+++ b/src-db/database/model/functions/MA_PRODUCTIONRUN_STANDARD.xml	Wed Sep 14 09:49:11 2011 +0200
@@ -492,7 +492,7 @@
 
         IF (v_Calculated = 'Y') THEN
           IF (v_ByDefault = 'N') THEN
-            SELECT TO_NUMBER((M_Production.ENDTIME - M_Production.STARTTIME)*24) INTO v_CostCenterUse
+            SELECT TO_NUMBER((M_ProductionPlan.ENDTIME - M_ProductionPlan.STARTTIME)*24) INTO v_CostCenterUse
             FROM M_Production, M_ProductionPlan
             WHERE M_Production.M_Production_ID = M_ProductionPlan.M_PRODUCTION_ID
               AND M_ProductionPlan.M_PRODUCTIONPLAN_ID = v_Record_ID;
--- a/src-db/database/model/functions/MA_WORKREQUIREMENT_PROCESS.xml	Thu Sep 08 13:45:46 2011 +0200
+++ b/src-db/database/model/functions/MA_WORKREQUIREMENT_PROCESS.xml	Wed Sep 14 09:49:11 2011 +0200
@@ -42,6 +42,8 @@
     v_Multiplier NUMBER;
     v_Processed CHAR;
     v_LaunchDate DATE;
+    v_Startdate DATE;
+    v_Enddate DATE;
     -- WRPhases to process
     Cur_WRPhase RECORD;
     --  Sequence Products to process
@@ -88,13 +90,17 @@
       Processed,
       ExplodePhases,
       LaunchDate,
-      AD_Org_ID
+      AD_Org_ID,
+      Startdate,
+      Enddate
     INTO v_ProcessPlan_ID,
       v_Quantity,
       v_Processed,
       v_ExplodePhases,
       v_LaunchDate,
-      v_Org_ID
+      v_Org_ID,
+      v_Startdate,
+      v_Enddate
     FROM MA_WorkRequirement
     WHERE MA_WorkRequirement_ID=v_Record_ID;
     --Check if it hasn't already been processed
@@ -123,7 +129,9 @@
             s.SeqNo,
             s.NoQty,
             s.GroupUse,
-            s.Outsourced
+            s.Outsourced,
+            s.Estimatedtime,
+            s.Usedmaterial
           FROM MA_Sequence s,
             MA_ProcessPlan_Version p
           WHERE s.MA_PROCESSPLAN_VERSION_ID=p.MA_PROCESSPLAN_VERSION_ID
@@ -144,7 +152,8 @@
               AD_Org_ID, Isactive, Created, Createdby,
               Updated, Updatedby, MA_Process_ID, CostCenterUse,
               Preptime, Quantity, Donequantity,
-              SeqNo, Closed, NoQty, GroupUse, Outsourced
+              SeqNo, Closed, NoQty, GroupUse, Outsourced,
+              Startdate, Enddate, Estimatedtime, Usedmaterial
             )
             VALUES
             (
@@ -152,7 +161,8 @@
               v_Org_ID, 'Y', now(), v_User_ID,
               now(), v_User_ID, Cur_Sequence.MA_Process_ID, Cur_Sequence.CostCenterUse,
               Cur_Sequence.Preptime, v_Multiplier*v_Quantity, 0,
-              Cur_Sequence.SeqNo, 'N', Cur_Sequence.NoQty, Cur_Sequence.GroupUse, Cur_Sequence.Outsourced
+              Cur_Sequence.SeqNo, 'N', Cur_Sequence.NoQty, Cur_Sequence.GroupUse, Cur_Sequence.Outsourced,
+              v_Startdate, v_Enddate, v_Multiplier*v_Quantity*Cur_Sequence.Estimatedtime, Cur_Sequence.Usedmaterial
             )
             ;
           FOR Cur_SeqProduct IN
--- a/src-db/database/model/tables/MA_SEQUENCE.xml	Thu Sep 08 13:45:46 2011 +0200
+++ b/src-db/database/model/tables/MA_SEQUENCE.xml	Wed Sep 14 09:49:11 2011 +0200
@@ -105,6 +105,10 @@
         <default/>
         <onCreateDefault/>
       </column>
+      <column name="USEDMATERIAL" primaryKey="false" required="true" type="CHAR" size="1" autoIncrement="false">
+        <default><![CDATA[N]]></default>
+        <onCreateDefault><![CDATA['N']]></onCreateDefault>
+      </column>
       <foreign-key foreignTable="AD_ORG" name="AD_ORG_MASEQUENCE">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
--- a/src-db/database/model/tables/MA_WORKREQUIREMENT.xml	Thu Sep 08 13:45:46 2011 +0200
+++ b/src-db/database/model/tables/MA_WORKREQUIREMENT.xml	Wed Sep 14 09:49:11 2011 +0200
@@ -101,6 +101,10 @@
         <default/>
         <onCreateDefault/>
       </column>
+      <column name="CREATEWORKREQUIREMENT" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
       <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAWORKREQUIREMENT">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
--- a/src-db/database/model/tables/MA_WRPHASE.xml	Thu Sep 08 13:45:46 2011 +0200
+++ b/src-db/database/model/tables/MA_WRPHASE.xml	Wed Sep 14 09:49:11 2011 +0200
@@ -105,6 +105,10 @@
         <default><![CDATA[0]]></default>
         <onCreateDefault><![CDATA[0]]></onCreateDefault>
       </column>
+      <column name="USEDMATERIAL" primaryKey="false" required="true" type="CHAR" size="1" autoIncrement="false">
+        <default><![CDATA[N]]></default>
+        <onCreateDefault/>
+      </column>
       <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAWRPHASE">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
--- a/src-db/database/sourcedata/AD_COLUMN.xml	Thu Sep 08 13:45:46 2011 +0200
+++ b/src-db/database/sourcedata/AD_COLUMN.xml	Wed Sep 14 09:49:11 2011 +0200
@@ -210968,6 +210968,39 @@
 <!--31A70D5921994990B17329ECB16314A0-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
 <!--31A70D5921994990B17329ECB16314A0--></AD_COLUMN>
 
+<!--320957DD03794EA1B9B54142DC5E31B9--><AD_COLUMN>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <AD_COLUMN_ID><![CDATA[320957DD03794EA1B9B54142DC5E31B9]]></AD_COLUMN_ID>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <NAME><![CDATA[Create Standards]]></NAME>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <HELP><![CDATA[Process to generate standards on production run.]]></HELP>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <COLUMNNAME><![CDATA[Usedmaterial]]></COLUMNNAME>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <AD_TABLE_ID><![CDATA[800099]]></AD_TABLE_ID>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <FIELDLENGTH><![CDATA[1]]></FIELDLENGTH>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <DEFAULTVALUE><![CDATA[N]]></DEFAULTVALUE>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <SEQNO><![CDATA[300]]></SEQNO>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <AD_ELEMENT_ID><![CDATA[800366]]></AD_ELEMENT_ID>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <POSITION><![CDATA[28]]></POSITION>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--320957DD03794EA1B9B54142DC5E31B9-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--320957DD03794EA1B9B54142DC5E31B9--></AD_COLUMN>
+
 <!--326E4E78F12B423685E7986B2FDBEE2C--><AD_COLUMN>
 <!--326E4E78F12B423685E7986B2FDBEE2C-->  <AD_COLUMN_ID><![CDATA[326E4E78F12B423685E7986B2FDBEE2C]]></AD_COLUMN_ID>
 <!--326E4E78F12B423685E7986B2FDBEE2C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -211801,6 +211834,39 @@
 <!--3DFAB9DBB8D143A3951271CBE02C224F-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
 <!--3DFAB9DBB8D143A3951271CBE02C224F--></AD_COLUMN>
 
+<!--3E1E7C1929194D75B61C77175B77A3CE--><AD_COLUMN>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <AD_COLUMN_ID><![CDATA[3E1E7C1929194D75B61C77175B77A3CE]]></AD_COLUMN_ID>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <NAME><![CDATA[Create Standards]]></NAME>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <HELP><![CDATA[Process to generate standards on production run.]]></HELP>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <COLUMNNAME><![CDATA[Usedmaterial]]></COLUMNNAME>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <AD_TABLE_ID><![CDATA[800096]]></AD_TABLE_ID>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <FIELDLENGTH><![CDATA[1]]></FIELDLENGTH>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <DEFAULTVALUE><![CDATA[N]]></DEFAULTVALUE>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <SEQNO><![CDATA[320]]></SEQNO>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <AD_ELEMENT_ID><![CDATA[800366]]></AD_ELEMENT_ID>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <POSITION><![CDATA[27]]></POSITION>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--3E1E7C1929194D75B61C77175B77A3CE-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--3E1E7C1929194D75B61C77175B77A3CE--></AD_COLUMN>
+
 <!--3EE5C3FA006A425AAA45B703B30A516B--><AD_COLUMN>
 <!--3EE5C3FA006A425AAA45B703B30A516B-->  <AD_COLUMN_ID><![CDATA[3EE5C3FA006A425AAA45B703B30A516B]]></AD_COLUMN_ID>
 <!--3EE5C3FA006A425AAA45B703B30A516B-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -259470,6 +259536,40 @@
 <!--B1918E7639D54B58BC591BA41EC40230-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
 <!--B1918E7639D54B58BC591BA41EC40230--></AD_COLUMN>
 
+<!--B1F6FEB87A28427B92567CDAFD263A84--><AD_COLUMN>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <AD_COLUMN_ID><![CDATA[B1F6FEB87A28427B92567CDAFD263A84]]></AD_COLUMN_ID>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <NAME><![CDATA[Createworkrequirement]]></NAME>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <DESCRIPTION><![CDATA[Create all Work Effort for a specific day]]></DESCRIPTION>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <HELP><![CDATA[Create all Work Effort for a specific day]]></HELP>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <COLUMNNAME><![CDATA[Createworkrequirement]]></COLUMNNAME>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <AD_TABLE_ID><![CDATA[800098]]></AD_TABLE_ID>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <AD_REFERENCE_ID><![CDATA[28]]></AD_REFERENCE_ID>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <FIELDLENGTH><![CDATA[1]]></FIELDLENGTH>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <SEQNO><![CDATA[260]]></SEQNO>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <AD_ELEMENT_ID><![CDATA[42B6380737BC4FB681E7A2F3FE1CE952]]></AD_ELEMENT_ID>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <AD_PROCESS_ID><![CDATA[FF808181324D007801324D2AE1130066]]></AD_PROCESS_ID>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <POSITION><![CDATA[26]]></POSITION>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--B1F6FEB87A28427B92567CDAFD263A84-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--B1F6FEB87A28427B92567CDAFD263A84--></AD_COLUMN>
+
 <!--B1F8283332A640C09D8ECD2FE253AC59--><AD_COLUMN>
 <!--B1F8283332A640C09D8ECD2FE253AC59-->  <AD_COLUMN_ID><![CDATA[B1F8283332A640C09D8ECD2FE253AC59]]></AD_COLUMN_ID>
 <!--B1F8283332A640C09D8ECD2FE253AC59-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -259682,7 +259782,7 @@
 <!--B6233AB4306E4857897F734B6081AC22-->  <HELP><![CDATA[Start time in hours.]]></HELP>
 <!--B6233AB4306E4857897F734B6081AC22-->  <COLUMNNAME><![CDATA[Starttime]]></COLUMNNAME>
 <!--B6233AB4306E4857897F734B6081AC22-->  <AD_TABLE_ID><![CDATA[385]]></AD_TABLE_ID>
-<!--B6233AB4306E4857897F734B6081AC22-->  <AD_REFERENCE_ID><![CDATA[15]]></AD_REFERENCE_ID>
+<!--B6233AB4306E4857897F734B6081AC22-->  <AD_REFERENCE_ID><![CDATA[24]]></AD_REFERENCE_ID>
 <!--B6233AB4306E4857897F734B6081AC22-->  <FIELDLENGTH><![CDATA[19]]></FIELDLENGTH>
 <!--B6233AB4306E4857897F734B6081AC22-->  <ISKEY><![CDATA[N]]></ISKEY>
 <!--B6233AB4306E4857897F734B6081AC22-->  <ISPARENT><![CDATA[N]]></ISPARENT>
@@ -263420,7 +263520,7 @@
 <!--FEDC3A57EFB74EC082F7E7EDD4858153-->  <HELP><![CDATA[End time in hours.]]></HELP>
 <!--FEDC3A57EFB74EC082F7E7EDD4858153-->  <COLUMNNAME><![CDATA[Endtime]]></COLUMNNAME>
 <!--FEDC3A57EFB74EC082F7E7EDD4858153-->  <AD_TABLE_ID><![CDATA[385]]></AD_TABLE_ID>
-<!--FEDC3A57EFB74EC082F7E7EDD4858153-->  <AD_REFERENCE_ID><![CDATA[15]]></AD_REFERENCE_ID>
+<!--FEDC3A57EFB74EC082F7E7EDD4858153-->  <AD_REFERENCE_ID><![CDATA[24]]></AD_REFERENCE_ID>
 <!--FEDC3A57EFB74EC082F7E7EDD4858153-->  <FIELDLENGTH><![CDATA[19]]></FIELDLENGTH>
 <!--FEDC3A57EFB74EC082F7E7EDD4858153-->  <ISKEY><![CDATA[N]]></ISKEY>
 <!--FEDC3A57EFB74EC082F7E7EDD4858153-->  <ISPARENT><![CDATA[N]]></ISPARENT>
--- a/src-db/database/sourcedata/AD_ELEMENT.xml	Thu Sep 08 13:45:46 2011 +0200
+++ b/src-db/database/sourcedata/AD_ELEMENT.xml	Wed Sep 14 09:49:11 2011 +0200
@@ -19288,6 +19288,17 @@
 <!--17485BBD94A447C2A0C823181EF0F066-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--17485BBD94A447C2A0C823181EF0F066--></AD_ELEMENT>
 
+<!--17ADA898A5534B858EC8BD7651492088--><AD_ELEMENT>
+<!--17ADA898A5534B858EC8BD7651492088-->  <AD_ELEMENT_ID><![CDATA[17ADA898A5534B858EC8BD7651492088]]></AD_ELEMENT_ID>
+<!--17ADA898A5534B858EC8BD7651492088-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--17ADA898A5534B858EC8BD7651492088-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--17ADA898A5534B858EC8BD7651492088-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--17ADA898A5534B858EC8BD7651492088-->  <COLUMNNAME><![CDATA[Date]]></COLUMNNAME>
+<!--17ADA898A5534B858EC8BD7651492088-->  <NAME><![CDATA[Date]]></NAME>
+<!--17ADA898A5534B858EC8BD7651492088-->  <PRINTNAME><![CDATA[Date]]></PRINTNAME>
+<!--17ADA898A5534B858EC8BD7651492088-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--17ADA898A5534B858EC8BD7651492088--></AD_ELEMENT>
+
 <!--1D5007B3718D4A808987DE155B83BDDE--><AD_ELEMENT>
 <!--1D5007B3718D4A808987DE155B83BDDE-->  <AD_ELEMENT_ID><![CDATA[1D5007B3718D4A808987DE155B83BDDE]]></AD_ELEMENT_ID>
 <!--1D5007B3718D4A808987DE155B83BDDE-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -19703,6 +19714,19 @@
 <!--40D3360F2BB046D3B499A86D2CB78200-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--40D3360F2BB046D3B499A86D2CB78200--></AD_ELEMENT>
 
+<!--42B6380737BC4FB681E7A2F3FE1CE952--><AD_ELEMENT>
+<!--42B6380737BC4FB681E7A2F3FE1CE952-->  <AD_ELEMENT_ID><![CDATA[42B6380737BC4FB681E7A2F3FE1CE952]]></AD_ELEMENT_ID>
+<!--42B6380737BC4FB681E7A2F3FE1CE952-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--42B6380737BC4FB681E7A2F3FE1CE952-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--42B6380737BC4FB681E7A2F3FE1CE952-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--42B6380737BC4FB681E7A2F3FE1CE952-->  <COLUMNNAME><![CDATA[Createworkrequirement]]></COLUMNNAME>
+<!--42B6380737BC4FB681E7A2F3FE1CE952-->  <NAME><![CDATA[Create Work Effort]]></NAME>
+<!--42B6380737BC4FB681E7A2F3FE1CE952-->  <PRINTNAME><![CDATA[Create Work Effort]]></PRINTNAME>
+<!--42B6380737BC4FB681E7A2F3FE1CE952-->  <DESCRIPTION><![CDATA[Create all Work Effort for a specific day]]></DESCRIPTION>
+<!--42B6380737BC4FB681E7A2F3FE1CE952-->  <HELP><![CDATA[Create all Work Effort for a specific day]]></HELP>
+<!--42B6380737BC4FB681E7A2F3FE1CE952-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--42B6380737BC4FB681E7A2F3FE1CE952--></AD_ELEMENT>
+
 <!--454F0DF7A3CE4A60B8AEA77359FA8E25--><AD_ELEMENT>
 <!--454F0DF7A3CE4A60B8AEA77359FA8E25-->  <AD_ELEMENT_ID><![CDATA[454F0DF7A3CE4A60B8AEA77359FA8E25]]></AD_ELEMENT_ID>
 <!--454F0DF7A3CE4A60B8AEA77359FA8E25-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_FIELD.xml	Thu Sep 08 13:45:46 2011 +0200
+++ b/src-db/database/sourcedata/AD_FIELD.xml	Wed Sep 14 09:49:11 2011 +0200
@@ -165488,7 +165488,7 @@
 <!--3140BF715A144C0486980C42E1259C31-->  <AD_COLUMN_ID><![CDATA[0B563CEA5A064FD3A9D65F55FAF3502B]]></AD_COLUMN_ID>
 <!--3140BF715A144C0486980C42E1259C31-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
 <!--3140BF715A144C0486980C42E1259C31-->  <DISPLAYLENGTH><![CDATA[12]]></DISPLAYLENGTH>
-<!--3140BF715A144C0486980C42E1259C31-->  <ISREADONLY><![CDATA[Y]]></ISREADONLY>
+<!--3140BF715A144C0486980C42E1259C31-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--3140BF715A144C0486980C42E1259C31-->  <SEQNO><![CDATA[36]]></SEQNO>
 <!--3140BF715A144C0486980C42E1259C31-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
 <!--3140BF715A144C0486980C42E1259C31-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
@@ -175222,6 +175222,33 @@
 <!--5AC5BD9E47401294E040007F01001710-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
 <!--5AC5BD9E47401294E040007F01001710--></AD_FIELD>
 
+<!--5AD878D01A1A441FB43E65E3909068C9--><AD_FIELD>
+<!--5AD878D01A1A441FB43E65E3909068C9-->  <AD_FIELD_ID><![CDATA[5AD878D01A1A441FB43E65E3909068C9]]></AD_FIELD_ID>
+<!--5AD878D01A1A441FB43E65E3909068C9-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--5AD878D01A1A441FB43E65E3909068C9-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--5AD878D01A1A441FB43E65E3909068C9-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--5AD878D01A1A441FB43E65E3909068C9-->  <NAME><![CDATA[Create Work Effort]]></NAME>
+<!--5AD878D01A1A441FB43E65E3909068C9-->  <DESCRIPTION><![CDATA[Create all Work Effort for a specific day]]></DESCRIPTION>
+<!--5AD878D01A1A441FB43E65E3909068C9-->  <HELP><![CDATA[Create all Work Effort for a specific day]]></HELP>
+<!--5AD878D01A1A441FB43E65E3909068C9-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--5AD878D01A1A441FB43E65E3909068C9-->  <AD_TAB_ID><![CDATA[800111]]></AD_TAB_ID>
+<!--5AD878D01A1A441FB43E65E3909068C9-->  <AD_COLUMN_ID><![CDATA[B1F6FEB87A28427B92567CDAFD263A84]]></AD_COLUMN_ID>
+<!--5AD878D01A1A441FB43E65E3909068C9-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--5AD878D01A1A441FB43E65E3909068C9-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
+<!--5AD878D01A1A441FB43E65E3909068C9-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--5AD878D01A1A441FB43E65E3909068C9-->  <SEQNO><![CDATA[150]]></SEQNO>
+<!--5AD878D01A1A441FB43E65E3909068C9-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--5AD878D01A1A441FB43E65E3909068C9-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--5AD878D01A1A441FB43E65E3909068C9-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--5AD878D01A1A441FB43E65E3909068C9-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--5AD878D01A1A441FB43E65E3909068C9-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--5AD878D01A1A441FB43E65E3909068C9-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--5AD878D01A1A441FB43E65E3909068C9-->  <GRID_SEQNO><![CDATA[0]]></GRID_SEQNO>
+<!--5AD878D01A1A441FB43E65E3909068C9-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--5AD878D01A1A441FB43E65E3909068C9-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--5AD878D01A1A441FB43E65E3909068C9-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--5AD878D01A1A441FB43E65E3909068C9--></AD_FIELD>
+
 <!--5AF11EAA77424BD980C99C91B5903746--><AD_FIELD>
 <!--5AF11EAA77424BD980C99C91B5903746-->  <AD_FIELD_ID><![CDATA[5AF11EAA77424BD980C99C91B5903746]]></AD_FIELD_ID>
 <!--5AF11EAA77424BD980C99C91B5903746-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -191796,6 +191823,32 @@
 <!--AD0EE5FEDBAB40F78E8499582B685477-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
 <!--AD0EE5FEDBAB40F78E8499582B685477--></AD_FIELD>
 
+<!--AD2D630930A24FB1B4779FF4D7D9E1D7--><AD_FIELD>
+<!--AD2D630930A24FB1B4779FF4D7D9E1D7-->  <AD_FIELD_ID><![CDATA[AD2D630930A24FB1B4779FF4D7D9E1D7]]></AD_FIELD_ID>
+<!--AD2D630930A24FB1B4779FF4D7D9E1D7-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AD2D630930A24FB1B4779FF4D7D9E1D7-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AD2D630930A24FB1B4779FF4D7D9E1D7-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AD2D630930A24FB1B4779FF4D7D9E1D7-->  <NAME><![CDATA[Create Standards]]></NAME>
+<!--AD2D630930A24FB1B4779FF4D7D9E1D7-->  <HELP><![CDATA[Process to generate standards on production run.]]></HELP>
+<!--AD2D630930A24FB1B4779FF4D7D9E1D7-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--AD2D630930A24FB1B4779FF4D7D9E1D7-->  <AD_TAB_ID><![CDATA[800109]]></AD_TAB_ID>
+<!--AD2D630930A24FB1B4779FF4D7D9E1D7-->  <AD_COLUMN_ID><![CDATA[3E1E7C1929194D75B61C77175B77A3CE]]></AD_COLUMN_ID>
+<!--AD2D630930A24FB1B4779FF4D7D9E1D7-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--AD2D630930A24FB1B4779FF4D7D9E1D7-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
+<!--AD2D630930A24FB1B4779FF4D7D9E1D7-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--AD2D630930A24FB1B4779FF4D7D9E1D7-->  <SEQNO><![CDATA[160]]></SEQNO>
+<!--AD2D630930A24FB1B4779FF4D7D9E1D7-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--AD2D630930A24FB1B4779FF4D7D9E1D7-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--AD2D630930A24FB1B4779FF4D7D9E1D7-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--AD2D630930A24FB1B4779FF4D7D9E1D7-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
+<!--AD2D630930A24FB1B4779FF4D7D9E1D7-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--AD2D630930A24FB1B4779FF4D7D9E1D7-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--AD2D630930A24FB1B4779FF4D7D9E1D7-->  <GRID_SEQNO><![CDATA[160]]></GRID_SEQNO>
+<!--AD2D630930A24FB1B4779FF4D7D9E1D7-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--AD2D630930A24FB1B4779FF4D7D9E1D7-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--AD2D630930A24FB1B4779FF4D7D9E1D7-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--AD2D630930A24FB1B4779FF4D7D9E1D7--></AD_FIELD>
+
 <!--AD44BF4F571E4D5BA903DE7AE04CCBBD--><AD_FIELD>
 <!--AD44BF4F571E4D5BA903DE7AE04CCBBD-->  <AD_FIELD_ID><![CDATA[AD44BF4F571E4D5BA903DE7AE04CCBBD]]></AD_FIELD_ID>
 <!--AD44BF4F571E4D5BA903DE7AE04CCBBD-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -195572,6 +195625,32 @@
 <!--F100F74DDDF145B0BC97F745252E1974-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
 <!--F100F74DDDF145B0BC97F745252E1974--></AD_FIELD>
 
+<!--F1CDE453637D43958F8CD4916A86760E--><AD_FIELD>
+<!--F1CDE453637D43958F8CD4916A86760E-->  <AD_FIELD_ID><![CDATA[F1CDE453637D43958F8CD4916A86760E]]></AD_FIELD_ID>
+<!--F1CDE453637D43958F8CD4916A86760E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--F1CDE453637D43958F8CD4916A86760E-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--F1CDE453637D43958F8CD4916A86760E-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--F1CDE453637D43958F8CD4916A86760E-->  <NAME><![CDATA[Create Standards]]></NAME>
+<!--F1CDE453637D43958F8CD4916A86760E-->  <HELP><![CDATA[Process to generate standards on production run.]]></HELP>
+<!--F1CDE453637D43958F8CD4916A86760E-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--F1CDE453637D43958F8CD4916A86760E-->  <AD_TAB_ID><![CDATA[800112]]></AD_TAB_ID>
+<!--F1CDE453637D43958F8CD4916A86760E-->  <AD_COLUMN_ID><![CDATA[320957DD03794EA1B9B54142DC5E31B9]]></AD_COLUMN_ID>
+<!--F1CDE453637D43958F8CD4916A86760E-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--F1CDE453637D43958F8CD4916A86760E-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
+<!--F1CDE453637D43958F8CD4916A86760E-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--F1CDE453637D43958F8CD4916A86760E-->  <SEQNO><![CDATA[130]]></SEQNO>
+<!--F1CDE453637D43958F8CD4916A86760E-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--F1CDE453637D43958F8CD4916A86760E-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--F1CDE453637D43958F8CD4916A86760E-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--F1CDE453637D43958F8CD4916A86760E-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
+<!--F1CDE453637D43958F8CD4916A86760E-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--F1CDE453637D43958F8CD4916A86760E-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--F1CDE453637D43958F8CD4916A86760E-->  <GRID_SEQNO><![CDATA[100]]></GRID_SEQNO>
+<!--F1CDE453637D43958F8CD4916A86760E-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--F1CDE453637D43958F8CD4916A86760E-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--F1CDE453637D43958F8CD4916A86760E-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--F1CDE453637D43958F8CD4916A86760E--></AD_FIELD>
+
 <!--F489C0DA5BFE40D28C0C888FBC1EF4A5--><AD_FIELD>
 <!--F489C0DA5BFE40D28C0C888FBC1EF4A5-->  <AD_FIELD_ID><![CDATA[F489C0DA5BFE40D28C0C888FBC1EF4A5]]></AD_FIELD_ID>
 <!--F489C0DA5BFE40D28C0C888FBC1EF4A5-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_MESSAGE.xml	Thu Sep 08 13:45:46 2011 +0200
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml	Wed Sep 14 09:49:11 2011 +0200
@@ -19742,4 +19742,15 @@
 <!--FF8081813224247D01322442257900AC-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--FF8081813224247D01322442257900AC--></AD_MESSAGE>
 
+<!--FF80818132626D6F01326328BA9400B4--><AD_MESSAGE>
+<!--FF80818132626D6F01326328BA9400B4-->  <AD_MESSAGE_ID><![CDATA[FF80818132626D6F01326328BA9400B4]]></AD_MESSAGE_ID>
+<!--FF80818132626D6F01326328BA9400B4-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF80818132626D6F01326328BA9400B4-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF80818132626D6F01326328BA9400B4-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF80818132626D6F01326328BA9400B4-->  <VALUE><![CDATA[WorkRequirementCreated]]></VALUE>
+<!--FF80818132626D6F01326328BA9400B4-->  <MSGTEXT><![CDATA[Work Requirement Created for day ]]></MSGTEXT>
+<!--FF80818132626D6F01326328BA9400B4-->  <MSGTYPE><![CDATA[S]]></MSGTYPE>
+<!--FF80818132626D6F01326328BA9400B4-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--FF80818132626D6F01326328BA9400B4--></AD_MESSAGE>
+
 </data>
--- a/src-db/database/sourcedata/AD_MODEL_OBJECT.xml	Thu Sep 08 13:45:46 2011 +0200
+++ b/src-db/database/sourcedata/AD_MODEL_OBJECT.xml	Wed Sep 14 09:49:11 2011 +0200
@@ -4143,4 +4143,16 @@
 <!--FF8081813219E68E013219EEC29C000D-->  <OBJECT_TYPE><![CDATA[S]]></OBJECT_TYPE>
 <!--FF8081813219E68E013219EEC29C000D--></AD_MODEL_OBJECT>
 
+<!--FF808181324D007801324D2BDC8E006A--><AD_MODEL_OBJECT>
+<!--FF808181324D007801324D2BDC8E006A-->  <AD_MODEL_OBJECT_ID><![CDATA[FF808181324D007801324D2BDC8E006A]]></AD_MODEL_OBJECT_ID>
+<!--FF808181324D007801324D2BDC8E006A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF808181324D007801324D2BDC8E006A-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF808181324D007801324D2BDC8E006A-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF808181324D007801324D2BDC8E006A-->  <ACTION><![CDATA[P]]></ACTION>
+<!--FF808181324D007801324D2BDC8E006A-->  <CLASSNAME><![CDATA[org.openbravo.erpCommon.ad_actionButton.CreateWorkEffort]]></CLASSNAME>
+<!--FF808181324D007801324D2BDC8E006A-->  <ISDEFAULT><![CDATA[Y]]></ISDEFAULT>
+<!--FF808181324D007801324D2BDC8E006A-->  <AD_PROCESS_ID><![CDATA[FF808181324D007801324D2AE1130066]]></AD_PROCESS_ID>
+<!--FF808181324D007801324D2BDC8E006A-->  <OBJECT_TYPE><![CDATA[S]]></OBJECT_TYPE>
+<!--FF808181324D007801324D2BDC8E006A--></AD_MODEL_OBJECT>
+
 </data>
--- a/src-db/database/sourcedata/AD_PROCESS.xml	Thu Sep 08 13:45:46 2011 +0200
+++ b/src-db/database/sourcedata/AD_PROCESS.xml	Wed Sep 14 09:49:11 2011 +0200
@@ -5582,4 +5582,24 @@
 <!--FF8081813219E68E013219ECFE930004-->  <UIPATTERN><![CDATA[S]]></UIPATTERN>
 <!--FF8081813219E68E013219ECFE930004--></AD_PROCESS>
 
+<!--FF808181324D007801324D2AE1130066--><AD_PROCESS>
+<!--FF808181324D007801324D2AE1130066-->  <AD_PROCESS_ID><![CDATA[FF808181324D007801324D2AE1130066]]></AD_PROCESS_ID>
+<!--FF808181324D007801324D2AE1130066-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF808181324D007801324D2AE1130066-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF808181324D007801324D2AE1130066-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF808181324D007801324D2AE1130066-->  <VALUE><![CDATA[CreateWorkEffort]]></VALUE>
+<!--FF808181324D007801324D2AE1130066-->  <NAME><![CDATA[Create Work Effort]]></NAME>
+<!--FF808181324D007801324D2AE1130066-->  <DESCRIPTION><![CDATA[Create all Work Effort for a specific day]]></DESCRIPTION>
+<!--FF808181324D007801324D2AE1130066-->  <HELP><![CDATA[Create all Work Effort for a specific day]]></HELP>
+<!--FF808181324D007801324D2AE1130066-->  <ACCESSLEVEL><![CDATA[7]]></ACCESSLEVEL>
+<!--FF808181324D007801324D2AE1130066-->  <ISUSERSTARTABLE><![CDATA[N]]></ISUSERSTARTABLE>
+<!--FF808181324D007801324D2AE1130066-->  <ISREPORT><![CDATA[N]]></ISREPORT>
+<!--FF808181324D007801324D2AE1130066-->  <ISDIRECTPRINT><![CDATA[N]]></ISDIRECTPRINT>
+<!--FF808181324D007801324D2AE1130066-->  <ISBACKGROUND><![CDATA[N]]></ISBACKGROUND>
+<!--FF808181324D007801324D2AE1130066-->  <ISJASPER><![CDATA[N]]></ISJASPER>
+<!--FF808181324D007801324D2AE1130066-->  <ISEXTERNALSERVICE><![CDATA[N]]></ISEXTERNALSERVICE>
+<!--FF808181324D007801324D2AE1130066-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--FF808181324D007801324D2AE1130066-->  <UIPATTERN><![CDATA[S]]></UIPATTERN>
+<!--FF808181324D007801324D2AE1130066--></AD_PROCESS>
+
 </data>
--- a/src-db/database/sourcedata/AD_PROCESS_PARA.xml	Thu Sep 08 13:45:46 2011 +0200
+++ b/src-db/database/sourcedata/AD_PROCESS_PARA.xml	Wed Sep 14 09:49:11 2011 +0200
@@ -4473,4 +4473,57 @@
 <!--FF8081813224247D0132246112F90130-->  <AD_ELEMENT_ID><![CDATA[526]]></AD_ELEMENT_ID>
 <!--FF8081813224247D0132246112F90130--></AD_PROCESS_PARA>
 
+<!--FF808181324D007801324D4040870083--><AD_PROCESS_PARA>
+<!--FF808181324D007801324D4040870083-->  <AD_PROCESS_PARA_ID><![CDATA[FF808181324D007801324D4040870083]]></AD_PROCESS_PARA_ID>
+<!--FF808181324D007801324D4040870083-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF808181324D007801324D4040870083-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF808181324D007801324D4040870083-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF808181324D007801324D4040870083-->  <NAME><![CDATA[Date]]></NAME>
+<!--FF808181324D007801324D4040870083-->  <AD_PROCESS_ID><![CDATA[FF808181324D007801324D2AE1130066]]></AD_PROCESS_ID>
+<!--FF808181324D007801324D4040870083-->  <SEQNO><![CDATA[10]]></SEQNO>
+<!--FF808181324D007801324D4040870083-->  <AD_REFERENCE_ID><![CDATA[15]]></AD_REFERENCE_ID>
+<!--FF808181324D007801324D4040870083-->  <COLUMNNAME><![CDATA[Date]]></COLUMNNAME>
+<!--FF808181324D007801324D4040870083-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--FF808181324D007801324D4040870083-->  <FIELDLENGTH><![CDATA[19]]></FIELDLENGTH>
+<!--FF808181324D007801324D4040870083-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--FF808181324D007801324D4040870083-->  <ISRANGE><![CDATA[N]]></ISRANGE>
+<!--FF808181324D007801324D4040870083-->  <AD_ELEMENT_ID><![CDATA[17ADA898A5534B858EC8BD7651492088]]></AD_ELEMENT_ID>
+<!--FF808181324D007801324D4040870083--></AD_PROCESS_PARA>
+
+<!--FF808181324D007801324D4137DF008A--><AD_PROCESS_PARA>
+<!--FF808181324D007801324D4137DF008A-->  <AD_PROCESS_PARA_ID><![CDATA[FF808181324D007801324D4137DF008A]]></AD_PROCESS_PARA_ID>
+<!--FF808181324D007801324D4137DF008A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF808181324D007801324D4137DF008A-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF808181324D007801324D4137DF008A-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF808181324D007801324D4137DF008A-->  <NAME><![CDATA[Starting Time]]></NAME>
+<!--FF808181324D007801324D4137DF008A-->  <HELP><![CDATA[Start time in hours.]]></HELP>
+<!--FF808181324D007801324D4137DF008A-->  <AD_PROCESS_ID><![CDATA[FF808181324D007801324D2AE1130066]]></AD_PROCESS_ID>
+<!--FF808181324D007801324D4137DF008A-->  <SEQNO><![CDATA[20]]></SEQNO>
+<!--FF808181324D007801324D4137DF008A-->  <AD_REFERENCE_ID><![CDATA[24]]></AD_REFERENCE_ID>
+<!--FF808181324D007801324D4137DF008A-->  <COLUMNNAME><![CDATA[Starttime]]></COLUMNNAME>
+<!--FF808181324D007801324D4137DF008A-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--FF808181324D007801324D4137DF008A-->  <FIELDLENGTH><![CDATA[19]]></FIELDLENGTH>
+<!--FF808181324D007801324D4137DF008A-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--FF808181324D007801324D4137DF008A-->  <ISRANGE><![CDATA[N]]></ISRANGE>
+<!--FF808181324D007801324D4137DF008A-->  <AD_ELEMENT_ID><![CDATA[800364]]></AD_ELEMENT_ID>
+<!--FF808181324D007801324D4137DF008A--></AD_PROCESS_PARA>
+
+<!--FF808181324D007801324D418FD0008E--><AD_PROCESS_PARA>
+<!--FF808181324D007801324D418FD0008E-->  <AD_PROCESS_PARA_ID><![CDATA[FF808181324D007801324D418FD0008E]]></AD_PROCESS_PARA_ID>
+<!--FF808181324D007801324D418FD0008E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF808181324D007801324D418FD0008E-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF808181324D007801324D418FD0008E-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF808181324D007801324D418FD0008E-->  <NAME><![CDATA[Ending Time]]></NAME>
+<!--FF808181324D007801324D418FD0008E-->  <HELP><![CDATA[End time in hours.]]></HELP>
+<!--FF808181324D007801324D418FD0008E-->  <AD_PROCESS_ID><![CDATA[FF808181324D007801324D2AE1130066]]></AD_PROCESS_ID>
+<!--FF808181324D007801324D418FD0008E-->  <SEQNO><![CDATA[30]]></SEQNO>
+<!--FF808181324D007801324D418FD0008E-->  <AD_REFERENCE_ID><![CDATA[24]]></AD_REFERENCE_ID>
+<!--FF808181324D007801324D418FD0008E-->  <COLUMNNAME><![CDATA[Endtime]]></COLUMNNAME>
+<!--FF808181324D007801324D418FD0008E-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--FF808181324D007801324D418FD0008E-->  <FIELDLENGTH><![CDATA[19]]></FIELDLENGTH>
+<!--FF808181324D007801324D418FD0008E-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--FF808181324D007801324D418FD0008E-->  <ISRANGE><![CDATA[N]]></ISRANGE>
+<!--FF808181324D007801324D418FD0008E-->  <AD_ELEMENT_ID><![CDATA[800353]]></AD_ELEMENT_ID>
+<!--FF808181324D007801324D418FD0008E--></AD_PROCESS_PARA>
+
 </data>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CreateWorkEffort.java	Wed Sep 14 09:49:11 2011 +0200
@@ -0,0 +1,293 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html 
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License. 
+ * The Original Code is Openbravo ERP. 
+ * The Initial Developer of the Original Code is Openbravo SLU 
+ * All portions are Copyright (C) 2011 Openbravo SLU 
+ * All Rights Reserved. 
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.erpCommon.ad_actionButton;
+
+import java.math.BigDecimal;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.Properties;
+import java.util.Vector;
+
+import org.hibernate.Query;
+import org.hibernate.criterion.Restrictions;
+import org.openbravo.base.exception.OBException;
+import org.openbravo.base.provider.OBProvider;
+import org.openbravo.base.secureApp.VariablesSecureApp;
+import org.openbravo.base.session.OBPropertiesProvider;
+import org.openbravo.dal.core.OBContext;
+import org.openbravo.dal.service.OBCriteria;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.database.ConnectionProvider;
+import org.openbravo.erpCommon.reference.PInstanceProcessData;
+import org.openbravo.erpCommon.utility.OBError;
+import org.openbravo.erpCommon.utility.Utility;
+import org.openbravo.model.ad.process.ProcessInstance;
+import org.openbravo.model.manufacturing.cost.CostcenterVersion;
+import org.openbravo.model.manufacturing.transaction.WorkRequirement;
+import org.openbravo.model.manufacturing.transaction.WorkRequirementOperation;
+import org.openbravo.model.materialmgmt.transaction.ProductionPlan;
+import org.openbravo.model.materialmgmt.transaction.ProductionTransaction;
+import org.openbravo.scheduling.ProcessBundle;
+
+public class CreateWorkEffort implements org.openbravo.scheduling.Process {
+
+  @Override
+  public void execute(ProcessBundle bundle) throws Exception {
+
+    try {
+
+      final String strWorkRequirement = (String) bundle.getParams().get("MA_Workrequirement_ID");
+      final String strdate = (String) bundle.getParams().get("date");
+      String strStartTime = (String) bundle.getParams().get("starttime");
+      String strEndTime = (String) bundle.getParams().get("endtime");
+      final ConnectionProvider conn = bundle.getConnection();
+
+      // ConvertVariables
+      String dateFormat = OBPropertiesProvider.getInstance().getOpenbravoProperties()
+          .getProperty("dateFormat.java");
+
+      SimpleDateFormat dateformater = new SimpleDateFormat(dateFormat);
+      SimpleDateFormat dateTimeformater = new SimpleDateFormat("yyyy-MM-dd");
+
+      Date date = dateformater.parse(strdate);
+      String dateformatTime = dateTimeformater.format(date);
+      if (strStartTime == null || strStartTime.equals(""))
+        strStartTime = "00:00:00";
+      if (strEndTime == null || strEndTime.equals(""))
+        strEndTime = "00:00:00";
+
+      Timestamp starttime = Timestamp.valueOf(dateformatTime + " " + strStartTime + ".0");
+      Timestamp endtime = Timestamp.valueOf(dateformatTime + " " + strEndTime + ".0");
+
+      // Long startimelong = new
+      // Timestamp starttime = new Timestamp();
+
+      // Search Phases To Be Created
+      WorkRequirement workReq = OBDal.getInstance().get(WorkRequirement.class, strWorkRequirement);
+
+      OBCriteria workReqOpCriteria = OBDal.getInstance().createCriteria(
+          WorkRequirementOperation.class);
+      workReqOpCriteria.add(Restrictions.eq(WorkRequirementOperation.PROPERTY_WORKREQUIREMENT,
+          workReq));
+      workReqOpCriteria.add(Restrictions.le(WorkRequirementOperation.PROPERTY_STARTINGDATE, date));
+      workReqOpCriteria.add(Restrictions.ge(WorkRequirementOperation.PROPERTY_ENDINGDATE, date));
+      workReqOpCriteria.add(Restrictions.eq(WorkRequirementOperation.PROPERTY_CLOSED, false));
+      workReqOpCriteria.addOrderBy(WorkRequirementOperation.PROPERTY_SEQUENCENUMBER, true);
+
+      List<WorkRequirementOperation> workReqOpList = workReqOpCriteria.list();
+
+      int counter = 0;
+      for (WorkRequirementOperation wrOp : workReqOpList) {
+        // Check if exits one not processed;
+
+        OBCriteria productionPlanCriteria = OBDal.getInstance()
+            .createCriteria(ProductionPlan.class);
+        productionPlanCriteria.add(Restrictions.eq(ProductionPlan.PROPERTY_WRPHASE, wrOp));
+        productionPlanCriteria.createAlias(ProductionPlan.PROPERTY_PRODUCTION, "pro");
+        productionPlanCriteria.add(Restrictions.eq("pro."
+            + ProductionTransaction.PROPERTY_MOVEMENTDATE, date));
+        productionPlanCriteria.add(Restrictions.eq("pro."
+            + ProductionTransaction.PROPERTY_PROCESSED, false));
+        List<ProductionPlan> pplanList = productionPlanCriteria.list();
+
+        if (pplanList.isEmpty()) {
+          counter++;
+          // Create ProductionTransaction
+          ProductionTransaction productionTransaction = OBProvider.getInstance().get(
+              ProductionTransaction.class);
+          productionTransaction.setClient(wrOp.getClient());
+          productionTransaction.setOrganization(wrOp.getOrganization());
+          productionTransaction.setMovementDate(date);
+          productionTransaction.setStartingTime(starttime);
+          productionTransaction.setEndingTime(endtime);
+          String documentNo = Utility.getDocumentNo(conn, wrOp.getClient().getId(), "M_Production",
+              true);
+          productionTransaction.setDocumentNo(documentNo);
+
+          OBDal.getInstance().save(productionTransaction);
+          OBDal.getInstance().flush();
+
+          // Crete ProductionPlan
+          ProductionPlan productionPlan = OBProvider.getInstance().get(ProductionPlan.class);
+          productionPlan.setProduction(productionTransaction);
+          productionPlan.setOrganization(productionTransaction.getOrganization());
+          productionPlan.setClient(productionTransaction.getClient());
+          // Only one line per ProductionTransaction
+          productionPlan.setLineNo(10L);
+          productionPlan.setWRPhase(wrOp);
+
+          productionPlan.setRunTime(0L);
+          productionPlan.setClosephase(false);
+          BigDecimal requeriedQty = wrOp.getQuantity().subtract(wrOp.getCompletedQuantity());
+
+          if (wrOp.isCreateStandards()) {
+            productionPlan.setProductionQuantity(requeriedQty);
+            BigDecimal estimatedTime = BigDecimal.ZERO;
+            if (wrOp.getEstimatedTime() != null && wrOp.getQuantity() != null
+                && wrOp.getQuantity().compareTo(BigDecimal.ZERO) != 0) {
+              estimatedTime = wrOp.getEstimatedTime().divide(wrOp.getQuantity())
+                  .multiply(requeriedQty);
+            }
+            productionPlan.setEstimatedTime(estimatedTime.longValue());
+          } else {
+            productionPlan.setProductionQuantity(BigDecimal.ZERO);
+            productionPlan.setEstimatedTime(0L);
+          }
+
+          productionPlan.setRejectedQuantity(0L);
+          productionPlan.setCostCenterUse(BigDecimal.ZERO);
+
+          productionPlan.setStartingTime(starttime);
+          productionPlan.setEndingTime(endtime);
+
+          productionPlan.setRequiredQuantity(requeriedQty.longValue());
+          productionPlan.setProcessUnit(wrOp.getWorkRequirement().getProcessUnit());
+          if (wrOp.getWorkRequirement().getConversionRate() != null
+              && wrOp.getWorkRequirement().getConversionRate().compareTo(BigDecimal.ZERO) != 0) {
+            productionPlan.setConversionRate(wrOp.getWorkRequirement().getConversionRate());
+          }
+
+          // Get CostCenterVersion
+          OBCriteria costcenterVersionCriteria = OBDal.getInstance().createCriteria(
+              CostcenterVersion.class);
+          costcenterVersionCriteria.add(Restrictions.eq(CostcenterVersion.PROPERTY_COSTCENTER, wrOp
+              .getActivity().getCostCenter()));
+          costcenterVersionCriteria.add(Restrictions.lt(CostcenterVersion.PROPERTY_VALIDFROMDATE,
+              date));
+          costcenterVersionCriteria.addOrderBy(CostcenterVersion.PROPERTY_VALIDFROMDATE, false);
+          List<CostcenterVersion> costcenterVersionList = costcenterVersionCriteria.list();
+          if (!costcenterVersionList.isEmpty()) {
+            productionPlan.setCostCenterVersion(costcenterVersionList.get(0));
+          }
+
+          productionPlan.setOutsourced((wrOp.isOutsourced() == null) ? false : wrOp.isOutsourced());
+          if (wrOp.getMASequence() != null)
+            productionPlan.setDivisionGroupQuantity(wrOp.getMASequence().getDivisiongroupqty());
+
+          OBDal.getInstance().save(productionPlan);
+          OBDal.getInstance().flush();
+
+          if (wrOp.isCreateStandards()) {
+            createStandars(productionPlan, conn, bundle.getContext().toVars());
+          }
+
+        }
+
+      }
+
+      final OBError msg = new OBError();
+
+      msg.setType("Success");
+      msg.setTitle(Utility.messageBD(conn, "Success", bundle.getContext().getLanguage()));
+      msg.setMessage(counter + " "
+          + Utility.messageBD(conn, "WorkRequirementCreated", bundle.getContext().getLanguage())
+          + strdate);
+      bundle.setResult(msg);
+    } catch (final Exception e) {
+      OBDal.getInstance().rollbackAndClose();
+      e.printStackTrace(System.err);
+      final OBError msg = new OBError();
+      msg.setType("Error");
+      if (e instanceof org.hibernate.exception.GenericJDBCException) {
+        msg.setMessage(((org.hibernate.exception.GenericJDBCException) e).getSQLException()
+            .getNextException().getMessage());
+      } else if (e instanceof org.hibernate.exception.ConstraintViolationException) {
+        msg.setMessage(((org.hibernate.exception.ConstraintViolationException) e).getSQLException()
+            .getNextException().getMessage());
+      } else {
+        msg.setMessage(e.getMessage());
+      }
+      msg.setTitle("Error occurred");
+      bundle.setResult(msg);
+    }
+  }
+
+  public static Long getNeededQtyLineNum(String phaseId) throws Exception {
+    String hql = "  SELECT (QUANTITY - DONEQUANTITY) AS DefaultValue FROM MA_WRPhase WHERE MA_WRPhase_ID = '"
+        + phaseId + "'";
+    Query q = OBDal.getInstance().getSession().createQuery(hql);
+
+    if (q.list().size() > 0) {
+      return new Long(q.list().get(0).toString());
+    } else {
+      return 0L;
+    }
+  }
+
+  private void createStandars(ProductionPlan productionPlan, ConnectionProvider conn,
+      VariablesSecureApp vars) throws Exception {
+
+    OBContext.setAdminMode();
+
+    org.openbravo.model.ad.ui.Process process = OBDal.getInstance().get(
+        org.openbravo.model.ad.ui.Process.class, "800105");
+
+    final ProcessInstance pInstance = OBProvider.getInstance().get(ProcessInstance.class);
+    pInstance.setProcess(process);
+    pInstance.setActive(true);
+    pInstance.setRecordID(productionPlan.getId());
+    pInstance.setUserContact(OBContext.getOBContext().getUser());
+
+    OBDal.getInstance().save(pInstance);
+    OBDal.getInstance().flush();
+
+    try {
+      final Connection connection = OBDal.getInstance().getConnection();
+      PreparedStatement ps = null;
+      final Properties obProps = OBPropertiesProvider.getInstance().getOpenbravoProperties();
+      if (obProps.getProperty("bbdd.rdbms") != null
+          && obProps.getProperty("bbdd.rdbms").equals("POSTGRE")) {
+        ps = connection.prepareStatement("SELECT * FROM ma_productionrun_standard(?)");
+      } else {
+        ps = connection.prepareStatement("CALL ma_productionrun_standard(?)");
+      }
+      ps.setString(1, pInstance.getId());
+      ps.execute();
+
+    } catch (Exception e) {
+      throw new IllegalStateException(e);
+    }
+
+    OBDal.getInstance().getSession().refresh(pInstance);
+
+    if (pInstance.getResult() == 0) {
+      // Error Processing
+      OBError myMessage = Utility
+          .getProcessInstanceMessage(conn, vars, getPInstanceData(pInstance));
+      throw new OBException("ERROR: " + myMessage.getMessage());
+    }
+    OBContext.restorePreviousMode();
+  }
+
+  private PInstanceProcessData[] getPInstanceData(ProcessInstance pInstance) throws Exception {
+    Vector<java.lang.Object> vector = new Vector<java.lang.Object>(0);
+    PInstanceProcessData objectPInstanceProcessData = new PInstanceProcessData();
+    objectPInstanceProcessData.result = pInstance.getResult().toString();
+    objectPInstanceProcessData.errormsg = pInstance.getErrorMsg();
+    objectPInstanceProcessData.pMsg = "";
+    vector.addElement(objectPInstanceProcessData);
+    PInstanceProcessData pinstanceData[] = new PInstanceProcessData[1];
+    vector.copyInto(pinstanceData);
+    return pinstanceData;
+  }
+}
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_SequenceProduct_Product_Attribute.java	Thu Sep 08 13:45:46 2011 +0200
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_SequenceProduct_Product_Attribute.java	Wed Sep 14 09:49:11 2011 +0200
@@ -20,7 +20,7 @@
 
 import javax.servlet.ServletException;
 
-import org.hibernate.criterion.Expression;
+import org.hibernate.criterion.Restrictions;
 import org.openbravo.base.filter.IsIDFilter;
 import org.openbravo.dal.service.OBCriteria;
 import org.openbravo.dal.service.OBDal;
@@ -52,7 +52,7 @@
           strmProductSequenceId);
 
       OBCriteria attributeUseCriteria = OBDal.getInstance().createCriteria(AttributeUse.class);
-      attributeUseCriteria.add(Expression.eq(AttributeUse.PROPERTY_ATTRIBUTESET,
+      attributeUseCriteria.add(Restrictions.eq(AttributeUse.PROPERTY_ATTRIBUTESET,
           product.getAttributeSet()));
       attributeUseCriteria.addOrderBy(AttributeUse.PROPERTY_SEQUENCENUMBER, true);
       java.util.List<AttributeUse> attUseList = attributeUseCriteria.list();
@@ -98,9 +98,9 @@
     Reference specialAttList = OBDal.getInstance().get(Reference.class, specialAttListId);
     OBCriteria specialAttListValuesCriteria = OBDal.getInstance().createCriteria(
         org.openbravo.model.ad.domain.List.class);
-    specialAttListValuesCriteria.add(Expression.eq(
+    specialAttListValuesCriteria.add(Restrictions.eq(
         org.openbravo.model.ad.domain.List.PROPERTY_REFERENCE, specialAttList));
-    specialAttListValuesCriteria.add(Expression.eq(
+    specialAttListValuesCriteria.add(Restrictions.eq(
         org.openbravo.model.ad.domain.List.PROPERTY_SEARCHKEY, Value));
     java.util.List<org.openbravo.model.ad.domain.List> specialAttListValues = (java.util.List) specialAttListValuesCriteria
         .list();