18 package org.turro.financials.treasury.m303;
20 import java.util.Date;
23 import java.util.TreeMap;
24 import org.amic.util.date.CheckDate;
25 import org.turro.jpa.Dao;
35 private Map<Integer, VatEntry> vatMap;
36 private Double amountOp, totalOp, toDeclareOp, toDeclareVat;
40 this.quarter = quarter;
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(), ((quarter - 1) * 3) + 1, 1, 0, 0, 0).getDate();
140 return new CheckDate(entry.
getExercise(), ((quarter - 1) * 3) + 4, 1, 0, 0, 0).addDays(-1).getDate();
144 return new CheckDate(entry.
getExercise(), ((quarter - 1) * 3) + 1, 1, 0, 0, 0).addDays(26).getDate();
148 return new CheckDate(entry.
getExercise(), ((quarter - 1) * 3) + 4, 1, 0, 0, 0).addDays(-1).addDays(25).getDate();
double getTotalOutputVat()
Map< Integer, VatEntry > getVatMap()
double getToDeclareTotalOp()
double getToDeclareTotalVat()
double getTotalInputVat()
EntryQuarter(ModelEntry entry, int quarter)
Date getQuarterInitialDate()
Date getFinalDeclaredDate()
void addToDeclareOp(Double toDeclareOp)
Date getQuarterDeclaredDate()
void addToDeclareVat(Double toDeclareVat)
Set< Integer > getPossibleVats()
Object getSingleResult(WhereClause wc)