Author: hansbak
Date: Sun Aug 31 07:08:28 2008
New Revision: 690698

URL: http://svn.apache.org/viewvc?rev=690698&view=rev
Log:
added new function to the projectmanager: create an invoice from all not yet 
invoiced project items

Modified:
    ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.xml
    
ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml
    ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml
    
ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/hoursNotYetBilled.bsh
    
ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml
    ofbiz/trunk/specialpurpose/projectmgr/widget/ProjectScreens.xml
    ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml

Modified: ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.xml?rev=690698&r1=690697&r2=690698&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.xml 
(original)
+++ ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.xml Sun Aug 
31 07:08:28 2008
@@ -28,6 +28,9 @@
         <value xml:lang="th">สถานะเป็น 
'เสร็จสมบูรณ์'</value>
         <value xml:lang="zh">置状态为完成</value>
     </property>
+    <property key="PageTitleAddProjectTimeToNewInvoice">
+        <value xml:lang="en">Add all reported/approved task time to a new 
invoice</value>
+    </property>
     <property key="PageTitleAddATimesheet">
         <value xml:lang="en">Add a new weekly Timesheet</value>
         <value xml:lang="fr">Ajouter une nouvelle feuille de présence 
hebdomadaire</value>

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=690698&r1=690697&r2=690698&view=diff
==============================================================================
--- 
ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml
 (original)
+++ 
ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml
 Sun Aug 31 07:08:28 2008
@@ -962,5 +962,29 @@
         <call-simple-method method-name="assignPartyToWorkEffort" 
xml-resource="component://workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml"/>
         <call-simple-method method-name="createTimeEntry" 
xml-resource="component://workeffort/script/org/ofbiz/workeffort/timesheet/TimesheetServices.xml"/>
     </simple-method>
-    
+
+    <simple-method method-name="addProjectTimeToNewInvoice" 
short-description="add all reported time on all completed timesheets from all 
workefforts for a project">
+        <entity-and entity-name="ProjectAndPhaseAndTask" list-name="tasks">
+            <field-map field-name="projectId" env-name="parameters.projectId"/>
+        </entity-and>
+        <iterate entry-name="task" list-name="tasks">
+            <if-empty field="notFirst">
+                <!-- first time so create invoice -->
+                <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"/>
+                <call-service service-name="addWorkEffortTimeToNewInvoice" 
in-map-name="addtaskToNewInvoice">
+                    <result-to-field result-name="invoiceId" 
field-name="addTaskToInvoice.invoiceId"/>
+                </call-service>
+                <set field="addTaskToInvoice.combineInvoiceItem" value="Y"/>
+                <set field="notFirst" value="Y"/>
+                <field-to-result field-name="addTaskToInvoice.invoiceId" 
result-name="invoiceId"/>
+                <else>
+                    <!-- add to created invoice -->
+                    <set field="addTaskToInvoice.workEffortId" 
from-field="task.workEffortId"/>
+                    <call-service service-name="addWorkEffortTimeToInvoice" 
in-map-name="addTaskToInvoice"/>
+                </else>
+            </if-empty>
+        </iterate>
+    </simple-method>    
 </simple-methods>

Modified: ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml?rev=690698&r1=690697&r2=690698&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml Sun Aug 31 
07:08:28 2008
@@ -223,5 +223,13 @@
         <attribute name="statusId" type="String" mode="IN"/>
         <attribute name="fromDate" type="Timestamp" mode="INOUT" 
optional="true"/>
     </service>
+    <service name="addProjectTimeToNewInvoice" engine="simple" auth="true"
+        location="org/ofbiz/project/ProjectServices.xml" 
invoke="addProjectTimeToNewInvoice">
+        <description>Add Project Time to a new Invoice</description>
+        <attribute name="projectId" type="String" mode="IN" optional="false"/>
+        <attribute name="partyIdFrom" type="String" mode="IN" 
optional="false"/>
+        <attribute name="partyId" type="String" mode="IN" optional="false"/>
+        <attribute name="invoiceId" type="String" mode="OUT" optional="true"/>
+    </service>
 
 </services>

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=690698&r1=690697&r2=690698&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
 Sun Aug 31 07:08:28 2008
@@ -61,6 +61,8 @@
                                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);
                        }
                }

Modified: 
ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml?rev=690698&r1=690697&r2=690698&view=diff
==============================================================================
--- 
ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml 
(original)
+++ 
ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml 
Sun Aug 31 07:08:28 2008
@@ -65,6 +65,12 @@
         <security https="true" auth="true"/>
         <response name="success" type="view" value="projectBilling"/>
     </request-map>
+    <request-map uri="addProjectTimeToNewInvoice">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="addProjectTimeToNewInvoice"/>
+        <response name="success" type="view" value="projectBilling"/>
+        <response name="error" type="view" value="projectBilling"/>
+    </request-map>
     <request-map uri="createProject">
         <security https="true" auth="true"/>
         <event type="service" invoke="createProject"/>

Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/ProjectScreens.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/ProjectScreens.xml?rev=690698&r1=690697&r2=690698&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/widget/ProjectScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/widget/ProjectScreens.xml Sun Aug 31 
07:08:28 2008
@@ -80,21 +80,10 @@
             </actions>
             <widgets>
                 <decorator-screen name="CommonProjectDecorator" 
location="${parameters.mainDecoratorLocation}">
-                    <decorator-section name="body">  
-                        <container style="screenlet">
-                            <container style="screenlet-title-bar">
-                                <container style="h3">
-                                    <label 
text="${uiLabelMap.PageTitleEditProject} ${uiLabelMap.CommonInformation}"/>
-                                </container>
-                            </container>
-                            <container style="screenlet-body">
-                                <section>
-                                    <widgets>    
-                                        <include-form name="EditProject" 
location="component://projectmgr/widget/forms/ProjectForms.xml"/>
-                                    </widgets>
-                                </section>
-                            </container>
-                        </container>
+                    <decorator-section name="body">
+                    <screenlet title="${uiLabelMap.PageTitleEditProject} 
${uiLabelMap.CommonInformation}" >
+                        <include-form name="EditProject" 
location="component://projectmgr/widget/forms/ProjectForms.xml"/>
+                    </screenlet>  
                     </decorator-section>
                 </decorator-screen>
             </widgets>
@@ -110,21 +99,13 @@
             </actions>
             <widgets>
                 <decorator-screen name="CommonProjectDecorator" 
location="${parameters.mainDecoratorLocation}">
-                    <decorator-section name="body">  
-                        <container style="screenlet">
-                            <container style="screenlet-title-bar">
-                                <container style="h3">
-                                    <label 
text="${uiLabelMap.PageTitleHoursNotYetBilled} 
${uiLabelMap.CommonInformation}"/>
-                                </container>
-                            </container>
-                            <container style="screenlet-body">
-                                <section>
-                                    <widgets>    
-                                        <include-form name="hoursNotYetBilled" 
location="component://projectmgr/widget/forms/ProjectForms.xml"/>
-                                    </widgets>
-                                </section>
-                            </container>
-                        </container>
+                    <decorator-section name="body" >
+                        <screenlet 
title="${uiLabelMap.PageTitleHoursNotYetBilled} 
${uiLabelMap.CommonInformation}" navigation-form-name="hoursNotYetBilled">
+                            <include-form name="hoursNotYetBilled" 
location="component://projectmgr/widget/forms/ProjectForms.xml"/>
+                        </screenlet>  
+                        <screenlet 
title="${uiLabelMap.PageTitleAddProjectTimeToNewInvoice}">
+                            <include-form name="AddProjectTimeToNewInvoice" 
location="component://projectmgr/widget/forms/ProjectForms.xml"/>
+                        </screenlet>
                     </decorator-section>
                 </decorator-screen>
             </widgets>

Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml?rev=690698&r1=690697&r2=690698&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml 
(original)
+++ ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml Sun Aug 
31 07:08:28 2008
@@ -86,8 +86,10 @@
         </actions>
         <field name="workEffortName"><display/></field>
         <field name="phaseName"><display/></field>
+        <field name="timesheetId"><hyperlink description="${timesheetId}" 
target="Timesheet?timesheetId=${timesheetId}"/></field>
         <field name="hours"><display/></field>
         <field name="partyId"><display-entity entity-name="PartyNameView" 
description="${firstName} ${middleName} ${lastName}"/></field>
+        <field name="rateTypeId"><display-entity entity-name="RateType" 
description="${description}"/></field>
         <field name="fromDate"><display type="date"/></field>
     </form>
     <form name="ListProjects" type="list" list-name="listIt" 
paginate-target="FindProject"
@@ -515,4 +517,11 @@
         <field entry-name="test" name="thruDate"><date-time 
type="date"/></field>
         <field name="submitButton" title="${uiLabelMap.CommonAdd}" 
widget-style="smallSubmit"><submit button-type="button"/></field>
     </form>
+    <form name="AddProjectTimeToNewInvoice" 
target="addProjectTimeToNewInvoice" title="" type="single">
+        <field name="combineInvoiceItem"><hidden value="Y"/></field>
+        <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="submitButton" 
title="${uiLabelMap.PageTitleAddProjectTimeToNewInvoice}" 
widget-style="smallSubmit"><submit button-type="button"/></field>
+    </form>
 </forms>
\ No newline at end of file


Reply via email to