Regalamiunsorriso/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/IncassoPagamento.java

156 lines
4.2 KiB
Java

package it.acxent.contab;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.DBAdapterException;
import it.acxent.db.ResParm;
import it.acxent.db.WcString;
import it.acxent.util.StringTokenizer;
import it.acxent.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 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(s_Sql_Find + s_Sql_Find +
wc.toString());
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 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(s_Sql_Find + s_Sql_Find +
wc.toString());
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(s_Sql_Find + s_Sql_Find +
wc.toString());
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);
}
}