Author: hansbak
Date: Fri Feb 22 21:52:18 2008 New Revision: 630393 URL: http://svn.apache.org/viewvc?rev=630393&view=rev Log: add list of unbilled hours to the client resource Added: ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/ListUnBilledHoursResources.bsh (with props) ofbiz/trunk/specialpurpose/projectmgr/widget/ResourceScreens.xml (with props) ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ResourceForms.xml (with props) Modified: ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrDemoData.xml ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml ofbiz/trunk/specialpurpose/projectmgr/widget/CommonScreens.xml ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml Modified: ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrDemoData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrDemoData.xml?rev=630393&r1=630392&r2=630393&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrDemoData.xml (original) +++ ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrDemoData.xml Fri Feb 22 21:52:18 2008 @@ -39,7 +39,7 @@ <!-- Demo Customer1 client for demo project 1 has access to project 1 only--> <Party partyId="DemoCustomer1" partyTypeId="PERSON" statusId="PARTY_ENABLED" /> - <Person partyId="DemoCustomer1" firstName="Sam" lastName="Customer 1" /> + <Person partyId="DemoCustomer1" firstName="ManagerP1" lastName="Customer 1" /> <UserLogin userLoginId="DemoCustomer1" partyId="DemoCustomer1"/> <PartyRole partyId="DemoCustomer1" roleTypeId="CUSTOMER"/> <PartyContactMech partyId="DemoCustomer1" contactMechId="9020" fromDate="2000-01-01 10:01:48.933" roleTypeId="CUSTOMER" /> @@ -50,7 +50,7 @@ <!-- Demo Customer2 client for demo project 2 has access to project 2 only--> <Party partyId="DemoCustomer2" partyTypeId="PERSON" statusId="PARTY_ENABLED" /> - <Person partyId="DemoCustomer2" firstName="John" lastName="Customer 2"/> + <Person partyId="DemoCustomer2" firstName="ManagerP2" lastName="Customer 2"/> <UserLogin userLoginId="DemoCustomer2" partyId="DemoCustomer2"/> <PartyRole partyId="DemoCustomer2" roleTypeId="CUSTOMER"/> <PartyContactMech partyId="DemoCustomer2" contactMechId="9020" fromDate="2000-01-01 10:01:48.933" roleTypeId="CUSTOMER" /> @@ -59,6 +59,17 @@ <PartyRole partyId="DemoCustomer2" roleTypeId="PROJECT_TEAM"/> <UserLoginAndSecurityGroup groupId="PROJECTUSER" userLoginId="DemoCustomer2" fromDate="2000-01-01 00:00:00.0"/> + <!-- Demo Customer3 billing for demo project 1 and project 2 --> + <Party partyId="DemoCustomer3" partyTypeId="PERSON" statusId="PARTY_ENABLED" /> + <Person partyId="DemoCustomer3" firstName="Billing" lastName="Customer 2"/> + <UserLogin userLoginId="DemoCustomer3" partyId="DemoCustomer3"/> + <PartyRole partyId="DemoCustomer3" roleTypeId="CUSTOMER"/> + <PartyContactMech partyId="DemoCustomer3" contactMechId="9020" fromDate="2000-01-01 10:01:48.933" roleTypeId="CUSTOMER" /> + <PartyContactMech partyId="DemoCustomer3" contactMechId="9001" fromDate="2000-01-01 10:01:48.933" roleTypeId="CUSTOMER" /> + <PartyContactMech partyId="DemoCustomer3" contactMechId="9023" fromDate="2000-01-01 10:01:48.933" roleTypeId="CUSTOMER" /> + <PartyRole partyId="DemoCustomer3" roleTypeId="PROJECT_TEAM"/> + <UserLoginAndSecurityGroup groupId="PROJECTUSER" userLoginId="DemoCustomer3" fromDate="2000-01-01 00:00:00.0"/> + <!-- make sure admin show up as a resource, he acts as a full access admin --> <PartyRole partyId="admin" roleTypeId="PROJECT_TEAM"/> @@ -75,6 +86,7 @@ <WorkEffort workEffortId="9000" workEffortTypeId="PROJECT" currentStatusId="_NA_" lastStatusUpdate="2007-12-14 15:07:52.901" scopeEnumId="WES_PUBLIC" workEffortName="Demo Project1 Cust1" revisionNumber="1"/> <WorkEffortPartyAssignment workEffortId="9000" partyId="admin" statusId="PAS_ASSIGNED" roleTypeId="PROVIDER_MANAGER" fromDate="2007-12-14 16:45:21.831"/> <WorkEffortPartyAssignment workEffortId="9000" partyId="DemoCustomer1" statusId="PAS_ASSIGNED" roleTypeId="CLIENT_MANAGER" fromDate="2007-12-14 16:45:21.831"/> + <WorkEffortPartyAssignment workEffortId="9000" partyId="DemoCustomer3" statusId="PAS_ASSIGNED" roleTypeId="CLIENT_BILLING" fromDate="2007-12-14 16:45:21.831"/> <WorkEffortPartyAssignment workEffortId="9000" partyId="DemoEmployee1" statusId="PAS_ASSIGNED" roleTypeId="PROVIDER_MANAGER" fromDate="2007-12-14 16:45:21.831"/> <WorkEffortPartyAssignment workEffortId="9000" partyId="DemoEmployee2" statusId="PAS_ASSIGNED" roleTypeId="PROVIDER_ANALYST" fromDate="2007-12-14 16:45:21.831"/> <WorkEffort workEffortId="9001" workEffortTypeId="PHASE" currentStatusId="_NA_" lastStatusUpdate="2007-12-14 16:45:14.226" workEffortParentId="9000" workEffortName="phase1" revisionNumber="1" /> @@ -97,6 +109,7 @@ <WorkEffort workEffortId="9100" workEffortTypeId="PROJECT" currentStatusId="_NA_" lastStatusUpdate="2007-12-14 15:07:52.911" scopeEnumId="WES_PUBLIC" workEffortName="Demo Project2 Cust 2" revisionNumber="1"/> <WorkEffortPartyAssignment workEffortId="9100" partyId="admin" statusId="PAS_ASSIGNED" roleTypeId="PROVIDER_MANAGER" fromDate="2007-12-14 16:45:21.831"/> <WorkEffortPartyAssignment workEffortId="9100" partyId="DemoCustomer2" statusId="PAS_ASSIGNED" roleTypeId="CLIENT_MANAGER" fromDate="2007-12-14 16:45:21.831"/> + <WorkEffortPartyAssignment workEffortId="9100" partyId="DemoCustomer3" statusId="PAS_ASSIGNED" roleTypeId="CLIENT_BILLING" fromDate="2007-12-14 16:45:21.831"/> <WorkEffortPartyAssignment workEffortId="9100" partyId="DemoEmployee1" statusId="PAS_ASSIGNED" roleTypeId="PROVIDER_MANAGER" fromDate="2007-12-14 16:45:21.831"/> <WorkEffortPartyAssignment workEffortId="9100" partyId="DemoEmployee3" statusId="PAS_ASSIGNED" roleTypeId="PROVIDER_ANALYST" fromDate="2007-12-14 16:45:21.831"/> <WorkEffort workEffortId="9101" workEffortTypeId="PHASE" currentStatusId="_NA_" lastStatusUpdate="2007-12-14 16:45:14.226" workEffortParentId="9100" workEffortName="phase1" revisionNumber="1" /> Added: ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/ListUnBilledHoursResources.bsh URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/ListUnBilledHoursResources.bsh?rev=630393&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/ListUnBilledHoursResources.bsh (added) +++ ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/ListUnBilledHoursResources.bsh Fri Feb 22 21:52:18 2008 @@ -0,0 +1,75 @@ +/* +/* + * 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 org.ofbiz.entity.*; +import org.ofbiz.entity.util.EntityUtil; +import org.ofbiz.base.util.*; +import javolution.util.FastMap; +import javolution.util.FastList; + +delegator = parameters.get("delegator"); + +// get the projects the client has the CLIENT_BILLING role. +tasks = EntityUtil.filterByDate(delegator.findByAnd("ProjectPartyAndPhaseAndTask", UtilMisc.toMap("partyId", parameters.get("partyId"), "roleTypeId", "CLIENT_BILLING"))); + +if (!UtilValidate.isEmpty(tasks)) { + List unBilledList = FastList.newInstance(); + //list all the tasks of he projects and check for registered and approved and unbilled hours + taskIterator = tasks.iterator(); + while (taskIterator.hasNext()) { + task = taskIterator.next(); + timeEntries = task.getRelated("TimeEntry"); + if (!UtilValidate.isEmpty(timeEntries)) { + teIterator = timeEntries.iterator(); + while (teIterator.hasNext()) { + timeEntry = teIterator.next(); + // check if entry already invoiced + if (timeEntry.getString("invoiceId") == null) { + timesheet = timeEntry.getRelatedOne("Timesheet"); + // check the role of his part, if party is a provider + if (!UtilValidate.isEmpty(EntityUtil.filterByDate(delegator.findByLike("WorkEffortPartyAssignment", + UtilMisc.toMap("workEffortId", timeEntry.getString("workEffortId"), + "partyId", timesheet.getString("partyId"), "roleTypeId", "PROVIDER_%"))))) { + rates = EntityUtil.filterByDate(delegator.findByAnd("PartyRate", + UtilMisc.toMap("partyId", timesheet.getString("partyId"), "rateTypeId", timeEntry.getString("rateTypeId")))); + if (UtilValidate.isEmpty(rates)) { + Debug.logError("TimeEntry has a number of hours, but no rateTypeId for this party was found: Timesheet: " + timesheet.getString("timesheetId"), "billingByCient"); + } else { + rate = rates.get(0); + unBilledMap = UtilMisc.toMap("projectId", task.getString("projectId"), + "projectName", task.getString("projectName"), + "phaseName", task.getString("phaseName"), + "taskName", task.getString("workEffortName"), + "taskId", task.getString("workEffortId"), + "hours", timeEntry.get("hours")); + unBilledMap.put("rate", rate.get("rate")); + unBilledMap.put("total", rate.get("rate") * timeEntry.get("hours")); + unBilledList.add(unBilledMap); + } + } + } + } + } + } + context.put("unBilledList", unBilledList); +} + Propchange: ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/ListUnBilledHoursResources.bsh ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/ListUnBilledHoursResources.bsh ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/ListUnBilledHoursResources.bsh ------------------------------------------------------------------------------ svn:mime-type = text/plain 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=630393&r1=630392&r2=630393&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml (original) +++ ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml Fri Feb 22 21:52:18 2008 @@ -566,6 +566,11 @@ <response name="success" type="view" value="listResourcesProject"/> <response name="error" type="view" value="listResourcesProject"/> </request-map> + <request-map uri="ListResourcesUnBilledHours"> + <security https="true" auth="true"/> + <response name="success" type="view" value="ListResourcesUnBilledHours"/> + <response name="error" type="view" value="ListResourcesUnBilledHours"/> + </request-map> <request-map uri="updaterequeststatus"> <security https="true" auth="true"/> <event type="service" invoke="updateCustRequest"/> @@ -781,6 +786,7 @@ <view-map name="FindProject" type="screen" page="component://projectmgr/widget/ProjectScreens.xml#FindProject"/> <view-map name="EditProject" type="screen" page="component://projectmgr/widget/ProjectScreens.xml#EditProject"/> <view-map name="projectBilling" type="screen" page="component://projectmgr/widget/ProjectScreens.xml#projectBilling"/> + <view-map name="ListResourcesUnBilledHours" type="screen" page="component://projectmgr/widget/ResourceScreens.xml#ListUnBilledHours"/> <view-map name="EditWorkEffort" type="screen" page="component://projectmgr/widget/ProjectScreens.xml#EditProject"/> <view-map name="ChildWorkEfforts" type="screen" page="component://projectmgr/widget/ProjectScreens.xml#ChildWorkEfforts"/> <view-map name="EditProjectAndAssoc" type="screen" page="component://projectmgr/widget/ProjectScreens.xml#EditProjectAndAssoc"/> Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/CommonScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/CommonScreens.xml?rev=630393&r1=630392&r2=630393&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/widget/CommonScreens.xml (original) +++ ofbiz/trunk/specialpurpose/projectmgr/widget/CommonScreens.xml Fri Feb 22 21:52:18 2008 @@ -395,7 +395,7 @@ <section> <condition><not><if-empty field-name="partyId"/></not></condition> <widgets> - <include-menu location="component://projectmgr/widget/Menus.xml" name="ResourcesTabBar"/> + <include-menu location="component://projectmgr/widget/Menus.xml" name="ResourceTabBar"/> <container> <section> <widgets> Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml?rev=630393&r1=630392&r2=630393&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml (original) +++ ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml Fri Feb 22 21:52:18 2008 @@ -19,7 +19,7 @@ --> <menus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-menu.xsd"> + xsi:noNamespaceSchemaLocation="../../../framework/widget/dtd/widget-menu.xsd"> <menu name="ProjectMgrAppBar" id="app-navigation" type="simple" selected-menuitem-context-field-name="headerItem" default-selected-style="selected" title="${uiLabelMap.ProjectMgrApplication}" menu-container-style="button-bar tab-bar"> <menu-item name="mytasks" title="${uiLabelMap.WorkEffortMyTasks}"><link target="MyTasks"/></menu-item> @@ -348,7 +348,7 @@ <link target="myTimeSheetStatustoComplete?timesheetId=${timesheet.timesheetId}&statusId=TIMESHEET_COMPLETED"/> </menu-item> </menu> - <menu name="ResourcesTabBar" menu-container-style="button-bar tab-bar" default-menu-item-name="edittimesheet" default-selected-style="selected"> + <menu name="ResourceTabBar" menu-container-style="button-bar tab-bar" default-menu-item-name="edittimesheet" default-selected-style="selected"> <menu-item name="ResourcesProfile" title="${uiLabelMap.PartyProfile}"> <link target="viewprofile?partyId=${partyId}"/> </menu-item> @@ -360,6 +360,9 @@ </menu-item> <menu-item name="EditPartyRates" title="${uiLabelMap.ProjectMgrRates}"> <link target="EditPartyRates?partyId=${partyId}"></link> + </menu-item> + <menu-item name="ListUnBilledHours" title="${uiLabelMap.ProjectMgrBilling}"> + <link target="ListResourcesUnBilledHours?partyId=${partyId}"></link> </menu-item> </menu> <menu name="RequestTabBar" menu-container-style="button-bar tab-bar" default-selected-style="selected"> Added: ofbiz/trunk/specialpurpose/projectmgr/widget/ResourceScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/ResourceScreens.xml?rev=630393&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/widget/ResourceScreens.xml (added) +++ ofbiz/trunk/specialpurpose/projectmgr/widget/ResourceScreens.xml Fri Feb 22 21:52:18 2008 @@ -0,0 +1,48 @@ +<?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. +--> + +<screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-screen.xsd"> + <screen name="ListUnBilledHours"> + <section> + <actions> + <set field="titleProperty" value="PageTitleListUnbilledHours"/> + <set field="tabButtonItem" value="ListUnBilledHours"/> + <set field="labelTitleProperty" value="ProjectMgrProjectName"/> + <set field="partyId" from-field="parameters.partyId"/> + <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/> + <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="20"/> + <script location="component://projectmgr/webapp/projectmgr/WEB-INF/actions/ListUnBilledHoursResources.bsh"/> + </actions> + <widgets> + <decorator-screen name="CommonListResourceDecorator" location="${parameters.mainDecoratorLocation}"> + <decorator-section name="body"> + <screenlet> + <screenlet title="Unbilled hours"> + <include-form name="ListUnBilledHours" location="component://projectmgr/widget/forms/ResourceForms.xml"/> + </screenlet> + </screenlet> + </decorator-section> + </decorator-screen> + </widgets> + </section> + </screen> + +</screens> \ No newline at end of file Propchange: ofbiz/trunk/specialpurpose/projectmgr/widget/ResourceScreens.xml ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/specialpurpose/projectmgr/widget/ResourceScreens.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ResourceForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ResourceForms.xml?rev=630393&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ResourceForms.xml (added) +++ ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ResourceForms.xml Fri Feb 22 21:52:18 2008 @@ -0,0 +1,31 @@ +<?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. +--> +<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd"> + <form name="ListUnBilledHours" type="list" list-name="unBilledList" paginate-target="ListResourcesUnBilledHours" + odd-row-style="alternate-row" default-table-style="basic-table hover-bar"> + <field name="projectName"><display/></field> + <field name="phaseName"><display/></field> + <field name="taskName"><display/></field> + <field name="hours"><display/></field> + <field name="rate"><display/></field> + <field name="total"><display/></field> + </form> +</forms> \ No newline at end of file Propchange: ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ResourceForms.xml ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ResourceForms.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml |
Free forum by Nabble | Edit this page |