added rateTypeId to weekly timesheet using the default of the partyRate table

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk/specialpurpose@609883 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hans Bakker
2008-01-08 06:10:48 +00:00
parent 9c712e3a15
commit 8de24d49ae
5 changed files with 34 additions and 7 deletions
@@ -184,6 +184,7 @@
</simple-method>
<simple-method method-name="updateTimeEntryByWorkeffort" short-description="Update workeffort by workeffort and timesheetId ">
<log level="always" message="=====start:==rateType: ${parameters.rateTypeId}"></log>
<if-empty field-name="parameters.workEffortId">
<return/>
</if-empty>
@@ -236,7 +237,7 @@
</if-empty>
<get-related value-name="timesheet" relation-name="TimeEntry" list-name="timeEntries"/>
<!-- update existing entries -->
<set field="hours" value="0" type="Double"/>
<if-not-empty field-name="timeEntries">
@@ -899,14 +900,17 @@
<call-service service-name="deleteTimeEntry" in-map-name="teDelMap"/>
<else>
<clear-field field-name="teUpdMap"/>
<log level="always" message="=====updtimeentry: ${parameters.rateTypeId}"></log>
<set field="teUpdMap.hours" from-field="hours"/>
<set field="teUpdMap.timeEntryId" from-field="timeEntry.timeEntryId"/>
<set field="teUpdMap.rateTypeId" from-field="parameters.rateTypeId"/>
<call-service service-name="updateTimeEntry" in-map-name="teUpdMap"/>
</else>
</if-compare>
<else>
<if-compare field-name="hours" operator="not-equals" value="0">
<set-service-fields service-name="createTimeEntry" map-name="parameters" to-map-name="teCreMap"/>
<set field="teCreMap.rateTypeId" from-field="parameters.rateTypeId"/>
<set field="teCreMap.hours" from-field="hours"/>
<set field="teCreMap.fromDate" from-field="fromDate"/>
<call-service service-name="createTimeEntry" in-map-name="teCreMap"/>
+1
View File
@@ -56,6 +56,7 @@ under the License.
<attribute name="timesheetId" type="String" mode="INOUT" optional="true"/>
<attribute name="workEffortId" type="String" mode="INOUT" optional="true"/><!-- when empty will be ignored -->
<attribute name="fromDate" type="Timestamp" mode="INOUT" optional="true"/>
<attribute name="rateTypeId" type="String" mode="IN" optional="true"/>
<attribute name="roleTypeId" type="String" mode="IN" optional="true"/>
<attribute name="hoursDay0" type="Double" mode="IN" optional="true"/>
<attribute name="hoursDay1" type="Double" mode="IN" optional="true"/>
@@ -65,7 +65,13 @@ if (timesheetId != null) {
}
}
// get the user names
context.put("partyNameView", delegator.findByPrimaryKey("PartyNameView", UtilMisc.toMap("partyId", partyId)));
context.put("partyNameView", delegator.findByPrimaryKey("PartyNameView", UtilMisc.toMap("partyId", partyId)));
// get the default rate for this person
rateTypes = EntityUtil.filterByDate(delegator.findByAnd("PartyRate", UtilMisc.toMap("partyId", partyId, "defaultRate", "Y")));
if (UtilValidate.isNotEmpty(rateTypes)) {
rateType = rateTypes.get(0);
context.put("defaultRateTypeId", rateType.getString("rateTypeId"));
}
if (timesheet == null) return;
@@ -116,8 +122,8 @@ void retrieveWorkEffortData() {
entry.put("phaseId",result.get("phaseId"));
entry.put("phaseName",result.get("phaseName"));
entry.put("projectId",result.get("projectId"));
entry.put("projectName",result.get("projectName"));
entry.put("projectName",result.get("projectName"));
}
entry.put("total", taskTotal);
entry.put("timesheetId", timesheet.get("timesheetId"));
@@ -140,7 +146,6 @@ while(te.hasNext()) {
retrieveWorkEffortData();
}
entry.put("timesheetId", timesheet.get("timesheetId"));
if (timeEntry.get("hours") != null) {
dayNumber = (timeEntry.get("fromDate").getTime() - timesheet.getTimestamp("fromDate").getTime()) / (24*60*60*1000);
hours = timeEntry.getDouble("hours").doubleValue();
@@ -153,7 +158,8 @@ while(te.hasNext()) {
if (dayNumber == 5) day5Total += hours;
if (dayNumber == 6) day6Total += hours;
taskTotal += hours;
}
}
entry.put("rateTypeId", timeEntry.get("rateTypeId"));
lastWorkEffortId = timeEntry.getString("workEffortId");
}
+10 -1
View File
@@ -237,7 +237,16 @@ under the License.
<widgets>
<!--include-menu name="TimesheetTabBar" location="component://projectmgr/widget/Menus.xml"/-->
<include-menu name="TimesheetSubTabBar" location="component://projectmgr/widget/Menus.xml"/>
<container><label style="head1">${uiLabelMap.TimesheetTimesheetId}: ${timesheetId} ${uiLabelMap.CommonFrom}: ${partyName.firstName} ${partyName.middleName} ${partyName.lastName} ${partyName.groupName} [${timesheet.partyId}]</label></container>
<section>
<condition>
<not>
<if-empty field-name="timesheet"/>
</not>
</condition>
<widgets>
<container><label style="head1">${uiLabelMap.TimesheetTimesheetId}: ${timesheetId} ${uiLabelMap.CommonFrom}: ${partyName.firstName} ${partyName.middleName} ${partyName.lastName} ${partyName.groupName} [${timesheet.partyId}]</label></container>
</widgets>
</section>
<decorator-section-include name="body"/>
</widgets>
<fail-widgets>
@@ -37,6 +37,11 @@
</drop-down>
</field>
<field name="checkComplete"><check/></field>
<field name="rateTypeId">
<drop-down allow-empty="false" no-current-selected-key="${defaultRateTypeId}">
<entity-options entity-name="RateType" description="${description}"/>
</drop-down>
</field>
<field name="0" parameter-name="hoursDay0" title="Sun"><text size="5"/></field>
<field name="1" parameter-name="hoursDay1" title="Mon"><text size="5"/></field>
<field name="2" parameter-name="hoursDay2" title="Tue"><text size="5"/></field>
@@ -240,6 +245,8 @@
<field name="projectName" title="${uiLabelMap.ProjectMgrProjectName}">
<hyperlink target="projectView?projectId=${projectId} " description="${projectName}"/>
</field>
<field name="checkComplete"><display/></field>
<field name="rateTypeId"><display-entity entity-name="RateType" description="${description}"/></field>
<field name="0" parameter-name="hoursDay0" title="Sun"><display/></field>
<field name="1" parameter-name="hoursDay1" title="Mon"><display/></field>
<field name="2" parameter-name="hoursDay2" title="Tue"><display/></field>