first commit

This commit is contained in:
MaddoScientisto 2026-03-14 20:04:39 +01:00
commit 4d332ef662
27586 changed files with 3281783 additions and 0 deletions

View file

@ -0,0 +1,151 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.WcString;
import com.ablia.util.StringTokenizer;
import com.ablia.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class AllegatoDocumento extends _ContabAdapter implements Serializable {
private long id_allegatoDocumento;
private long id_documento;
private long id_tipoAllegatoDocumento;
private String nomeFile;
private Documento documento;
private TipoAllegatoDocumento tipoAllegatoDocumento;
public AllegatoDocumento(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public AllegatoDocumento() {}
public void setId_allegatoDocumento(long newId_allegatoDocumento) {
this.id_allegatoDocumento = newId_allegatoDocumento;
}
public void setId_documento(long newId_documento) {
this.id_documento = newId_documento;
setDocumento(null);
}
public void setId_tipoAllegatoDocumento(long newId_tipoAllegatoDocumento) {
this.id_tipoAllegatoDocumento = newId_tipoAllegatoDocumento;
setTipoAllegatoDocumento(null);
}
public void setNomeFile(String newNomeFile) {
this.nomeFile = newNomeFile;
}
public long getId_allegatoDocumento() {
return this.id_allegatoDocumento;
}
public long getId_documento() {
return this.id_documento;
}
public long getId_tipoAllegatoDocumento() {
return this.id_tipoAllegatoDocumento;
}
public String getNomeFile() {
return (this.nomeFile == null) ? "" : this.nomeFile.trim();
}
public void setDocumento(Documento newDocumento) {
this.documento = newDocumento;
}
public Documento getDocumento() {
this.documento = (Documento)getSecondaryObject(this.documento, Documento.class,
getId_documento());
return this.documento;
}
public void setTipoAllegatoDocumento(TipoAllegatoDocumento newTipoAllegatoDocumento) {
this.tipoAllegatoDocumento = newTipoAllegatoDocumento;
}
public TipoAllegatoDocumento getTipoAllegatoDocumento() {
this.tipoAllegatoDocumento = (TipoAllegatoDocumento)getSecondaryObject(
this.tipoAllegatoDocumento, TipoAllegatoDocumento.class,
getId_tipoAllegatoDocumento());
return this.tipoAllegatoDocumento;
}
protected void deleteCascade() {}
public Vectumerator findByCR(AllegatoDocumentoCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from ALLEGATO_DOCUMENTO AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(),
" ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token +
"%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public void findByDocumentoNomeFile(long l_id_documento, String l_id_nomeFile) {
String s_Sql_Find = "select DISTINCT A.* from ALLEGATO_DOCUMENTO AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.id_documento=" + l_id_documento);
wc.addWc("A.nomeFile='" + l_id_nomeFile + "'");
try {
PreparedStatement stmt = getConn().prepareStatement(
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
findFirstRecord(stmt);
} catch (SQLException e) {
handleDebug(e);
}
}
public Vectumerator findByDocumentoTipo(long l_id_documento, long l_id_tipoAllegatoDocumento, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from ALLEGATO_DOCUMENTO AS A";
String s_Sql_Order = " order by A.nomeFile";
WcString wc = new WcString();
wc.addWc("A.id_documento=" + l_id_documento);
if (l_id_tipoAllegatoDocumento > 0L)
wc.addWc("A.id_tipoAllegatoDocumento=" + l_id_tipoAllegatoDocumento);
try {
PreparedStatement stmt = getConn().prepareStatement(
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public String getNomeFileSuDisco() {
return String.valueOf(getId_documento()) + "_" + getNomeFile();
}
}

View file

@ -0,0 +1,80 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
public class AllegatoDocumentoCR extends CRAdapter {
private long id_allegatoDocumento;
private long id_documento;
private long id_tipoAllegatoDocumento;
private String nomeFile;
private Documento documento;
private TipoAllegatoDocumento tipoAllegatoDocumento;
public AllegatoDocumentoCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public AllegatoDocumentoCR() {}
public void setId_allegatoDocumento(long newId_allegatoDocumento) {
this.id_allegatoDocumento = newId_allegatoDocumento;
}
public void setId_documento(long newId_documento) {
this.id_documento = newId_documento;
setDocumento(null);
}
public void setId_tipoAllegatoDocumento(long newId_tipoAllegatoDocumento) {
this.id_tipoAllegatoDocumento = newId_tipoAllegatoDocumento;
setTipoAllegatoDocumento(null);
}
public void setNomeFile(String newNomeFile) {
this.nomeFile = newNomeFile;
}
public long getId_allegatoDocumento() {
return this.id_allegatoDocumento;
}
public long getId_documento() {
return this.id_documento;
}
public long getId_tipoAllegatoDocumento() {
return this.id_tipoAllegatoDocumento;
}
public String getNomeFile() {
return (this.nomeFile == null) ? "" : this.nomeFile.trim();
}
public void setDocumento(Documento newDocumento) {
this.documento = newDocumento;
}
public Documento getDocumento() {
this.documento = (Documento)getSecondaryObject(
this.documento,
Documento.class, getId_documento());
return this.documento;
}
public void setTipoAllegatoDocumento(TipoAllegatoDocumento newTipoAllegatoDocumento) {
this.tipoAllegatoDocumento = newTipoAllegatoDocumento;
}
public TipoAllegatoDocumento getTipoAllegatoDocumento() {
this.tipoAllegatoDocumento = (TipoAllegatoDocumento)getSecondaryObject(
this.tipoAllegatoDocumento,
TipoAllegatoDocumento.class, getId_tipoAllegatoDocumento());
return this.tipoAllegatoDocumento;
}
}

View file

@ -0,0 +1,73 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.DBAdapter;
import com.ablia.db.DBAdapterException;
import com.ablia.db.ResParm;
import com.ablia.db.WcString;
import com.ablia.util.StringTokenizer;
import com.ablia.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class CausaleContabile extends DBAdapter implements Serializable {
private static final long serialVersionUID = 8044331984020899695L;
private long id_causaleContabile;
private String descrizione;
public CausaleContabile(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public CausaleContabile() {}
public long getId_causaleContabile() {
return this.id_causaleContabile;
}
public void setId_causaleContabile(long id_incassoPagamento) {
this.id_causaleContabile = id_incassoPagamento;
}
public Vectumerator<CausaleContabile> findByCR(CausaleContabileCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from CAUSALE_CONTABILE AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
protected void deleteCascade() {}
protected ResParm checkDeleteCascade() throws DBAdapterException, SQLException {
return null;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione;
}
public void setDescrizione(String descrizione) {
this.descrizione = descrizione;
}
}

View file

@ -0,0 +1,35 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import java.io.Serializable;
public class CausaleContabileCR extends CRAdapter implements Serializable {
private static final long serialVersionUID = 8044331984020899695L;
private long id_causaleContabile;
private String descrizione;
public CausaleContabileCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public CausaleContabileCR() {}
public long getId_causaleContabile() {
return this.id_causaleContabile;
}
public void setId_causaleContabile(long id_incassoPagamento) {
this.id_causaleContabile = id_incassoPagamento;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione;
}
public void setDescrizione(String descrizione) {
this.descrizione = descrizione;
}
}

View file

@ -0,0 +1,278 @@
package com.ablia.contab;
import com.ablia.anag.MagFisico;
import com.ablia.db.ApplParmFull;
import com.ablia.db.ResParm;
import com.ablia.db.WcString;
import com.ablia.util.StringTokenizer;
import com.ablia.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class CausaleMagazzino extends _ContabAdapter implements Serializable {
private static final long serialVersionUID = 1393916760598955841L;
private long id_causaleMagazzino;
private String descrizione;
private long id_magFisicoPartenza;
private long id_magFisicoArrivo;
private long flgVisualizzazioneArrivo;
private long flgVisualizzazionePartenza;
private long flgScaricoPartenza;
private long flgScaricoArrivo;
private MagFisico magFisicoPartenza;
private MagFisico magFisicoArrivo;
private long flgCaricoArrivo;
private long flgCaricoPartenza;
private long flgPartenzaInterno;
private long flgArrivoInterno;
private long flgArrivoLavorazione;
private long flgPartenzaLavorazione;
private String nota;
public CausaleMagazzino(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public CausaleMagazzino() {}
public void setId_causaleMagazzino(long newId_causaleMagazzino) {
this.id_causaleMagazzino = newId_causaleMagazzino;
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public void setId_magFisicoPartenza(long newId_magFisicoPartenza) {
this.id_magFisicoPartenza = newId_magFisicoPartenza;
setMagFisicoPartenza(null);
}
public void setId_magFisicoArrivo(long newId_magFisicoArrivo) {
this.id_magFisicoArrivo = newId_magFisicoArrivo;
setMagFisicoArrivo(null);
}
public void setFlgVisualizzazioneArrivo(long newFlgVisualizzazioneArrivo) {
this.flgVisualizzazioneArrivo = newFlgVisualizzazioneArrivo;
}
public void setFlgVisualizzazionePartenza(long newFlgVisualizzazionePartenza) {
this.flgVisualizzazionePartenza = newFlgVisualizzazionePartenza;
}
public void setFlgCaricoPartenza(long newFlgCaricoPartenza) {
this.flgCaricoPartenza = newFlgCaricoPartenza;
}
public void setFlgScaricoPartenza(long newFlgScaricoPartenza) {
this.flgScaricoPartenza = newFlgScaricoPartenza;
}
public void setFlgCaricoArrivo(long newFlgCaricoArrivo) {
this.flgCaricoArrivo = newFlgCaricoArrivo;
}
public void setFlgScaricoArrivo(long newFlgScaricoArrivo) {
this.flgScaricoArrivo = newFlgScaricoArrivo;
}
public long getId_causaleMagazzino() {
return this.id_causaleMagazzino;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione.trim();
}
public String getDescrizionePartenza() {
if (getId_magFisicoPartenza() == 0L) {
StringBuilder sb = new StringBuilder();
if (getFlgPartenzaInterno() == 1L)
sb.append("Qualsiasi magazzino interno - ");
if (getFlgPartenzaLavorazione() == 1L)
sb.append("Qualsiasi magazzino Lav. ");
return sb.toString();
}
return getMagFisicoPartenza().getDescrizione();
}
public String getDescrizioneArrivo() {
if (getId_magFisicoArrivo() == 0L) {
StringBuilder sb = new StringBuilder();
if (getFlgArrivoInterno() == 1L)
sb.append("Qualsiasi magazzino interno - ");
if (getFlgArrivoLavorazione() == 1L)
sb.append("Qualsiasi magazzino Lav. ");
return sb.toString();
}
return getMagFisicoArrivo().getDescrizione();
}
public long getId_magFisicoPartenza() {
return this.id_magFisicoPartenza;
}
public long getId_magFisicoArrivo() {
return this.id_magFisicoArrivo;
}
public long getFlgVisualizzazioneArrivo() {
return this.flgVisualizzazioneArrivo;
}
public long getFlgVisualizzazionePartenza() {
return this.flgVisualizzazionePartenza;
}
public long getFlgCaricoPartenza() {
return this.flgCaricoPartenza;
}
public long getFlgScaricoPartenza() {
return this.flgScaricoPartenza;
}
public long getFlgCaricoArrivo() {
return this.flgCaricoArrivo;
}
public long getFlgScaricoArrivo() {
return this.flgScaricoArrivo;
}
public void setMagFisicoPartenza(MagFisico newMagFisicoPartenza) {
this.magFisicoPartenza = newMagFisicoPartenza;
}
public MagFisico getMagFisicoPartenza() {
this.magFisicoPartenza = (MagFisico)getSecondaryObject(this.magFisicoPartenza, MagFisico.class, getId_magFisicoPartenza());
return this.magFisicoPartenza;
}
public void setMagFisicoArrivo(MagFisico newMagFisicoArrivo) {
this.magFisicoArrivo = newMagFisicoArrivo;
}
public MagFisico getMagFisicoArrivo() {
this.magFisicoArrivo = (MagFisico)getSecondaryObject(this.magFisicoArrivo, MagFisico.class, getId_magFisicoArrivo());
return this.magFisicoArrivo;
}
protected void deleteCascade() {}
public Vectumerator<CausaleMagazzino> findByCR(CausaleMagazzinoCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from CAUSALE_MAGAZZINO AS A";
String s_Sql_Order = " order by A.descrizione";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.descrizione like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public long getFlgPartenzaInterno() {
return this.flgPartenzaInterno;
}
public void setFlgPartenzaInterno(long flgPartenzaInterno) {
this.flgPartenzaInterno = flgPartenzaInterno;
}
public long getFlgArrivoInterno() {
return this.flgArrivoInterno;
}
public void setFlgArrivoInterno(long flgArrivoInterno) {
this.flgArrivoInterno = flgArrivoInterno;
}
public long getFlgArrivoLavorazione() {
return this.flgArrivoLavorazione;
}
public void setFlgArrivoLavorazione(long flgArrivoLavorazione) {
this.flgArrivoLavorazione = flgArrivoLavorazione;
}
public long getFlgPartenzaLavorazione() {
return this.flgPartenzaLavorazione;
}
public void setFlgPartenzaLavorazione(long flgPartenzaLavorazione) {
this.flgPartenzaLavorazione = flgPartenzaLavorazione;
}
public String getNota() {
return (this.nota == null) ? "" : this.nota.trim();
}
public void setNota(String nota) {
this.nota = nota;
}
public ResParm save() {
if (getFlgArrivoInterno() == 1L || getFlgArrivoLavorazione() == 1L)
setId_magFisicoArrivo(0L);
if (getFlgPartenzaInterno() == 1L || getFlgPartenzaLavorazione() == 1L)
setId_magFisicoPartenza(0L);
return super.save();
}
public boolean isMagArrivo() {
if (getId_magFisicoArrivo() > 0L || isMagArrivoDaScegliere())
return true;
return false;
}
public boolean isMagPartenza() {
if (getId_magFisicoPartenza() > 0L || isMagPartenzaDaScegliere())
return true;
return false;
}
public boolean isMagArrivoDaScegliere() {
if (getFlgArrivoInterno() == 1L || getFlgArrivoLavorazione() == 1L)
return true;
return false;
}
public boolean isMagPartenzaDaScegliere() {
if (getFlgPartenzaInterno() == 1L || getFlgPartenzaLavorazione() == 1L)
return true;
return false;
}
}

View file

@ -0,0 +1,141 @@
package com.ablia.contab;
import com.ablia.anag.MagFisico;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
public class CausaleMagazzinoCR extends CRAdapter {
private long id_causaleMagazzino;
private String descrizione;
private long id_magFisicoPartenza;
private long id_magFisicoArrivo;
private long flgVisualizzazioneArrivo;
private long flgVisualizzazionePartenza;
private long flgCaricoPartenza;
private long flgScaricoPartenza;
private long flgCaricoArrivo;
private long flgScaricoArrivo;
private MagFisico magFisicoPartenza;
private MagFisico magFisicoArrivo;
public CausaleMagazzinoCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public CausaleMagazzinoCR() {}
public void setId_causaleMagazzino(long newId_causaleMagazzino) {
this.id_causaleMagazzino = newId_causaleMagazzino;
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public void setId_magFisicoPartenza(long newId_magFisicoPartenza) {
this.id_magFisicoPartenza = newId_magFisicoPartenza;
setMagFisicoPartenza(null);
}
public void setId_magFisicoArrivo(long newId_magFisicoArrivo) {
this.id_magFisicoArrivo = newId_magFisicoArrivo;
setMagFisicoArrivo(null);
}
public void setFlgVisualizzazioneArrivo(long newFlgVisualizzazioneArrivo) {
this.flgVisualizzazioneArrivo = newFlgVisualizzazioneArrivo;
}
public void setFlgVisualizzazionePartenza(long newFlgVisualizzazionePartenza) {
this.flgVisualizzazionePartenza = newFlgVisualizzazionePartenza;
}
public void setFlgCaricoPartenza(long newFlgCaricoPartenza) {
this.flgCaricoPartenza = newFlgCaricoPartenza;
}
public void setFlgScaricoPartenza(long newFlgScaricoPartenza) {
this.flgScaricoPartenza = newFlgScaricoPartenza;
}
public void setFlgCaricoArrivo(long newFlgCaricoArrivo) {
this.flgCaricoArrivo = newFlgCaricoArrivo;
}
public void setFlgScaricoArrivo(long newFlgScaricoArrivo) {
this.flgScaricoArrivo = newFlgScaricoArrivo;
}
public long getId_causaleMagazzino() {
return this.id_causaleMagazzino;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione.trim();
}
public long getId_magFisicoPartenza() {
return this.id_magFisicoPartenza;
}
public long getId_magFisicoArrivo() {
return this.id_magFisicoArrivo;
}
public long getFlgVisualizzazioneArrivo() {
return this.flgVisualizzazioneArrivo;
}
public long getFlgVisualizzazionePartenza() {
return this.flgVisualizzazionePartenza;
}
public long getFlgCaricoPartenza() {
return this.flgCaricoPartenza;
}
public long getFlgScaricoPartenza() {
return this.flgScaricoPartenza;
}
public long getFlgCaricoArrivo() {
return this.flgCaricoArrivo;
}
public long getFlgScaricoArrivo() {
return this.flgScaricoArrivo;
}
public void setMagFisicoPartenza(MagFisico newMagFisicoPartenza) {
this.magFisicoPartenza = newMagFisicoPartenza;
}
public MagFisico getMagFisicoPartenza() {
this.magFisicoPartenza = (MagFisico)getSecondaryObject(
this.magFisicoPartenza,
MagFisico.class, getId_magFisicoPartenza());
return this.magFisicoPartenza;
}
public void setMagFisicoArrivo(MagFisico newMagFisicoArrivo) {
this.magFisicoArrivo = newMagFisicoArrivo;
}
public MagFisico getMagFisicoArrivo() {
this.magFisicoArrivo = (MagFisico)getSecondaryObject(
this.magFisicoArrivo,
MagFisico.class, getId_magFisicoArrivo());
return this.magFisicoArrivo;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,150 @@
package com.ablia.contab;
import com.ablia.anag.Banca;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import java.sql.Date;
public class DistintaRibaCR extends CRAdapter {
private long id_distintaRiba;
private long id_banca;
private Banca banca;
private Date dataPresentazione;
private Date dataPresentazioneDa;
private Date dataPresentazioneA;
private double importoScadenza;
private long flgStatoDistinta;
private long flgAccorpaScadenze;
private long flgContabilizzata;
private String filePdf;
private long timestampElaborazione;
public static final long STATO_BOZZA = 0L;
public static final long STATO_PRESENTATA = 1L;
public DistintaRibaCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public DistintaRibaCR() {}
public Date getDataPresentazione() {
return this.dataPresentazione;
}
public void setDataPresentazione(Date data) {
this.dataPresentazione = data;
}
public double getImportoScadenza() {
return this.importoScadenza;
}
public void setImportoScadenza(double importo) {
this.importoScadenza = importo;
}
public long getFlgStatoDistinta() {
return this.flgStatoDistinta;
}
public void setFlgStatoDistinta(long flgTipoIncasso) {
this.flgStatoDistinta = flgTipoIncasso;
}
public String getDescrizioneFlgStatoDistinta() {
String ret = "";
if (getFlgStatoDistinta() == 0L) {
ret = "Bozza";
} else if (getFlgStatoDistinta() == 1L) {
ret = "Presentata";
}
return ret;
}
public long getId_distintaRiba() {
return this.id_distintaRiba;
}
public void setId_distintaRiba(long id_distintaRiba) {
this.id_distintaRiba = id_distintaRiba;
}
public long getId_banca() {
return this.id_banca;
}
public void setId_banca(long id_banca) {
this.id_banca = id_banca;
setBanca(null);
}
public Banca getBanca() {
this.banca = (Banca)getSecondaryObject(this.banca, Banca.class, getId_banca());
return this.banca;
}
public void setBanca(Banca banca) {
this.banca = banca;
}
public long getFlgAccorpaScadenze() {
return this.flgAccorpaScadenze;
}
public void setFlgAccorpaScadenze(long flgAccorpaScadenze) {
this.flgAccorpaScadenze = flgAccorpaScadenze;
}
public long getFlgContabilizzata() {
return this.flgContabilizzata;
}
public void setFlgContabilizzata(long flgContabilizzata) {
this.flgContabilizzata = flgContabilizzata;
}
public Date getDataPresentazioneDa() {
return this.dataPresentazioneDa;
}
public void setDataPresentazioneDa(Date dataPresentazioneDa) {
this.dataPresentazioneDa = dataPresentazioneDa;
}
public Date getDataPresentazioneA() {
return this.dataPresentazioneA;
}
public void setDataPresentazioneA(Date dataPresentazioneA) {
this.dataPresentazioneA = dataPresentazioneA;
}
public String getFilePdf() {
return (this.filePdf == null) ? "" : this.filePdf;
}
public void setFilePdf(String filePdf) {
this.filePdf = filePdf;
}
public long getTimestampElaborazione() {
return this.timestampElaborazione;
}
public void setTimestampElaborazione(long timestampElaborazione) {
this.timestampElaborazione = timestampElaborazione;
}
}

View file

@ -0,0 +1,164 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.DBAdapter;
import com.ablia.db.ResParm;
import com.ablia.db.WcString;
import com.ablia.util.StringTokenizer;
import com.ablia.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class DocFiglioPadre extends DBAdapter implements Serializable {
private static final long serialVersionUID = 1564387437366L;
private long id_docFiglioPadre;
private long id_documentoPadre;
private long id_documentoFiglio;
private Documento documentoPadre;
private Documento documentoFiglio;
public DocFiglioPadre(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public DocFiglioPadre() {}
public void setId_docFiglioPadre(long newId_documentoPF) {
this.id_docFiglioPadre = newId_documentoPF;
}
public void setId_documentoPadre(long newId_documentoPadre) {
this.id_documentoPadre = newId_documentoPadre;
setDocumentoPadre(null);
}
public void setId_documentoFiglio(long newId_documentoFiglio) {
this.id_documentoFiglio = newId_documentoFiglio;
setDocumentoFiglio(null);
}
public long getId_docFiglioPadre() {
return this.id_docFiglioPadre;
}
public long getId_documentoPadre() {
return this.id_documentoPadre;
}
public long getId_documentoFiglio() {
return this.id_documentoFiglio;
}
public void setDocumentoPadre(Documento newDocumentoPadre) {
this.documentoPadre = newDocumentoPadre;
}
public Documento getDocumentoPadre() {
this.documentoPadre = (Documento)getSecondaryObject(this.documentoPadre, Documento.class, getId_documentoPadre());
return this.documentoPadre;
}
public void setDocumentoFiglio(Documento newDocumentoFiglio) {
this.documentoFiglio = newDocumentoFiglio;
}
public Documento getDocumentoFiglio() {
this.documentoFiglio = (Documento)getSecondaryObject(this.documentoFiglio, Documento.class, getId_documentoFiglio());
return this.documentoFiglio;
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public Vectumerator<DocFiglioPadre> findByCR(DocFiglioPadreCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from DOC_FIGLIO_PADRE AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public void findByFiglioPadre(long l_id_documentoFiglio, long l_id_documentoPadre) {
String s_Sql_Find = "select DISTINCT A.* from DOC_FIGLIO_PADRE AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.id_documentoFiglio=" + l_id_documentoFiglio);
wc.addWc("A.id_documentoPadre=" + l_id_documentoPadre);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
findFirstRecord(stmt);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
}
}
public Vectumerator<DocFiglioPadre> findByFiglio(long l_id_documentoFiglio) {
String s_Sql_Find = "select DISTINCT A.* from DOC_FIGLIO_PADRE AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.id_documentoFiglio=" + l_id_documentoFiglio);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public Vectumerator<DocFiglioPadre> findByPadre(long l_id_documentoPadre) {
String s_Sql_Find = "select DISTINCT A.* from DOC_FIGLIO_PADRE AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.id_documentoPadre=" + l_id_documentoPadre);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public ResParm delete() {
if (getDocumentoFiglio().getTipoDocumento().getFlgTipologia() == 210L) {
getDocumentoFiglio().setFlgStatoLavorazione(0L);
getDocumentoFiglio().superSave();
}
return super.delete();
}
protected void afterDelete() {
super.afterDelete();
}
}

View file

@ -0,0 +1,70 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
public class DocFiglioPadreCR extends CRAdapter {
private long id_docFiglioPadre;
private long id_documentoPadre;
private long id_documentoFiglio;
private Documento documentoPadre;
private Documento documentoFiglio;
public DocFiglioPadreCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public DocFiglioPadreCR() {}
public void setId_docFiglioPadre(long newId_documentoPF) {
this.id_docFiglioPadre = newId_documentoPF;
}
public void setId_documentoPadre(long newId_documentoPadre) {
this.id_documentoPadre = newId_documentoPadre;
setDocumentoPadre(null);
}
public void setId_documentoFiglio(long newId_documentoFiglio) {
this.id_documentoFiglio = newId_documentoFiglio;
setDocumentoFiglio(null);
}
public long getId_docFiglioPadre() {
return this.id_docFiglioPadre;
}
public long getId_documentoPadre() {
return this.id_documentoPadre;
}
public long getId_documentoFiglio() {
return this.id_documentoFiglio;
}
public void setDocumentoPadre(Documento newDocumentoPadre) {
this.documentoPadre = newDocumentoPadre;
}
public Documento getDocumentoPadre() {
this.documentoPadre = (Documento)getSecondaryObject(
this.documentoPadre,
Documento.class, getId_documentoPadre());
return this.documentoPadre;
}
public void setDocumentoFiglio(Documento newDocumentoFiglio) {
this.documentoFiglio = newDocumentoFiglio;
}
public Documento getDocumentoFiglio() {
this.documentoFiglio = (Documento)getSecondaryObject(
this.documentoFiglio,
Documento.class, getId_documentoFiglio());
return this.documentoFiglio;
}
}

View file

@ -0,0 +1,197 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.WcString;
import com.ablia.util.StringTokenizer;
import com.ablia.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class DocPrel extends _ContabAdapter implements Serializable {
public static final long TIPO_GENERAZIONE_RIGA_0 = 0L;
public static final long TIPO_GENERAZIONE_DOC_1 = 1L;
public static final long TIPO_GENERAZIONE_TIPO_ART_2 = 2L;
private long id_docPrel;
private long id_tipoDocumentoPrel;
private long id_tipoDocumento;
private TipoDocumento tipoDocumentoPrel;
private TipoDocumento tipoDocumento;
private long flgTipoGenerazione;
public DocPrel(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public DocPrel() {}
public static final String getTipoGenerazione(long l_flgTipoGenerazione) {
if (l_flgTipoGenerazione == 0L)
return "Riga Riga";
if (l_flgTipoGenerazione == 1L)
return "Per documento";
if (l_flgTipoGenerazione == 2L)
return "Per tipo articolo/riga";
return "";
}
public String getTipoGenerazione() {
return getTipoGenerazione(getFlgTipoGenerazione());
}
public void setId_docPrel(long newId_docPrel) {
this.id_docPrel = newId_docPrel;
}
public void setId_tipoDocumentoPrel(long newId_tipoDocumentoPrel) {
this.id_tipoDocumentoPrel = newId_tipoDocumentoPrel;
setTipoDocumentoPrel(null);
}
public void setId_tipoDocumento(long newId_tipoDocumento) {
this.id_tipoDocumento = newId_tipoDocumento;
setTipoDocumento(null);
}
public long getId_docPrel() {
return this.id_docPrel;
}
public long getId_tipoDocumentoPrel() {
return this.id_tipoDocumentoPrel;
}
public long getId_tipoDocumento() {
return this.id_tipoDocumento;
}
public void setTipoDocumentoPrel(TipoDocumento newTipoDocumentoPrel) {
this.tipoDocumentoPrel = newTipoDocumentoPrel;
}
public TipoDocumento getTipoDocumentoPrel() {
this.tipoDocumentoPrel = (TipoDocumento)getSecondaryObject(this.tipoDocumentoPrel, TipoDocumento.class, getId_tipoDocumentoPrel());
return this.tipoDocumentoPrel;
}
public void setTipoDocumento(TipoDocumento newTipoDocumento) {
this.tipoDocumento = newTipoDocumento;
}
public TipoDocumento getTipoDocumento() {
this.tipoDocumento = (TipoDocumento)getSecondaryObject(this.tipoDocumento, TipoDocumento.class, getId_tipoDocumento());
return this.tipoDocumento;
}
protected void deleteCascade() {}
public Vectumerator findByCR(DocPrelCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from DOC_PREL AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public void findByTipoDocumentoTipoDocumentoPrel(long l_id_tipoDocumento, long l_id_tipoDocumentoPrel) {
String s_Sql_Find = "select A.* from DOC_PREL AS A";
String s_Sql_order = "";
WcString wc = new WcString();
wc.addWc("A.id_tipoDocumento=" + l_id_tipoDocumento);
wc.addWc("A.id_tipoDocumentoPrel=" + l_id_tipoDocumentoPrel);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc + s_Sql_order);
findFirstRecord(stmt);
} catch (Exception e) {
handleDebug(e, 0);
}
}
public Vectumerator findPrelevabiliByTipoDocumentoGen(long l_id_tipoDocumento, long l_tipoRicerca, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from DOC_PREL AS A,TIPO_DOCUMENTO AS B";
String s_Sql_order = " order by B.descrizione";
WcString wc = new WcString();
wc.addWc("A.id_tipoDocumentoPrel=B.id_tipoDocumento");
wc.addWc("A.id_tipoDocumento=" + l_id_tipoDocumento);
if (l_tipoRicerca == 1L) {
wc.addWc("(B.flgUsato is null or A.flgUsato=0)");
} else if (l_tipoRicerca == 2L) {
wc.addWc("B.flgUsato=1");
}
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc + s_Sql_order);
return findRows(stmt, pageNumber, pageRows);
} catch (Exception e) {
handleDebug(e, 0);
return AB_EMPTY_VECTUMERATOR;
}
}
public Vectumerator<DocPrel> findGenerabiliByTipoDocumentoPrel(long l_id_tipoDocumentoPrel, long l_tipoRicerca, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from DOC_PREL AS A,TIPO_DOCUMENTO AS B";
String s_Sql_order = " order by B.descrizione";
WcString wc = new WcString();
wc.addWc("A.id_tipoDocumento=B.id_tipoDocumento");
wc.addWc("A.id_tipoDocumentoPrel=" + l_id_tipoDocumentoPrel);
if (l_tipoRicerca == 1L) {
wc.addWc("(B.flgUsato is null or B.flgUsato=0)");
} else if (l_tipoRicerca == 2L) {
wc.addWc("B.flgUsato=1");
}
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc + s_Sql_order);
return findRows(stmt, pageNumber, pageRows);
} catch (Exception e) {
handleDebug(e, 0);
return AB_EMPTY_VECTUMERATOR;
}
}
public void findByTipoDocumentoGenPrel(long l_id_tipoDocumentoGen, long l_id_tipoDocumentoPrel) {
String s_Sql_Find = "select A.* from DOC_PREL AS A,TIPO_DOCUMENTO AS B";
String s_Sql_order = " order by B.descrizione";
WcString wc = new WcString();
wc.addWc("A.id_tipoDocumentoPrel=B.id_tipoDocumento");
wc.addWc("A.id_tipoDocumentoPrel=" + l_id_tipoDocumentoPrel);
wc.addWc("A.id_tipoDocumento=" + l_id_tipoDocumentoGen);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc + s_Sql_order);
findFirstRecord(stmt);
} catch (Exception e) {
handleDebug(e, 0);
}
}
public long getFlgTipoGenerazione() {
return this.flgTipoGenerazione;
}
public void setFlgTipoGenerazione(long flgTipoGenerazione) {
this.flgTipoGenerazione = flgTipoGenerazione;
}
}

View file

@ -0,0 +1,70 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
public class DocPrelCR extends CRAdapter {
private long id_docPrel;
private long id_tipoDocumentoPrel;
private long id_tipoDocumento;
private TipoDocumento tipoDocumentoPrel;
private TipoDocumento tipoDocumento;
public DocPrelCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public DocPrelCR() {}
public void setId_docPrel(long newId_docPrel) {
this.id_docPrel = newId_docPrel;
}
public void setId_tipoDocumentoPrel(long newId_tipoDocumentoPrel) {
this.id_tipoDocumentoPrel = newId_tipoDocumentoPrel;
setTipoDocumentoPrel(null);
}
public void setId_tipoDocumento(long newId_tipoDocumento) {
this.id_tipoDocumento = newId_tipoDocumento;
setTipoDocumento(null);
}
public long getId_docPrel() {
return this.id_docPrel;
}
public long getId_tipoDocumentoPrel() {
return this.id_tipoDocumentoPrel;
}
public long getId_tipoDocumento() {
return this.id_tipoDocumento;
}
public void setTipoDocumentoPrel(TipoDocumento newTipoDocumentoPrel) {
this.tipoDocumentoPrel = newTipoDocumentoPrel;
}
public TipoDocumento getTipoDocumentoPrel() {
this.tipoDocumentoPrel = (TipoDocumento)getSecondaryObject(
this.tipoDocumentoPrel,
TipoDocumento.class, getId_tipoDocumentoPrel());
return this.tipoDocumentoPrel;
}
public void setTipoDocumento(TipoDocumento newTipoDocumento) {
this.tipoDocumento = newTipoDocumento;
}
public TipoDocumento getTipoDocumento() {
this.tipoDocumento = (TipoDocumento)getSecondaryObject(
this.tipoDocumento,
TipoDocumento.class, getId_tipoDocumento());
return this.tipoDocumento;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,657 @@
package com.ablia.contab;
import com.ablia.anag.Clifor;
import com.ablia.db.ApplParmFull;
import com.ablia.db.WcString;
import com.ablia.util.DoubleOperator;
import com.ablia.util.PdfFontFactory;
import com.ablia.util.SimpleDateFormat;
import com.ablia.util.Vectumerator;
import com.lowagie.text.Cell;
import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.Element;
import com.lowagie.text.Font;
import com.lowagie.text.HeaderFooter;
import com.lowagie.text.PageSize;
import com.lowagie.text.Phrase;
import com.lowagie.text.Table;
import com.lowagie.text.pdf.PdfWriter;
import java.awt.Color;
import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.Serializable;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.text.NumberFormat;
import java.util.Calendar;
public class DocumentoAgente extends _ContabAdapter implements Serializable {
private long id_documentoAgente;
private long id_documento;
private long id_cliforDA;
private double percDocumentoAgente = -1.0D;
private Documento documento;
private Clifor agente;
private double importoDocumentoAgente;
public DocumentoAgente(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public DocumentoAgente() {}
public long getId_documentoAgente() {
return this.id_documentoAgente;
}
public void setId_documentoAgente(long id_documentoAgente) {
this.id_documentoAgente = id_documentoAgente;
}
public long getId_documento() {
return this.id_documento;
}
public void setId_documento(long id_documento) {
this.id_documento = id_documento;
}
public long getId_cliforDA() {
return this.id_cliforDA;
}
public void setId_cliforDA(long id_clifor) {
this.id_cliforDA = id_clifor;
}
public double getPercDocumentoAgente() {
return this.percDocumentoAgente;
}
public void setPercDocumentoAgente(double percDocumentoAgente) {
this.percDocumentoAgente = percDocumentoAgente;
}
public Documento getDocumento() {
this.documento = new Documento(getApFull());
this.documento.findByPrimaryKey(getId_documento());
return this.documento;
}
public void setDocumento(Documento documento) {
this.documento = documento;
}
public Clifor getAgente() {
this.agente = new Clifor(getApFull());
this.agente.findByPrimaryKey(getId_cliforDA());
return this.agente;
}
public void setAgente(Clifor agente) {
this.agente = agente;
}
public Vectumerator findByCR(DocumentoAgenteCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* , B.cognome, B.nome from DOCUMENTO_AGENTE AS A inner join CLIFOR AS B on A.id_cliforDA=B.id_clifor inner join DOCUMENTO as C on A.id_documento=C.id_documento";
String s_Sql_Order = " order by B.cognome, B.nome, A.id_cliforDA";
WcString wc = new WcString();
if (CR.getId_documento() != 0L)
wc.addWc("A.id_documento = " + CR.getId_documento());
if (CR.getId_cliforDA() != 0L)
wc.addWc("A.id_cliforDA = " + CR.getId_cliforDA());
if (CR.getFlgPagata() == 0L) {
wc.addWc("(C.flgPagata is null or C.flgPagata=0)");
} else if (CR.getFlgPagata() > 0L) {
wc.addWc("C.flgPagata =" + CR.getFlgPagata());
}
if (CR.getDataDocumentoDa() != null)
wc.addWc("C.dataDocumento>=?");
if (CR.getDataDocumentoA() != null)
wc.addWc("C.dataDocumento<=?");
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
int dataCount = 0;
if (CR.getDataDocumentoDa() != null) {
dataCount++;
stmt.setDate(dataCount, CR.getDataDocumentoDa());
}
if (CR.getDataDocumentoA() != null) {
dataCount++;
stmt.setDate(dataCount, CR.getDataDocumentoA());
}
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public void findByDocumentoAgente(long l_id_documento, long l_id_agente) {
String s_Sql_Find = "select DISTINCT A.* from DOCUMENTO_AGENTE AS A";
String s_Sql_Order = " ";
WcString wc = new WcString();
wc.addWc("A.id_documento = " + l_id_documento);
wc.addWc("A.id_clifor = " + l_id_agente);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
findFirstRecord(stmt);
} catch (SQLException e) {
handleDebug(e);
}
}
public void deleteAgentiByDocumento(long id_documento) {
DocumentoAgenteCR CR = new DocumentoAgenteCR();
CR.setId_documento(id_documento);
Vectumerator vec = new DocumentoAgente(getApFull()).findByCR(CR, 0, 0);
while (vec.hasMoreElements()) {
DocumentoAgente row = (DocumentoAgente)vec.nextElement();
row.delete();
}
}
public Vectumerator findByDocumento(long id_documento) {
String s_Sql_Find = "select DISTINCT A.* from DOCUMENTO_AGENTE AS A";
String s_Sql_Order = " ";
WcString wc = new WcString();
wc.addWc("A.id_documento = " + id_documento);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public double getImportoDocumentoAgente() {
if (getId_documentoAgente() > 0L && getId_documento() > 0L &&
this.importoDocumentoAgente == -1.0D) {
DoubleOperator dp = new DoubleOperator(getDocumento().getImponibileTotale());
dp.setScale(2, 5);
dp.multiply(getPercDocumentoAgente());
dp.divide(100.0F);
this.importoDocumentoAgente = dp.getResult();
}
return (this.importoDocumentoAgente == -1.0D) ? 0.0D : this.importoDocumentoAgente;
}
public void setImportoDocumentoAgente(double importoDocumentoAgente) {
this.importoDocumentoAgente = importoDocumentoAgente;
}
public String getTotaleProvvigioniByDocumento(long id_documento) {
String s_Sql_Find = "select DISTINCT A.* from DOCUMENTO_AGENTE AS A";
String s_Sql_Order = " ";
WcString wc = new WcString();
wc.addWc("A.id_documento = " + id_documento);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
Vectumerator vec = findRows(stmt);
Documento doc = new Documento(getApFull());
doc.findByPrimaryKey(id_documento);
double totDoc = doc.getTotaleDaPagare();
DoubleOperator totRes = new DoubleOperator(0.0F);
while (vec.hasMoreElements()) {
DocumentoAgente docage = (DocumentoAgente)vec.nextElement();
DoubleOperator dp = new DoubleOperator(totDoc);
dp.multiply(docage.getPercDocumentoAgente());
dp.divide(100.0F);
totRes.add(dp.getResult());
}
NumberFormat nf2 = NumberFormat.getInstance();
nf2.setMaximumFractionDigits(2);
nf2.setMinimumFractionDigits(2);
return String.valueOf(nf2.format(totRes.getResult()));
} catch (SQLException e) {
handleDebug(e);
return "";
}
}
public Vectumerator findByDocumentoOld(long id_documento) {
String s_Sql_Find = "select DISTINCT A.* from DOCUMENTO_AGENTE AS A";
String s_Sql_Order = " ";
WcString wc = new WcString();
wc.addWc("A.id_documento = " + id_documento);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
Vectumerator vec = findRows(stmt);
Vectumerator vecres = new Vectumerator();
Documento doc = new Documento(getApFull());
doc.findByPrimaryKey(id_documento);
double totDoc = doc.getTotaleDaPagare();
while (vec.hasMoreElements()) {
DocumentoAgente docage = (DocumentoAgente)vec.nextElement();
DoubleOperator dp = new DoubleOperator(totDoc);
dp.multiply(docage.getPercDocumentoAgente());
dp.divide(100.0F);
docage.setImportoDocumentoAgente(dp.getResult());
vecres.add(docage);
}
return vecres;
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
protected void initFields() {
super.initFields();
this.importoDocumentoAgente = -1.0D;
}
public ByteArrayOutputStream creaPdfreportProvvigioni(DocumentoAgenteCR CR, RigaDocumentoProgettistaCR CRRDA) {
ByteArrayOutputStream ba = new ByteArrayOutputStream();
Cell cell = new Cell();
int cellLeading = 10;
int corpoPadding = 2;
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdfh = new SimpleDateFormat("hh:mm");
NumberFormat nf = NumberFormat.getInstance();
nf.setMinimumFractionDigits(2);
nf.setMaximumFractionDigits(2);
Date dataVisita = null;
int col1 = 5, col2 = 18, col3 = 4, col4 = 4, col5 = 4, col6 = 2, col7 = 3;
try {
this.document = new Document(PageSize.A4, 20.0F, 20.0F, 20.0F, 10.0F);
String nomeFile = CR.getFileName();
if (nomeFile.isEmpty()) {
this.writer = PdfWriter.getInstance(this.document, ba);
} else {
PdfWriter.getInstance(this.document, new FileOutputStream(nomeFile));
}
Font PDF_riga = PdfFontFactory.PDF_fPiccolo;
Phrase pHh = new Phrase(new Chunk("Provvigioni Agenti " + CR.getDescrizioneCR(), PdfFontFactory.PDF_fGrandeB));
HeaderFooter header = new HeaderFooter(pHh, false);
header.setAlignment(0);
header.setBorder(0);
this.document.setHeader(header);
Phrase pH = new Phrase("Data/ora stampa: " + sdf.format(getToday()) + " " + sdfh.format(Long.valueOf(cal.getTimeInMillis())) + " pag. ");
HeaderFooter footer = new HeaderFooter(pH, true);
footer.setAlignment(2);
footer.setBorder(0);
this.document.setFooter(footer);
this.document.open();
DocumentoAgente bean = new DocumentoAgente(getApFull());
Table corpo = null;
corpo = new Table(40);
corpo.setWidth(100.0F);
corpo.setPadding((float)corpoPadding);
corpo.setSpacing(0.0F);
corpo.setWidths(colWidthsRighe40);
corpo.setBorder(0);
corpo.endHeaders();
long l_id_currentAgente = 0L;
Clifor currentAgente = null;
Vectumerator<DocumentoAgente> vec = bean.findByCR(CR, 0, 0);
DoubleOperator totProvvAgente = new DoubleOperator(), totProvvigioni = new DoubleOperator();
while (vec.hasMoreElements()) {
DocumentoAgente row = (DocumentoAgente)vec.nextElement();
if (row.getId_cliforDA() != l_id_currentAgente) {
if (l_id_currentAgente > 0L) {
cell = new Cell();
cell.add(new Chunk("TOTALE provvigioni per " + currentAgente.getDescrizioneCompleta(), PdfFontFactory.PDF_fGrandeB));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.LIGHT_GRAY);
cell.setColspan(40 - col7);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk(getNf().format(totProvvAgente.getResult()), PdfFontFactory.PDF_fGrandeB));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.LIGHT_GRAY);
cell.setColspan(col7);
cell.setRowspan(1);
corpo.addCell(cell);
this.document.add((Element)corpo);
this.document.newPage();
corpo = new Table(40);
corpo.setWidth(100.0F);
corpo.setPadding((float)corpoPadding);
corpo.setSpacing(0.0F);
corpo.setWidths(colWidthsRighe40);
corpo.setBorder(0);
}
cell = new Cell();
cell.add(new Chunk("Elenco provvigioni per " + row.getAgente().getDescrizioneCompleta() + " (" +
row.getAgente().getDescrizioneAgenteResponsabileCommerciale() + ")", PdfFontFactory.PDF_fGrandeB));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.LIGHT_GRAY);
cell.setColspan(40);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk("N. Doc.", PdfFontFactory.PDF_fMedioB));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.LIGHT_GRAY);
cell.setColspan(col1);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk("Intestazione", PdfFontFactory.PDF_fMedioB));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.LIGHT_GRAY);
cell.setColspan(col2);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk("Data Doc.", PdfFontFactory.PDF_fMedioB));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.LIGHT_GRAY);
cell.setColspan(col3);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk("Tot. Doc.", PdfFontFactory.PDF_fMedioB));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.LIGHT_GRAY);
cell.setColspan(col4);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk("Imponibile", PdfFontFactory.PDF_fMedioB));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.LIGHT_GRAY);
cell.setColspan(col5);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk("Perc.%", PdfFontFactory.PDF_fMedioB));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.LIGHT_GRAY);
cell.setColspan(col6);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk("Importo", PdfFontFactory.PDF_fMedioB));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.LIGHT_GRAY);
cell.setColspan(col7);
cell.setRowspan(1);
corpo.addCell(cell);
l_id_currentAgente = row.getId_cliforDA();
currentAgente = row.getAgente();
totProvvAgente = new DoubleOperator();
}
totProvvAgente.add(row.getImportoDocumentoAgente());
totProvvigioni.add(row.getImportoDocumentoAgente());
cell = new Cell();
cell.add(new Chunk(row.getDocumento().getNumeroDocumentoCompleto(), PDF_riga));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setColspan(col1);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk(row.getDocumento().getNominativoDocumento(), PDF_riga));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setColspan(col2);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk(getDataFormat().format(row.getDocumento().getDataDocumento()), PdfFontFactory.PDF_fPiccolo));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setColspan(col3);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk(getNf().format(row.getDocumento().getTotaleDocumento()), PDF_riga));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setColspan(col4);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk(getNf().format(row.getDocumento().getImponibileTotale()), PDF_riga));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setColspan(col5);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk(getNf().format(row.getPercDocumentoAgente()), PDF_riga));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setColspan(col6);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk(nf.format(row.getImportoDocumentoAgente()), PDF_riga));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setColspan(col7);
cell.setRowspan(1);
corpo.addCell(cell);
}
if (l_id_currentAgente > 0L) {
cell = new Cell();
cell.add(new Chunk("TOTALE provvigioni per " + currentAgente.getDescrizioneCompleta(), PdfFontFactory.PDF_fGrandeB));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.LIGHT_GRAY);
cell.setColspan(40 - col7);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk(getNf().format(totProvvAgente.getResult()), PdfFontFactory.PDF_fGrandeB));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.LIGHT_GRAY);
cell.setColspan(col7);
cell.setRowspan(1);
corpo.addCell(cell);
}
this.document.add((Element)corpo);
RigaDocumentoProgettista beanRDA = new RigaDocumentoProgettista(getApFull());
corpo = new Table(40);
corpo.setWidth(100.0F);
corpo.setPadding((float)corpoPadding);
corpo.setSpacing(0.0F);
corpo.setWidths(colWidthsRighe40);
corpo.setBorder(0);
corpo.endHeaders();
long l_id_currentProgettista = 0L;
Clifor currentProgettista = null;
Vectumerator<RigaDocumentoProgettista> vecP = beanRDA.findByCR(CRRDA, 0, 0);
if (vecP.hasMoreElements())
this.document.newPage();
DoubleOperator totProvvProgettista = new DoubleOperator(), totProvvigioniP = new DoubleOperator();
while (vecP.hasMoreElements()) {
RigaDocumentoProgettista row = (RigaDocumentoProgettista)vecP.nextElement();
if (row.getId_cliforRDA() != l_id_currentProgettista) {
if (l_id_currentProgettista > 0L) {
cell = new Cell();
cell.add(new Chunk("TOTALE provvigioni per " + row.getProgettista().getDescrizioneCompleta(), PdfFontFactory.PDF_fGrandeB));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.LIGHT_GRAY);
cell.setColspan(40 - col7);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk(getNf().format(totProvvProgettista.getResult()), PdfFontFactory.PDF_fGrandeB));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.LIGHT_GRAY);
cell.setColspan(col7);
cell.setRowspan(1);
corpo.addCell(cell);
this.document.add((Element)corpo);
this.document.newPage();
corpo = new Table(40);
corpo.setWidth(100.0F);
corpo.setPadding((float)corpoPadding);
corpo.setSpacing(0.0F);
corpo.setWidths(colWidthsRighe40);
corpo.setBorder(0);
}
cell = new Cell();
cell.add(new Chunk("Elenco provvigioni per " + row.getProgettista().getDescrizioneCompleta(), PdfFontFactory.PDF_fGrandeB));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.LIGHT_GRAY);
cell.setColspan(40);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk("N. Doc.", PdfFontFactory.PDF_fMedioB));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.LIGHT_GRAY);
cell.setColspan(col1);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk("Intestazione", PdfFontFactory.PDF_fMedioB));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.LIGHT_GRAY);
cell.setColspan(col2);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk("Data Doc.", PdfFontFactory.PDF_fMedioB));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.LIGHT_GRAY);
cell.setColspan(col3);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk("Articolo", PdfFontFactory.PDF_fMedioB));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.LIGHT_GRAY);
cell.setColspan(col4);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk("Imponibile", PdfFontFactory.PDF_fMedioB));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.LIGHT_GRAY);
cell.setColspan(col5);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk("Perc.%", PdfFontFactory.PDF_fMedioB));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.LIGHT_GRAY);
cell.setColspan(col6);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk("Importo", PdfFontFactory.PDF_fMedioB));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.LIGHT_GRAY);
cell.setColspan(col7);
cell.setRowspan(1);
corpo.addCell(cell);
l_id_currentProgettista = row.getId_cliforRDA();
currentProgettista = row.getProgettista();
totProvvProgettista = new DoubleOperator();
}
totProvvProgettista.add(row.getImportoRDA());
totProvvigioniP.add(row.getImportoRDA());
cell = new Cell();
cell.add(new Chunk(row.getRigaDocumento().getDocumento().getNumeroDocumentoCompleto(), PDF_riga));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setColspan(col1);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk(row.getRigaDocumento().getDocumento().getNominativoDocumento(), PDF_riga));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setColspan(col2);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk(getDataFormat().format(row.getRigaDocumento().getDocumento().getDataDocumento()), PdfFontFactory.PDF_fPiccolo));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setColspan(col3);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk(row.getRigaDocumento().getDescrizioneRigaCompleta(), PDF_riga));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setColspan(col4);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk(nf.format(row.getRigaDocumento().getTotImponibileRigaConSconto()), PDF_riga));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setColspan(col5);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk(getNf().format(row.getPercRDA()), PDF_riga));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setColspan(col6);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk(nf.format(row.getImportoRDA()), PDF_riga));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setColspan(col7);
cell.setRowspan(1);
corpo.addCell(cell);
}
if (l_id_currentProgettista > 0L) {
cell = new Cell();
cell.add(new Chunk("TOTALE provvigioni per " + currentProgettista.getDescrizioneCompleta(), PdfFontFactory.PDF_fGrandeB));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.LIGHT_GRAY);
cell.setColspan(40 - col7);
cell.setRowspan(1);
corpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk(getNf().format(totProvvProgettista.getResult()), PdfFontFactory.PDF_fGrandeB));
cell.setLeading((float)cellLeading);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.LIGHT_GRAY);
cell.setColspan(col7);
cell.setRowspan(1);
corpo.addCell(cell);
}
this.document.add((Element)corpo);
this.document.close();
this.document = null;
} catch (Exception e) {
e.printStackTrace();
}
return ba;
}
}

View file

@ -0,0 +1,132 @@
package com.ablia.contab;
import com.ablia.anag.Clifor;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import com.ablia.db.FieldsDescriptor;
import java.sql.Date;
import java.util.HashMap;
public class DocumentoAgenteCR extends CRAdapter {
private long id_documentoAgente;
private long id_documento;
private long id_cliforDA;
private double percDocumentoAgente;
private Documento documento;
private Clifor agente;
private Date dataDocumentoA;
private Date dataDocumentoDa;
private long flgPagata = -1L;
public DocumentoAgenteCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public DocumentoAgenteCR() {}
public long getId_documentoAgente() {
return this.id_documentoAgente;
}
public void setId_documentoAgente(long id_documentoAgente) {
this.id_documentoAgente = id_documentoAgente;
}
public long getId_documento() {
return this.id_documento;
}
public void setId_documento(long id_documento) {
this.id_documento = id_documento;
}
public long getId_cliforDA() {
return this.id_cliforDA;
}
public String getPagata() {
return getPagata(getFlgPagata());
}
public final String getPagata(long l_flgPagata) {
if (l_flgPagata == 0L)
return "No";
if (l_flgPagata == 1L)
return "Si";
return "";
}
public void setId_cliforDA(long id_clifor) {
this.id_cliforDA = id_clifor;
}
public double getPercDocumentoAgente() {
return this.percDocumentoAgente;
}
public void setPercDocumentoAgente(double percDocumentoAgente) {
this.percDocumentoAgente = percDocumentoAgente;
}
public Documento getDocumento() {
this.documento = new Documento(getApFull());
this.documento.findByPrimaryKey(getId_documento());
return this.documento;
}
public void setDocumento(Documento documento) {
this.documento = documento;
}
public Clifor getAgente() {
this.agente = new Clifor(getApFull());
this.agente.findByPrimaryKey(getId_cliforDA());
return this.agente;
}
public void setAgente(Clifor agente) {
this.agente = agente;
}
public Date getDataDocumentoA() {
return this.dataDocumentoA;
}
public void setDataDocumentoA(Date dataDocumentoA) {
this.dataDocumentoA = dataDocumentoA;
}
public Date getDataDocumentoDa() {
return this.dataDocumentoDa;
}
public void setDataDocumentoDa(Date dataDocumentoDa) {
this.dataDocumentoDa = dataDocumentoDa;
}
public long getFlgPagata() {
return this.flgPagata;
}
public void setFlgPagata(long flgPagata) {
this.flgPagata = flgPagata;
}
protected void initCrFieldDescriptor() {
if (this.crFieldDescriptor == null) {
this.crFieldDescriptor = new HashMap();
this.crFieldDescriptor.put("id_cliforDA", new FieldsDescriptor("id_cliforDA", 10L, "Agente", ""));
this.crFieldDescriptor.put("dataDocumentoDa", new FieldsDescriptor("dataDocumentoDa", 40L, "Data Documento Da", ""));
this.crFieldDescriptor.put("dataDocumentoA", new FieldsDescriptor("dataDocumentoA", 50L, "Data Documento A", ""));
this.crFieldDescriptor.put("flgPagata", new FieldsDescriptor("flgPagata", 60L, "Pagata", ""));
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,796 @@
package com.ablia.contab;
import com.ablia.anag.Aspetto;
import com.ablia.anag.CausaleTrasporto;
import com.ablia.anag.Clifor;
import com.ablia.anag.Comune;
import com.ablia.anag.DestinazioneDiversa;
import com.ablia.anag.Esercizio;
import com.ablia.anag.Iva;
import com.ablia.anag.Porto;
import com.ablia.anag.RegCassa;
import com.ablia.anag.TipoPagamento;
import com.ablia.anag.Users;
import com.ablia.anag.Vettore;
import com.ablia.common.Parm;
import com.ablia.contab.iva.RigheRegistroIva;
import com.ablia.db.ApplParmFull;
import com.ablia.db.ResParm;
import com.ablia.db.WcString;
import com.ablia.util.Vectumerator;
import java.io.ByteArrayOutputStream;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.Time;
public interface DocumentoInterface {
ApplParmFull getApFull();
ResParm delete();
Parm getParm(String paramString);
ResParm getFatturaElettronicaXml();
void findByPrimaryKey(long paramLong);
void setId_documento(long paramLong);
void setId_tipoDocumento(long paramLong);
void setId_clifor(long paramLong);
void setId_vettore(long paramLong);
void setId_tipoPagamento(long paramLong);
void setFlgSys(long paramLong);
void setCurrentFocus(String paramString);
void setFlgStato(long paramLong);
void setDataDocumento(Date paramDate);
void setProgDocumento(long paramLong);
void setId_esercizio(long paramLong);
void setRiferimento(String paramString);
void setDataRiferimento(Date paramDate);
void setFlgTipoDocumento(long paramLong);
void setScontoIncondizionato(double paramDouble);
void setDataPagamento(Date paramDate);
void setDataRegistrazioneDI(Date paramDate);
void setDichiarazioneIntento(String paramString);
void setFlgArt8(long paramLong);
void setFlgPagata(long paramLong);
void setFlgExport(long paramLong);
void setFlgTrasporto(long paramLong);
void setKgLordo(double paramDouble);
void setNColli(long paramLong);
void setDataStampaBollato(Date paramDate);
void setDataStampaIva(Date paramDate);
void setFlgTrasportoAssicurato(long paramLong);
void setNotaSpedizione(String paramString);
void setDataConsegna(Date paramDate);
void setOraConsegna(Time paramTime);
void setSpeseTrasporto(double paramDouble);
void setSpeseAltre(double paramDouble);
void setDescSpeseAltre(String paramString);
void setId_aspetto(long paramLong);
long getId_documento();
long getId_tipoDocumento();
long getId_clifor();
long getId_vettore();
long getId_tipoPagamento();
long getFlgSys();
long getFlgStato();
Date getDataDocumento();
long getProgDocumento();
long getId_esercizio();
long getId_contatore();
String getRiferimento();
Date getDataRiferimento();
long getFlgTipoDocumento();
double getScontoIncondizionato();
Date getDataPagamento();
Date getDataRegistrazioneDI();
String getDichiarazioneIntento();
long getFlgArt8();
long getFlgPagata();
long getFlgExport();
long getFlgTrasporto();
double getKgLordo();
long getNColli();
Date getDataStampaBollato();
Date getDataStampaIva();
long getFlgTrasportoAssicurato();
String getNotaSpedizione();
Date getDataConsegna();
Time getOraConsegna();
double getSpeseTrasporto();
double getSpeseAltre();
String getDescSpeseAltre();
long getId_aspetto();
void setTipoDocumento(TipoDocumento paramTipoDocumento);
TipoDocumento getTipoDocumento();
void setClifor(Clifor paramClifor);
Clifor getClifor();
void setVettore(Vettore paramVettore);
Vettore getVettore();
void setTipoPagamento(TipoPagamento paramTipoPagamento);
TipoPagamento getTipoPagamento();
void setEsercizio(Esercizio paramEsercizio);
Esercizio getEsercizio();
void setAspetto(Aspetto paramAspetto);
Aspetto getAspetto();
String getTrasporto();
boolean isRigheConSeriali();
boolean isProgConBuchi();
boolean isProgConBuchi(long paramLong);
ResParm save();
RigheRegistroIva getRigaRegistroIva();
RigheRegistroIva getRigaRegistroIvaCompleto();
Vectumerator findRigheDocumento(long paramLong, String paramString, int paramInt1, int paramInt2, int paramInt3);
double getImponibileRighe();
void setImponibileRighe(double paramDouble);
double getImportoIvaRighe();
void setImportoIvaRighe(double paramDouble);
double getImportoRMRighe();
void setImportoRMRighe(double paramDouble);
String getNumeroDocumento();
String getNumeroDocumentoCompleto();
double getTotaleDocumento();
double getImportoIvaTotale();
double getImponibileTotale();
String trovaPrimoBuco();
String trovaPrimoBuco(long paramLong);
String getNote();
void setNote(String paramString);
long getFlgStatoPrecedente();
void setFlgStatoPrecedente(long paramLong);
ResParm delRigaDocumento(RigaDocumento paramRigaDocumento);
void setImportoIvaTotale(double paramDouble);
void setImponibileTotale(double paramDouble);
double getTotaleAltriCosti();
long getFlgAutoAdd();
void setFlgAutoAdd(long paramLong);
long getFlgSingleLineArt();
void setFlgSingleLineArt(long paramLong);
ByteArrayOutputStream creaLabelDocumentoArticoliA4Pdf(DocumentoCR paramDocumentoCR);
Documento getDocumentoFiglio();
void setDocumentoFiglio(Documento paramDocumento);
long getId_documentoFiglio();
void setId_documentoFiglio(long paramLong);
long getFlgEmettiFatturaScontrino();
void setFlgEmettiFatturaScontrino(long paramLong);
ResParm generaScontrino();
boolean isScontrinoEmesso();
void setEchoScontrino(String paramString);
ResParm stampaScontrino(boolean paramBoolean, RegCassa paramRegCassa);
ResParm aggiornaEchoScontrino(String paramString);
ResParm creaDocumentoFiglio(long paramLong1, long paramLong2, Users paramUsers, boolean paramBoolean, long paramLong3);
String getEchoScontrino();
long getTipoRigaDocumento();
ByteArrayOutputStream creaDocumentoPdf(DocumentoCR paramDocumentoCR, boolean paramBoolean);
String getNumeroDocumentoPdf();
Comune getComuneSped();
long getId_comuneSped();
String getIndirizzoSped();
String getPresso();
void setId_comuneSped(long paramLong);
void setIndirizzoSped(String paramString);
void setPresso(String paramString);
void setComuneSped(Comune paramComune);
String getDescrizioneDocumentiPadre();
boolean hasLabelDaStampare();
String getStato();
Vectumerator findRigheDocumentoPrelevabili(int paramInt1, int paramInt2);
ResParm addRigaDocumentoDaPrelevare(RigaDocumento paramRigaDocumento, double paramDouble);
ResParm delRigaDocumentoDaPrelevare(long paramLong1, long paramLong2);
Vectumerator findRigheDocumentoPrelevateAssociate(int paramInt1, int paramInt2);
String getNumeroCivicoSped();
void setNumeroCivicoSped(String paramString);
String getDocumentoPrelevato();
void setFlgDocumentoPrelevato(long paramLong);
void aggiornaFlgDocumentoPrelevato(long paramLong);
void verificaEAggiornaFlgDocumentoPrelevato();
boolean isPrelevata();
long getTipoCaricoScarico();
ByteArrayOutputStream creaReportPdf(int paramInt, DocumentoCR paramDocumentoCR);
double getImportoTotaleRigheCorrispettivi();
double getImportoTotale();
void setImportoTotale(double paramDouble);
boolean isDataOkOld();
void findByProgressivoEsercizioContatore(long paramLong1, long paramLong2, long paramLong3);
long getFlgMantieniArticoloRiga();
void setFlgMantieniArticoloRiga(long paramLong);
double getAcconto();
void setAcconto(double paramDouble);
long getFlgStatoPrenotazione();
void setFlgStatoPrenotazione(long paramLong);
boolean isDocumentoFiglioCreabile();
boolean isCaricoConIva();
boolean hasRigheDocumento();
boolean hasRigheDocumento2();
long getNumPagDocumento();
void setNumPagDocumento(long paramLong);
String getDescrizioneRigheHtmlOld();
void setAbbuono(double paramDouble);
double getKgNetto();
void setKgNetto(double paramDouble);
double getVolume();
void setVolume(double paramDouble);
CausaleTrasporto getCausaleTrasporto();
void setCausaleTrasporto(CausaleTrasporto paramCausaleTrasporto);
long getId_causaleTrasporto();
void setId_causaleTrasporto(long paramLong);
double getSpeseIncasso();
void setSpeseIncasso(double paramDouble);
double getTotaleDaPagare();
String getBancaDesc();
String getEMailDocumento();
void setBancaDesc(String paramString);
void setEMailDocumento(String paramString);
Vectumerator findRigheDocumento(long paramLong, int paramInt1, int paramInt2, int paramInt3);
void setId_contatore(long paramLong);
String getStatoPrenotazione();
String getStatoCompleto();
String getIban();
void setIban(String paramString);
String getAbi();
String getCab();
String getConto();
void findPrimoScontrinoAperto(long paramLong);
String getNotePagamento();
void setNotePagamento(String paramString);
long getId_destinazioneDiversa();
void setId_destinazioneDiversa(long paramLong);
DestinazioneDiversa getDestinazioneDiversa();
void setDestinazioneDiversa(DestinazioneDiversa paramDestinazioneDiversa);
ResParm impostaFlgPagata(long paramLong);
String getDescDocumenti();
void setDescDocumenti(String paramString);
String getProgDocumentoAgg();
void setProgDocumentoAgg(String paramString);
ByteArrayOutputStream creaLabelDocumentoArticoliAccA4Pdf(DocumentoCR paramDocumentoCR);
boolean hasLabelAccessoriDaStampare();
Date getDataAvviso();
void setDataAvviso(Date paramDate);
Date getDataChiusura();
void setDataChiusura(Date paramDate);
long getId_users();
Users getUsers();
void setId_users(long paramLong);
void setUsers(Users paramUsers);
String getNominativoDocumento();
ResParm inviaAvviso();
double getAbbuono();
String getCellDocumento();
void setCellDocumento(String paramString);
long getFlgInviaAvviso();
void setFlgInviaAvviso(long paramLong);
String getInviaAvviso();
ResParm aggiornaStatoPrenotazione(long paramLong1, long paramLong2);
double getPercContIntegrativo();
void setPercContIntegrativo(double paramDouble);
double getPercRitenutaAcconto();
void setPercRitenutaAcconto(double paramDouble);
double getRimborsoArt15();
void setRimborsoArt15(double paramDouble);
double getImportoContIntegrativo();
void setRigaRegistroIva(RigheRegistroIva paramRigheRegistroIva);
void setRigaRegistroIvaCompleto(RigheRegistroIva paramRigheRegistroIva);
double getTotaleDocumentoSenzaRitenuta();
double getImportoRitenutaAcconto();
Date getDataScadenzaPagamento();
void setDataScadenzaPagamento(Date paramDate);
long getFlgPagamentoDataFissa();
void setFlgPagamentoDataFissa(long paramLong);
String getPagamentoDataFissa();
long getFlgHaDocumentoPadre();
void setFlgHaDocumentoPadre(long paramLong);
void findOrdineBozza(long paramLong);
ByteArrayOutputStream creaSlip(DocumentoCR paramDocumentoCR);
long getFlgInserisciReso();
void setFlgInserisciReso(long paramLong);
String getDescrizioneRigheHtml();
long getTipoAvviso();
String getTipoAvvisoDesc();
long getFlgInGaranzia();
void setFlgInGaranzia(long paramLong);
long getFlgStatoRiparazione();
void setFlgStatoRiparazione(long paramLong);
double getCauzione();
void setCauzione(double paramDouble);
String getStatoRiparazione();
long getFlgHasDocumentiPrelevabili();
void setFlgHasDocumentiPrelevabili(long paramLong);
ResParm aggiornaStatoRiparazione(long paramLong);
String getDescrizioneDifetto();
void setDescrizioneDifetto(String paramString);
String getIntestazioneDocumento();
void setInterventoEffettuato(String paramString);
long getFlgPreventivo();
void setFlgPreventivo(long paramLong);
double getImportoPreventivo();
void setImportoPreventivo(double paramDouble);
String getNotaAggiuntiva();
void setNotaAggiuntiva(String paramString);
String getDescrizionePreventivo();
void setDescrizionePreventivo(String paramString);
ResParm aggiornaDataAvviso(Date paramDate);
void findDocumentoBozza(long paramLong1, long paramLong2);
String getFaxDocumento();
void setFaxDocumento(String paramString);
String getTelDocumento();
void setTelDocumento(String paramString);
long getId_usersIntervento();
void setId_usersIntervento(long paramLong);
long getId_usersChiusura();
void setId_usersChiusura(long paramLong);
Users getUsersIntervento();
void setUsersIntervento(Users paramUsers);
Users getUsersChiusura();
void setUsersChiusura(Users paramUsers);
long getFlgStatoRiparazionePrecedente();
void setFlgStatoRiparazionePrecedente(long paramLong);
String getInGaranzia();
Vectumerator findDocumentiFiglio();
Vectumerator findDocumentiPadre();
String getDescrizioneRigheHtmlCompleta();
boolean isUnDocumentoFiglioCreato();
String getDocumentiFigliDesc();
Documento getDocumentoFiglioUno();
void setDocumentoFiglioUno(Documento paramDocumento);
long getId_porto();
void setId_porto(long paramLong);
Porto getPorto();
void setPorto(Porto paramPorto);
boolean isDataOk();
void findPrecedente(long paramLong1, long paramLong2, long paramLong3);
void findSuccessiva(long paramLong1, long paramLong2, long paramLong3);
long getId_tipoDocumentoFiglio();
void setId_tipoDocumentoFiglio(long paramLong);
long getId_esercizioB();
void setId_esercizioB(long paramLong);
long getProgDocumentoB();
void setProgDocumentoB(long paramLong);
String getProgDocumentoAggB();
void setProgDocumentoAggB(String paramString);
void findByCRCreateWC(DocumentoCR paramDocumentoCR, StringBuffer paramStringBuffer, WcString paramWcString);
Vectumerator findByCR(DocumentoCR paramDocumentoCR, int paramInt1, int paramInt2);
void findByCRCreateStmtDate(DocumentoCR paramDocumentoCR, PreparedStatement paramPreparedStatement);
long getFlgDocumentoPrelevato();
boolean isRientro(String paramString);
Vectumerator findRientri(String paramString);
boolean hasRigheDocumentoPrenotazioneArrivate();
long getFlgTipoMovimento();
void setFlgTipoMovimento(long paramLong);
ResParm delAllegato(AllegatoDocumento paramAllegatoDocumento);
ResParm addAllegato(AllegatoDocumento paramAllegatoDocumento);
Vectumerator getAllegati(long paramLong);
void setNominativoDocumento(String paramString);
long getId_cliforListino();
void setId_cliforListino(long paramLong);
Clifor getCliforListino();
void setCliforListino(Clifor paramClifor);
void applicaListinoByClifor(Clifor paramClifor);
String getDescrizioneAllegato();
void setDescrizioneAllegato(String paramString);
long getId_ivaDoc();
Iva getIvaDoc();
void setId_ivaDoc(long paramLong);
void setIvaDoc(Iva paramIva);
String getInterventoEffettuato();
double getImportoConsuntivo();
void setImportoConsuntivo(double paramDouble);
ByteArrayOutputStream creaLabelDocumentoArticoliAccZebraPdf(DocumentoCR paramDocumentoCR);
ByteArrayOutputStream creaLabelDocumentoArticoliZebraPdf(DocumentoCR paramDocumentoCR);
String getDescTransaction();
void setDescTransaction(String paramString);
Date getDataTransaction();
void setDataTransaction(Date paramDate);
long getFlgProcediPagamento();
void setFlgProcediPagamento(long paramLong);
long getFlgStatoOrdineWww();
void setFlgStatoOrdineWww(long paramLong);
long getId_ordine();
String getStatoOrdineWww();
long getStatoPagato();
ResParm sendResoMailMessage();
void setId_ordine(long paramLong);
String getCapSped();
String getCittaSped();
void setCapSped(String paramString);
void setCittaSped(String paramString);
String getProvinciaSped();
void setProvinciaSped(String paramString);
String getPathAttach();
String getId_documentoXpay();
void setId_documentoXpay(String paramString);
ResParm agiornaNuovoId_documentoXpay();
void findByDocumentoXpay(String paramString);
ResParm sendOrderMailMessage(String paramString, boolean paramBoolean1, boolean paramBoolean2, boolean paramBoolean3);
String getId_ordineCript();
ResParm stampaScontrinoEpson(boolean paramBoolean, RegCassa paramRegCassa);
ResParm stampaReportFinanziario(RegCassa paramRegCassa);
ResParm stampaReportGiornaliero(RegCassa paramRegCassa);
ResParm ristampaScontrino(RegCassa paramRegCassa);
long getLastUpdId_user();
Object getCurrentTab();
boolean isFatturaONotaDiCredito();
String getAbiCF();
String getCabCF();
String getContoCF();
long getTipoCaricoScarico2();
}

View file

@ -0,0 +1,42 @@
package com.ablia.contab;
import com.lowagie.text.Document;
import com.lowagie.text.Table;
public class DocumentoPDF {
private Document document;
private Table pdfcorpo;
public DocumentoPDF(Document document, Table pdfcorpo, int pageNumber) {
this.document = document;
this.pdfcorpo = pdfcorpo;
this.pageNumber = pageNumber;
}
private int pageNumber = 0;
public Document getDocument() {
return this.document;
}
public void setDocument(Document document) {
this.document = document;
}
public Table getPdfcorpo() {
return this.pdfcorpo;
}
public void setPdfcorpo(Table pdfcorpo) {
this.pdfcorpo = pdfcorpo;
}
public int getPageNumber() {
return this.pageNumber;
}
public void setPageNumber(int pageNumber) {
this.pageNumber = pageNumber;
}
}

View file

@ -0,0 +1,873 @@
package com.ablia.contab;
import com.ablia.anag.TipoPagamento;
import com.ablia.db.ApplParmFull;
import com.ablia.db.ResParm;
import com.ablia.db.WcString;
import com.ablia.util.DoubleOperator;
import com.ablia.util.PdfFontFactory;
import com.ablia.util.SimpleDateFormat;
import com.ablia.util.Vectumerator;
import com.lowagie.text.Cell;
import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.Element;
import com.lowagie.text.HeaderFooter;
import com.lowagie.text.PageSize;
import com.lowagie.text.Phrase;
import com.lowagie.text.pdf.PdfWriter;
import java.awt.Color;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.Serializable;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.text.NumberFormat;
import java.util.Calendar;
public class DocumentoPagamento extends _ContabAdapter implements Serializable {
private static final long serialVersionUID = 8044331984020899695L;
private long id_documentoPagamento;
private long id_documento;
private Documento documento;
private Date data;
private double importo;
private String nota;
private long id_tipoPagamento;
private TipoPagamento tipoPagamento;
private long flgTipoMovimento;
private long flgTipoIncasso;
public static final long DOCUMENTI_TUTTI = 0L;
public static final long DOCUMENTI_APERTI = 1L;
public static final long DOCUMENTI_CHIUSI = 2L;
public static final long TIPO_MOVIMENTO_DOCUMENTO = 1L;
public static final long TIPO_MOVIMENTO_RATA = 2L;
public static final long TIPO_MOVIMENTO_STORNO = 3L;
public static final long TIPO_INCASSO_ACCONTO = 0L;
public static final long TIPO_INCASSO_SALDO = 1L;
public DocumentoPagamento(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public DocumentoPagamento() {}
public long getId_documentoPagamento() {
return this.id_documentoPagamento;
}
public void setId_documentoPagamento(long id_incassoPagamento) {
this.id_documentoPagamento = id_incassoPagamento;
}
public Date getData() {
return this.data;
}
public void setData(Date data) {
this.data = data;
}
public double getImporto() {
return this.importo;
}
public void setImporto(double importo) {
this.importo = importo;
}
public String getNota() {
return (this.nota == null) ? "" : this.nota.trim();
}
public void setNota(String nota) {
this.nota = nota;
}
public long getId_documento() {
return this.id_documento;
}
public void setId_documento(long id_documento) {
this.id_documento = id_documento;
}
public Documento getDocumento() {
this.documento = (Documento)getSecondaryObject(this.documento, Documento.class, getId_documento());
return this.documento;
}
public void setDocumento(Documento documento) {
this.documento = documento;
}
public Vectumerator<DocumentoPagamento> findByCROldxx(DocumentoPagamentoCR CR, int pageNumber, int pageRows) {
String pre_S_Sql_Find = "SELECT * FROM DOCUMENTO_PAGAMENTO AS A WHERE A.id_documento IN (";
String post_S_Sql_Find = ")";
String s_Sql_Find = "";
if (CR.getFlgTipoSaldo() > 0L) {
s_Sql_Find = "select A.id_documento ";
} else {
s_Sql_Find = "select DISTINCT A.* ";
}
s_Sql_Find = String.valueOf(s_Sql_Find) + " FROM DOCUMENTO_PAGAMENTO AS A INNER JOIN DOCUMENTO AS B ON A.id_documento = B.id_documento ";
String s_Sql_Group = "";
String s_Sql_Order = " ORDER BY B.progDocumento, B.dataDocumento ";
String s_Sql_Having = "";
if (!CR.getFlgReport().isEmpty())
s_Sql_Order = " ORDER BY B.nominativoDocumento, B.progDocumento, B.dataDocumento ";
WcString wc = new WcString();
if (CR.getId_clifor() > 0L)
wc.addWc(" B.id_clifor = " + CR.getId_clifor());
if (CR.getDataDa() != null)
wc.addWc(" A.data >= ? ");
if (CR.getDataA() != null)
wc.addWc(" A.data <= ? ");
if (CR.getDataFatturaDa() != null)
wc.addWc(" B.dataDocumento >= ? ");
if (CR.getDataFatturaA() != null)
wc.addWc(" B.dataDocumento <= ? ");
if (CR.getId_tipoPagamentoS() > 0L)
wc.addWc(" A.id_tipoPagamento = " + CR.getId_tipoPagamentoS());
if (CR.getNumeroFattura() > 0L)
wc.addWc(" B.progDocumento = " + CR.getNumeroFattura());
if (CR.getAnnoFattura() > 0L)
wc.addWc(" B.id_esercizio = " + CR.getAnnoFattura());
if (CR.getId_documento() > 0L)
wc.addWc(" A.id_documento = " + CR.getId_documento());
if (CR.getId_tipoDocumento() > 0L)
wc.addWc(" B.id_tipoDocumento = " + CR.getId_tipoDocumento());
if (!CR.getRiferimento().isEmpty()) {
s_Sql_Find = String.valueOf(s_Sql_Find) + " inner join TIPO_DOCUMENTO AS T ON B.id_tipoDocumento=T.id_tipoDocumento";
wc.addWc(" T.riferimento = '" + CR.getRiferimento() + "'");
}
String sql = "";
if (CR.getFlgTipoSaldo() > 0L) {
sql = String.valueOf(pre_S_Sql_Find) + s_Sql_Find + wc.toString() + s_Sql_Group + s_Sql_Having + s_Sql_Order + post_S_Sql_Find;
} else {
sql = String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Group + s_Sql_Having + s_Sql_Order;
}
try {
PreparedStatement stmt = getConn().prepareStatement(sql);
int dataCount = 0;
if (CR.getDataDa() != null) {
dataCount++;
stmt.setDate(dataCount, CR.getDataDa());
}
if (CR.getDataA() != null) {
dataCount++;
stmt.setDate(dataCount, CR.getDataA());
}
if (CR.getDataFatturaDa() != null) {
dataCount++;
stmt.setDate(dataCount, CR.getDataFatturaDa());
}
if (CR.getDataFatturaA() != null) {
dataCount++;
stmt.setDate(dataCount, CR.getDataFatturaA());
}
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public Vectumerator<DocumentoPagamento> findSaldiByCR(DocumentoPagamentoCR CR, int pageNumber, int pageRows) {
String pre_S_Sql_Find = "SELECT * FROM DOCUMENTO_PAGAMENTO AS A WHERE A.id_documento IN (";
String post_S_Sql_Find = ")";
String s_Sql_Find = "";
if (CR.getFlgTipoSaldo() > 0L) {
s_Sql_Find = "select A.id_documento ";
} else {
s_Sql_Find = "select DISTINCT A.* ";
}
s_Sql_Find = String.valueOf(s_Sql_Find) + " FROM DOCUMENTO_PAGAMENTO AS A INNER JOIN DOCUMENTO AS B ON A.id_documento = B.id_documento ";
String s_Sql_Group = "";
String s_Sql_Order = " ORDER BY B.progDocumento, B.dataDocumento ";
String s_Sql_Having = "";
if (CR.getFlgTipoSaldo() == 1L) {
s_Sql_Group = " GROUP BY id_documento ";
s_Sql_Having = " HAVING SUM(importo) > 0 ";
} else if (CR.getFlgTipoSaldo() == 2L) {
s_Sql_Group = " GROUP BY id_documento ";
s_Sql_Having = " HAVING SUM(importo) <= 0 ";
}
if (!CR.getFlgReport().isEmpty())
s_Sql_Order = " ORDER BY B.nominativoDocumento, B.progDocumento, B.dataDocumento ";
WcString wc = new WcString();
if (CR.getId_clifor() > 0L)
wc.addWc(" B.id_clifor = " + CR.getId_clifor());
if (CR.getDataDa() != null)
wc.addWc(" A.data >= ? ");
if (CR.getDataA() != null)
wc.addWc(" A.data <= ? ");
if (CR.getDataFatturaDa() != null)
wc.addWc(" B.dataDocumento >= ? ");
if (CR.getDataFatturaA() != null)
wc.addWc(" B.dataDocumento <= ? ");
if (CR.getId_tipoPagamentoS() > 0L)
wc.addWc(" A.id_tipoPagamento = " + CR.getId_tipoPagamentoS());
if (CR.getNumeroFattura() > 0L)
wc.addWc(" B.progDocumento = " + CR.getNumeroFattura());
if (CR.getAnnoFattura() > 0L)
wc.addWc(" B.id_esercizio = " + CR.getAnnoFattura());
if (CR.getId_documento() > 0L)
wc.addWc(" A.id_documento = " + CR.getId_documento());
String sql = "";
if (CR.getFlgTipoSaldo() > 0L) {
sql = String.valueOf(pre_S_Sql_Find) + s_Sql_Find + wc.toString() + s_Sql_Group + s_Sql_Having + s_Sql_Order + post_S_Sql_Find;
} else {
sql = String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Group + s_Sql_Having + s_Sql_Order;
}
try {
PreparedStatement stmt = getConn().prepareStatement(sql);
int dataCount = 0;
if (CR.getDataDa() != null) {
dataCount++;
stmt.setDate(dataCount, CR.getDataDa());
}
if (CR.getDataA() != null) {
dataCount++;
stmt.setDate(dataCount, CR.getDataA());
}
if (CR.getDataFatturaDa() != null) {
dataCount++;
stmt.setDate(dataCount, CR.getDataFatturaDa());
}
if (CR.getDataFatturaA() != null) {
dataCount++;
stmt.setDate(dataCount, CR.getDataFatturaA());
}
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
protected void deleteCascade() {}
public void findRecordDocumentoByDocumento(long id_documento) {
String s_Sql_Find = "select DISTINCT A.* from DOCUMENTO_PAGAMENTO AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc(" A.id_documento = " + id_documento);
wc.addWc(" A.flgTipoMovimento = 1");
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
findFirstRecord(stmt);
} catch (SQLException e) {
handleDebug(e);
}
}
public double getSaldoControlloByDocumento() {
String s_Sql_Find = "select SUM(importo) AS _sum from DOCUMENTO_PAGAMENTO AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc(" A.id_documento = " + getId_documento());
if (getId_documentoPagamento() > 0L)
wc.addWc(" A.id_documentoPagamento != " + getId_documentoPagamento());
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return getSum(stmt);
} catch (SQLException e) {
handleDebug(e);
return 0.0D;
}
}
public double getSaldoByDocumento(long id_documento) {
String s_Sql_Find = "select SUM(importo) AS _sum from DOCUMENTO_PAGAMENTO AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc(" A.id_documento = " + id_documento);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return getSum(stmt);
} catch (SQLException e) {
handleDebug(e);
return 0.0D;
}
}
public double getTotByDocumento(long id_documento) {
String s_Sql_Find = "select SUM(importo) as _sum from DOCUMENTO_PAGAMENTO AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc(" A.id_documento = " + id_documento);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return getSum(stmt);
} catch (SQLException e) {
handleDebug(e);
return 0.0D;
}
}
public double getSaldoRateByDocumento(long id_documento) {
String s_Sql_Find = "select SUM(importo) as _sum from DOCUMENTO_PAGAMENTO AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc(" A.id_documento = " + id_documento);
wc.addWc(" (A.flgTipoMovimento = 2 OR A.flgTipoMovimento = 3)");
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return getSum(stmt);
} catch (SQLException e) {
handleDebug(e);
return 0.0D;
}
}
public ResParm delete() {
ResParm rp = new ResParm(true);
rp = super.delete();
return rp;
}
public Vectumerator<DocumentoPagamento> findByClifor(long id_clifor, long tipoDocumenti) {
String s_Sql_Find = "select DISTINCT A.*, SUM(importo) AS importo, B.flgPagata as flgPagata FROM DOCUMENTO_PAGAMENTO AS A INNER JOIN DOCUMENTO AS B ON A.id_documento = B.id_documento ";
String s_Sql_Group = " GROUP BY id_documento";
String s_Sql_Order = "";
String s_Sql_Having = "";
WcString wc = new WcString();
wc.addWc(" B.id_clifor = " + id_clifor);
if (tipoDocumenti == 1L) {
s_Sql_Having = " HAVING SUM(importo) != 0 and (flgPagata is null or flgPagata=0)";
} else if (tipoDocumenti == 2L) {
s_Sql_Having = " HAVING SUM(importo) = 0";
}
try {
PreparedStatement stmt = getConn()
.prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Group + s_Sql_Order + s_Sql_Having);
return findRows(stmt);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public long getId_tipoPagamento() {
return this.id_tipoPagamento;
}
public void setId_tipoPagamento(long id_tipoPagamento) {
this.id_tipoPagamento = id_tipoPagamento;
}
public TipoPagamento getTipoPagamento() {
this.tipoPagamento = (TipoPagamento)getSecondaryObject(this.tipoPagamento, TipoPagamento.class, getId_tipoPagamento());
return this.tipoPagamento;
}
public void setTipoPagamento(TipoPagamento pagamento) {
this.tipoPagamento = pagamento;
}
public long getFlgTipoMovimento() {
return this.flgTipoMovimento;
}
public void setFlgTipoMovimento(long flgTipoMovimento) {
this.flgTipoMovimento = flgTipoMovimento;
}
public ResParm save() {
if (getFlgTipoMovimento() == 2L || getFlgTipoMovimento() == 3L) {
if (getDocumento().getTipoDocumento().isFatturaVendita() || getDocumento().getTipoDocumento().isNotaCreditoAcquisto())
setImporto(-1.0D * getImporto());
} else if (getFlgTipoMovimento() == 1L) {
if (getDocumento().getTipoDocumento().isFatturaAcquisto() || getDocumento().getTipoDocumento().isNotaCreditoVendita())
setImporto(-1.0D * getImporto());
}
ResParm rp = super.save();
if (rp.getStatus() &&
getFlgTipoMovimento() == 2L) {
if (getFlgTipoIncasso() != 1L) {
double totDoc = getTotByDocumento(this.id_documento);
if (getDocumento().getTipoDocumento().isFatturaAcquisto() || getDocumento().getTipoDocumento().isNotaCreditoVendita())
totDoc *= -1.0D;
if (totDoc <= 0.0D) {
setFlgTipoIncasso(1L);
} else {
setFlgTipoIncasso(0L);
}
}
if (getFlgTipoIncasso() == 1L) {
Documento doc = new Documento(getApFull());
doc.findByPrimaryKey(getId_documento());
doc.impostaPagato(getData());
}
}
return rp;
}
public double getImportoVis() {
if (getImporto() < 0.0D)
return getImporto() * -1.0D;
return getImporto();
}
protected void afterDelete() {
double saldo = getTotByDocumento(getId_documento());
if (saldo != 0.0D) {
Documento doc = new Documento(getApFull());
doc.findByPrimaryKey(getId_documento());
doc.impostaNonPagato();
String sql = "UPDATE DOCUMENTO_PAGAMENTO SET flgTipoIncasso = 0 WHERE id_documento = " + getId_documento();
update(sql);
}
super.afterDelete();
}
public boolean hasPagamentiEffettuatiByDocumento(long id_documento) {
String s_Sql_Find = "select DISTINCT A.* from DOCUMENTO_PAGAMENTO AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc(" A.id_documento = " + id_documento);
wc.addWc(" A.flgTipoMovimento = 2");
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
Vectumerator<DocumentoPagamento> vec = findRows(stmt, 1, 1);
return vec.hasMoreElements();
} catch (SQLException e) {
handleDebug(e);
return false;
}
}
public Vectumerator<DocumentoPagamento> findByDocumento(long l_id_documento) {
if (l_id_documento == 0L)
return AB_EMPTY_VECTUMERATOR;
String s_Sql_Find = "select DISTINCT A.* from DOCUMENTO_PAGAMENTO AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc(" A.id_documento = " + l_id_documento);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public long getFlgTipoIncasso() {
return this.flgTipoIncasso;
}
public void setFlgTipoIncasso(long flgTipoIncasso) {
this.flgTipoIncasso = flgTipoIncasso;
}
public static final String getTipoIncasso(long l_flgTipoIncasso) {
String ret = "";
if (l_flgTipoIncasso == 0L) {
ret = "Acconto";
} else if (l_flgTipoIncasso == 1L) {
ret = "Saldo";
}
return ret;
}
public String getTipoIncasso() {
return getTipoIncasso(getFlgTipoIncasso());
}
public String getDescrizioneTipoMovimento() {
String ret = "";
if (getFlgTipoMovimento() == 1L) {
ret = "Documento";
} else if (getFlgTipoMovimento() == 2L) {
ret = "Rata";
} else if (getFlgTipoMovimento() == 3L) {
ret = "Storno";
}
return ret;
}
public Vectumerator<DocumentoPagamento> findByCR(DocumentoPagamentoCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "SELECT DISTINCT * FROM DOCUMENTO_PAGAMENTO AS A INNER JOIN DOCUMENTO AS B ON A.id_documento = B.id_documento inner join CLIFOR AS C ON B.id_clifor=C.id_clifor";
String s_Sql_Order = " ORDER BY B.id_esercizio, B.progDocumento, B.dataDocumento ";
if (!CR.getFlgReport().isEmpty())
if (CR.getFlgClienteFornitore().equals("F")) {
s_Sql_Order = " ORDER BY C.cognome, C.nome , B.dataRiferimento, B.riferimento ";
} else {
s_Sql_Order = " ORDER BY C.cognome, C.nome ,B.id_esercizio, B.progDocumento, B.dataDocumento ";
}
WcString wc = new WcString();
if (CR.getId_clifor() > 0L)
wc.addWc(" B.id_clifor = " + CR.getId_clifor());
if (CR.getDataDa() != null)
wc.addWc(" A.data >= ? ");
if (CR.getDataA() != null)
wc.addWc(" A.data <= ? ");
if (CR.getDataFatturaDa() != null)
wc.addWc(" B.dataDocumento >= ? ");
if (CR.getDataFatturaA() != null)
wc.addWc(" B.dataDocumento <= ? ");
if (CR.getId_tipoPagamentoS() > 0L)
wc.addWc(" A.id_tipoPagamento = " + CR.getId_tipoPagamentoS());
if (CR.getNumeroFattura() > 0L)
wc.addWc(" B.progDocumento = " + CR.getNumeroFattura());
if (CR.getAnnoFattura() > 0L)
wc.addWc(" B.id_esercizio = " + CR.getAnnoFattura());
if (CR.getId_documento() > 0L)
wc.addWc(" A.id_documento = " + CR.getId_documento());
if (CR.getId_tipoDocumento() > 0L)
wc.addWc(" B.id_tipoDocumento = " + CR.getId_tipoDocumento());
if (!CR.getRiferimento().isEmpty() || !CR.getFlgClienteFornitore().isEmpty()) {
s_Sql_Find = String.valueOf(s_Sql_Find) + " inner join TIPO_DOCUMENTO AS T ON B.id_tipoDocumento=T.id_tipoDocumento";
if (!CR.getRiferimento().isEmpty())
wc.addWc(" T.riferimento = '" + CR.getRiferimento() + "'");
if (!CR.getFlgClienteFornitore().isEmpty())
wc.addWc(" T.flgClienteFornitore = '" + CR.getFlgClienteFornitore() + "'");
}
if (CR.getFlgTipoSaldo() == 1L) {
wc.addWc("( B.flgPagata is null or B.flgPagata =0) ");
} else if (CR.getFlgTipoSaldo() == 2L) {
wc.addWc("B.flgPagata= 1 ");
}
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
int dataCount = 0;
if (CR.getDataDa() != null) {
dataCount++;
stmt.setDate(dataCount, CR.getDataDa());
}
if (CR.getDataA() != null) {
dataCount++;
stmt.setDate(dataCount, CR.getDataA());
}
if (CR.getDataFatturaDa() != null) {
dataCount++;
stmt.setDate(dataCount, CR.getDataFatturaDa());
}
if (CR.getDataFatturaA() != null) {
dataCount++;
stmt.setDate(dataCount, CR.getDataFatturaA());
}
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public ByteArrayOutputStream creaReportPdf(DocumentoPagamentoCR CR) {
ByteArrayOutputStream ba = new ByteArrayOutputStream();
try {
this.document = new Document(PageSize.A4, 20.0F, 20.0F, 20.0F, 10.0F);
this.writer = PdfWriter.getInstance(this.document, ba);
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
SimpleDateFormat sdfh = new SimpleDateFormat("hh:mm");
Phrase pH = new Phrase("Data/ora stampa: " + sdf.format(getToday()) + " " + sdfh.format(Long.valueOf(cal.getTimeInMillis())) + " pag. ");
HeaderFooter footer = new HeaderFooter(pH, true);
footer.setAlignment(2);
footer.setBorder(0);
this.document.setFooter(footer);
this.document.open();
CR.setFilePdf(String.valueOf(getDocBase()) + getPathTmp() + "ReportPagamenti.pdf");
this.document = creaReport(CR);
this.document.close();
this.document = null;
FileOutputStream fos = new FileOutputStream(new File(CR.getFilePdf()));
fos.write(ba.toByteArray());
fos.close();
System.out.println("Creato file documento " + CR.getFilePdf());
} catch (Exception e) {
e.printStackTrace();
}
return ba;
}
private Document creaReport(DocumentoPagamentoCR CR) {
try {
prepareNewPdfCorpoDocument();
int cellLeading = 10;
NumberFormat nf = NumberFormat.getInstance();
nf.setMinimumFractionDigits(2);
nf.setMaximumFractionDigits(2);
SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
long id_clifor = 0L;
DoubleOperator dpRottura = new DoubleOperator();
DoubleOperator dpReport = new DoubleOperator();
String salvaDescrizioneCliente = "";
Cell cell = new Cell();
cell.add(new Chunk("REPORT PAGAMENTI", PdfFontFactory.PDF_fIntestazione));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setBorder(0);
cell.setColspan(40);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(2);
cell.setLeading((float)cellLeading);
cell.setBorder(0);
cell.setColspan(40);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk(CR.getCriteriDiRicerca(), PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setBorder(0);
cell.setColspan(40);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(2);
cell.setLeading((float)cellLeading);
cell.setBorder(0);
cell.setColspan(40);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("Documento", PdfFontFactory.PDF_fMedioBianco));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.lightGray);
cell.setLeading((float)cellLeading);
cell.setColspan(15);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("Data", PdfFontFactory.PDF_fMedioBianco));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.lightGray);
cell.setLeading((float)cellLeading);
cell.setColspan(5);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("Importo", PdfFontFactory.PDF_fMedioBianco));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.lightGray);
cell.setLeading((float)cellLeading);
cell.setColspan(5);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("Nota", PdfFontFactory.PDF_fMedioBianco));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.lightGray);
cell.setLeading((float)cellLeading);
cell.setColspan(15);
this.pdfcorpo.addCell(cell);
this.pdfcorpo.endHeaders();
Vectumerator<DocumentoPagamento> vec = findByCR(CR, 0, 0);
while (vec.hasMoreElements()) {
DocumentoPagamento doc = (DocumentoPagamento)vec.nextElement();
if (id_clifor != doc.getDocumento().getId_clifor()) {
if (id_clifor > 0L) {
cell = new Cell(new Chunk("Totale per " + salvaDescrizioneCliente, PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(15);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(5);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk(nf.format(dpRottura.getResult()), PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(2);
cell.setLeading((float)cellLeading);
cell.setColspan(5);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(15);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("_", PdfFontFactory.PDF_fMedioBianco));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(40);
this.pdfcorpo.addCell(cell);
dpRottura = new DoubleOperator();
}
if (!doc.getDocumento().getClifor().getNominativoCompleto().isEmpty()) {
cell = new Cell(new Chunk(doc.getDocumento().getClifor().getNominativoCompleto(), PdfFontFactory.PDF_fGrandeB));
if (doc.getDocumento().getClifor().getFlgTipo().equals("F")) {
cell.add(new Chunk(" iban: " + doc.getDocumento().getClifor().getIban(), PdfFontFactory.PDF_fGrandeB));
cell.add(new Chunk(" Pag: " + doc.getDocumento().getTipoPagamento().getDescrizione(),
PdfFontFactory.PDF_fMedioB));
}
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(40);
this.pdfcorpo.addCell(cell);
}
salvaDescrizioneCliente = "";
}
if (doc.getFlgTipoMovimento() == 1L) {
if (doc.getDocumento().getTipoDocumento().getFlgClienteFornitore().equals("F")) {
cell = new Cell(new Chunk(doc.getDocumento().getRiferimento(), PdfFontFactory.PDF_fMedio));
} else {
cell = new Cell(new Chunk(doc.getDocumento().getNumeroDocumentoCompleto(), PdfFontFactory.PDF_fMedio));
}
} else {
cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedio));
}
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(15);
this.pdfcorpo.addCell(cell);
if (doc.getFlgTipoMovimento() == 1L) {
if (doc.getDocumento().getTipoDocumento().getFlgClienteFornitore().equals("F")) {
cell = new Cell(new Chunk(df.format(doc.getDocumento().getDataRiferimento()), PdfFontFactory.PDF_fMedio));
} else {
cell = new Cell(new Chunk(df.format(doc.getDocumento().getDataDocumento()), PdfFontFactory.PDF_fMedio));
}
} else {
cell = new Cell(new Chunk(df.format(doc.getData()), PdfFontFactory.PDF_fMedio));
}
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(1);
cell.setLeading((float)cellLeading);
cell.setColspan(5);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk(nf.format(doc.getImporto()), PdfFontFactory.PDF_fMedio));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(2);
cell.setLeading((float)cellLeading);
cell.setColspan(5);
this.pdfcorpo.addCell(cell);
if (doc.getFlgTipoMovimento() != 1L) {
cell = new Cell(new Chunk("Pagamento - ", PdfFontFactory.PDF_fMedio));
cell.add(new Chunk(doc.getNota(), PdfFontFactory.PDF_fMedio));
} else {
cell = new Cell(new Chunk(doc.getNota(), PdfFontFactory.PDF_fMedio));
}
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(15);
this.pdfcorpo.addCell(cell);
dpRottura.add(doc.getImporto());
dpReport.add(doc.getImporto());
salvaDescrizioneCliente = doc.getDocumento().getClifor().getNominativoCompleto();
id_clifor = doc.getDocumento().getId_clifor();
}
if (id_clifor > 0L) {
cell = new Cell(new Chunk("Totale per " + salvaDescrizioneCliente, PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(15);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(5);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk(nf.format(dpRottura.getResult()), PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(2);
cell.setLeading((float)cellLeading);
cell.setColspan(5);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(15);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("_", PdfFontFactory.PDF_fMedioBianco));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(40);
this.pdfcorpo.addCell(cell);
}
if (dpReport.getResult() != 0.0D) {
cell = new Cell(new Chunk("Totale Report ", PdfFontFactory.PDF_fGrandissimo));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(15);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(5);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk(nf.format(dpReport.getResult()), PdfFontFactory.PDF_fGrandissimo));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(2);
cell.setLeading((float)cellLeading);
cell.setColspan(5);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(15);
this.pdfcorpo.addCell(cell);
}
this.document.add((Element)this.pdfcorpo);
} catch (Exception e) {
e.printStackTrace();
}
return this.document;
}
public String getDescrizioneFlgTipoIncasso() {
String ret = "";
if (getFlgTipoIncasso() == 0L) {
ret = "Acconto";
} else if (getFlgTipoIncasso() == 1L) {
ret = "Saldo";
}
return ret;
}
public static final String getTipoMovimento(long l_flgTipoMovimento) {
String ret = "";
if (l_flgTipoMovimento == 1L) {
ret = "Documento";
} else if (l_flgTipoMovimento == 2L) {
ret = "Rata";
} else if (l_flgTipoMovimento == 3L) {
ret = "Storno";
}
return ret;
}
public String getTipoMovimento() {
return getTipoMovimento(getFlgTipoMovimento());
}
public long getId_clifor() {
return getDocumento().getId_clifor();
}
}

View file

@ -0,0 +1,363 @@
package com.ablia.contab;
import com.ablia.anag.Clifor;
import com.ablia.anag.TipoPagamento;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import com.ablia.util.SimpleDateFormat;
import java.io.Serializable;
import java.sql.Date;
public class DocumentoPagamentoCR extends CRAdapter implements Serializable {
private static final long serialVersionUID = 8044331984020899695L;
private long id_documentoPagamento;
private Date data;
private double importo;
private String nota;
private long id_documento;
private Documento documento;
private long id_tipoPagamentoS;
private Date dataDa;
private Date dataA;
private Date dataFatturaDa;
private Date dataFatturaA;
private long numeroFattura;
private long annoFattura;
private long id_clifor;
private Clifor clifor;
private long flgTipoSaldo = 1L;
private long id_tipoDocumento;
private long flgTipoIncasso;
private String filePdf;
private String flgClienteFornitore;
public static final long SALDO_DOCUMENTI_TUTTI = 0L;
public static final long SALDO_DOCUMENTI_APERTI = 1L;
public static final long SALDO_DOCUMENTI_CHIUSI = 2L;
private String riferimento;
private long flgTipoMovimento;
private TipoPagamento tipoPagamento;
private TipoDocumento tipoDocumento;
public DocumentoPagamentoCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public DocumentoPagamentoCR() {}
public long getId_documentoPagamento() {
return this.id_documentoPagamento;
}
public void setId_documentoPagamento(long id_incassoPagamento) {
this.id_documentoPagamento = id_incassoPagamento;
}
public Date getData() {
return this.data;
}
public void setData(Date data) {
this.data = data;
}
public double getImporto() {
return this.importo;
}
public void setImporto(double importo) {
this.importo = importo;
}
public String getNota() {
return (this.nota == null) ? "" : this.nota;
}
public void setNota(String nota) {
this.nota = nota;
}
public long getId_documento() {
return this.id_documento;
}
public void setId_documento(long id_documento) {
this.id_documento = id_documento;
}
public Documento getDocumento() {
this.documento = (Documento)getSecondaryObject(this.documento, Documento.class, getId_documento());
return this.documento;
}
public void setDocumento(Documento documento) {
this.documento = documento;
}
public long getId_tipoPagamentoS() {
return this.id_tipoPagamentoS;
}
public void setId_tipoPagamentoS(long id_tipoPagamento) {
this.id_tipoPagamentoS = id_tipoPagamento;
}
public Date getDataDa() {
return this.dataDa;
}
public void setDataDa(Date dataDa) {
this.dataDa = dataDa;
}
public Date getDataA() {
return this.dataA;
}
public void setDataA(Date dataA) {
this.dataA = dataA;
}
public Date getDataFatturaDa() {
return this.dataFatturaDa;
}
public void setDataFatturaDa(Date dataFatturaDa) {
this.dataFatturaDa = dataFatturaDa;
}
public Date getDataFatturaA() {
return this.dataFatturaA;
}
public void setDataFatturaA(Date dataFatturaA) {
this.dataFatturaA = dataFatturaA;
}
public long getNumeroFattura() {
return this.numeroFattura;
}
public void setNumeroFattura(long numeroFattura) {
this.numeroFattura = numeroFattura;
}
public long getAnnoFattura() {
return this.annoFattura;
}
public void setAnnoFattura(long annoFattura) {
this.annoFattura = annoFattura;
}
public long getId_clifor() {
return this.id_clifor;
}
public void setId_clifor(long id_clifor) {
this.id_clifor = id_clifor;
}
public Clifor getClifor() {
this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor());
return this.clifor;
}
public void setClifor(Clifor clifor) {
this.clifor = clifor;
}
public long getFlgTipoSaldo() {
return this.flgTipoSaldo;
}
public void setFlgTipoSaldo(long flgTipoSaldo) {
this.flgTipoSaldo = flgTipoSaldo;
}
public long getId_tipoDocumento() {
return this.id_tipoDocumento;
}
public void setId_tipoDocumento(long id_tipoDocumento) {
this.id_tipoDocumento = id_tipoDocumento;
}
public long getFlgTipoIncasso() {
return this.flgTipoIncasso;
}
public void setFlgTipoIncasso(long flgTipoIncasso) {
this.flgTipoIncasso = flgTipoIncasso;
}
public long getFlgTipoMovimento() {
return this.flgTipoMovimento;
}
public void setFlgTipoMovimento(long tipoMovimento) {
this.flgTipoMovimento = tipoMovimento;
}
public String getRiferimento() {
return (this.riferimento == null) ? "" : this.riferimento.trim();
}
public void setRiferimento(String riferimento) {
this.riferimento = riferimento;
}
public String getFilePdf() {
return this.filePdf;
}
public void setFilePdf(String filePdf) {
this.filePdf = filePdf;
}
public String getFlgClienteFornitore() {
return (this.flgClienteFornitore == null) ? "" : this.flgClienteFornitore;
}
public void setFlgClienteFornitore(String flgAttivoPassivo) {
this.flgClienteFornitore = flgAttivoPassivo;
}
public String getCriteriDiRicerca() {
SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
StringBuilder sb = new StringBuilder();
if (getId_clifor() > 0L)
sb.append("Cliente: " + getClifor().getCognomeNome());
if (getDataDa() != null) {
if (sb.length() > 0)
sb.append(" ");
sb.append("Data Da: " + df.format(getDataDa()));
}
if (getDataA() != null) {
if (sb.length() > 0)
sb.append(" ");
sb.append("Data A: " + df.format(getDataA()));
}
if (getFlgTipoSaldo() == 0L) {
if (sb.length() > 0)
sb.append(" ");
sb.append("Tipo: Tutte");
}
if (getFlgTipoSaldo() == 1L) {
if (sb.length() > 0)
sb.append(" ");
sb.append("Tipo: Aperte");
}
if (getFlgTipoSaldo() == 2L) {
if (sb.length() > 0)
sb.append(" ");
sb.append("Tipo: Chiuse");
}
if (getId_tipoPagamentoS() > 0L) {
if (sb.length() > 0)
sb.append(" ");
sb.append("Tipo Pagamento: " + getTipoPagamento().getDescrizione());
}
if (!getRiferimento().isEmpty()) {
if (sb.length() > 0)
sb.append(" ");
sb.append("Riferimento: " + getRiferimento());
}
if (getId_tipoDocumento() > 0L) {
if (sb.length() > 0)
sb.append(" ");
sb.append("Tipo Documento: " + getTipoDocumento().getDescrizione());
}
if (getNumeroFattura() > 0L) {
if (sb.length() > 0)
sb.append(" ");
sb.append("Numero Fattura: " + getNumeroFattura());
}
if (getAnnoFattura() > 0L) {
if (sb.length() > 0)
sb.append(" ");
sb.append("Anno Fattura: " + getAnnoFattura());
}
if (getDataFatturaDa() != null) {
if (sb.length() > 0)
sb.append(" ");
sb.append("Data Fattura Da: " + df.format(getDataFatturaDa()));
}
if (getDataFatturaA() != null) {
if (sb.length() > 0)
sb.append(" ");
sb.append("Data Fattura A: " + df.format(getDataFatturaA()));
}
if (getFlgClienteFornitore().equals("C")) {
if (sb.length() > 0)
sb.append(" ");
sb.append("Attività/Passività: Attività");
}
if (getFlgClienteFornitore().equals("F")) {
if (sb.length() > 0)
sb.append(" ");
sb.append("Attività/Passività: Passività");
}
return sb.toString();
}
public TipoPagamento getTipoPagamento() {
this.tipoPagamento = (TipoPagamento)getSecondaryObject(this.tipoPagamento, TipoPagamento.class, getId_tipoPagamentoS());
return this.tipoPagamento;
}
public void setTipoPagamento(TipoPagamento tipoPagamento) {
this.tipoPagamento = tipoPagamento;
}
public TipoDocumento getTipoDocumento() {
this.tipoDocumento = (TipoDocumento)getSecondaryObject(this.tipoDocumento, TipoDocumento.class, getId_tipoDocumento());
return this.tipoDocumento;
}
public void setTipoDocumento(TipoDocumento tipoDocumento) {
this.tipoDocumento = tipoDocumento;
}
public static final String getTipoIncasso(long l_flgTipoIncasso) {
return DocumentoPagamento.getTipoIncasso(l_flgTipoIncasso);
}
public static final String getTipoMovimento(long l_flgTipoMovimento) {
return DocumentoPagamento.getTipoMovimento(l_flgTipoMovimento);
}
public String getTipoIncasso() {
return DocumentoPagamento.getTipoIncasso(getFlgTipoIncasso());
}
public String getTipoMovimento() {
return DocumentoPagamento.getTipoMovimento(getFlgTipoMovimento());
}
}

View file

@ -0,0 +1,796 @@
package com.ablia.contab;
import com.ablia.anag.Banca;
import com.ablia.db.ApplParmFull;
import com.ablia.db.ResParm;
import com.ablia.db.WcString;
import com.ablia.util.DoubleOperator;
import com.ablia.util.PdfFontFactory;
import com.ablia.util.SimpleDateFormat;
import com.ablia.util.Vectumerator;
import com.lowagie.text.Cell;
import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.Element;
import com.lowagie.text.HeaderFooter;
import com.lowagie.text.PageSize;
import com.lowagie.text.Phrase;
import com.lowagie.text.pdf.PdfWriter;
import java.awt.Color;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.Serializable;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.text.NumberFormat;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Random;
public class DocumentoScadenza extends _ContabAdapter implements Serializable {
private static final long serialVersionUID = -4810747675006169924L;
private long id_documentoScadenza;
private long id_documento;
private Documento documento;
private long id_distintaRiba;
private DistintaRiba distintaRiba;
private Date dataScadenza;
private double importoScadenza;
private long flgScadenzaSelezionata;
private long flgAccorpata;
private String listaDocumenti;
public DocumentoScadenza(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public DocumentoScadenza() {}
public long getId_documentoScadenza() {
return this.id_documentoScadenza;
}
public void setId_documentoScadenza(long id_incassoPagamento) {
this.id_documentoScadenza = id_incassoPagamento;
}
public void setDataScadenza(Date data) {
this.dataScadenza = data;
}
public double getImportoScadenza() {
return this.importoScadenza;
}
public void setImportoScadenza(double importo) {
this.importoScadenza = importo;
}
public long getId_documento() {
return this.id_documento;
}
public void setId_documento(long id_documento) {
this.id_documento = id_documento;
}
public Documento getDocumento() {
this.documento = (Documento)getSecondaryObject(this.documento, Documento.class, getId_documento());
return this.documento;
}
public void setDocumento(Documento documento) {
this.documento = documento;
}
protected void deleteCascade() {}
public ResParm delete() {
ResParm rp = new ResParm(true);
rp = super.delete();
return rp;
}
public ResParm save() {
return super.save();
}
public Vectumerator<DocumentoScadenza> findByDocumento(long l_id_documento) {
if (l_id_documento == 0L)
return AB_EMPTY_VECTUMERATOR;
String s_Sql_Find = "select DISTINCT A.* from DOCUMENTO_SCADENZA AS A";
String s_Sql_Order = " order by A.dataScadenza";
WcString wc = new WcString();
wc.addWc(" A.id_documento = " + l_id_documento);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public long getFlgScadenzaSelezionata() {
return this.flgScadenzaSelezionata;
}
public void setFlgScadenzaSelezionata(long flgTipoIncasso) {
this.flgScadenzaSelezionata = flgTipoIncasso;
}
public Vectumerator<DocumentoScadenza> findByCR(DocumentoScadenzaCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "";
String s_Sql_Order = "";
WcString wc = new WcString();
s_Sql_Find = "SELECT DISTINCT * FROM DOCUMENTO_SCADENZA AS A INNER JOIN DOCUMENTO AS B ON A.id_documento = B.id_documento LEFT JOIN TIPO_PAGAMENTO AS C ON B.id_tipoPagamento = C.id_tipoPagamento ";
if (CR.getFlgOrderImporto() == 1L) {
s_Sql_Order = " ORDER BY A.importoScadenza DESC ";
} else {
s_Sql_Order = " ORDER BY A.dataScadenza";
}
if (CR.getDataScadenzaDa() != null)
wc.addWc(" A.dataScadenza >= ? ");
if (CR.getDataScadenzaA() != null)
wc.addWc(" A.dataScadenza <= ? ");
if (CR.getId_documento() > 0L)
wc.addWc(" A.id_documento = " + CR.getId_documento());
if (CR.getFlgDaEstrarre() > 0L)
wc.addWc(" (A.id_distintaRiba = 0 OR A.id_distintaRiba IS NULL) ");
if (CR.getId_distintaRiba() > 0L)
wc.addWc(" A.id_distintaRiba = " + CR.getId_distintaRiba());
if (CR.getId_clifor() > 0L)
wc.addWc(" B.id_clifor = " + CR.getId_clifor());
if (CR.getDataFatturaDa() != null)
wc.addWc(" B.dataDocumento >= ? ");
if (CR.getDataFatturaA() != null)
wc.addWc(" B.dataDocumento <= ? ");
if (CR.getFlgTipoPagamento() > 0L)
wc.addWc(" C.flgTipoPagamento = " + CR.getFlgTipoPagamento());
if (CR.getFlgSoloRiba() > 0L) {
s_Sql_Find = String.valueOf(s_Sql_Find) + " LEFT JOIN TIPO_PAGAMENTO AS T ON B.id_tipoPagamento = T.id_tipoPagamento ";
wc.addWc(" T.flgTipoPagamento = 1");
}
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
int dataCount = 0;
if (CR.getDataScadenzaDa() != null) {
dataCount++;
stmt.setDate(dataCount, CR.getDataScadenzaDa());
}
if (CR.getDataScadenzaA() != null) {
dataCount++;
stmt.setDate(dataCount, CR.getDataScadenzaA());
}
if (CR.getDataFatturaDa() != null) {
dataCount++;
stmt.setDate(dataCount, CR.getDataFatturaDa());
}
if (CR.getDataFatturaA() != null) {
dataCount++;
stmt.setDate(dataCount, CR.getDataFatturaA());
}
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public ByteArrayOutputStream creaReportPdf(DocumentoScadenzaCR CR) {
ByteArrayOutputStream ba = new ByteArrayOutputStream();
try {
this.document = new Document(PageSize.A4, 20.0F, 20.0F, 20.0F, 10.0F);
this.writer = PdfWriter.getInstance(this.document, ba);
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
SimpleDateFormat sdfh = new SimpleDateFormat("hh:mm");
Phrase pH = new Phrase("Data/ora stampa: " + sdf.format(getToday()) + " " + sdfh.format(Long.valueOf(cal.getTimeInMillis())) + " pag. ");
HeaderFooter footer = new HeaderFooter(pH, true);
footer.setAlignment(2);
footer.setBorder(0);
this.document.setFooter(footer);
this.document.open();
CR.setFilePdf(String.valueOf(getDocBase()) + getPathTmp() + "ReportPagamenti.pdf");
if (new File(CR.getFilePdf()).exists())
new File(CR.getFilePdf()).delete();
this.document = creaReport(CR);
this.document.close();
this.document = null;
FileOutputStream fos = new FileOutputStream(new File(CR.getFilePdf()));
fos.write(ba.toByteArray());
fos.close();
System.out.println("Creato file documento " + CR.getFilePdf());
} catch (Exception e) {
e.printStackTrace();
}
return ba;
}
private Document creaReport(DocumentoScadenzaCR CR) {
try {
prepareNewPdfCorpoDocument();
int cellLeading = 10;
NumberFormat nf = NumberFormat.getInstance();
nf.setMinimumFractionDigits(2);
nf.setMaximumFractionDigits(2);
long id_clifor = 0L;
DoubleOperator dpRottura = new DoubleOperator();
DoubleOperator dpReport = new DoubleOperator();
String salvaDescrizioneCliente = "";
Cell cell = new Cell();
cell.add(new Chunk("REPORT SCADENZE", PdfFontFactory.PDF_fIntestazione));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setBorder(0);
cell.setColspan(40);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(2);
cell.setLeading((float)cellLeading);
cell.setBorder(0);
cell.setColspan(40);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(2);
cell.setLeading((float)cellLeading);
cell.setBorder(0);
cell.setColspan(40);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("Documento", PdfFontFactory.PDF_fMedioBianco));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.lightGray);
cell.setLeading((float)cellLeading);
cell.setColspan(15);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("Data", PdfFontFactory.PDF_fMedioBianco));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.lightGray);
cell.setLeading((float)cellLeading);
cell.setColspan(5);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("Importo", PdfFontFactory.PDF_fMedioBianco));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.lightGray);
cell.setLeading((float)cellLeading);
cell.setColspan(5);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("Nota", PdfFontFactory.PDF_fMedioBianco));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.lightGray);
cell.setLeading((float)cellLeading);
cell.setColspan(15);
this.pdfcorpo.addCell(cell);
this.pdfcorpo.endHeaders();
Vectumerator<DocumentoScadenza> vec = findByCR(CR, 0, 0);
while (vec.hasMoreElements()) {
DocumentoScadenza doc = (DocumentoScadenza)vec.nextElement();
if (id_clifor != doc.getDocumento().getId_clifor()) {
if (id_clifor > 0L) {
cell = new Cell(new Chunk("Totale per " + salvaDescrizioneCliente, PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(15);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(5);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk(nf.format(dpRottura.getResult()), PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(2);
cell.setLeading((float)cellLeading);
cell.setColspan(5);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(15);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("_", PdfFontFactory.PDF_fMedioBianco));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(40);
this.pdfcorpo.addCell(cell);
dpRottura = new DoubleOperator();
}
if (!doc.getDocumento().getClifor().getNominativoCompleto().isEmpty()) {
cell = new Cell(new Chunk(doc.getDocumento().getClifor().getNominativoCompleto(), PdfFontFactory.PDF_fGrandeB));
if (doc.getDocumento().getClifor().getFlgTipo().equals("F"))
cell.add(new Chunk(" iban: " + doc.getDocumento().getClifor().getIban(), PdfFontFactory.PDF_fGrandeB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(40);
this.pdfcorpo.addCell(cell);
}
salvaDescrizioneCliente = "";
}
dpRottura.add(doc.getImportoScadenza());
dpReport.add(doc.getImportoScadenza());
salvaDescrizioneCliente = doc.getDocumento().getClifor().getNominativoCompleto();
id_clifor = doc.getDocumento().getId_clifor();
}
if (id_clifor > 0L) {
cell = new Cell(new Chunk("Totale per " + salvaDescrizioneCliente, PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(15);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(5);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk(nf.format(dpRottura.getResult()), PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(2);
cell.setLeading((float)cellLeading);
cell.setColspan(5);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(15);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("_", PdfFontFactory.PDF_fMedioBianco));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(40);
this.pdfcorpo.addCell(cell);
}
if (dpReport.getResult() != 0.0D) {
cell = new Cell(new Chunk("Totale Report ", PdfFontFactory.PDF_fGrandissimo));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(15);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(5);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk(nf.format(dpReport.getResult()), PdfFontFactory.PDF_fGrandissimo));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(2);
cell.setLeading((float)cellLeading);
cell.setColspan(5);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(15);
this.pdfcorpo.addCell(cell);
}
this.document.add((Element)this.pdfcorpo);
} catch (Exception e) {
e.printStackTrace();
}
return this.document;
}
public long getId_distintaRiba() {
return this.id_distintaRiba;
}
public void setId_distintaRiba(long id_distintaRiba) {
this.id_distintaRiba = id_distintaRiba;
setDistintaRiba(null);
}
public DistintaRiba getDistintaRiba() {
this.distintaRiba = (DistintaRiba)getSecondaryObject(this.distintaRiba, DistintaRiba.class, getId_distintaRiba());
return this.distintaRiba;
}
public void setDistintaRiba(DistintaRiba distintaRiba) {
this.distintaRiba = distintaRiba;
}
public Date getDataScadenza() {
return this.dataScadenza;
}
public ResParm deleteByDocumento(long id_documento) {
String sql = "DELETE FROM DOCUMENTO_SCADENZA WHERE id_documento = " + id_documento;
return delete(sql);
}
public long getFlgAccorpata() {
return this.flgAccorpata;
}
public void setFlgAccorpata(long flgAccorpata) {
this.flgAccorpata = flgAccorpata;
}
public String getListaDocumenti() {
return (this.listaDocumenti == null) ? "" : this.listaDocumenti;
}
public String getListaDocumentiPdf() {
if (getFlgAccorpata() == 0L)
return String.valueOf(getDocumento().getTipoDocumento().getCodice()) + " - " + getDocumento().getNumeroDocumento() + " del " +
getDataFormat().format(getDocumento().getDataDocumento());
return getListaDocumenti().replace("<br>", " ");
}
public void setListaDocumenti(String listaDocumenti) {
this.listaDocumenti = listaDocumenti;
}
public double getTotaleScadenzeByCR(DocumentoScadenzaCR CR) {
if ((CR.getDataFatturaDa() == null || CR.getDataFatturaA() == null) && (
CR.getDataScadenzaDa() == null || CR.getDataScadenzaA() == null)) {
System.out.println("No");
return 0.0D;
}
System.out.println("Si");
DoubleOperator dop = new DoubleOperator();
Vectumerator<DocumentoScadenza> vec = findByCR(CR, 0, 0);
while (vec.hasMoreElements()) {
DocumentoScadenza ds = (DocumentoScadenza)vec.nextElement();
dop.add(ds.getImportoScadenza());
}
return dop.getResult();
}
public String randomNumber(long length) {
char[] caratteri = "0123456789".toCharArray();
StringBuilder sb = new StringBuilder();
Random random = new Random();
for (int i = 0; (long)i < length; i++) {
char c = caratteri[random.nextInt(caratteri.length)];
sb.append(c);
}
return sb.toString();
}
public void creaDistinte(DocumentoScadenzaCR CR) {
ResParm rp = new ResParm(true);
DoubleOperator dopInc = new DoubleOperator();
DoubleOperator dopTot = new DoubleOperator();
double importoBanca = 0.0D;
double importoTotaleRiba = getTotaleScadenzeByCR(CR);
Vectumerator<DistintaRiba> vecd = new Vectumerator();
Vectumerator<DocumentoScadenza> vec = findByCR(CR, 0, 0);
CR.setTimestampElaborazione(Long.valueOf(randomNumber(9L)).longValue());
if (importoTotaleRiba > 0.0D)
while (CR.getVecRiba().hasMoreElements()) {
Banca row = (Banca)CR.getVecRiba().nextElement();
System.out.println(String.valueOf(row.getDescrizione()) + " " + row.getImportoRiba());
importoBanca = row.getImportoRiba();
if (importoBanca > 0.0D && importoTotaleRiba > dopTot.getResult()) {
DistintaRiba dr = new DistintaRiba(getApFull());
dr.setId_banca(row.getId_banca());
dr.setDataPresentazione(CR.getDataDistintaRiba());
dr.setFlgAccorpaScadenze(CR.getFlgAccorpaScadenze());
dr.setFlgStatoDistinta(0L);
dr.setTimestampElaborazione(CR.getTimestampElaborazione());
dr.setMaxDistinta(importoBanca);
rp = dr.save();
if (rp.getStatus()) {
vecd.add(dr);
dopInc = new DoubleOperator(0.0F);
vec.moveFirst();
while (vec.hasMoreElements()) {
DocumentoScadenza ds = (DocumentoScadenza)vec.nextElement();
if (ds.getId_distintaRiba() == 0L) {
dopInc.add(ds.getImportoScadenza());
if (importoBanca >= dopInc.getResult()) {
dopTot.add(ds.getImportoScadenza());
ds.setFlgScadenzaSelezionata(0L);
ds.setId_distintaRiba(dr.getId_distintaRiba());
rp = ds.save();
rp.getStatus();
continue;
}
dopInc.subtract(ds.getImportoScadenza());
}
}
}
}
}
while (vecd.hasMoreElements()) {
DistintaRiba dr = (DistintaRiba)vecd.nextElement();
if (dr.getImportoTotale() == 0.0D)
dr.delete();
}
}
private Document creaListaScadenze(DocumentoScadenzaCR CR) {
try {
prepareNewPdfCorpoDocument();
SimpleDateFormat df = getDataFormat();
int cellLeading = 10;
NumberFormat nf = NumberFormat.getInstance();
nf.setMinimumFractionDigits(2);
nf.setMaximumFractionDigits(2);
DoubleOperator dpReport = new DoubleOperator();
int[] col = { 4, 3, 14, 3, 10, 2, 4 };
Cell cell = new Cell();
cell.add(new Chunk("Lista scadenze", PdfFontFactory.PDF_fIntestazione));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setBorder(0);
cell.setColspan(40);
this.pdfcorpo.addCell(cell);
cell = new Cell();
cell.add(new Chunk("Criteri ricerca: " + CR.getDescrizioneCR(), PdfFontFactory.PDF_fPiccolissimo));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setBorder(0);
cell.setColspan(40);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(2);
cell.setLeading((float)cellLeading);
cell.setBorder(0);
cell.setColspan(40);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(2);
cell.setLeading((float)cellLeading);
cell.setBorder(0);
cell.setColspan(40);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("Documento", PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.lightGray);
cell.setLeading((float)cellLeading);
cell.setColspan(col[0]);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("Data doc.", PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.lightGray);
cell.setLeading((float)cellLeading);
cell.setColspan(col[1]);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("Cliente", PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.lightGray);
cell.setLeading((float)cellLeading);
cell.setColspan(col[2]);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("Data scad.", PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.lightGray);
cell.setLeading((float)cellLeading);
cell.setColspan(col[3]);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("Tipo pag.", PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.lightGray);
cell.setLeading((float)cellLeading);
cell.setColspan(col[4]);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("N. dist.", PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.lightGray);
cell.setLeading((float)cellLeading);
cell.setColspan(col[5]);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk("Importo", PdfFontFactory.PDF_fMedioB));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setBackgroundColor(Color.lightGray);
cell.setLeading((float)cellLeading);
cell.setColspan(col[6]);
this.pdfcorpo.addCell(cell);
this.pdfcorpo.endHeaders();
Vectumerator<DocumentoScadenza> vec = findByCR(CR, 0, 0);
while (vec.hasMoreElements()) {
DocumentoScadenza doc = (DocumentoScadenza)vec.nextElement();
cell = new Cell(new Chunk(String.valueOf(doc.getDocumento().getTipoDocumento().getCodice()) + " " + doc.getDocumento().getNumeroDocumento(),
PdfFontFactory.PDF_fPiccolo));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(col[0]);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk(df.format(doc.getDocumento().getDataDocumento()), PdfFontFactory.PDF_fPiccolo));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(1);
cell.setLeading((float)cellLeading);
cell.setColspan(col[1]);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk(doc.getDocumento().getClifor().getDescrizioneCompleta(), PdfFontFactory.PDF_fPiccolo));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(col[2]);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk(df.format(doc.getDataScadenza()), PdfFontFactory.PDF_fPiccolo));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(1);
cell.setLeading((float)cellLeading);
cell.setColspan(col[3]);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk(doc.getDocumento().getTipoPagamento().getDescrizioneTipo(), PdfFontFactory.PDF_fPiccolo));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(0);
cell.setLeading((float)cellLeading);
cell.setColspan(col[4]);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk(String.valueOf(doc.getId_distintaRiba()), PdfFontFactory.PDF_fPiccolo));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(1);
cell.setLeading((float)cellLeading);
cell.setColspan(col[5]);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk(nf.format(doc.getImportoScadenza()), PdfFontFactory.PDF_fPiccolo));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(2);
cell.setLeading((float)cellLeading);
cell.setColspan(col[6]);
this.pdfcorpo.addCell(cell);
dpReport.add(doc.getImportoScadenza());
}
if (dpReport.getResult() != 0.0D) {
cell = new Cell(new Chunk("Totale", PdfFontFactory.PDF_fMedio));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(2);
cell.setLeading((float)cellLeading);
cell.setColspan(col[0] + col[1] + col[2] + col[3] + col[4] + col[5]);
this.pdfcorpo.addCell(cell);
cell = new Cell(new Chunk(nf.format(dpReport.getResult()), PdfFontFactory.PDF_fMedio));
cell.setVerticalAlignment(4);
cell.setHorizontalAlignment(2);
cell.setLeading((float)cellLeading);
cell.setColspan(col[6]);
this.pdfcorpo.addCell(cell);
}
this.document.add((Element)this.pdfcorpo);
} catch (Exception e) {
e.printStackTrace();
}
return this.document;
}
public ByteArrayOutputStream creaListaScadenzePdf(DocumentoScadenzaCR CR) {
ByteArrayOutputStream ba = new ByteArrayOutputStream();
try {
this.document = new Document(PageSize.A4, 20.0F, 20.0F, 20.0F, 10.0F);
this.writer = PdfWriter.getInstance(this.document, ba);
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
SimpleDateFormat sdfh = new SimpleDateFormat("hh:mm");
Phrase pH = new Phrase("Data/ora stampa: " + sdf.format(getToday()) + " " + sdfh.format(Long.valueOf(cal.getTimeInMillis())) + " pag. ");
HeaderFooter footer = new HeaderFooter(pH, true);
footer.setAlignment(2);
footer.setBorder(0);
this.document.setFooter(footer);
this.document.open();
CR.setFilePdf(String.valueOf(getDocBase()) + getPathTmp() + "ReportScadenze.pdf");
if (new File(CR.getFilePdf()).exists())
new File(CR.getFilePdf()).delete();
this.document = creaListaScadenze(CR);
this.document.close();
this.document = null;
FileOutputStream fos = new FileOutputStream(new File(CR.getFilePdf()));
fos.write(ba.toByteArray());
fos.close();
System.out.println("Creato file documento " + CR.getFilePdf());
} catch (Exception e) {
e.printStackTrace();
}
return ba;
}
public void creaDistintexx(DocumentoScadenzaCR CR) {
ResParm rp = new ResParm(true);
DoubleOperator dopInc = new DoubleOperator();
DoubleOperator dopTot = new DoubleOperator();
double importoBanca = 0.0D;
double importoTotaleRiba = getTotaleScadenzeByCR(CR);
Vectumerator<DistintaRiba> vecd = new Vectumerator();
Vectumerator<DocumentoScadenza> vec = findByCR(CR, 0, 0);
CR.setTimestampElaborazione(Long.valueOf(randomNumber(9L)).longValue());
HashMap<Long, Double> hm = new HashMap<>();
if (importoTotaleRiba > 0.0D) {
Iterator<Map.Entry> it = hm.entrySet().iterator();
while (it.hasNext()) {
Map.Entry pair = it.next();
importoBanca = (Double)pair.getValue();
if (importoBanca > 0.0D && importoTotaleRiba > dopTot.getResult()) {
DistintaRiba dr = new DistintaRiba(getApFull());
dr.setId_banca(((Long)pair.getKey()).longValue());
dr.setDataPresentazione(CR.getDataDistintaRiba());
dr.setFlgAccorpaScadenze(CR.getFlgAccorpaScadenze());
dr.setFlgStatoDistinta(0L);
dr.setTimestampElaborazione(CR.getTimestampElaborazione());
dr.setMaxDistinta(importoBanca);
rp = dr.save();
if (rp.getStatus()) {
vecd.add(dr);
dopInc = new DoubleOperator(0.0F);
vec.moveFirst();
while (vec.hasMoreElements()) {
DocumentoScadenza ds = (DocumentoScadenza)vec.nextElement();
if (ds.getId_distintaRiba() == 0L) {
dopInc.add(ds.getImportoScadenza());
if (importoBanca >= dopInc.getResult()) {
dopTot.add(ds.getImportoScadenza());
ds.setFlgScadenzaSelezionata(0L);
ds.setId_distintaRiba(dr.getId_distintaRiba());
rp = ds.save();
rp.getStatus();
continue;
}
dopInc.subtract(ds.getImportoScadenza());
}
}
}
}
}
}
while (vecd.hasMoreElements()) {
DistintaRiba dr = (DistintaRiba)vecd.nextElement();
if (dr.getImportoTotale() == 0.0D)
dr.delete();
}
}
public boolean hasScadenzaConRiba(long l_id_documento) {
if (l_id_documento == 0L)
return false;
String s_Sql_Find = "select DISTINCT A.* from DOCUMENTO_SCADENZA AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc(" A.id_documento = " + l_id_documento);
wc.addWc(" A.id_distintaRiba>0 ");
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
Vectumerator<DocumentoScadenza> res = findRows(stmt, 1, 1);
if (res.hasMoreElements())
return true;
return false;
} catch (SQLException e) {
handleDebug(e);
return true;
}
}
}

View file

@ -0,0 +1,346 @@
package com.ablia.contab;
import com.ablia.anag.Banca;
import com.ablia.anag.Clifor;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
import com.ablia.util.Vectumerator;
import java.sql.Date;
public class DocumentoScadenzaCR extends CRAdapter {
private long id_documentoScadenza;
private long id_documento;
private Documento documento;
private long id_distintaRiba;
private DistintaRiba distintaRiba;
private Date dataScadenza;
private Date dataScadenzaDa;
private Date dataScadenzaA;
private Date dataScadenzaMDa;
private Date dataScadenzaMA;
private Date dataFatturaDa;
private Date dataFatturaA;
private double importoScadenza;
private long flgScadenzaSelezionata;
private long flgDaEstrarre;
private long flgAccorpaScadenze = 1L;
private long flgAll;
private long id_clifor;
private Vectumerator<Banca> vecRiba;
private Clifor clifor;
private String filePdf;
private String numDocumentoDa = "1";
private String numDocumentoA = "999999999";
private long flgDistinta;
private Date dataDistintaRiba = DBAdapter.getToday();
private long timestampElaborazione;
private long flgSoloRiba;
private long flgGestioneDistinta;
private long flgTipoPagamento;
private long flgOrderImporto;
private double totaleRiba;
public DocumentoScadenzaCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public DocumentoScadenzaCR() {}
public long getId_documentoScadenza() {
return this.id_documentoScadenza;
}
public void setId_documentoScadenza(long id_incassoPagamento) {
this.id_documentoScadenza = id_incassoPagamento;
}
public void setDataScadenza(Date data) {
this.dataScadenza = data;
}
public double getImportoScadenza() {
return this.importoScadenza;
}
public void setImportoScadenza(double importo) {
this.importoScadenza = importo;
}
public long getId_documento() {
return this.id_documento;
}
public void setId_documento(long id_documento) {
this.id_documento = id_documento;
}
public Documento getDocumento() {
this.documento = (Documento)getSecondaryObject(this.documento, Documento.class, getId_documento());
return this.documento;
}
public void setDocumento(Documento documento) {
this.documento = documento;
}
public long getFlgScadenzaSelezionata() {
return this.flgScadenzaSelezionata;
}
public void setFlgScadenzaSelezionata(long flgTipoIncasso) {
this.flgScadenzaSelezionata = flgTipoIncasso;
}
public long getId_distintaRiba() {
return this.id_distintaRiba;
}
public void setId_distintaRiba(long id_distintaRiba) {
this.id_distintaRiba = id_distintaRiba;
}
public DistintaRiba getDistintaRiba() {
return this.distintaRiba;
}
public void setDistintaRiba(DistintaRiba distintaRiba) {
this.distintaRiba = distintaRiba;
}
public Date getDataScadenza() {
return this.dataScadenza;
}
public Date getDataScadenzaDa() {
return this.dataScadenzaDa;
}
public void setDataScadenzaDa(Date dataScadenzaDa) {
this.dataScadenzaDa = dataScadenzaDa;
}
public Date getDataScadenzaA() {
return this.dataScadenzaA;
}
public void setDataScadenzaA(Date dataScadenzaA) {
this.dataScadenzaA = dataScadenzaA;
}
public String getFilePdf() {
return (this.filePdf == null) ? "" : this.filePdf;
}
public void setFilePdf(String filePdf) {
this.filePdf = filePdf;
}
public Date getDataScadenzaMDa() {
return this.dataScadenzaMDa;
}
public void setDataScadenzaMDa(Date dataScadenzaMDa) {
this.dataScadenzaMDa = dataScadenzaMDa;
}
public Date getDataScadenzaMA() {
return this.dataScadenzaMA;
}
public void setDataScadenzaMA(Date dataScadenzaMA) {
this.dataScadenzaMA = dataScadenzaMA;
}
public long getFlgDaEstrarre() {
return this.flgDaEstrarre;
}
public void setFlgDaEstrarre(long flgDaEstrarre) {
this.flgDaEstrarre = flgDaEstrarre;
}
public long getFlgAccorpaScadenze() {
return this.flgAccorpaScadenze;
}
public void setFlgAccorpaScadenze(long flgAccorpaScadenze) {
this.flgAccorpaScadenze = flgAccorpaScadenze;
}
public long getId_clifor() {
return this.id_clifor;
}
public void setId_clifor(long id_clifor) {
this.id_clifor = id_clifor;
setClifor(null);
}
public Clifor getClifor() {
this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor());
return this.clifor;
}
public void setClifor(Clifor clifor) {
this.clifor = clifor;
}
public long getFlgAll() {
return this.flgAll;
}
public void setFlgAll(long flgAll) {
this.flgAll = flgAll;
}
public String getNumDocumentoDa() {
return (this.numDocumentoDa == null) ? "" : this.numDocumentoDa;
}
public void setNumDocumentoDa(String numDocumentoDa) {
this.numDocumentoDa = numDocumentoDa;
}
public String getNumDocumentoA() {
return (this.numDocumentoA == null) ? "" : this.numDocumentoA;
}
public void setNumDocumentoA(String numDocumentoA) {
this.numDocumentoA = numDocumentoA;
}
public long getFlgDistinta() {
return this.flgDistinta;
}
public void setFlgDistinta(long flgDistinta) {
this.flgDistinta = flgDistinta;
}
public Date getDataDistintaRiba() {
return this.dataDistintaRiba;
}
public void setDataDistintaRiba(Date dataDistintaRiba) {
this.dataDistintaRiba = dataDistintaRiba;
}
public long getTimestampElaborazione() {
return this.timestampElaborazione;
}
public void setTimestampElaborazione(long timestampElaborazione) {
this.timestampElaborazione = timestampElaborazione;
}
public double getMaxDistintaByBanca(long id_banca) {
double ret = 0.0D;
while (getVecRiba().hasMoreElements()) {
Banca row = (Banca)getVecRiba().nextElement();
if (row.getId_banca() == id_banca) {
ret = row.getImportoRiba();
break;
}
}
return ret;
}
public long getFlgSoloRiba() {
return this.flgSoloRiba;
}
public void setFlgSoloRiba(long flgSoloRiba) {
this.flgSoloRiba = flgSoloRiba;
}
public Date getDataFatturaDa() {
return this.dataFatturaDa;
}
public void setDataFatturaDa(Date dataFatturaDa) {
this.dataFatturaDa = dataFatturaDa;
}
public Date getDataFatturaA() {
return this.dataFatturaA;
}
public void setDataFatturaA(Date dataFatturaA) {
this.dataFatturaA = dataFatturaA;
}
public long getFlgGestioneDistinta() {
return this.flgGestioneDistinta;
}
public void setFlgGestioneDistinta(long flgGestioneDistinta) {
this.flgGestioneDistinta = flgGestioneDistinta;
}
public long getFlgTipoPagamento() {
return this.flgTipoPagamento;
}
public void setFlgTipoPagamento(long flgTipoPagamento) {
this.flgTipoPagamento = flgTipoPagamento;
}
public long getFlgOrderImporto() {
return this.flgOrderImporto;
}
public void setFlgOrderImporto(long flgOrderImporto) {
this.flgOrderImporto = flgOrderImporto;
}
public Vectumerator<Banca> getVecRiba() {
return (this.vecRiba == null) ? DBAdapter.AB_EMPTY_VECTUMERATOR : this.vecRiba;
}
public void setVecRiba(Vectumerator<Banca> vecRiba) {
this.vecRiba = vecRiba;
}
public String getDescrizioneCR() {
return "da fare..";
}
public double getTotaleRiba() {
return this.totaleRiba;
}
public void setTotaleRiba(double totaleRiba) {
this.totaleRiba = totaleRiba;
}
}

View file

@ -0,0 +1,158 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.DBAdapter;
import com.ablia.db.DBAdapterException;
import com.ablia.db.ResParm;
import com.ablia.db.WcString;
import com.ablia.util.StringTokenizer;
import com.ablia.util.Vectumerator;
import java.io.Serializable;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class IncassoPagamento extends DBAdapter implements Serializable {
private static final long serialVersionUID = 8044331984020899695L;
private long id_incassoPagamento;
private Date dataIP;
private double importoIP;
private String notaIP;
private long id_documento;
private Documento documento;
public IncassoPagamento(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public IncassoPagamento() {}
public long getId_incassoPagamento() {
return this.id_incassoPagamento;
}
public void setId_incassoPagamento(long id_incassoPagamento) {
this.id_incassoPagamento = id_incassoPagamento;
}
public Date getDataIP() {
return this.dataIP;
}
public void setDataIP(Date dataIP) {
this.dataIP = dataIP;
}
public double getImportoIP() {
return this.importoIP;
}
public void setImportoIP(double importoIP) {
this.importoIP = importoIP;
}
public String getNotaIP() {
return (this.notaIP == null) ? "" : this.notaIP;
}
public void setNotaIP(String notaIP) {
this.notaIP = notaIP;
}
public long getId_documento() {
return this.id_documento;
}
public void setId_documento(long id_documento) {
this.id_documento = id_documento;
}
public Documento getDocumento() {
this.documento = (Documento)getSecondaryObject(this.documento, Documento.class, getId_documento());
return this.documento;
}
public void setDocumento(Documento documento) {
this.documento = documento;
}
public Vectumerator<IncassoPagamento> findByCR(IncassoPagamentoCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from INCASSO_PAGAMENTO AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(),
" ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token +
"%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
protected void deleteCascade() {}
public Vectumerator<IncassoPagamento> findByDocumento(long id_documento, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from INCASSO_PAGAMENTO AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc(" A.id_documento = " + id_documento);
try {
PreparedStatement stmt = getConn().prepareStatement(
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public double getTotByDocumento(long id_documento) {
String s_Sql_Find = "select SUM(importoIP) as _tot from INCASSO_PAGAMENTO AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc(" A.id_documento = " + id_documento);
try {
PreparedStatement stmt = getConn().prepareStatement(
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return getSum(stmt);
} catch (SQLException e) {
handleDebug(e);
return 0.0D;
}
}
public ResParm save() {
return super.save();
}
public ResParm delete() {
ResParm rp = new ResParm(true);
rp = super.delete();
return rp;
}
protected ResParm checkDeleteCascade() throws DBAdapterException, SQLException {
return new ResParm(true);
}
}

View file

@ -0,0 +1,77 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import java.io.Serializable;
import java.sql.Date;
public class IncassoPagamentoCR extends CRAdapter implements Serializable {
private static final long serialVersionUID = 8044331984020899695L;
private long id_incassoPagamento;
private Date dataIP;
private double importoIP;
private String notaIP;
private long id_documento;
private Documento documento;
public IncassoPagamentoCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public IncassoPagamentoCR() {}
public long getId_incassoPagamento() {
return this.id_incassoPagamento;
}
public void setId_incassoPagamento(long id_incassoPagamento) {
this.id_incassoPagamento = id_incassoPagamento;
}
public Date getDataIP() {
return this.dataIP;
}
public void setDataIP(Date dataIP) {
this.dataIP = dataIP;
}
public double getImportoIP() {
return this.importoIP;
}
public void setImportoIP(double importoIP) {
this.importoIP = importoIP;
}
public String getNotaIP() {
return (this.notaIP == null) ? "" : this.notaIP;
}
public void setNotaIP(String notaIP) {
this.notaIP = notaIP;
}
public long getId_documento() {
return this.id_documento;
}
public void setId_documento(long id_documento) {
this.id_documento = id_documento;
}
public Documento getDocumento() {
this.documento = (Documento)getSecondaryObject(this.documento, Documento.class, getId_documento());
return this.documento;
}
public void setDocumento(Documento documento) {
this.documento = documento;
}
}

View file

@ -0,0 +1,116 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.DBAdapter;
import com.ablia.db.DBAdapterException;
import com.ablia.db.ResParm;
import com.ablia.db.WcString;
import com.ablia.util.StringTokenizer;
import com.ablia.util.Vectumerator;
import java.io.Serializable;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class MovContabile extends DBAdapter implements Serializable {
private static final long serialVersionUID = 3773329117463754505L;
private long id_movContabile;
private String descrizione;
private long id_causaleContabile;
private Date dataMovContabile;
private long flgStato;
private CausaleContabile causaleContabile;
public MovContabile(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public MovContabile() {}
public long getId_movContabile() {
return this.id_movContabile;
}
public void setId_movContabile(long id_incassoPagamento) {
this.id_movContabile = id_incassoPagamento;
}
public Vectumerator<MovContabile> findByCR(MovContabileCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from MOV_CONTABILE AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
protected void deleteCascade() {}
protected ResParm checkDeleteCascade() throws DBAdapterException, SQLException {
return null;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione;
}
public void setDescrizione(String descrizione) {
this.descrizione = descrizione;
}
public long getId_causaleContabile() {
return this.id_causaleContabile;
}
public void setId_causaleContabile(long id_causaleContabile) {
this.id_causaleContabile = id_causaleContabile;
setCausaleContabile(null);
}
public Date getDataMovContabile() {
return this.dataMovContabile;
}
public void setDataMovContabile(Date dataMovContabile) {
this.dataMovContabile = dataMovContabile;
}
public long getFlgStato() {
return this.flgStato;
}
public void setFlgStato(long flgStato) {
this.flgStato = flgStato;
}
public CausaleContabile getCausaleContabile() {
this.causaleContabile = (CausaleContabile)getSecondaryObject(this.causaleContabile, CausaleContabile.class, getId_causaleContabile());
return this.causaleContabile;
}
public void setCausaleContabile(CausaleContabile causaleContabile) {
this.causaleContabile = causaleContabile;
}
}

View file

@ -0,0 +1,77 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import java.io.Serializable;
import java.sql.Date;
public class MovContabileCR extends CRAdapter implements Serializable {
private static final long serialVersionUID = 1120016389762829114L;
private long id_movContabile;
private String descrizione;
private long id_causaleContabile;
private Date dataMovContabile;
private long flgStato;
private CausaleContabile causaleContabile;
public MovContabileCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public MovContabileCR() {}
public long getId_movContabile() {
return this.id_movContabile;
}
public void setId_movContabile(long id_incassoPagamento) {
this.id_movContabile = id_incassoPagamento;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione;
}
public void setDescrizione(String descrizione) {
this.descrizione = descrizione;
}
public long getId_causaleContabile() {
return this.id_causaleContabile;
}
public void setId_causaleContabile(long id_causaleContabile) {
this.id_causaleContabile = id_causaleContabile;
}
public Date getDataMovContabile() {
return this.dataMovContabile;
}
public void setDataMovContabile(Date dataMovContabile) {
this.dataMovContabile = dataMovContabile;
}
public long getFlgStato() {
return this.flgStato;
}
public void setFlgStato(long flgStato) {
this.flgStato = flgStato;
}
public CausaleContabile getCausaleContabile() {
this.causaleContabile = (CausaleContabile)getSecondaryObject(this.causaleContabile, CausaleContabile.class, getId_causaleContabile());
return this.causaleContabile;
}
public void setCausaleContabile(CausaleContabile causaleContabile) {
this.causaleContabile = causaleContabile;
}
}

View file

@ -0,0 +1,982 @@
package com.ablia.contab;
import com.ablia.anag.Clifor;
import com.ablia.anag.MagFisico;
import com.ablia.art.Articolo;
import com.ablia.art.ArticoloTaglia;
import com.ablia.art.ArticoloVariante;
import com.ablia.art.TipologiaArticolo;
import com.ablia.db.ApplParmFull;
import com.ablia.db.ResParm;
import com.ablia.db.WcString;
import com.ablia.util.FileWr;
import com.ablia.util.StringTokenizer;
import com.ablia.util.Vectumerator;
import java.io.File;
import java.io.Serializable;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class Movimento extends _ContabAdapter implements Serializable {
private static final long serialVersionUID = -5378446506644250769L;
private long id_movimento;
private long id_rigaDocumento;
private long id_articoloVariante;
private long id_articoloTaglia;
private long id_magFisico;
private long id_clifor;
private String seriale;
private double kg;
private double mt;
private double nr;
private RigaDocumento rigaDocumento;
private Articolo articolo;
private ArticoloVariante articoloVariante;
private ArticoloTaglia articoloTaglia;
private MagFisico magFisico;
private Clifor clifor;
private long id_articolo;
private long id_rigaDocumentoP;
private long id_causaleMagazzino;
private CausaleMagazzino causaleMagazzino;
private Date dataMovimento;
public Movimento(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public Movimento() {}
protected void deleteCascade() {}
public Vectumerator xxfindByCR(MovimentoCR CR, int pageNumber, int pageRows) {
return findSaldiArticoloByCR(CR, pageNumber, pageRows);
}
public Vectumerator findSaldiArticoloByCR(MovimentoCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.id_articolo, A.id_articoloVariante, A.id_articoloTaglia, A.id_magFisico, A.seriale, A.id_clifor, SUM(A.kg) as kg, SUM(A.mt) as mt, SUM(A.nr) as nr from MOVIMENTO AS A INNER JOIN ARTICOLO AS B ON A.id_articolo = B.id_articolo ";
String s_Sql_Group = " group by A.id_articolo, id_articoloVariante, id_articoloTaglia, A.id_magFisico, A.seriale, A.id_clifor ";
String s_Sql_Order = " order by B.nome, A.id_magFisico, A.id_clifor ";
String s_Sql_Having = "";
if (CR.getFlgInMagazzino() == 1L) {
s_Sql_Having = " Having SUM(kg) > 0 OR SUM(mt) > 0 OR SUM(nr) > 0 ";
} else if (CR.getFlgInMagazzino() == 2L) {
s_Sql_Having = " Having SUM(kg) < 0 OR SUM(mt) < 0 OR SUM(nr) < 0 ";
} else if (CR.getFlgInMagazzino() == 3L) {
s_Sql_Having = " Having SUM(kg) <> 0 OR SUM(mt) <> 0 OR SUM(nr) <> 0 ";
}
WcString wc = new WcString();
if (!CR.getSearchTxt().isEmpty() && !CR.getSearchTxt().equals("*")) {
String star = "";
String temp = CR.getSearchTxt();
temp = prepareMySqlString(temp, true);
temp = temp.replace("*", "%");
StringTokenizer st = new StringTokenizer(temp.trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = String.valueOf(star) + st.nextToken();
txt.append("(B.codice like '" + token + "%' or B.nome like '" + token + "%' or B.codiceProduttore like '" + token +
"%' or B.codiciAlternativi like '%," + token + "%')");
if (st.hasMoreTokens()) {
txt.append(" and ");
star = "%";
}
}
txt.append(")");
wc.addWc(txt.toString());
}
if (CR.getId_articolo() > 0L)
wc.addWc(" A.id_articolo = " + CR.getId_articolo());
if (CR.getId_articoloVariante() > 0L)
wc.addWc(" A.id_articoloVariante = " + CR.getId_articoloVariante());
if (CR.getId_articoloTaglia() > 0L)
wc.addWc(" A.id_articoloTaglia = " + CR.getId_articoloTaglia());
if (CR.getId_magFisico() > 0L)
wc.addWc(" A.id_magFisico = " + CR.getId_magFisico());
if (CR.getId_clifor() > 0L)
wc.addWc(" A.id_clifor = " + CR.getId_clifor());
try {
PreparedStatement stmt = getConn()
.prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Group + s_Sql_Having + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public long getId_movimento() {
return this.id_movimento;
}
public void setId_movimento(long id_movimento) {
this.id_movimento = id_movimento;
}
public long getId_rigaDocumento() {
return this.id_rigaDocumento;
}
public void setId_rigaDocumento(long id_rigaDocumento) {
this.id_rigaDocumento = id_rigaDocumento;
}
public long getId_articolo() {
return this.id_articolo;
}
public void setId_articolo(long id_articolo) {
this.id_articolo = id_articolo;
}
public long getId_articoloVariante() {
return this.id_articoloVariante;
}
public void setId_articoloVariante(long id_articoloVariante) {
this.id_articoloVariante = id_articoloVariante;
}
public long getId_articoloTaglia() {
return this.id_articoloTaglia;
}
public void setId_articoloTaglia(long id_articoloTaglia) {
this.id_articoloTaglia = id_articoloTaglia;
}
public long getId_magFisico() {
return this.id_magFisico;
}
public void setId_magFisico(long id_magFisico) {
this.id_magFisico = id_magFisico;
}
public long getId_clifor() {
return this.id_clifor;
}
public void setId_clifor(long id_clifor) {
this.id_clifor = id_clifor;
}
public String getSeriale() {
return (this.seriale == null) ? "" : this.seriale;
}
public void setSeriale(String seriale) {
this.seriale = seriale;
}
public double getKg() {
return this.kg;
}
public void setKg(double kg) {
this.kg = kg;
}
public double getMt() {
return this.mt;
}
public void setMt(double mt) {
this.mt = mt;
}
public double getNr() {
return this.nr;
}
public void setNr(double nr) {
this.nr = nr;
}
public RigaDocumento getRigaDocumento() {
this.rigaDocumento = (RigaDocumento)getSecondaryObject(this.rigaDocumento, RigaDocumento.class, getId_rigaDocumento());
return this.rigaDocumento;
}
public void setRigaDocumento(RigaDocumento rigaDocumento) {
this.rigaDocumento = rigaDocumento;
}
public Articolo getArticolo() {
this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, getId_articolo());
return this.articolo;
}
public void setArticolo(Articolo articolo) {
this.articolo = articolo;
}
public ArticoloVariante getArticoloVariante() {
this.articoloVariante = (ArticoloVariante)getSecondaryObject(this.articoloVariante, ArticoloVariante.class, getId_articoloVariante());
return this.articoloVariante;
}
public void setArticoloVariante(ArticoloVariante articoloVariante) {
this.articoloVariante = articoloVariante;
}
public ArticoloTaglia getArticoloTaglia() {
this.articoloTaglia = (ArticoloTaglia)getSecondaryObject(this.articoloTaglia, ArticoloTaglia.class, getId_articoloTaglia());
return this.articoloTaglia;
}
public void setArticoloTaglia(ArticoloTaglia articoloTaglia) {
this.articoloTaglia = articoloTaglia;
}
public MagFisico getMagFisico() {
this.magFisico = (MagFisico)getSecondaryObject(this.magFisico, MagFisico.class, getId_magFisico());
return this.magFisico;
}
public void setMagFisico(MagFisico magFisico) {
this.magFisico = magFisico;
}
public Clifor getClifor() {
this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor());
return this.clifor;
}
public void setClifor(Clifor clifor) {
this.clifor = clifor;
}
public Vectumerator findByRigaDocumento(long l_id_rigaDocumento) {
String s_Sql_Find = "select DISTINCT A.* from MOVIMENTO AS A ";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc(" A.id_rigaDocumento = " + l_id_rigaDocumento);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, 0, 0);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public void findDisponibilita(long l_id_articolo, long l_id_articoloVariante, long l_id_articoloTaglia, String l_seriale, long l_tipologia_magfisico, long l_id_clifor, Date dataA) {
String s_Sql_Sum = " SUM(A.kg) as kg, SUM(A.mt) as mt, SUM(A.nr) as nr from MOVIMENTO AS A ";
String s_Sql_colonne = "";
String s_Sql_join = "";
WcString wc = new WcString();
wc.addWc(" A.id_magFisico = B.id_magFisico ");
if (l_id_articolo != 0L) {
wc.addWc(" A.id_articolo = " + l_id_articolo);
s_Sql_colonne = String.valueOf(s_Sql_colonne) + " A.id_articolo,";
}
if (l_id_articoloVariante != 0L) {
wc.addWc(" A.id_articoloVariante = " + l_id_articoloVariante);
s_Sql_colonne = String.valueOf(s_Sql_colonne) + " A.id_articoloVariante,";
}
if (l_id_articoloTaglia != 0L) {
wc.addWc(" A.id_articoloTaglia = " + l_id_articoloTaglia);
s_Sql_colonne = String.valueOf(s_Sql_colonne) + " A.id_articoloTaglia,";
}
if (l_tipologia_magfisico != 0L) {
wc.addWc(" B.flgTipo = " + l_tipologia_magfisico);
s_Sql_colonne = String.valueOf(s_Sql_colonne) + " A.id_magFisico,";
}
if (l_seriale != null && !l_seriale.isEmpty()) {
wc.addWc(" A.seriale = " + l_seriale);
s_Sql_colonne = String.valueOf(s_Sql_colonne) + " A.seriale,";
}
if (l_id_clifor != 0L) {
wc.addWc(" A.id_clifor = " + l_id_clifor);
s_Sql_colonne = String.valueOf(s_Sql_colonne) + " A.id_clifor,";
}
if (dataA != null) {
s_Sql_join = " inner join RIGA_DOCUMENTO AS RD ON A.id_rigaDocumento=RD.id_rigaDocumento INNER JOIN DOCUMENTO AS DOC ON RD.id_documento=DOC.id_documento ";
wc.addWc(" DOC.dataDocumento <= ?");
}
String s_sql_groupby = "";
if (!s_Sql_colonne.isEmpty())
s_sql_groupby = " group by " + s_Sql_colonne.substring(0, s_Sql_colonne.length() - 1);
s_Sql_Sum = String.valueOf(s_Sql_Sum) + s_Sql_join + ", MAG_FISICO AS B";
try {
PreparedStatement stmt = getConn()
.prepareStatement("select " + s_Sql_colonne + s_Sql_Sum + wc.toString() + s_sql_groupby);
if (dataA != null)
stmt.setDate(1, dataA);
findFirstRecord(stmt);
} catch (SQLException e) {
handleDebug(e);
}
}
public Vectumerator findSaldiArticoloVarianteTagliaByCR(MovimentoCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select B.id_articolo, C.id_articoloVariante , SUM(A.kg) as kg, SUM(A.mt) as mt, SUM(A.nr) as nr from ARTICOLO AS B LEFT JOIN ARTICOLO_VARIANTE AS C ON B.id_articolo=C.id_articolo LEFT JOIN MOVIMENTO AS A ON A.id_articolo=B.id_articolo and A.id_articoloVariante=C.id_articoloVariante left JOIN MAG_FISICO AS D ON A.id_magFisico=D.id_magFisico ";
if (CR.getFlgTipoMagazzino() > 0L)
s_Sql_Find = String.valueOf(s_Sql_Find) + " and D.flgTipo = " + CR.getFlgTipoMagazzino();
String s_Sql_Group = " group by B.id_articolo, C.id_articoloVariante";
String s_Sql_Order = " order by B.nome, C.nomeV, A.id_articoloTaglia ";
String s_Sql_Having = "";
if (CR.getFlgInMagazzino() == 1L) {
s_Sql_Having = " Having SUM(A.kg) > 0 OR SUM(A.mt) > 0 OR SUM(A.nr) > 0 ";
} else if (CR.getFlgInMagazzino() == 2L) {
s_Sql_Having = " Having SUM(A.kg) < 0 OR SUM(A.mt) < 0 OR SUM(A.nr) < 0 ";
}
WcString wc = new WcString();
if (!CR.getSearchTxt().isEmpty() && !CR.getSearchTxt().equals("*")) {
String star = "";
String temp = CR.getSearchTxt();
temp = prepareMySqlString(temp, true);
temp = temp.replace("*", "%");
StringTokenizer st = new StringTokenizer(temp.trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = String.valueOf(star) + st.nextToken();
txt.append("(B.codice like '" + token + "%' or B.nome like '" + token + "%' or B.codiceProduttore like '" + token +
"%' or B.codiciAlternativi like '%," + token + "%')");
if (st.hasMoreTokens()) {
txt.append(" and ");
star = "%";
}
}
txt.append(")");
wc.addWc(txt.toString());
}
if (CR.getId_articolo() > 0L)
wc.addWc("B.id_articolo = " + CR.getId_articolo());
if (CR.getId_magFisico() > 0L)
wc.addWc(" A.id_magFisico = " + CR.getId_magFisico());
if (CR.getId_clifor() > 0L)
wc.addWc(" A.id_clifor = " + CR.getId_clifor());
try {
PreparedStatement stmt = getConn()
.prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Group + s_Sql_Having + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public boolean isArticoloDisponibile(long l_id_articolo, long l_id_articoloVariante, long l_id_taglia, String l_seriale, long l_id_magazzino) {
return (getQuantita() > 0.0D);
}
public double getQuantita() {
TipologiaArticolo ta = getArticolo().getTipologiaArticolo();
if (ta.getFlgUdm() == 1L)
return getNr();
if (ta.getFlgUdm() == 3L)
return getMt();
if (ta.getFlgUdm() == 2L)
return getKg();
return 0.0D;
}
public long getId_rigaDocumentoP() {
return this.id_rigaDocumentoP;
}
public void setId_rigaDocumentoP(long id_rigaDocumentoP) {
this.id_rigaDocumentoP = id_rigaDocumentoP;
}
public void findDisponibilitaPuntuale(long l_id_articolo, long l_id_articoloVariante, long l_id_articoloTaglia, String l_seriale, long l_id_magfisico, long l_id_clifor) {
String s_Sql_Sum = " SUM(kg) as kg, SUM(mt) as mt, SUM(nr) as nr from MOVIMENTO AS A";
String s_Sql_colonne = "";
WcString wc = new WcString();
if (l_id_articolo != 0L) {
wc.addWc(" id_articolo = " + l_id_articolo);
s_Sql_colonne = String.valueOf(s_Sql_colonne) + " id_articolo,";
}
if (l_id_articoloVariante != 0L) {
wc.addWc(" id_articoloVariante = " + l_id_articoloVariante);
s_Sql_colonne = String.valueOf(s_Sql_colonne) + " id_articoloVariante,";
}
if (l_id_articoloTaglia != 0L) {
wc.addWc(" id_articoloTaglia = " + l_id_articoloTaglia);
s_Sql_colonne = String.valueOf(s_Sql_colonne) + " id_articoloTaglia,";
}
if (l_id_magfisico != 0L) {
wc.addWc(" id_magFisico = " + l_id_magfisico);
s_Sql_colonne = String.valueOf(s_Sql_colonne) + " id_magFisico,";
}
if (l_seriale != null && !l_seriale.isEmpty()) {
wc.addWc(" seriale = '" + l_seriale + "'");
s_Sql_colonne = String.valueOf(s_Sql_colonne) + " seriale,";
}
if (l_id_clifor != 0L) {
wc.addWc(" id_clifor = " + l_id_clifor);
s_Sql_colonne = String.valueOf(s_Sql_colonne) + " id_clifor,";
}
String s_sql_groupby = "";
if (!s_Sql_colonne.isEmpty())
s_sql_groupby = " group by " + s_Sql_colonne.substring(0, s_Sql_colonne.length() - 1);
try {
PreparedStatement stmt = getConn()
.prepareStatement("select " + s_Sql_colonne + s_Sql_Sum + wc.toString() + s_sql_groupby);
findFirstRecord(stmt);
} catch (SQLException e) {
handleDebug(e);
}
}
public ResParm deleteP(long l_id_rigaDocumentoP) {
return delete("DELETE FROM MOVIMENTO WHERE id_rigaDocumentoP = " + l_id_rigaDocumentoP);
}
public void findDisponibilitaPuntualeMagazziniInterni(long l_id_articolo, long l_id_articoloVariante, long l_id_articoloTaglia, String l_seriale, long l_id_clifor) {
String s_Sql_Sum = " SUM(kg) as kg, SUM(mt) as mt, SUM(nr) as nr from MOVIMENTO AS A";
String s_Sql_colonne = "";
WcString wc = new WcString();
if (l_id_articolo != 0L) {
wc.addWc(" id_articolo = " + l_id_articolo);
s_Sql_colonne = String.valueOf(s_Sql_colonne) + " id_articolo,";
}
if (l_id_articoloVariante != 0L) {
wc.addWc(" id_articoloVariante = " + l_id_articoloVariante);
s_Sql_colonne = String.valueOf(s_Sql_colonne) + " id_articoloVariante,";
}
if (l_id_articoloTaglia != 0L) {
wc.addWc(" id_articoloTaglia = " + l_id_articoloTaglia);
s_Sql_colonne = String.valueOf(s_Sql_colonne) + " id_articoloTaglia,";
}
MagFisico mag = new MagFisico(getApFull());
Vectumerator<MagFisico> vecMag = mag.findByTipo(1L);
if (vecMag.hasMoreElements()) {
StringBuilder mf = new StringBuilder("");
s_Sql_colonne = String.valueOf(s_Sql_colonne) + " id_magFisico,";
while (vecMag.hasMoreElements()) {
mag = (MagFisico)vecMag.nextElement();
if (mf.length() > 0)
mf.append(" OR ");
mf.append(" id_magFisico = " + mag.getId_magFisico());
}
mf.append(")");
wc.addWc("(" + mf.toString());
}
if (l_seriale != null && !l_seriale.isEmpty()) {
wc.addWc(" seriale = '" + l_seriale + "'");
s_Sql_colonne = String.valueOf(s_Sql_colonne) + " seriale,";
}
if (l_id_clifor != 0L) {
wc.addWc(" id_clifor = " + l_id_clifor);
s_Sql_colonne = String.valueOf(s_Sql_colonne) + " id_clifor,";
}
String s_sql_groupby = "";
if (!s_Sql_colonne.isEmpty())
s_sql_groupby = " group by " + s_Sql_colonne.substring(0, s_Sql_colonne.length() - 1);
try {
PreparedStatement stmt = getConn()
.prepareStatement("select " + s_Sql_colonne + s_Sql_Sum + wc.toString() + s_sql_groupby);
findFirstRecord(stmt);
} catch (SQLException e) {
handleDebug(e);
}
}
public static ResParm aggiornaDispo(ApplParmFull ap, long l_id_articolo, long l_id_articoloVariante, long l_id_articoloTaglia, long l_id_users) {
ResParm rp = new ResParm(true);
if (l_id_articolo != 0L || l_id_articoloVariante != 0L || l_id_articoloTaglia != 0L) {
Movimento mov = new Movimento(ap);
mov.findDisponibilitaPuntualeMagazziniInterni(l_id_articolo, l_id_articoloVariante, l_id_articoloTaglia, "", 0L);
Articolo art = new Articolo(ap);
art.findByPrimaryKey(l_id_articolo);
art.resetCalcoloQuantita();
if (art.getTipo().getFlgTipoMagazzino() == 0L ||
art.getTipo().getFlgTipoMagazzino() == 9L) {
System.out.println("ATTENZIONE!!!!aggiornaDispo");
art.setFlgDispo(1L);
} else {
if (l_id_articoloTaglia > 0L) {
ArticoloTaglia bean = new ArticoloTaglia(ap);
bean.findByPrimaryKey(l_id_articoloTaglia);
bean.setFlgDispo((long)((mov.getQuantita() > 0.0D) ? 1L : 0L));
bean.save();
}
if (l_id_articoloVariante > 0L) {
ArticoloVariante bean = new ArticoloVariante(ap);
bean.resetCalcoloQuantita();
bean.save();
}
art.setFlgDispo((long)((mov.getQuantita() > 0.0D) ? 1L : 0L));
}
art.save();
RigaDocumento rd = new RigaDocumento(ap);
rd.resetStatoPrenotazioneByArticolo(l_id_articolo, l_id_articoloVariante, l_id_articoloTaglia);
}
return rp;
}
public ResParm save() {
setDataMovimento(getRigaDocumento().getDocumento().getDataDocumento());
ResParm rp = super.save();
if (rp.getStatus())
rp = aggiornaDispo(getApFull(), getId_articolo(), getId_articoloVariante(), getId_articoloTaglia(), getLastUpdId_user());
return rp;
}
public ResParm delete(String sqlString) {
ResParm rp = new ResParm(false);
try {
Movimento mov = (Movimento)clone();
rp = super.delete(sqlString);
aggiornaDispo(getApFull(), mov.getId_articolo(), mov.getId_articoloVariante(), mov.getId_articoloTaglia(), getLastInsertId());
} catch (Exception e) {
rp.setStatus(false);
rp.setException(e);
}
return rp;
}
public long getId_causaleMagazzino() {
return this.id_causaleMagazzino;
}
public void setId_causaleMagazzino(long id_causaleMagazzino) {
this.id_causaleMagazzino = id_causaleMagazzino;
}
public CausaleMagazzino getCausaleMagazzino() {
this.causaleMagazzino = (CausaleMagazzino)getSecondaryObject(this.causaleMagazzino, CausaleMagazzino.class, getId_causaleMagazzino());
return this.causaleMagazzino;
}
public void setCausaleMagazzino(CausaleMagazzino causaleMagazzino) {
this.causaleMagazzino = causaleMagazzino;
}
public void findByRigaDocumentoCausale(long l_id_rigaDocumento, long l_id_causaleMagazzino) {
String s_Sql_Find = "select DISTINCT A.* from MOVIMENTO AS A ";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc(" A.id_rigaDocumento = " + l_id_rigaDocumento);
wc.addWc(" A.id_causaleMagazzino = " + l_id_causaleMagazzino);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
findFirstRecord(stmt);
} catch (SQLException e) {
handleDebug(e);
}
}
public void findBySerialeDisponibile(String l_seriale) {
String s_Sql_Find = "SELECT A.*, SUM(A.nr) AS nr from MOVIMENTO AS A ";
String s_Sql_Having = " HAVING nr > 0 ";
String s_Sql_Order = " ";
WcString wc = new WcString();
wc.addWc(" A.seriale = '" + l_seriale + "'");
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
findFirstRecord(stmt);
} catch (SQLException e) {
handleDebug(e);
}
}
public void findBySerialeEsistente(String l_seriale) {
String s_Sql_Find = "SELECT A.* from MOVIMENTO AS A ";
String s_Sql_Order = " ";
WcString wc = new WcString();
wc.addWc(" A.seriale = '" + l_seriale + "'");
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
findFirstRecord(stmt);
} catch (SQLException e) {
handleDebug(e);
}
}
public Date getDataMovimento() {
return this.dataMovimento;
}
public void setDataMovimento(Date dataMovimento) {
this.dataMovimento = dataMovimento;
}
public String getDescrizioneArticolo() {
if (getId_articoloTaglia() != 0L)
return getArticoloTaglia().getDescrizioneCompleta();
if (getId_articoloVariante() == 0L)
return getArticolo().getDescrizioneCompleta();
return getArticoloVariante().getDescrizioneCompleta();
}
public Vectumerator findByCR(MovimentoCR CR, int pageNumber, int pageRows) {
if (CR.getFlgReport().equals("S") && CR.getFlgTipoReport() == 1L)
return findByCRCompatto(CR, pageNumber, pageRows);
boolean flgOttimizzo = (getParm("OTTIMIZZO").getNumero() == 1.0D);
StringBuffer s_Sql_Find = new StringBuffer(
"select distinct A.* from MOVIMENTO AS A, RIGA_DOCUMENTO AS B, DOCUMENTO AS C, ARTICOLO AS D ");
String s_Sql_Order = " order by D.nome,D.codice, A.seriale, C.dataDocumento, C.id_esercizio desc, C.progDocumento desc";
if (CR.getFlgOrderBy() == 1L)
s_Sql_Order = " order by C.dataDocumento asc, C.id_esercizio asc, C.progDocumento asc";
WcString wc = new WcString();
findByCRCreateWC(CR, s_Sql_Find, wc);
try {
PreparedStatement stmt;
if ((pageNumber == 0 && pageRows == 0) || !flgOttimizzo) {
stmt = getConn().prepareStatement(s_Sql_Find + wc.toString() + s_Sql_Order);
} else {
if (pageNumber == 0)
pageNumber = 1;
int start = (pageNumber - 1) * pageRows;
int stop = start + pageRows;
stmt = getConn().prepareStatement(s_Sql_Find + wc.toString() + s_Sql_Order + " limit " + start + "," + stop);
}
findByCRCreateStmtDate(CR, stmt);
if ((pageNumber == 0 && pageRows == 0) || !flgOttimizzo)
return findRows(stmt, pageNumber, pageRows);
Vectumerator vec = findRows(stmt, 1, pageRows);
vec.setPageNumber(pageNumber);
vec.setTotNumberOfRecords(findByCRTotRecord(CR));
return vec;
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
protected void findByCRCreateStmtDate(MovimentoCR CR, PreparedStatement stmt) {
try {
int dataCount = 0;
if (CR.getDataDocumentoDa() != null) {
dataCount++;
stmt.setDate(dataCount, CR.getDataDocumentoDa());
}
if (CR.getDataDocumentoA() != null) {
dataCount++;
stmt.setDate(dataCount, CR.getDataDocumentoA());
}
if (CR.getDataRiferimentoDa() != null) {
dataCount++;
stmt.setDate(dataCount, CR.getDataRiferimentoDa());
}
if (CR.getDataRiferimentoA() != null) {
dataCount++;
stmt.setDate(dataCount, CR.getDataRiferimentoA());
}
} catch (SQLException e) {
handleDebug(e);
}
}
protected void findByCRCreateWC(MovimentoCR CR, StringBuffer s_Sql_Find, WcString wc) {
wc.addWc("A.id_rigaDocumento=B.id_rigaDocumento");
wc.addWc("B.id_documento=C.id_documento");
wc.addWc("B.id_articolo=D.id_articolo");
if (!CR.getSearchTxt().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = prepareSqlString(st.nextToken());
txt.append("(C.nominativoDocumento like '%" + token + "%' or D.nome like '%" + token + "%' )");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
if (CR.getId_articoloVariante() != 0L) {
wc.addWc("A.id_articoloVariante=" + CR.getId_articoloVariante());
} else if (CR.getId_articolo() != 0L) {
wc.addWc("A.id_articolo=" + CR.getId_articolo());
}
if (CR.getId_tipoDocumento() > 0L)
wc.addWc("C.id_tipoDocumento=" + CR.getId_tipoDocumento());
if (CR.getId_esercizio() > 0L)
wc.addWc("year(C.dataDocumento)=" + CR.getId_esercizio());
if (CR.getId_clifor() > 0L)
wc.addWc("C.id_clifor=" + CR.getId_clifor());
if (CR.getId_magFisico() > 0L)
wc.addWc("A.id_magFisico=" + CR.getId_magFisico());
if (CR.getId_tipo() != 0L) {
s_Sql_Find.append(" , TIPO AS E");
wc.addWc("D.id_tipo=E.id_tipo");
wc.addWc("(D.id_tipo=" + CR.getId_tipo() + " or E.indici like'%:" + CR.getId_tipo() + ":%')");
}
if (CR.getId_marca() != 0L)
wc.addWc("D.id_marca=" + CR.getId_marca());
if (!CR.getSeriale().isEmpty()) {
String temp = CR.getSeriale();
temp = temp.replace("%", "\\%");
temp = temp.replace("_", "\\_");
temp = temp.replace("*", "%");
wc.addWc("A.seriale like '" + CR.getSeriale() + "'");
}
if (CR.getDataDocumentoDa() != null)
wc.addWc("C.dataDocumento>=?");
if (CR.getDataDocumentoA() != null)
wc.addWc("C.dataDocumento<=?");
if (CR.getDataRiferimentoDa() != null)
wc.addWc("C.dataRiferimento>=?");
if (CR.getDataRiferimentoA() != null)
wc.addWc("C.dataRiferimento<=?");
}
private int findByCRTotRecord(MovimentoCR CR) {
StringBuffer s_Sql_Find = new StringBuffer(
"select distinct count(*) as tot from MOVIMENTO AS A, RIGA_DOCUMENTO AS B, DOCUMENTO AS C, ARTICOLO AS D ");
WcString wc = new WcString();
findByCRCreateWC(CR, s_Sql_Find, wc);
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + wc.toString());
findByCRCreateStmtDate(CR, stmt);
return (int)getTots(stmt);
} catch (Exception e) {
handleDebug(e);
return 0;
}
}
public double getSaldoByArticoloVarianteTagliaMagazzino(long l_id_articolo, long l_id_articoloVariante, long l_id_articoloTaglia, long l_id_magFisico) {
String s_Sql_Find = "select SUM(A.kg) as kg, SUM(A.mt) as mt, SUM(A.nr) as nr from MOVIMENTO AS A ";
String s_Sql_Group = " group by A.id_articolo, A.id_articoloVariante, A.id_articoloTaglia ";
String s_Sql_Order = " ";
WcString wc = new WcString();
wc.addWc(" A.id_articolo = " + l_id_articolo);
if (l_id_articoloVariante > 0L)
wc.addWc(" A.id_articoloVariante = " + l_id_articoloVariante);
if (l_id_articoloTaglia > 0L)
wc.addWc(" A.id_articoloTaglia = " + l_id_articoloTaglia);
wc.addWc(" A.id_magFisico = " + l_id_magFisico);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Group + s_Sql_Order);
findFirstRecord(stmt);
return getNr();
} catch (SQLException e) {
handleDebug(e);
return 0.0D;
}
}
public void creaFileCvs(MovimentoCR CR) {
if (CR.getFlgReport().equals("S") && CR.getFlgTipoReport() == 1L) {
creaFileCvsCompatto(CR);
} else {
Vectumerator list = findByCR(CR, 0, 0);
CR.setFileName("tmpFile/movMagazzino_" + CR.getId_users() + ".csv");
String theCvsFile = String.valueOf(getDocBase()) + CR.getFileName();
String SEP = ";";
new File(theCvsFile).delete();
FileWr outCvsFile = new FileWr(theCvsFile, false);
String s1 = "Operatore;Documento;Intestazione;Data;Cod. Articolo;Articolo;Seriale;Disp.Art.;Tipo Movimento;Magazzini;Q.ta;Kg;Mt;Nr.";
outCvsFile.writeLine(CR.getDescrizioneCR());
outCvsFile.writeLine(s1);
while (list.hasMoreElements()) {
Movimento row = (Movimento)list.nextElement();
s1 = String.valueOf(row.getRigaDocumento().getDocumento().getUsers().getCognomeNome()) + SEP + "\"" +
row.getRigaDocumento().getDocumento().getNumeroDocumentoCompleto() + "\"" + SEP +
row.getRigaDocumento().getDocumento().getClifor().getDescrizioneCompleta() + SEP +
getDataFormat().format(row.getRigaDocumento().getDocumento().getDataDocumento()) + SEP +
row.getCodiceArticolo() + SEP + row.getRigaDocumento().getDescrizioneRigaCompleta() + SEP + row.getSeriale() +
SEP + getNf().format(row.getArticolo().getQuantita()) + SEP +
row.getRigaDocumento().getDocumento().getTipoDocumento().getCausaleMagazzino().getDescrizione() + SEP +
row.getMagFisico().getDescrizione() + SEP + getNf().format(row.getQuantita()) + SEP +
getNf().format(row.getKg()) + SEP + getNf().format(row.getMt()) + SEP + getNf().format(row.getNr());
s1 = s1.replace("&euro;", "");
s1 = s1.replace("&raquo;", "-->");
outCvsFile.writeLine(s1);
}
outCvsFile.closeFile();
}
}
public Vectumerator findSaldiArticoloVarianteTagliaByCR_OLD(MovimentoCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.id_articolo, A.id_articoloVariante, A.id_articoloTaglia, SUM(A.kg) as kg, SUM(A.mt) as mt, SUM(A.nr) as nr from MOVIMENTO AS A INNER JOIN ARTICOLO AS B ON A.id_articolo=B.id_articolo LEFT JOIN ARTICOLO_VARIANTE AS C ON A.id_articoloVariante=C.id_articoloVariante INNER JOIN MAG_FISICO AS D ON A.id_magFisico=D.id_magFisico ";
String s_Sql_Group = " group by A.id_articolo, A.id_articoloVariante, A.id_articoloTaglia ";
String s_Sql_Order = " order by B.nome, C.nomeV, A.id_articoloTaglia ";
String s_Sql_Having = "";
if (CR.getFlgInMagazzino() == 1L) {
s_Sql_Having = " Having SUM(kg) > 0 OR SUM(mt) > 0 OR SUM(nr) > 0 ";
} else if (CR.getFlgInMagazzino() == 2L) {
s_Sql_Having = " Having SUM(kg) < 0 OR SUM(mt) < 0 OR SUM(nr) < 0 ";
}
WcString wc = new WcString();
if (!CR.getSearchTxt().isEmpty() && !CR.getSearchTxt().equals("*")) {
s_Sql_Find = String.valueOf(s_Sql_Find) + " LEFT JOIN ARTICOLO AS B ON A.id_articolo = B.id_articolo ";
String star = "";
String temp = CR.getSearchTxt();
temp = prepareMySqlString(temp, true);
temp = temp.replace("*", "%");
StringTokenizer st = new StringTokenizer(temp.trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = String.valueOf(star) + st.nextToken();
txt.append("(B.codice like '" + token + "%' or B.nome like '" + token + "%' or B.codiceProduttore like '" + token +
"%' or B.codiciAlternativi like '%," + token + "%')");
if (st.hasMoreTokens()) {
txt.append(" and ");
star = "%";
}
}
txt.append(")");
wc.addWc(txt.toString());
}
if (CR.getId_articolo() > 0L)
wc.addWc(" A.id_articolo = " + CR.getId_articolo());
if (CR.getId_magFisico() > 0L)
wc.addWc(" A.id_magFisico = " + CR.getId_magFisico());
if (CR.getFlgTipoMagazzino() > 0L)
wc.addWc(" D.flgTipo = " + CR.getFlgTipoMagazzino());
if (CR.getId_clifor() > 0L)
wc.addWc(" A.id_clifor = " + CR.getId_clifor());
try {
PreparedStatement stmt = getConn()
.prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Group + s_Sql_Having + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public void findDisponibilitaPuntualeMagazziniInterniEsterni(long l_id_articolo, long l_id_articoloVariante, long l_id_articoloTaglia, String l_seriale, long l_id_clifor) {
String s_Sql_Sum = " SUM(kg) as kg, SUM(mt) as mt, SUM(nr) as nr from MOVIMENTO AS A";
String s_Sql_colonne = "";
WcString wc = new WcString();
if (l_id_articolo != 0L) {
wc.addWc(" id_articolo = " + l_id_articolo);
s_Sql_colonne = String.valueOf(s_Sql_colonne) + " id_articolo,";
}
if (l_id_articoloVariante != 0L) {
wc.addWc(" id_articoloVariante = " + l_id_articoloVariante);
s_Sql_colonne = String.valueOf(s_Sql_colonne) + " id_articoloVariante,";
}
if (l_id_articoloTaglia != 0L) {
wc.addWc(" id_articoloTaglia = " + l_id_articoloTaglia);
s_Sql_colonne = String.valueOf(s_Sql_colonne) + " id_articoloTaglia,";
}
MagFisico mag = new MagFisico(getApFull());
StringBuilder mf = new StringBuilder("");
Vectumerator<MagFisico> vecMag = mag.findByTipo(1L);
if (vecMag.hasMoreElements())
while (vecMag.hasMoreElements()) {
mag = (MagFisico)vecMag.nextElement();
if (mf.length() > 0)
mf.append(" OR ");
mf.append(" id_magFisico = " + mag.getId_magFisico());
}
vecMag = mag.findByTipo(2L);
if (vecMag.hasMoreElements())
while (vecMag.hasMoreElements()) {
mag = (MagFisico)vecMag.nextElement();
if (mf.length() > 0)
mf.append(" OR ");
mf.append(" id_magFisico = " + mag.getId_magFisico());
}
if (mf.length() > 0) {
mf.append(")");
wc.addWc("(" + mf.toString());
s_Sql_colonne = String.valueOf(s_Sql_colonne) + " id_magFisico,";
}
if (l_seriale != null && !l_seriale.isEmpty()) {
wc.addWc(" seriale = '" + l_seriale + "'");
s_Sql_colonne = String.valueOf(s_Sql_colonne) + " seriale,";
}
if (l_id_clifor != 0L) {
wc.addWc(" id_clifor = " + l_id_clifor);
s_Sql_colonne = String.valueOf(s_Sql_colonne) + " id_clifor,";
}
String s_sql_groupby = "";
if (!s_Sql_colonne.isEmpty())
s_sql_groupby = " group by " + s_Sql_colonne.substring(0, s_Sql_colonne.length() - 1);
try {
PreparedStatement stmt = getConn()
.prepareStatement("select " + s_Sql_colonne + s_Sql_Sum + wc.toString() + s_sql_groupby);
findFirstRecord(stmt);
} catch (SQLException e) {
handleDebug(e);
}
}
public void findDisponibilitaGlobaleMagazziniInterniEsterni(long l_id_articolo, String l_seriale, long l_id_clifor) {
findDisponibilitaPuntualeMagazziniInterniEsterni(0L, 0L, 0L, l_seriale, l_id_clifor);
setId_articolo(l_id_articolo);
}
public String getCodiceArticolo() {
return getArticolo().getCodice();
}
public Vectumerator findByCRCompatto(MovimentoCR CR, int pageNumber, int pageRows) {
boolean flgOttimizzo = (getParm("OTTIMIZZO").getNumero() == 1.0D);
StringBuffer s_Sql_Find = new StringBuffer(
"select A.id_articolo, A.id_articoloVariante, A.id_articoloTaglia, sum(A.kg) as Kg,sum(A.mt) as mt, sum(A.nr) as nr, D.nome, D.codice from MOVIMENTO AS A, RIGA_DOCUMENTO AS B, DOCUMENTO AS C, ARTICOLO AS D ");
String s_Sql_Order = " order by D.nome,D.codice";
if (CR.getFlgOrderBy() == 1L)
s_Sql_Order = " order by C.dataDocumento asc, C.id_esercizio asc, C.progDocumento asc";
String s_Sql_groupby = " group by A.id_articolo";
WcString wc = new WcString();
findByCRCreateWC(CR, s_Sql_Find, wc);
try {
PreparedStatement stmt;
if ((pageNumber == 0 && pageRows == 0) || !flgOttimizzo) {
stmt = getConn().prepareStatement(s_Sql_Find + wc.toString() + s_Sql_groupby + s_Sql_Order);
} else {
if (pageNumber == 0)
pageNumber = 1;
int start = (pageNumber - 1) * pageRows;
int stop = start + pageRows;
stmt = getConn()
.prepareStatement(s_Sql_Find + wc.toString() + s_Sql_groupby + s_Sql_Order + " limit " + start + "," + stop);
}
findByCRCreateStmtDate(CR, stmt);
if ((pageNumber == 0 && pageRows == 0) || !flgOttimizzo)
return findRows(stmt, pageNumber, pageRows);
Vectumerator vec = findRows(stmt, 1, pageRows);
vec.setPageNumber(pageNumber);
vec.setTotNumberOfRecords(findByCRTotRecord(CR));
return vec;
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public void creaFileCvsCompatto(MovimentoCR CR) {
Vectumerator list = findByCRCompatto(CR, 0, 0);
CR.setFileName("tmpFile/movMagazzinoCompatto_" + CR.getId_users() + ".csv");
String theCvsFile = String.valueOf(getDocBase()) + CR.getFileName();
String SEP = ";";
new File(theCvsFile).delete();
FileWr outCvsFile = new FileWr(theCvsFile, false);
String s1 = "Cod. Articolo;Articolo;Tipo;Disp.Art.;Q.ta;Kg;Mt;Nr.";
outCvsFile.writeLine(CR.getDescrizioneCR());
outCvsFile.writeLine(s1);
while (list.hasMoreElements()) {
Movimento row = (Movimento)list.nextElement();
s1 = String.valueOf(row.getCodiceArticolo()) + SEP + row.getDescrizioneArticolo() + SEP +
row.getArticolo().getTipo().getDescrizioneCompleta() + SEP + getNf().format(row.getArticolo().getQuantita()) + SEP +
getNf().format(row.getQuantita()) + SEP + getNf().format(row.getKg()) + SEP + getNf().format(row.getMt()) + SEP +
getNf().format(row.getNr());
s1 = s1.replace("&euro;", "");
s1 = s1.replace("&raquo;", "-->");
outCvsFile.writeLine(s1);
}
outCvsFile.closeFile();
}
}

View file

@ -0,0 +1,463 @@
package com.ablia.contab;
import com.ablia.anag.Clifor;
import com.ablia.anag.MagFisico;
import com.ablia.art.Articolo;
import com.ablia.art.ArticoloTaglia;
import com.ablia.art.ArticoloVariante;
import com.ablia.art.Marca;
import com.ablia.art.Tipo;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import com.ablia.util.SimpleDateFormat;
import java.io.Serializable;
import java.sql.Date;
public class MovimentoCR extends CRAdapter implements Serializable {
private static final long serialVersionUID = -4078728447478246886L;
public static final int TIPO_REPORT_STD = 0;
public static final int TIPO_REPORT_COMPATTO = 1;
private long id_movimento;
private long id_rigaDocumento;
private long id_articolo;
private long id_articoloVariante;
private long id_articoloTaglia;
private long id_magFisico;
private long id_clifor;
private String seriale;
private double kg;
private double mt;
private double nr;
private RigaDocumento rigaDocumento;
private Articolo articolo;
private ArticoloVariante articoloVariante;
private ArticoloTaglia articoloTaglia;
private MagFisico magFisico;
private Clifor clifor;
private long flgInMagazzino = -1L;
private long flgTipoMagazzino;
private CausaleMagazzino causaleMagazzino;
private long id_causaleMagazzino;
private Date dataDocumentoA;
private Date dataDocumentoDa;
private String descrizioneCompletaArticolo;
private long id_tipoDocumento;
private long id_documento;
private long id_documento2;
private Date dataRiferimentoA;
private Date dataRiferimentoDa;
private long id_esercizio = -1L;
private String fileName;
private long id_marca;
private long id_tipo;
private Tipo tipo;
private Marca marca;
private TipoDocumento tipoDocumento;
public static final long IN_MAGAZZINO = 1L;
public static final long MAGAZZINO_NEGATIVO = 2L;
public static final long IN_MAGAZZINO_O_NEGATIVO = 3L;
public MovimentoCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public MovimentoCR() {}
public long getId_movimento() {
return this.id_movimento;
}
public void setId_movimento(long id_movimento) {
this.id_movimento = id_movimento;
}
public long getId_rigaDocumento() {
return this.id_rigaDocumento;
}
public void setId_rigaDocumento(long id_rigaDocumento) {
this.id_rigaDocumento = id_rigaDocumento;
}
public long getId_articolo() {
return this.id_articolo;
}
public void setId_articolo(long id_articolo) {
this.id_articolo = id_articolo;
}
public long getId_articoloVariante() {
return this.id_articoloVariante;
}
public void setId_articoloVariante(long id_articoloVariante) {
this.id_articoloVariante = id_articoloVariante;
}
public long getId_articoloTaglia() {
return this.id_articoloTaglia;
}
public void setId_articoloTaglia(long id_articoloTaglia) {
this.id_articoloTaglia = id_articoloTaglia;
}
public long getId_magFisico() {
return this.id_magFisico;
}
public void setId_magFisico(long id_magFisico) {
this.id_magFisico = id_magFisico;
setMagFisico(null);
}
public void setId_clifor(long id_clifor) {
this.id_clifor = id_clifor;
}
public String getSeriale() {
return (this.seriale == null) ? "" : this.seriale.trim();
}
public void setSeriale(String seriale) {
this.seriale = seriale;
}
public double getKg() {
return this.kg;
}
public void setKg(double kg) {
this.kg = kg;
}
public double getMt() {
return this.mt;
}
public void setMt(double mt) {
this.mt = mt;
}
public double getNr() {
return this.nr;
}
public void setNr(double nr) {
this.nr = nr;
}
public RigaDocumento getRigaDocumento() {
return this.rigaDocumento;
}
public void setRigaDocumento(RigaDocumento rigaDocumento) {
this.rigaDocumento = rigaDocumento;
}
public Articolo getArticolo() {
this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, getId_articolo());
return this.articolo;
}
public void setArticolo(Articolo articolo) {
this.articolo = articolo;
}
public ArticoloVariante getArticoloVariante() {
this.articoloVariante = (ArticoloVariante)getSecondaryObject(this.articoloVariante, ArticoloVariante.class, getId_articoloVariante());
return this.articoloVariante;
}
public void setArticoloVariante(ArticoloVariante articoloVariante) {
this.articoloVariante = articoloVariante;
}
public ArticoloTaglia getArticoloTaglia() {
return this.articoloTaglia;
}
public void setArticoloTaglia(ArticoloTaglia articoloTaglia) {
this.articoloTaglia = articoloTaglia;
}
public MagFisico getMagFisico() {
this.magFisico = (MagFisico)getSecondaryObject(this.magFisico, MagFisico.class, getId_magFisico());
return this.magFisico;
}
public void setMagFisico(MagFisico magFisico) {
this.magFisico = magFisico;
}
public Clifor getClifor() {
this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor());
return this.clifor;
}
public void setClifor(Clifor clifor) {
this.clifor = clifor;
}
public long getFlgInMagazzino() {
return this.flgInMagazzino;
}
public void setFlgInMagazzino(long flgInMagazzino) {
this.flgInMagazzino = flgInMagazzino;
}
public long getFlgTipoMagazzino() {
return this.flgTipoMagazzino;
}
public void setFlgTipoMagazzino(long flgTipoMagazzino) {
this.flgTipoMagazzino = flgTipoMagazzino;
}
public CausaleMagazzino getCausaleMagazzino() {
this.causaleMagazzino = (CausaleMagazzino)getSecondaryObject(this.causaleMagazzino, CausaleMagazzino.class, getId_causaleMagazzino());
return this.causaleMagazzino;
}
public long getId_causaleMagazzino() {
return this.id_causaleMagazzino;
}
public void setCausaleMagazzino(CausaleMagazzino causaleMagazzino) {
this.causaleMagazzino = causaleMagazzino;
}
public void setId_causaleMagazzino(long id_causaleMagazzino) {
this.id_causaleMagazzino = id_causaleMagazzino;
}
public Date getDataDocumentoA() {
return this.dataDocumentoA;
}
public void setDataDocumentoA(Date dataDocumentoA) {
this.dataDocumentoA = dataDocumentoA;
}
public Date getDataDocumentoDa() {
return this.dataDocumentoDa;
}
public void setDataDocumentoDa(Date dataDocumentoDa) {
this.dataDocumentoDa = dataDocumentoDa;
}
public String getDescrizioneCompletaArticolo() {
if (getId_articoloVariante() != 0L)
return getArticoloVariante().getDescrizioneCompleta();
if (getId_articolo() != 0L)
return getArticolo().getDescrizioneCompleta();
return (this.descrizioneCompletaArticolo == null) ? "" : this.descrizioneCompletaArticolo.trim();
}
public long getId_tipoDocumento() {
return this.id_tipoDocumento;
}
public void setId_tipoDocumento(long id_tipoDocumento) {
this.id_tipoDocumento = id_tipoDocumento;
setTipoDocumento(null);
}
public long getId_documento() {
return this.id_documento;
}
public void setId_documento(long id_documento) {
this.id_documento = id_documento;
}
public long getId_documento2() {
return this.id_documento2;
}
public void setId_documento2(long id_documento2) {
this.id_documento2 = id_documento2;
}
public long getId_clifor() {
return this.id_clifor;
}
public Date getDataRiferimentoA() {
return this.dataRiferimentoA;
}
public void setDataRiferimentoA(Date dataRiferimentoA) {
this.dataRiferimentoA = dataRiferimentoA;
}
public Date getDataRiferimentoDa() {
return this.dataRiferimentoDa;
}
public void setDataRiferimentoDa(Date dataRiferimentoDa) {
this.dataRiferimentoDa = dataRiferimentoDa;
}
public long getId_esercizio() {
return this.id_esercizio;
}
public void setId_esercizio(long id_esercizio) {
this.id_esercizio = id_esercizio;
}
public String getFileName() {
return this.fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public long getId_marca() {
return this.id_marca;
}
public long getId_tipo() {
return this.id_tipo;
}
public Tipo getTipo() {
this.tipo = (Tipo)getSecondaryObject(this.tipo, Tipo.class, getId_tipo());
return this.tipo;
}
public void setId_marca(long newId_marca) {
this.id_marca = newId_marca;
setMarca(null);
}
public void setId_tipo(long id_tipo) {
this.id_tipo = id_tipo;
setTipo(null);
}
public Marca getMarca() {
return (Marca)getSecondaryObject(this.marca, Marca.class, new Long(getId_marca()));
}
public void setMarca(Marca newMarca) {
this.marca = newMarca;
}
public void setTipo(Tipo tipo) {
this.tipo = tipo;
}
public String getTipoReport(long l_flgTipoReport) {
switch ((int)l_flgTipoReport) {
case 0:
return "Standard";
case 1:
return "Compatto";
}
return "??";
}
public String getDescrizioneCR() {
StringBuilder temp = new StringBuilder();
SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
if (!getSearchTxt().isEmpty())
temp.append("Descrizione: " + getSearchTxt() + " - ");
if (getId_esercizio() != 0L)
temp.append("Anno: " + getId_esercizio() + " - ");
if (getDataDocumentoDa() != null && getDataDocumentoA() != null) {
temp.append("Data Documento: dal " + df.format(getDataDocumentoDa()) + " al " + df.format(getDataDocumentoA()) + " - ");
} else {
if (getDataDocumentoDa() != null)
temp.append("Data Documento: dal " + df.format(getDataDocumentoDa()) + " - ");
if (getDataDocumentoA() != null)
temp.append("Data Documento: al " + df.format(getDataDocumentoA()) + " - ");
}
if (getFlgInMagazzino() >= 0L) {
temp.append(" - In Magazzino:");
if (getFlgInMagazzino() == 0L)
temp.append(" NO");
if (getFlgInMagazzino() == 1L)
temp.append(" SI");
if (getFlgInMagazzino() == 2L)
temp.append(" negativo");
temp.append(" - ");
}
if (getId_magFisico() != 0L)
temp.append("Magazzino: " + getMagFisico().getDescrizione() + " - ");
if (getId_tipoDocumento() != 0L)
temp.append("Tipo Documento: " + getTipoDocumento().getDescrizioneCompleta() + " - ");
if (getId_articolo() != 0L)
temp.append("Articolo: " + getDescrizioneCompletaArticolo() + " - ");
if (getId_articoloVariante() != 0L)
temp.append("Variante: " + getArticoloVariante().getDescrizione() + " - ");
if (!getSeriale().isEmpty())
temp.append("Seriale: " + getSeriale() + " - ");
if (getId_tipo() != 0L)
temp.append("Tipo: " + getTipo().getDescrizioneCompleta() + " - ");
if (getDataRiferimentoDa() != null && getDataRiferimentoA() != null) {
temp.append("Data Riferimento: dal " + df.format(getDataRiferimentoDa()) + " al " + df.format(getDataRiferimentoA()) + " - ");
} else {
if (getDataRiferimentoDa() != null)
temp.append("Data Riferimento: dal " + df.format(getDataRiferimentoDa()) + " - ");
if (getDataRiferimentoA() != null)
temp.append("Data Riferimento: al " + df.format(getDataRiferimentoA()) + " - ");
}
return temp.toString();
}
public TipoDocumento getTipoDocumento() {
this.tipoDocumento = (TipoDocumento)getSecondaryObject(this.tipoDocumento, TipoDocumento.class, getId_tipoDocumento());
return this.tipoDocumento;
}
public void setTipoDocumento(TipoDocumento tipoDocumento) {
this.tipoDocumento = tipoDocumento;
}
}

View file

@ -0,0 +1,187 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.DBAdapter;
import com.ablia.db.DBAdapterException;
import com.ablia.db.ResParm;
import com.ablia.db.WcString;
import com.ablia.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class PianoConti extends DBAdapter implements Serializable {
private static final long serialVersionUID = 8044331984020899695L;
private long id_pianoConti;
private String contoCompleto;
private String descrizione;
private long flgTipo;
private long flgCFBI;
private long flgMovimentabile;
private String mastro;
private String conto;
private String sottoconto;
private static final long TIPO_ECONOMICO = 0L;
private static final long TIPO_PATRIMONIALE = 1L;
private static final long CFBI_NESSUNO = 0L;
private static final long CFBI_CLIENTE = 1L;
private static final long CFBI_FORNITORE = 2L;
private static final long CFBI_BANCA = 3L;
private static final long CFBI_IVA = 4L;
public PianoConti(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public PianoConti() {}
public long getId_pianoConti() {
return this.id_pianoConti;
}
public void setId_pianoConti(long id_incassoPagamento) {
this.id_pianoConti = id_incassoPagamento;
}
public String getConto() {
return (this.conto == null) ? "" : this.conto;
}
public void setConto(String conto) {
this.conto = conto;
}
public Vectumerator<PianoConti> findByCR(PianoContiCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from PIANO_CONTI AS A";
String s_Sql_Order = " ORDER BY contoCompleto ";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty())
wc.addWc(" A.Descrizione like '%" + CR.getSearchTxt() + "%'");
if (CR.getFlgMovimentabile() == 1L)
wc.addWc(" A.flgMovimentabile = 1 ");
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
protected void deleteCascade() {}
protected ResParm checkDeleteCascade() throws DBAdapterException, SQLException {
return null;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione;
}
public void setDescrizione(String descrizione) {
this.descrizione = descrizione;
}
public long getFlgTipo() {
return this.flgTipo;
}
public void setFlgTipo(long flgTipo) {
this.flgTipo = flgTipo;
}
public long getFlgCFBI() {
return this.flgCFBI;
}
public void setFlgCFBI(long flgCFBI) {
this.flgCFBI = flgCFBI;
}
public long getFlgMovimentabile() {
return this.flgMovimentabile;
}
public void setFlgMovimentabile(long flgMovimentabile) {
this.flgMovimentabile = flgMovimentabile;
}
public String getDescrizioneTipo() {
return getDescrizioneTipo(getFlgTipo());
}
public String getDescrizioneTipo(long flgTipo) {
String ret = "";
if (flgTipo == 0L) {
ret = "Economico";
} else if (flgTipo == 1L) {
ret = "Patrimoniale";
}
return ret;
}
public String getDescrizioneCFBI() {
return getDescrizioneCFBI(getFlgCFBI());
}
public String getDescrizioneCFBI(long flgCFBI) {
String ret = "";
if (flgCFBI == 0L) {
ret = "Nessuno";
} else if (flgCFBI == 1L) {
ret = "Cliente";
} else if (flgCFBI == 2L) {
ret = "Fornitore";
} else if (flgCFBI == 3L) {
ret = "Banca";
} else if (flgCFBI == 4L) {
ret = "Iva";
}
return ret;
}
public String getContoCompleto() {
return (this.contoCompleto == null) ? "" : this.contoCompleto;
}
public void setContoCompleto(String contoCompleto) {
this.contoCompleto = contoCompleto;
}
public String getMastro() {
return (this.mastro == null) ? "" : this.mastro;
}
public void setMastro(String mastro) {
this.mastro = mastro;
}
public String getSottoconto() {
return (this.sottoconto == null) ? "" : this.sottoconto;
}
public void setSottoconto(String sottoconto) {
this.sottoconto = sottoconto;
}
protected void prepareSave(PreparedStatement ps) throws Exception {
setContoCompleto(String.valueOf(getMastro()) + getConto() + getSottoconto());
super.prepareSave(ps);
}
}

View file

@ -0,0 +1,75 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import java.io.Serializable;
public class PianoContiCR extends CRAdapter implements Serializable {
private static final long serialVersionUID = 8044331984020899695L;
private long id_pianoConti;
private String conto;
private String descrizione;
private long flgTipo;
private long flgCFBI;
private long flgMovimentabile;
public PianoContiCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public PianoContiCR() {}
public long getId_pianoConti() {
return this.id_pianoConti;
}
public void setId_pianoConti(long id_incassoPagamento) {
this.id_pianoConti = id_incassoPagamento;
}
public String getConto() {
return (this.conto == null) ? "" : this.conto;
}
public void setConto(String conto) {
this.conto = conto;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione;
}
public void setDescrizione(String descrizione) {
this.descrizione = descrizione;
}
public long getFlgTipo() {
return this.flgTipo;
}
public void setFlgTipo(long flgTipo) {
this.flgTipo = flgTipo;
}
public long getFlgCFBI() {
return this.flgCFBI;
}
public void setFlgCFBI(long flgCFBI) {
this.flgCFBI = flgCFBI;
}
public long getFlgMovimentabile() {
return this.flgMovimentabile;
}
public void setFlgMovimentabile(long flgMovimentabile) {
this.flgMovimentabile = flgMovimentabile;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,114 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import java.sql.Date;
public class RegistroIvaCR extends CRAdapter {
private long id_registroIva;
private long anno;
private Date dataUltimaStampa;
private long ultimaPagina;
private String flgTipoRegistro;
private long ultimaRiga;
private long flgTipoLiquidazione;
private long flgMeseStampato;
private long flgAnnoStampato;
private long flgTrimestreStampato;
public RegistroIvaCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public RegistroIvaCR() {}
public void setId_registroIva(long newId_registroIva) {
this.id_registroIva = newId_registroIva;
}
public void setAnno(long newAnno) {
this.anno = newAnno;
}
public void setDataUltimaStampa(Date newDataUltimaStampa) {
this.dataUltimaStampa = newDataUltimaStampa;
}
public void setUltimaPagina(long newUltimaPagina) {
this.ultimaPagina = newUltimaPagina;
}
public void setFlgTipoRegistro(String newFlgTipoRegistro) {
this.flgTipoRegistro = newFlgTipoRegistro;
}
public void setUltimaRiga(long newUltimaRiga) {
this.ultimaRiga = newUltimaRiga;
}
public void setFlgTipoLiquidazione(long newFlgTipoLiquidazione) {
this.flgTipoLiquidazione = newFlgTipoLiquidazione;
}
public void setFlgMeseStampato(long newFlgMeseStampato) {
this.flgMeseStampato = newFlgMeseStampato;
}
public void setFlgAnnoStampato(long newFlgAnnoStampato) {
this.flgAnnoStampato = newFlgAnnoStampato;
}
public void setFlgTrimestreStampato(long newFlgTrimestreStampato) {
this.flgTrimestreStampato = newFlgTrimestreStampato;
}
public long getId_registroIva() {
return this.id_registroIva;
}
public long getAnno() {
return this.anno;
}
public Date getDataUltimaStampa() {
return this.dataUltimaStampa;
}
public long getUltimaPagina() {
return this.ultimaPagina;
}
public String getFlgTipoRegistro() {
return (this.flgTipoRegistro == null) ? "" :
this.flgTipoRegistro.trim();
}
public long getUltimaRiga() {
return this.ultimaRiga;
}
public long getFlgTipoLiquidazione() {
return this.flgTipoLiquidazione;
}
public long getFlgMeseStampato() {
return this.flgMeseStampato;
}
public long getFlgAnnoStampato() {
return this.flgAnnoStampato;
}
public long getFlgTrimestreStampato() {
return this.flgTrimestreStampato;
}
}

View file

@ -0,0 +1,149 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.DBAdapter;
import com.ablia.db.DBAdapterException;
import com.ablia.db.ResParm;
import com.ablia.db.WcString;
import com.ablia.util.StringTokenizer;
import com.ablia.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class RigaCausaleContabile extends DBAdapter implements Serializable {
private static final long serialVersionUID = 3474479017832499327L;
private long id_rigaCausaleContabile;
private long id_causaleContabile;
private long id_pianoConti;
private long flgDA;
private CausaleContabile causaleContabile;
private PianoConti pianoConti;
public static final long DARE = 0L;
public static final long AVERE = 1L;
public RigaCausaleContabile(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public RigaCausaleContabile() {}
public long getId_causaleContabile() {
return this.id_causaleContabile;
}
public void setId_causaleContabile(long id_incassoPagamento) {
this.id_causaleContabile = id_incassoPagamento;
setCausaleContabile(null);
}
public Vectumerator<RigaCausaleContabile> findByCR(RigaCausaleContabileCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from RIGA_CAUSALE_CONTABILE AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public Vectumerator<RigaCausaleContabile> findByCausaleContabile(long id_causaleContabile) {
String s_Sql_Find = "select DISTINCT A.* from RIGA_CAUSALE_CONTABILE AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.id_causaleContabile = " + id_causaleContabile);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
protected void deleteCascade() {}
protected ResParm checkDeleteCascade() throws DBAdapterException, SQLException {
return new ResParm(true);
}
public long getId_rigaCausaleContabile() {
return this.id_rigaCausaleContabile;
}
public void setId_rigaCausaleContabile(long id_rigaCausaleContabile) {
this.id_rigaCausaleContabile = id_rigaCausaleContabile;
}
public long getId_pianoConti() {
return this.id_pianoConti;
}
public void setId_pianoConti(long id_pianoConti) {
this.id_pianoConti = id_pianoConti;
setPianoConti(null);
}
public long getFlgDA() {
return this.flgDA;
}
public void setFlgDA(long flgDA) {
this.flgDA = flgDA;
}
public CausaleContabile getCausaleContabile() {
this.causaleContabile = (CausaleContabile)getSecondaryObject(this.causaleContabile, CausaleContabile.class, getId_causaleContabile());
return this.causaleContabile;
}
public void setCausaleContabile(CausaleContabile causaleContabile) {
this.causaleContabile = causaleContabile;
}
public PianoConti getPianoConti() {
this.pianoConti = (PianoConti)getSecondaryObject(this.pianoConti, PianoConti.class, getId_pianoConti());
return this.pianoConti;
}
public void setPianoConti(PianoConti pianoConti) {
this.pianoConti = pianoConti;
}
public String getDescrizioneDA() {
return getDescrizioneDA(getFlgDA());
}
public String getDescrizioneDA(long flgDA) {
String ret = "";
if (flgDA == 0L) {
ret = "Dare";
} else if (flgDA == 1L) {
ret = "Avere";
}
return ret;
}
}

View file

@ -0,0 +1,55 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import java.io.Serializable;
public class RigaCausaleContabileCR extends CRAdapter implements Serializable {
private static final long serialVersionUID = 5861166998559498673L;
private long id_rigaCausaleContabile;
private long id_causaleContabile;
private long id_pianoConti;
private long flgDA;
public RigaCausaleContabileCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public RigaCausaleContabileCR() {}
public long getId_causaleContabile() {
return this.id_causaleContabile;
}
public void setId_causaleContabile(long id_incassoPagamento) {
this.id_causaleContabile = id_incassoPagamento;
}
public long getId_rigaCausaleContabile() {
return this.id_rigaCausaleContabile;
}
public void setId_rigaCausaleContabile(long id_rigaCausaleContabile) {
this.id_rigaCausaleContabile = id_rigaCausaleContabile;
}
public long getId_pianoConti() {
return this.id_pianoConti;
}
public void setId_pianoConti(long id_pianoConti) {
this.id_pianoConti = id_pianoConti;
}
public long getFlgDA() {
return this.flgDA;
}
public void setFlgDA(long flgDA) {
this.flgDA = flgDA;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,708 @@
package com.ablia.contab;
import com.ablia.anag.Clifor;
import com.ablia.anag.Iva;
import com.ablia.anag.MagFisico;
import com.ablia.art.Articolo;
import com.ablia.art.ArticoloVariante;
import com.ablia.art.Marca;
import com.ablia.art.Taglia;
import com.ablia.art.Tipo;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import java.sql.Date;
public class RigaDocumentoCR extends CRAdapter {
public static long RICERCA_SOLO_MAGAZZINO = 2L;
public static long RICERCA_SOLO_RIGHE_DOC = 1L;
private long id_rigaDocumento;
private long id_documento;
private long id_articolo;
private long id_articoloVariante;
private long id_iva;
private long id_magFisico;
private long id_taglia;
private String descrizioneCodiceRiga;
private double imponibile;
private long flgTipoRicerca = 1L;
private String quantita;
private String codiceCartellinoIniziale;
private String noteRiga;
private Documento documento;
private Articolo articolo;
private ArticoloVariante articoloVariante;
private Iva iva;
private MagFisico magFisico;
private Taglia taglia;
private Date dataDocumentoA;
private Date dataDocumentoDa;
private long flgStato = 1L;
private long id_clifor;
private long id_esercizio;
private long id_tipoDocumento;
private long progDocumento;
private Clifor clifor;
private String seriale;
private long flgUdm;
private long flgStatoPrenotazione = -1L;
private long flgRigaPrelevata = -1L;
private String testoMessaggio;
private long flgTipoMovimento = 0L;
private String fileName;
private long id_tipo;
private Tipo tipo;
private Date dataRiferimentoDa;
private Date dataRiferimentoA;
private boolean flgRicercaNonOrdinati = false;
private long flgArticoliConQuantita;
private long flgTipologia;
private long id_marca;
private Marca marca;
private long flgRicercaMag = RICERCA_SOLO_RIGHE_DOC;
private long flgInMagazzino = -1L;
private long flgTipoMagazzino;
private long id_articoloFilato;
private long id_articoloTaglia;
private double percL1;
private double percL2;
private double percL3;
private String riferimento;
private long flgStatoLavorazioneRiga = -2L;
private long flgStatoLavorazione = -2L;
private String descrizioneRiga;
private long id_tipologiaDocumento;
private long id_tipoStampaDocumento;
private TipologiaDocumento tipologiaDocumento;
private TipoStampaDocumento tipoStampaDocumento;
private long flgNoSeriale;
private long flgCodiceRiga = 0L;
private long flgDaCancellare = -1L;
public static final long IN_MAGAZZINO = 1L;
public static final long IN_MAGAZZINO_O_NEGATIVO = 3L;
public static final long MAGAZZINO_NEGATIVO = 2L;
public static final long ORDER_BY_TIPO_ARTICOLO = 9L;
public static final long TIPO_RICERCA_NORMALE = 0L;
public static final long ORDER_BY_DATA_DOC_ASC = 5L;
public static final long TIPO_RICERCA_COMPATTA = 1L;
public RigaDocumentoCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public RigaDocumentoCR() {}
public void setId_rigaDocumento(long newId_rigaDocumento) {
this.id_rigaDocumento = newId_rigaDocumento;
}
public void setId_documento(long newId_documento) {
this.id_documento = newId_documento;
setDocumento(null);
}
public void setId_articolo(long newId_articolo) {
this.id_articolo = newId_articolo;
setArticolo(null);
}
public void setId_articoloVariante(long newId_articoloVariante) {
this.id_articoloVariante = newId_articoloVariante;
setArticoloVariante(null);
}
public void setId_iva(long newId_iva) {
this.id_iva = newId_iva;
setIva(null);
}
public void setId_magFisico(long newId_magFisico) {
this.id_magFisico = newId_magFisico;
setMagFisico(null);
}
public void setId_taglia(long newId_taglia) {
this.id_taglia = newId_taglia;
setTaglia(null);
}
public void setSeriale(String newSeriale) {
this.seriale = newSeriale;
}
public void setImponibile(double newImponibile) {
this.imponibile = newImponibile;
}
public void setFlgUdm(long newFlgUdm) {
this.flgUdm = newFlgUdm;
}
public void setQuantita(String newQuantita) {
this.quantita = newQuantita;
}
public void setDescrizioneRiga(String newDescrizioneRiga) {
this.descrizioneRiga = newDescrizioneRiga;
}
public void setNoteRiga(String newNoteRiga) {
this.noteRiga = newNoteRiga;
}
public long getId_rigaDocumento() {
return this.id_rigaDocumento;
}
public long getId_documento() {
return this.id_documento;
}
public long getId_articolo() {
return this.id_articolo;
}
public long getId_articoloVariante() {
return this.id_articoloVariante;
}
public long getId_iva() {
return this.id_iva;
}
public long getId_magFisico() {
return this.id_magFisico;
}
public long getId_taglia() {
return this.id_taglia;
}
public String getSeriale() {
return (this.seriale == null) ? "" : this.seriale.trim();
}
public double getImponibile() {
return this.imponibile;
}
public long getFlgUdm() {
return this.flgUdm;
}
public String getQuantita() {
return (this.quantita == null) ? "" : this.quantita.trim();
}
public String getDescrizioneRiga() {
return (this.descrizioneRiga == null) ? "" : this.descrizioneRiga.trim();
}
public String getNoteRiga() {
return (this.noteRiga == null) ? "" : this.noteRiga.trim();
}
public void setDocumento(Documento newDocumento) {
this.documento = newDocumento;
}
public Documento getDocumento() {
this.documento = (Documento)getSecondaryObject(this.documento, Documento.class, getId_documento());
return this.documento;
}
public void setArticolo(Articolo newArticolo) {
this.articolo = newArticolo;
}
public Articolo getArticolo() {
this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, getId_articolo());
return this.articolo;
}
public void setArticoloVariante(ArticoloVariante newArticoloVariante) {
this.articoloVariante = newArticoloVariante;
}
public ArticoloVariante getArticoloVariante() {
this.articoloVariante = (ArticoloVariante)getSecondaryObject(this.articoloVariante, ArticoloVariante.class, getId_articoloVariante());
return this.articoloVariante;
}
public void setIva(Iva newIva) {
this.iva = newIva;
}
public Iva getIva() {
this.iva = (Iva)getSecondaryObject(this.iva, Iva.class, getId_iva());
return this.iva;
}
public void setMagFisico(MagFisico newMagFisico) {
this.magFisico = newMagFisico;
}
public MagFisico getMagFisico() {
this.magFisico = (MagFisico)getSecondaryObject(this.magFisico, MagFisico.class, getId_magFisico());
return this.magFisico;
}
public void setTaglia(Taglia newTaglia) {
this.taglia = newTaglia;
}
public Taglia getTaglia() {
this.taglia = (Taglia)getSecondaryObject(this.taglia, Taglia.class, getId_taglia());
return this.taglia;
}
public Date getDataDocumentoDa() {
return this.dataDocumentoDa;
}
public void setDataDocumentoDa(Date dataDocumentoDa) {
this.dataDocumentoDa = dataDocumentoDa;
}
public Date getDataDocumentoA() {
return this.dataDocumentoA;
}
public void setDataDocumentoA(Date dataDocumentoA) {
this.dataDocumentoA = dataDocumentoA;
}
public long getFlgStato() {
return this.flgStato;
}
public void setFlgStato(long flgStato) {
this.flgStato = flgStato;
}
public long getId_clifor() {
return this.id_clifor;
}
public void setId_clifor(long id_clifor) {
this.id_clifor = id_clifor;
setClifor(null);
}
public long getId_esercizio() {
return this.id_esercizio;
}
public void setId_esercizio(long id_esercizio) {
this.id_esercizio = id_esercizio;
}
public long getId_tipoDocumento() {
return this.id_tipoDocumento;
}
public void setId_tipoDocumento(long id_tipoDocumento) {
this.id_tipoDocumento = id_tipoDocumento;
}
public long getProgDocumento() {
return this.progDocumento;
}
public void setProgDocumento(long progDocumento) {
this.progDocumento = progDocumento;
}
public Clifor getClifor() {
this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor());
return this.clifor;
}
public void setClifor(Clifor clifor) {
this.clifor = clifor;
}
public String getDescrizioneCompletaArticolo() {
if (getId_articoloVariante() != 0L)
return getArticoloVariante().getDescrizioneCompleta();
return getArticolo().getDescrizioneCompleta();
}
public static final String getStato(long l_flgStato) {
return DocumentoCR.getStato(l_flgStato);
}
public long getFlgTipoRicerca() {
return this.flgTipoRicerca;
}
public void setFlgTipoRicerca(long flgTipoRicerca) {
this.flgTipoRicerca = flgTipoRicerca;
}
public long getFlgStatoPrenotazione() {
return this.flgStatoPrenotazione;
}
public void setFlgStatoPrenotazione(long flgStatoPrenotazione) {
this.flgStatoPrenotazione = flgStatoPrenotazione;
}
public long getFlgRigaPrelevata() {
return this.flgRigaPrelevata;
}
public void setFlgRigaPrelevata(long flgRigaPrelevata) {
this.flgRigaPrelevata = flgRigaPrelevata;
}
public String getTestoMessaggio() {
return (this.testoMessaggio == null) ? "" : this.testoMessaggio.trim();
}
public void setTestoMessaggio(String messaggioSms) {
this.testoMessaggio = messaggioSms;
}
public long getFlgTipoMovimento() {
return this.flgTipoMovimento;
}
public void setFlgTipoMovimento(long flgTipoMovimento) {
this.flgTipoMovimento = flgTipoMovimento;
}
public String getFileName() {
return (this.fileName == null) ? "" : this.fileName.trim();
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public long getId_tipo() {
return this.id_tipo;
}
public void setId_tipo(long id_tipo) {
this.id_tipo = id_tipo;
setTipo(null);
}
public Tipo getTipo() {
this.tipo = (Tipo)getSecondaryObject(this.tipo, Tipo.class, getId_tipo());
return this.tipo;
}
public void setTipo(Tipo tipo) {
this.tipo = tipo;
}
public Date getDataRiferimentoDa() {
return this.dataRiferimentoDa;
}
public void setDataRiferimentoDa(Date dataRiferimentoDa) {
this.dataRiferimentoDa = dataRiferimentoDa;
}
public Date getDataRiferimentoA() {
return this.dataRiferimentoA;
}
public void setDataRiferimentoA(Date dataRiferimentoA) {
this.dataRiferimentoA = dataRiferimentoA;
}
public boolean getFlgRicercaNonOrdinati() {
return this.flgRicercaNonOrdinati;
}
public void setFlgRicercaNonOrdinati(boolean flgRicercaNonOrdinati) {
this.flgRicercaNonOrdinati = flgRicercaNonOrdinati;
}
public long getFlgArticoliConQuantita() {
return this.flgArticoliConQuantita;
}
public void setFlgArticoliConQuantita(long flgArticoliConQuantita) {
this.flgArticoliConQuantita = flgArticoliConQuantita;
}
public long getFlgNoSeriale() {
return this.flgNoSeriale;
}
public void setFlgNoSeriale(long flgNoSeriale) {
this.flgNoSeriale = flgNoSeriale;
}
public long getId_marca() {
return this.id_marca;
}
public Marca getMarca() {
return (Marca)getSecondaryObject(this.marca, Marca.class, new Long(getId_marca()));
}
public void setId_marca(long newId_marca) {
this.id_marca = newId_marca;
setMarca(null);
}
public void setMarca(Marca newMarca) {
this.marca = newMarca;
}
public long getFlgRicercaMag() {
return this.flgRicercaMag;
}
public void setFlgRicercaMag(long flgRicercaMag) {
this.flgRicercaMag = flgRicercaMag;
}
public long getFlgInMagazzino() {
return this.flgInMagazzino;
}
public void setFlgInMagazzino(long flgInMagazzino) {
this.flgInMagazzino = flgInMagazzino;
}
public long getFlgTipoMagazzino() {
return this.flgTipoMagazzino;
}
public void setFlgTipoMagazzino(long flgTipoMagazzino) {
this.flgTipoMagazzino = flgTipoMagazzino;
}
public long getId_articoloFilato() {
return this.id_articoloFilato;
}
public void setId_articoloFilato(long id_articoloFilato) {
this.id_articoloFilato = id_articoloFilato;
}
public long getId_articoloTaglia() {
return this.id_articoloTaglia;
}
public void setId_articoloTaglia(long id_articoloTaglia) {
this.id_articoloTaglia = id_articoloTaglia;
}
public double getPercL1() {
return this.percL1;
}
public double getPercL2() {
return this.percL2;
}
public double getPercL3() {
return this.percL3;
}
public void setPercL1(double percL1) {
this.percL1 = percL1;
}
public void setPercL2(double percL2) {
this.percL2 = percL2;
}
public void setPercL3(double percL3) {
this.percL3 = percL3;
}
public String getRiferimento() {
return (this.riferimento == null) ? "" : this.riferimento.trim();
}
public void setRiferimento(String riferimento) {
this.riferimento = riferimento;
}
public String getDescrizioneCodiceRiga() {
return (this.descrizioneCodiceRiga == null) ? "" : this.descrizioneCodiceRiga.trim();
}
public void setDescrizioneCodiceRiga(String descrizioneCodiceRiga) {
this.descrizioneCodiceRiga = descrizioneCodiceRiga;
}
public long getFlgStatoLavorazioneRiga() {
return this.flgStatoLavorazioneRiga;
}
public void setFlgStatoLavorazioneRiga(long flgStatoLavorazione) {
this.flgStatoLavorazioneRiga = flgStatoLavorazione;
}
public static final String getStatoLavorazione(long l_flgStatoLavorazione) {
return Documento.getStatoLavorazione(l_flgStatoLavorazione);
}
public String getStatoLavorazione() {
return Documento.getStatoLavorazione(getFlgStatoLavorazioneRiga());
}
public String getCodiceCartellinoIniziale() {
return (this.codiceCartellinoIniziale == null) ? "" : this.codiceCartellinoIniziale.trim();
}
public void setCodiceCartellinoIniziale(String codiceCartellinoIniziale) {
this.codiceCartellinoIniziale = codiceCartellinoIniziale;
}
public long getId_tipologiaDocumento() {
return this.id_tipologiaDocumento;
}
public long getId_tipoStampaDocumento() {
return this.id_tipoStampaDocumento;
}
public TipologiaDocumento getTipologiaDocumento() {
this.tipologiaDocumento = (TipologiaDocumento)getSecondaryObject(this.tipologiaDocumento, TipologiaDocumento.class,
getId_tipologiaDocumento());
return this.tipologiaDocumento;
}
public TipoStampaDocumento getTipoStampaDocumento() {
this.tipoStampaDocumento = (TipoStampaDocumento)getSecondaryObject(this.tipoStampaDocumento, TipoStampaDocumento.class,
getId_tipoStampaDocumento());
return this.tipoStampaDocumento;
}
public void setId_tipologiaDocumento(long newId_tipologiaDocumento) {
this.id_tipologiaDocumento = newId_tipologiaDocumento;
setTipologiaDocumento(null);
}
public void setId_tipoStampaDocumento(long newId_tipoStampaDocumento) {
this.id_tipoStampaDocumento = newId_tipoStampaDocumento;
setTipoStampaDocumento(null);
}
public void setTipologiaDocumento(TipologiaDocumento newTipologiaDocumento) {
this.tipologiaDocumento = newTipologiaDocumento;
}
public void setTipoStampaDocumento(TipoStampaDocumento newTipoStampaDocumento) {
this.tipoStampaDocumento = newTipoStampaDocumento;
}
public long getFlgTipologia() {
return this.flgTipologia;
}
public void setFlgTipologia(long flgTipologia) {
this.flgTipologia = flgTipologia;
}
public long getFlgCodiceRiga() {
return this.flgCodiceRiga;
}
public void setFlgCodiceRiga(long flgCodiceRiga) {
this.flgCodiceRiga = flgCodiceRiga;
}
public long getFlgStatoLavorazione() {
return this.flgStatoLavorazione;
}
public void setFlgStatoLavorazione(long flgStatoLavorazione) {
this.flgStatoLavorazione = flgStatoLavorazione;
}
public String getStatoLavorazioneRiga() {
return Documento.getStatoLavorazione(getFlgStatoLavorazioneRiga());
}
public static final String getStatoLavorazioneRiga(long l_flgStatoLavorazione) {
return Documento.getStatoLavorazione(l_flgStatoLavorazione);
}
public long getFlgDaCancellare() {
return this.flgDaCancellare;
}
public void setFlgDaCancellare(long flgDaCancellare) {
this.flgDaCancellare = flgDaCancellare;
}
}

View file

@ -0,0 +1,24 @@
package com.ablia.contab;
import com.ablia.anag.IvaInterface;
import com.ablia.db.ApplParmFull;
public interface RigaDocumentoInterface {
IvaInterface getIva();
double getRDITotImponibile();
double getRDITotImposta();
double getRDITotCosto();
boolean isRDIPIva();
boolean isRDINotaCredito();
double getRDITotImponibileRM();
String getFEEsigibilitaIva();
ApplParmFull getApFull();
}

View file

@ -0,0 +1,71 @@
package com.ablia.contab;
import com.lowagie.text.Font;
import java.util.ArrayList;
public class RigaDocumentoItemPdf {
private int colSpan;
private String desc;
private Font pdfFont;
private int cellAlign = 0;
public RigaDocumentoItemPdf(int colSpan, String desc, Font theFont) {
this.colSpan = colSpan;
this.desc = desc;
this.pdfFont = theFont;
}
public RigaDocumentoItemPdf(int colSpan, String desc, Font theFont, int theCellAlign) {
this.colSpan = colSpan;
this.desc = desc;
this.pdfFont = theFont;
this.cellAlign = theCellAlign;
}
public int getColSpan() {
return this.colSpan;
}
public void setColSpan(int colSpan) {
this.colSpan = colSpan;
}
public String getDesc() {
return (this.desc == null) ? "" : this.desc.trim();
}
public void setDesc(String desc) {
this.desc = desc;
}
public Font getPdfFont() {
return this.pdfFont;
}
public void setPdfFont(Font theFont) {
this.pdfFont = theFont;
}
public static final ArrayList<RigaDocumentoItemPdf> getArrayListNota(String nota, int idColDesc, int[] colSpan, Font PDF_f) {
ArrayList<RigaDocumentoItemPdf> res = new ArrayList<>();
for (int i = 0; i < colSpan.length; i++) {
if (i == idColDesc) {
res.add(new RigaDocumentoItemPdf(colSpan[i], nota.trim(), PDF_f));
} else {
res.add(new RigaDocumentoItemPdf(colSpan[i], "", PDF_f));
}
}
return res;
}
public int getCellAlign() {
return this.cellAlign;
}
public void setCellAlign(int cellAlign) {
this.cellAlign = cellAlign;
}
}

View file

@ -0,0 +1,338 @@
package com.ablia.contab;
import com.ablia.anag.MagFisico;
import com.ablia.db.ApplParmFull;
import com.ablia.db.ResParm;
import com.ablia.db.WcString;
import com.ablia.util.StringTokenizer;
import com.ablia.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.HashMap;
public class RigaDocumentoP extends _ContabAdapter implements Serializable {
private static final long serialVersionUID = 1068781847344225625L;
private long id_documento;
private long id_rigaDocumento;
private long id_rigaDocumentoPrelevata;
private double quantitaPrelevata;
private Documento documento;
private RigaDocumento rigaDocumento;
private RigaDocumento rigaDocumentoPrelevata;
private long id_rigaDocumentoP;
public RigaDocumentoP(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public RigaDocumentoP() {}
public void setId_documento(long newId_documento) {
this.id_documento = newId_documento;
setDocumento(null);
}
public void setId_rigaDocumento(long newId_rigaDocumento) {
this.id_rigaDocumento = newId_rigaDocumento;
setRigaDocumento(null);
}
public void setId_rigaDocumentoPrelevata(long newId_rigaDocumentoPrelevata) {
this.id_rigaDocumentoPrelevata = newId_rigaDocumentoPrelevata;
setRigaDocumentoPrelevata(null);
}
public void setQuantitaPrelevata(double newQuantitaPrelevata) {
this.quantitaPrelevata = newQuantitaPrelevata;
}
public long getId_documento() {
return this.id_documento;
}
public long getId_rigaDocumento() {
return this.id_rigaDocumento;
}
public long getId_rigaDocumentoPrelevata() {
return this.id_rigaDocumentoPrelevata;
}
public double getQuantitaPrelevata() {
return this.quantitaPrelevata;
}
public void setDocumento(Documento newDocumento) {
this.documento = newDocumento;
}
public Documento getDocumento() {
this.documento = (Documento)getSecondaryObject(this.documento, Documento.class, getId_documento());
return this.documento;
}
public void setRigaDocumento(RigaDocumento newRigaDocumento) {
this.rigaDocumento = newRigaDocumento;
}
public RigaDocumento getRigaDocumento() {
this.rigaDocumento = (RigaDocumento)getSecondaryObject(this.rigaDocumento, RigaDocumento.class, getId_rigaDocumento());
return this.rigaDocumento;
}
public void setRigaDocumentoPrelevata(RigaDocumento newRigaDocumentoPrelevata) {
this.rigaDocumentoPrelevata = newRigaDocumentoPrelevata;
}
public RigaDocumento getRigaDocumentoPrelevata() {
this.rigaDocumentoPrelevata = (RigaDocumento)getSecondaryObject(this.rigaDocumentoPrelevata, RigaDocumento.class,
getId_rigaDocumentoPrelevata());
return this.rigaDocumentoPrelevata;
}
protected void deleteCascade() {}
public Vectumerator findByCR(RigaDocumentoPCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from RIGA_DOCUMENTO_P AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public ResParm delete() {
RigaDocumento rd = getRigaDocumento();
RigaDocumento rdP = getRigaDocumentoPrelevata();
long id_rigaDocumentoP = getId_rigaDocumentoP();
ResParm rp = super.delete();
if (rp.getStatus()) {
rdP.setFlgRigaPrelevata(0L);
rdP.aggiornaQuantitaPrelevata();
rdP.getDocumento().aggiornaFlgDocumentoPrelevato(0L);
rd.aggiornaQuantitaAssociata();
RigaDocumento.cancellaMovimento(rd, rdP.getDocumento().getTipoDocumento().getCausaleMagazzino().getId_magFisicoPartenza(),
rdP.getDocumento().getTipoDocumento().getCausaleMagazzino().getId_magFisicoArrivo());
rdP.getArticolo().resetCalcoloQuantita();
}
return rp;
}
public ResParm superDelete() {
ResParm rp = super.delete();
return rp;
}
public ResParm save() {
ResParm rp = super.save();
if (rp.getStatus()) {
getRigaDocumentoPrelevata().aggiornaQuantitaPrelevata();
getRigaDocumento().aggiornaQuantitaAssociata();
}
return rp;
}
public Vectumerator findByDocumento(long l_id_documento, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from RIGA_DOCUMENTO_P AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.id_documento=" + l_id_documento);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public Vectumerator findByRigaDocumento(long l_id_rigaDocumento, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from RIGA_DOCUMENTO_P AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.id_rigaDocumento=" + l_id_rigaDocumento);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public Vectumerator findByRigaDocumentoPrelevata(long l_id_rigaDocumentoPrelevata, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from RIGA_DOCUMENTO_P AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.id_rigaDocumentoPrelevata=" + l_id_rigaDocumentoPrelevata);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public void findByKey(RigaDocumentoPKey rdpK) {
String s_Sql_Find = "select DISTINCT A.* from RIGA_DOCUMENTO_P AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.id_rigaDocumento=" + rdpK.getId_rigaDocumento());
wc.addWc("A.id_rigaDocumentoPrelevata=" + rdpK.getId_rigaDocumentoPrelevata());
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
findFirstRecord(stmt);
} catch (SQLException e) {
handleDebug(e);
}
}
public long getId_rigaDocumentoP() {
return this.id_rigaDocumentoP;
}
public void setId_rigaDocumentoP(long id_rigaDocumentoP) {
this.id_rigaDocumentoP = id_rigaDocumentoP;
}
public double getQuantitaPrelevatoByRigaDocumentoPrelevata(long l_id_rigaDocumento) {
String s_Sql_Find = "select SUM(quantitaPrelevata) as _tot from RIGA_DOCUMENTO_P AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.id_rigaDocumentoPrelevata=" + l_id_rigaDocumento);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return (double)getCount(stmt, "_tot");
} catch (SQLException e) {
handleDebug(e);
return 0.0D;
}
}
public void aggiustaOrdiniSuMovimenti() {
try {
HashMap<Long, Long> ht = new HashMap<>();
String s_Sql_Find = "SELECT A.* FROM RIGA_DOCUMENTO_P AS A WHERE A.id_rigaDocumentoPrelevata NOT IN (SELECT id_rigaDocumento FROM RIGA_DOCUMENTO)";
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find);
Vectumerator<RigaDocumentoP> vec = findRows(stmt, 0, 0);
while (vec.hasMoreElements()) {
RigaDocumentoP rdp = (RigaDocumentoP)vec.nextElement();
long id_articolo = rdp.getRigaDocumento().getId_articolo();
Movimento mov = new Movimento(getApFull());
mov.deleteP(rdp.getId_rigaDocumentoPrelevata());
mov.setId_articolo(id_articolo);
mov.setId_articoloVariante(rdp.getRigaDocumento().getId_articoloVariante());
mov.setId_articoloTaglia(rdp.getRigaDocumento().getId_articoloTaglia());
mov.setId_clifor(rdp.getRigaDocumento().getDocumento().getId_clifor());
mov.setId_causaleMagazzino(rdp.getRigaDocumento().getDocumento().getTipoDocumento().getId_causaleMagazzino());
MagFisico mag = new MagFisico(getApFull());
mag.findMagazzinoOrdinato();
mov.setId_magFisico(mag.getId_magFisico());
mov.setId_rigaDocumento(rdp.getId_rigaDocumento());
if (rdp.getRigaDocumento().getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() == 1L) {
mov.setNr(-1.0D * rdp.getQuantitaPrelevata());
} else if (rdp.getRigaDocumento().getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() == 2L) {
mov.setKg(-1.0D * rdp.getQuantitaPrelevata());
} else if (rdp.getRigaDocumento().getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() == 3L) {
mov.setMt(-1.0D * rdp.getQuantitaPrelevata());
}
mov.save();
if (ht.containsKey(Long.valueOf(id_articolo))) {
long qta = ht.get(Long.valueOf(id_articolo));
qta = (long)((double)qta + rdp.getQuantitaPrelevata());
ht.put(Long.valueOf(id_articolo), Long.valueOf(qta));
continue;
}
ht.put(Long.valueOf(id_articolo), Long.valueOf((long)rdp.getQuantitaPrelevata()));
}
} catch (SQLException e) {
handleDebug(e);
}
}
public double getQuantitaPrelevatoByRigaDocumento(long l_id_rigaDocumento) {
String s_Sql_Find = "select SUM(quantitaPrelevata) as _tot from RIGA_DOCUMENTO_P AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.id_rigaDocumento=" + l_id_rigaDocumento);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return (double)getCount(stmt, "_tot");
} catch (SQLException e) {
handleDebug(e);
return 0.0D;
}
}
public void aggiustaOrdiniSuRD() {
try {
int i = 0, j = 0;
int se1 = 10;
int se2 = 100;
String s_Sql_Find = "SELECT A.* FROM RIGA_DOCUMENTO_P AS A ";
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find);
Vectumerator<RigaDocumentoP> vec = findRows(stmt, 0, 0);
while (vec.hasMoreElements()) {
RigaDocumentoP row = (RigaDocumentoP)vec.nextElement();
if (row.getRigaDocumento().getId_rigaDocumento() == 0L || row.getRigaDocumentoPrelevata().getId_rigaDocumento() == 0L) {
row.delete();
System.out.println("x");
} else {
RigaDocumento rd = (RigaDocumento)row.getRigaDocumento().clone();
rd.setId_rigaDocumento(0L);
rd.setDBState(0);
rd.setId_rigaDocumentoMov(row.getId_rigaDocumento());
rd.setId_rigaDocumentoPrelevata(row.getId_rigaDocumentoPrelevata());
MagFisico mag = new MagFisico(getApFull());
mag.findMagazzinoOrdinato();
rd.setId_magFisico(mag.getId_magFisico());
rd.setSegnoMov(-1L);
if (row.getRigaDocumento().getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() == 1L) {
rd.setNr(row.getQuantitaPrelevata());
} else if (row.getRigaDocumento().getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() == 2L) {
rd.setKg(row.getQuantitaPrelevata());
} else if (row.getRigaDocumento().getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() == 3L) {
rd.setMt(row.getQuantitaPrelevata());
}
rd.setQuantitaPrelevata(row.getQuantitaPrelevata());
rd.superSave();
}
i++;
if (se1 > 0 && i % se1 == 0)
System.out.print(".");
if (se2 > 0 && i % se2 == 0)
System.out.println(String.valueOf(i) + " su " + vec.getTotNumberOfRecords());
}
} catch (SQLException e) {
handleDebug(e);
} catch (Exception e) {
handleDebug(e);
}
}
}

View file

@ -0,0 +1,94 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
public class RigaDocumentoPCR extends CRAdapter {
private long id_documento;
private long id_rigaDocumento;
private long id_rigaDocumentoPrelevata;
private double quantitaPrelevata;
private Documento documento;
private RigaDocumento rigaDocumento;
private RigaDocumento rigaDocumentoPrelevata;
public RigaDocumentoPCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public RigaDocumentoPCR() {}
public void setId_documento(long newId_documento) {
this.id_documento = newId_documento;
setDocumento(null);
}
public void setId_rigaDocumento(long newId_rigaDocumento) {
this.id_rigaDocumento = newId_rigaDocumento;
setRigaDocumento(null);
}
public void setId_rigaDocumentoPrelevata(long newId_rigaDocumentoPrelevata) {
this.id_rigaDocumentoPrelevata = newId_rigaDocumentoPrelevata;
setRigaDocumentoPrelevata(null);
}
public void setQuantitaPrelevata(double newQuantitaPrelevata) {
this.quantitaPrelevata = newQuantitaPrelevata;
}
public long getId_documento() {
return this.id_documento;
}
public long getId_rigaDocumento() {
return this.id_rigaDocumento;
}
public long getId_rigaDocumentoPrelevata() {
return this.id_rigaDocumentoPrelevata;
}
public double getQuantitaPrelevata() {
return this.quantitaPrelevata;
}
public void setDocumento(Documento newDocumento) {
this.documento = newDocumento;
}
public Documento getDocumento() {
this.documento = (Documento)getSecondaryObject(
this.documento,
Documento.class, getId_documento());
return this.documento;
}
public void setRigaDocumento(RigaDocumento newRigaDocumento) {
this.rigaDocumento = newRigaDocumento;
}
public RigaDocumento getRigaDocumento() {
this.rigaDocumento = (RigaDocumento)getSecondaryObject(
this.rigaDocumento,
RigaDocumento.class, getId_rigaDocumento());
return this.rigaDocumento;
}
public void setRigaDocumentoPrelevata(RigaDocumento newRigaDocumentoPrelevata) {
this.rigaDocumentoPrelevata = newRigaDocumentoPrelevata;
}
public RigaDocumento getRigaDocumentoPrelevata() {
this.rigaDocumentoPrelevata = (RigaDocumento)getSecondaryObject(
this.rigaDocumentoPrelevata,
RigaDocumento.class, getId_rigaDocumentoPrelevata());
return this.rigaDocumentoPrelevata;
}
}

View file

@ -0,0 +1,32 @@
package com.ablia.contab;
import java.io.Serializable;
public class RigaDocumentoPKey implements Serializable {
private static final long serialVersionUID = -1567073687136477415L;
private long id_rigaDocumento;
private long id_rigaDocumentoPrelevata;
public RigaDocumentoPKey(long newId_rigaDocumento, long newId_rigaDocumentoPrelevata) {
setId_rigaDocumento(newId_rigaDocumento);
setId_rigaDocumentoPrelevata(newId_rigaDocumentoPrelevata);
}
public void setId_rigaDocumento(long newId_rigaDocumento) {
this.id_rigaDocumento = newId_rigaDocumento;
}
public void setId_rigaDocumentoPrelevata(long newId_rigaDocumentoPrelevata) {
this.id_rigaDocumentoPrelevata = newId_rigaDocumentoPrelevata;
}
public long getId_rigaDocumento() {
return this.id_rigaDocumento;
}
public long getId_rigaDocumentoPrelevata() {
return this.id_rigaDocumentoPrelevata;
}
}

View file

@ -0,0 +1,161 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.ResParm;
import com.ablia.db.WcString;
import com.ablia.util.StringTokenizer;
import com.ablia.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class RigaDocumentoPM extends _ContabAdapter implements Serializable {
private long id_rigaDocumento;
private long id_rigaDocumentoPrelevata;
private double quantitaPrelevata;
private RigaDocumento rigaDocumento;
private RigaDocumento rigaDocumentoPrelevata;
public RigaDocumentoPM(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public RigaDocumentoPM() {}
public void setId_rigaDocumento(long newId_rigaDocumento) {
this.id_rigaDocumento = newId_rigaDocumento;
setRigaDocumento(null);
}
public void setId_rigaDocumentoPrelevata(long newId_rigaDocumentoPrelevata) {
this.id_rigaDocumentoPrelevata = newId_rigaDocumentoPrelevata;
setRigaDocumentoPrelevata(null);
}
public void setQuantitaPrelevata(double newQuantitaPrelevata) {
this.quantitaPrelevata = newQuantitaPrelevata;
}
public long getId_rigaDocumento() {
return this.id_rigaDocumento;
}
public long getId_rigaDocumentoPrelevata() {
return this.id_rigaDocumentoPrelevata;
}
public double getQuantitaPrelevata() {
return this.quantitaPrelevata;
}
public void setRigaDocumento(RigaDocumento newRigaDocumento) {
this.rigaDocumento = newRigaDocumento;
}
public RigaDocumento getRigaDocumento() {
this.rigaDocumento = (RigaDocumento)getSecondaryObject(this.rigaDocumento, RigaDocumento.class, getId_rigaDocumento());
return this.rigaDocumento;
}
public void setRigaDocumentoPrelevata(RigaDocumento newRigaDocumentoPrelevata) {
this.rigaDocumentoPrelevata = newRigaDocumentoPrelevata;
}
public RigaDocumento getRigaDocumentoPrelevata() {
this.rigaDocumentoPrelevata = (RigaDocumento)getSecondaryObject(this.rigaDocumentoPrelevata, RigaDocumento.class,
getId_rigaDocumentoPrelevata());
return this.rigaDocumentoPrelevata;
}
protected void deleteCascade() {}
public Vectumerator findByCR(RigaDocumentoPCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from RIGA_DOCUMENTO_P_M AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public ResParm delete() {
RigaDocumento rd = getRigaDocumento();
RigaDocumento rdP = getRigaDocumentoPrelevata();
ResParm rp = super.delete();
return rp;
}
public ResParm save() {
ResParm rp = super.save();
return rp;
}
public Vectumerator findByDocumento(long l_id_documento, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from RIGA_DOCUMENTO_P_M AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.id_documento=" + l_id_documento);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public void findByRigaDocumento(long l_id_rigaDocumento) {
String s_Sql_Find = "select DISTINCT A.* from RIGA_DOCUMENTO_P_M AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.id_rigaDocumento=" + l_id_rigaDocumento);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
findFirstRecord(stmt);
} catch (SQLException e) {
handleDebug(e);
}
}
public Vectumerator findByRigaDocumentoPrelevata(long l_id_rigaDocumentoPrelevata) {
String s_Sql_Find = "select DISTINCT A.* from RIGA_DOCUMENTO_P_M AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.id_rigaDocumentoPrelevata=" + l_id_rigaDocumentoPrelevata);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, 0, 0);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public static boolean isRigaPrenotazionePrelevata(RigaDocumento rd) {
RigaDocumentoPM rdpm = new RigaDocumentoPM(rd.getApFull());
rdpm.findByRigaDocumentoPrelevata(rd.getId_rigaDocumento());
if (rdpm.getDBState() == 1)
return true;
return false;
}
}

View file

@ -0,0 +1,69 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
public class RigaDocumentoPMCR extends CRAdapter {
private long id_rigaDocumento;
private long id_rigaDocumentoPrelevata;
private double quantitaPrelevata;
private RigaDocumento rigaDocumento;
private RigaDocumento rigaDocumentoPrelevata;
public RigaDocumentoPMCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public RigaDocumentoPMCR() {}
public void setId_rigaDocumento(long newId_rigaDocumento) {
this.id_rigaDocumento = newId_rigaDocumento;
setRigaDocumento(null);
}
public void setId_rigaDocumentoPrelevata(long newId_rigaDocumentoPrelevata) {
this.id_rigaDocumentoPrelevata = newId_rigaDocumentoPrelevata;
setRigaDocumentoPrelevata(null);
}
public void setQuantitaPrelevata(double newQuantitaPrelevata) {
this.quantitaPrelevata = newQuantitaPrelevata;
}
public long getId_rigaDocumento() {
return this.id_rigaDocumento;
}
public long getId_rigaDocumentoPrelevata() {
return this.id_rigaDocumentoPrelevata;
}
public double getQuantitaPrelevata() {
return this.quantitaPrelevata;
}
public void setRigaDocumento(RigaDocumento newRigaDocumento) {
this.rigaDocumento = newRigaDocumento;
}
public RigaDocumento getRigaDocumento() {
this.rigaDocumento = (RigaDocumento)getSecondaryObject(this.rigaDocumento,
RigaDocumento.class, getId_rigaDocumento());
return this.rigaDocumento;
}
public void setRigaDocumentoPrelevata(RigaDocumento newRigaDocumentoPrelevata) {
this.rigaDocumentoPrelevata = newRigaDocumentoPrelevata;
}
public RigaDocumento getRigaDocumentoPrelevata() {
this.rigaDocumentoPrelevata = (RigaDocumento)getSecondaryObject(
this.rigaDocumentoPrelevata, RigaDocumento.class,
getId_rigaDocumentoPrelevata());
return this.rigaDocumentoPrelevata;
}
}

View file

@ -0,0 +1,30 @@
package com.ablia.contab;
import java.io.Serializable;
public class RigaDocumentoPMKey implements Serializable {
private long id_rigaDocumento;
private long id_rigaDocumentoPrelevata;
public RigaDocumentoPMKey(long newId_rigaDocumento, long newId_rigaDocumentoPrelevata) {
setId_rigaDocumento(newId_rigaDocumento);
setId_rigaDocumentoPrelevata(newId_rigaDocumentoPrelevata);
}
public void setId_rigaDocumento(long newId_rigaDocumento) {
this.id_rigaDocumento = newId_rigaDocumento;
}
public void setId_rigaDocumentoPrelevata(long newId_rigaDocumentoPrelevata) {
this.id_rigaDocumentoPrelevata = newId_rigaDocumentoPrelevata;
}
public long getId_rigaDocumento() {
return this.id_rigaDocumento;
}
public long getId_rigaDocumentoPrelevata() {
return this.id_rigaDocumentoPrelevata;
}
}

View file

@ -0,0 +1,191 @@
package com.ablia.contab;
import com.ablia.anag.Clifor;
import com.ablia.anag._AnagAdapter;
import com.ablia.db.ApplParmFull;
import com.ablia.db.WcString;
import com.ablia.util.DoubleOperator;
import com.ablia.util.Vectumerator;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class RigaDocumentoProgettista extends _AnagAdapter {
private long id_rigaDocumentoProgettista;
private long id_rigaDocumento;
private long id_cliforRDA;
private double percRDA;
private double importoRDA;
private Clifor progettista;
private RigaDocumento rigaDocumento;
public RigaDocumentoProgettista() {}
public RigaDocumentoProgettista(ApplParmFull newApplParm) {
super(newApplParm);
}
public long getId_cliforRDA() {
return this.id_cliforRDA;
}
public void setId_cliforRDA(long id_clifor) {
this.id_cliforRDA = id_clifor;
}
public double getImportoRDA() {
if (getId_rigaDocumentoProgettista() > 0L && getId_rigaDocumento() > 0L &&
this.importoRDA == -1.0D) {
DoubleOperator dp = new DoubleOperator(getRigaDocumento().getTotImponibileRigaConSconto());
dp.setScale(2, 5);
dp.multiply(getPercRDA());
dp.divide(100.0F);
this.importoRDA = dp.getResult();
}
return (this.importoRDA == -1.0D) ? 0.0D : this.importoRDA;
}
public void setImportoRDA(double importo) {
this.importoRDA = importo;
}
public double getPercRDA() {
return this.percRDA;
}
public void setPercRDA(double percArticolo) {
this.percRDA = percArticolo;
}
public Vectumerator findByRigaDocumento(long id_rigaDocumento) {
String s_Sql_Find = "SELECT A.* FROM RIGA_DOCUMENTO_PROGETTISTA AS A ";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc(" A.id_rigaDocumento = " + id_rigaDocumento);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public Vectumerator findByDocumento(long id_documento) {
String s_Sql_Find = "SELECT A.* FROM RIGA_DOCUMENTO_PROGETTISTA AS A INNER JOIN RIGA_DOCUMENTO AS B ON A.id_rigaDocumento = B.id_rigaDocumento INNER JOIN DOCUMENTO AS C ON B.id_documento = C.id_documento ";
String s_Sql_Order = " order by id_rigaDocumento, id_articolo, id_cliforRDA, percRDA";
WcString wc = new WcString();
wc.addWc(" C.id_documento = " + id_documento);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public long getId_rigaDocumentoProgettista() {
return this.id_rigaDocumentoProgettista;
}
public void setId_rigaDocumentoProgettista(long id_rigaDocumentoProgettista) {
this.id_rigaDocumentoProgettista = id_rigaDocumentoProgettista;
}
public long getId_rigaDocumento() {
return this.id_rigaDocumento;
}
public void setId_rigaDocumento(long id_rigaDocumento) {
this.id_rigaDocumento = id_rigaDocumento;
setRigaDocumento(null);
}
public Clifor getProgettista() {
this.progettista = new Clifor(getApFull());
this.progettista.findByPrimaryKey(getId_cliforRDA());
return this.progettista;
}
public void setProgettista(Clifor clifor) {
this.progettista = clifor;
}
public void findByRigaDocumentoProgettista(long id_rigaDocumento, long id_progettista) {
String s_Sql_Find = "SELECT A.* FROM RIGA_DOCUMENTO_PROGETTISTA AS A ";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc(" A.id_rigaDocumento = " + id_rigaDocumento);
wc.addWc(" A.id_clifor = " + id_progettista);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
findFirstRecord(stmt);
} catch (SQLException e) {
handleDebug(e);
}
}
protected void initFields() {
super.initFields();
this.importoRDA = -1.0D;
}
public RigaDocumento getRigaDocumento() {
this.rigaDocumento = new RigaDocumento(getApFull());
this.rigaDocumento.findByPrimaryKey(getId_rigaDocumento());
return this.rigaDocumento;
}
public void setRigaDocumento(RigaDocumento rigaDocumento) {
this.rigaDocumento = rigaDocumento;
}
public Vectumerator findByCR(RigaDocumentoProgettistaCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from RIGA_DOCUMENTO_PROGETTISTA AS A inner join CLIFOR AS B on A.id_cliforRDA=B.id_clifor inner join RIGA_DOCUMENTO AS D ON A.id_rigaDocumento=D.id_rigaDocumento inner join DOCUMENTO as C on D.id_documento=C.id_documento";
String s_Sql_Order = " order by B.cognome, B.nome, A.id_cliforRDA";
WcString wc = new WcString();
if (CR.getId_documento() != 0L)
wc.addWc("A.id_documento = " + CR.getId_documento());
if (CR.getId_cliforDA() != 0L)
wc.addWc("A.id_cliforRDA = " + CR.getId_cliforDA());
if (CR.getFlgPagata() == 0L) {
wc.addWc("(C.flgPagata is null or C.flgPagata=0)");
} else if (CR.getFlgPagata() > 0L) {
wc.addWc("C.flgPagata =" + CR.getFlgPagata());
}
if (CR.getDataDocumentoDa() != null)
wc.addWc("C.dataDocumento>=?");
if (CR.getDataDocumentoA() != null)
wc.addWc("C.dataDocumento<=?");
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
int dataCount = 0;
if (CR.getDataDocumentoDa() != null) {
dataCount++;
stmt.setDate(dataCount, CR.getDataDocumentoDa());
}
if (CR.getDataDocumentoA() != null) {
dataCount++;
stmt.setDate(dataCount, CR.getDataDocumentoA());
}
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public void deleteByRigaDocumento(long id_rigaDocumento) {
Vectumerator vec = new RigaDocumentoProgettista(getApFull()).findByRigaDocumento(id_rigaDocumento);
while (vec.hasMoreElements()) {
RigaDocumentoProgettista row = (RigaDocumentoProgettista)vec.nextElement();
row.delete();
}
}
}

View file

@ -0,0 +1,108 @@
package com.ablia.contab;
import com.ablia.anag.Clifor;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import java.sql.Date;
public class RigaDocumentoProgettistaCR extends CRAdapter {
private long id_documentoAgente;
private long id_documento;
private long id_cliforDA;
private double percDocumentoAgente;
private Documento documento;
private Clifor agente;
private Date dataDocumentoA;
private Date dataDocumentoDa;
private long flgPagata = -1L;
public RigaDocumentoProgettistaCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public RigaDocumentoProgettistaCR() {}
public long getId_documentoAgente() {
return this.id_documentoAgente;
}
public void setId_documentoAgente(long id_documentoAgente) {
this.id_documentoAgente = id_documentoAgente;
}
public long getId_documento() {
return this.id_documento;
}
public void setId_documento(long id_documento) {
this.id_documento = id_documento;
}
public long getId_cliforDA() {
return this.id_cliforDA;
}
public void setId_cliforDA(long id_clifor) {
this.id_cliforDA = id_clifor;
}
public double getPercDocumentoAgente() {
return this.percDocumentoAgente;
}
public void setPercDocumentoAgente(double percDocumentoAgente) {
this.percDocumentoAgente = percDocumentoAgente;
}
public Documento getDocumento() {
this.documento = new Documento(getApFull());
this.documento.findByPrimaryKey(getId_documento());
return this.documento;
}
public void setDocumento(Documento documento) {
this.documento = documento;
}
public Clifor getAgente() {
this.agente = new Clifor(getApFull());
this.agente.findByPrimaryKey(getId_cliforDA());
return this.agente;
}
public void setAgente(Clifor agente) {
this.agente = agente;
}
public Date getDataDocumentoA() {
return this.dataDocumentoA;
}
public void setDataDocumentoA(Date dataDocumentoA) {
this.dataDocumentoA = dataDocumentoA;
}
public Date getDataDocumentoDa() {
return this.dataDocumentoDa;
}
public void setDataDocumentoDa(Date dataDocumentoDa) {
this.dataDocumentoDa = dataDocumentoDa;
}
public long getFlgPagata() {
return this.flgPagata;
}
public void setFlgPagata(long flgPagata) {
this.flgPagata = flgPagata;
}
}

View file

@ -0,0 +1,218 @@
package com.ablia.contab;
import com.ablia.anag.Banca;
import com.ablia.anag.Clifor;
import com.ablia.anag.Iva;
import com.ablia.db.ApplParmFull;
import com.ablia.db.DBAdapter;
import com.ablia.db.DBAdapterException;
import com.ablia.db.ResParm;
import com.ablia.db.WcString;
import com.ablia.util.StringTokenizer;
import com.ablia.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class RigaMovContabile extends DBAdapter implements Serializable {
private static final long serialVersionUID = -4169805255664880589L;
private long id_rigaMovContabile;
private long id_movContabile;
private double importo;
private long flgDA;
private long id_pianoConti;
private long id_clifor;
private long id_banca;
private long id_documento;
private long id_iva;
private MovContabile movContabile;
private PianoConti pianoConti;
private Clifor clifor;
private Banca banca;
private Documento documento;
private Iva iva;
public RigaMovContabile(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public RigaMovContabile() {}
public Vectumerator<RigaMovContabile> findByCR(RigaMovContabileCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from RIGA_MOV_CONTABILE AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
protected void deleteCascade() {}
protected ResParm checkDeleteCascade() throws DBAdapterException, SQLException {
return null;
}
public long getId_rigaMovContabile() {
return this.id_rigaMovContabile;
}
public void setId_rigaMovContabile(long id_rigaMovContabile) {
this.id_rigaMovContabile = id_rigaMovContabile;
}
public long getId_movContabile() {
return this.id_movContabile;
}
public void setId_movContabile(long id_incassoPagamento) {
this.id_movContabile = id_incassoPagamento;
setMovContabile(null);
}
public double getImporto() {
return this.importo;
}
public void setImporto(double importo) {
this.importo = importo;
}
public long getFlgDA() {
return this.flgDA;
}
public void setFlgDA(long flgDA) {
this.flgDA = flgDA;
}
public long getId_pianoConti() {
return this.id_pianoConti;
}
public void setId_pianoConti(long id_pianoConti) {
this.id_pianoConti = id_pianoConti;
setPianoConti(null);
}
public long getId_clifor() {
return this.id_clifor;
}
public void setId_clifor(long id_clifor) {
this.id_clifor = id_clifor;
setClifor(null);
}
public long getId_banca() {
return this.id_banca;
}
public void setId_banca(long id_banca) {
this.id_banca = id_banca;
setBanca(null);
}
public long getId_documento() {
return this.id_documento;
}
public void setId_documento(long id_documento) {
this.id_documento = id_documento;
setDocumento(null);
}
public long getId_iva() {
return this.id_iva;
}
public void setId_iva(long id_iva) {
this.id_iva = id_iva;
setIva(null);
}
public MovContabile getMovContabile() {
this.movContabile = (MovContabile)getSecondaryObject(this.movContabile, MovContabile.class, getId_movContabile());
return this.movContabile;
}
public void setMovContabile(MovContabile movContabile) {
this.movContabile = movContabile;
}
public PianoConti getPianoConti() {
this.pianoConti = (PianoConti)getSecondaryObject(this.pianoConti, PianoConti.class, getId_pianoConti());
return this.pianoConti;
}
public void setPianoConti(PianoConti pianoConti) {
this.pianoConti = pianoConti;
}
public Clifor getClifor() {
this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor());
return this.clifor;
}
public void setClifor(Clifor clifor) {
this.clifor = clifor;
}
public Banca getBanca() {
this.banca = (Banca)getSecondaryObject(this.banca, Banca.class, getId_banca());
return this.banca;
}
public void setBanca(Banca banca) {
this.banca = banca;
}
public Documento getDocumento() {
this.documento = (Documento)getSecondaryObject(this.documento, Documento.class, getId_documento());
return this.documento;
}
public void setDocumento(Documento documento) {
this.documento = documento;
}
public Iva getIva() {
this.iva = (Iva)getSecondaryObject(this.iva, Iva.class, getId_iva());
return this.iva;
}
public void setIva(Iva iva) {
this.iva = iva;
}
}

View file

@ -0,0 +1,179 @@
package com.ablia.contab;
import com.ablia.anag.Banca;
import com.ablia.anag.Clifor;
import com.ablia.anag.Iva;
import com.ablia.db.ApplParmFull;
import java.io.Serializable;
public class RigaMovContabileCR extends Object implements Serializable {
private static final long serialVersionUID = -639622181326860331L;
private long id_rigaMovContabile;
private long id_movContabile;
private double importo;
private long flgDA;
private long id_pianoConti;
private long id_clifor;
private long id_banca;
private long id_documento;
private long id_iva;
private MovContabile movContabile;
private PianoConti pianoConti;
private Clifor clifor;
private Banca banca;
private Documento documento;
private Iva iva;
public RigaMovContabileCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public RigaMovContabileCR() {}
public long getId_rigaMovContabile() {
return this.id_rigaMovContabile;
}
public void setId_rigaMovContabile(long id_rigaMovContabile) {
this.id_rigaMovContabile = id_rigaMovContabile;
}
public long getId_movContabile() {
return this.id_movContabile;
}
public void setId_movContabile(long id_incassoPagamento) {
this.id_movContabile = id_incassoPagamento;
setMovContabile(null);
}
public double getImporto() {
return this.importo;
}
public void setImporto(double importo) {
this.importo = importo;
}
public long getFlgDA() {
return this.flgDA;
}
public void setFlgDA(long flgDA) {
this.flgDA = flgDA;
}
public long getId_pianoConti() {
return this.id_pianoConti;
}
public void setId_pianoConti(long id_pianoConti) {
this.id_pianoConti = id_pianoConti;
setPianoConti(null);
}
public long getId_clifor() {
return this.id_clifor;
}
public void setId_clifor(long id_clifor) {
this.id_clifor = id_clifor;
setClifor(null);
}
public long getId_banca() {
return this.id_banca;
}
public void setId_banca(long id_banca) {
this.id_banca = id_banca;
setBanca(null);
}
public long getId_documento() {
return this.id_documento;
}
public void setId_documento(long id_documento) {
this.id_documento = id_documento;
setDocumento(null);
}
public long getId_iva() {
return this.id_iva;
}
public void setId_iva(long id_iva) {
this.id_iva = id_iva;
setIva(null);
}
public MovContabile getMovContabile() {
this.movContabile = (MovContabile)getSecondaryObject(this.movContabile, MovContabile.class, getId_movContabile());
return this.movContabile;
}
public void setMovContabile(MovContabile movContabile) {
this.movContabile = movContabile;
}
public PianoConti getPianoConti() {
this.pianoConti = (PianoConti)getSecondaryObject(this.pianoConti, PianoConti.class, getId_pianoConti());
return this.pianoConti;
}
public void setPianoConti(PianoConti pianoConti) {
this.pianoConti = pianoConti;
}
public Clifor getClifor() {
this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor());
return this.clifor;
}
public void setClifor(Clifor clifor) {
this.clifor = clifor;
}
public Banca getBanca() {
this.banca = (Banca)getSecondaryObject(this.banca, Banca.class, getId_banca());
return this.banca;
}
public void setBanca(Banca banca) {
this.banca = banca;
}
public Documento getDocumento() {
this.documento = (Documento)getSecondaryObject(this.documento, Documento.class, getId_documento());
return this.documento;
}
public void setDocumento(Documento documento) {
this.documento = documento;
}
public Iva getIva() {
this.iva = (Iva)getSecondaryObject(this.iva, Iva.class, getId_iva());
return this.iva;
}
public void setIva(Iva iva) {
this.iva = iva;
}
}

View file

@ -0,0 +1,65 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.WcString;
import com.ablia.util.StringTokenizer;
import com.ablia.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class TipoAllegatoDocumento extends _ContabAdapter implements Serializable {
private long id_tipoAllegatoDocumento;
private String descrizione;
public TipoAllegatoDocumento(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public TipoAllegatoDocumento() {}
public void setId_tipoAllegatoDocumento(long newId_tipoAllegatoDocumento) {
this.id_tipoAllegatoDocumento = newId_tipoAllegatoDocumento;
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public long getId_tipoAllegatoDocumento() {
return this.id_tipoAllegatoDocumento;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione.trim();
}
protected void deleteCascade() {}
public Vectumerator findByCR(TipoAllegatoDocumentoCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from TIPO_ALLEGATO_DOCUMENTO AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
}

View file

@ -0,0 +1,32 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
public class TipoAllegatoDocumentoCR extends CRAdapter {
private long id_tipoAllegatoDocumento;
private String descrizione;
public TipoAllegatoDocumentoCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public TipoAllegatoDocumentoCR() {}
public void setId_tipoAllegatoDocumento(long newId_tipoAllegatoDocumento) {
this.id_tipoAllegatoDocumento = newId_tipoAllegatoDocumento;
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public long getId_tipoAllegatoDocumento() {
return this.id_tipoAllegatoDocumento;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione.trim();
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,160 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
public class TipoDocumentoCR extends CRAdapter {
private long id_tipoDocumento;
private long id_causaleMagazzino;
private String descrizione;
private long flgTipologia = -1L;
private CausaleMagazzino causaleMagazzino;
private String flgClienteFornitore;
private long flgMenu = -1L;
private String flgTipologie;
private long id_tipologiaDocumento;
private long id_tipoStampaDocumento;
private TipologiaDocumento tipologiaDocumento;
private TipoStampaDocumento tipoStampaDocumento;
private long flgNascondiNuovo = -1L;
public TipoDocumentoCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public TipoDocumentoCR() {}
public void setId_tipoDocumento(long newId_tipoDocumento) {
this.id_tipoDocumento = newId_tipoDocumento;
}
public void setId_causaleMagazzino(long newId_causaleMagazzino) {
this.id_causaleMagazzino = newId_causaleMagazzino;
setCausaleMagazzino(null);
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public void setFlgTipologia(long newFlgTipologia) {
this.flgTipologia = newFlgTipologia;
}
public long getId_tipoDocumento() {
return this.id_tipoDocumento;
}
public long getId_causaleMagazzino() {
return this.id_causaleMagazzino;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione.trim();
}
public long getFlgTipologia() {
return this.flgTipologia;
}
public void setCausaleMagazzino(CausaleMagazzino newCausaleMagazzino) {
this.causaleMagazzino = newCausaleMagazzino;
}
public CausaleMagazzino getCausaleMagazzino() {
this.causaleMagazzino = (CausaleMagazzino)getSecondaryObject(this.causaleMagazzino, CausaleMagazzino.class, getId_causaleMagazzino());
return this.causaleMagazzino;
}
public String getTipologia() {
return getTipologia(getFlgTipologia());
}
public final String getTipologia(long l_flgTipologia) {
TipologiaDocumento td = new TipologiaDocumento(getApFull());
td.findByCodice(l_flgTipologia);
return td.getDescrizione();
}
public String getFlgClienteFornitore() {
return (this.flgClienteFornitore == null) ? "" : this.flgClienteFornitore;
}
public void setFlgClienteFornitore(String newFlgClienteFornitore) {
this.flgClienteFornitore = newFlgClienteFornitore;
}
public long getFlgMenu() {
return this.flgMenu;
}
public void setFlgMenu(long flgMenu) {
this.flgMenu = flgMenu;
}
public String getFlgTipologie() {
return (this.flgTipologie == null) ? "" : this.flgTipologie.toString();
}
public void setFlgTipologie(String flgTipologie) {
this.flgTipologie = flgTipologie;
}
public long getId_tipologiaDocumento() {
return this.id_tipologiaDocumento;
}
public long getId_tipoStampaDocumento() {
return this.id_tipoStampaDocumento;
}
public TipologiaDocumento getTipologiaDocumento() {
this.tipologiaDocumento = (TipologiaDocumento)getSecondaryObject(this.tipologiaDocumento, TipologiaDocumento.class,
getId_tipologiaDocumento());
return this.tipologiaDocumento;
}
public TipoStampaDocumento getTipoStampaDocumento() {
this.tipoStampaDocumento = (TipoStampaDocumento)getSecondaryObject(this.tipoStampaDocumento, TipoStampaDocumento.class,
getId_tipoStampaDocumento());
return this.tipoStampaDocumento;
}
public void setId_tipologiaDocumento(long newId_tipologiaDocumento) {
this.id_tipologiaDocumento = newId_tipologiaDocumento;
setTipologiaDocumento(null);
}
public void setId_tipoStampaDocumento(long newId_tipoStampaDocumento) {
this.id_tipoStampaDocumento = newId_tipoStampaDocumento;
setTipoStampaDocumento(null);
}
public void setTipologiaDocumento(TipologiaDocumento newTipologiaDocumento) {
this.tipologiaDocumento = newTipologiaDocumento;
}
public void setTipoStampaDocumento(TipoStampaDocumento newTipoStampaDocumento) {
this.tipoStampaDocumento = newTipoStampaDocumento;
}
public long getFlgNascondiNuovo() {
return this.flgNascondiNuovo;
}
public void setFlgNascondiNuovo(long flgNascondiNuovo) {
this.flgNascondiNuovo = flgNascondiNuovo;
}
}

View file

@ -0,0 +1,98 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.DBAdapter;
import com.ablia.db.ResParm;
import com.ablia.db.WcString;
import com.ablia.util.StringTokenizer;
import com.ablia.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class TipoStampaDocumento extends DBAdapter implements Serializable {
private static final long serialVersionUID = 1553591799994L;
private long id_tipoStampaDocumento;
private String Descrizione;
private long codice;
public TipoStampaDocumento(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public TipoStampaDocumento() {}
public void setId_tipoStampaDocumento(long newId_tipoStampaDocumento) {
this.id_tipoStampaDocumento = newId_tipoStampaDocumento;
}
public void setDescrizione(String newDescrizione) {
this.Descrizione = newDescrizione;
}
public long getId_tipoStampaDocumento() {
return this.id_tipoStampaDocumento;
}
public String getDescrizione() {
return (this.Descrizione == null) ? "" : this.Descrizione.trim();
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public Vectumerator<TipoStampaDocumento> findByCR(TipoStampaDocumentoCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from TIPO_STAMPA_DOCUMENTO AS A";
String s_Sql_Order = " order by A.descrizione";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public long getCodice() {
return this.codice;
}
public void setCodice(long codice) {
this.codice = codice;
}
public Vectumerator<TipoStampaDocumento> findByTipologiaDocumento(long l_id_tipologiaDocumento) {
String s_Sql_Find = "select DISTINCT A.* from TIPO_STAMPA_DOCUMENTO AS A inner join TIPOLOGIA_DOCUMENTO_TIPO_STAMPA AS B ON A.id_tipoStampaDocumento=B.id_tipoStampaDocumento";
String s_Sql_Order = " order by A.descrizione";
WcString wc = new WcString();
wc.addWc("B.id_tipologiaDocumento=" + l_id_tipologiaDocumento);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
}

View file

@ -0,0 +1,42 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
public class TipoStampaDocumentoCR extends CRAdapter {
private long id_tipoStampaDocumento;
private String descrizione;
private long codice;
public TipoStampaDocumentoCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public TipoStampaDocumentoCR() {}
public void setId_tipoStampaDocumento(long newId_tipoStampaDocumento) {
this.id_tipoStampaDocumento = newId_tipoStampaDocumento;
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public long getId_tipoStampaDocumento() {
return this.id_tipoStampaDocumento;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione.trim();
}
public long getCodice() {
return this.codice;
}
public void setCodice(long codice) {
this.codice = codice;
}
}

View file

@ -0,0 +1,159 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.DBAdapter;
import com.ablia.db.ResParm;
import com.ablia.db.WcString;
import com.ablia.util.StringTokenizer;
import com.ablia.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class TipologiaDocumento extends DBAdapter implements Serializable {
private static final long serialVersionUID = 1553591799856L;
private long id_tipologiaDocumento;
private String descrizione;
private String suffissoPD;
private long codice;
private long flgArticolo2;
private long flgGestioneSeparata;
private String suffissoCR;
public TipologiaDocumento(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public TipologiaDocumento() {}
public void setId_tipologiaDocumento(long newId_tipologiaDocumento) {
this.id_tipologiaDocumento = newId_tipologiaDocumento;
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public void setSuffissoPD(String newSuffissoPD) {
this.suffissoPD = newSuffissoPD;
}
public long getId_tipologiaDocumento() {
return this.id_tipologiaDocumento;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione.trim();
}
public String getSuffissoPD() {
return (this.suffissoPD == null) ? "" : this.suffissoPD.trim();
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public Vectumerator<TipologiaDocumento> findByCR(TipologiaDocumentoCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from TIPOLOGIA_DOCUMENTO AS A";
String s_Sql_Order = " ORDER BY A.descrizione";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public long getCodice() {
return this.codice;
}
public void setCodice(long codice) {
this.codice = codice;
}
public Vectumerator<TipologiaDocumentoTipoStampa> findByTipologiaDocumento() {
return new TipologiaDocumentoTipoStampa(getApFull()).findByTipologiaDocumento(getId_tipologiaDocumento());
}
public String getElencoStampe() {
if (getId_tipologiaDocumento() == 0L)
return "";
StringBuilder sb = new StringBuilder();
Vectumerator<TipologiaDocumentoTipoStampa> vec = findByTipologiaDocumento();
while (vec.hasMoreElements()) {
TipologiaDocumentoTipoStampa row = (TipologiaDocumentoTipoStampa)vec.nextElement();
sb.append(row.getTipoStampaDocumento().getDescrizione());
if (vec.hasMoreElements())
sb.append(", ");
}
return sb.toString();
}
public long getFlgArticolo2() {
return this.flgArticolo2;
}
public void setFlgArticolo2(long flgArticolo2) {
this.flgArticolo2 = flgArticolo2;
}
public void findByCodice(long l_codice) {
String s_Sql_Find = "select DISTINCT A.* from TIPOLOGIA_DOCUMENTO AS A";
String s_Sql_Order = " ORDER BY A.descrizione";
WcString wc = new WcString();
wc.addWc("A.codice=" + l_codice);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
findFirstRecord(stmt);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
}
}
public long getFlgGestioneSeparata() {
return this.flgGestioneSeparata;
}
public void setFlgGestioneSeparata(long flgGestioneSeparata) {
this.flgGestioneSeparata = flgGestioneSeparata;
}
public String getSuffissoCR() {
return (this.suffissoCR == null) ? "" : this.suffissoCR.trim();
}
public void setSuffissoCR(String suffissoCR) {
this.suffissoCR = suffissoCR;
}
public String getDescrizione(String lang) {
return super.getDescrizione(lang);
}
}

View file

@ -0,0 +1,52 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
public class TipologiaDocumentoCR extends CRAdapter {
private long id_tipologiaDocumento;
private String descrizione;
private String suffissoPD;
private long codice;
public TipologiaDocumentoCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public TipologiaDocumentoCR() {}
public void setId_tipologiaDocumento(long newId_tipologiaDocumento) {
this.id_tipologiaDocumento = newId_tipologiaDocumento;
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public void setSuffissoPD(String newSuffissoPD) {
this.suffissoPD = newSuffissoPD;
}
public long getId_tipologiaDocumento() {
return this.id_tipologiaDocumento;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione.trim();
}
public String getSuffissoPD() {
return (this.suffissoPD == null) ? "" : this.suffissoPD.trim();
}
public long getCodice() {
return this.codice;
}
public void setCodice(long codice) {
this.codice = codice;
}
}

View file

@ -0,0 +1,124 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.DBAdapter;
import com.ablia.db.ResParm;
import com.ablia.db.WcString;
import com.ablia.util.StringTokenizer;
import com.ablia.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class TipologiaDocumentoTipoStampa extends DBAdapter implements Serializable {
private static final long serialVersionUID = 1553591799904L;
private long id_tipologiaDocumentoTipoStampa;
private long id_tipologiaDocumento;
private long id_tipoStampaDocumento;
private TipologiaDocumento tipologiaDocumento;
private TipoStampaDocumento tipoStampaDocumento;
public TipologiaDocumentoTipoStampa(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public TipologiaDocumentoTipoStampa() {}
public void setId_tipologiaDocumentoTipoStampa(long newId_tipologiaDocumentoTipoStampa) {
this.id_tipologiaDocumentoTipoStampa = newId_tipologiaDocumentoTipoStampa;
}
public void setId_tipologiaDocumento(long newId_tipologiaDocumento) {
this.id_tipologiaDocumento = newId_tipologiaDocumento;
setTipologiaDocumento(null);
}
public void setId_tipoStampaDocumento(long newId_tipoStampaDocumento) {
this.id_tipoStampaDocumento = newId_tipoStampaDocumento;
setTipoStampaDocumento(null);
}
public long getId_tipologiaDocumentoTipoStampa() {
return this.id_tipologiaDocumentoTipoStampa;
}
public long getId_tipologiaDocumento() {
return this.id_tipologiaDocumento;
}
public long getId_tipoStampaDocumento() {
return this.id_tipoStampaDocumento;
}
public void setTipologiaDocumento(TipologiaDocumento newTipologiaDocumento) {
this.tipologiaDocumento = newTipologiaDocumento;
}
public TipologiaDocumento getTipologiaDocumento() {
this.tipologiaDocumento = (TipologiaDocumento)getSecondaryObject(this.tipologiaDocumento, TipologiaDocumento.class,
getId_tipologiaDocumento());
return this.tipologiaDocumento;
}
public void setTipoStampaDocumento(TipoStampaDocumento newTipoStampaDocumento) {
this.tipoStampaDocumento = newTipoStampaDocumento;
}
public TipoStampaDocumento getTipoStampaDocumento() {
this.tipoStampaDocumento = (TipoStampaDocumento)getSecondaryObject(this.tipoStampaDocumento, TipoStampaDocumento.class,
getId_tipoStampaDocumento());
return this.tipoStampaDocumento;
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public Vectumerator<TipologiaDocumentoTipoStampa> findByCR(TipologiaDocumentoTipoStampaCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from TIPOLOGIA_DOCUMENTO_TIPO_STAMPA AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public Vectumerator<TipologiaDocumentoTipoStampa> findByTipologiaDocumento(long l_id_tipologiaDocumento) {
String s_Sql_Find = "select DISTINCT A.* from TIPOLOGIA_DOCUMENTO_TIPO_STAMPA AS A inner join TIPO_STAMPA_DOCUMENTO AS B on A.id_tipoStampaDocumento=B.id_tipoStampaDocumento";
String s_Sql_Order = " order by B.descrizione";
WcString wc = new WcString();
wc.addWc("A.id_tipologiaDocumento=" + l_id_tipologiaDocumento);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
}

View file

@ -0,0 +1,70 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
public class TipologiaDocumentoTipoStampaCR extends CRAdapter {
private long id_tipologiaDocumentoTipoStampa;
private long id_tipologiaDocumento;
private long id_tipoStampaDocumento;
private TipologiaDocumento tipologiaDocumento;
private TipoStampaDocumento tipoStampaDocumento;
public TipologiaDocumentoTipoStampaCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public TipologiaDocumentoTipoStampaCR() {}
public void setId_tipologiaDocumentoTipoStampa(long newId_tipologiaDocumentoTipoStampa) {
this.id_tipologiaDocumentoTipoStampa = newId_tipologiaDocumentoTipoStampa;
}
public void setId_tipologiaDocumento(long newId_tipologiaDocumento) {
this.id_tipologiaDocumento = newId_tipologiaDocumento;
setTipologiaDocumento(null);
}
public void setId_tipoStampaDocumento(long newId_tipoStampaDocumento) {
this.id_tipoStampaDocumento = newId_tipoStampaDocumento;
setTipoStampaDocumento(null);
}
public long getId_tipologiaDocumentoTipoStampa() {
return this.id_tipologiaDocumentoTipoStampa;
}
public long getId_tipologiaDocumento() {
return this.id_tipologiaDocumento;
}
public long getId_tipoStampaDocumento() {
return this.id_tipoStampaDocumento;
}
public void setTipologiaDocumento(TipologiaDocumento newTipologiaDocumento) {
this.tipologiaDocumento = newTipologiaDocumento;
}
public TipologiaDocumento getTipologiaDocumento() {
this.tipologiaDocumento = (TipologiaDocumento)getSecondaryObject(
this.tipologiaDocumento,
TipologiaDocumento.class, getId_tipologiaDocumento());
return this.tipologiaDocumento;
}
public void setTipoStampaDocumento(TipoStampaDocumento newTipoStampaDocumento) {
this.tipoStampaDocumento = newTipoStampaDocumento;
}
public TipoStampaDocumento getTipoStampaDocumento() {
this.tipoStampaDocumento = (TipoStampaDocumento)getSecondaryObject(
this.tipoStampaDocumento,
TipoStampaDocumento.class, getId_tipoStampaDocumento());
return this.tipoStampaDocumento;
}
}

View file

@ -0,0 +1,34 @@
package com.ablia.contab;
import com.ablia.anag._AnagAdapter;
import com.ablia.db.ApplParmFull;
public class _ContabAdapter extends _AnagAdapter {
public static final long SF_BOZZA = 0L;
public static final long SF_EMESSA = 1L;
public static final long SF_REG_IVA = 2L;
public static final long CONTATORE_VENDITE = 1L;
public static final long CONTATORE_ACQUISTI = 2L;
public _ContabAdapter() {}
public _ContabAdapter(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
protected String getFooterDocumento(int l_numb) {
return getParm("FOOT_DOC" + l_numb).getTesto();
}
protected String getHeaderDoocumento(int l_numb) {
return getParm("HEAD_DOC" + l_numb).getTesto();
}
protected boolean isDescScontrinoFull() {
return (getParm("DESC_SCONTRINO_FULL").getNumeroInt() == 1);
}
}

View file

@ -0,0 +1,54 @@
package com.ablia.contab.iva;
import com.ablia.anag.IvaInterface;
import com.ablia.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;
}
}

View file

@ -0,0 +1,193 @@
package com.ablia.contab.iva;
import com.ablia.anag.Iva;
import com.ablia.anag.IvaInterface;
import com.ablia.contab.RigaDocumentoInterface;
import com.ablia.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) {
addFattura(l_iva, imponibile, imposta, costo, 0.0D, 0.0D, getRiConPI());
}
private void addFatturaConPi(Iva l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento) {
addFattura(l_iva, imponibile, imposta, costo, speseAccessorie, arrotondamento, getRiConPI());
}
private void addNotaDiCreditoConPI(IvaInterface l_iva, double imponibile, double imposta, double costo) {
addFattura(l_iva, -imponibile, -imposta, costo, 0.0D, 0.0D, getRiConPI());
}
private void addNotaDiCreditoConPI(Iva l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento) {
addFattura(l_iva, -imponibile, -imposta, costo, speseAccessorie, arrotondamento, getRiConPI());
}
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) {
addFattura(l_iva, imponibile, imposta, costo, 0.0D, 0.0D);
}
private void addFattura(IvaInterface l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento) {
addFattura(l_iva, imponibile, imposta, costo, speseAccessorie, arrotondamento, getRi());
}
private void addFattura(IvaInterface l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento, Hashtable<String, RiepilogoIvaItem> RI) {
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);
RI.put(theKey, rii);
}
private void addNotaDiCredito(IvaInterface l_iva, double imponibile, double imposta, double costo) {
addFattura(l_iva, -imponibile, -imposta, costo, 0.0D, 0.0D, getRi());
}
private void addNotaDiCredito(Iva l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento) {
addFattura(l_iva, -imponibile, -imposta, costo, speseAccessorie, arrotondamento, getRi());
}
private void addFatturaSenzaPi(IvaInterface l_iva, double imponibile, double imposta, double costo) {
addFattura(l_iva, imponibile, imposta, costo, 0.0D, 0.0D, getRiSenzaPI());
}
private void addFatturaSenzaPi(Iva l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento) {
addFattura(l_iva, imponibile, imposta, costo, speseAccessorie, arrotondamento, getRiSenzaPI());
}
private void addNotaDiCreditoSenzaPI(IvaInterface l_iva, double imponibile, double imposta, double costo) {
addFattura(l_iva, -imponibile, -imposta, costo, 0.0D, 0.0D, getRiSenzaPI());
}
private void addNotaDiCreditoSenzaPI(Iva l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento) {
addFattura(l_iva, -imponibile, -imposta, costo, speseAccessorie, arrotondamento, getRiSenzaPI());
}
public void addRigaDocumento(IvaInterface l_iva, double imponibile, double imposta, boolean isNotaDiCredito, boolean isPartitaIva) {
if (!isNotaDiCredito) {
addFattura(l_iva, imponibile, imposta, 0.0D);
} else {
addNotaDiCredito(l_iva, imponibile, imposta, 0.0D);
}
if (!isPartitaIva) {
if (!isNotaDiCredito) {
addFatturaSenzaPi(l_iva, imponibile, imposta, 0.0D);
} else {
addNotaDiCreditoSenzaPI(l_iva, imponibile, imposta, 0.0D);
}
} else if (!isNotaDiCredito) {
addFatturaConPi(l_iva, imponibile, imposta, 0.0D);
} else {
addNotaDiCreditoConPI(l_iva, imponibile, imposta, 0.0D);
}
}
public void addRigaRegistroIvaItem(RigaRegistroIvaItem rrii, boolean isNotaDiCredito, boolean isPartitaIva) {
addRigaDocumento(rrii.getIva(), rrii.getImponibile(), rrii.getImportoIva(), isNotaDiCredito, isPartitaIva);
}
private void addRigaDocumento(RigaDocumentoInterface rigaDocumento) {
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());
} else {
addNotaDiCredito(rigaDocumento.getIva(), imponibile, iva, rigaDocumento.getRDITotCosto());
}
if (!rigaDocumento.isRDIPIva()) {
if (!rigaDocumento.isRDINotaCredito()) {
addFatturaSenzaPi(rigaDocumento.getIva(), imponibile, iva, rigaDocumento.getRDITotCosto());
} else {
addNotaDiCreditoSenzaPI(rigaDocumento.getIva(), imponibile, iva, rigaDocumento.getRDITotCosto());
}
} else if (!rigaDocumento.isRDINotaCredito()) {
addFatturaConPi(rigaDocumento.getIva(), imponibile, iva, rigaDocumento.getRDITotCosto());
} else {
addNotaDiCreditoConPI(rigaDocumento.getIva(), imponibile, iva, rigaDocumento.getRDITotCosto());
}
}
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_REGIME_MARGINE").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;
}
}

View file

@ -0,0 +1,112 @@
package com.ablia.contab.iva;
import com.ablia.anag.IvaInterface;
import com.ablia.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;
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) {
DoubleOperator dImponibile = new DoubleOperator(imponibile);
dImponibile.setScale(4, 5);
DoubleOperator dImposta = new DoubleOperator(imposta);
dImposta.setScale(2, 5);
if (getIva().getFlgTipo().equals("I")) {
if (getIva().getAliquotaIndetraibile() == 0L) {
dImponibile.add(getImponibile());
setImponibile(dImponibile.getResult());
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().equals("N") || getIva().getFlgTipo().equals("S") ||
getIva().getFlgTipo().equals("R")) {
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;
}
}

View file

@ -0,0 +1,127 @@
package com.ablia.contab.iva;
import com.ablia.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);
}
}

View file

@ -0,0 +1,137 @@
package com.ablia.contab.iva;
import com.ablia.anag.IvaInterface;
import com.ablia.fattele.FEDatiRiepilogoInterface;
import com.ablia.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;
}
}

View file

@ -0,0 +1,277 @@
package com.ablia.contab.iva;
import com.ablia.anag.Iva;
import com.ablia.anag.IvaInterface;
import com.ablia.contab.RigaDocumentoInterface;
import com.ablia.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 = new Iva(rigaDocumento.getApFull());
long l_id_ivaStdVendita = rigaDocumento.getApFull().getParm("CODICE_IVA_STD_VEND").getNumeroLong();
ivaStdVend.findByPrimaryKey(l_id_ivaStdVendita);
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;
}
}

View file

@ -0,0 +1,73 @@
package com.ablia.contab.servlet;
import com.ablia.contab.CausaleContabile;
import com.ablia.contab.CausaleContabileCR;
import com.ablia.contab.RigaCausaleContabile;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
import com.ablia.db.ResParm;
import com.ablia.servlet.AblServletSvlt;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(urlPatterns = {"/admin/contabConfig/CausaleContabile.abl"})
public class CausaleContabileSvlt extends AblServletSvlt {
private static final long serialVersionUID = -442960013744440571L;
protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {
CausaleContabile bbean = (CausaleContabile)bean;
req.setAttribute("list", new RigaCausaleContabile(getApFull(req)).findByCausaleContabile(bbean.getId_causaleContabile()));
}
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
protected DBAdapter getBean(HttpServletRequest req) {
return new CausaleContabile(getApFull(req));
}
protected CRAdapter getBeanCR(HttpServletRequest req) {
return new CausaleContabileCR(getApFull(req));
}
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {
super.prepareNewRecord(req, res);
}
public void _addConto(HttpServletRequest req, HttpServletResponse res) {
long id_causaleContabile = getRequestLongParameter(req, "id_causaleContabile");
long id_rigaCausaleContabile = getRequestLongParameter(req, "id_rigaCausaleContabile");
ResParm rp = new ResParm(true);
CausaleContabile bean = new CausaleContabile(getApFull(req));
bean.findByPrimaryKey(id_causaleContabile);
fillObject(req, bean);
rp = bean.save();
if (rp.getStatus()) {
RigaCausaleContabile rBean = new RigaCausaleContabile(getApFull(req));
rBean.findByPrimaryKey(id_rigaCausaleContabile);
fillObject(req, rBean);
rBean.setId_causaleContabile(bean.getId_causaleContabile());
rBean.save();
}
req.setAttribute("id_causaleContabile", Long.valueOf(bean.getId_causaleContabile()));
sendMessage(req, rp.getMsg());
showBean(req, res);
}
public void _modConto(HttpServletRequest req, HttpServletResponse res) {
long id_rigaCausaleContabile = getRequestLongParameter(req, "id_rigaCausaleContabile");
RigaCausaleContabile riga = new RigaCausaleContabile(getApFull(req));
riga.findByPrimaryKey(id_rigaCausaleContabile);
req.setAttribute("bean2", riga);
showBean(req, res);
}
public void _delConto(HttpServletRequest req, HttpServletResponse res) {
long id_rigaCausaleContabile = getRequestLongParameter(req, "id_rigaCausaleContabile");
RigaCausaleContabile riga = new RigaCausaleContabile(getApFull(req));
riga.findByPrimaryKey(id_rigaCausaleContabile);
ResParm rp = riga.delete();
sendMessage(req, rp.getMsg());
showBean(req, res);
}
}

View file

@ -0,0 +1,38 @@
package com.ablia.contab.servlet;
import com.ablia.anag.MagFisico;
import com.ablia.contab.CausaleMagazzino;
import com.ablia.contab.CausaleMagazzinoCR;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
import com.ablia.servlet.AblServletSvlt;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(urlPatterns = {"/admin/contabConfig/CausaleMagazzino.abl"})
public class CausaleMagazzinoSvlt extends AblServletSvlt {
private static final long serialVersionUID = 1L;
protected void addRows(HttpServletRequest req, HttpServletResponse res) {}
protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {
req.setAttribute("listaMagFisico", new MagFisico(getApFull(req)).findAll());
}
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {
req.setAttribute("listaMagFisico", new MagFisico(getApFull(req)).findAll());
}
protected DBAdapter getBean(HttpServletRequest req) {
return new CausaleMagazzino(getApFull(req));
}
protected CRAdapter getBeanCR(HttpServletRequest req) {
return new CausaleMagazzinoCR(getApFull(req));
}
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {
req.setAttribute("listaMagFisico", new MagFisico(getApFull(req)).findAll());
}
}

View file

@ -0,0 +1,81 @@
package com.ablia.contab.servlet;
import com.ablia.anag.Banca;
import com.ablia.anag.BancaCR;
import com.ablia.contab.DistintaRiba;
import com.ablia.contab.DistintaRibaCR;
import com.ablia.contab.DocumentoScadenza;
import com.ablia.contab.DocumentoScadenzaCR;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
import com.ablia.db.ResParm;
import com.ablia.servlet.AblServletSvlt;
import com.ablia.util.Vectumerator;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(urlPatterns = {"/admin/contab/DistintaRiba.abl"})
public class DistintaRibaSvlt extends AblServletSvlt {
private static final long serialVersionUID = -5831361296695092818L;
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
DistintaRiba bean = (DistintaRiba)beanA;
DocumentoScadenzaCR CR = new DocumentoScadenzaCR();
fillObject(req, CR);
req.setAttribute("listaBanche", new Banca(getApFull(req)).findByCR(new BancaCR(), 0, 0));
CR.setId_distintaRiba(bean.getId_distintaRiba());
Vectumerator<DocumentoScadenza> vec = new DocumentoScadenza(getApFull(req)).findByCR(CR, 0, 0);
if (CR.getFlgAccorpaScadenze() == 1L || bean.getFlgAccorpaScadenze() == 1L)
vec = bean.accorpaScadenze(vec);
req.setAttribute("listaScadenze", vec);
}
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
protected DBAdapter getBean(HttpServletRequest req) {
return new DistintaRiba(getApFull(req));
}
protected CRAdapter getBeanCR(HttpServletRequest req) {
return new DistintaRibaCR(getApFull(req));
}
protected void refresh(HttpServletRequest req, HttpServletResponse res) {
long id_distintaRiba = getRequestLongParameter(req, "id_distintaRiba");
DistintaRiba bean = new DistintaRiba(getApFull(req));
bean.findByPrimaryKey(id_distintaRiba);
fillComboAfterDetail(bean, req, res);
super.refresh(req, res);
}
public void _creaFile(HttpServletRequest req, HttpServletResponse res) {
long id_distintaRiba = getRequestLongParameter(req, "id_distintaRiba");
DistintaRiba bean = new DistintaRiba(getApFull(req));
bean.findByPrimaryKey(id_distintaRiba);
ResParm rp = bean.creaFile();
if (rp.getStatus()) {
req.setAttribute("retPath", rp.getMsg());
sendMessage(req, "File creato correttamente");
} else {
sendMessage(req, rp.getMsg());
}
showBean(req, res);
}
protected void print(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
try {
long l_id = getRequestLongParameter(req, "id_distintaRiba");
DistintaRiba bean = new DistintaRiba(apFull);
bean.findByPrimaryKey(l_id);
DistintaRibaCR CR = new DistintaRibaCR();
fillObject(req, CR);
CR.setId_distintaRiba(l_id);
sendPdf(res, bean.creaReportPdf(CR));
} catch (Exception e) {
e.printStackTrace();
}
}
}

View file

@ -0,0 +1,63 @@
package com.ablia.contab.servlet;
import com.ablia.anag.Iva;
import com.ablia.anag.TipoPagamento;
import com.ablia.anag.TipoPagamentoCR;
import com.ablia.anag.Users;
import com.ablia.anag.Vettore;
import com.ablia.contab.Documento;
import com.ablia.contab.RigaDocumento;
import com.ablia.contab.TipoDocumento;
import com.ablia.db.ApplParmFull;
import com.ablia.db.DBAdapter;
import com.ablia.db.ResParm;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(urlPatterns = {"/admin/contab/DocumentoOrd.abl"})
public class DocumentoOrdSvlt extends DocumentoSvlt {
protected String getBeanPageName(HttpServletRequest req) {
return "documento";
}
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
Documento bean = (Documento)beanA;
super.fillComboAfterDetail(beanA, req, res);
}
protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
ResParm rp = new ResParm(true);
return rp;
}
protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) {
req.setAttribute("id_tipoDocumento", String.valueOf(getId_docOrdine()));
return new ResParm(true);
}
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
req.setAttribute("nf4", getNf4());
req.setAttribute("listaOperatori",
new Users(apFull).findUsersByProfileMax(9L));
Documento bean = new Documento(apFull);
bean.setId_tipoDocumento(getId_docOrdine());
bean.setFlgStato(1L);
bean.setId_tipoPagamento(1L);
req.setAttribute("bean", bean);
req.setAttribute("listaTipoPagamento", new TipoPagamento(apFull)
.findByCR(new TipoPagamentoCR(), 0, 0));
req.setAttribute("listaVettore", new Vettore(apFull).findAll());
req.setAttribute("listaTipoDocumento",
new TipoDocumento(apFull).findAll());
req.setAttribute("listaIva", new Iva(apFull).findAll());
RigaDocumento bean2 = new RigaDocumento(apFull);
bean2.setId_iva(getParm("CODICE_IVA_STD_VEND").getNumeroLong());
req.setAttribute("bean2", bean2);
}
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
search(req, res);
}
}

View file

@ -0,0 +1,105 @@
package com.ablia.contab.servlet;
import com.ablia.anag.TipoPagamento;
import com.ablia.anag.TipoPagamentoCR;
import com.ablia.contab.DocumentoPagamento;
import com.ablia.contab.DocumentoPagamentoCR;
import com.ablia.contab.TipoDocumento;
import com.ablia.contab.TipoDocumentoCR;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
import com.ablia.db.ResParm;
import com.ablia.servlet.AblServletSvlt;
import com.ablia.util.StringTokenizer;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(urlPatterns = {"/admin/contab/DocumentoPagamento.abl"})
public class DocumentoPagamentoSvlt extends AblServletSvlt {
private static final long serialVersionUID = 1L;
protected void addRows(HttpServletRequest req, HttpServletResponse res) {}
protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {
req.setAttribute("listaTipiPagamento", new TipoPagamento(getApFull(req)).findByCR(new TipoPagamentoCR(), 0, 0));
}
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
req.setAttribute("listaTipiPagamento", new TipoPagamento(apFull).findByCR(new TipoPagamentoCR(), 0, 0));
req.setAttribute("listaTipoDocumento", new TipoDocumento(apFull).findByCR(new TipoDocumentoCR(), 0, 0));
req.setAttribute("listaRiferimenti", new TipoDocumento(apFull).findRiferimenti());
}
protected DBAdapter getBean(HttpServletRequest req) {
return new DocumentoPagamento(getApFull(req));
}
protected CRAdapter getBeanCR(HttpServletRequest req) {
return new DocumentoPagamentoCR(getApFull(req));
}
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {
req.setAttribute("listaTipiPagamento", new TipoPagamento(getApFull(req)).findByCR(new TipoPagamentoCR(), 0, 0));
DocumentoPagamento bean = new DocumentoPagamento(getApFull(req));
bean.setId_documento(getRequestLongParameter(req, "id_documento"));
req.setAttribute("bean", bean);
}
public void _loadLista(HttpServletRequest req, HttpServletResponse res) {
long id_clifor = getRequestLongParameter(req, "id_clifor");
req.setAttribute("listaPagamenti",
new DocumentoPagamento(getApFull(req)).findByClifor(id_clifor, 1L));
setJspPageRelative("/documentoPagamentoList.jsp", req);
callJsp(req, res);
}
public void _savePagamenti(HttpServletRequest req, HttpServletResponse res) {
String listaDocumenti = getRequestParameter(req, "listaDocumenti");
StringTokenizer st = new StringTokenizer(listaDocumenti, "|");
DocumentoPagamento dp = null;
while (st.hasMoreTokens()) {
String documento = st.nextToken();
StringTokenizer stDocumento = new StringTokenizer(documento, ",");
long id_documento = Long.valueOf(stDocumento.getToken(0));
double importo = Double.valueOf(stDocumento.getToken(1));
long flgStatoTipoIncasso = Long.valueOf(stDocumento.getToken(2));
dp = new DocumentoPagamento(getApFull(req));
fillObject(req, dp);
dp.setId_documento(id_documento);
dp.setFlgTipoMovimento(2L);
dp.setImporto(importo);
dp.setFlgTipoIncasso(flgStatoTipoIncasso);
dp.save();
}
req.setAttribute("id_tipoPagamento", "0");
search(req, res);
}
protected String getBeanPageName(HttpServletRequest req) {
if (getAct(req).toLowerCase().equals("ins"))
return String.valueOf(super.getBeanPageName(req)) + getAct(req);
return super.getBeanPageName(req);
}
public void _printReport(HttpServletRequest req, HttpServletResponse res) {
DocumentoPagamento bean = new DocumentoPagamento(getApFull(req));
DocumentoPagamentoCR CR = new DocumentoPagamentoCR(getApFull(req));
CR = (DocumentoPagamentoCR)req.getSession().getAttribute(getATTR_CRBEAN(req));
sendPdf(res, bean.creaReportPdf(CR));
}
protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) {
DocumentoPagamentoCR CR = new DocumentoPagamentoCR(getApFull(req));
fillObject(req, CR);
if (CR.getId_clifor() > 0L)
if (CR.getClifor().getFlgTipo().equals("C")) {
req.setAttribute("flgClienteFornitore", "C");
} else {
req.setAttribute("flgClienteFornitore", "F");
}
return super.beforeSearch(req, res);
}
}

View file

@ -0,0 +1,218 @@
package com.ablia.contab.servlet;
import com.ablia.anag.Iva;
import com.ablia.anag.TipoPagamento;
import com.ablia.anag.TipoPagamentoCR;
import com.ablia.anag.Users;
import com.ablia.anag.Vettore;
import com.ablia.contab.Documento;
import com.ablia.contab.DocumentoCR;
import com.ablia.contab.RigaDocumento;
import com.ablia.contab.TipoDocumento;
import com.ablia.db.ApplParmFull;
import com.ablia.db.DBAdapter;
import com.ablia.db.ResParm;
import com.ablia.util.Vectumerator;
import java.sql.Date;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(urlPatterns = {"/admin/contab/DocumentoPre.abl"})
public class DocumentoPreSvlt extends DocumentoSvlt {
private static final long serialVersionUID = -3181095019824437439L;
protected String getBeanPageName(HttpServletRequest req) {
if (getCmd(req).equals("search"))
return "documentoPre";
return "documento";
}
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
super.fillComboAfterDetail(beanA, req, res);
}
protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
ResParm rp = new ResParm(true);
return rp;
}
protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) {
if (getRequestLongParameter(req, "flgTipologia") == 0L)
req.setAttribute("flgStatoPrenotazione", Integer.valueOf(200));
req.setAttribute("flgTipologia", Integer.valueOf(4));
return new ResParm(true);
}
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
req.setAttribute("nf4", getNf4());
req.setAttribute("listaOperatori", new Users(apFull).findUsersByProfileMax(9L));
Documento bean = new Documento(apFull);
bean.setId_tipoDocumento(getId_docPrenotazione());
bean.setFlgStato(1L);
bean.setId_tipoPagamento(1L);
req.setAttribute("bean", bean);
req.setAttribute("listaTipoPagamento", new TipoPagamento(apFull).findByCR(new TipoPagamentoCR(), 0, 0));
req.setAttribute("listaVettore", new Vettore(apFull).findAll());
req.setAttribute("listaTipoDocumento", new TipoDocumento(apFull).findAll());
req.setAttribute("listaIva", new Iva(apFull).findAll());
RigaDocumento bean2 = new RigaDocumento(apFull);
bean2.setId_iva(getParm("CODICE_IVA_STD_VEND").getNumeroLong());
req.setAttribute("bean2", bean2);
}
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
super.otherCommands(req, res);
}
public void _annAssPren(HttpServletRequest req, HttpServletResponse res) {
RigaDocumento row = new RigaDocumento(getApFull(req));
long l_id = getRequestLongParameter(req, "id_rigaDocumento");
row.findByPrimaryKey(l_id);
row.setFlgPrenotazioneArrivata(0L);
ResParm rp = row.save();
rp.append(row.getDocumento().aggiornaStatoPrenotazione(row.getDocumento().getFlgStatoPrenotazione(),
0L));
if (rp.getStatus()) {
sendMessage(req, "Prenotazione riga aggiornata con successo!");
} else {
sendMessage(req, rp.getMsg());
}
showBean(req, res);
}
public void _annullaSlip(HttpServletRequest req, HttpServletResponse res) {
RigaDocumento row = new RigaDocumento(getApFull(req));
long l_id = getRequestLongParameter(req, "id_rigaDocumento");
row.findByPrimaryKey(l_id);
row.setQtaSlipStampate(0L);
ResParm rp = row.save();
rp.append(row.getDocumento().aggiornaStatoPrenotazione(row.getDocumento().getFlgStatoPrenotazione(),
0L));
if (rp.getStatus()) {
sendMessage(req, "Stampa slip azzerata. Prenotazione riga aggiornata con successo!");
} else {
sendMessage(req, rp.getMsg());
}
showBean(req, res);
}
protected void XXXXotherCommands(HttpServletRequest req, HttpServletResponse res) {
if (getCmd(req).equals("aggionraSRCR")) {
Documento bean = null;
long l_id = getRequestLongParameter(req, "id_documento");
bean = new Documento(getApFull(req));
bean.findByPrimaryKey(l_id);
long l_flgStatoRiparazione = getRequestLongParameter(req, "flgStatoRiparazioneS");
ResParm rp = new ResParm();
if (bean.getDBState() == 0) {
rp.setStatus(false);
rp.setMsg("Errore! Codice documento non valido");
} else {
rp = bean.aggiornaStatoRiparazione(l_flgStatoRiparazione);
}
if (rp.getStatus()) {
sendMessage(req, "Stato Riparazione aggiornato.");
} else {
sendMessage(req, rp.getMsg());
}
search(req, res);
} else if (getCmd(req).equals("inviaAvviso")) {
Documento bean = null;
long l_id = getRequestLongParameter(req, "id_documento");
bean = new Documento(getApFull(req));
bean.findByPrimaryKey(l_id);
ResParm rp = new ResParm();
if (bean.getDBState() == 0) {
rp.setStatus(false);
rp.setMsg("Errore! Codice documento non valido");
} else {
rp = bean.inviaAvviso();
}
if (rp.getStatus()) {
sendMessage(req, "Avviso inviato correttamente.");
} else {
sendMessage(req, rp.getMsg());
}
search(req, res);
} else if (getCmd(req).equals("annAssPren")) {
RigaDocumento row = new RigaDocumento(getApFull(req));
long l_id = getRequestLongParameter(req, "id_rigaDocumento");
row.findByPrimaryKey(l_id);
row.setFlgPrenotazioneArrivata(0L);
ResParm rp = row.save();
rp.append(row.getDocumento().aggiornaStatoPrenotazione(row.getDocumento().getFlgStatoPrenotazione(),
0L));
if (rp.getStatus()) {
sendMessage(req, "Prenotazione riga aggiornata con successo!");
} else {
sendMessage(req, rp.getMsg());
}
showBean(req, res);
} else if (getCmd(req).equals("annullaSlip")) {
RigaDocumento row = new RigaDocumento(getApFull(req));
long l_id = getRequestLongParameter(req, "id_rigaDocumento");
row.findByPrimaryKey(l_id);
row.setQtaSlipStampate(0L);
ResParm rp = row.save();
rp.append(row.getDocumento().aggiornaStatoPrenotazione(row.getDocumento().getFlgStatoPrenotazione(),
0L));
if (rp.getStatus()) {
sendMessage(req, "Stampa slip azzerata. Prenotazione riga aggiornata con successo!");
} else {
sendMessage(req, rp.getMsg());
}
showBean(req, res);
} else {
super.otherCommands(req, res);
}
}
public void _addRestituzioneAcconto(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
ResParm rp = new ResParm(true);
long id_documento = getRequestLongParameter(req, "id_documento");
Date dataRestituzione = getRequestDateParameter(req, "dataRestituzioneAcconto");
DocumentoCR CR = new DocumentoCR(apFull);
fillObject(req, CR);
req.setAttribute("CR", CR);
req.setAttribute("cmd", "search");
if (id_documento > 0L) {
Documento bean = new Documento(apFull);
bean.findByPrimaryKey(id_documento);
bean.setDataRestituzioneAcconto(dataRestituzione);
rp = bean.aggiornaStatoPrenotazione(bean.getFlgStatoPrenotazione(), 100L);
} else {
rp = new ResParm(false, "ERRORE! Id documento non valido!");
}
sendMessage(req, rp.getMsg());
search(req, res);
}
public void _creaReportCsvPrenotazioni(HttpServletRequest req, HttpServletResponse res) {
DocumentoCR CR = (DocumentoCR)req.getSession().getAttribute("CRdocumentoPre");
Documento bean = new Documento(getApFull(req));
bean.creaFileCvsPrenotazioni(CR);
sendHtmlMsgResponse(req, res, "<a href='../../" + CR.getFileName() + "' target='_blank'>File export in formato cvs (Excel)</a>");
}
protected void search(HttpServletRequest req, HttpServletResponse res) {
DocumentoCR CR = new DocumentoCR(getApFull(req));
fillObject(req, CR);
if (CR.getFlgReport().equals("S")) {
req.getSession().setAttribute("CRdocumentoPre", CR);
if (CR.getFlgStatoPrenotazioneArt() > -1L) {
Documento bean = new Documento(getApFull(req));
Vectumerator<Documento> vec = bean.findPrenotazioniByCR(CR);
req.setAttribute("list", vec);
req.setAttribute("CR", CR);
callJsp(req, res);
} else {
super.search(req, res);
}
} else {
super.search(req, res);
}
}
}

View file

@ -0,0 +1,140 @@
package com.ablia.contab.servlet;
import com.ablia.anag.Iva;
import com.ablia.anag.TipoPagamento;
import com.ablia.anag.TipoPagamentoCR;
import com.ablia.anag.Users;
import com.ablia.anag.Vettore;
import com.ablia.contab.Documento;
import com.ablia.contab.DocumentoCR;
import com.ablia.contab.RigaDocumento;
import com.ablia.contab.TipoAllegatoDocumento;
import com.ablia.contab.TipoDocumento;
import com.ablia.db.ApplParmFull;
import com.ablia.db.DBAdapter;
import com.ablia.db.ResParm;
import com.ablia.util.AbMessages;
import com.ablia.util.Vectumerator;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(urlPatterns = {"/admin/contab/DocumentoRip.abl"})
public class DocumentoRipSvlt extends DocumentoSvlt {
private static final long serialVersionUID = 6122990489236236941L;
protected String getBeanPageName(HttpServletRequest req) {
return "documentoRip";
}
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
Documento bean = (Documento)beanA;
int ordineInverso = (bean.getTipoDocumento().getFlgOrdinamentoRigheEdit() == 1L) ? 1 : 0;
Vectumerator<RigaDocumento> vec = bean.findRigheDocumento(1, 1, ordineInverso);
if (vec.hasMoreElements()) {
RigaDocumento bean2 = (RigaDocumento)vec.nextElement();
req.setAttribute("bean2", bean2);
}
req.setAttribute("listaDocGen", bean.getTipoDocumento().findDocGen(1L, 0, 0));
req.setAttribute("listaOperatori", new Users(apFull).findUsersByFlgOperatore());
req.setAttribute("listaDocFigli", bean.findDocumentiFiglio());
req.setAttribute("listaDocPadri", bean.findDocumentiPadre());
if (bean.getTipoDocumento().getFlgAllegato() == 1L) {
req.setAttribute("listaTipiAllegatoDocumento", new TipoAllegatoDocumento(apFull).findAll());
req.setAttribute("listaAllegati", bean.getAllegati(0L));
}
req.setAttribute("listaIva", new Iva(apFull).findAll());
}
protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
Documento bean = (Documento)beanA;
RigaDocumento row = new RigaDocumento(getApFull(req));
ResParm rp = new ResParm(true);
if (bean.getId_documento() != 0L) {
fillObject(req, row);
System.out.println(getRequestParameter(req, "flgReso"));
rp = Documento.addRigaDocumento(bean, row);
return bean.save();
}
return rp;
}
protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) {
req.setAttribute("id_tipoDocumento", String.valueOf(getId_docRiparazione()));
return new ResParm(true);
}
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
req.setAttribute("nf4", getNf4());
req.setAttribute("listaOperatori", new Users(apFull).findUsersByProfileMax(9L));
Documento bean = new Documento(apFull);
bean.setId_tipoDocumento(getId_docRiparazione());
bean.setFlgStato(1L);
bean.setId_tipoPagamento(1L);
req.setAttribute("bean", bean);
req.setAttribute("listaTipoPagamento", new TipoPagamento(apFull).findByCR(new TipoPagamentoCR(), 0, 0));
req.setAttribute("listaVettore", new Vettore(apFull).findAll());
req.setAttribute("listaTipoDocumento", new TipoDocumento(apFull).findAll());
req.setAttribute("listaIva", new Iva(apFull).findAll());
RigaDocumento bean2 = new RigaDocumento(apFull);
bean2.setId_iva(getParm("CODICE_IVA_STD_VEND").getNumeroLong());
req.setAttribute("bean2", bean2);
}
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
super.otherCommands(req, res);
}
protected void afterCreaDocFigli(HttpServletRequest req, HttpServletResponse res, Documento bean, long l_id_tipoDocumentoFiglio) {
TipoDocumento td = new TipoDocumento(getApFull(req));
td.findByPrimaryKey(l_id_tipoDocumentoFiglio);
if (td.getFlgClienteFornitore().equals("F")) {
bean.setFlgStatoRiparazione(1L);
} else {
bean.setFlgStatoRiparazione(99L);
bean.setDataChiusura(DBAdapter.getToday());
}
bean.save();
sendMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_OK"));
}
public void _aggionraSRCR(HttpServletRequest req, HttpServletResponse res) {
Documento bean = null;
long l_id = getRequestLongParameter(req, "id_documento");
bean = new Documento(getApFull(req));
bean.findByPrimaryKey(l_id);
long l_flgStatoRiparazione = getRequestLongParameter(req, "flgStatoRiparazioneS");
ResParm rp = new ResParm();
if (bean.getDBState() == 0) {
rp.setStatus(false);
rp.setMsg("Errore! Codice documento non valido");
} else {
rp = bean.aggiornaStatoRiparazione(l_flgStatoRiparazione);
}
if (rp.getStatus()) {
sendMessage(req, "Stato Riparazione aggiornato.");
} else {
sendMessage(req, rp.getMsg());
}
search(req, res);
}
public void _vediRientri(HttpServletRequest req, HttpServletResponse res) {
long l_id = getRequestLongParameter(req, "id_rigaDocumento");
RigaDocumento bean2 = new RigaDocumento(getApFull(req));
bean2.findByPrimaryKey(l_id);
req.setAttribute("list", new Documento(getApFull(req)).findRientri(bean2.getSeriale()));
req.setAttribute("bean2", bean2);
setJspPageRelative("rientriView.jsp", req);
callJsp(req, res);
}
public void _creaReportCsvRiparazioni(HttpServletRequest req, HttpServletResponse res) {
DocumentoCR CR = (DocumentoCR)req.getSession().getAttribute(getATTR_CRBEAN(req));
Documento bean = new Documento(getApFull(req));
bean.creaFileCvsRiparazioni(CR);
sendHtmlMsgResponse(req, res, "<a href='../../" + CR.getFileName() + "' target='_blank'>File export in formato cvs (Excel)</a>");
}
}

View file

@ -0,0 +1,81 @@
package com.ablia.contab.servlet;
import com.ablia.anag.Banca;
import com.ablia.contab.DistintaRiba;
import com.ablia.contab.DocumentoScadenza;
import com.ablia.contab.DocumentoScadenzaCR;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import com.ablia.db.ResParm;
import com.ablia.util.Vectumerator;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class DocumentoScadenzaAutoComboSvlt extends DocumentoScadenzaAutoOrdSvlt {
protected String getBeanPageName(HttpServletRequest req) {
return "documentoScadenzaAutoCombo";
}
protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) {
Vectumerator<Banca> vecBanca;
ApplParmFull apFull = getApFull(req);
long timestampElaborazione = getRequestLongParameter(req, "timestampElaborazione");
Vectumerator<DistintaRiba> vec = new Vectumerator();
if (timestampElaborazione > 0L) {
Banca banca = new Banca(apFull);
banca.resetPresentazioneRibaAuto();
vecBanca = new Banca(apFull).findByOrdine();
} else {
vecBanca = new Banca(apFull).findByOrdineVisibili();
}
vecBanca.moveFirst();
while (vecBanca.hasMoreElements()) {
Banca banca = (Banca)vecBanca.nextElement();
DistintaRiba dr = new DistintaRiba(apFull);
if (timestampElaborazione > 0L)
dr.findDistintaByTimestampBanca(timestampElaborazione, banca.getId_banca());
dr.setId_banca(banca.getId_banca());
dr.setTimestampElaborazione(timestampElaborazione);
double importo = getRequestDoubleParameter(req, "distinta_" + banca.getId_banca());
dr.setImportoManuale(importo);
if (timestampElaborazione == 0L || dr.getId_distintaRiba() > 0L) {
banca.addBancaAPresentazioneRibaAuto();
vec.add(dr);
}
}
req.setAttribute("listaBanche", vec);
req.setAttribute("listaBancheNonVis", new Banca(apFull).findNonVisibili());
req.setAttribute("listaEstrazioni", new DistintaRiba(apFull).findDistinte());
}
public void _init(HttpServletRequest req, HttpServletResponse res) {
Banca banca = new Banca(getApFull());
banca.resetPresentazioneRibaAuto();
fillComboAfterSearch(getBeanCR(req), req, res);
showBean(req, res);
}
public void _rimuoviBancaDaDistinta(HttpServletRequest req, HttpServletResponse res) {
long id_banca = getRequestLongParameter(req, "id_banca");
Banca banca = new Banca(getApFull());
banca.findByPrimaryKey(id_banca);
ResParm rp = banca.rimuoviBancaAPresentazioneRibaAuto();
DocumentoScadenza bean = new DocumentoScadenza(getApFull(req));
DocumentoScadenzaCR CR = new DocumentoScadenzaCR(getApFull());
fillObject(req, CR);
CR.setFlgDaEstrarre(1L);
CR.setFlgSoloRiba(1L);
double tot = bean.getTotaleScadenzeByCR(CR);
sendMessage(req, rp.getMsg());
search(req, res);
}
public void _addBancaADistinta(HttpServletRequest req, HttpServletResponse res) {
long id_banca = getRequestLongParameter(req, "id_bancaDaAggungere");
Banca banca = new Banca(getApFull());
banca.findByPrimaryKey(id_banca);
ResParm rp = banca.addBancaAPresentazioneRibaAuto();
sendMessage(req, rp.getMsg());
search(req, res);
}
}

View file

@ -0,0 +1,184 @@
package com.ablia.contab.servlet;
import com.ablia.anag.Banca;
import com.ablia.anag.BancaCR;
import com.ablia.contab.DistintaRiba;
import com.ablia.contab.DistintaRibaCR;
import com.ablia.contab.DocumentoScadenza;
import com.ablia.contab.DocumentoScadenzaCR;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
import com.ablia.db.ResParm;
import com.ablia.servlet.AblServletSvlt;
import com.ablia.util.HashMapUtil;
import com.ablia.util.Vectumerator;
import java.util.HashMap;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(urlPatterns = {"/admin/contab/DocumentoScadenzaAuto.abl"})
public class DocumentoScadenzaAutoOrdSvlt extends AblServletSvlt {
private static final long serialVersionUID = -7830020471332013441L;
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {}
protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
long timestampElaborazione = getRequestLongParameter(req, "timestampElaborazione");
Vectumerator<DistintaRiba> vec = new Vectumerator();
Vectumerator<Banca> vecBanca = new Banca(apFull).findByOrdine();
vecBanca.moveFirst();
while (vecBanca.hasMoreElements()) {
Banca banca = (Banca)vecBanca.nextElement();
DistintaRiba dr = new DistintaRiba(apFull);
if (timestampElaborazione > 0L)
dr.findDistintaByTimestampBanca(timestampElaborazione, banca.getId_banca());
dr.setId_banca(banca.getId_banca());
dr.setTimestampElaborazione(timestampElaborazione);
double importo = getRequestDoubleParameter(req, "distinta_" + banca.getId_banca());
dr.setImportoManuale(importo);
vec.add(dr);
}
req.setAttribute("listaBanche", vec);
req.setAttribute("listaEstrazioni", new DistintaRiba(apFull).findDistinte());
}
protected DBAdapter getBean(HttpServletRequest req) {
return new DocumentoScadenza(getApFull(req));
}
protected CRAdapter getBeanCR(HttpServletRequest req) {
return new DocumentoScadenzaCR(getApFull(req));
}
public void _creaDistinta(HttpServletRequest req, HttpServletResponse res) {
DocumentoScadenza bean = new DocumentoScadenza(getApFull(req));
DocumentoScadenzaCR CR = new DocumentoScadenzaCR(getApFull());
fillObject(req, CR);
CR.setFlgDaEstrarre(1L);
CR.setFlgSoloRiba(1L);
CR.setFlgOrderImporto(1L);
System.out.println("_creaDistinta");
Vectumerator<Banca> vecRiba = new Vectumerator();
Vectumerator<Banca> vec = new Banca(getApFull(req)).findByOrdine();
while (vec.hasMoreElements()) {
Banca row = (Banca)vec.nextElement();
double importo = getRequestDoubleParameter(req, "distinta_" + row.getId_banca());
if (importo > 0.0D) {
System.out.println(String.valueOf(row.getId_banca()) + " - " + row.getDescrizione() + " " + importo);
row.setImportoRiba(importo);
vecRiba.add(row);
}
}
CR.setVecRiba(vecRiba);
bean.creaDistinte(CR);
req.setAttribute("timestampElaborazione", Long.valueOf(CR.getTimestampElaborazione()));
req.setAttribute("CR", CR);
search(req, res);
}
public void _eliminaDistinta(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
long id_distintaRiba = getRequestLongParameter(req, "id_distintaRiba");
DocumentoScadenzaCR CR = new DocumentoScadenzaCR(apFull);
fillObject(req, CR);
DistintaRiba distinta = new DistintaRiba(apFull);
distinta.findByPrimaryKey(id_distintaRiba);
req.setAttribute("timestampElaborazione", Long.valueOf(distinta.getTimestampElaborazione()));
ResParm rp = distinta.delete();
req.setAttribute("CR", CR);
sendMessage(req, rp.getMsg());
search(req, res);
}
public void _selezionaScadenza(HttpServletRequest req, HttpServletResponse res) {
long id_documentoScadenza = getRequestLongParameter(req, "id_documentoScadenza");
DocumentoScadenza documentoScadenza = new DocumentoScadenza(getApFull(req));
documentoScadenza.findByPrimaryKey(id_documentoScadenza);
documentoScadenza.setFlgScadenzaSelezionata(1L);
documentoScadenza.save();
}
public void _deselezionaScadenza(HttpServletRequest req, HttpServletResponse res) {
long id_documentoScadenza = getRequestLongParameter(req, "id_documentoScadenza");
DocumentoScadenza documentoScadenza = new DocumentoScadenza(getApFull(req));
documentoScadenza.findByPrimaryKey(id_documentoScadenza);
documentoScadenza.setFlgScadenzaSelezionata(0L);
documentoScadenza.save();
}
protected String getBeanPageName(HttpServletRequest req) {
return "documentoScadenzaAutoOrd";
}
protected boolean isSimpleServlet(HttpServletRequest req) {
return true;
}
public void _recuperaTotale(HttpServletRequest req, HttpServletResponse res) {
DocumentoScadenza bean = new DocumentoScadenza(getApFull(req));
DocumentoScadenzaCR CR = new DocumentoScadenzaCR(getApFull());
fillObject(req, CR);
CR.setFlgDaEstrarre(1L);
CR.setFlgSoloRiba(1L);
double tot = bean.getTotaleScadenzeByCR(CR);
sendHtmlMsgResponse(req, res, getNf().format(tot));
}
protected void print(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
try {
long l_id = getRequestLongParameter(req, "id_distintaRiba");
DistintaRiba bean = new DistintaRiba(apFull);
bean.findByPrimaryKey(l_id);
DistintaRibaCR CR = new DistintaRibaCR();
fillObject(req, CR);
CR.setId_distintaRiba(l_id);
sendPdf(res, bean.creaReportPdf(CR));
} catch (Exception e) {
e.printStackTrace();
}
}
public void _creaDistintaxx(HttpServletRequest req, HttpServletResponse res) {
DocumentoScadenza bean = new DocumentoScadenza(getApFull(req));
DocumentoScadenzaCR CR = new DocumentoScadenzaCR(getApFull());
fillObject(req, CR);
CR.setFlgDaEstrarre(1L);
CR.setFlgSoloRiba(1L);
CR.setFlgOrderImporto(1L);
HashMap<Long, Double> hm = new HashMap<>();
Vectumerator<Banca> vec = new Banca(getApFull(req)).findByCR(new BancaCR(), 0, 0);
while (vec.hasMoreElements()) {
Banca banca = (Banca)vec.nextElement();
double importo = getRequestDoubleParameter(req, "distinta_" + banca.getId_banca());
if (importo > 0.0D)
hm.put(Long.valueOf(banca.getId_banca()), Double.valueOf(importo));
}
hm = (HashMap<Long, Double>)HashMapUtil.sortReverseByValue(hm);
bean.creaDistinte(CR);
req.setAttribute("timestampElaborazione", Long.valueOf(CR.getTimestampElaborazione()));
req.setAttribute("CR", CR);
showBean(req, res);
}
public void _bancaMeno(HttpServletRequest req, HttpServletResponse res) {
long id_banca = getRequestLongParameter(req, "id_banca");
Banca banca = new Banca(getApFull());
banca.findByPrimaryKey(id_banca);
ResParm rp = banca.settaOrdineMeno();
sendMessage(req, rp.getMsg());
search(req, res);
}
public void _bancaPiu(HttpServletRequest req, HttpServletResponse res) {
long id_banca = getRequestLongParameter(req, "id_banca");
Banca banca = new Banca(getApFull());
banca.findByPrimaryKey(id_banca);
ResParm rp = banca.settaOrdinePiu();
sendMessage(req, rp.getMsg());
search(req, res);
}
}

View file

@ -0,0 +1,88 @@
package com.ablia.contab.servlet;
import com.ablia.anag.Banca;
import com.ablia.anag.BancaCR;
import com.ablia.contab.DistintaRiba;
import com.ablia.contab.DistintaRibaCR;
import com.ablia.contab.DocumentoScadenza;
import com.ablia.contab.DocumentoScadenzaCR;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
import com.ablia.db.ResParm;
import com.ablia.servlet.AblServletSvlt;
import com.ablia.util.StringTokenizer;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(urlPatterns = {"/admin/contab/DocumentoScadenza.abl"})
public class DocumentoScadenzaSvlt extends AblServletSvlt {
private static final long serialVersionUID = -7830020471332013441L;
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {}
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {
req.setAttribute("listaBanche", new Banca(getApFull(req)).findByCR(new BancaCR(), 0, 0));
}
protected DBAdapter getBean(HttpServletRequest req) {
return new DocumentoScadenza(getApFull(req));
}
protected CRAdapter getBeanCR(HttpServletRequest req) {
return new DocumentoScadenzaCR(getApFull(req));
}
public void _creaDistinta(HttpServletRequest req, HttpServletResponse res) {
String scadenzeSelezionate = req.getParameter("scadenzeSelezionate");
StringTokenizer st = new StringTokenizer(scadenzeSelezionate, ";");
DocumentoScadenza documentoScadenza = new DocumentoScadenza(getApFull(req));
DistintaRibaCR CR = new DistintaRibaCR();
fillObject(req, CR);
DistintaRiba distinta = new DistintaRiba(getApFull(req));
fillObject(req, distinta);
distinta.setFlgStatoDistinta(0L);
ResParm rp = distinta.save();
if (rp.getStatus())
while (st.hasMoreTokens()) {
String s = st.nextToken();
if (!s.isEmpty()) {
documentoScadenza = new DocumentoScadenza(getApFull(req));
documentoScadenza.findByPrimaryKey(Long.valueOf(s));
documentoScadenza.setFlgScadenzaSelezionata(0L);
documentoScadenza.setId_distintaRiba(distinta.getId_distintaRiba());
documentoScadenza.save();
}
}
search(req, res);
}
public void _selezionaScadenza(HttpServletRequest req, HttpServletResponse res) {
long id_documentoScadenza = getRequestLongParameter(req, "id_documentoScadenza");
DocumentoScadenza documentoScadenza = new DocumentoScadenza(getApFull(req));
documentoScadenza.findByPrimaryKey(id_documentoScadenza);
documentoScadenza.setFlgScadenzaSelezionata(1L);
documentoScadenza.save();
}
public void _deselezionaScadenza(HttpServletRequest req, HttpServletResponse res) {
long id_documentoScadenza = getRequestLongParameter(req, "id_documentoScadenza");
DocumentoScadenza documentoScadenza = new DocumentoScadenza(getApFull(req));
documentoScadenza.findByPrimaryKey(id_documentoScadenza);
documentoScadenza.setFlgScadenzaSelezionata(0L);
documentoScadenza.save();
}
protected void print(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
DocumentoScadenza bean = new DocumentoScadenza(apFull);
try {
DocumentoScadenzaCR CR = new DocumentoScadenzaCR();
fillObject(req, CR);
sendPdf(res, bean.creaListaScadenzePdf(CR));
} catch (Exception e) {
e.printStackTrace();
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,104 @@
package com.ablia.contab.servlet;
import com.ablia.anag._AnagAdapter;
import com.ablia.contab.Documento;
import com.ablia.db.DBAdapter;
import com.ablia.reg.EcDc;
import com.ablia.servlet.AcServlet;
import java.io.File;
import java.io.FileInputStream;
import java.sql.Time;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class GetFileSvlt extends AcServlet {
private static final long serialVersionUID = 1L;
protected void callJsp(HttpServletRequest req, HttpServletResponse res) {
File theFile = null;
FileInputStream fis = null;
try {
if (checkProfile(req, res)) {
Documento doc = new Documento(getApFull(req));
String id = getIdDocumento(req, res);
doc.findByPrimaryKey(Long.valueOf(id));
String fileName = String.valueOf(getDocBase()) + doc.getPathTmp() + getFileName(req, res);
String ext = fileName.substring(fileName.lastIndexOf('.') + 1, fileName.length());
if (ext.toLowerCase().equals("html") || ext.toLowerCase().equals("jsp") || ext.toLowerCase().equals("php")) {
String thePage = String.valueOf(req.getContextPath()) + fileName;
setJspPage(thePage, req);
res.sendRedirect(getJspPage(req));
} else {
fileName = doc.getPathStampaDocumentoFull();
ext = fileName.substring(fileName.lastIndexOf('.') + 1, fileName.length());
theFile = new File(fileName);
res.setContentType("application/" + ext);
if (theFile.exists()) {
if (doc.getDBState() == 1) {
doc.setDataDownload(DBAdapter.getToday());
doc.setOraDownload(new Time(DBAdapter.getTimestamp().getTime()));
doc.setIpDownload(req.getRemoteAddr());
doc.setFlgDownload(1L);
doc.save();
}
fis = new FileInputStream(theFile);
byte[] temp = new byte[1024];
int nByte = 0;
ServletOutputStream sos = res.getOutputStream();
while ((nByte = fis.read(temp)) != -1)
sos.write(temp, 0, nByte);
sos.flush();
fis.close();
sos.close();
} else if (useAlwaysSendRedirect()) {
String absPage = getFileNotFoundJsp(req, res).startsWith("/") ? (
String.valueOf(req.getContextPath()) + getFileNotFoundJsp(req, res)) : (
String.valueOf(req.getContextPath()) + "/" + getFileNotFoundJsp(req, res));
res.sendRedirect(absPage);
} else {
setJspPage(getFileNotFoundJsp(req, res), req);
res.sendRedirect(getJspPage(req));
}
}
} else {
setJspPage(getFileNotFoundJsp(req, res), req);
res.sendRedirect(getJspPage(req));
}
} catch (Exception e) {
e.printStackTrace();
} finally {
theFile = null;
if (fis != null)
fis = null;
}
}
protected String getFileName(HttpServletRequest req, HttpServletResponse res) {
String fileName = getRequestParameter(req, "id");
fileName = EcDc.decodeDizionario(fileName, _AnagAdapter.KEY_ENCODE_DIZ);
return fileName;
}
protected String getIdDocumento(HttpServletRequest req, HttpServletResponse res) {
String id = getRequestParameter(req, "id2");
id = EcDc.decodeDizionario(id, _AnagAdapter.KEY_ENCODE_DIZ);
return id;
}
protected String getFileNotFoundJsp(HttpServletRequest req, HttpServletResponse res) {
return "/fileNotFound.jsp";
}
protected boolean checkProfile(HttpServletRequest req, HttpServletResponse res) {
return true;
}
protected void processRequest(HttpServletRequest request, HttpServletResponse response) {
callJsp(request, response);
}
protected boolean isSecureServlet(HttpServletRequest req) {
return false;
}
}

View file

@ -0,0 +1,20 @@
package com.ablia.contab.servlet;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(urlPatterns = {"/admin/contab/GetIva.pdf"})
public class GetIvaSvlt extends com.ablia.servlet.GetFileSvlt {
protected String getUploadPath() {
return getParm("PATH_TMP").getTesto();
}
protected String getFileName(HttpServletRequest req, HttpServletResponse res) {
return String.valueOf(getDocBase()) + getUploadPath() + super.getFileName(req, res);
}
protected boolean checkProfile(HttpServletRequest req, HttpServletResponse res) {
return super.checkProfile(req, res);
}
}

View file

@ -0,0 +1,33 @@
package com.ablia.contab.servlet;
import com.ablia.contab.IncassoPagamento;
import com.ablia.contab.IncassoPagamentoCR;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
import com.ablia.servlet.AblServletSvlt;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(urlPatterns = {"/admin/contab/IncassoPagamento.abl"})
public class IncassoPagamentoSvlt extends AblServletSvlt {
private static final long serialVersionUID = 1L;
protected void addRows(HttpServletRequest req, HttpServletResponse res) {}
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {}
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
protected DBAdapter getBean(HttpServletRequest req) {
return new IncassoPagamento(getApFull(req));
}
protected CRAdapter getBeanCR(HttpServletRequest req) {
return new IncassoPagamentoCR(getApFull(req));
}
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {}
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {}
}

View file

@ -0,0 +1,195 @@
package com.ablia.contab.servlet;
import com.ablia.anag.Esercizio;
import com.ablia.anag.MagFisico;
import com.ablia.art.Articolo;
import com.ablia.art.Marca;
import com.ablia.contab.Movimento;
import com.ablia.contab.MovimentoCR;
import com.ablia.contab.RigaDocumento;
import com.ablia.contab.TipoDocumento;
import com.ablia.contab.TipoDocumentoCR;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
import com.ablia.db.ResParm;
import com.ablia.servlet.AblServletSvlt;
import com.ablia.util.Vectumerator;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(urlPatterns = {"/admin/contab/Movimento.abl"})
public class MovimentoSvlt extends AblServletSvlt {
private static final long serialVersionUID = 1L;
protected void addRows(HttpServletRequest req, HttpServletResponse res) {}
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {}
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
req.setAttribute("listaTipoDocumento", new TipoDocumento(apFull).findByCR(new TipoDocumentoCR(), 0, 0));
req.setAttribute("listaMagFisico", new MagFisico(apFull).findAll());
req.setAttribute("listaEsercizi", new Esercizio(apFull).findAll());
req.setAttribute("listaMarche", new Marca(apFull).findAll());
}
protected DBAdapter getBean(HttpServletRequest req) {
return new Movimento(getApFull(req));
}
protected CRAdapter getBeanCR(HttpServletRequest req) {
return new MovimentoCR(getApFull(req));
}
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {}
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
if (getCmd(req).equals("viewM")) {
setJspPageRelative("../../admin/art/articoloViewMovimento.jsp", req);
long l_id_articolo = getRequestLongParameter(req, "id_articolo");
long l_id_magFisico = getRequestLongParameter(req, "id_magFisico");
long l_id_clifor = getRequestLongParameter(req, "id_clifor");
long l_flgInMagazzino = getRequestLongParameter(req, "flgInMagazzino");
Articolo bean = new Articolo(getApFull(req));
bean.findByPrimaryKey(l_id_articolo);
MovimentoCR CR = new MovimentoCR();
CR.setId_articolo(l_id_articolo);
CR.setId_magFisico(l_id_magFisico);
CR.setId_clifor(l_id_clifor);
CR.setFlgInMagazzino(l_flgInMagazzino);
Movimento mov = new Movimento(getApFull(req));
Vectumerator vec = mov.findSaldiArticoloVarianteTagliaByCR(CR, 0, 0);
req.setAttribute("listaArticoliVarianteMovimento", vec);
req.setAttribute("bean", bean);
callJsp(req, res);
} else {
super.otherCommands(req, res);
}
}
protected int getPageRow(HttpServletRequest req) {
return 55;
}
public void _interrogazione2(HttpServletRequest req, HttpServletResponse res) {
long l_id_articolo = getRequestLongParameter(req, "id_articolo");
MovimentoCR CR = new MovimentoCR();
CR.setId_articolo(l_id_articolo);
RigaDocumento bean = new RigaDocumento(getApFull(req));
req.setAttribute("list1", bean.findOrdiniByArticolo(l_id_articolo));
req.setAttribute("CR", CR);
showBean(req, res);
}
public void _loadDettaglio1(HttpServletRequest req, HttpServletResponse res) {
long l_id_articolo = getRequestLongParameter(req, "id_articolo");
long l_id_documento = getRequestLongParameter(req, "id_documento");
MovimentoCR CR = new MovimentoCR();
CR.setId_articolo(l_id_articolo);
RigaDocumento bean = new RigaDocumento(getApFull(req));
req.setAttribute("list1", bean.findOrdiniByArticolo(l_id_articolo));
req.setAttribute("list2", bean.findMovimentiDiCaricoByArticoloDocumento(l_id_articolo, l_id_documento));
req.setAttribute("CR", CR);
showBean(req, res);
}
public void _loadDettaglio2(HttpServletRequest req, HttpServletResponse res) {
long l_id_articolo = getRequestLongParameter(req, "id_articolo");
long l_id_documento = getRequestLongParameter(req, "id_documento");
MovimentoCR CR = new MovimentoCR();
CR.setId_articolo(l_id_articolo);
CR.setId_documento(l_id_documento);
RigaDocumento bean = new RigaDocumento(getApFull(req));
req.setAttribute("list1", bean.findOrdiniByArticolo(l_id_articolo));
req.setAttribute("list2", bean.findMovimentiDiCaricoByArticoloDocumento(l_id_articolo, l_id_documento));
req.setAttribute("CR", CR);
showBean(req, res);
}
public void _loadDettaglio3(HttpServletRequest req, HttpServletResponse res) {
long l_id_articolo = getRequestLongParameter(req, "id_articolo");
long l_id_documento = getRequestLongParameter(req, "id_documento");
long l_id_documento2 = getRequestLongParameter(req, "id_documento2");
MovimentoCR CR = new MovimentoCR();
CR.setId_articolo(l_id_articolo);
CR.setId_documento(l_id_documento);
CR.setId_documento2(l_id_documento2);
RigaDocumento bean = new RigaDocumento(getApFull(req));
req.setAttribute("list1", bean.findOrdiniByArticolo(l_id_articolo));
req.setAttribute("list2", bean.findMovimentiDiCaricoByArticoloDocumento(l_id_articolo, l_id_documento));
req.setAttribute("list3", bean.findDettaglioBollaByArticoloDocumento(l_id_articolo, l_id_documento2));
req.setAttribute("CR", CR);
showBean(req, res);
}
public void _loadDettaglio4(HttpServletRequest req, HttpServletResponse res) {
long l_id_articolo = getRequestLongParameter(req, "id_articolo");
long l_id_documento = getRequestLongParameter(req, "id_documento");
long l_id_documento2 = getRequestLongParameter(req, "id_documento2");
long l_id_rigaDocumento = getRequestLongParameter(req, "id_rigaDocumento");
MovimentoCR CR = new MovimentoCR();
CR.setId_articolo(l_id_articolo);
CR.setId_documento(l_id_documento);
CR.setId_documento2(l_id_documento2);
CR.setId_documento(l_id_rigaDocumento);
RigaDocumento bean = new RigaDocumento(getApFull(req));
req.setAttribute("list1", bean.findOrdiniByArticolo(l_id_articolo));
req.setAttribute("list2", bean.findMovimentiDiCaricoByArticoloDocumento(l_id_articolo, l_id_documento));
req.setAttribute("list3", bean.findDettaglioBollaByArticoloDocumento(l_id_articolo, l_id_documento2));
req.setAttribute("list4", new Movimento(getApFull(req)).findByRigaDocumento(l_id_rigaDocumento));
req.setAttribute("CR", CR);
showBean(req, res);
}
public void _aggiustaOrdini(HttpServletRequest req, HttpServletResponse res) {
RigaDocumento bean = new RigaDocumento(getApFull(req));
bean.importMovimentoOrdiniAFornitore();
showBean(req, res);
}
public void _interrogazione3(HttpServletRequest req, HttpServletResponse res) {
long l_id_articolo = getRequestLongParameter(req, "id_articolo");
MovimentoCR CR = new MovimentoCR();
CR.setId_articolo(l_id_articolo);
RigaDocumento bean = new RigaDocumento(getApFull(req));
req.setAttribute("CR", CR);
showBean(req, res);
}
protected String getBeanPageName(HttpServletRequest req) {
if (getCmd(req).equals("interrogazione3"))
return "checkOrdinato";
return super.getBeanPageName(req);
}
protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) {
long l_id_articolo = getRequestLongParameter(req, "id_articolo");
if (getBackRequest(req).equals(getACT_BACK())) {
MovimentoCR movimentoCR = (MovimentoCR)req.getSession().getAttribute(getATTR_CRBEAN(req));
l_id_articolo = movimentoCR.getId_articolo();
}
MovimentoCR CR = new MovimentoCR(getApFull(req));
fillObject(req, CR);
if (l_id_articolo > 0L) {
Articolo articolo = new Articolo(getApFull(req));
articolo.findByPrimaryKey(l_id_articolo);
if (articolo.getTipo().getFlgUsaVarianti() == 1L)
if (articolo.getDBState() == 1)
req.setAttribute("listaVarianti", articolo.findArticoliVarianti(-1L, -1L));
}
if (CR.getId_esercizio() == -1L)
req.setAttribute("id_esercizio", Integer.valueOf(DBAdapter.getCurrentYear()));
return super.beforeSearch(req, res);
}
public void _creaReportCsv(HttpServletRequest req, HttpServletResponse res) {
MovimentoCR CR = (MovimentoCR)req.getSession().getAttribute(getATTR_CRBEAN(req));
CR.setFlgTipoReport(getRequestLongParameter(req, "flgTipoReport"));
CR.setId_users(getLoginUserId(req).longValue());
Movimento bean = new Movimento(getApFull(req));
bean.creaFileCvs(CR);
sendHtmlMsgResponse(req, res, "<a href='../../" + CR.getFileName() + "' target='_blank'>File report in formato cvs (Excel)</a>");
}
}

View file

@ -0,0 +1,27 @@
package com.ablia.contab.servlet;
import com.ablia.contab.PianoConti;
import com.ablia.contab.PianoContiCR;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
import com.ablia.servlet.AblServletSvlt;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(urlPatterns = {"/admin/contabConfig/PianoConti.abl"})
public class PianoContiSvlt extends AblServletSvlt {
private static final long serialVersionUID = -6143176459987431155L;
protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {}
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
protected DBAdapter getBean(HttpServletRequest req) {
return new PianoConti(getApFull(req));
}
protected CRAdapter getBeanCR(HttpServletRequest req) {
return new PianoContiCR(getApFull(req));
}
}

View file

@ -0,0 +1,108 @@
package com.ablia.contab.servlet;
import com.ablia.contab.RegistroIva;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
import com.ablia.util.AbMessages;
import java.io.File;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(urlPatterns = {"/admin/contab/RegistroIva.abl"})
public class RegistroIvaSvlt extends _ContabSvlt {
protected void xchiamaJsp(HttpServletRequest req, HttpServletResponse res) {
setJspPageRelative("registroIva.jsp", req);
try {
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
rd.forward((ServletRequest)req, (ServletResponse)res);
} catch (Exception e) {
handleDebug(e);
}
}
protected void print(HttpServletRequest req, HttpServletResponse res) {
try {
if (getLoginUserGrant(req, getBean(req).getTableBeanName()) > 0L) {
if (getAct(req).equals("riva")) {
RegistroIva bean = RegistroIva.getInstance(getApFull(req), getTipoRegistro(req));
fillObject(req, bean);
String nomeRegistro = "riva_" + bean.getDataDa() + "_" + bean.getDataA() + ".pdf";
String fileName = String.valueOf(getPathTmp()) + nomeRegistro;
if (isFileExist(fileName))
new File(fileName).delete();
bean.setFileName(fileName);
bean.creaRegistroIvaPdf();
bean.aggiustaRPAIniziale();
req.setAttribute("bean", bean);
} else if (getAct(req).equals("riep")) {
RegistroIva bean = RegistroIva.getInstance(getApFull(req), getTipoRegistro(req));
fillObject(req, bean);
String nomeRegistro = "riep_" + bean.getDataDa() + "_" + bean.getDataA() + ".pdf";
String fileName = String.valueOf(getPathTmp()) + nomeRegistro;
if (isFileExist(fileName))
new File(fileName).delete();
bean.setFileName(fileName);
bean.creaRiepilogoIvaPdf();
bean.aggiustaRPAIniziale();
req.setAttribute("bean", bean);
} else {
sendMessage(req, "?? comando non valido!");
}
} else {
sendGrantMessage(req, AbMessages.getMessage(getLocale(req), "GRANT_NO_R"));
}
} catch (Exception e) {
e.printStackTrace();
}
forceJspPageRelative("registroIva.jsp", req);
callJsp(req, res);
}
protected void search(HttpServletRequest req, HttpServletResponse res) {
RegistroIva bean = RegistroIva.getInstance(getApFull(req), getTipoRegistro(req));
if (getLoginUserGrant(req, bean.getTableBeanName()) > 0L) {
fillObject(req, bean);
bean.aggiustaRPAIniziale();
req.setAttribute("bean", bean);
} else {
sendGrantMessage(req, AbMessages.getMessage(getLocale(req), "GRANT_NO_R"));
}
forceJspPageRelative("registroIva.jsp", req);
callJsp(req, res);
}
protected long getTipoRegistro(HttpServletRequest req) {
long tr = getRequestLongParameter(req, "id_registroIva");
if (tr == 0L)
return 1L;
return tr;
}
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {}
protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) {}
protected DBAdapter getBean(HttpServletRequest req) {
return RegistroIva.getInstance(getApFull(req), getTipoRegistro(req));
}
protected CRAdapter getBeanCR(HttpServletRequest req) {
return null;
}
public void _stampaRegistroIva(HttpServletRequest req, HttpServletResponse res) {
RegistroIva bean = RegistroIva.getInstance(getApFull(req), getTipoRegistro(req));
fillObject(req, bean);
String nomeRegistro = "riva_" + bean.getDataDa() + "_" + bean.getDataA() + ".pdf";
String fileName = nomeRegistro;
bean.setFileName(fileName);
bean.creaRegistroIvaPdf();
bean.aggiustaRPAIniziale();
req.setAttribute("bean", bean);
showBean(req, res);
}
}

View file

@ -0,0 +1,223 @@
package com.ablia.contab.servlet;
import com.ablia.anag.Esercizio;
import com.ablia.anag.Iva;
import com.ablia.anag.MagFisico;
import com.ablia.anag.TipoPagamento;
import com.ablia.anag.Vettore;
import com.ablia.art.Marca;
import com.ablia.contab.Documento;
import com.ablia.contab.Movimento;
import com.ablia.contab.MovimentoCR;
import com.ablia.contab.RigaDocumento;
import com.ablia.contab.RigaDocumentoCR;
import com.ablia.contab.TipoDocumento;
import com.ablia.contab.TipoDocumentoCR;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
import com.ablia.db.ResParm;
import com.ablia.newsletter.CodaMessaggi;
import com.ablia.newsletter.TemplateMsg;
import com.ablia.util.AbMessages;
import com.ablia.util.Vectumerator;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(urlPatterns = {"/admin/contab/RigaDocumento.abl"})
public class RigaDocumentoSvlt extends _ContabSvlt {
private static final long serialVersionUID = -4988119342406716471L;
protected void addRows(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
Documento bean = null;
ResParm rp = new ResParm(true, "");
long l_id = getRequestLongParameter(req, "id_documento");
bean = new Documento(apFull);
try {
bean.findByPrimaryKey(l_id);
fillObject(req, bean);
rp = bean.save();
req.setAttribute("id_documento", String.valueOf(bean.getId_documento()));
if (rp.getStatus()) {
if (getAct(req).equals("addRigaArticolo")) {
RigaDocumento row = new RigaDocumento(apFull);
if (l_id != 0L) {
fillObject(req, row);
rp = Documento.addRigaDocumento(bean, row);
sendMessage(req, rp.getMsg());
} else {
sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL"));
}
showBean(req, res);
} else if (getAct(req).equals("delRigaArticolo")) {
RigaDocumento row = new RigaDocumento(apFull);
long l_id_rigaDocumento = getRequestLongParameter(req, "id_rigaDocumento");
if (l_id_rigaDocumento != 0L) {
fillObject(req, row);
bean.delRigaDocumento(row);
sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_OK"));
} else {
sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL"));
}
showBean(req, res);
} else if (getAct(req).equals("modRigaArticolo")) {
RigaDocumento row = new RigaDocumento(apFull);
if (getRequestLongParameter(req, "id_rigaDocumento") != 0L) {
fillObject(req, row);
long l_id_rigaDocumento = getRequestLongParameter(req, "id_rigaDocumento");
row.findByPrimaryKey(l_id_rigaDocumento);
req.setAttribute("bean2", row);
sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_OK"));
} else {
sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL"));
}
showBean(req, res);
}
} else {
req.setAttribute("bean", bean);
sendMessage(req, rp.getMsg());
showBean(req, res);
}
} catch (Exception e) {
forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL"));
showBean(req, res);
}
}
protected void mail(HttpServletRequest req, HttpServletResponse res) {}
protected void print(HttpServletRequest req, HttpServletResponse res) {}
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
super.processRequest(req, res);
}
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
RigaDocumento bean = (RigaDocumento)beanA;
req.setAttribute("listaTipoPagamento", new TipoPagamento(apFull).findAll());
req.setAttribute("listaVettore", new Vettore(apFull).findAll());
req.setAttribute("listaTipoDocumento", new TipoDocumento(apFull).findAll());
req.setAttribute("listaIva", new Iva(apFull).findAll());
}
protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
req.setAttribute("listaTipoDocumento", new TipoDocumento(apFull).findByCR(new TipoDocumentoCR(), 0, 0));
req.setAttribute("listaMagFisico", new MagFisico(apFull).findAll());
req.setAttribute("listaEsercizi", new Esercizio(apFull).findAll());
req.setAttribute("listaMarche", new Marca(apFull).findAll());
}
protected DBAdapter getBean(HttpServletRequest req) {
return new RigaDocumento(getApFull(req));
}
protected CRAdapter getBeanCR(HttpServletRequest req) {
return new RigaDocumentoCR(getApFull(req));
}
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {}
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
if (getCmd(req).equals("ov")) {
RigaDocumentoCR CR = new RigaDocumentoCR(getApFull(req));
fillObject(req, CR);
CR.setId_tipoDocumento(getId_docOrdine());
CR.setFlgTipoRicerca(0L);
req.setAttribute("CR", CR);
RigaDocumento bean = new RigaDocumento(getApFull(req));
req.setAttribute("list", bean.findByCR(CR, 0, 0));
setJspPageRelative("ordiniView.jsp", req);
callJsp(req, res);
} else if (getCmd(req).equals("creaCodaMsgTimCard")) {
creaCodaMessaggiTimCard(req, res);
}
search(req, res);
}
protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) {
if (!getAct(req).contains("back")) {
long l_id_esercizio = getRequestLongParameter(req, "id_esercizio");
if (l_id_esercizio == 0L)
req.setAttribute("id_esercizio", String.valueOf(DBAdapter.getCurrentYear()));
}
req.setAttribute("flgRicercaMag", Long.valueOf(RigaDocumentoCR.RICERCA_SOLO_MAGAZZINO));
return super.beforeSearch(req, res);
}
protected void creaCodaMessaggiTimCard(HttpServletRequest req, HttpServletResponse res) {
RigaDocumento bean = new RigaDocumento(getApFull(req));
RigaDocumentoCR CR = new RigaDocumentoCR(getApFull(req));
fillObject(req, CR);
CR.setFlgTipoRicerca(1L);
Vectumerator vec = bean.findByCR(CR, 0, 0);
long l_id_templateMsg = getRequestLongParameter(req, "id_templateMsg");
TemplateMsg ts = new TemplateMsg(getApFull(req));
ts.findByPrimaryKey(l_id_templateMsg);
String campagna = String.valueOf(ts.getDescrizione()) + " " + DBAdapter.getToday();
while (vec.hasMoreElements()) {
RigaDocumento row = (RigaDocumento)vec.nextElement();
if (ts.getFlgTipo() != 1L)
if (row.getArticolo().getId_tipo() == 271L) {
CodaMessaggi cm = new CodaMessaggi(getApFull(req));
cm.setFlgTipo(ts.getFlgTipo());
cm.setCampagna(campagna);
cm.setCellulare(row.getSeriale().trim());
cm.setTestoMessaggio(ts.getTestoMessaggio());
cm.save();
}
}
}
public void _statoRigaPre(HttpServletRequest req, HttpServletResponse res) {
long l_id_rigaDocumento = getRequestLongParameter(req, "id_rigaDocumento");
RigaDocumento bean = new RigaDocumento(getApFull(req));
bean.findByPrimaryKey(l_id_rigaDocumento);
if (getAct(req).equals("reset")) {
bean.setStatoPrenotazione(-1L);
bean.superSave();
}
long stato = bean.getStatoPrenotazione();
req.setAttribute("stato", String.valueOf(stato));
req.setAttribute("statoMsg", bean.getStatoRiga(stato));
req.setAttribute("id", String.valueOf(l_id_rigaDocumento));
sendCmdJspPageResponse(req, res);
}
protected int getPageRow(HttpServletRequest req) {
return 55;
}
public void _creaReportCsv(HttpServletRequest req, HttpServletResponse res) {
RigaDocumentoCR CR = (RigaDocumentoCR)req.getSession().getAttribute(
getATTR_CRBEAN(req));
CR.setFlgTipoReport(getRequestLongParameter(req, "flgTipoReport"));
CR.setId_users(getLoginUserId(req).longValue());
RigaDocumento bean = new RigaDocumento(getApFull(req));
bean.creaFileCvsMov(CR);
sendHtmlMsgResponse(req, res, "<a href='../../" + CR.getFileName() +
"' target='_blank'>File report in formato cvs (Excel)</a>");
}
public void _loadDettaglio4(HttpServletRequest req, HttpServletResponse res) {
long l_id_articolo = getRequestLongParameter(req, "id_articolo");
long l_id_documento = getRequestLongParameter(req, "id_documento");
long l_id_documento2 = getRequestLongParameter(req, "id_documento2");
long l_id_rigaDocumento = getRequestLongParameter(req, "id_rigaDocumento");
MovimentoCR CR = new MovimentoCR();
CR.setId_articolo(l_id_articolo);
CR.setId_documento(l_id_documento);
CR.setId_documento2(l_id_documento2);
CR.setId_documento(l_id_rigaDocumento);
RigaDocumento bean = new RigaDocumento(getApFull(req));
req.setAttribute("list1", bean.findOrdiniByArticolo(l_id_articolo));
req.setAttribute("list2", bean.findMovimentiDiCaricoByArticoloDocumento(l_id_articolo, l_id_documento));
req.setAttribute("list3", bean.findDettaglioBollaByArticoloDocumento(l_id_articolo, l_id_documento2));
req.setAttribute("list4", new Movimento(getApFull(req)).findByRigaDocumento(l_id_rigaDocumento));
req.setAttribute("CR", CR);
showBean(req, res);
}
}

View file

@ -0,0 +1,61 @@
package com.ablia.contab.servlet;
import com.ablia.contab.TipoAllegatoDocumento;
import com.ablia.contab.TipoAllegatoDocumentoCR;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
import com.ablia.db.ResParm;
import com.ablia.servlet.AblServletSvlt;
import com.ablia.util.AbMessages;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(urlPatterns = {"/admin/contabConfig/TipoAllegatoDocumento.abl"})
public class TipoAllegatoDocumentoSvlt extends AblServletSvlt {
private static final long serialVersionUID = 1L;
protected void addRows(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
TipoAllegatoDocumento bean = null;
ResParm rp = new ResParm(true, "");
long l_id = getRequestLongParameter(req, "id_tipoDocumento");
bean = new TipoAllegatoDocumento(apFull);
try {
bean.findByPrimaryKey(l_id);
fillObject(req, bean);
rp = bean.save();
l_id = bean.getId_tipoAllegatoDocumento();
req.setAttribute("id_tipoAllegatoDocumento", String.valueOf(l_id));
req.setAttribute("bean", bean);
if (!rp.getStatus()) {
req.setAttribute("bean", bean);
sendMessage(req, rp.getMsg());
showBean(req, res);
}
} catch (Exception e) {
forceMessage(req,
AbMessages.getMessage(getLocale(req), "SAVE_FAIL"));
showBean(req, res);
}
}
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {}
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
protected DBAdapter getBean(HttpServletRequest req) {
return new TipoAllegatoDocumento(getApFull(req));
}
protected CRAdapter getBeanCR(HttpServletRequest req) {
return new TipoAllegatoDocumentoCR(getApFull(req));
}
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {}
protected boolean isSimpleServlet(HttpServletRequest req) {
return true;
}
}

View file

@ -0,0 +1,151 @@
package com.ablia.contab.servlet;
import com.ablia.anag.Contatore;
import com.ablia.common.TtFont;
import com.ablia.contab.CausaleMagazzino;
import com.ablia.contab.DocPrel;
import com.ablia.contab.TipoDocumento;
import com.ablia.contab.TipoDocumentoCR;
import com.ablia.contab.TipoStampaDocumento;
import com.ablia.contab.TipologiaDocumento;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
import com.ablia.db.ResParm;
import com.ablia.servlet.AblServletSvlt;
import com.ablia.util.AbMessages;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(urlPatterns = {"/admin/contabConfig/TipoDocumento.abl"})
public class TipoDocumentoSvlt extends AblServletSvlt {
private static final long serialVersionUID = 1L;
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
TipoDocumento bean = (TipoDocumento)beanA;
req.setAttribute("listaTipologiaDocumento", new TipologiaDocumento(apFull).findAll());
req.setAttribute("listaTipoStampaDocumento",
new TipoStampaDocumento(apFull).findByTipologiaDocumento(bean.getId_tipologiaDocumento()));
req.setAttribute("listaCausaliMagazzino", new CausaleMagazzino(apFull).findAll());
req.setAttribute("listaContatori", new Contatore(apFull).findAll());
if (bean.getFlgTipologia() != 3L)
req.setAttribute("listaDocumentiPadre", new TipoDocumento(apFull).findAll());
if (bean.getFlgTipologia() == 4L) {
TipoDocumentoCR CR = new TipoDocumentoCR();
CR.setFlgTipologie("0,1,2,4,5,100,");
req.setAttribute("listaDocumentiFiglio", new TipoDocumento(apFull).findByCR(CR, 0, 0));
} else {
req.setAttribute("listaDocumentiFiglio", new TipoDocumento(apFull).findAll());
}
req.setAttribute("listaDocPrel", bean.findDocPrel(0L, 0, 0));
req.setAttribute("listaDocGen", bean.findDocGen(0L, 0, 0));
req.setAttribute("listaTtf", TtFont.getInstance(apFull).findAll());
}
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
req.setAttribute("listaTipologiaDocumento", new TipologiaDocumento(apFull).findAll());
}
protected DBAdapter getBean(HttpServletRequest req) {
return new TipoDocumento(getApFull(req));
}
protected CRAdapter getBeanCR(HttpServletRequest req) {
return new TipoDocumentoCR(getApFull(req));
}
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
req.setAttribute("listaTipologiaDocumento", new TipologiaDocumento(apFull).findAll());
req.setAttribute("listaCausaliMagazzino", new CausaleMagazzino(apFull).findAll());
req.setAttribute("listaContatori", new Contatore(apFull).findAll());
req.setAttribute("listaTtf", TtFont.getInstance(apFull).findAll());
}
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
if (getCmd(req).equals("list")) {
TipoDocumento bean = new TipoDocumento(getApFull(req));
TipoDocumentoCR CR = new TipoDocumentoCR(getApFull(req));
CR.setFlgNascondiNuovo(0L);
req.setAttribute("list", bean.findByCR(CR, 0, 0));
setJspPageRelative("tipoDocumentoL.jsp", req);
callJsp(req, res);
} else {
super.otherCommands(req, res);
}
}
protected void addRows(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
TipoDocumento bean = null;
ResParm rp = new ResParm(true, "");
long l_id = getRequestLongParameter(req, "id_tipoDocumento");
bean = new TipoDocumento(apFull);
try {
bean.findByPrimaryKey(l_id);
fillObject(req, bean);
rp = bean.save();
l_id = bean.getId_tipoDocumento();
req.setAttribute("id_tipoDocumento", String.valueOf(l_id));
req.setAttribute("bean", bean);
if (rp.getStatus()) {
if (getAct(req).equals("addDocPrel")) {
DocPrel row = new DocPrel(apFull);
if (l_id != 0L) {
fillObject(req, row);
row.setFlgTipoGenerazione(getRequestLongParameter(req, "flgTipoGenerazionePadre"));
rp = bean.addDocPrel(row);
sendMessage(req, rp.getMsg());
} else {
sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL"));
}
showBean(req, res);
} else if (getAct(req).equals("delDocPrel")) {
DocPrel row = new DocPrel(apFull);
long l_id_docPrel = getRequestLongParameter(req, "id_docPrel");
if (l_id_docPrel != 0L) {
fillObject(req, row);
bean.delDocPrel(row);
sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_OK"));
} else {
sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL"));
}
showBean(req, res);
} else if (getAct(req).equals("addDocFiglio")) {
DocPrel row = new DocPrel(apFull);
if (l_id != 0L) {
fillObject(req, row);
row.setId_tipoDocumentoPrel(row.getId_tipoDocumento());
row.setId_tipoDocumento(getRequestLongParameter(req, "id_tipoDocumentoFiglio"));
rp = bean.addDocPrel(row);
sendMessage(req, rp.getMsg());
} else {
sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL"));
}
showBean(req, res);
} else if (getAct(req).equals("delDocPrel")) {
DocPrel row = new DocPrel(apFull);
long l_id_docPrel = getRequestLongParameter(req, "id_docPrel");
if (l_id_docPrel != 0L) {
fillObject(req, row);
bean.delDocPrel(row);
sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_OK"));
} else {
sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL"));
}
showBean(req, res);
}
} else {
req.setAttribute("bean", bean);
sendMessage(req, rp.getMsg());
showBean(req, res);
}
} catch (Exception e) {
forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL"));
showBean(req, res);
}
}
}

View file

@ -0,0 +1,60 @@
package com.ablia.contab.servlet;
import com.ablia.anag.Contatore;
import com.ablia.common.TtFont;
import com.ablia.contab.CausaleMagazzino;
import com.ablia.contab.TipoDocumento;
import com.ablia.contab.TipoDocumentoCR;
import com.ablia.contab.TipoStampaDocumento;
import com.ablia.contab.TipoStampaDocumentoCR;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
import com.ablia.servlet.AblServletSvlt;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(urlPatterns = {"/admin/contabConfig/TipoStampaDocumento.abl"})
public class TipoStampaDocumentoSvlt extends AblServletSvlt {
private static final long serialVersionUID = 1L;
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
}
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
protected DBAdapter getBean(HttpServletRequest req) {
return new TipoStampaDocumento(getApFull(req));
}
protected CRAdapter getBeanCR(HttpServletRequest req) {
return new TipoStampaDocumentoCR(getApFull(req));
}
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
req.setAttribute("listaCausaliMagazzino", new CausaleMagazzino(
apFull).findAll());
req.setAttribute("listaContatori", new Contatore(apFull).findAll());
req.setAttribute("listaTtf", TtFont.getInstance(apFull).findAll());
}
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
if (getCmd(req).equals("list")) {
TipoDocumento bean = new TipoDocumento(getApFull(req));
TipoDocumentoCR CR = new TipoDocumentoCR(getApFull(req));
CR.setFlgMenu(0L);
req.setAttribute("list", bean.findByCR(CR, 0, 0));
setJspPageRelative("tipoDocumentoL.jsp", req);
callJsp(req, res);
} else {
super.otherCommands(req, res);
}
}
protected boolean isSimpleServlet(HttpServletRequest req) {
return true;
}
}

View file

@ -0,0 +1,96 @@
package com.ablia.contab.servlet;
import com.ablia.anag.Contatore;
import com.ablia.common.TtFont;
import com.ablia.contab.CausaleMagazzino;
import com.ablia.contab.TipoDocumento;
import com.ablia.contab.TipoDocumentoCR;
import com.ablia.contab.TipoStampaDocumento;
import com.ablia.contab.TipologiaDocumento;
import com.ablia.contab.TipologiaDocumentoCR;
import com.ablia.contab.TipologiaDocumentoTipoStampa;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
import com.ablia.db.ResParm;
import com.ablia.servlet.AblServletSvlt;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(urlPatterns = {"/admin/contabConfig/TipologiaDocumento.abl"})
public class TipologiaDocumentoSvlt extends AblServletSvlt {
private static final long serialVersionUID = 1L;
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
TipologiaDocumento bean = (TipologiaDocumento)beanA;
req.setAttribute("listaTipoStampaDocumento", new TipoStampaDocumento(apFull).findAll());
req.setAttribute("listaStampeByTipologiaDocumento", bean.findByTipologiaDocumento());
}
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
protected DBAdapter getBean(HttpServletRequest req) {
return new TipologiaDocumento(getApFull(req));
}
protected CRAdapter getBeanCR(HttpServletRequest req) {
return new TipologiaDocumentoCR(getApFull(req));
}
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
req.setAttribute("listaCausaliMagazzino", new CausaleMagazzino(apFull).findAll());
req.setAttribute("listaContatori", new Contatore(apFull).findAll());
req.setAttribute("listaTtf", TtFont.getInstance(apFull).findAll());
}
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
if (getCmd(req).equals("list")) {
TipoDocumento bean = new TipoDocumento(getApFull(req));
TipoDocumentoCR CR = new TipoDocumentoCR(getApFull(req));
CR.setFlgMenu(0L);
req.setAttribute("list", bean.findByCR(CR, 0, 0));
setJspPageRelative("tipoDocumentoL.jsp", req);
callJsp(req, res);
} else {
super.otherCommands(req, res);
}
}
protected boolean isSimpleServlet(HttpServletRequest req) {
return false;
}
public void _addTipoStampa(HttpServletRequest req, HttpServletResponse res) {
ResParm rp;
ApplParmFull apFull = getApFull(req);
TipologiaDocumentoTipoStampa bean2 = new TipologiaDocumentoTipoStampa(apFull);
fillObject(req, bean2);
if (bean2.getId_tipologiaDocumentoTipoStampa() > 0L)
bean2.findByPrimaryKey(bean2.getId_tipologiaDocumentoTipoStampa());
if (bean2.getId_tipoStampaDocumento() > 0L) {
rp = bean2.save();
} else {
rp = new ResParm(false, "Errore! Tipo Stampa non selezionata correttamente");
}
sendMessage(req, rp.getMsg());
showBean(req, res);
}
public void _delTipoStampa(HttpServletRequest req, HttpServletResponse res) {
ResParm rp;
ApplParmFull apFull = getApFull(req);
TipologiaDocumentoTipoStampa bean2 = new TipologiaDocumentoTipoStampa(apFull);
fillObject(req, bean2);
if (bean2.getId_tipologiaDocumentoTipoStampa() > 0L) {
bean2.findByPrimaryKey(bean2.getId_tipologiaDocumentoTipoStampa());
rp = bean2.delete();
} else {
rp = new ResParm(false, "Errore! Impossibile cancellare tipo stampa ");
}
sendMessage(req, rp.getMsg());
showBean(req, res);
}
}

View file

@ -0,0 +1,101 @@
package com.ablia.contab.servlet;
import com.ablia.common.Users;
import com.ablia.db.ApplParm;
import com.ablia.db.ApplParmFull;
import com.ablia.servlet.AblServletSvlt;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public abstract class _ContabSvlt extends AblServletSvlt {
protected static ApplParmFull ap2;
protected boolean checkLoginProfile(HttpServletRequest req) {
try {
if (getLoginUser(req) == null) {
forceJspPage(getLoginPage(null, null), req);
return true;
}
if (getLoginUser(req).getFlgValido().equals("N")) {
forceJspPage(super.getLoginPage(null, null), req);
req.getSession().removeAttribute("loginUser_id");
req.getSession().removeAttribute("utenteLogon");
return false;
}
if (getLoginUser(req).getId_userProfile() > 0L)
return true;
forceJspPage(super.getLoginPage(null, null), req);
req.getSession().removeAttribute("loginUser_id");
req.getSession().removeAttribute("utenteLogon");
return true;
} catch (Exception e) {
handleDebug(e);
return false;
}
}
protected long getLoginUserGrant(HttpServletRequest req, String l_permesso) {
if (isSecureServlet(req))
try {
return getLoginUser(req).getGrantType(l_permesso);
} catch (Exception e) {
handleDebug(e);
return 0L;
}
return 4L;
}
protected String getAct3(HttpServletRequest req) {
return getRequestParameter(req, "act3");
}
protected String getCmd3(HttpServletRequest req) {
return getRequestParameter(req, "cmd3");
}
protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) {
return "/admin/menu/menu.jsp";
}
protected Users getUser(HttpServletRequest req) {
return new com.ablia.anag.Users(getApFull(req));
}
protected boolean useAlwaysSendRedirect() {
return true;
}
protected ApplParmFull getAp2() {
if (ap2 == null) {
ApplParmFull apFull = getApFull();
ApplParm apx = new ApplParm(apFull.getParm("DBDRIVER2").getNumeroInt(), apFull.getParm("DBNAME2").getTesto(),
apFull.getParm("USER2").getTesto(), apFull.getParm("PASSWORD2").getTesto());
ap2 = new ApplParmFull(apx);
}
return ap2;
}
protected long getId_docCassa() {
return getParm("ID_DOC_CASSA").getNumeroLong();
}
protected long getId_docOrdine() {
return getParm("ID_DOC_ORDINE").getNumeroLong();
}
protected long getId_docPrenotazione() {
return getParm("ID_DOC_PRENOTAZIONE").getNumeroLong();
}
protected long getId_docRiparazione() {
return getParm("ID_DOC_RIPARAZIONE").getNumeroLong();
}
protected long getId_docOrdineWww() {
return getParm("ID_DOC_ORDINE_WWW").getNumeroLong();
}
protected long getId_docRicevuta() {
return getParm("ID_DOC_RICEVUTA").getNumeroLong();
}
}

View file

@ -0,0 +1,69 @@
package com.ablia.contab.taglib;
import com.ablia.contab.TipoDocumento;
import com.ablia.taglib.AbstractDbTag;
import com.ablia.util.Vectumerator;
import java.io.IOException;
import java.text.NumberFormat;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspTagException;
public class TipoDocumentoTag extends AbstractDbTag {
private static final long serialVersionUID = 1L;
private String rowbeanname;
private NumberFormat nf;
private Vectumerator theList;
public int doAfterBody() throws JspException {
try {
if (this.theList.hasMoreElements()) {
TipoDocumento row = (TipoDocumento)this.theList.nextElement();
this.pageContext.setAttribute(getRowbeanname(), row);
this.pageContext.setAttribute("nf", getNf());
this.pageContext.setAttribute("idx", String.valueOf(
this.theList.getIndex()));
return 2;
}
String body = getBodyContent().getString();
this.bodyContent.getEnclosingWriter().print(body);
return 0;
} catch (IOException ex) {
throw new JspTagException(ex.toString());
}
}
public int doStartTag() {
this.theList = new TipoDocumento(getApFull()).findMenu();
if (this.theList == null)
return 0;
this.theList.moveFirst();
if (this.theList.hasMoreElements()) {
TipoDocumento row = (TipoDocumento)this.theList.nextElement();
this.pageContext.setAttribute(getRowbeanname(), row);
this.pageContext.setAttribute("nf", getNf());
this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex()));
return 2;
}
return 0;
}
public String getRowbeanname() {
return (this.rowbeanname == null) ? "rowBean" : this.rowbeanname;
}
public void setRowbeanname(String s) {
this.rowbeanname = s;
}
public NumberFormat getNf() {
if (this.nf == null) {
this.nf = NumberFormat.getInstance();
this.nf.setMaximumFractionDigits(2);
this.nf.setMinimumFractionDigits(2);
}
return this.nf;
}
}

View file

@ -0,0 +1,20 @@
package com.ablia.contab.taglib;
import javax.servlet.jsp.tagext.TagData;
import javax.servlet.jsp.tagext.TagExtraInfo;
import javax.servlet.jsp.tagext.VariableInfo;
public class TipoDocumentoTagExtraInfo extends TagExtraInfo {
public VariableInfo[] getVariableInfo(TagData tagdata) {
String rowBeanName = (tagdata.getAttributeString("rowbeanname") != null) ?
tagdata.getAttributeString("rowbeanname") :
"rowBean";
String rowBeanClass = "com.ablia.contab.TipoDocumento";
return new VariableInfo[] { new VariableInfo(rowBeanName, rowBeanClass, true,
0),
new VariableInfo("nf", "java.text.NumberFormat", true,
0),
new VariableInfo("idx", "java.lang.String", true,
0) };
}
}

View file

@ -0,0 +1,155 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.WcString;
import com.ablia.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class xDocFiglioPadre extends _ContabAdapter implements Serializable {
private long id_documentoPadre;
private long id_documentoFiglio;
private Documento documentoPadre;
private Documento documentoFiglio;
private long id_docFiglioPadre;
public xDocFiglioPadre(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public xDocFiglioPadre() {}
public void setId_documentoPadre(long newId_documentoPadre) {
this.id_documentoPadre = newId_documentoPadre;
setDocumentoPadre(null);
}
public void setId_documentoFiglio(long newId_documentoFiglio) {
this.id_documentoFiglio = newId_documentoFiglio;
setDocumentoFiglio(null);
}
public long getId_documentoPadre() {
return this.id_documentoPadre;
}
public long getId_documentoFiglio() {
return this.id_documentoFiglio;
}
public void setDocumentoPadre(Documento newDocumentoPadre) {
this.documentoPadre = newDocumentoPadre;
}
public Documento getDocumentoPadre() {
this.documentoPadre = (Documento)getSecondaryObject(this.documentoPadre,
Documento.class, getId_documentoPadre());
return this.documentoPadre;
}
public void setDocumentoFiglio(Documento newDocumentoFiglio) {
this.documentoFiglio = newDocumentoFiglio;
}
public Documento getDocumentoFiglio() {
this.documentoFiglio = (Documento)getSecondaryObject(this.documentoFiglio,
Documento.class, getId_documentoFiglio());
return this.documentoFiglio;
}
protected void deleteCascade() {}
public Vectumerator findByCR(xDocFiglioPadreCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from DOC_FIGLIO_PADRE AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
try {
PreparedStatement stmt = getConn().prepareStatement(
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public Vectumerator findByDocumentoPadre(long l_id_documentoPadre) {
String s_Sql_Find = "select DISTINCT A.* from DOC_FIGLIO_PADRE AS A, DOCUMENTO as B";
String s_Sql_Order = " order by B.id_esercizio, B.progDocumento";
WcString wc = new WcString();
wc.addWc("A.id_documentoFiglio=B.id_documento");
wc.addWc("A.id_documentoPadre=" + l_id_documentoPadre);
try {
PreparedStatement stmt = getConn().prepareStatement(
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public void findByDocumentoFiglioPadre(long l_id_documentoFiglio, long l_id_documentoPadre) {
String s_Sql_Find = "select DISTINCT A.* from DOC_FIGLIO_PADRE AS A";
WcString wc = new WcString();
wc.addWc("A.id_documentoFiglio=" + l_id_documentoFiglio);
wc.addWc("A.id_documentoPadre=" + l_id_documentoPadre);
try {
PreparedStatement stmt = getConn().prepareStatement(
String.valueOf(s_Sql_Find) + wc.toString());
findFirstRecord(stmt);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
}
}
public long getId_docFiglioPadre() {
return this.id_docFiglioPadre;
}
public void setId_docFiglioPadre(long id_docFiglioPadre) {
this.id_docFiglioPadre = id_docFiglioPadre;
}
public void findByDocumentoPadreTipoFiglio(long l_id_documentoPadre, long l_id_tipoDocumentoFiglio) {
String s_Sql_Find = "select DISTINCT A.* from DOC_FIGLIO_PADRE AS A, DOCUMENTO AS B";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.id_documentoFiglio=B.id_documento");
wc.addWc("A.id_documentoPadre=" + l_id_documentoPadre);
wc.addWc("B.id_tipoDocumento=" + l_id_tipoDocumentoFiglio);
try {
PreparedStatement stmt = getConn().prepareStatement(
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
findFirstRecord(stmt);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
}
}
public Vectumerator findByDocumentoFiglio(long l_id_documentoFiglio) {
String s_Sql_Find = "select DISTINCT A.* from DOC_FIGLIO_PADRE AS A, DOCUMENTO as B";
String s_Sql_Order = " order by B.id_esercizio, B.progDocumento";
WcString wc = new WcString();
wc.addWc("A.id_documentoPadre=B.id_documento");
wc.addWc("A.id_documentoFiglio=" + l_id_documentoFiglio);
try {
PreparedStatement stmt = getConn().prepareStatement(
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
}

View file

@ -0,0 +1,81 @@
package com.ablia.contab;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import java.sql.Timestamp;
public class xDocFiglioPadreCR extends CRAdapter {
private long id_documentoPadre;
private long id_documentoFiglio;
private long lastUpdId_user;
private Timestamp lastUpdTmst;
private Documento documentoPadre;
private Documento documentoFiglio;
public xDocFiglioPadreCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public xDocFiglioPadreCR() {}
public void setId_documentoPadre(long newId_documentoPadre) {
this.id_documentoPadre = newId_documentoPadre;
setDocumentoPadre(null);
}
public void setId_documentoFiglio(long newId_documentoFiglio) {
this.id_documentoFiglio = newId_documentoFiglio;
setDocumentoFiglio(null);
}
public void setLastUpdId_user(long newLastUpdId_user) {
this.lastUpdId_user = newLastUpdId_user;
}
public void setLastUpdTmst(Timestamp newLastUpdTmst) {
this.lastUpdTmst = newLastUpdTmst;
}
public long getId_documentoPadre() {
return this.id_documentoPadre;
}
public long getId_documentoFiglio() {
return this.id_documentoFiglio;
}
public long getLastUpdId_user() {
return this.lastUpdId_user;
}
public Timestamp getLastUpdTmst() {
return this.lastUpdTmst;
}
public void setDocumentoPadre(Documento newDocumentoPadre) {
this.documentoPadre = newDocumentoPadre;
}
public Documento getDocumentoPadre() {
this.documentoPadre = (Documento)getSecondaryObject(
this.documentoPadre,
Documento.class, getId_documentoPadre());
return this.documentoPadre;
}
public void setDocumentoFiglio(Documento newDocumentoFiglio) {
this.documentoFiglio = newDocumentoFiglio;
}
public Documento getDocumentoFiglio() {
this.documentoFiglio = (Documento)getSecondaryObject(
this.documentoFiglio,
Documento.class, getId_documentoFiglio());
return this.documentoFiglio;
}
}