Develop and Download Open Source Software

Browse Subversion Repository

Diff of /aoiro/trunk/src/main/java/net/osdn/aoiro/report/BalanceSheet.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 119 by hirukawa_ryo, Tue Feb 28 00:02:13 2023 UTC revision 120 by hirukawa_ryo, Sat Mar 4 02:37:28 2023 UTC
# Line 810  public class BalanceSheet { Line 810  public class BalanceSheet {
810                          Collections.sort(list, (o1, o2) -> {                          Collections.sort(list, (o1, o2) -> {
811                                  return accountTitles.indexOf(o1.getKey()) - accountTitles.indexOf(o2.getKey());                                  return accountTitles.indexOf(o1.getKey()) - accountTitles.indexOf(o2.getKey());
812                          });                          });
813                            Entry<AccountTitle, Amount> reserved = null;
814                          for(Entry<AccountTitle, Amount> e : list) {                          for(Entry<AccountTitle, Amount> e : list) {
815                                  AccountTitle accountTitle = e.getKey();                                  AccountTitle accountTitle = e.getKey();
816                                  Amount amount = e.getValue();                                  Amount amount = e.getValue();
# Line 823  public class BalanceSheet { Line 824  public class BalanceSheet {
824                                  }                                  }
825                                  if(accountTitle.getType() == AccountType.Assets) {                                  if(accountTitle.getType() == AccountType.Assets) {
826                                          if(amount.getValue() == 0) {                                          if(amount.getValue() == 0) {
827                                                    if(reserved == null) {
828                                                            reserved = e;
829                                                    }
830                                                  continue;                                                  continue;
831                                          } else if(amount.getValue() > 0) {                                          } else if(amount.getValue() > 0) {
832                                                  debtors.add(e);                                                  debtors.add(e);
# Line 833  public class BalanceSheet { Line 837  public class BalanceSheet {
837                                          }                                          }
838                                  } else if(accountTitle.getType() == AccountType.Liabilities || accountTitle.getType() == AccountType.Equity) {                                  } else if(accountTitle.getType() == AccountType.Liabilities || accountTitle.getType() == AccountType.Equity) {
839                                          if(amount.getValue() == 0) {                                          if(amount.getValue() == 0) {
840                                                    if(reserved == null) {
841                                                            reserved = e;
842                                                    }
843                                                  continue;                                                  continue;
844                                          } else if(amount.getValue() > 0) {                                          } else if(amount.getValue() > 0) {
845                                                  creditors.add(e);                                                  creditors.add(e);
# Line 844  public class BalanceSheet { Line 851  public class BalanceSheet {
851                                  }                                  }
852                          }                          }
853                          AccountTitle capital = AccountTitle.getByDisplayName(new HashSet<>(accountTitles), "元入金");                          AccountTitle capital = AccountTitle.getByDisplayName(new HashSet<>(accountTitles), "元入金");
854                          if(capital != null) {                          // 期末残高 0 の勘定科目は翌期の元入金に繰り越しませんが、
855                            // 繰り越す勘定科目が 1つもない場合は先頭の勘定科目を翌期の元入金として繰り越します。
856                            if(creditors.size() == 0 && debtors.size() == 0 && reserved != null && capital != null) {
857                                    Map.Entry<AccountTitle, Amount> e = Map.entry(capital, new Amount(Creditor.class, 0));
858                                    if(reserved.getKey().getType().getNormalBalance() == Debtor.class) {
859                                            debtors.add(reserved);
860                                            creditors.add(e);
861                                    } else {
862                                            debtors.add(e);
863                                            creditors.add(reserved);
864                                    }
865                            } else if(capital != null) {
866                                    // 借方・貸方の勘定差異を元入金勘定で埋めます。
867                                  Map.Entry<AccountTitle, Amount> e = Map.entry(capital, new Amount(Creditor.class, (debtorsTotal - creditorsTotal)));                                  Map.Entry<AccountTitle, Amount> e = Map.entry(capital, new Amount(Creditor.class, (debtorsTotal - creditorsTotal)));
868                                  if(debtorsTotal >= creditorsTotal) {                                  if(debtorsTotal >= creditorsTotal) {
869                                          creditors.add(e);                                          creditors.add(e);

Legend:
Removed from v.119  
changed lines
  Added in v.120

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26