136 lines
3.2 KiB
Java
136 lines
3.2 KiB
Java
package it.acxent.anag;
|
|
|
|
import it.acxent.db.ApplParmFull;
|
|
import it.acxent.db.WcString;
|
|
import it.acxent.util.StringTokenizer;
|
|
import it.acxent.util.Vectumerator;
|
|
import java.io.Serializable;
|
|
import java.sql.PreparedStatement;
|
|
import java.sql.SQLException;
|
|
|
|
public class Contatore extends _AnagAdapter implements Serializable {
|
|
public static final int TIPO_ANNUALE = 1;
|
|
|
|
private long id_contatore;
|
|
|
|
private String descrizione;
|
|
|
|
private long flgTipo;
|
|
|
|
private long flgControllo;
|
|
|
|
private long annoIniziale;
|
|
|
|
private long progIniziale;
|
|
|
|
public static final int TIPO_MAGAZZINO = 3;
|
|
|
|
public static final int TIPO_CONTABILE = 2;
|
|
|
|
public Contatore(ApplParmFull newApplParmFull) {
|
|
super(newApplParmFull);
|
|
}
|
|
|
|
public Contatore() {}
|
|
|
|
public void setId_contatore(long newId_contatore) {
|
|
this.id_contatore = newId_contatore;
|
|
}
|
|
|
|
public void setDescrizione(String newDescrizione) {
|
|
this.descrizione = newDescrizione;
|
|
}
|
|
|
|
public void setFlgTipo(long newFlgTipo) {
|
|
this.flgTipo = newFlgTipo;
|
|
}
|
|
|
|
public void setFlgControllo(long newFlgControllo) {
|
|
this.flgControllo = newFlgControllo;
|
|
}
|
|
|
|
public long getId_contatore() {
|
|
return this.id_contatore;
|
|
}
|
|
|
|
public String getDescrizione() {
|
|
return (this.descrizione == null) ? "" :
|
|
this.descrizione.trim();
|
|
}
|
|
|
|
public long getFlgTipo() {
|
|
return this.flgTipo;
|
|
}
|
|
|
|
public long getFlgControllo() {
|
|
return this.flgControllo;
|
|
}
|
|
|
|
protected void deleteCascade() {}
|
|
|
|
public Vectumerator findByCR(ContatoreCR CR, int pageNumber, int pageRows) {
|
|
String s_Sql_Find = "select A.* from CONTATORE 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(s_Sql_Find + s_Sql_Find +
|
|
wc.toString());
|
|
return findRows(stmt, pageNumber, pageRows);
|
|
} catch (SQLException e) {
|
|
handleDebug(e);
|
|
return AB_EMPTY_VECTUMERATOR;
|
|
}
|
|
}
|
|
|
|
public static String getTipo(long l_flgTipo) {
|
|
switch ((int)l_flgTipo) {
|
|
case 1:
|
|
return "Annuale";
|
|
case 2:
|
|
return "Contabile";
|
|
case 3:
|
|
return "Magazzino";
|
|
}
|
|
return "????";
|
|
}
|
|
|
|
public String getTipo() {
|
|
return getTipo(getFlgTipo());
|
|
}
|
|
|
|
public String getControllo() {
|
|
return (getFlgControllo() == 0L) ? "No" : "Si";
|
|
}
|
|
|
|
public long getAnnoIniziale() {
|
|
if (getFlgControllo() == 0L)
|
|
return 0L;
|
|
return this.annoIniziale;
|
|
}
|
|
|
|
public void setAnnoIniziale(long annoIniziale) {
|
|
this.annoIniziale = annoIniziale;
|
|
}
|
|
|
|
public long getProgIniziale() {
|
|
if (getFlgControllo() == 0L)
|
|
return 0L;
|
|
return this.progIniziale;
|
|
}
|
|
|
|
public void setProgIniziale(long progIniziale) {
|
|
this.progIniziale = progIniziale;
|
|
}
|
|
}
|