-
Notifications
You must be signed in to change notification settings - Fork 0
AnA19S03AdapatingProjectsToExpenses
TWiki> LibrePlan Web>AnA19S03AdapatingProjectsToExpenses (11 Sep 2012, JavierMoran)EditAttach
Story summary | Adapting projects to expenses |
Iteration | AnA19CostModule |
FEA | AnA19S03AdapatingProjectsToExpenses |
Story Lead | |
Next Story | |
Passed acceptance test | No |
In these tasks are described a set of adaptations needed to adapt completely the expenses to be used in the LibrePlan projects.
It is needed to implement a validation to be checked when a user requests to delete a project. The validation to be checked will be the following: Search in the database if there are some ExpenseSheetLine
imputing money to some of the OrderElement
of the project. It must be avoided the deletion in this case with a red info message.
If you try to delete an OrderElement
that has objects WorkReportLine
imputing time, it is prevented this deletion with an error message.
It must be implemented a validation similar to the WorkReportLine
for the ExpenseSheetLine
. It must be prevented the deletion of a OrderElement
if there are some ExpenseSheetLine
object imputing cost.
It must be also checked that the
OrderElement
that wanted to be deleted do not have any descendant with some ExpenseSheetLine
imputing cost to it.
This task consists of precalculating the total money spent in expenses in the OrderElement
of an Order
instead of having to query the database each time the expenses cost can be displayed in a project. It is a cache mechanism similar to the one developed for the sum of hours devoted in the projects.
The class diagram for this task is the next one:
The mapping of the OrderElement
and SumExpenses
class must be similar to the one existing between OrderElement
and SumChargedEffort
. It must be guaranteed that:
- On saving a project, the
OrderElement
, it has to cascade toSumExpenses
the delete operation.
<one-to-one name="sumChargedEffort" class="SumChargedEffort"
cascade="delete" property-ref="orderElement" />
<many-to-one name="orderElement" column="order_element"
class="OrderElement" cascade="none" unique="true" />
- The
SumExpenses
are not created on editing a project, they will be just read to calculate the cost taking into account the expenses.
Creation of the SumExpenses objects
The creation of the SumExpenses
objects will be done on saving a ExpenseSheet
. At this moment for each ExpenseSheetLine
are created/updated the SumExpense
objects associated to the OrderElement
and its parents to which the ExpenseSheetLine
imputes time.
You can inspire and guide yourself looking into the code that does a similar action but for the
WorkReportLine
.
Update the SumExpenses on planning a project
The database mapping has been designed in order to avoid storing the SumExpenses
objects when saving the project plan. This is to avoid concurrency problems between the project planning perspectives and the screen to manage the expenses.
So, the strategy that we will need to implement here is the same as the one for the WorkReport
lines. This strategy consists of:
- Detect when it is needed to recalculate the
SumExpenses
of anOrder
. It is needed to include in the WBS interface a system to detect when it is changed the position of anOrderElement
with someExpenseSheetLine
imputing money to it. If some of this movements is done in the WBS tree then theOrder
is flagged to be recalculated theSumExpenses
. - The recalculation is done by an independent thread and not by the
Order
saving code. It must be followed the same approach that the used in theSumChargedEffort
case.
Some classes that you should take a look to implement this task:
org.libreplan.business.orders.daos.SumChargedEffortDAO
org.libreplan.business.orders.entities.SumChargedEffortRecalculator
In the Gantt diagram of the projects in LibrePlan there is a bar which shows the spent money in the the OrderElement
bound to a task and all its descendants OrderElement
objects. Cost categories, type of hours and the configuration of the resources related to the cost category they belong are taken into account. This can can called the cost because of worked hours.
This task consists of adding the cost because of expenses to the cost because of worked hours. They must be added not only the expenses because of the direct expenses but because of the indirect expenses, expenses of the OrderElement
children to the cost bar. These quantities must be extracted from the SumExpenses
object.
This task consists of adding the information about the expenses done in an OrderElement
in the tab Imputed hours.
The changes to do are the next ones:
- Change the name of the tab. It will be Cost.
- Create a new section below Imputed hours allocation called Expenses. Do a table with the list of the direct expenses imputing in the
OrderElement
. The expenses must appear sorted byDate
. It will have the following columns:
| Date | Concept | Resource | Value |
| | | | |
Sum of direct expenses
Sum of expenses imputed in children tasks
- Do a new format of the bottom table Money spent to be:
- Money spent. It will be the sum of the cost because of worked time and expenses.
- Because of hours. The total cost because of the hours worked in the
OrderElement
and its children. - Because of expenses. The total cost because of the expenses in the
OrderElement
and its children.
- Because of hours. The total cost because of the hours worked in the
- Money spent. It will be the sum of the cost because of worked time and expenses.
Change the name of the report to be just Project cost
The report will have a new area per OrderElement
called Expenses. It will contain a list of expenses imputing money to the OrderElement
. The columns of the Expenses area will be:
| Date | Concept | Resource | Value |
| | | | |
The table will be order by Date
and must include a subtotal with all the expenses done in an OrderElement
.
If an
OrderElement
has not any expenses the area must not be rendered, not even the heading of the table.
I | Attachment | Action | Size | Date | Who | Comment |
---|---|---|---|---|---|---|
![]() |
expense_cache_class_diagram.png | manage | 7.6 K | 19 Apr 2012 - 17:13 | JavierMoran | Expenses class diagram |
Copyright (c) by the contributing authors. All material on this collaboration platform is the property of the contributing authors.