19 package org.turro.financials.treasury.m303m;
21 import java.util.Date;
24 import java.util.TreeMap;
25 import org.amic.util.date.CheckDate;
26 import org.turro.jpa.Dao;
35 private Map<Integer, VatEntry> vatMap;
36 private Double amountOp, totalOp, toDeclareOp, toDeclareVat;
45 return amountOp ==
null ? 0.0 : amountOp;
49 return totalOp ==
null ? 0.0 : totalOp;
53 this.toDeclareVat += toDeclareVat;
57 return toDeclareVat ==
null ? 0.0 : toDeclareVat;
61 this.toDeclareOp += toDeclareOp;
65 return toDeclareOp ==
null ? 0.0 : toDeclareOp;
79 if(
getEntry().getType().getBookId() == 1 ||
getEntry().getType().getBookId() == 3) {
80 result += ve.getAmountVat();
89 if(
getEntry().getType().getBookId() == 2) {
90 result += ve.getAmountVat();
104 private void fillData() {
106 vatMap =
new TreeMap<Integer, VatEntry>();
107 for(Integer vat : vats) {
108 vatMap.put(vat,
new VatEntry(vat,
this));
113 for(VatEntry ve : vatMap.values()) {
114 totalOp += ve.getAmountOp();
117 "select sum(e.debit - e.credit) from RegisterEntry e " +
118 "join e.register r " +
119 "join r.bookRegisters b with b.bookDefinition.id = ? " +
120 "where e.register.registerDate <= ? " +
121 "and e.register.registerDate >= ? " +
122 "and e.register.view.id = 1 " +
123 "and (e.register.exclude = FALSE and e.register.closing = FALSE and e.register.regularizeVAT = FALSE) " +
124 "and e.account.id like ?",
127 amountOp = -amountOp;
132 return new CheckDate(entry.
getExercise(), 1, 1, 0, 0, 0).getDate();
136 return new CheckDate(entry.
getExercise(), month, 1, 0, 0, 0).getDate();
140 return new CheckDate(entry.
getExercise(), month + 1, 1, 0, 0, 0).addDays(-1).getDate();
144 return new CheckDate(entry.
getExercise(), month, 1, 0, 0, 0).addDays(26).getDate();
148 return new CheckDate(entry.
getExercise(), month + 1, 1, 0, 0, 0).addDays(-1).addDays(25).getDate();
Date getFinalDeclaredDate()
void addToDeclareVat(Double toDeclareVat)
Date getMonthInitialDate()
Date getMonthDeclaredDate()
double getTotalInputVat()
EntryMonth(ModelEntry entry, int month)
double getTotalOutputVat()
double getToDeclareTotalVat()
double getToDeclareTotalOp()
void addToDeclareOp(Double toDeclareOp)
Map< Integer, VatEntry > getVatMap()
Set< Integer > getPossibleVats()
Object getSingleResult(WhereClause wc)