You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ha...@apache.org on 2008/08/30 03:51:20 UTC
svn commit: r690439 - in /ofbiz/trunk/applications/workeffort:
script/org/ofbiz/workeffort/timesheet/TimesheetServices.xml
servicedef/services_timesheet.xml widget/WorkEffortForms.xml
widget/WorkEffortScreens.xml
Author: hansbak
Date: Fri Aug 29 18:51:20 2008
New Revision: 690439
URL: http://svn.apache.org/viewvc?rev=690439&view=rev
Log:
cleanup workeffort find/list (because of the many fields paging did not work), add option to add all timeentries into one invoice item, screenlet conversion
Modified:
ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/TimesheetServices.xml
ofbiz/trunk/applications/workeffort/servicedef/services_timesheet.xml
ofbiz/trunk/applications/workeffort/widget/WorkEffortForms.xml
ofbiz/trunk/applications/workeffort/widget/WorkEffortScreens.xml
Modified: ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/TimesheetServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/TimesheetServices.xml?rev=690439&r1=690438&r2=690439&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/TimesheetServices.xml (original)
+++ ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/TimesheetServices.xml Fri Aug 29 18:51:20 2008
@@ -114,7 +114,6 @@
<check-errors/>
<entity-one entity-name="WorkEffort" value-name="workEffort"/>
- <get-related value-name="workEffort" relation-name="TimeEntry" list-name="timeEntryList"/>
<if-empty field="parameters.invoiceId">
<set-service-fields service-name="createInvoice" map-name="parameters" to-map-name="createInvoiceMap"/>
@@ -138,33 +137,76 @@
<call-simple-method method-name="createTimeEntryInvoiceItemsInline"/>
</simple-method>
<simple-method method-name="createTimeEntryInvoiceItemsInline" short-description="createTimeEntryInvoiceItemsInline">
+ <log level="always" message="=========input: ${parameters.combineInvoiceItem}"/>
+ <set field="orderBy[]" value="rateTypeId"/>
+ <get-related value-name="workEffort" relation-name="TimeEntry" list-name="timeEntryList" order-by-list-name="orderBy"/>
+ <set field="invoiceItemMap.invoiceId" from-field="invoiceId"/>
+ <set field="invoiceItemMap.taxableFlag" value="N"/>
+ <set field="invoiceItemMap.invoiceItemTypeId" value="INV_TE_ITEM"/>
+ <set field="invoiceItemMap.uomId" value="TF_hr"/>
<iterate entry-name="timeEntry" list-name="timeEntryList">
+
<!-- only add to invoice if it is not already on an invoice; may want to make this smarter in the future to see if invoice cancelled or some such -->
<if-empty field="timeEntry.invoiceId">
- <clear-field field-name="createInvoiceItemMap"/>
- <clear-field field-name="getTimeEntryRate"/>
- <clear-field field-name="rateAmount"/>
-
- <set field="getTimeEntryRate.timeEntryId" from-field="timeEntry.timeEntryId"/>
- <call-service service-name="getTimeEntryRate" in-map-name="getTimeEntryRate">
- <result-to-field result-name="rateAmount"/>
- </call-service>
-
- <set field="createInvoiceItemMap.invoiceId" from-field="invoiceId"/>
- <set field="createInvoiceItemMap.taxableFlag" value="N"/>
- <set field="createInvoiceItemMap.invoiceItemTypeId" value="INV_TE_ITEM"/>
+
+ <!-- check if the RateTypeId changed or the first record -->
+ <if>
+ <condition>
+ <or>
+ <if-empty field="oldRateTypeId"/>
+ <and>
+ <not><if-empty field="oldRateTypeId"/></not>
+ <if-compare-field field="timeEntry.rateTypeId" operator="not-equals" to-field="oldRateTypeId"/>
+ </and>
+ </or>
+ </condition>
+ <then>
+ <set field="getTimeEntryRate.timeEntryId" from-field="timeEntry.timeEntryId"/>
+ <call-service service-name="getTimeEntryRate" in-map-name="getTimeEntryRate">
+ <result-to-field result-name="rateAmount"/>
+ </call-service>
+ <set field="invoiceItemMap.amount" from-field="rateAmount" default-value="0.0" type="Double"/>
+ <if-compare field="parameters.combineInvoiceItem" operator="equals" value="Y" >
+ <log level="always" message="===== first line of rateTypeId with hours: ${timeEntry.hours}"/>
+ <set field="invoiceItemMap.quantity" from-field="timeEntry.hours" default-value="0.0" type="Double"/>
+ <call-service service-name="createInvoiceItem" in-map-name="invoiceItemMap">
+ <result-to-field result-name="invoiceItemSeqId" field-name="invoiceItemMap.invoiceItemSeqId"/>
+ </call-service>
+ </if-compare>
+ </then>
+ <else>
+ <if-compare field="parameters.combineInvoiceItem" operator="equals" value="Y" >
+ <log level="always" message="===== following lines with hours: ${timeEntry.hours}"/>
+ <!-- or combine them when it is the same rate -->
+ <calculate field-name="invoiceItemMap.quantity">
+ <calcop operator="get" field-name="invoiceItemMap.quantity"/>
+ <calcop operator="add" field-name="timeEntry.hours"/>
+ </calculate>
+ <call-service service-name="updateInvoiceItem" in-map-name="invoiceItemMap"/>
+ </if-compare>
+ </else>
+ </if>
+ <set field="oldRateTypeId" from-field="timeEntry.rateTypeId"/>
- <set field="createInvoiceItemMap.quantity" from-field="timeEntry.hours" default-value="0.0" type="Double"/>
- <set field="createInvoiceItemMap.uomId" value="TF_hr"/>
- <set field="createInvoiceItemMap.amount" from-field="rateAmount" default-value="0.0" type="Double"/>
-
- <set field="createInvoiceItemMap.description" from-field="timeEntry.comments"/>
+ <set field="invoiceItemMap.description" from-field="timeEntry.comments"/>
+ <if-empty field="invoiceItemMap.description">
+ <set field="invoiceItemMap.description" from-field="workEffort.workEffortName"/>
+ </if-empty>
+
+ <!-- create an invoiceitem for every time entry -->
+ <if-compare field="parameters.combineInvoiceItem" operator="not-equals" value="Y" >
+ <log level="always" message="===== always create item lines with hours: ${timeEntry.hours}"/>
+ <set field="invoiceItemMap.quantity" from-field="timeEntry.hours" default-value="0.0" type="Double"/>
+ <call-service service-name="createInvoiceItem" in-map-name="invoiceItemMap">
+ <result-to-field result-name="invoiceItemSeqId" field-name="invoiceItemMap.invoiceItemSeqId"/>
+ </call-service>
+ </if-compare>
- <call-service service-name="createInvoiceItem" in-map-name="createInvoiceItemMap">
- <result-to-field result-name="invoiceItemSeqId" field-name="timeEntry.invoiceItemSeqId"/>
- </call-service>
+ <!-- update the timeentry -->
<set field="timeEntry.invoiceId" from-field="invoiceId"/>
+ <set field="timeEntry.invoiceItemSeqId" from-field="invoiceItemMap.invoiceItemSeqId"/>
<store-value value-name="timeEntry"/>
+
</if-empty>
</iterate>
</simple-method>
Modified: ofbiz/trunk/applications/workeffort/servicedef/services_timesheet.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/servicedef/services_timesheet.xml?rev=690439&r1=690438&r2=690439&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/servicedef/services_timesheet.xml (original)
+++ ofbiz/trunk/applications/workeffort/servicedef/services_timesheet.xml Fri Aug 29 18:51:20 2008
@@ -84,10 +84,11 @@
<service name="addWorkEffortTimeToInvoice" default-entity-name="Timesheet" engine="simple" auth="true"
location="org/ofbiz/workeffort/timesheet/TimesheetServices.xml" invoke="addWorkEffortTimeToInvoice">
- <description>Add WorkEffort Time to Invoice</description>
+ <description>Add WorkEffort Time to Invoice, with the option to combine all timeentries with the same rateType into one invoiceItem </description>
<permission-service service-name="workEffortGenericPermission" main-action="CREATE"/>
<attribute name="workEffortId" type="String" mode="IN" optional="false"/>
<attribute name="invoiceId" type="String" mode="IN" optional="false"/>
+ <attribute name="combineInvoiceItem" mode="IN" type="String" optional="true"/>
</service>
<service name="addWorkEffortTimeToNewInvoice" default-entity-name="Timesheet" engine="simple" auth="true"
location="org/ofbiz/workeffort/timesheet/TimesheetServices.xml" invoke="addWorkEffortTimeToInvoice">
Modified: ofbiz/trunk/applications/workeffort/widget/WorkEffortForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/widget/WorkEffortForms.xml?rev=690439&r1=690438&r2=690439&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/widget/WorkEffortForms.xml (original)
+++ ofbiz/trunk/applications/workeffort/widget/WorkEffortForms.xml Fri Aug 29 18:51:20 2008
@@ -18,8 +18,8 @@
under the License.
-->
-<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd">
-
+<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd">
<form name="FilterUserJobs" title="" type="single"
header-row-style="header-row" default-table-style="basic-table">
<field name="statusId">
@@ -175,10 +175,9 @@
<form name="FindWorkEffort" default-map-name="workEffort" target="ListWorkEfforts" title="" type="single"
header-row-style="header-row" default-table-style="basic-table">
- <auto-fields-entity entity-name="WorkEffort" default-field-type="find"/>
+ <!-- auto-fields-entity entity-name="WorkEffort" default-field-type="find"/-->
<field name="workEffortId" title="${uiLabelMap.WorkEffortWorkEffortId}"><text-find/></field>
- <field name="workEffortParentId"><text-find/></field>
- <field name="workEffortName"><text-find/></field>
+ <field name="workEffortParentId" position="2"><text-find/></field>
<field name="workEffortTypeId">
<drop-down allow-empty="true">
<entity-options description="${description}" entity-name="WorkEffortType" key-field-name="workEffortTypeId">
@@ -186,14 +185,13 @@
</entity-options>
</drop-down>
</field>
- <field name="workEffortPurposeTypeId">
+ <field name="workEffortPurposeTypeId" position="2">
<drop-down allow-empty="true">
<entity-options description="${description}" entity-name="WorkEffortPurposeType" key-field-name="workEffortPurposeTypeId">
<entity-order-by field-name="description"/>
</entity-options>
</drop-down>
</field>
-
<field name="currentStatusId" title="${uiLabelMap.CommonStatus}">
<drop-down allow-empty="true">
<entity-options entity-name="StatusItem" key-field-name="statusId" description="[${uiLabelMap.WorkEffortGeneral}] ${description}">
@@ -210,9 +208,23 @@
</entity-options>
</drop-down>
</field>
- <field name="workEffortParentId"><lookup target-form-name="LookupWorkEffort"/></field>
+ <field name="priority" position="2">
+ <drop-down allow-empty="true">
+ <option key="9"/>
+ <option key="8"/>
+ <option key="7"/>
+ <option key="6"/>
+ <option key="5"/>
+ <option key="4"/>
+ <option key="3"/>
+ <option key="2"/>
+ <option key="1"/>
+ </drop-down>
+ </field>
+ <field name="workEffortName"><text-find/></field>
+ <field name="description" position="2"><text-find/></field>
<field name="facilityId"><lookup target-form-name="LookupFacility"/></field>
- <field name="fixedAssetId"><lookup target-form-name="LookupFixedAsset"/></field>
+ <field name="fixedAssetId" position="2"><lookup target-form-name="LookupFixedAsset"/></field>
<field name="scopeEnumId">
<drop-down allow-empty="true">
<entity-options entity-name="Enumeration" key-field-name="enumId" description="${description}">
@@ -220,7 +232,7 @@
</entity-options>
</drop-down>
</field>
- <field name="moneyUomId" title="${uiLabelMap.CommonCurrency}">
+ <field name="moneyUomId" title="${uiLabelMap.CommonCurrency}" position="2">
<drop-down allow-empty="true">
<entity-options key-field-name="uomId" description="${abbreviation} - ${description}" entity-name="Uom">
<entity-constraint name="uomTypeId" operator="equals" value="CURRENCY_MEASURE"/>
@@ -250,9 +262,8 @@
</service>
</actions>
<field name="workEffortId" title="${uiLabelMap.WorkEffortWorkEffortId}" widget-style="buttontext">
- <hyperlink also-hidden="false" description="${workEffortId}" target="javascript:set_value('${workEffortId}')" target-type="plain"/>
+ <hyperlink also-hidden="false" description="${workEffortName}[${workEffortId}]" target="javascript:set_value('${workEffortId}')" target-type="plain"/>
</field>
- <field name="workEffortName"><display/></field>
<field name="workEffortTypeId"><display-entity entity-name="WorkEffortType"/></field>
<field name="contactMechTypeId"><display-entity entity-name="ContactMechType"/></field>
<field name="marketingCampaignId"><display-entity description="${campaignName}" entity-name="MarketingCampaign"/></field>
@@ -362,19 +373,27 @@
</sort-order>
</form>
- <form name="ListWorkEfforts" target="ListWorkEfforts" title="" type="list" list-name="listIt"
+ <form name="ListWorkEfforts" type="list" list-name="listIt" paginate-target="ListWorkEfforts"
odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
<actions>
- <service result-map-list-name="listIt" result-map-name="result" service-name="performFind">
+ <service service-name="performFind" result-map-name="result" result-map-list-name="listIt">
<field-map field-name="inputFields" env-name="parameters"/>
<field-map field-name="entityName" value="WorkEffort"/>
+ <field-map field-name="orderBy" value="lastModifiedDate DESC"/>
</service>
</actions>
<field name="workEffortId" title="${uiLabelMap.WorkEffortWorkEffortId}" widget-style="buttontext">
<hyperlink also-hidden="false" description="${workEffortName} [${workEffortId}]" target="EditWorkEffort?workEffortId=${workEffortId}"/>
</field>
<field name="workEffortTypeId"><display-entity entity-name="WorkEffortType"/></field>
+ <field name="currentStatusId"><display-entity entity-name="StatusItem" key-field-name="statusId" description="${description}"/></field>
<field name="workEffortPurposeTypeId"><display-entity entity-name="WorkEffortPurposeType"/></field>
+ <field name="description"><display/></field>
+ <field name="priority"><display/></field>
+ <field name="estimatedStartDate"><display type="date"/></field>
+ <field name="estimatedCompletionDate"><display type="date"/></field>
+ <field name="actualStartDate"><display type="date"/></field>
+ <field name="actualCompletionDate"><display type="date"/></field>
<!-- These links have been commented because they are (partially or totally) broken
<field name="editLink" title="${uiLabelMap.CommonEmptyHeader}" widget-style="linktext">
<hyperlink also-hidden="false" description="${uiLabelMap.CommonEdit}" target="EditWorkEffort?workEffortId=${workEffortId}&DONE_PAGE=ListWorkEfforts?${queryStringEncoded}"/>
@@ -780,7 +799,7 @@
<field name="submitButton" title="${uiLabelMap.PageTitleAddWorkEffortTimeToInvoice}" widget-style="smallSubmit"><submit button-type="button"/></field>
</form>
<form name="AddWorkEffortTimeToNewInvoice" target="addWorkEffortTimeToNewInvoice" title="" type="single">
-
+ <field name="combineInvoiceItem"><hidden value="Y"/></field>
<field name="workEffortId"><hidden/></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>
Modified: ofbiz/trunk/applications/workeffort/widget/WorkEffortScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/widget/WorkEffortScreens.xml?rev=690439&r1=690438&r2=690439&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/widget/WorkEffortScreens.xml (original)
+++ ofbiz/trunk/applications/workeffort/widget/WorkEffortScreens.xml Fri Aug 29 18:51:20 2008
@@ -191,8 +191,8 @@
<container style="screenlet-body">
<section>
<widgets>
- <container><link text="${uiLabelMap.WorkEffortCreate}" target="EditWorkEffort?DONE_PAGE=${donePage}" style="buttontext"/></container>
- <container><link text="${uiLabelMap.ProductAdvancedSearch}" target="WorkEffortSearchOptions" style="buttontext"/></container>
+ <link text="${uiLabelMap.WorkEffortCreate}" target="EditWorkEffort?DONE_PAGE=${donePage}" style="buttontext"/>
+ <link text="${uiLabelMap.ProductAdvancedSearch}" target="WorkEffortSearchOptions" style="buttontext"/>
<include-form name="FindWorkEffort" location="component://workeffort/widget/WorkEffortForms.xml"/>
</widgets>
</section>
@@ -210,28 +210,14 @@
<set field="titleProperty" value="PageTitleListWorkEfforts"/>
<set field="tabButtonItem" value="WorkEffort"/>
<set field="labelTitleProperty" value="PageTitleListWorkEfforts"/>
-
<set field="workEffortId" from-field="parameters.workEffortId"/>
</actions>
<widgets>
<decorator-screen name="CommonWorkEffortDecorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
- <container style="screenlet">
- <container style="screenlet-title-bar">
- <container style="h3">
- <label text="${uiLabelMap.PageTitleListWorkEfforts}"/>
- </container>
- </container>
- <container style="screenlet-body">
- <section>
- <widgets>
- <container><link text="${uiLabelMap.WorkEffortCreate}" target="EditWorkEffort?DONE_PAGE=${donePage}" style="buttontext"/></container>
- <container><link text="${uiLabelMap.CommonFind}" target="FindWorkEffort" style="buttontext"/></container>
- <include-form name="ListWorkEfforts" location="component://workeffort/widget/WorkEffortForms.xml"/>
- </widgets>
- </section>
- </container>
- </container>
+ <screenlet title="${uiLabelMap.PageTitleListWorkEfforts}" navigation-form-name="ListWorkEfforts">
+ <include-form name="ListWorkEfforts" location="component://workeffort/widget/WorkEffortForms.xml"/>
+ </screenlet>
</decorator-section>
</decorator-screen>
</widgets>