81 lines
3.1 KiB
Java
81 lines
3.1 KiB
Java
|
|
package it.acxent.contab.servlet;
|
||
|
|
|
||
|
|
import it.acxent.anag.Banca;
|
||
|
|
import it.acxent.anag.BancaCR;
|
||
|
|
import it.acxent.contab.DistintaRiba;
|
||
|
|
import it.acxent.contab.DistintaRibaCR;
|
||
|
|
import it.acxent.contab.DocumentoScadenza;
|
||
|
|
import it.acxent.contab.DocumentoScadenzaCR;
|
||
|
|
import it.acxent.db.ApplParmFull;
|
||
|
|
import it.acxent.db.CRAdapter;
|
||
|
|
import it.acxent.db.DBAdapter;
|
||
|
|
import it.acxent.db.ResParm;
|
||
|
|
import it.acxent.servlet.AblServletSvlt;
|
||
|
|
import it.acxent.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), "Riba_" + DBAdapter.getDayTimeTimestamp() + ".pdf");
|
||
|
|
} catch (Exception e) {
|
||
|
|
e.printStackTrace();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|