expenses prevision turns works
This commit is contained in:
parent
e371483c59
commit
11b26bcf40
|
@ -17,7 +17,10 @@
|
|||
</h2>
|
||||
Euros disponibles au départ:
|
||||
<input type="number" ng-model="disponibility">
|
||||
Dépenses mensuelles: {{ sumMonthlyExpenses }}
|
||||
<strong>
|
||||
|
||||
Dépenses mensuelles: {{ sumMonthlyExpenses() }} €
|
||||
</strong>
|
||||
</div>
|
||||
<div class="postes">
|
||||
<h2>Postes de dépenses
|
||||
|
@ -60,16 +63,16 @@
|
|||
</td>
|
||||
<td>
|
||||
|
||||
<input type="text" ng-model="e.delay">
|
||||
<input type="number" ng-model="e.delay">
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" ng-model="e.repeat">
|
||||
<input type="number" ng-model="e.repeat">
|
||||
</td>
|
||||
<td class="text-right padded">
|
||||
{{ e.repeat * e.amount }}
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" ng-model="e.amount">
|
||||
<input type="number" ng-model="e.amount">
|
||||
</td>
|
||||
<td class="text-right padded">
|
||||
{{ e.amount * 12 }}
|
||||
|
@ -128,18 +131,18 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="line in previsionTable">
|
||||
<tr ng-repeat="line in previsionTable()">
|
||||
<td>
|
||||
{{ $index }}
|
||||
</td>
|
||||
<td>
|
||||
-
|
||||
</td>
|
||||
<td>
|
||||
<td class="text-right ">
|
||||
|
||||
{{ line.expense }}
|
||||
</td>
|
||||
<td ng-class="{ 'bg-warning' : line.available < 0}">
|
||||
<td class="text-right" ng-class="{ 'bg-warning' : line.available < 0}">
|
||||
|
||||
{{ line.available }}
|
||||
</td>
|
||||
|
|
|
@ -255,15 +255,16 @@ angular
|
|||
};
|
||||
|
||||
$scope.previsionTable = () => {
|
||||
let turns = 60;
|
||||
let turns = 24;
|
||||
let monthly = $scope.sumMonthlyExpenses();
|
||||
let available = $scope.disponibility;
|
||||
let previsionTable = [];
|
||||
for (let i = 0; i <= turns; i++) {
|
||||
// TODO take in account delays in expenses
|
||||
available = available - monthly;
|
||||
let newLine = {
|
||||
expense: monthly,
|
||||
available: available - monthly,
|
||||
available: available,
|
||||
};
|
||||
previsionTable.push(newLine);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue