Author: apatel
Date: Wed Jul 8 11:00:42 2009 New Revision: 792097 URL: http://svn.apache.org/viewvc?rev=792097&view=rev Log: Service to find previous customtimeperiod. This service uses periodNum field value to find previous custometimeperid of same periodType. Corrected demo data. Modified: ofbiz/trunk/applications/accounting/data/DemoGlSetupData.xml ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/period/PeriodServices.xml ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml Modified: ofbiz/trunk/applications/accounting/data/DemoGlSetupData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/data/DemoGlSetupData.xml?rev=792097&r1=792096&r2=792097&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/data/DemoGlSetupData.xml (original) +++ ofbiz/trunk/applications/accounting/data/DemoGlSetupData.xml Wed Jul 8 11:00:42 2009 @@ -324,22 +324,22 @@ <VarianceReasonGlAccount organizationPartyId="Company" varianceReasonId="VAR_SAMPLE" glAccountId="625000"/> <!-- Some Sample Time Periods, two Years with Quarters --> - <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6000" periodTypeId="FISCAL_YEAR" fromDate="2007-01-01" thruDate="2008-01-01" isClosed="N" periodNum="5" periodName="2007"/> + <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6000" periodTypeId="FISCAL_YEAR" fromDate="2007-01-01" thruDate="2007-12-31" isClosed="N" periodNum="1" periodName="2007"/> <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6001" periodTypeId="FISCAL_QUARTER" fromDate="2007-01-01" thruDate="2007-04-01" isClosed="N" periodNum="1" periodName="2007/Q1" parentPeriodId="6000"/> <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6002" periodTypeId="FISCAL_QUARTER" fromDate="2007-04-01" thruDate="2007-07-01" isClosed="N" periodNum="2" periodName="2007/Q2" parentPeriodId="6000"/> <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6003" periodTypeId="FISCAL_QUARTER" fromDate="2007-07-01" thruDate="2007-10-01" isClosed="N" periodNum="3" periodName="2007/Q3" parentPeriodId="6000"/> <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6004" periodTypeId="FISCAL_QUARTER" fromDate="2007-10-01" thruDate="2008-01-01" isClosed="N" periodNum="4" periodName="2007/Q4" parentPeriodId="6000"/> - <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6005" periodTypeId="FISCAL_YEAR" fromDate="2008-01-01" thruDate="2009-01-01" isClosed="N" periodNum="5" periodName="2008"/> + <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6005" periodTypeId="FISCAL_YEAR" fromDate="2008-01-01" thruDate="2008-12-31" isClosed="N" periodNum="2" periodName="2008"/> <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6006" periodTypeId="FISCAL_QUARTER" fromDate="2008-01-01" thruDate="2008-04-01" isClosed="N" periodNum="1" periodName="2008/Q1" parentPeriodId="6005"/> <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6007" periodTypeId="FISCAL_QUARTER" fromDate="2008-04-01" thruDate="2008-07-01" isClosed="N" periodNum="2" periodName="2008/Q2" parentPeriodId="6005"/> <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6008" periodTypeId="FISCAL_QUARTER" fromDate="2008-07-01" thruDate="2008-10-01" isClosed="N" periodNum="3" periodName="2008/Q3" parentPeriodId="6005"/> <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6009" periodTypeId="FISCAL_QUARTER" fromDate="2008-10-01" thruDate="2009-01-01" isClosed="N" periodNum="4" periodName="2008/Q4" parentPeriodId="6005"/> - <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6010" periodTypeId="FISCAL_YEAR" fromDate="2009-01-01" thruDate="2010-01-01" isClosed="N" periodNum="5" periodName="2009"/> + <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6010" periodTypeId="FISCAL_YEAR" fromDate="2009-01-01" thruDate="2009-12-31" isClosed="N" periodNum="3" periodName="2009"/> <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6011" periodTypeId="FISCAL_QUARTER" fromDate="2009-01-01" thruDate="2009-04-01" isClosed="N" periodNum="1" periodName="2009/Q1" parentPeriodId="6010"/> <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6012" periodTypeId="FISCAL_QUARTER" fromDate="2009-04-01" thruDate="2009-07-01" isClosed="N" periodNum="2" periodName="2009/Q2" parentPeriodId="6010"/> <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6013" periodTypeId="FISCAL_QUARTER" fromDate="2009-07-01" thruDate="2009-10-01" isClosed="N" periodNum="3" periodName="2009/Q3" parentPeriodId="6011"/> <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6014" periodTypeId="FISCAL_QUARTER" fromDate="2009-10-01" thruDate="2010-01-01" isClosed="N" periodNum="4" periodName="2009/Q4" parentPeriodId="6012"/> - <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6015" periodTypeId="FISCAL_YEAR" fromDate="2010-01-01" thruDate="2011-01-01" isClosed="N" periodNum="5" periodName="2010"/> + <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6015" periodTypeId="FISCAL_YEAR" fromDate="2010-01-01" thruDate="2010-12-31" isClosed="N" periodNum="4" periodName="2010"/> <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6016" periodTypeId="FISCAL_QUARTER" fromDate="2010-01-01" thruDate="2010-04-01" isClosed="N" periodNum="1" periodName="2010/Q1" parentPeriodId="6015"/> <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6017" periodTypeId="FISCAL_QUARTER" fromDate="2010-04-01" thruDate="2010-07-01" isClosed="N" periodNum="2" periodName="2010/Q2" parentPeriodId="6015"/> <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6018" periodTypeId="FISCAL_QUARTER" fromDate="2010-07-01" thruDate="2010-10-01" isClosed="N" periodNum="3" periodName="2010/Q3" parentPeriodId="6015"/> Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/period/PeriodServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/period/PeriodServices.xml?rev=792097&r1=792096&r2=792097&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/period/PeriodServices.xml (original) +++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/period/PeriodServices.xml Wed Jul 8 11:00:42 2009 @@ -73,4 +73,24 @@ <field-to-result field="listSoFar" result-name="customTimePeriodList"/> </simple-method> + + <!-- Return previous year with respect to the given year and if none found then return current year as previous. --> + <simple-method method-name="getPreviousTimePeriod" short-description="Return previous time period"> + + <entity-one entity-name="CustomTimePeriod" value-field="currentTimePeriod"/> + + <set field="periodNum" value="${currentTimePeriod.periodNum - 1}" type="Integer"/> + <if-compare field="periodNum" operator="greater" value="-1"> + <entity-and entity-name="CustomTimePeriod" list="customTimePeriodList" filter-by-date="false"> + <field-map field-name="organizationPartyId" from-field="currentTimePeriod.organizationPartyId"/> + <field-map field-name="periodTypeId" from-field="currentTimePeriod.periodTypeId"/> + <field-map field-name="periodNum"/> + </entity-and> + <first-from-list list="customTimePeriodList" entry="previousTimePeriod"/> + <field-to-result field="previousTimePeriod"/> + <else> + <field-to-result field="currentTimePeriod" result-name="previousTimePeriod"/> + </else> + </if-compare> + </simple-method> </simple-methods> Modified: ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml?rev=792097&r1=792096&r2=792097&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml (original) +++ ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml Wed Jul 8 11:00:42 2009 @@ -568,4 +568,10 @@ <attribute name="lastClosedDate" type="Timestamp" mode="OUT" optional="true"/> <attribute name="lastClosedTimePeriod" type="org.ofbiz.entity.GenericValue" mode="OUT" optional="true"/> </service> + <service name="getPreviousTimePeriod" engine="simple" invoke="getPreviousTimePeriod" + location="component://accounting/script/org/ofbiz/accounting/period/PeriodServices.xml" auth="true"> + <description>Return previous year with respect to the given year and if none found then return current year as previous.</description> + <attribute name="customTimePeriodId" mode="IN" type="String"/> + <attribute name="previousTimePeriod" mode="OUT" type="Map" optional="false"/> + </service> </services> |
Free forum by Nabble | Edit this page |