Author: hansbak
Date: Mon Jul  6 04:34:40 2009
New Revision: 791378

URL: http://svn.apache.org/viewvc?rev=791378&view=rev
Log:
only print the nonbilled hours if the project is billable

Added:
    
ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/ProjectIsBillable.groovy
   (with props)
Modified:
    ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml

Added: 
ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/ProjectIsBillable.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/ProjectIsBillable.groovy?rev=791378&view=auto
==============================================================================
--- 
ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/ProjectIsBillable.groovy
 (added)
+++ 
ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/ProjectIsBillable.groovy
 Mon Jul  6 04:34:40 2009
@@ -0,0 +1,39 @@
+/*
+ * 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.util.EntityUtil;
+ 
+projectMembers = delegator.findByAnd("WorkEffortPartyAssignment", 
["workEffortId" : context.projectId]);
+projectMembers = EntityUtil.filterByDate(projectMembers);
+
+toPartyId = null;
+fromPartyId = null;
+projectMembers.each {member ->
+       if (member.roleTypeId.equals("INTERNAL_ORGANIZATIO")) {
+               fromPartyId = member.partyId;
+       }
+       if (member.roleTypeId.equals("CLIENT_BILLING")) {
+               toPartyId = member.partyId;
+       }
+       if (fromPartyId && toPartyId && fromPartyId.equals(toPartyId)) {
+               context.isBillable = false;
+       } else {
+               context.isBillable = true;
+       }
+}

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

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

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

Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml?rev=791378&r1=791377&r2=791378&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml 
(original)
+++ ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml Mon Jul 
 6 04:34:40 2009
@@ -166,6 +166,9 @@
         <actions>
             <script 
location="component://projectmgr/webapp/projectmgr/WEB-INF/actions/ListCurrentProjects.groovy"/>
         </actions>
+        <row-actions>
+            <script 
location="component://projectmgr/webapp/projectmgr/WEB-INF/actions/ProjectIsBillable.groovy"/>
+        </row-actions>
         <field name="projectName" title="${uiLabelMap.ProjectMgrProjectName}" 
widget-style="buttontext">
             <hyperlink description="${projectName}" target="projectView">
                 <parameter param-name="projectId"/>
@@ -178,7 +181,7 @@
         <field name="actualCompletionDate" 
title="${uiLabelMap.FormFieldTitle_actualCompletionDate}"><display 
type="date"/></field>
         <field name="plannedHours" 
title="${uiLabelMap.ProjectMgrPlannedHours}"><display/></field>
         <field name="actualHours" 
title="${uiLabelMap.ProjectMgrActualHours}"><display/></field>
-        <field name="actualNonBilledTotalHours" 
title="${uiLabelMap.ProjectMgrNonBilledActualHours}"><display/></field>
+        <field name="actualNonBilledTotalHours" 
title="${uiLabelMap.ProjectMgrNonBilledActualHours}"><display 
description="${bsh:isBillable&amp;&amp;actualNonBilledTotalHours!=void?actualNonBilledTotalHours:&quot;&quot;}"/></field>
         <field name="createdStamp" 
title="${uiLabelMap.FormFieldTitle_createdDate}"><display type="date"/></field>
     </form>
     <form name="EditSubProjects" list-name="projects" type="list" 
target="RemoveSubProject"


Reply via email to