Show CSV data

This commit is contained in:
2016-07-29 17:40:52 +02:00
parent 4d3da2ac09
commit 889e7ab7e0
4 changed files with 30 additions and 8 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>de.tilman</groupId> <groupId>de.tilman</groupId>
<artifactId>next-transactions</artifactId> <artifactId>next-transactions</artifactId>
<version>1.4.0</version> <version>1.5.0</version>
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
+10 -3
View File
@@ -392,6 +392,7 @@ transactionControllers.controller('ImportListCtrl', [ '$scope', '$resource', '$l
$scope.processCSV = function () { $scope.processCSV = function () {
$scope.account = ImportService.getAccount(); $scope.account = ImportService.getAccount();
$scope.categories = ImportService.getCategories(); $scope.categories = ImportService.getCategories();
$scope.csvInput = ImportService.getCSV();
$scope.csv = Papa.parse(ImportService.getCSV()).data; $scope.csv = Papa.parse(ImportService.getCSV()).data;
var matcherData = $resource('/api/matchers/search/listForAccount', { projection: 'full', accountId: $scope.account.id }).get(); var matcherData = $resource('/api/matchers/search/listForAccount', { projection: 'full', accountId: $scope.account.id }).get();
@@ -464,9 +465,6 @@ transactionControllers.controller('ImportListCtrl', [ '$scope', '$resource', '$l
$scope.importTransaction = function(line) { $scope.importTransaction = function(line) {
if (line.targetCategory) { if (line.targetCategory) {
console.log(line[1]);
console.log(line[1].substr(6,4) + "-" + line[1].substr(3,2) + "-" + line[1].substr(0,2));
var newTransaction = new Transaction({ var newTransaction = new Transaction({
"account" : $scope.account._links.self.href, "account" : $scope.account._links.self.href,
"amount" : line[4].replace(',', '.'), "amount" : line[4].replace(',', '.'),
@@ -481,6 +479,15 @@ transactionControllers.controller('ImportListCtrl', [ '$scope', '$resource', '$l
console.log(transaction); console.log(transaction);
line.submittedTransactionLink = transaction._links.self.href; line.submittedTransactionLink = transaction._links.self.href;
line.submittedTransactionId = transaction.id; line.submittedTransactionId = transaction.id;
// delete from CSV
var descriptionPos = $scope.csvInput.search(line[3]);
var lineStart = $scope.csvInput.lastIndexOf('\n', descriptionPos);
var lineEnd = $scope.csvInput.indexOf('\n', descriptionPos);
if (lineEnd < 0)
lineEnd = $scope.csvInput.length;
$scope.csvInput = $scope.csvInput.substring(0, lineStart) + $scope.csvInput.substring(lineEnd, $scope.csvInput.length);
}); });
} }
} }
@@ -41,7 +41,10 @@
</tr> </tr>
</table> </table>
</div> </div>
<div class="row" style="margin-top: 4ex;"> <div class="row" style="margin-top: 4ex; text-align: center;">
<textarea ng-model='csvInput' name="csvText" cols="220" rows="30" style="font-family: monospace; font-size: 70%;" disabled></textarea>
</div>
<!-- div class="row" style="margin-top: 4ex;">
<table class="importTable"> <table class="importTable">
<tr> <tr>
<th style="width: 5%;">Position</th> <th style="width: 5%;">Position</th>
@@ -66,5 +69,5 @@
<td class="spacer"></td> <td class="spacer"></td>
</tr> </tr>
</table> </table>
</div> </div -->
</div> </div>
+13 -1
View File
@@ -7,7 +7,7 @@
</div> </div>
<form name="importForm" ng-submit="importCSV()" style="text-align: center;"> <form name="importForm" ng-submit="importCSV()" style="text-align: center;">
<textarea ng-model='csvInput' name="csvText" cols="140" rows="20"></textarea> <textarea ng-model='csvInput' name="csvText" cols="220" rows="30" style="font-family: monospace; font-size: 70%;"></textarea>
<div style="margin: 2ex;"> <div style="margin: 2ex;">
<button id="transactionSubmit" type="submit" class="btn btn-primary"> <button id="transactionSubmit" type="submit" class="btn btn-primary">
@@ -18,3 +18,15 @@
</form> </form>
</div> </div>
</div> </div>
<!-- HERE BE DRAGONS
SELECT FORMATDATETIME(t.date,'dd.MM.yyyy'), c.name, t.amount, t.description
FROM Transaction t
JOIN Category c on (t.category_id = c.id)
WHERE t.account_id = 1 and t.date > parsedatetime('2016-06-01','yyyy-MM-dd')
"08.08.2016";"08.08.2016";"Übertrag/Überweisung";"Empfänger: Adam Kto/IBAN: DE485197745151542243216 BLZ/BIC: COBADEHD001 Buchungstext: none End-to-End-Ref.: nicht angegeben Ref. JK21619010302362/2";"-40,00";
"27.07.2016";"27.07.2016";"Lastschrift/Belast.";"Auftraggeber: DANKE, IHR LIDL Kto/IBAN: DE61300500000008000119 Buchungstext: Kartenzahlung DANKE, IHR LIDL//Berlin/DE 2016-06-25T09:47:08 KFN 2 VJ 1912 Ref. 6GL16179AXXX0086/7787";"-70,17";
"24.07.2016";"24.07.2016";"Übertrag/Überweisung";"Auftraggeber: Adam Buchungstext: Uebertrag comdirect bank End-to-End-Ref.: nicht angegeben Ref. IX216126F0211532/1";"200,00";
"24.07.2016";"24.07.2016";"Übertrag/Überweisung";"Auftraggeber: Wohnungsbau-Verein Oberwaffeln eG Buchungstext: Mg.-Nr. 12345, Adam - 4, Dividende 2015 End-to-End-Ref.: nicht angegeben Ref. H2216176742235523/75535";"4,42";
-->