www in docker support
This commit is contained in:
parent
539a848e95
commit
c227fce036
2145 changed files with 399596 additions and 58 deletions
|
|
@ -0,0 +1,54 @@
|
|||
package it.acxent.contab.iva;
|
||||
|
||||
import it.acxent.anag.IvaInterface;
|
||||
import it.acxent.util.DoubleOperator;
|
||||
|
||||
public class RegimeMargine {
|
||||
private IvaInterface iva;
|
||||
|
||||
private double importo;
|
||||
|
||||
private double costo;
|
||||
|
||||
private double imponibileMargine;
|
||||
|
||||
private double impostaMargine;
|
||||
|
||||
public RegimeMargine(IvaInterface l_ivaStdVendite, double l_mporto, double l_costo) {
|
||||
this.iva = l_ivaStdVendite;
|
||||
this.importo = l_mporto;
|
||||
this.costo = l_costo;
|
||||
DoubleOperator temp2 = new DoubleOperator((float)getIva().getAliquota());
|
||||
temp2.setScale(2, 5);
|
||||
temp2.divide(100.0F);
|
||||
temp2.add(1);
|
||||
DoubleOperator impo = new DoubleOperator(this.importo);
|
||||
impo.subtract(this.costo);
|
||||
DoubleOperator l_imposta = new DoubleOperator(impo.getResult());
|
||||
impo.setScale(2, 5);
|
||||
impo.divide(temp2);
|
||||
this.imponibileMargine = impo.getResult();
|
||||
l_imposta.subtract(this.imponibileMargine);
|
||||
this.impostaMargine = l_imposta.getResult();
|
||||
}
|
||||
|
||||
public IvaInterface getIva() {
|
||||
return this.iva;
|
||||
}
|
||||
|
||||
public void setIva(IvaInterface iva) {
|
||||
this.iva = iva;
|
||||
}
|
||||
|
||||
public double getImponibileMargine() {
|
||||
return this.imponibileMargine;
|
||||
}
|
||||
|
||||
public double getImpostaMargine() {
|
||||
return this.impostaMargine;
|
||||
}
|
||||
|
||||
public double getCosto() {
|
||||
return this.costo;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,193 @@
|
|||
package it.acxent.contab.iva;
|
||||
|
||||
import it.acxent.anag.Iva;
|
||||
import it.acxent.anag.IvaInterface;
|
||||
import it.acxent.contab.RigaDocumentoInterface;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
|
||||
public class RiepilogoIva {
|
||||
private Hashtable<String, RiepilogoIvaItem> ri;
|
||||
|
||||
private Hashtable<String, RiepilogoIvaItem> riConPI;
|
||||
|
||||
private Hashtable<String, RiepilogoIvaItem> riSenzaPI;
|
||||
|
||||
private ApplParmFull ap;
|
||||
|
||||
private Iva ivaEsente;
|
||||
|
||||
private Iva ivaStdVendite;
|
||||
|
||||
private void addFatturaConPi(IvaInterface l_iva, double imponibile, double imposta, double costo, boolean isSplit) {
|
||||
addFattura(l_iva, imponibile, imposta, costo, 0.0D, 0.0D, getRiConPI(), isSplit);
|
||||
}
|
||||
|
||||
private void addFatturaConPi(Iva l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento, boolean isSplit) {
|
||||
addFattura(l_iva, imponibile, imposta, costo, speseAccessorie, arrotondamento, getRiConPI(), isSplit);
|
||||
}
|
||||
|
||||
private void addNotaDiCreditoConPI(IvaInterface l_iva, double imponibile, double imposta, double costo, boolean isSplit) {
|
||||
addFattura(l_iva, -imponibile, -imposta, costo, 0.0D, 0.0D, getRiConPI(), isSplit);
|
||||
}
|
||||
|
||||
private void addNotaDiCreditoConPI(Iva l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento, boolean isSplit) {
|
||||
addFattura(l_iva, -imponibile, -imposta, costo, speseAccessorie, arrotondamento, getRiConPI(), isSplit);
|
||||
}
|
||||
|
||||
public Enumeration<RiepilogoIvaItem> elements() {
|
||||
return getRi().elements();
|
||||
}
|
||||
|
||||
public Enumeration<RiepilogoIvaItem> elementsSenzaPI() {
|
||||
return getRiSenzaPI().elements();
|
||||
}
|
||||
|
||||
public Enumeration<RiepilogoIvaItem> elementsConPI() {
|
||||
return getRiConPI().elements();
|
||||
}
|
||||
|
||||
public RiepilogoIva() {}
|
||||
|
||||
public RiepilogoIva(ApplParmFull theAp) {
|
||||
setAp(theAp);
|
||||
}
|
||||
|
||||
private Hashtable<String, RiepilogoIvaItem> getRi() {
|
||||
if (this.ri == null)
|
||||
this.ri = new Hashtable<>();
|
||||
return this.ri;
|
||||
}
|
||||
|
||||
private Hashtable<String, RiepilogoIvaItem> getRiConPI() {
|
||||
if (this.riConPI == null)
|
||||
this.riConPI = new Hashtable<>();
|
||||
return this.riConPI;
|
||||
}
|
||||
|
||||
private Hashtable<String, RiepilogoIvaItem> getRiSenzaPI() {
|
||||
if (this.riSenzaPI == null)
|
||||
this.riSenzaPI = new Hashtable<>();
|
||||
return this.riSenzaPI;
|
||||
}
|
||||
|
||||
private void addFattura(IvaInterface l_iva, double imponibile, double imposta, double costo, boolean isSplit) {
|
||||
addFattura(l_iva, imponibile, imposta, costo, 0.0D, 0.0D, isSplit);
|
||||
}
|
||||
|
||||
private void addFattura(IvaInterface l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento, boolean isSplit) {
|
||||
addFattura(l_iva, imponibile, imposta, costo, speseAccessorie, arrotondamento, getRi(), isSplit);
|
||||
}
|
||||
|
||||
private void addFattura(IvaInterface l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento, Hashtable<String, RiepilogoIvaItem> RI, boolean isSplit) {
|
||||
RiepilogoIvaItem rii;
|
||||
String theKey = String.valueOf(l_iva.getId_iva());
|
||||
if (RI.containsKey(theKey)) {
|
||||
rii = RI.get(theKey);
|
||||
} else {
|
||||
rii = new RiepilogoIvaItem(l_iva);
|
||||
}
|
||||
rii.addImporto(imponibile, imposta, isSplit);
|
||||
RI.put(theKey, rii);
|
||||
}
|
||||
|
||||
private void addNotaDiCredito(IvaInterface l_iva, double imponibile, double imposta, double costo, boolean isSplit) {
|
||||
addFattura(l_iva, -imponibile, -imposta, costo, 0.0D, 0.0D, getRi(), isSplit);
|
||||
}
|
||||
|
||||
private void addNotaDiCredito(Iva l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento, boolean isSplit) {
|
||||
addFattura(l_iva, -imponibile, -imposta, costo, speseAccessorie, arrotondamento, getRi(), isSplit);
|
||||
}
|
||||
|
||||
private void addFatturaSenzaPi(IvaInterface l_iva, double imponibile, double imposta, double costo, boolean isSplit) {
|
||||
addFattura(l_iva, imponibile, imposta, costo, 0.0D, 0.0D, getRiSenzaPI(), isSplit);
|
||||
}
|
||||
|
||||
private void addFatturaSenzaPi(Iva l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento, boolean isSplit) {
|
||||
addFattura(l_iva, imponibile, imposta, costo, speseAccessorie, arrotondamento, getRiSenzaPI(), isSplit);
|
||||
}
|
||||
|
||||
private void addNotaDiCreditoSenzaPI(IvaInterface l_iva, double imponibile, double imposta, double costo, boolean isSplit) {
|
||||
addFattura(l_iva, -imponibile, -imposta, costo, 0.0D, 0.0D, getRiSenzaPI(), isSplit);
|
||||
}
|
||||
|
||||
private void addNotaDiCreditoSenzaPI(Iva l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento, boolean isSplit) {
|
||||
addFattura(l_iva, -imponibile, -imposta, costo, speseAccessorie, arrotondamento, getRiSenzaPI(), isSplit);
|
||||
}
|
||||
|
||||
public void addRigaDocumento(IvaInterface l_iva, double imponibile, double imposta, boolean isNotaDiCredito, boolean isPartitaIva, boolean isSplit) {
|
||||
if (!isNotaDiCredito) {
|
||||
addFattura(l_iva, imponibile, imposta, 0.0D, isSplit);
|
||||
} else {
|
||||
addNotaDiCredito(l_iva, imponibile, imposta, 0.0D, isSplit);
|
||||
}
|
||||
if (!isPartitaIva) {
|
||||
if (!isNotaDiCredito) {
|
||||
addFatturaSenzaPi(l_iva, imponibile, imposta, 0.0D, isSplit);
|
||||
} else {
|
||||
addNotaDiCreditoSenzaPI(l_iva, imponibile, imposta, 0.0D, isSplit);
|
||||
}
|
||||
} else if (!isNotaDiCredito) {
|
||||
addFatturaConPi(l_iva, imponibile, imposta, 0.0D, isSplit);
|
||||
} else {
|
||||
addNotaDiCreditoConPI(l_iva, imponibile, imposta, 0.0D, isSplit);
|
||||
}
|
||||
}
|
||||
|
||||
public void addRigaRegistroIvaItem(RigaRegistroIvaItem rrii, boolean isNotaDiCredito, boolean isPartitaIva, boolean isSplit) {
|
||||
addRigaDocumento(rrii.getIva(), rrii.getImponibile(), rrii.getImportoIva(), isNotaDiCredito, isPartitaIva, isSplit);
|
||||
}
|
||||
|
||||
private void addRigaDocumento(RigaDocumentoInterface rigaDocumento, boolean isSplit) {
|
||||
double imponibile, iva;
|
||||
if (!rigaDocumento.getIva().isRegimeMargine()) {
|
||||
imponibile = rigaDocumento.getRDITotImponibile();
|
||||
iva = rigaDocumento.getRDITotImposta();
|
||||
} else {
|
||||
imponibile = rigaDocumento.getRDITotImponibileRM();
|
||||
iva = 0.0D;
|
||||
}
|
||||
String codIva = rigaDocumento.getIva().getDescrizione();
|
||||
if (!rigaDocumento.isRDINotaCredito()) {
|
||||
addFattura(rigaDocumento.getIva(), imponibile, iva, rigaDocumento.getRDITotCosto(), isSplit);
|
||||
} else {
|
||||
addNotaDiCredito(rigaDocumento.getIva(), imponibile, iva, rigaDocumento.getRDITotCosto(), isSplit);
|
||||
}
|
||||
if (!rigaDocumento.isRDIPIva()) {
|
||||
if (!rigaDocumento.isRDINotaCredito()) {
|
||||
addFatturaSenzaPi(rigaDocumento.getIva(), imponibile, iva, rigaDocumento.getRDITotCosto(), isSplit);
|
||||
} else {
|
||||
addNotaDiCreditoSenzaPI(rigaDocumento.getIva(), imponibile, iva, rigaDocumento.getRDITotCosto(), isSplit);
|
||||
}
|
||||
} else if (!rigaDocumento.isRDINotaCredito()) {
|
||||
addFatturaConPi(rigaDocumento.getIva(), imponibile, iva, rigaDocumento.getRDITotCosto(), isSplit);
|
||||
} else {
|
||||
addNotaDiCreditoConPI(rigaDocumento.getIva(), imponibile, iva, rigaDocumento.getRDITotCosto(), isSplit);
|
||||
}
|
||||
}
|
||||
|
||||
private ApplParmFull getApFull() {
|
||||
return this.ap;
|
||||
}
|
||||
|
||||
private Iva getIvaEsente() {
|
||||
if (this.ivaEsente == null) {
|
||||
this.ivaEsente = new Iva(getApFull());
|
||||
this.ivaEsente.findByPrimaryKey(getApFull().getParm("CODICE_IVA_ESENTE").getNumeroLong());
|
||||
}
|
||||
return this.ivaEsente;
|
||||
}
|
||||
|
||||
private Iva getIvaStdVendite() {
|
||||
if (this.ivaStdVendite == null) {
|
||||
this.ivaStdVendite = new Iva(getApFull());
|
||||
this.ivaStdVendite.findByPrimaryKey(getApFull().getParm("CODICE_IVA_STD_VEND").getNumeroLong());
|
||||
}
|
||||
return this.ivaStdVendite;
|
||||
}
|
||||
|
||||
private void setAp(ApplParmFull ap) {
|
||||
this.ap = ap;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
package it.acxent.contab.iva;
|
||||
|
||||
import it.acxent.anag.IvaInterface;
|
||||
import it.acxent.util.DoubleOperator;
|
||||
|
||||
public class RiepilogoIvaItem {
|
||||
private double imponibile;
|
||||
|
||||
private IvaInterface iva;
|
||||
|
||||
private double imposta;
|
||||
|
||||
private double esente;
|
||||
|
||||
private double imponibileIndetraibile;
|
||||
|
||||
private double impostaIndetraibile;
|
||||
|
||||
private double percIndetraibile;
|
||||
|
||||
private double split;
|
||||
|
||||
public RiepilogoIvaItem(IvaInterface l_iva) {
|
||||
setIva(l_iva);
|
||||
}
|
||||
|
||||
public double getEsente() {
|
||||
return this.esente;
|
||||
}
|
||||
|
||||
public double getImponibile() {
|
||||
return this.imponibile;
|
||||
}
|
||||
|
||||
public double getImponibileIndetraibile() {
|
||||
return this.imponibileIndetraibile;
|
||||
}
|
||||
|
||||
public void addImporto(double imponibile, double imposta) {
|
||||
addImporto(imponibile, imposta, false);
|
||||
}
|
||||
|
||||
public void addImporto(double imponibile, double imposta, boolean isSplit) {
|
||||
DoubleOperator dImponibile = new DoubleOperator(imponibile);
|
||||
dImponibile.setScale(4, 5);
|
||||
DoubleOperator dImposta = new DoubleOperator(imposta);
|
||||
DoubleOperator dSplit = new DoubleOperator(imposta);
|
||||
dImposta.setScale(2, 5);
|
||||
if (getIva().getFlgTipo().equals("I")) {
|
||||
if (getIva().getAliquotaIndetraibile() == 0L) {
|
||||
dImponibile.add(getImponibile());
|
||||
setImponibile(dImponibile.getResult());
|
||||
if (isSplit) {
|
||||
dSplit.add(getSplit());
|
||||
setSplit(dSplit.getResult());
|
||||
} else {
|
||||
dImposta.add(getImposta());
|
||||
setImposta(dImposta.getResult());
|
||||
}
|
||||
} else {
|
||||
dImponibile.add(getImponibile());
|
||||
setImponibile(dImponibile.getResult());
|
||||
DoubleOperator ivaDetraibile = new DoubleOperator(100.0F);
|
||||
ivaDetraibile.subtract(getIva().getAliquotaIndetraibile());
|
||||
ivaDetraibile.multiply(imposta);
|
||||
ivaDetraibile.divide(100.0F);
|
||||
dImposta.subtract(ivaDetraibile);
|
||||
ivaDetraibile.add(getImposta());
|
||||
setImposta(ivaDetraibile.getResult());
|
||||
dImposta.add(getImpostaIndetraibile());
|
||||
setImpostaIndetraibile(dImposta.getResult());
|
||||
}
|
||||
} else if (getIva().getFlgTipo().equals("X") || getIva().getFlgTipo().equals("E") ||
|
||||
getIva().getFlgTipo().startsWith("N") ||
|
||||
getIva().getFlgTipo().startsWith("S") ||
|
||||
getIva().getFlgTipo().equals("R") ||
|
||||
getIva().getFlgTipo().startsWith("C") ||
|
||||
getIva().getFlgTipo().startsWith("C7")) {
|
||||
dImponibile.add(getEsente());
|
||||
setEsente(dImponibile.getResult());
|
||||
}
|
||||
}
|
||||
|
||||
public double getImposta() {
|
||||
return this.imposta;
|
||||
}
|
||||
|
||||
public double getImpostaIndetraibile() {
|
||||
return this.impostaIndetraibile;
|
||||
}
|
||||
|
||||
public double getPercIndetraibile() {
|
||||
return this.percIndetraibile;
|
||||
}
|
||||
|
||||
public void setEsente(double d) {
|
||||
this.esente = d;
|
||||
}
|
||||
|
||||
public void setImponibile(double d) {
|
||||
this.imponibile = d;
|
||||
}
|
||||
|
||||
public void setImponibileIndetraibile(double d) {
|
||||
this.imponibileIndetraibile = d;
|
||||
}
|
||||
|
||||
public void setImposta(double d) {
|
||||
this.imposta = d;
|
||||
}
|
||||
|
||||
public void setImpostaIndetraibile(double d) {
|
||||
this.impostaIndetraibile = d;
|
||||
}
|
||||
|
||||
public void setPercIndetraibile(double d) {
|
||||
this.percIndetraibile = d;
|
||||
}
|
||||
|
||||
public IvaInterface getIva() {
|
||||
return this.iva;
|
||||
}
|
||||
|
||||
public void setIva(IvaInterface iva) {
|
||||
this.iva = iva;
|
||||
}
|
||||
|
||||
public double getSplit() {
|
||||
return this.split;
|
||||
}
|
||||
|
||||
public void setSplit(double split) {
|
||||
this.split = split;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
package it.acxent.contab.iva;
|
||||
|
||||
import it.acxent.anag.Iva;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
|
||||
public class RiepilogoIvaOLD {
|
||||
private Hashtable ri;
|
||||
|
||||
private Hashtable riConPI;
|
||||
|
||||
private Hashtable riSenzaPI;
|
||||
|
||||
public void addFatturaConPi(Iva l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento) {
|
||||
addFattura(l_iva, imponibile, imposta, costo, speseAccessorie, arrotondamento, getRiConPI());
|
||||
}
|
||||
|
||||
public void addNotaDiCreditoConPI(Iva l_iva, double imponibile, double imposta, double costo) {
|
||||
RiepilogoIvaItem rii;
|
||||
String theKey = String.valueOf(l_iva.getId_iva());
|
||||
if (getRiConPI().containsKey(theKey)) {
|
||||
rii = (RiepilogoIvaItem)getRiConPI().get(theKey);
|
||||
} else {
|
||||
rii = new RiepilogoIvaItem(l_iva);
|
||||
}
|
||||
rii.addImporto(-imponibile, -imposta);
|
||||
getRiConPI().put(theKey, rii);
|
||||
}
|
||||
|
||||
public Enumeration elements() {
|
||||
return getRi().elements();
|
||||
}
|
||||
|
||||
public Enumeration elementsSenzaPI() {
|
||||
return getRiSenzaPI().elements();
|
||||
}
|
||||
|
||||
public Enumeration elementsConPI() {
|
||||
return getRiConPI().elements();
|
||||
}
|
||||
|
||||
private Hashtable getRi() {
|
||||
if (this.ri == null)
|
||||
this.ri = new Hashtable();
|
||||
return this.ri;
|
||||
}
|
||||
|
||||
private Hashtable getRiConPI() {
|
||||
if (this.riConPI == null)
|
||||
this.riConPI = new Hashtable();
|
||||
return this.riConPI;
|
||||
}
|
||||
|
||||
private Hashtable getRiSenzaPI() {
|
||||
if (this.riSenzaPI == null)
|
||||
this.riSenzaPI = new Hashtable();
|
||||
return this.riSenzaPI;
|
||||
}
|
||||
|
||||
public void setRiConPI(Hashtable riConPI) {
|
||||
this.riConPI = riConPI;
|
||||
}
|
||||
|
||||
public void setRiSenzaPI(Hashtable riSenzaPI) {
|
||||
this.riSenzaPI = riSenzaPI;
|
||||
}
|
||||
|
||||
public void addFattura(Iva l_iva, double imponibile, double imposta, double costo) {
|
||||
addFattura(l_iva, imponibile, imposta, costo, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
public void addFattura(Iva l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento) {
|
||||
addFattura(l_iva, imponibile, imposta, costo, speseAccessorie, arrotondamento, getRi());
|
||||
}
|
||||
|
||||
private void addFattura(Iva l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento, Hashtable RI) {
|
||||
RiepilogoIvaItem rii;
|
||||
String theKey = String.valueOf(l_iva.getId_iva());
|
||||
if (getRi().containsKey(theKey)) {
|
||||
rii = (RiepilogoIvaItem)getRi().get(theKey);
|
||||
} else {
|
||||
rii = new RiepilogoIvaItem(l_iva);
|
||||
}
|
||||
rii.addImporto(imponibile, imposta);
|
||||
getRi().put(theKey, rii);
|
||||
}
|
||||
|
||||
public void addNotaDiCredito(Iva l_iva, double imponibile, double imposta, double costo) {
|
||||
RiepilogoIvaItem rii;
|
||||
String theKey = String.valueOf(l_iva.getId_iva());
|
||||
if (getRi().containsKey(theKey)) {
|
||||
rii = (RiepilogoIvaItem)getRi().get(theKey);
|
||||
} else {
|
||||
rii = new RiepilogoIvaItem(l_iva);
|
||||
}
|
||||
rii.addImporto(-imponibile, -imposta);
|
||||
getRi().put(theKey, rii);
|
||||
}
|
||||
|
||||
public void addFatturaSenzaPi(Iva l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento) {
|
||||
addFattura(l_iva, imponibile, imposta, costo, speseAccessorie, arrotondamento, getRiSenzaPI());
|
||||
}
|
||||
|
||||
public void addNotaDiCreditoSenzaPI(Iva l_iva, double imponibile, double imposta, double costo) {
|
||||
RiepilogoIvaItem rii;
|
||||
String theKey = String.valueOf(l_iva.getId_iva());
|
||||
if (getRiSenzaPI().containsKey(theKey)) {
|
||||
rii = (RiepilogoIvaItem)getRiSenzaPI().get(theKey);
|
||||
} else {
|
||||
rii = new RiepilogoIvaItem(l_iva);
|
||||
}
|
||||
rii.addImporto(-imponibile, -imposta);
|
||||
getRiSenzaPI().put(theKey, rii);
|
||||
}
|
||||
|
||||
public void addFatturaOLD(Iva l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento) {
|
||||
RiepilogoIvaItem rii;
|
||||
String theKey = String.valueOf(l_iva.getId_iva());
|
||||
if (getRi().containsKey(theKey)) {
|
||||
rii = (RiepilogoIvaItem)getRi().get(theKey);
|
||||
} else {
|
||||
rii = new RiepilogoIvaItem(l_iva);
|
||||
}
|
||||
rii.addImporto(imponibile, imposta);
|
||||
getRi().put(theKey, rii);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,137 @@
|
|||
package it.acxent.contab.iva;
|
||||
|
||||
import it.acxent.anag.IvaInterface;
|
||||
import it.acxent.fattele.FEDatiRiepilogoInterface;
|
||||
import it.acxent.util.DoubleOperator;
|
||||
|
||||
public class RigaRegistroIvaItem implements FEDatiRiepilogoInterface {
|
||||
private IvaInterface iva;
|
||||
|
||||
private double importoIvaNoCalc;
|
||||
|
||||
private double imponibile;
|
||||
|
||||
private boolean regimeDelMargine = false;
|
||||
|
||||
private String fEEsigibilitaIva;
|
||||
|
||||
public RigaRegistroIvaItem(IvaInterface l_iva) {
|
||||
setIva(l_iva);
|
||||
}
|
||||
|
||||
public void addImporto(double l_imponibile, double l_importoIva) {
|
||||
DoubleOperator dImponibile = new DoubleOperator(getImponibile());
|
||||
dImponibile.setScale(4, 5);
|
||||
dImponibile.add(l_imponibile);
|
||||
setImponibile(dImponibile.getResult());
|
||||
DoubleOperator dImposta = new DoubleOperator(getImportoIvaNoCalc());
|
||||
dImposta.setScale(2, 5);
|
||||
dImposta.add(l_importoIva);
|
||||
setImportoIvaNoCalc(dImposta.getResult());
|
||||
}
|
||||
|
||||
public double getImponibile() {
|
||||
return this.imponibile;
|
||||
}
|
||||
|
||||
public double getImportoIva() {
|
||||
return getImportoIvaCalc();
|
||||
}
|
||||
|
||||
public double getImportoIvaNoCalc() {
|
||||
return this.importoIvaNoCalc;
|
||||
}
|
||||
|
||||
public double xxgetImportoIvaSulTotaleImponibile() {
|
||||
DoubleOperator temp = new DoubleOperator((float)getIva().getAliquota());
|
||||
temp.divide(100.0F);
|
||||
temp.multiply(getImponibile());
|
||||
if (getImportoIva() != temp.getResult())
|
||||
System.out.println("RRI: importi iva calcolati diversi");
|
||||
return temp.getResult();
|
||||
}
|
||||
|
||||
public void setImponibile(double d) {
|
||||
this.imponibile = d;
|
||||
}
|
||||
|
||||
public void setImportoIvaNoCalc(double d) {
|
||||
this.importoIvaNoCalc = d;
|
||||
}
|
||||
|
||||
public IvaInterface getIva() {
|
||||
return this.iva;
|
||||
}
|
||||
|
||||
private double getImportoIvaCalc() {
|
||||
if (getIva().isRegimeMargine())
|
||||
return 0.0D;
|
||||
DoubleOperator temp = new DoubleOperator(getImponibile());
|
||||
temp.setScale(4, 5);
|
||||
temp.multiply(getIva().getAliquota());
|
||||
temp.divide(100.0F);
|
||||
return temp.getResult();
|
||||
}
|
||||
|
||||
public void setIva(IvaInterface iva) {
|
||||
this.iva = iva;
|
||||
}
|
||||
|
||||
public double getFEAliquotaIva() {
|
||||
return (double)getIva().getAliquota();
|
||||
}
|
||||
|
||||
public double getFEArrotondamento() {
|
||||
return 0.0D;
|
||||
}
|
||||
|
||||
public String getFEEsigibilitaIva() {
|
||||
return this.fEEsigibilitaIva;
|
||||
}
|
||||
|
||||
public double getFEImponibileImporto() {
|
||||
return getImponibile();
|
||||
}
|
||||
|
||||
public double getFEImposta() {
|
||||
return getImportoIva();
|
||||
}
|
||||
|
||||
public String getFENatura() {
|
||||
return getIva().getFENatura();
|
||||
}
|
||||
|
||||
public String getFERiferimentoNormativo() {
|
||||
if (getFENatura().isEmpty())
|
||||
return null;
|
||||
return getIva().getNotaEsenzione();
|
||||
}
|
||||
|
||||
public double getFESpeseAccessorie() {
|
||||
return 0.0D;
|
||||
}
|
||||
|
||||
public double getImponibile2() {
|
||||
DoubleOperator dop = new DoubleOperator(getImponibile());
|
||||
dop.setScale(2, 5);
|
||||
return dop.getResult();
|
||||
}
|
||||
|
||||
public double getImportoIva2() {
|
||||
DoubleOperator dop = new DoubleOperator(getImportoIvaCalc());
|
||||
dop.setScale(2, 5);
|
||||
return dop.getResult();
|
||||
}
|
||||
|
||||
public boolean isRegimeDelMargine() {
|
||||
return this.regimeDelMargine;
|
||||
}
|
||||
|
||||
public void setRegimeDelMargine(boolean regimeDelMargine) {
|
||||
this.regimeDelMargine = regimeDelMargine;
|
||||
}
|
||||
|
||||
public void setFEEsigibilitaIva(String fEEsigibilitaIva) {
|
||||
this.fEEsigibilitaIva = fEEsigibilitaIva;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,275 @@
|
|||
package it.acxent.contab.iva;
|
||||
|
||||
import it.acxent.anag.Iva;
|
||||
import it.acxent.anag.IvaInterface;
|
||||
import it.acxent.contab.RigaDocumentoInterface;
|
||||
import it.acxent.util.DoubleOperator;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
|
||||
public class RigheRegistroIva implements Cloneable {
|
||||
private Hashtable<String, RigaRegistroIvaItem> ri;
|
||||
|
||||
private DoubleOperator totImponibileDO;
|
||||
|
||||
private double importoRM;
|
||||
|
||||
private Hashtable<String, RigaRegistroIvaItem> riFatt;
|
||||
|
||||
public void addRigaDocumento(Iva l_iva, double imponibile) {
|
||||
DoubleOperator dop = new DoubleOperator(imponibile);
|
||||
dop.setScale(4, 5);
|
||||
dop.multiply(l_iva.getAliquota());
|
||||
dop.divide(100.0F);
|
||||
dop.setScale(2, 5);
|
||||
addRigaDocumento(l_iva, imponibile, dop.getResult(), false, false);
|
||||
}
|
||||
|
||||
public void addRigaDocumento(RigaDocumentoInterface rigaDocumento) {
|
||||
RigaRegistroIvaItem rii;
|
||||
if (!rigaDocumento.getIva().isRegimeMargine()) {
|
||||
String str = String.valueOf(rigaDocumento.getIva().getId_iva());
|
||||
if (getRi().containsKey(str)) {
|
||||
rii = getRi().get(str);
|
||||
} else {
|
||||
rii = new RigaRegistroIvaItem(rigaDocumento.getIva());
|
||||
}
|
||||
rii.addImporto(rigaDocumento.getRDITotImponibile(), rigaDocumento.getRDITotImposta());
|
||||
getTotImponibileDO().add(rigaDocumento.getRDITotImponibile());
|
||||
rii.setFEEsigibilitaIva(rigaDocumento.getFEEsigibilitaIva());
|
||||
getRi().put(str, rii);
|
||||
} else {
|
||||
RigaRegistroIvaItem rigaRegistroIvaItem;
|
||||
Iva ivaStdVend = rigaDocumento.getIva().getIvaStdRM();
|
||||
RegimeMargine rm = new RegimeMargine(ivaStdVend, rigaDocumento.getRDITotImponibile(), rigaDocumento.getRDITotCosto());
|
||||
String theKeyStdVend = String.valueOf(ivaStdVend.getId_iva());
|
||||
if (getRi().containsKey(theKeyStdVend)) {
|
||||
rigaRegistroIvaItem = getRi().get(theKeyStdVend);
|
||||
} else {
|
||||
rigaRegistroIvaItem = new RigaRegistroIvaItem(ivaStdVend);
|
||||
}
|
||||
rigaRegistroIvaItem.setFEEsigibilitaIva(rigaDocumento.getFEEsigibilitaIva());
|
||||
rigaRegistroIvaItem.addImporto(rm.getImponibileMargine(), rm.getImpostaMargine());
|
||||
rigaRegistroIvaItem.setRegimeDelMargine(true);
|
||||
getRi().put(theKeyStdVend, rigaRegistroIvaItem);
|
||||
getTotImponibileDO().add(rm.getImponibileMargine());
|
||||
String rm_theKey = String.valueOf(rigaDocumento.getIva().getId_iva());
|
||||
if (getRi().containsKey(rm_theKey)) {
|
||||
rigaRegistroIvaItem = getRi().get(rm_theKey);
|
||||
} else {
|
||||
rigaRegistroIvaItem = new RigaRegistroIvaItem(rigaDocumento.getIva());
|
||||
}
|
||||
rigaRegistroIvaItem.setFEEsigibilitaIva(rigaDocumento.getFEEsigibilitaIva());
|
||||
rigaRegistroIvaItem.addImporto(rigaDocumento.getRDITotCosto(), 0.0D);
|
||||
rigaRegistroIvaItem.setRegimeDelMargine(true);
|
||||
getTotImponibileDO().add(rigaDocumento.getRDITotCosto());
|
||||
getRi().put(rm_theKey, rigaRegistroIvaItem);
|
||||
}
|
||||
String theKey = String.valueOf(rigaDocumento.getIva().getId_iva());
|
||||
if (getRiFatt().containsKey(theKey)) {
|
||||
rii = getRiFatt().get(theKey);
|
||||
} else {
|
||||
rii = new RigaRegistroIvaItem(rigaDocumento.getIva());
|
||||
}
|
||||
rii.addImporto(rigaDocumento.getRDITotImponibile(), rigaDocumento.getRDITotImposta());
|
||||
getRiFatt().put(theKey, rii);
|
||||
}
|
||||
|
||||
public Enumeration<RigaRegistroIvaItem> elements() {
|
||||
return getRi().elements();
|
||||
}
|
||||
|
||||
public Enumeration elementsNoType() {
|
||||
return getRi().elements();
|
||||
}
|
||||
|
||||
public Enumeration<RigaRegistroIvaItem> elementsFatt() {
|
||||
return getRiFatt().elements();
|
||||
}
|
||||
|
||||
public Enumeration elementsFattNoType() {
|
||||
return getRiFatt().elements();
|
||||
}
|
||||
|
||||
private Hashtable<String, RigaRegistroIvaItem> getRi() {
|
||||
if (this.ri == null)
|
||||
this.ri = new Hashtable<>();
|
||||
return this.ri;
|
||||
}
|
||||
|
||||
public double getImportoRM() {
|
||||
return this.importoRM;
|
||||
}
|
||||
|
||||
public void setImportoRM(double importoRM) {
|
||||
this.importoRM = importoRM;
|
||||
}
|
||||
|
||||
private void addRigaDocumentoRM(Iva l_iva, double imponibile, double imposta, double costo) {
|
||||
String theKey = String.valueOf(l_iva.getId_iva());
|
||||
if (!l_iva.getFlgTipo().equals("R")) {
|
||||
RigaRegistroIvaItem rii;
|
||||
if (getRi().containsKey(theKey)) {
|
||||
rii = getRi().get(theKey);
|
||||
} else {
|
||||
rii = new RigaRegistroIvaItem(l_iva);
|
||||
}
|
||||
rii.addImporto(imponibile, imposta);
|
||||
getTotImponibileDO().add(imponibile);
|
||||
getRi().put(theKey, rii);
|
||||
} else {
|
||||
synchronized (this) {
|
||||
RigaRegistroIvaItem rii;
|
||||
DoubleOperator dop = new DoubleOperator(this.importoRM);
|
||||
dop.add(imponibile);
|
||||
this.importoRM = dop.getResult();
|
||||
double l_imponibile = 0.0D;
|
||||
if (getRi().containsKey(theKey)) {
|
||||
rii = getRi().get(theKey);
|
||||
} else {
|
||||
rii = new RigaRegistroIvaItem(l_iva);
|
||||
}
|
||||
DoubleOperator impo = new DoubleOperator(imponibile);
|
||||
DoubleOperator temp2 = new DoubleOperator((float)-l_iva.getAliquota());
|
||||
temp2.divide(100.0F);
|
||||
temp2.add(1);
|
||||
impo.subtract(costo);
|
||||
DoubleOperator l_imposta = new DoubleOperator(impo.getResult());
|
||||
impo.setScale(4, 5);
|
||||
impo.multiply(temp2);
|
||||
l_imponibile = impo.getResult();
|
||||
l_imposta.subtract(l_imponibile);
|
||||
rii.addImporto(l_imponibile, l_imposta.getResult());
|
||||
getTotImponibileDO().add(l_imponibile);
|
||||
getRi().put(theKey, rii);
|
||||
long l_id_ivaEs = l_iva.getParm("CODICE_IVA_REGIME_MARGINE").getNumeroLong();
|
||||
if (l_id_ivaEs == 0L)
|
||||
l_id_ivaEs = l_iva.getId_iva();
|
||||
String es_theKey = String.valueOf(l_id_ivaEs);
|
||||
if (getRi().containsKey(es_theKey)) {
|
||||
rii = getRi().get(es_theKey);
|
||||
} else {
|
||||
Iva ivaEs = new Iva(l_iva.getApFull());
|
||||
ivaEs.findByPrimaryKey(l_id_ivaEs);
|
||||
rii = new RigaRegistroIvaItem(ivaEs);
|
||||
}
|
||||
rii.addImporto(costo, 0.0D);
|
||||
getRi().put(es_theKey, rii);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private DoubleOperator getTotImponibileDO() {
|
||||
if (this.totImponibileDO == null) {
|
||||
this.totImponibileDO = new DoubleOperator();
|
||||
this.totImponibileDO.setScale(4, 5);
|
||||
}
|
||||
return this.totImponibileDO;
|
||||
}
|
||||
|
||||
public double getTotale() {
|
||||
DoubleOperator dop = new DoubleOperator(getTotImponibile());
|
||||
dop.add(getTotIva());
|
||||
return dop.getResult();
|
||||
}
|
||||
|
||||
public double getTotIva() {
|
||||
Enumeration<RigaRegistroIvaItem> enu = getRi().elements();
|
||||
DoubleOperator dIva = new DoubleOperator();
|
||||
dIva.setScale(4, 5);
|
||||
while (enu.hasMoreElements()) {
|
||||
RigaRegistroIvaItem row = enu.nextElement();
|
||||
dIva.add(row.getImportoIva());
|
||||
}
|
||||
dIva.setScale(2, 5);
|
||||
return dIva.getResult();
|
||||
}
|
||||
|
||||
public double getTotImponibile() {
|
||||
return getTotImponibileDO().getResult();
|
||||
}
|
||||
|
||||
public void addRigaDocumento(IvaInterface l_iva, double imponibile, double imposta, boolean isNotaDiCredito, boolean isPartitaIva) {
|
||||
RigaRegistroIvaItem rii;
|
||||
String theKey = String.valueOf(l_iva.getId_iva());
|
||||
if (getRi().containsKey(theKey)) {
|
||||
rii = getRi().get(theKey);
|
||||
} else {
|
||||
rii = new RigaRegistroIvaItem(l_iva);
|
||||
}
|
||||
rii.addImporto(imponibile, imposta);
|
||||
getTotImponibileDO().add(imponibile);
|
||||
getRi().put(theKey, rii);
|
||||
if (getRiFatt().containsKey(theKey)) {
|
||||
rii = getRiFatt().get(theKey);
|
||||
} else {
|
||||
rii = new RigaRegistroIvaItem(l_iva);
|
||||
}
|
||||
rii.addImporto(imponibile, imposta);
|
||||
getRiFatt().put(theKey, rii);
|
||||
}
|
||||
|
||||
protected Object clone() throws CloneNotSupportedException {
|
||||
return super.clone();
|
||||
}
|
||||
|
||||
private void addRigaDocumentoRMOLD(Iva l_iva, double imponibile, double imposta, double costo) {
|
||||
String theKey = String.valueOf(l_iva.getId_iva());
|
||||
if (!l_iva.getFlgTipo().equals("R")) {
|
||||
RigaRegistroIvaItem rii;
|
||||
if (getRi().containsKey(theKey)) {
|
||||
rii = getRi().get(theKey);
|
||||
} else {
|
||||
rii = new RigaRegistroIvaItem(l_iva);
|
||||
}
|
||||
rii.addImporto(imponibile, imposta);
|
||||
getTotImponibileDO().add(imponibile);
|
||||
getRi().put(theKey, rii);
|
||||
} else {
|
||||
synchronized (this) {
|
||||
RigaRegistroIvaItem rii;
|
||||
DoubleOperator dop = new DoubleOperator(this.importoRM);
|
||||
dop.add(imponibile);
|
||||
this.importoRM = dop.getResult();
|
||||
double l_imponibile = 0.0D;
|
||||
if (getRi().containsKey(theKey)) {
|
||||
rii = getRi().get(theKey);
|
||||
} else {
|
||||
rii = new RigaRegistroIvaItem(l_iva);
|
||||
}
|
||||
DoubleOperator impo = new DoubleOperator(imponibile);
|
||||
DoubleOperator temp2 = new DoubleOperator((float)-l_iva.getAliquota());
|
||||
temp2.divide(100.0F);
|
||||
temp2.add(1);
|
||||
impo.subtract(costo);
|
||||
DoubleOperator l_imposta = new DoubleOperator(impo.getResult());
|
||||
impo.setScale(4, 5);
|
||||
impo.multiply(temp2);
|
||||
l_imponibile = impo.getResult();
|
||||
l_imposta.subtract(l_imponibile);
|
||||
rii.addImporto(l_imponibile, l_imposta.getResult());
|
||||
getTotImponibileDO().add(l_imponibile);
|
||||
getRi().put(theKey, rii);
|
||||
long l_id_ivaEs = l_iva.getParm("CODICE_IVA_REGIME_MARGINE").getNumeroLong();
|
||||
if (l_id_ivaEs == 0L)
|
||||
l_id_ivaEs = l_iva.getId_iva();
|
||||
String es_theKey = String.valueOf(l_id_ivaEs);
|
||||
if (getRi().containsKey(es_theKey)) {
|
||||
rii = getRi().get(es_theKey);
|
||||
} else {
|
||||
Iva ivaEs = new Iva(l_iva.getApFull());
|
||||
ivaEs.findByPrimaryKey(l_id_ivaEs);
|
||||
rii = new RigaRegistroIvaItem(ivaEs);
|
||||
}
|
||||
rii.addImporto(costo, 0.0D);
|
||||
getRi().put(es_theKey, rii);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Hashtable<String, RigaRegistroIvaItem> getRiFatt() {
|
||||
if (this.riFatt == null)
|
||||
this.riFatt = new Hashtable<>();
|
||||
return this.riFatt;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue