Skip to content

Commit 6f56c21

Browse files
committed
Added multi-line note transaction creation
1 parent 2cae34e commit 6f56c21

File tree

2 files changed

+75
-60
lines changed

2 files changed

+75
-60
lines changed

BluecoinsImportTool.h

Lines changed: 73 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -790,10 +790,10 @@ int entryInput(ENTRY entryTemplate) {
790790
heading("Transaction input");
791791
show_inputted(tempEntry);
792792
line(50, '-');
793-
cout << "Notes? (Only press 'enter' when done, no multi-line support yet)" << endl;
793+
cout << "Notes? (Multi-line available. Input \" to save and exit note-ing mode.)" << endl;
794794
line(50, '-');
795795

796-
getline(cin, userInput);
796+
getline(cin, userInput, '\"');
797797
USER_INPUT_STRING_RETURN else if (userInput == "-1") { goto Amount_input; }
798798

799799
tempEntry.notes.set(userInput);
@@ -996,60 +996,69 @@ void readFile() {
996996
void writeToFile() {
997997
// If user selects to append or is not first entry then will not output this line.
998998
if (!append) {
999-
file << "(1)Type,(2)Date,(3)Item or Payee,(4)Amount,(5)Parent Category,(6)Category,(7)Account Type,(8)Account,(9)Notes,(10) Label,(11) Status,(12) Split" << endl;
999+
file << "\"(1)Type\",\"(2)Date\",\"(3)Item or Payee\",\"(4)Amount\",\"(5)Parent Category\",\"(6)Category\",\"(7)Account Type\",\"(8)Account\",\"(9)Notes\",\"(10) Label\",\"(11) Status\",\"(12) Split\"" << endl;
10001000
}
10011001

10021002
// There are different logics for transfers and normal transactions.
10031003
if (entry.type.value == "Transfer") {
10041004
// Source Account
1005-
file << "Transfer" << ",";
1006-
file << right << setfill('0')
1007-
<< setw(2) << entry.month.value << "/"
1008-
<< setw(2) << entry.day.value << "/"
1005+
file << "\"";
1006+
file << "Transfer";
1007+
file << "\"" << ",";
1008+
1009+
file << "\"";
1010+
file << entry.month.value << "/"
1011+
<< entry.day.value << "/"
10091012
<< entry.year.value << " "
1010-
<< setw(2) << entry.hour.value << ":"
1011-
<< setw(2) << entry.mins.value << ","
1012-
<< setfill(' ');
1013-
file << entry.title.value << ",";
1014-
file << entry.amount.value * -1 << ",";
1015-
file << "(Transfer)" << ",";
1016-
file << "(Transfer)" << ",";
1017-
file << entry.sourceAccCat.value << ",";
1018-
file << entry.sourceAccChild.value << ",";
1019-
file << entry.notes.value << ",";
1020-
file << entry.label.value << ",";
1013+
<< entry.hour.value << ":"
1014+
<< entry.mins.value;
1015+
file << "\"" << ",";
1016+
1017+
file << "\"" << entry.title.value << "\",";
1018+
file << "\"" << entry.amount.value * -1 << "\",";
1019+
file << "\"" << "(Transfer)" << "\",";
1020+
file << "\"" << "(Transfer)" << "\",";
1021+
file << "\"" << entry.sourceAccCat.value << "\",";
1022+
file << "\"" << entry.sourceAccChild.value << "\",";
1023+
file << "\"" << entry.notes.value << "\",";
1024+
file << "\"" << entry.label.value << "\",";
1025+
1026+
file << "\"";
10211027
if (entry.status.value != '\0') {
10221028
file << entry.status.value;
10231029
}
1024-
file << ",";
1025-
if (splitTransac) {
1026-
file << "split";
1027-
}
1030+
file << "\"" << ",";
1031+
file << "\"\"";
10281032
file << endl;
1033+
10291034
// Destination Account
1030-
file << "Transfer" << ",";
1031-
file << right << setfill('0')
1032-
<< setw(2) << entry.month.value << "/"
1033-
<< setw(2) << entry.day.value << "/"
1035+
file << "\"";
1036+
file << "Transfer";
1037+
file << "\"" << ",";
1038+
1039+
file << "\"";
1040+
file << entry.month.value << "/"
1041+
<< entry.day.value << "/"
10341042
<< entry.year.value << " "
1035-
<< setw(2) << entry.hour.value << ":"
1036-
<< setw(2) << entry.mins.value << ","
1037-
<< setfill(' ');
1038-
file << entry.title.value << ",";
1039-
file << entry.amount.value << ",";
1040-
file << "(Transfer)" << ",";
1041-
file << "(Transfer)" << ",";
1042-
file << entry.destAccCat.value << ",";
1043-
file << entry.destAccChild.value << ",";
1044-
file << entry.notes.value << ",";
1045-
file << entry.label.value << ",";
1043+
<< entry.hour.value << ":"
1044+
<< entry.mins.value;
1045+
file << "\"" << ",";
1046+
1047+
file << "\"" << entry.title.value << "\",";
1048+
file << "\"" << entry.amount.value * -1 << "\",";
1049+
file << "\"" << "(Transfer)" << "\",";
1050+
file << "\"" << "(Transfer)" << "\",";
1051+
file << "\"" << entry.destAccCat.value << "\",";
1052+
file << "\"" << entry.destAccChild.value << "\",";
1053+
file << "\"" << entry.notes.value << "\",";
1054+
file << "\"" << entry.label.value << "\",";
1055+
1056+
file << "\"";
10461057
if (entry.status.value != '\0') {
10471058
file << entry.status.value;
10481059
}
1049-
file << ",";
1050-
if (splitTransac) {
1051-
file << "split";
1052-
}
1060+
file << "\"" << ",";
1061+
file << "\"\"";
10531062
file << endl;
10541063

10551064
// If accounts have currentBal defined then deduct it
@@ -1091,30 +1100,36 @@ void writeToFile() {
10911100

10921101
}
10931102
else { // For normal use cases.
1094-
file << entry.type.value << ",";
1095-
file << right << setfill('0')
1096-
<< setw(2) << entry.month.value << "/"
1097-
<< setw(2) << entry.day.value << "/"
1103+
file << "\"" << entry.type.value << "\",";
1104+
1105+
file << "\"";
1106+
file << entry.month.value << "/"
1107+
<< entry.day.value << "/"
10981108
<< entry.year.value << " "
1099-
<< setw(2) << entry.hour.value << ":"
1100-
<< setw(2) << entry.mins.value << ","
1101-
<< setfill(' ');
1102-
1103-
file << entry.title.value << ",";
1104-
file << entry.amount.value << ",";
1105-
file << entry.transCat.value << ",";
1106-
file << entry.transChild.value << ",";
1107-
file << entry.accCat.value << ",";
1108-
file << entry.accChild.value << ",";
1109-
file << entry.notes.value << ",";
1110-
file << entry.label.value << ",";
1109+
<< entry.hour.value << ":"
1110+
<< entry.mins.value;
1111+
file << "\"" << ",";
1112+
1113+
file << "\"" << entry.title.value << "\",";
1114+
file << "\"" << entry.amount.value * -1 << "\",";
1115+
file << "\"" << entry.transCat.value << "\",";
1116+
file << "\"" << entry.transChild.value << "\",";
1117+
file << "\"" << entry.accCat.value << "\",";
1118+
file << "\"" << entry.accChild.value << "\",";
1119+
file << "\"" << entry.notes.value << "\",";
1120+
file << "\"" << entry.label.value << "\",";
1121+
1122+
file << "\"";
11111123
if (entry.status.value != '\0') {
11121124
file << entry.status.value;
11131125
}
1114-
file << ",";
1126+
file << "\"" << ",";
1127+
1128+
file << "\"";
11151129
if (splitTransac) {
11161130
file << "split";
11171131
}
1132+
file << "\"";
11181133
file << endl;
11191134

11201135
// If accounts have currentBal defined then deduct it

fixedEntry.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,11 +498,11 @@ void lockNotes(bool bypass = false) {
498498
heading("Lock Field -> Notes");
499499
show_fixed(templateEntry);
500500
line(50, '-');
501-
cout << "Notes? (Only press 'enter' when done, no multi-line support yet)" << endl;
501+
cout << "Notes? (Multi-line available. Input \" to save and exit note-ing mode.)" << endl;
502502
line(50, '-');
503503

504504
string userInput;
505-
getline(cin, userInput);
505+
getline(cin, userInput, '\"');
506506

507507
BYPASS_COMPULSORY_INPUT_STRING;
508508

0 commit comments

Comments
 (0)