package it.acxent.contab.servlet; import it.acxent.anag.Iva; import it.acxent.anag.TipoPagamento; import it.acxent.anag.TipoPagamentoCR; import it.acxent.anag.Users; import it.acxent.anag.Vettore; import it.acxent.contab.Documento; import it.acxent.contab.DocumentoCR; import it.acxent.contab.RigaDocumento; import it.acxent.contab.TipoAllegatoDocumento; import it.acxent.contab.TipoDocumento; import it.acxent.db.ApplParmFull; import it.acxent.db.DBAdapter; import it.acxent.db.ResParm; import it.acxent.util.AbMessages; import it.acxent.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 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, 0L, 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, "File export in formato cvs (Excel)"); } }