svn commit: r728894 [2/2] - in /ofbiz/trunk: applications/accounting/ applications/accounting/config/ applications/accounting/data/ applications/accounting/entitydef/ applications/accounting/script/org/ofbiz/accounting/rate/ applications/accounting/ser...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r728894 [2/2] - in /ofbiz/trunk: applications/accounting/ applications/accounting/config/ applications/accounting/data/ applications/accounting/entitydef/ applications/accounting/script/org/ofbiz/accounting/rate/ applications/accounting/ser...

hansbak-2
Modified: ofbiz/trunk/applications/party/webapp/partymgr/party/PartyForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/party/PartyForms.xml?rev=728894&r1=728893&r2=728894&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/party/PartyForms.xml (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/party/PartyForms.xml Mon Dec 22 23:26:55 2008
@@ -311,12 +311,12 @@
     </form>
 
     <!-- PartyRate -->
-    <form name="AddPartyRate" type="single" target="createPartyRate"
+    <form name="AddPartyRate" type="single" target="updatePartyRate"
         focus-field-name="rateTypeId" header-row-style="header-row" default-table-style="basic-table">
         <actions>
             <property-to-field field="defaultCurrencyUomId" resource="general" property="currency.uom.id.default" default="USD"/>
+            <set field="periodTypeId" value="RATE_HOUR"/>
         </actions>
-        <auto-fields-service service-name="createPartyRate"/>
         <field name="partyId"><hidden/></field>
         <field name="rateTypeId" title="${uiLabelMap.TimesheetRateType}">
             <drop-down no-current-selected-key="STANDARD" allow-empty="false">
@@ -325,42 +325,52 @@
                 </entity-options>
             </drop-down>
         </field>
-        <field name="defaultRate">
+        <field name="periodTypeId" position="2">
+            <display-entity entity-name="PeriodType"/>
+        </field>
+        <field name="rateAmount"  tooltip="override Default Rate amount"><text/></field>
+        <field name="rateCurrencyUomId" title="${uiLabelMap.ProductCurrencyUomId}" position="2" entry-name="defaultCurrencyUomId" tooltip="Adjust in accounting component">
+            <display-entity entity-name="Uom" key-field-name="uomId"/>
+        </field>
+        <field name="percentageUsed"><text size="6"/></field>
+        <field name="defaultRate" position="2">
             <drop-down no-current-selected-key="N">
                 <option key="N"/>
                 <option key="Y"/>
             </drop-down>
         </field>
-        <field name="currencyUomId" title="${uiLabelMap.ProductCurrencyUomId}">
-            <drop-down allow-empty="false" no-current-selected-key="${defaultCurrencyUomId}">
-                <entity-options key-field-name="uomId" description="${abbreviation} - ${description}" entity-name="Uom">
-                    <entity-constraint name="uomTypeId" operator="equals" value="CURRENCY_MEASURE"/>
-                    <entity-order-by field-name="abbreviation"/>
-                </entity-options>
-            </drop-down>
-        </field>
         <field name="submitButton" title="${uiLabelMap.CommonCreate}"><submit button-type="button"/></field>
     </form>
 
-    <form name="ListPartyRates" type="list" list-name="partyTaxInfos" target="updatePartyRate"
+    <form name="ListPartyRates" type="list" target="deletePartyRate"
         odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
         <actions>
-            <entity-condition entity-name="PartyRate">
+            <entity-condition entity-name="PartyRate" filter-by-date="true">
                 <condition-expr field-name="partyId" env-name="partyId"/>
                 <order-by field-name="rateTypeId"/>
-                <order-by field-name="fromDate"/>
             </entity-condition>
         </actions>
-        <auto-fields-service service-name="updatePartyRate"/>
+        <row-actions>
+            <service service-name="getRateAmount" result-map-name="rateResult"/>
+            <set field="rateDefaultAmount" from-field="rateResult.rateAmount"/>
+            <set field="periodTypeId" from-field="rateResult.periodTypeId"/>
+            <set field="rateCurrencyUomId" from-field="rateResult.rateCurrencyUomId"/>
+            <set field="rateLevel" from-field="rateResult.level"/>
+            <set field="rateAmountFromDate" from-field="rateResult.fromDate"/>
+        </row-actions>
         <field name="partyId"><hidden/></field>
+        <field name="fromDate"><hidden/></field>
+        <field name="rateAmountFromDate"><hidden/></field>
+        <field name="rateCurrencyUomId"><hidden/></field>
         <field name="rateTypeId" title="${uiLabelMap.TimesheetRateType}"><display-entity entity-name="RateType" also-hidden="true"/></field>
-        <field name="fromDate" title="${uiLabelMap.CommonFromDateTime}"><display/></field>
-        <field name="currencyUomId"><display-entity entity-name="Uom" key-field-name="uomId" description="${description}"/></field>
-        <field name="submitButton" title="${uiLabelMap.CommonUpdate}"><submit button-type="button"/></field>
-        <field name="deleteLink" title="${uiLabelMap.CommonEmptyHeader}" widget-style="smallSubmit">
-            <hyperlink target="deletePartyRate?partyId=${partyId}&amp;rateTypeId=${rateTypeId}&amp;currencyUomId=${currencyUomId}&amp;fromDate=${fromDate}"
-                description="${uiLabelMap.CommonDelete}" also-hidden="false"/>
-        </field>
+        <field name="periodTypeId"><display-entity entity-name="PeriodType" description="${description}"/></field>
+        <field name="rateDefaultAmount" use-when="&quot;workEffort&quot;.equals(rateLevel)" tooltip="Value from workeffort level"><display type="currency" currency="${rateCurrencyUomId}"/></field>
+        <field name="rateDefaultAmount" use-when="&quot;party&quot;.equals(rateLevel)" tooltip="Value from party level"><display type="currency" currency="${rateCurrencyUomId}"/></field>
+        <field name="rateDefaultAmount" use-when="&quot;rateType&quot;.equals(rateLevel)" tooltip="Value from rateType level"><display type="currency" currency="${rateCurrencyUomId}"/></field>
+        <field name="rateDefaultAmount" use-when="rateLevel==null" tooltip="Rate not specified for this party AND NO default rate"><display/></field>
+        <field name="defaultRate"><display/></field>
+        <field name="percentageUsed"><display/></field>
+        <field name="deleteButton" widget-style="smallSubmit"><submit /></field>
     </form>
 
     <form name="NewUser" type="single" target="${target}${previousParams}"

Modified: ofbiz/trunk/applications/workeffort/data/WorkEffortTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/data/WorkEffortTypeData.xml?rev=728894&r1=728893&r2=728894&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/data/WorkEffortTypeData.xml (original)
+++ ofbiz/trunk/applications/workeffort/data/WorkEffortTypeData.xml Mon Dec 22 23:26:55 2008
@@ -18,13 +18,6 @@
 under the License.
 -->
 <entity-engine-xml>
-    <RateType rateTypeId="STANDARD" description="Standard Hourly Rate"/>
-    <RateType rateTypeId="DISCOUNTED" description="Discounted Hourly Rate"/>
-    <RateType rateTypeId="OVERTIME" description="Overtime Hourly Rate"/>
-    <RateType rateTypeId="AVERAGE_PAY_RATE" description="Average Pay Rate"/>
-    <RateType rateTypeId="HIGH_PAY_RATE" description="Highest Pay Rate"/>
-    <RateType rateTypeId="LOW_PAY_RATE" description="Lowest Pay Rate"/>
-    
     <EnumerationType description="Parent Type for all Work Effort enum types" enumTypeId="WORK_EFFORT" hasTable="N" parentTypeId=""/>
     <EnumerationType description="Parent Type for all Workflow enum types" enumTypeId="WORKFLOW" hasTable="N" parentTypeId=""/>
 

Modified: ofbiz/trunk/applications/workeffort/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/entitydef/entitymodel.xml?rev=728894&r1=728893&r2=728894&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/workeffort/entitydef/entitymodel.xml Mon Dec 22 23:26:55 2008
@@ -41,43 +41,6 @@
   <!-- org.ofbiz.workeffort.timesheet -->
   <!-- ========================================================= -->
 
-    <entity entity-name="PartyRate"
-            package-name="org.ofbiz.workeffort.timesheet"
-            title="Party Rate Entity">
-      <field name="partyId" type="id-ne"></field>
-      <field name="rateTypeId" type="id-ne"></field>
-      <field name="currencyUomId" type="id-ne"/>
-      <field name="defaultRate" type="indicator"></field>
-      <field name="fromDate" type="date-time"></field>
-      <field name="thruDate" type="date-time"></field>
-      <field name="rate" type="currency-amount"></field>
-      <prim-key field="partyId"/>
-      <prim-key field="rateTypeId"/>
-      <prim-key field="currencyUomId"/>
-      <prim-key field="fromDate"/>
-      <relation type="one" fk-name="PRTY_RTE_PRTY" rel-entity-name="Party">
-        <key-map field-name="partyId"/>
-      </relation>
-      <relation type="one" fk-name="PRTY_RTE_RTTP" rel-entity-name="RateType">
-        <key-map field-name="rateTypeId"/>
-      </relation>
-      <relation type="one" fk-name="PARTY_RATE_CUOM" title="Currency" rel-entity-name="Uom">
-        <key-map field-name="currencyUomId" rel-field-name="uomId"/>
-      </relation>
-    </entity>
-    <entity entity-name="RateType"
-            package-name="org.ofbiz.workeffort.timesheet"
-            default-resource-name="WorkEffortEntityLabels"
-            title="Rate Type Entity">
-      <field name="rateTypeId" type="id-ne"></field>
-      <field name="description" type="description"></field>
-      <field name="normalRate" type="currency-amount"></field>
-      <field name="rateUomId" type="id"></field>
-      <prim-key field="rateTypeId"/>
-        <relation type="one" fk-name="RATETYPE_RUOM" title="Rate" rel-entity-name="Uom">
-            <key-map field-name="rateUomId" rel-field-name="uomId"/>
-        </relation>
-    </entity>
     <entity entity-name="TimeEntry"
             package-name="org.ofbiz.workeffort.timesheet"
             title="Time Entry Entity">
@@ -161,30 +124,7 @@
         <key-map field-name="roleTypeId"/>
       </relation>
     </entity>
-    <entity entity-name="WorkEffortAssignmentRate"
-            package-name="org.ofbiz.workeffort.timesheet"
-            title="Work Effort Assignment Rate Entity">
-      <field name="workEffortId" type="id-ne"></field>
-      <field name="rateTypeId" type="id-ne"></field>
-      <field name="partyId" type="id-ne"></field>
-      <field name="fromDate" type="date-time"></field>
-      <field name="thruDate" type="date-time"></field>
-      <field name="rate" type="currency-amount"></field>
-      <prim-key field="workEffortId"/>
-      <prim-key field="rateTypeId"/>
-      <prim-key field="partyId"/>
-      <prim-key field="fromDate"/>
-      <relation type="one" fk-name="WEFF_ASRT_WEFF" rel-entity-name="WorkEffort">
-        <key-map field-name="workEffortId"/>
-      </relation>
-      <relation type="one" fk-name="WEFF_ASRT_RATETP" rel-entity-name="RateType">
-        <key-map field-name="rateTypeId"/>
-      </relation>
-      <relation type="one" fk-name="WEFF_ASRT_PRTY" rel-entity-name="Party">
-        <key-map field-name="partyId"/>
-      </relation>
-    </entity>
-
+  
   <!-- ========================================================= -->
   <!-- org.ofbiz.workeffort.workeffort -->
   <!-- ========================================================= -->

Added: ofbiz/trunk/applications/workeffort/entitydef/entitymodel_old.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/entitydef/entitymodel_old.xml?rev=728894&view=auto
==============================================================================
--- ofbiz/trunk/applications/workeffort/entitydef/entitymodel_old.xml (added)
+++ ofbiz/trunk/applications/workeffort/entitydef/entitymodel_old.xml Mon Dec 22 23:26:55 2008
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<entitymodel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/entitymodel.xsd">
+    <title>Entity of an Open For Business Project Component</title>
+    <description>old depreciated entities</description>
+    <copyright>Copyright 2001-2008 The Apache Software Foundation</copyright>
+    <author>None</author>
+    <version>1.0</version>
+
+  <entity entity-name="OldWorkEffortAssignmentRate" table-name="WORK_EFFORT_ASSIGNMENT_RATE"
+    package-name="org.ofbiz.workeffort.timesheet"
+    title="Work Effort Assignment Rate Entity, now depreciated and replaced by the RateAmount entity">
+    <field name="workEffortId" type="id-ne"></field>
+    <field name="rateTypeId" type="id-ne"></field>
+    <field name="partyId" type="id-ne"></field>
+    <field name="fromDate" type="date-time"></field>
+    <field name="thruDate" type="date-time"></field>
+    <field name="rate" type="currency-amount"></field>
+    <prim-key field="workEffortId"/>
+    <prim-key field="rateTypeId"/>
+    <prim-key field="partyId"/>
+    <prim-key field="fromDate"/>
+    <relation type="one" fk-name="WEFF_ASRT_WEFF" rel-entity-name="WorkEffort">
+      <key-map field-name="workEffortId"/>
+    </relation>
+    <relation type="one" fk-name="WEFF_ASRT_RATETP" rel-entity-name="RateType">
+      <key-map field-name="rateTypeId"/>
+    </relation>
+    <relation type="one" fk-name="WEFF_ASRT_PRTY" rel-entity-name="Party">
+      <key-map field-name="partyId"/>
+    </relation>
+  </entity>
+  
+</entitymodel>

Propchange: ofbiz/trunk/applications/workeffort/entitydef/entitymodel_old.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/workeffort/entitydef/entitymodel_old.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/applications/workeffort/entitydef/entitymodel_old.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: ofbiz/trunk/applications/workeffort/entitydef/entitymodel_view.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/entitydef/entitymodel_view.xml?rev=728894&r1=728893&r2=728894&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/entitydef/entitymodel_view.xml (original)
+++ ofbiz/trunk/applications/workeffort/entitydef/entitymodel_view.xml Mon Dec 22 23:26:55 2008
@@ -144,7 +144,7 @@
       <relation type="many" rel-entity-name="WorkEffortBilling">
         <key-map field-name="workEffortId"/>
       </relation>
-      <relation type="many" rel-entity-name="WorkEffortAssignmentRate">
+      <relation type="many" rel-entity-name="RateAmount">
         <key-map field-name="workEffortId"/>
       </relation>
       <relation type="many" rel-entity-name="CommunicationEventWorkEff">
@@ -829,4 +829,5 @@
           <key-map field-name="contactMechId"/>
       </view-link>
     </view-entity>    
-</entitymodel>
+
+</entitymodel>
\ No newline at end of file

Modified: ofbiz/trunk/applications/workeffort/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/ofbiz-component.xml?rev=728894&r1=728893&r2=728894&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/ofbiz-component.xml (original)
+++ ofbiz/trunk/applications/workeffort/ofbiz-component.xml Mon Dec 22 23:26:55 2008
@@ -26,6 +26,7 @@
     <classpath type="dir" location="config"/>
     <classpath type="dir" location="script"/>
     <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/>
+    <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel_old.xml"/>
     <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel_view.xml"/>
     <entity-resource type="eca" reader-name="main" loader="main" location="entitydef/eecas.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" location="data/WorkEffortTypeData.xml"/>

Modified: ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/RateServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/RateServices.xml?rev=728894&r1=728893&r2=728894&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/RateServices.xml (original)
+++ ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/RateServices.xml Mon Dec 22 23:26:55 2008
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods.xsd">
-
-    <!-- PartyRate Services -->
-    <simple-method method-name="createPartyRate" short-description="Create PartyRate">
-        <check-permission permission="WORKEFFORTMGR" action="_CREATE"><fail-message message="You do not have permission to perform this operation: ${methodShortDescription}."/></check-permission>
-        <check-errors/>
-        <make-value value-name="newEntity" entity-name="PartyRate"/>
-        <set-pk-fields map-name="parameters" value-name="newEntity"/>
-        <if-empty field="newEntity.fromDate"><now-timestamp-to-env env-name="newEntity.fromDate"/></if-empty>
-        <set-nonpk-fields map-name="parameters" value-name="newEntity"/>
-        <call-simple-method method-name="checkOtherDefaultRate"/>
-        <create-value value-name="newEntity"/>
-    </simple-method>
-    <simple-method method-name="updatePartyRate" short-description="Update PartyRate">
-        <check-permission permission="WORKEFFORTMGR" action="_UPDATE"><fail-message message="You do not have permission to perform this operation: ${methodShortDescription}."/></check-permission>
-        <check-errors/>
-        <entity-one entity-name="PartyRate" value-name="newEntity"/>
-        <set-nonpk-fields map-name="parameters" value-name="newEntity"/>
-        <call-simple-method method-name="checkOtherDefaultRate"/>
-        <store-value value-name="newEntity"/>
-    </simple-method>
-    <simple-method method-name="checkOtherDefaultRate" short-description="remove an other defaultRate flag">
-        <if-compare field="newEntity.defaultRate" value="Y" operator="equals">
-            <entity-and entity-name="PartyRate" list-name="rates" filter-by-date="true">
-                <field-map field-name="partyId" env-name="newEntity.partyId"/>
-                <field-map field-name="defaultRate" value="Y"/>
-            </entity-and>
-            <if-not-empty field="rates">
-                <first-from-list entry-name="rate" list-name="rates"/>
-                <set field="rate.defaultRate" value="N"/>
-                <store-value value-name="rate"/>
-            </if-not-empty>
-        </if-compare>
-    </simple-method>
-    <simple-method method-name="deletePartyRate" short-description="Delete PartyRate">
-        <check-permission permission="WORKEFFORTMGR" action="_DELETE"><fail-message message="You do not have permission to perform this operation: ${methodShortDescription}."/></check-permission>
-        <check-errors/>
-        
-        <entity-one entity-name="PartyRate" value-name="lookedUpValue"/>
-        <remove-value value-name="lookedUpValue"/>
-    </simple-method>
-    
-    <!-- WorkEffortAssignmentRate Services -->
-    <simple-method method-name="createWorkEffortAssignmentRate" short-description="Create WorkEffortAssignmentRate">
-        <check-permission permission="WORKEFFORTMGR" action="_CREATE"><fail-message message="You do not have permission to perform this operation: ${methodShortDescription}."/></check-permission>
-        <check-errors/>
-        
-        <make-value value-name="newEntity" entity-name="WorkEffortAssignmentRate"/>
-        <set-pk-fields map-name="parameters" value-name="newEntity"/>
-        <if-empty field="newEntity.fromDate"><now-timestamp-to-env env-name="newEntity.fromDate"/></if-empty>
-        <set-nonpk-fields map-name="parameters" value-name="newEntity"/>
-        <create-value value-name="newEntity"/>
-    </simple-method>
-    <simple-method method-name="updateWorkEffortAssignmentRate" short-description="Update WorkEffortAssignmentRate">
-        <check-permission permission="WORKEFFORTMGR" action="_UPDATE"><fail-message message="You do not have permission to perform this operation: ${methodShortDescription}."/></check-permission>
-        <check-errors/>
-        
-        <entity-one entity-name="WorkEffortAssignmentRate" value-name="lookedUpValue"/>
-        <set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/>
-        <store-value value-name="lookedUpValue"/>
-    </simple-method>
-    <simple-method method-name="deleteWorkEffortAssignmentRate" short-description="Delete WorkEffortAssignmentRate">
-        <check-permission permission="WORKEFFORTMGR" action="_DELETE"><fail-message message="You do not have permission to perform this operation: ${methodShortDescription}."/></check-permission>
-        <check-errors/>
-        
-        <entity-one entity-name="WorkEffortAssignmentRate" value-name="lookedUpValue"/>
-        <remove-value value-name="lookedUpValue"/>
-    </simple-method>
-</simple-methods>

Modified: ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/TimesheetServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/TimesheetServices.xml?rev=728894&r1=728893&r2=728894&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/TimesheetServices.xml (original)
+++ ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/TimesheetServices.xml Mon Dec 22 23:26:55 2008
@@ -134,11 +134,12 @@
         </entity-one>
         <set field="updateInvoiceMap.invoiceId" from-field="parameters.invoiceId"/>
         <set field="updateInvoiceMap.currencyUomId" from-field="party.preferredCurrencyUomId"/>
+        <now-timestamp-to-env env-name="updateInvoiceMap.invoiceDate"/>
         <if-empty field="updateInvoiceMap.currencyUomId">
             <property-to-field field-name="invoice.currencyUomId" resource="general" property="currency.uom.id.default" default="USD"/>
         </if-empty>                
         <call-service service-name="updateInvoice" in-map-name="updateInvoiceMap"/>
-        
+        <entity-one entity-name="Invoice" value-name="invoice"/>
         <call-simple-method method-name="createTimeEntryInvoiceItemsInline"/>
     </simple-method>
     <simple-method method-name="createTimeEntryInvoiceItemsInline" short-description="createTimeEntryInvoiceItemsInline">
@@ -164,6 +165,36 @@
                     <if-compare field="invoice.statusId" operator="equals" value="INVOICE_IN_PROCESS">
                         <!-- only add to invoice if it is not already on an invoice-->
                         <if-empty field="timeEntry.invoiceId">
+                            <!-- check if only a percentage of the hours need to be used -->
+                            <if-empty field="timeEntry.partyId">
+                                <if-not-empty field="timeEntry.timesheetId">
+                                    <entity-one entity-name="Timesheet" value-name="timesheet">
+                                        <field-map field-name="timesheetId" env-name="timeEntry.timesheetId"/>
+                                    </entity-one>
+                                    <set field="timeEntry.partyId" from-field="timesheet.partyId"/>                                    
+                                </if-not-empty>
+                            </if-empty>
+                            <if-not-empty field="timeEntry.partyId">
+                                <entity-and entity-name="PartyRate" list-name="partyRates" filter-by-date="true">
+                                    <field-map field-name="rateTypeId" env-name="timeEntry.rateTypeId"/>
+                                    <field-map field-name="partyId" env-name="timeEntry.partyId"/>
+                                </entity-and>
+                                <if-not-empty field="partyRates">
+                                    <first-from-list entry-name="partyRate" list-name="partyRates"/>
+                                    <if-not-empty field="partyRate.percentageUsed">
+                                        <calculate field-name="timeEntry.hours" type="Double">
+                                            <calcop operator="multiply" field-name="timeEntry.hours">
+                                                <calcop operator="get" field-name="partyRate.percentageUsed"/>
+                                            </calcop>
+                                        </calculate>
+                                        <calculate field-name="timeEntry.hours" type="Double">
+                                            <calcop operator="divide" field-name="timeEntry.hours">
+                                                <number value="100"/>
+                                            </calcop>
+                                        </calculate>
+                                    </if-not-empty>
+                                </if-not-empty>                                                                
+                            </if-not-empty>
                             <set field="getTimeEntryRate.timeEntryId" from-field="timeEntry.timeEntryId"/>
                             <set field="getTimeEntryRate.currencyUomId" from-field="invoice.currencyUomId"/>
                             <call-service service-name="getTimeEntryRate" in-map-name="getTimeEntryRate">
@@ -310,48 +341,22 @@
         <check-errors/>
         
         <entity-one entity-name="TimeEntry" value-name="timeEntry"/>
-        
-        <!-- first try the WorkEffortAssignmentRate -->
-        <if-not-empty field="timeEntry.workEffortId">
-            <entity-condition entity-name="WorkEffortAssignmentRate" list-name="workEffortAssignmentRateList" filter-by-date="true">
-                <condition-list combine="and">
-                    <condition-expr field-name="workEffortId" env-name="timeEntry.workEffortId"/>
-                    <condition-expr field-name="partyId" env-name="timeEntry.partyId"/>
-                    <condition-expr field-name="rateTypeId" env-name="timeEntry.rateTypeId"/>
-                </condition-list>
-                <order-by field-name="-fromDate"/>
-            </entity-condition>
-            <first-from-list entry-name="workEffortAssignmentRate" list-name="workEffortAssignmentRateList"/>
-            <if-not-empty field="workEffortAssignmentRate">
-                <set field="rateAmount" from-field="workEffortAssignmentRate.rate"/>
-            </if-not-empty>
-        </if-not-empty>
-        <!-- no rateAmount yet, try PartyRate if partyId not provided try the timesheet-->
-        <if-empty field="rateAmount">
-            <if-empty field="timeEntry.partyId">
-                <get-related-one value-name="timeEntry" relation-name="Timesheet" to-value-name="timesheet"/>
-                <if-not-empty field="timesheet">
-                    <set field="timeEntry.partyId" from-field="timesheet.partyId"/>
-                </if-not-empty>
-            </if-empty>
-            <if-empty field="parameters.currencyUomId">
-                <property-to-field field-name="parameters.currencyUomId" resource="general" property="currency.uom.id.default" default="USD"/>
-            </if-empty>
-            <entity-condition entity-name="PartyRate" list-name="partyRateList">
-                <condition-list combine="and">
-                    <condition-expr field-name="partyId" env-name="timeEntry.partyId"/>
-                    <condition-expr field-name="rateTypeId" env-name="timeEntry.rateTypeId"/>
-                    <condition-expr field-name="currencyUomId" env-name="parameters.currencyUomId"/>
-                </condition-list>
-                <order-by field-name="-fromDate"/>
-            </entity-condition>
-            <filter-list-by-date list-name="partyRateList" all-same="true"/>
-            <first-from-list entry-name="partyRate" list-name="partyRateList"/>
-            <if-not-empty field="partyRate">
-                <set field="rateAmount" from-field="partyRate.rate"/>
+
+        <set-service-fields service-name="getRateAmount" map-name="parameters" to-map-name="getRate"/>
+        <set field="getRate.rateCurrencyUomId" from-field="parameters.currencyUomId"/>
+        <set field="getRate.rateTypeId" from-field="timeEntry.rateTypeId"/>
+        <if-empty field="timeEntry.partyId">
+            <get-related-one value-name="timeEntry" relation-name="Timesheet" to-value-name="timesheet"/>
+            <if-not-empty field="timesheet">
+                <set field="getRate.partyId" from-field="timesheet.partyId"/>
             </if-not-empty>
+            <else>
+                <set field="getRate.partyId" from-field="timeEntry.partyId"/>
+            </else>
         </if-empty>
-        <field-to-result field-name="rateAmount"/>
+        <call-service service-name="getRateAmount" in-map-name="getRate">
+            <result-to-result result-name="rateAmount"/>
+        </call-service>
     </simple-method>
     
     <!-- subroutines -->
@@ -383,5 +388,5 @@
         </if>
         <check-errors/>
     </simple-method>
-    
+
 </simple-methods>

Modified: ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml?rev=728894&r1=728893&r2=728894&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml (original)
+++ ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml Mon Dec 22 23:26:55 2008
@@ -1163,7 +1163,8 @@
             </iterate>
         </if-not-empty>
         <if-not-empty field="parameters.duplicateWorkEffortAssignmentRates">
-            <find-by-and entity-name="WorkEffortAssignmentRate" map-name="workEffortFindContext" list-name="foundValues"/>
+            <find-by-and entity-name="RateAmount" map-name="workEffortFindContext" list-name="foundValuesAll"/>
+            <filter-list-by-date list-name="foundValuesAll" to-list-name="foundValues"/>
             <iterate entry-name="foundValue" list-name="foundValues">
                 <clone-value value-name="foundValue" new-value-name="newTempValue"/>
                 <set from-field="parameters.workEffortId" field="newTempValue.workEffortId"/>
@@ -1183,7 +1184,7 @@
             <remove-by-and entity-name="WorkEffortNote" map-name="workEffortFindContext"/>
         </if-not-empty>
         <if-not-empty field="parameters.removeWorkEffortAssignmentRates">
-            <remove-by-and entity-name="WorkEffortAssignmentRate" map-name="workEffortFindContext"/>
+            <remove-by-and entity-name="RateAmount" map-name="workEffortFindContext"/>
         </if-not-empty>
     </simple-method>
     

Modified: ofbiz/trunk/applications/workeffort/servicedef/services_timesheet.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/servicedef/services_timesheet.xml?rev=728894&r1=728893&r2=728894&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/servicedef/services_timesheet.xml (original)
+++ ofbiz/trunk/applications/workeffort/servicedef/services_timesheet.xml Mon Dec 22 23:26:55 2008
@@ -147,43 +147,5 @@
         <attribute name="rateAmount" type="Double" mode="OUT" optional="true"/>
     </service>
     
-    <!-- PartyRate Services -->
-    <service name="createPartyRate" default-entity-name="PartyRate" engine="simple" auth="true"
-        location="org/ofbiz/workeffort/timesheet/RateServices.xml" invoke="createPartyRate">
-        <description>Creates PartyRate</description>
-        <auto-attributes include="pk" mode="IN" optional="false"/>
-        <auto-attributes include="nonpk" mode="IN" optional="true"/>
-        <override name="fromDate" optional="true"/>
-    </service>
-    <service name="updatePartyRate" default-entity-name="PartyRate" engine="simple" auth="true"
-        location="org/ofbiz/workeffort/timesheet/RateServices.xml" invoke="updatePartyRate">
-        <description>Updates PartyRate</description>
-        <auto-attributes include="pk" mode="IN" optional="false"/>
-        <auto-attributes include="nonpk" mode="IN" optional="true"/>
-    </service>
-    <service name="deletePartyRate" default-entity-name="PartyRate" engine="simple" auth="true"
-        location="org/ofbiz/workeffort/timesheet/RateServices.xml" invoke="deletePartyRate">
-        <description>Deletes PartyRate</description>
-        <auto-attributes include="pk" mode="IN" optional="false"/>
-    </service>
-
-    <!-- WorkEffortAssignmentRate Services -->
-    <service name="createWorkEffortAssignmentRate" default-entity-name="WorkEffortAssignmentRate" engine="simple" auth="true"
-        location="org/ofbiz/workeffort/timesheet/RateServices.xml" invoke="createWorkEffortAssignmentRate">
-        <description>Creates WorkEffortAssignmentRate</description>
-        <auto-attributes include="pk" mode="IN" optional="false"/>
-        <auto-attributes include="nonpk" mode="IN" optional="true"/>
-        <override name="fromDate" optional="true"/>
-    </service>
-    <service name="updateWorkEffortAssignmentRate" default-entity-name="WorkEffortAssignmentRate" engine="simple" auth="true"
-        location="org/ofbiz/workeffort/timesheet/RateServices.xml" invoke="updateWorkEffortAssignmentRate">
-        <description>Updates WorkEffortAssignmentRate</description>
-        <auto-attributes include="pk" mode="IN" optional="false"/>
-        <auto-attributes include="nonpk" mode="IN" optional="true"/>
-    </service>
-    <service name="deleteWorkEffortAssignmentRate" default-entity-name="WorkEffortAssignmentRate" engine="simple" auth="true"
-        location="org/ofbiz/workeffort/timesheet/RateServices.xml" invoke="deleteWorkEffortAssignmentRate">
-        <description>Deletes WorkEffortAssignmentRate</description>
-        <auto-attributes include="pk" mode="IN" optional="false"/>
-    </service>
+    <!-- WorkEffortRate Services (WorkEffortAssignmentRate Services now depreciated and replced by RateAmount services )-->
 </services>

Modified: ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/controller.xml?rev=728894&r1=728893&r2=728894&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/controller.xml Mon Dec 22 23:26:55 2008
@@ -166,24 +166,21 @@
         <response name="error" type="view" value="ListWorkEffortPartyAssigns"/>
     </request-map>
     
-    <request-map uri="EditWorkEffortAssignmentRates"><security https="true" auth="true"/><response name="success" type="view" value="EditWorkEffortAssignmentRates"/></request-map>
-    <request-map uri="createWorkEffortAssignmentRate">
+    <request-map uri="EditWorkEffortRates">
         <security https="true" auth="true"/>
-        <event type="service" invoke="createWorkEffortAssignmentRate"/>
-        <response name="success" type="view" value="EditWorkEffortAssignmentRates"/>
-        <response name="error" type="view" value="EditWorkEffortAssignmentRates"/>
+        <response name="success" type="view" value="EditWorkEffortRates"/>
     </request-map>
-    <request-map uri="updateWorkEffortAssignmentRate">
+    <request-map uri="updateWorkEffortRate">
         <security https="true" auth="true"/>
-        <event type="service" invoke="updateWorkEffortAssignmentRate"/>
-        <response name="success" type="view" value="EditWorkEffortAssignmentRates"/>
-        <response name="error" type="view" value="EditWorkEffortAssignmentRates"/>
+        <event type="service" invoke="updateRateAmount"/>
+        <response name="success" type="view" value="EditWorkEffortRates"/>
+        <response name="error" type="view" value="EditWorkEffortRates"/>
     </request-map>
-    <request-map uri="deleteWorkEffortAssignmentRate">
+    <request-map uri="deleteWorkEffortRate">
         <security https="true" auth="true"/>
-        <event type="service" invoke="deleteWorkEffortAssignmentRate"/>
-        <response name="success" type="view" value="EditWorkEffortAssignmentRates"/>
-        <response name="error" type="view" value="EditWorkEffortAssignmentRates"/>
+        <event type="service" invoke="deleteRateAmount"/>
+        <response name="success" type="view" value="EditWorkEffortRates"/>
+        <response name="error" type="view" value="EditWorkEffortRates"/>
     </request-map>
     
     <!--  WorkEffort CommunicationEvents requests -->
@@ -693,7 +690,7 @@
     <view-map name="ListWorkEffortEventReminders" type="screen" page="component://workeffort/widget/WorkEffortScreens.xml#ListWorkEffortEventReminders"/>
     <view-map name="ListWorkEffortFixedAssetAssigns" type="screen" page="component://workeffort/widget/WorkEffortScreens.xml#ListWorkEffortFixedAssetAssigns"/>
     <view-map name="ListWorkEffortPartyAssigns" type="screen" page="component://workeffort/widget/WorkEffortScreens.xml#ListWorkEffortPartyAssigns"/>
-    <view-map name="EditWorkEffortAssignmentRates" type="screen" page="component://workeffort/widget/WorkEffortScreens.xml#EditWorkEffortAssignmentRates"/>
+    <view-map name="EditWorkEffortRates" type="screen" page="component://workeffort/widget/WorkEffortScreens.xml#EditWorkEffortRates"/>
     <view-map name="ListWorkEffortCommEvents" type="screen" page="component://workeffort/widget/WorkEffortScreens.xml#ListWorkEffortCommEvents"/>
     <view-map name="ListWorkEffortShopLists" type="screen" page="component://workeffort/widget/WorkEffortScreens.xml#ListWorkEffortShopLists"/>
     

Modified: ofbiz/trunk/applications/workeffort/widget/WorkEffortForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/widget/WorkEffortForms.xml?rev=728894&r1=728893&r2=728894&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/widget/WorkEffortForms.xml (original)
+++ ofbiz/trunk/applications/workeffort/widget/WorkEffortForms.xml Mon Dec 22 23:26:55 2008
@@ -704,37 +704,32 @@
         <field name="datetimeEnded" title="${uiLabelMap.CommonFinishDate}"><display/></field>
     </form>
 
-    <!-- WorkEffortAssignmentRate -->
-    <form name="ListWorkEffortAssignmentRates" type="list" list-name="workEffortAssignmentRates" target="updateWorkEffortAssignmentRate"
+    <!-- WorkEffortRate -->
+    <form name="ListWorkEffortRates" type="list" list-name="workEffortRates" target="deleteWorkEffortRate"
         odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
         <actions>
-            <entity-condition entity-name="WorkEffortAssignmentRate">
+            <entity-condition entity-name="RateAmount" filter-by-date="true">
                 <condition-expr field-name="workEffortId" env-name="workEffortId"/>
-                <order-by field-name="partyId"/>
                 <order-by field-name="rateTypeId"/>
-                <order-by field-name="-fromDate"/>
+                <order-by field-name="periodTypeId"/>
+                <order-by field-name="rateCurrencyUomId"/>
             </entity-condition>
         </actions>
-        <auto-fields-service service-name="updateWorkEffortAssignmentRate"/>
-        
         <field name="workEffortId"><hidden/></field>
+        <field name="fromDate"><hidden/></field>
+        <field name="rateCurrencyUomId"><hidden/></field>
         <field name="rateTypeId" title="${uiLabelMap.TimesheetRateType}"><display-entity entity-name="RateType"/></field>
-        <field name="partyId" title="${uiLabelMap.PartyParty}">
-            <display-entity description="${firstName} ${lastName} ${groupName} [${partyId}]" entity-name="PartyNameView"/>
-        </field>
-        <field name="fromDate"><display/></field>
-        <field name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit button-type="button"/></field>
-        
-        <field name="deleteLink" title="${uiLabelMap.CommonEmptyHeader}" widget-style="buttontext">
-            <hyperlink target="deleteWorkEffortAssignmentRate?workEffortId=${workEffortId}&amp;rateTypeId=${rateTypeId}&amp;partyId=${partyId}&amp;fromDate=${fromDate}" description="${uiLabelMap.CommonDelete}" also-hidden="false"/>
-        </field>
+        <field name="rateAmount"><display type="currency" currency="${rateCurrencyUomId}"/></field>
+        <field name="periodTypeId"><display-entity entity-name="PeriodType" description="${description}"/></field>
+        <field name="deleteButton" widget-style="smallSubmit"><submit /></field>
     </form>
-    <form name="AddWorkEffortAssignmentRate" type="single" target="createWorkEffortAssignmentRate" title=""
+    <form name="AddWorkEffortRate" type="single" target="updateWorkEffortRate" title=""
         header-row-style="header-row" default-table-style="basic-table">
-        <auto-fields-service service-name="createWorkEffortAssignmentRate"/>
-        
+        <actions>
+            <property-to-field field="defaultCurrencyUomId" resource="general" property="currency.uom.id.default" default="USD"/>
+            <set field="periodTypeId" value="RATE_HOUR"/>
+        </actions>
         <field name="workEffortId"><hidden/></field>
-        <field name="partyId" title="${uiLabelMap.PartyParty}"><lookup target-form-name="LookupPartyName" default-value="${timesheet.partyId}"/></field>
         <field name="rateTypeId" title="${uiLabelMap.TimesheetRateType}">
             <drop-down no-current-selected-key="STANDARD">
                 <entity-options entity-name="RateType" description="${description}">
@@ -742,6 +737,23 @@
                 </entity-options>
             </drop-down>
         </field>
+        <field name="periodTypeId" position="2">
+            <drop-down>
+                <entity-options entity-name="PeriodType" description="${description}">
+                    <entity-constraint name="periodTypeId" operator="like" value="RATE_%"/>
+                    <entity-order-by field-name="description"/>
+                </entity-options>
+            </drop-down>
+        </field>
+        <field name="rateAmount"  tooltip="override Default Rate amount"><text/></field>
+        <field name="rateCurrencyUomId" position="2">
+            <drop-down allow-empty="true" no-current-selected-key="${defaultCurrencyUomId}">
+                <entity-options key-field-name="uomId" description="${abbreviation} - ${description}" entity-name="Uom">
+                    <entity-constraint name="uomTypeId" operator="equals" value="CURRENCY_MEASURE"/>
+                    <entity-order-by field-name="abbreviation"/>
+                </entity-options>
+            </drop-down>
+        </field>
         <field name="submitButton" title="${uiLabelMap.CommonAdd}" widget-style="smallSubmit"><submit button-type="button"/></field>
     </form>
 
@@ -757,8 +769,6 @@
                 <order-by field-name="-fromDate"/>
             </entity-condition>
         </actions>
-        <auto-fields-service service-name="updateTimeEntry"/>
-        
         <field name="timeEntryId"><hidden/></field>
         <field name="timesheetId">
             <lookup size="10" target-form-name="LookupTimesheet">

Modified: ofbiz/trunk/applications/workeffort/widget/WorkEffortMenus.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/widget/WorkEffortMenus.xml?rev=728894&r1=728893&r2=728894&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/widget/WorkEffortMenus.xml (original)
+++ ofbiz/trunk/applications/workeffort/widget/WorkEffortMenus.xml Mon Dec 22 23:26:55 2008
@@ -53,8 +53,8 @@
         <menu-item name="WorkEffortPartyAssigns" title="${uiLabelMap.WorkEffortParties}">
             <link target="ListWorkEffortPartyAssigns?workEffortId=${workEffortId}"/>
         </menu-item>
-        <menu-item name="WorkEffortAssignmentRates" title="${uiLabelMap.TimesheetRates}">
-            <link target="EditWorkEffortAssignmentRates?workEffortId=${workEffortId}"/>
+        <menu-item name="WorkEffortRates" title="${uiLabelMap.TimesheetRates}">
+            <link target="EditWorkEffortRates?workEffortId=${workEffortId}"/>
         </menu-item>
         <menu-item name="WorkEffortCommEvents" title="${uiLabelMap.WorkEffortCommEvents}">
             <link target="ListWorkEffortCommEvents?workEffortId=${workEffortId}"/>

Modified: ofbiz/trunk/applications/workeffort/widget/WorkEffortScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/widget/WorkEffortScreens.xml?rev=728894&r1=728893&r2=728894&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/widget/WorkEffortScreens.xml (original)
+++ ofbiz/trunk/applications/workeffort/widget/WorkEffortScreens.xml Mon Dec 22 23:26:55 2008
@@ -474,11 +474,11 @@
         </section>
     </screen>
 
-    <screen name="EditWorkEffortAssignmentRates">
+    <screen name="EditWorkEffortRates">
         <section>
             <actions>
                 <set field="titleProperty" value="PageTitleListWorkEffortAssignmentRates"/>
-                <set field="tabButtonItem" value="WorkEffortAssignmentRates"/>
+                <set field="tabButtonItem" value="WorkEffortRates"/>
                 <set field="labelTitleProperty" value="PageTitleListWorkEffortAssignmentRates"/>
                 
                 <set field="workEffortId" from-field="parameters.workEffortId"/>
@@ -486,10 +486,10 @@
             <widgets>
                 <decorator-screen name="CommonWorkEffortDecorator" location="${parameters.mainDecoratorLocation}">
                     <decorator-section name="body">
-                        <screenlet id="AddWorkEffortAssignmentRatesPanel" title="${uiLabelMap.PageTitleAddWorkEffortAssignmentRate}" collapsible="true">
-                            <include-form name="AddWorkEffortAssignmentRate" location="component://workeffort/widget/WorkEffortForms.xml"/>
+                        <screenlet id="AddWorkEffortRatesPanel" title="${uiLabelMap.PageTitleAddWorkEffortAssignmentRate}" collapsible="true">
+                            <include-form name="AddWorkEffortRate" location="component://workeffort/widget/WorkEffortForms.xml"/>
                         </screenlet>
-                        <include-form name="ListWorkEffortAssignmentRates" location="component://workeffort/widget/WorkEffortForms.xml"/>
+                        <include-form name="ListWorkEffortRates" location="component://workeffort/widget/WorkEffortForms.xml"/>
                     </decorator-section>
                 </decorator-screen>
             </widgets>

Modified: ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml?rev=728894&r1=728893&r2=728894&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml Mon Dec 22 23:26:55 2008
@@ -1218,15 +1218,12 @@
             <remove-by-and entity-name="InvoiceItem" map-name="removeItems"/>
             <set field="notFirst" value="Y"/><!-- do not create, only add -->
         </if-compare>
-        <if-empty field="parameters.thruDate">
-            <set field="parameters.thruDate" value="9999-12-31 00:00:00.000" type="Timestamp"/>
-        </if-empty>
         <entity-condition entity-name="ProjectPhaseTaskAndTimeEntryTimeSheet" list-name="tasks">
             <condition-list combine="and">
                 <condition-expr field-name="projectId" operator="equals" env-name="parameters.projectId"/>
-                <condition-expr field-name="invoiceId" operator="equals" env-name="null"/>
+                <condition-expr field-name="invoiceId" operator="equals" env-name="nullField"/>
                 <condition-expr field-name="timesheetStatusId" operator="equals" value="TIMESHEET_COMPLETED"/>
-                <condition-expr field-name="fromDate" operator="less" env-name="parameters.thruDate"/>
+                <condition-expr field-name="fromDate" operator="less" env-name="parameters.thruDate" ignore-if-empty="true"/>
             </condition-list>
             <order-by field-name="workEffortId"/>
         </entity-condition>

Modified: ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/ProjectBilling.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/ProjectBilling.groovy?rev=728894&r1=728893&r2=728894&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/ProjectBilling.groovy (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/ProjectBilling.groovy Mon Dec 22 23:26:55 2008
@@ -20,21 +20,28 @@
   
 import org.ofbiz.entity.*;
 import org.ofbiz.base.util.*;
+import org.ofbiz.entity.*;
+import org.ofbiz.entity.condition.*;
+import org.ofbiz.entity.util.*;
 
 projectId = parameters.projectId;
-List entries = delegator.findByAnd("ProjectAndPhaseAndTask", ["projectId" : projectId ], ["lastModifiedDate DESC"]);
-for(ind = 0; ind < entries.size(); ind++) {
- entryItems = entries[ind].getRelated("TimeEntry");
- if (entryItems && entryItems[0].invoiceId != null) {
- invoice = delegator.findByPrimaryKey("Invoice", ["invoiceId" : entryItems[0].invoiceId]);
- if (invoice.getString("statusId").equals("INVOICE_IN_PROCESS")) {
- context.partyIdFrom = invoice.partyIdFrom;
- context.partyId = invoice.partyId;
- context.invoiceId = entryItems[0].invoiceId;
- }
- break;
+entryExprs =
+    EntityCondition.makeCondition([
+        EntityCondition.makeCondition("projectId", EntityOperator.EQUALS, projectId),
+        EntityCondition.makeCondition("invoiceId", EntityOperator.NOT_EQUAL, null),
+        ], EntityOperator.AND);
+orderBy = ["-fromDate"];
+// check if latest invoice generated is still in process so allow re-generation to correct errors
+entryIterator = delegator.find("ProjectPhaseTaskAndTimeEntryTimeSheet", entryExprs, null, null, orderBy, null);
+while (entryItem = entryIterator.next()) {
+ invoice = entryItem.getRelatedOne("Invoice");
+ if (invoice.getString("statusId").equals("INVOICE_IN_PROCESS")) {
+ context.partyIdFrom = invoice.partyIdFrom;
+ context.partyId = invoice.partyId;
+ context.invoiceId = invoice.invoiceId;
+    break;
+    }
  }
-}
-
+entryIterator.close();
 //start of this month
-context.thruDate = UtilDateTime.getMonthStart(UtilDateTime.nowTimestamp());
\ No newline at end of file
+context.thruDate = UtilDateTime.getMonthStart(UtilDateTime.nowTimestamp());

Modified: ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/hoursNotYetBilled.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/hoursNotYetBilled.bsh?rev=728894&r1=728893&r2=728894&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/hoursNotYetBilled.bsh (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/hoursNotYetBilled.bsh Mon Dec 22 23:26:55 2008
@@ -1,71 +0,0 @@
-/*
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-  
-import java.util.*;
-import java.lang.*;
-import java.util.Iterator;
-import javolution.util.FastMap;
-import java.math.BigDecimal;
-
-import org.ofbiz.entity.*;
-import org.ofbiz.base.util.*;
-import org.ofbiz.base.util.UtilMisc;
-import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.entity.condition.EntityConditionList;
-import org.ofbiz.entity.condition.EntityExpr;
-import org.ofbiz.entity.condition.EntityOperator;
-
-
-import org.ofbiz.entity.util.*;
-import org.ofbiz.base.util.*;
-import org.ofbiz.entity.condition.*;
-import java.sql.Timestamp;
-
-projectId = parameters.get("projectId");
-
-// get all tasks from the project, get related time entries and checked if not invoiced
-List entryList = new LinkedList();
-entries = delegator.findByAnd("ProjectAndPhaseAndTask", UtilMisc.toMap("projectId", projectId), UtilMisc.toList("phaseName", "workEffortName"));
-t = entries.iterator();
-while (t.hasNext()) {
- entry = t.next();
- entryItems = entry.getRelated("TimeEntry");
- e = entryItems.iterator();
- while (e.hasNext()) {
- entryItem = e.next();
- if (entryItem.getString("invoiceId") == null) {
- timesheet = entryItem.getRelatedOne("Timesheet");
- if (timesheet.getString("statusId").equals("TIMESHEET_COMPLETED")) {
- Map all = FastMap.newInstance();
- all.put("workEffortName", entry.getString("workEffortName"));
- all.put("workEffortId", entry.getString("workEffortId"));
- all.put("phaseName", entry.getString("phaseName"));
- all.put("phaseId", entry.getString("phaseId"));
- all.put("partyId", timesheet.getString("partyId"));
- all.put("hours", entryItem.getDouble("hours"));
- all.put("fromDate", entryItem.getTimestamp("fromDate"));
- all.put("timesheetId", timesheet.getString("timesheetId"));
- all.put("rateTypeId", entryItem.getString("rateTypeId"));
- entryList.add(all);
- }
- }
- }
-}
-context.put("entryList", entryList);

Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml?rev=728894&r1=728893&r2=728894&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml Mon Dec 22 23:26:55 2008
@@ -83,7 +83,15 @@
     <form name="hoursNotYetBilled" type="list" list-name="entryList"
         odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
         <actions>
-            <script location="component://projectmgr/webapp/projectmgr/WEB-INF/actions/hoursNotYetBilled.bsh"/>
+            <entity-condition entity-name="ProjectPhaseTaskAndTimeEntryTimeSheet" list-name="entryList">
+                <condition-list combine="and">
+                    <condition-expr field-name="projectId" operator="equals" env-name="parameters.projectId"/>
+                    <condition-expr field-name="invoiceId" operator="equals" env-name="nullField"/>
+                    <condition-expr field-name="timesheetStatusId" operator="equals" value="TIMESHEET_COMPLETED"/>
+                    <condition-expr field-name="fromDate" operator="less" env-name="parameters.thruDate" ignore-if-empty="true"/>
+                </condition-list>
+                <order-by field-name="-fromDate"/>
+            </entity-condition>
         </actions>
         <field name="workEffortName"><display/></field>
         <field name="phaseName"><display/></field>
@@ -553,7 +561,7 @@
         <field name="partyId" title="${uiLabelMap.WorkEffortTimeBillToParty}"><lookup target-form-name="LookupPartyName" default-value="${timesheet.clientPartyId}"/></field>
         <field name="thruDate" title="${uiLabelMap.CommonThruDate}"><date-time type="timestamp"/></field>
         <field name="invoiceId"><hidden/></field>
-        <field name="reCreate" position="1" title="re-create Invoice: ${context.invoiceId}" use-when="context.get(&quot;invoiceId&quot;)!=null">
+        <field name="reCreate" position="1" title="re-create Invoice: ${invoiceId}" use-when="context.get(&quot;invoiceId&quot;)!=null">
          <drop-down no-current-selected-key="N">
          <option key="Y" description="Yes"/>
          <option key="N" description="No"/>

Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/forms/TimeSheetForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/forms/TimeSheetForms.xml?rev=728894&r1=728893&r2=728894&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/widget/forms/TimeSheetForms.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/widget/forms/TimeSheetForms.xml Mon Dec 22 23:26:55 2008
@@ -83,7 +83,7 @@
     <form name="FindTimeSheet" target="FindTimeSheet" title="" type="single"
         header-row-style="header-row" default-table-style="basic-table">
         <field name="noConditionFind"><hidden value="Y"/></field>
-        <field name="newTimesheetId" parameter-name="timesheetId"><text-find default-option="contains" ignore-case="true"/></field>
+        <field name="timesheetId"><text-find default-option="contains" ignore-case="true"/></field>
         <field name="comments"><text-find default-option="contains" ignore-case="true"/></field>
         <field name="partyId" title="${uiLabelMap.PartyParty}">
             <drop-down allow-empty="true">