400 lines
12 KiB
Java
400 lines
12 KiB
Java
package it.acxent.anag;
|
|
|
|
import it.acxent.db.ApplParmFull;
|
|
import it.acxent.db.DBAdapterException;
|
|
import it.acxent.db.ResParm;
|
|
import it.acxent.db.WcString;
|
|
import it.acxent.util.Vectumerator;
|
|
import java.io.Serializable;
|
|
import java.sql.PreparedStatement;
|
|
import java.sql.SQLException;
|
|
|
|
public class Iva extends _AnagAdapter implements Serializable, IvaInterface {
|
|
private static final long serialVersionUID = -2303180562953644516L;
|
|
|
|
public static final String TI_IMPONIBILE = "I";
|
|
|
|
public static final String TI_N1_ESCLUSO_ART_15 = "X";
|
|
|
|
public static final String TI_N2_NON_SOGGETTE_NON_VALIDO_2021 = "S";
|
|
|
|
public static final String TI_N2_1_NON_SOGGETTE_ART_7 = "S1";
|
|
|
|
public static final String TI_N2_2_NON_SOGGETTE_ALTRE = "S2";
|
|
|
|
public static final String TI_N3_NON_IMPONIBILE_NON_VALIDO_2021 = "N";
|
|
|
|
public static final String TI_N3_1_NON_IMPONIBILE_ESPORTAZIONI = "N1";
|
|
|
|
public static final String TI_N3_2_NON_IMPONIBILE_CESS_COMUN = "N2";
|
|
|
|
public static final String TI_N3_3_NON_IMPONIBILE_CESS_S_MARINO = "N3";
|
|
|
|
public static final String TI_N3_4_NON_IMPONIBILE_OP_ASSIM_CESS_ESPORT = "N4";
|
|
|
|
public static final String TI_N3_5_NON_IMPONIBILE_CON_DICH_INTENTO = "N5";
|
|
|
|
public static final String TI_N3_6_NON_IMPONIBILE_ALTRE_OPER = "N6";
|
|
|
|
public static final String TI_N4_ESENTE = "E";
|
|
|
|
public static final String TI_N5_REGIME_MARGINE = "R";
|
|
|
|
public static final String TI_N6_INVERSIONE_CONTABILE_NON_VALIDO_2021 = "C";
|
|
|
|
public static final String TI_N6_1_INVERSIONE_CONTABILE_ROTTAMI = "C1";
|
|
|
|
public static final String TI_N6_2_INVERSIONE_CONTABILE_ORO_ARGENTO = "C2";
|
|
|
|
public static final String TI_N6_3_INVERSIONE_CONTABILE_SUBAPP_EDILE = "C3";
|
|
|
|
public static final String TI_N6_4_INVERSIONE_CONTABILE_CESS_FABBRICATI = "C4";
|
|
|
|
public static final String TI_N6_5_INVERSIONE_CONTABILE_CESS_TEL_CELLULARI = "C5";
|
|
|
|
public static final String TI_N6_6_INVERSIONE_CONTABILE_CESS_PROD_ELETTRONICI = "C6";
|
|
|
|
public static final String TI_N6_7_INVERSIONE_CONTABILE_PREST_EDILE = "C7";
|
|
|
|
public static final String TI_N6_8_INVERSIONE_CONTABILE_SETT_ENERGETICO = "C8";
|
|
|
|
public static final String TI_N6_9_INVERSIONE_CONTABILE_ALTRI_CASI = "C9";
|
|
|
|
public static final String TI_N7_ASSOLTA_ATRO_STATO_UE = "A";
|
|
|
|
private long aliquota;
|
|
|
|
private long aliquotaIndetraibile;
|
|
|
|
private String descrizione;
|
|
|
|
private String flgTipo;
|
|
|
|
private long id_ivaStdRM;
|
|
|
|
private Iva ivaStdRM;
|
|
|
|
private String notaEsenzione;
|
|
|
|
private String codiceExport;
|
|
|
|
private String descrizioneRigaStampa;
|
|
|
|
private long flgOss;
|
|
|
|
private long id_iva;
|
|
|
|
public static final String P_CODICE_IVA_STD_VEND = "CODICE_IVA_STD_VEND";
|
|
|
|
public static final String P_CODICE_IVA_STD_ACQUISTO = "CODICE_IVA_STD_ACQ";
|
|
|
|
public static final String P_CODICE_IVA_ESENTE_SPESE_BOLLI = "CODICE_IVA_ESENTE";
|
|
|
|
public static final String P_CODICE_IVA_CEE_AZIENDA_ART41 = "CODICE_IVA_CEE_AZIENDA_ART41";
|
|
|
|
public static final String P_CODICE_IVA_ITA_CEE_AZIENDA_ART58 = "CODICE_IVA_ITA_CEE_AZIENDA_ART58";
|
|
|
|
public static final String P_CODICE_IVA_EXTRA_CEE_ART8_A = "CODICE_IVA_ART8_A";
|
|
|
|
public static final String P_CODICE_IVA_EXTRA_CEE_ESP_ABITUALE_ART8_C = "CODICE_IVA_EXTRA_CEE_ESP_ABITUALE_ART8_C";
|
|
|
|
public static final String P_CODICE_IVA_TRASP_EXTRA_CEE_RAV_ART9 = "CODICE_IVA_ART9";
|
|
|
|
public static final String P_CODICE_IVA_REVERSE_CHARGE = "CODICE_IVA_REVERSE_CHARGE";
|
|
|
|
public static final String P_CODICE_IVA_REGIME_MARGINE = "CODICE_IVA_REGIME_MARGINE";
|
|
|
|
public static final String P_IVA_CEE_ONE_STOP_SHOP = "IVA_CEE_ONE_STOP_SHOP";
|
|
|
|
public static final String P_IVA_ESTERO_AZIENDA_ESENTE = "IVA_ESTERO_AZIENDA_ESENTE";
|
|
|
|
public Iva() {}
|
|
|
|
public Iva(ApplParmFull newApplParmFull) {
|
|
super(newApplParmFull);
|
|
}
|
|
|
|
protected void deleteCascade() {}
|
|
|
|
public Vectumerator findByCR(IvaCR CR, int pageNumber, int pageRows) throws DBAdapterException, SQLException {
|
|
String s_Sql_Find = "select A.* from IVA AS A";
|
|
String s_Sql_Order = " order by A.descrizione";
|
|
String wc = "";
|
|
if (!CR.getSearchTxt().isEmpty())
|
|
wc = buildWc(wc, "A.descrizione like'" + CR.getSearchTxt() + "%' ");
|
|
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc);
|
|
return findRows(stmt, pageNumber, pageRows);
|
|
}
|
|
|
|
public long getAliquota() {
|
|
return this.aliquota;
|
|
}
|
|
|
|
public long getAliquotaIndetraibile() {
|
|
return this.aliquotaIndetraibile;
|
|
}
|
|
|
|
public String getDescrizione() {
|
|
return (this.descrizione == null) ? "" : this.descrizione;
|
|
}
|
|
|
|
public String getFlgTipo() {
|
|
return (this.flgTipo == null || this.flgTipo.isEmpty()) ? "I" : this.flgTipo;
|
|
}
|
|
|
|
public static final String getTipo(String l_flgTipo) {
|
|
if (l_flgTipo.equals("I"))
|
|
return "Imponibile";
|
|
if (l_flgTipo.equals("X"))
|
|
return "Escluso ex art. 15 N1";
|
|
if (l_flgTipo.equals("S"))
|
|
return "Non Soggette N2 NO 2021";
|
|
if (l_flgTipo.equals("S1"))
|
|
return "Non Soggette N2.1 ART. 7 DPR 633/72";
|
|
if (l_flgTipo.equals("S2"))
|
|
return "Non Soggette N2.2 ALTRE";
|
|
if (l_flgTipo.equals("N"))
|
|
return "Non Imponibile N3 NO 2021";
|
|
if (l_flgTipo.equals("N1"))
|
|
return "Non Imponibile N3.1 Esportazioni";
|
|
if (l_flgTipo.equals("N2"))
|
|
return "Non Imponibile N3.2 Cessioni Intracomunitarie";
|
|
if (l_flgTipo.equals("N3"))
|
|
return "Non Imponibile N3.3 Cessioni San Marino";
|
|
if (l_flgTipo.equals("N4"))
|
|
return "Non Imponibile N3.4 Assim. Cess. Esportazioni";
|
|
if (l_flgTipo.equals("N5"))
|
|
return "Non Imponibile N3.5 con dichiarazioni di Intento";
|
|
if (l_flgTipo.equals("N6"))
|
|
return "Non Imponibile N3.6 oper. non concorrono al plafond";
|
|
if (l_flgTipo.equals("E"))
|
|
return "Esente N4";
|
|
if (l_flgTipo.equals("R"))
|
|
return "Regime del Margine N5";
|
|
if (l_flgTipo.equals("C"))
|
|
return "Inversione Contabile N6 NO 2021";
|
|
if (l_flgTipo.equals("C1"))
|
|
return "Inversione Contabile N6.1 Cess. Rottami";
|
|
if (l_flgTipo.equals("C2"))
|
|
return "Inversione Contabile N6.2 Cess. Oro o Argento";
|
|
if (l_flgTipo.equals("C3"))
|
|
return "Inversione Contabile N6.3 subapp. settore edile";
|
|
if (l_flgTipo.equals("C4"))
|
|
return "Inversione Contabile N6.4 Cessione Fabbricati";
|
|
if (l_flgTipo.equals("C5"))
|
|
return "Inversione Contabile N6.5 Cessione Tel. Cellulari";
|
|
if (l_flgTipo.equals("C6"))
|
|
return "Inversione Contabile N6.6 Cessione Prod. Elettronici";
|
|
if (l_flgTipo.equals("C7"))
|
|
return "Inversione Contabile N6.7 Prestaz. comparto edile e connessi";
|
|
if (l_flgTipo.equals("C8"))
|
|
return "Inversione Contabile N6.8 Oper. Settore Energetico";
|
|
if (l_flgTipo.equals("C9"))
|
|
return "Inversione Contabile N6.9 Altri Casi";
|
|
if (l_flgTipo.equals("A"))
|
|
return "Assolta UE N7";
|
|
return "";
|
|
}
|
|
|
|
public static final String getFENatura(String l_flgTipo) {
|
|
if (l_flgTipo.equals("I"))
|
|
return "";
|
|
if (l_flgTipo.equals("X"))
|
|
return "N1";
|
|
if (l_flgTipo.equals("S"))
|
|
return "N2";
|
|
if (l_flgTipo.equals("S1"))
|
|
return "N2.1";
|
|
if (l_flgTipo.equals("S2"))
|
|
return "N2.2";
|
|
if (l_flgTipo.equals("N"))
|
|
return "N3";
|
|
if (l_flgTipo.equals("N1"))
|
|
return "N3.1";
|
|
if (l_flgTipo.equals("N2"))
|
|
return "N3.2";
|
|
if (l_flgTipo.equals("N3"))
|
|
return "N3.3";
|
|
if (l_flgTipo.equals("N4"))
|
|
return "N3.4";
|
|
if (l_flgTipo.equals("N5"))
|
|
return "N3.5";
|
|
if (l_flgTipo.equals("N6"))
|
|
return "N3.6";
|
|
if (l_flgTipo.equals("E"))
|
|
return "N4";
|
|
if (l_flgTipo.equals("R"))
|
|
return "N5";
|
|
if (l_flgTipo.equals("C"))
|
|
return "N6";
|
|
if (l_flgTipo.equals("C1"))
|
|
return "N6.1";
|
|
if (l_flgTipo.equals("C2"))
|
|
return "N6.2";
|
|
if (l_flgTipo.equals("C3"))
|
|
return "N6.3";
|
|
if (l_flgTipo.equals("C4"))
|
|
return "N6.4";
|
|
if (l_flgTipo.equals("C5"))
|
|
return "N6.5";
|
|
if (l_flgTipo.equals("C6"))
|
|
return "N6.6";
|
|
if (l_flgTipo.equals("C7"))
|
|
return "N6.7";
|
|
if (l_flgTipo.equals("C8"))
|
|
return "N6.8";
|
|
if (l_flgTipo.equals("C9"))
|
|
return "N6.9";
|
|
if (l_flgTipo.equals("A"))
|
|
return "N7";
|
|
return "";
|
|
}
|
|
|
|
public String getFENatura() {
|
|
return getFENatura(getFlgTipo());
|
|
}
|
|
|
|
public String getTipo() {
|
|
return getTipo(getFlgTipo());
|
|
}
|
|
|
|
public long getId_iva() {
|
|
return this.id_iva;
|
|
}
|
|
|
|
public String getNotaEsenzione() {
|
|
return (this.notaEsenzione == null) ? "" : this.notaEsenzione;
|
|
}
|
|
|
|
public void setAliquota(long newAliquota) {
|
|
this.aliquota = newAliquota;
|
|
}
|
|
|
|
public void setAliquotaIndetraibile(long l) {
|
|
this.aliquotaIndetraibile = l;
|
|
}
|
|
|
|
public void setDescrizione(String newDescrizione) {
|
|
this.descrizione = newDescrizione;
|
|
}
|
|
|
|
public void setFlgTipo(String string) {
|
|
this.flgTipo = string;
|
|
}
|
|
|
|
public void setId_iva(long newId_iva) {
|
|
this.id_iva = newId_iva;
|
|
}
|
|
|
|
public void setNotaEsenzione(String l_notaEsenzione) {
|
|
this.notaEsenzione = l_notaEsenzione;
|
|
}
|
|
|
|
public String getCodiceExport() {
|
|
return (this.codiceExport == null) ? "" : this.codiceExport;
|
|
}
|
|
|
|
public void setCodiceExport(String codiceExport) {
|
|
this.codiceExport = codiceExport;
|
|
}
|
|
|
|
public long getAliquotaFE() {
|
|
if (getFlgTipo().equals("R"))
|
|
return 0L;
|
|
return getAliquota();
|
|
}
|
|
|
|
public boolean isRegimeMargine() {
|
|
return getFlgTipo().equals("R");
|
|
}
|
|
|
|
public String getDescrizioneRigaStampa() {
|
|
return (this.descrizioneRigaStampa == null) ? "" : this.descrizioneRigaStampa.trim();
|
|
}
|
|
|
|
public void setDescrizioneRigaStampa(String descrizioneRigaStampa) {
|
|
this.descrizioneRigaStampa = descrizioneRigaStampa;
|
|
}
|
|
|
|
public String getDescrizioneRigaStampaAuto() {
|
|
return getDescrizioneRigaStampa().isEmpty() ? getDescrizione() : getDescrizioneRigaStampa();
|
|
}
|
|
|
|
public long getFlgOss() {
|
|
return this.flgOss;
|
|
}
|
|
|
|
public void setFlgOss(long flgOss) {
|
|
this.flgOss = flgOss;
|
|
}
|
|
|
|
public Vectumerator<Iva> findAllOss() {
|
|
String s_Sql_Find = "select A.* from IVA AS A";
|
|
String s_Sql_Order = " order by A.descrizione";
|
|
WcString wc = new WcString();
|
|
wc.addWc("A.flgOss=1");
|
|
try {
|
|
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc));
|
|
return findRows(stmt);
|
|
} catch (SQLException e) {
|
|
handleDebug(e);
|
|
return AB_EMPTY_VECTUMERATOR;
|
|
}
|
|
}
|
|
|
|
public long getId_ivaStdRM() {
|
|
return this.id_ivaStdRM;
|
|
}
|
|
|
|
public void setId_ivaStdRM(long id_ivaStdRM) {
|
|
this.id_ivaStdRM = id_ivaStdRM;
|
|
setIvaStdRM(null);
|
|
}
|
|
|
|
public Iva getIvaStdRM() {
|
|
this.ivaStdRM = (Iva)getSecondaryObject(this.ivaStdRM, Iva.class, new Long(getId_ivaStdRM()));
|
|
return this.ivaStdRM;
|
|
}
|
|
|
|
public void setIvaStdRM(Iva ivaStdRM) {
|
|
this.ivaStdRM = ivaStdRM;
|
|
}
|
|
|
|
public ResParm save() {
|
|
if (getFlgTipo().equals("R")) {
|
|
if (getId_ivaStdRM() == 0L)
|
|
return new ResParm(false, "Errore! Indicare una aliquota iva per il calcolo dell'iva sul margine");
|
|
} else {
|
|
setId_ivaStdRM(0L);
|
|
}
|
|
return super.save();
|
|
}
|
|
|
|
public Vectumerator<Iva> findAllNoRM() {
|
|
String s_Sql_Find = "select A.* from IVA AS A";
|
|
String s_Sql_Order = " order by A.descrizione";
|
|
WcString wc = new WcString();
|
|
wc.addWc("A.flgTipo!='R'");
|
|
try {
|
|
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc));
|
|
return findRows(stmt);
|
|
} catch (SQLException e) {
|
|
handleDebug(e);
|
|
return AB_EMPTY_VECTUMERATOR;
|
|
}
|
|
}
|
|
|
|
public Vectumerator<Iva> findAllNonOss() {
|
|
String s_Sql_Find = "select A.* from IVA AS A";
|
|
String s_Sql_Order = " order by A.descrizione";
|
|
WcString wc = new WcString();
|
|
wc.addWc("(A.flgOss=0 or A.flgOss is null)");
|
|
try {
|
|
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc));
|
|
return findRows(stmt);
|
|
} catch (SQLException e) {
|
|
handleDebug(e);
|
|
return AB_EMPTY_VECTUMERATOR;
|
|
}
|
|
}
|
|
}
|