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

111 lines
4.8 KiB
Java
Raw Normal View History

2026-04-22 18:41:37 +02:00
package it.acxent.contab.servlet;
import it.acxent.anag.TipoPagamento;
import it.acxent.anag.TipoPagamentoCR;
import it.acxent.contab.DocumentoPagamento;
import it.acxent.contab.DocumentoPagamentoCR;
import it.acxent.contab.TipoDocumento;
import it.acxent.contab.TipoDocumentoCR;
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.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 {
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));
TipoDocumentoCR TDCR = new TipoDocumentoCR();
TDCR.setFlgTipologia(20L);
req.setAttribute("listaTipoDocumento", new TipoDocumento(apFull).findByCR(TDCR, 0, 0));
}
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 super.getBeanPageName(req) + super.getBeanPageName(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), "Report_Documenti_Pagamento " + DBAdapter.getDayTimeTimestamp());
}
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);
}
public void _creaFileCvs(HttpServletRequest req, HttpServletResponse res) {
DocumentoPagamentoCR CR = (DocumentoPagamentoCR)req.getSession().getAttribute(getATTR_CRBEAN(req));
DocumentoPagamento bean = new DocumentoPagamento(getApFull(req));
bean.creaFileCvs(CR);
sendHtmlMsgResponse(req, res, "<a href='../../" + CR.getFileName() + "' target='_blank'>File export in formato cvs (Excel)</a>");
}
}