• R/O
  • SSH
  • HTTPS

aoiro: Commit


Commit MetaInfo

Révision47 (tree)
l'heure2020-05-30 11:21:01
Auteurhirukawa_ryo

Message de Log

* aoiro 0.6
総勘定元帳の月計印字する際に開始仕訳を1月計に含めずに前期繰越計として印字するようにしました。
複合仕訳で月計が繰り返し出力されてしまうバグを修正しました。

Change Summary

Modification

--- aoiro/trunk/src/main/java/net/osdn/aoiro/report/GeneralLedger.java (revision 46)
+++ aoiro/trunk/src/main/java/net/osdn/aoiro/report/GeneralLedger.java (revision 47)
@@ -100,16 +100,22 @@
100100 int month = entry.getDate().getMonthValue();
101101 int day = entry.getDate().getDayOfMonth();
102102
103+ int monthlyTotalMonth = -1;
103104 boolean isLastEntryInMonth = false;
104- if(showMonthlyTotal && !entry.isClosing()) {
105- if(j + 1 == entries.size()) {
106- isLastEntryInMonth = true;
107- } else if(j + 1 < entries.size()) {
108- JournalEntry nextEntry = entries.get(j + 1);
109- if(month != nextEntry.getDate().getMonthValue()) {
105+ if(showMonthlyTotal) {
106+ // 開始仕訳は1月計に含めないようにするために0月として扱います。
107+ monthlyTotalMonth = entry.isOpening() ? 0 : month;
108+ if(!entry.isClosing()) {
109+ if(j + 1 == entries.size()) {
110110 isLastEntryInMonth = true;
111- } else if(nextEntry.isClosing()) {
112- isLastEntryInMonth = true;
111+ } else if(j + 1 < entries.size()) {
112+ JournalEntry nextEntry = entries.get(j + 1);
113+ int nextEntryMonth = nextEntry.isOpening() ? 0 : nextEntry.getDate().getMonthValue();
114+ if(monthlyTotalMonth != nextEntryMonth) {
115+ isLastEntryInMonth = true;
116+ } else if(nextEntry.isClosing()) {
117+ isLastEntryInMonth = true;
118+ }
113119 }
114120 }
115121 }
@@ -262,7 +268,8 @@
262268 currentRow += rowsRequired;
263269 restOfRows -= rowsRequired;
264270
265- if(showMonthlyTotal && isLastEntryInMonth) {
271+ //月計印字有効 + 月末最後の仕訳 + 相手勘定科目の末尾 のときに月計を印字します。
272+ if(showMonthlyTotal && isLastEntryInMonth && (l + 1) == counterpartAccounts.size()) {
266273 int emptyRows = (ROWS - 1) - currentRow - (isLastInAccountTitle ? 0 : 1);
267274 if(emptyRows < 0) {
268275 emptyRows = 0;
@@ -297,7 +304,11 @@
297304 printData.add("\t\t\\box " + String.format("16 %.2f 49 %.2f", currentRow * ROW_HEIGHT, ROW_HEIGHT));
298305 printData.add("\t\t\\font serif 10 bold");
299306 printData.add("\t\t\\align center right");
300- printData.add("\t\t\\text " + month + "月計");
307+ if(monthlyTotalMonth == 0) {
308+ printData.add("\t\t\\text 前期繰越計");
309+ } else {
310+ printData.add("\t\t\\text " + month + "月計");
311+ }
301312
302313 printData.add("\t\t\\box " + String.format("0 %.2f -0 %.2f", currentRow * ROW_HEIGHT, ROW_HEIGHT + 0.5));
303314 printData.add("\t\t\\line-style medium solid");
@@ -324,7 +335,7 @@
324335 currentRow += rowsRequired;
325336 restOfRows -= rowsRequired;
326337 }
327-
338+
328339 }
329340 }
330341 }
Afficher sur ancien navigateur de dépôt.