svn commit: r702371 - in /ofbiz/trunk/specialpurpose/projectmgr: script/org/ofbiz/project/ProjectServices.xml servicedef/services.xml webapp/projectmgr/WEB-INF/actions/ProjectBilling.groovy widget/ProjectScreens.xml widget/forms/ProjectForms.xml

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

svn commit: r702371 - in /ofbiz/trunk/specialpurpose/projectmgr: script/org/ofbiz/project/ProjectServices.xml servicedef/services.xml webapp/projectmgr/WEB-INF/actions/ProjectBilling.groovy widget/ProjectScreens.xml widget/forms/ProjectForms.xml

hansbak-2
Author: hansbak
Date: Tue Oct  7 00:35:07 2008
New Revision: 702371

URL: http://svn.apache.org/viewvc?rev=702371&view=rev
Log:
improved (re)creation of invoices from project, and added an optional thruDate parameter

Added:
    ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/ProjectBilling.groovy   (with props)
Modified:
    ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml
    ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml
    ofbiz/trunk/specialpurpose/projectmgr/widget/ProjectScreens.xml
    ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml

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=702371&r1=702370&r2=702371&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml Tue Oct  7 00:35:07 2008
@@ -968,7 +968,6 @@
     </simple-method>
 
     <simple-method method-name="addProjectTimeToNewInvoice" short-description="add all reported time on all completed timesheets from all workefforts for a project">
-
  <!-- recreate the invoice if still in preparation in order to correct errors. -->
         <if-compare operator="equals" value="Y" field="parameters.reCreate">
         <entity-one entity-name="Invoice" value-name="invoice"/>
@@ -977,7 +976,7 @@
              <check-errors/>
          </if-empty>
             <if-compare field="invoice.statusId" operator="not-equals" value="INVOICE_IN_PROCESS">
-            <add-error><fail-message message="Could not find invoice with ID [${parameters.invoiceId}], not adding Timesheet Entries to it."/></add-error>
+            <add-error><fail-message message="Invoice with ID [${parameters.invoiceId}], has the wrong status, not adding Timesheet Entries to it."/></add-error>
              <check-errors/>
  </if-compare>
  <entity-and list-name="entries" entity-name="TimeEntry">
@@ -992,7 +991,6 @@
          <remove-by-and entity-name="InvoiceItem" map-name="removeItems"/>
          <set field="notFirst" value="Y"/><!-- do not create, only add -->
         </if-compare>
-        <log level="always" message="==============invoice items deleted"/>
         <entity-and entity-name="ProjectAndPhaseAndTask" list-name="tasks">
             <field-map field-name="projectId" env-name="parameters.projectId"/>
         </entity-and>
@@ -1002,6 +1000,7 @@
                 <set-service-fields service-name="addWorkEffortTimeToNewInvoice" map-name="parameters" to-map-name="addTaskToNewInvoice"/>
                 <set field="addTaskToNewInvoice.workEffortId" from-field="task.workEffortId"/>
                 <set field="addTaskToNewInvoice.combineInvoiceItem" value="Y"/>
+                <set field="addTaskToNewInvoice.thrudate" from-field="parameters.thruDate"/>
             <call-service service-name="addWorkEffortTimeToNewInvoice" in-map-name="addTaskToNewInvoice">
                 <result-to-field result-name="invoiceId" field-name="parameters.invoiceId"/>
                 </call-service>
@@ -1013,7 +1012,6 @@
                 <set field="addTaskToInvoice.combineInvoiceItem" value="Y"/>
                     <set field="addTaskToInvoice.invoiceId" from-field="parameters.invoiceId"/>
                     <set field="addTaskToInvoice.workEffortId" from-field="task.workEffortId"/>
-        <log level="always" message="==============add workeffort iwth data ${addTaskToInvoice}"/>
                     <call-service service-name="addWorkEffortTimeToInvoice" in-map-name="addTaskToInvoice"/>
                 </else>
             </if-empty>

Modified: ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml?rev=702371&r1=702370&r2=702371&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml Tue Oct  7 00:35:07 2008
@@ -233,6 +233,7 @@
         <attribute name="projectId" type="String" mode="IN" optional="false"/>
         <attribute name="partyIdFrom" type="String" mode="IN" optional="true"/>
         <attribute name="partyId" type="String" mode="IN" optional="true"/>
+        <attribute name="thruDate" type="Timestamp" mode="IN" optional="true"/>
         <attribute name="invoiceId" type="String" mode="INOUT" optional="true"/>
         <attribute name="reCreate" type="String" mode="IN" optional="true"/>
     </service>

Added: 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=702371&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/ProjectBilling.groovy (added)
+++ ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/ProjectBilling.groovy Tue Oct  7 00:35:07 2008
@@ -0,0 +1,40 @@
+/*
+/*
+ * 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 org.ofbiz.entity.*;
+import org.ofbiz.base.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;
+ }
+}
+
+//start of this month
+context.thruDate = UtilDateTime.getMonthStart(UtilDateTime.nowTimestamp());
\ No newline at end of file

Propchange: ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/ProjectBilling.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/ProjectBilling.groovy
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/ProjectBilling.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/ProjectScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/ProjectScreens.xml?rev=702371&r1=702370&r2=702371&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/widget/ProjectScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/widget/ProjectScreens.xml Tue Oct  7 00:35:07 2008
@@ -96,6 +96,7 @@
                 <set field="tabButtonItem" value="billing"/>                
                 <set field="labelTitleProperty" value="PageTitleProjectBilling"/>
                 <set field="projectId" from-field="parameters.projectId" default-value="${parameters.workEffortId}"/>
+                <script location="component://projectmgr/webapp/projectmgr/WEB-INF/actions/ProjectBilling.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="CommonProjectDecorator" location="${parameters.mainDecoratorLocation}">

Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml?rev=702371&r1=702370&r2=702371&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml Tue Oct  7 00:35:07 2008
@@ -521,13 +521,14 @@
         <field name="projectId"><hidden value="${parameters.projectId}"/></field>
         <field name="partyIdFrom" title="${uiLabelMap.WorkEffortTimeBillFromParty}"><lookup target-form-name="LookupPartyName"/></field>
         <field name="partyId" title="${uiLabelMap.WorkEffortTimeBillToParty}"><lookup target-form-name="LookupPartyName" default-value="${timesheet.clientPartyId}"/></field>
-        <field name="reCreate">
+        <field name="thruDate"><text/></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">
          <drop-down no-current-selected-key="N">
          <option key="Y" description="Yes"/>
          <option key="N" description="No"/>
          </drop-down>
        </field>
-        <field name="invoiceId" position="2"><text/></field>
         <field name="submitButton" title="${uiLabelMap.PageTitleAddProjectTimeToNewInvoice}" widget-style="smallSubmit"><submit button-type="button"/></field>
     </form>
 </forms>
\ No newline at end of file