about to remove Withdrawal entity
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
INSERT INTO User (id, name, username) VALUES (1, 'Adam', 'adam@mail.com'), (2, 'Betty', 'betty@mail.com');
|
INSERT INTO User (id, name, username) VALUES (1, 'Adam', 'adam@mail.com'), (2, 'Betty', 'betty@mail.com'), (3, 'Curt', 'curt@mail.com');
|
||||||
INSERT INTO Account (id, name, owner_id) VALUES (1, 'Gemeinschaftskonto', 1), (2, 'Konto Adam', 1);
|
INSERT INTO Account (id, name, owner_id) VALUES (1, 'Gemeinschaftskonto', 1), (2, 'Konto Adam', 1);
|
||||||
|
|
||||||
INSERT INTO Withdrawal(id, account_id, amount, user_id, date) VALUES (1, 1, 20.00, 2, '2016-04-12 18:20:15');
|
INSERT INTO Withdrawal(id, account_id, amount, user_id, date) VALUES (1, 1, 20.00, 2, '2016-04-12 18:20:15');
|
||||||
@@ -6,7 +6,7 @@ INSERT INTO Withdrawal(id, account_id, amount, user_id, date) VALUES (2, 1, 10.0
|
|||||||
|
|
||||||
INSERT INTO Category (id, name, account_id, position) VALUES (1, 'Essen - Lebensmittel', 1, 2), (2, 'Einnahmen - Gehalt', 1, 1), (3, 'Essen - Arbeit', 1, 3), (4, 'Einnahmen - Gehalt', 2, 1), (5, 'Technik - Server und Hosting', 2, 2);
|
INSERT INTO Category (id, name, account_id, position) VALUES (1, 'Essen - Lebensmittel', 1, 2), (2, 'Einnahmen - Gehalt', 1, 1), (3, 'Essen - Arbeit', 1, 3), (4, 'Einnahmen - Gehalt', 2, 1), (5, 'Technik - Server und Hosting', 2, 2);
|
||||||
|
|
||||||
INSERT INTO Account_User (account_id, user_id) VALUES (1, 1), (1, 2), (2, 1);
|
INSERT INTO Account_User (account_id, user_id) VALUES (1, 1), (1, 2), (1, 3), (2, 1);
|
||||||
|
|
||||||
INSERT INTO Transaction (id, amount, account_id, category_id, date, description, creditor_id) VALUES
|
INSERT INTO Transaction (id, amount, account_id, category_id, date, description, creditor_id) VALUES
|
||||||
(NULL, 1280.81, 1, 2, '2016-04-01 14:14:14', 'Gehalt', null),
|
(NULL, 1280.81, 1, 2, '2016-04-01 14:14:14', 'Gehalt', null),
|
||||||
|
|||||||
@@ -52,23 +52,6 @@ label {
|
|||||||
background-color: #D9DBC9;
|
background-color: #D9DBC9;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
.creditor-1 { background-color: #8dcfe3; }
|
|
||||||
.creditor-2 { background-color: #b3e0e6; }
|
|
||||||
.creditor-3 { background-color: #e4f3ef; }
|
|
||||||
.creditor-4 { background-color: #accdb9; }
|
|
||||||
.creditor-5 { background-color: #c8d5b9; }
|
|
||||||
.creditor-6 { background-color: #d9d0b2; }
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
.creditor-1 { background-color: #4a98b0; }
|
|
||||||
.creditor-2 { background-color: #67aab3; }
|
|
||||||
.creditor-3 { background-color: #8ec0b5; }
|
|
||||||
.creditor-4 { background-color: #accdb9; }
|
|
||||||
.creditor-5 { background-color: #c8d5b9; }
|
|
||||||
.creditor-6 { background-color: #d9d0b2; }
|
|
||||||
*/
|
|
||||||
|
|
||||||
.creditor-1 { background-color: #a4d4e3; }
|
.creditor-1 { background-color: #a4d4e3; }
|
||||||
.creditor-2 { background-color: #cfe6e1; }
|
.creditor-2 { background-color: #cfe6e1; }
|
||||||
.creditor-3 { background-color: #a4d4e3; }
|
.creditor-3 { background-color: #a4d4e3; }
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ function amountToNumber(amount) {
|
|||||||
|
|
||||||
function numberToAmount(number) {
|
function numberToAmount(number) {
|
||||||
var amount = number.toFixed(2).toString().replace('.', ',');
|
var amount = number.toFixed(2).toString().replace('.', ',');
|
||||||
if (amount.charAt(0) !== '-') {
|
if (amount.charAt(0) !== '-' && amount !== '0,00') {
|
||||||
amount = "+" + amount;
|
amount = "+" + amount;
|
||||||
}
|
}
|
||||||
return amount;
|
return amount;
|
||||||
@@ -40,11 +40,15 @@ transactionControllers.controller('TransactionListCtrl', [ '$scope', '$location'
|
|||||||
$scope.accountUsers[i].expenses = new Array(data[i]._embedded.transactions.length);
|
$scope.accountUsers[i].expenses = new Array(data[i]._embedded.transactions.length);
|
||||||
var expenseSum = 0;
|
var expenseSum = 0;
|
||||||
for (j = 0; j < data[i]._embedded.transactions.length; j++) {
|
for (j = 0; j < data[i]._embedded.transactions.length; j++) {
|
||||||
$scope.accountUsers[i].expenses[j] = data[i]._embedded.transactions[j];
|
$scope.accountUsers[i].expenses[j] = new Object();
|
||||||
// XXX $scope.accountUsers[i].expenses[j].amount = numberToAmount(data[i]._embedded.transactions[j].amount);
|
$scope.accountUsers[i].expenses[j].date = data[i]._embedded.transactions[j].date;
|
||||||
|
$scope.accountUsers[i].expenses[j].category = data[i]._embedded.transactions[j].category.name;
|
||||||
|
$scope.accountUsers[i].expenses[j].amount = numberToAmount(data[i]._embedded.transactions[j].amount);
|
||||||
|
$scope.accountUsers[i].expenses[j].description = data[i]._embedded.transactions[j].description;
|
||||||
expenseSum = expenseSum + data[i]._embedded.transactions[j].amount;
|
expenseSum = expenseSum + data[i]._embedded.transactions[j].amount;
|
||||||
}
|
}
|
||||||
$scope.accountUsers[i].outstandingSum -= expenseSum;
|
$scope.accountUsers[i].outstandingSum -= expenseSum;
|
||||||
|
$scope.accountUsers[i].outstandingAmount = numberToAmount($scope.accountUsers[i].outstandingSum);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -60,10 +64,13 @@ transactionControllers.controller('TransactionListCtrl', [ '$scope', '$location'
|
|||||||
$scope.accountUsers[i].withdrawals = new Array(data[i]._embedded.withdrawals.length);
|
$scope.accountUsers[i].withdrawals = new Array(data[i]._embedded.withdrawals.length);
|
||||||
var withdrawnSum = 0;
|
var withdrawnSum = 0;
|
||||||
for (j = 0; j < data[i]._embedded.withdrawals.length; j++) {
|
for (j = 0; j < data[i]._embedded.withdrawals.length; j++) {
|
||||||
$scope.accountUsers[i].withdrawals[j] = data[i]._embedded.withdrawals[j];
|
$scope.accountUsers[i].withdrawals[j] = new Object();
|
||||||
|
$scope.accountUsers[i].withdrawals[j].date = data[i]._embedded.withdrawals[j].date;
|
||||||
|
$scope.accountUsers[i].withdrawals[j].amount = numberToAmount(data[i]._embedded.withdrawals[j].amount);
|
||||||
withdrawnSum = withdrawnSum + data[i]._embedded.withdrawals[j].amount;
|
withdrawnSum = withdrawnSum + data[i]._embedded.withdrawals[j].amount;
|
||||||
}
|
}
|
||||||
$scope.accountUsers[i].outstandingSum -= withdrawnSum;
|
$scope.accountUsers[i].outstandingSum -= withdrawnSum;
|
||||||
|
$scope.accountUsers[i].outstandingAmount = numberToAmount($scope.accountUsers[i].outstandingSum);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -356,7 +363,6 @@ transactionControllers.controller('DetailsModalCtrl', [ '$scope', '$resource', '
|
|||||||
transactionControllers.controller('ExpensesModalCtrl', [ '$scope', '$uibModalInstance', 'accountUser', function($scope, $uibModalInstance, accountUser) {
|
transactionControllers.controller('ExpensesModalCtrl', [ '$scope', '$uibModalInstance', 'accountUser', function($scope, $uibModalInstance, accountUser) {
|
||||||
|
|
||||||
$scope.accountUser = accountUser;
|
$scope.accountUser = accountUser;
|
||||||
console.log($scope.accountUser);
|
|
||||||
|
|
||||||
$scope.ok = function () {
|
$scope.ok = function () {
|
||||||
$uibModalInstance.close();
|
$uibModalInstance.close();
|
||||||
@@ -365,4 +371,8 @@ transactionControllers.controller('ExpensesModalCtrl', [ '$scope', '$uibModalIns
|
|||||||
$scope.close = function () {
|
$scope.close = function () {
|
||||||
$uibModalInstance.dismiss('close');
|
$uibModalInstance.dismiss('close');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.clearOutstandings = function() {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
} ]);
|
} ]);
|
||||||
|
|||||||
@@ -100,7 +100,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="margin-top: 2em; text-align: center;">
|
<div style="margin-top: 2em; text-align: center;">
|
||||||
<span ng-repeat="user in accountUsers" ng-click="openExpenses(user)" class="clickable">{{user.name}} {{user.outstandingSum | number : 2}} €<br/></span>
|
<span ng-repeat="user in accountUsers" ng-click="openExpenses(user)" class="clickable">{{user.name}} {{user.outstandingAmount}} €<br/></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@@ -178,10 +178,10 @@
|
|||||||
|
|
||||||
<script type="text/ng-template" id="expensesTemplate.html">
|
<script type="text/ng-template" id="expensesTemplate.html">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h3 class="modal-title">{{accountUser.name}}</h3>
|
<h3 class="modal-title">{{accountUser.name}} <span style="margin: 0" ng-class="accountUser.outstandingSum >= 0 ? 'color-green' : 'color-red'">{{accountUser.outstandingAmount}} €</span></h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div ng-show="accountUser.expenses">
|
<div ng-show="accountUser.expenses.length > 0">
|
||||||
<h4 class="modal-title">Auslagen</h4>
|
<h4 class="modal-title">Auslagen</h4>
|
||||||
<table class="listing">
|
<table class="listing">
|
||||||
<tr>
|
<tr>
|
||||||
@@ -192,14 +192,14 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr ng-repeat="expense in accountUser.expenses">
|
<tr ng-repeat="expense in accountUser.expenses">
|
||||||
<td>{{expense.date | date:'dd.MM.yyyy'}}</td>
|
<td>{{expense.date | date:'dd.MM.yyyy'}}</td>
|
||||||
<td>{{expense.category.name}}</td>
|
<td>{{expense.category}}</td>
|
||||||
<td align="right">{{expense.amount}} €</td>
|
<td align="right">{{expense.amount}} €</td>
|
||||||
<td>{{expense.description}}</td>
|
<td>{{expense.description}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ng-show="accountUser.withdrawals">
|
<div ng-show="accountUser.withdrawals.length > 0">
|
||||||
<h4 class="modal-title" style="margin-top: 3.5ex;">Entnahmen</h4>
|
<h4 class="modal-title" style="margin-top: 3.5ex;">Entnahmen</h4>
|
||||||
<table class="listing">
|
<table class="listing">
|
||||||
<tr>
|
<tr>
|
||||||
@@ -213,9 +213,18 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div ng-show="accountUser.expenses.length == 0 && accountUser.withdrawals.length == 0">
|
||||||
|
<i>Keine Auslagen oder Entnahmen für {{accountUser.name}}</i>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button class="btn btn-default" type="button" ng-click="close()">Schließen</button>
|
<div style="float:left">
|
||||||
|
<button class="btn btn-danger" ng-click="clearOutstandings()">Zurücksetzen</button>
|
||||||
|
</div>
|
||||||
|
<div style="float:right">
|
||||||
|
<button class="btn btn-default" type="button" ng-click="close()">Schließen</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- pre style="font-size: 75%; color: black;">{{transaction | json}}</pre -->
|
<!-- pre style="font-size: 75%; color: black;">{{transaction | json}}</pre -->
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user