657 lines
25 KiB
Java
657 lines
25 KiB
Java
package it.acxent.contab;
|
|
|
|
import com.lowagie.text.Cell;
|
|
import com.lowagie.text.Chunk;
|
|
import com.lowagie.text.Document;
|
|
import com.lowagie.text.Element;
|
|
import com.lowagie.text.Font;
|
|
import com.lowagie.text.HeaderFooter;
|
|
import com.lowagie.text.PageSize;
|
|
import com.lowagie.text.Phrase;
|
|
import com.lowagie.text.Table;
|
|
import com.lowagie.text.pdf.PdfWriter;
|
|
import it.acxent.anag.Clifor;
|
|
import it.acxent.db.ApplParmFull;
|
|
import it.acxent.db.WcString;
|
|
import it.acxent.util.DoubleOperator;
|
|
import it.acxent.util.PdfFontFactory;
|
|
import it.acxent.util.SimpleDateFormat;
|
|
import it.acxent.util.Vectumerator;
|
|
import java.awt.Color;
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.io.FileOutputStream;
|
|
import java.io.Serializable;
|
|
import java.sql.Date;
|
|
import java.sql.PreparedStatement;
|
|
import java.sql.SQLException;
|
|
import java.text.NumberFormat;
|
|
import java.util.Calendar;
|
|
|
|
public class DocumentoAgente extends _ContabAdapter implements Serializable {
|
|
private long id_documentoAgente;
|
|
|
|
private long id_documento;
|
|
|
|
private long id_cliforDA;
|
|
|
|
private double percDocumentoAgente = -1.0D;
|
|
|
|
private Documento documento;
|
|
|
|
private Clifor agente;
|
|
|
|
private double importoDocumentoAgente;
|
|
|
|
public DocumentoAgente(ApplParmFull newApplParmFull) {
|
|
super(newApplParmFull);
|
|
}
|
|
|
|
public DocumentoAgente() {}
|
|
|
|
public long getId_documentoAgente() {
|
|
return this.id_documentoAgente;
|
|
}
|
|
|
|
public void setId_documentoAgente(long id_documentoAgente) {
|
|
this.id_documentoAgente = id_documentoAgente;
|
|
}
|
|
|
|
public long getId_documento() {
|
|
return this.id_documento;
|
|
}
|
|
|
|
public void setId_documento(long id_documento) {
|
|
this.id_documento = id_documento;
|
|
}
|
|
|
|
public long getId_cliforDA() {
|
|
return this.id_cliforDA;
|
|
}
|
|
|
|
public void setId_cliforDA(long id_clifor) {
|
|
this.id_cliforDA = id_clifor;
|
|
}
|
|
|
|
public double getPercDocumentoAgente() {
|
|
return this.percDocumentoAgente;
|
|
}
|
|
|
|
public void setPercDocumentoAgente(double percDocumentoAgente) {
|
|
this.percDocumentoAgente = percDocumentoAgente;
|
|
}
|
|
|
|
public Documento getDocumento() {
|
|
this.documento = new Documento(getApFull());
|
|
this.documento.findByPrimaryKey(getId_documento());
|
|
return this.documento;
|
|
}
|
|
|
|
public void setDocumento(Documento documento) {
|
|
this.documento = documento;
|
|
}
|
|
|
|
public Clifor getAgente() {
|
|
this.agente = new Clifor(getApFull());
|
|
this.agente.findByPrimaryKey(getId_cliforDA());
|
|
return this.agente;
|
|
}
|
|
|
|
public void setAgente(Clifor agente) {
|
|
this.agente = agente;
|
|
}
|
|
|
|
public Vectumerator findByCR(DocumentoAgenteCR CR, int pageNumber, int pageRows) {
|
|
String s_Sql_Find = "select A.* , B.cognome, B.nome from DOCUMENTO_AGENTE AS A inner join CLIFOR AS B on A.id_cliforDA=B.id_clifor inner join DOCUMENTO as C on A.id_documento=C.id_documento";
|
|
String s_Sql_Order = " order by B.cognome, B.nome, A.id_cliforDA";
|
|
WcString wc = new WcString();
|
|
if (CR.getId_documento() != 0L)
|
|
wc.addWc("A.id_documento = " + CR.getId_documento());
|
|
if (CR.getId_cliforDA() != 0L)
|
|
wc.addWc("A.id_cliforDA = " + CR.getId_cliforDA());
|
|
if (CR.getFlgPagata() == 0L) {
|
|
wc.addWc("(C.flgPagata is null or C.flgPagata=0)");
|
|
} else if (CR.getFlgPagata() > 0L) {
|
|
wc.addWc("C.flgPagata =" + CR.getFlgPagata());
|
|
}
|
|
if (CR.getDataDocumentoDa() != null)
|
|
wc.addWc("C.dataDocumento>=?");
|
|
if (CR.getDataDocumentoA() != null)
|
|
wc.addWc("C.dataDocumento<=?");
|
|
try {
|
|
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
|
int dataCount = 0;
|
|
if (CR.getDataDocumentoDa() != null) {
|
|
dataCount++;
|
|
stmt.setDate(dataCount, CR.getDataDocumentoDa());
|
|
}
|
|
if (CR.getDataDocumentoA() != null) {
|
|
dataCount++;
|
|
stmt.setDate(dataCount, CR.getDataDocumentoA());
|
|
}
|
|
return findRows(stmt, pageNumber, pageRows);
|
|
} catch (SQLException e) {
|
|
handleDebug(e);
|
|
return AB_EMPTY_VECTUMERATOR;
|
|
}
|
|
}
|
|
|
|
public void findByDocumentoAgente(long l_id_documento, long l_id_agente) {
|
|
String s_Sql_Find = "select A.* from DOCUMENTO_AGENTE AS A";
|
|
String s_Sql_Order = " ";
|
|
WcString wc = new WcString();
|
|
wc.addWc("A.id_documento = " + l_id_documento);
|
|
wc.addWc("A.id_clifor = " + l_id_agente);
|
|
try {
|
|
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
|
findFirstRecord(stmt);
|
|
} catch (SQLException e) {
|
|
handleDebug(e);
|
|
}
|
|
}
|
|
|
|
public void deleteAgentiByDocumento(long id_documento) {
|
|
DocumentoAgenteCR CR = new DocumentoAgenteCR();
|
|
CR.setId_documento(id_documento);
|
|
Vectumerator vec = new DocumentoAgente(getApFull()).findByCR(CR, 0, 0);
|
|
while (vec.hasMoreElements()) {
|
|
DocumentoAgente row = (DocumentoAgente)vec.nextElement();
|
|
row.delete();
|
|
}
|
|
}
|
|
|
|
public Vectumerator findByDocumento(long id_documento) {
|
|
String s_Sql_Find = "select A.* from DOCUMENTO_AGENTE 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);
|
|
} catch (SQLException e) {
|
|
handleDebug(e);
|
|
return AB_EMPTY_VECTUMERATOR;
|
|
}
|
|
}
|
|
|
|
public double getImportoDocumentoAgente() {
|
|
if (getId_documentoAgente() > 0L && getId_documento() > 0L &&
|
|
this.importoDocumentoAgente == -1.0D) {
|
|
DoubleOperator dp = new DoubleOperator(getDocumento().getImponibileTotale());
|
|
dp.setScale(2, 5);
|
|
dp.multiply(getPercDocumentoAgente());
|
|
dp.divide(100.0F);
|
|
this.importoDocumentoAgente = dp.getResult();
|
|
}
|
|
return (this.importoDocumentoAgente == -1.0D) ? 0.0D : this.importoDocumentoAgente;
|
|
}
|
|
|
|
public void setImportoDocumentoAgente(double importoDocumentoAgente) {
|
|
this.importoDocumentoAgente = importoDocumentoAgente;
|
|
}
|
|
|
|
public String getTotaleProvvigioniByDocumento(long id_documento) {
|
|
String s_Sql_Find = "select A.* from DOCUMENTO_AGENTE 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());
|
|
Vectumerator vec = findRows(stmt);
|
|
Documento doc = new Documento(getApFull());
|
|
doc.findByPrimaryKey(id_documento);
|
|
double totDoc = doc.getTotaleDaPagare();
|
|
DoubleOperator totRes = new DoubleOperator(0.0F);
|
|
while (vec.hasMoreElements()) {
|
|
DocumentoAgente docage = (DocumentoAgente)vec.nextElement();
|
|
DoubleOperator dp = new DoubleOperator(totDoc);
|
|
dp.multiply(docage.getPercDocumentoAgente());
|
|
dp.divide(100.0F);
|
|
totRes.add(dp.getResult());
|
|
}
|
|
NumberFormat nf2 = NumberFormat.getInstance();
|
|
nf2.setMaximumFractionDigits(2);
|
|
nf2.setMinimumFractionDigits(2);
|
|
return String.valueOf(nf2.format(totRes.getResult()));
|
|
} catch (SQLException e) {
|
|
handleDebug(e);
|
|
return "";
|
|
}
|
|
}
|
|
|
|
public Vectumerator findByDocumentoOld(long id_documento) {
|
|
String s_Sql_Find = "select A.* from DOCUMENTO_AGENTE 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());
|
|
Vectumerator vec = findRows(stmt);
|
|
Vectumerator vecres = new Vectumerator();
|
|
Documento doc = new Documento(getApFull());
|
|
doc.findByPrimaryKey(id_documento);
|
|
double totDoc = doc.getTotaleDaPagare();
|
|
while (vec.hasMoreElements()) {
|
|
DocumentoAgente docage = (DocumentoAgente)vec.nextElement();
|
|
DoubleOperator dp = new DoubleOperator(totDoc);
|
|
dp.multiply(docage.getPercDocumentoAgente());
|
|
dp.divide(100.0F);
|
|
docage.setImportoDocumentoAgente(dp.getResult());
|
|
vecres.add(docage);
|
|
}
|
|
return vecres;
|
|
} catch (SQLException e) {
|
|
handleDebug(e);
|
|
return AB_EMPTY_VECTUMERATOR;
|
|
}
|
|
}
|
|
|
|
protected void initFields() {
|
|
super.initFields();
|
|
this.importoDocumentoAgente = -1.0D;
|
|
}
|
|
|
|
public ByteArrayOutputStream creaPdfreportProvvigioni(DocumentoAgenteCR CR, RigaDocumentoProgettistaCR CRRDA) {
|
|
ByteArrayOutputStream ba = new ByteArrayOutputStream();
|
|
Cell cell = new Cell();
|
|
int cellLeading = 10;
|
|
int corpoPadding = 2;
|
|
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
|
|
Calendar cal = Calendar.getInstance();
|
|
SimpleDateFormat sdfh = new SimpleDateFormat("hh:mm");
|
|
NumberFormat nf = NumberFormat.getInstance();
|
|
nf.setMinimumFractionDigits(2);
|
|
nf.setMaximumFractionDigits(2);
|
|
Date dataVisita = null;
|
|
int col1 = 5, col2 = 18, col3 = 4, col4 = 4, col5 = 4, col6 = 2, col7 = 3;
|
|
try {
|
|
this.document = new Document(PageSize.A4, 20.0F, 20.0F, 20.0F, 10.0F);
|
|
String nomeFile = CR.getFileName();
|
|
if (nomeFile.isEmpty()) {
|
|
this.writer = PdfWriter.getInstance(this.document, ba);
|
|
} else {
|
|
PdfWriter.getInstance(this.document, new FileOutputStream(nomeFile));
|
|
}
|
|
Font PDF_riga = PdfFontFactory.PDF_fPiccolo;
|
|
Phrase pHh = new Phrase(new Chunk("Provvigioni Agenti " + CR.getDescrizioneCR(), PdfFontFactory.PDF_fGrandeB));
|
|
HeaderFooter header = new HeaderFooter(pHh, false);
|
|
header.setAlignment(0);
|
|
header.setBorder(0);
|
|
this.document.setHeader(header);
|
|
Phrase pH = new Phrase("Data/ora stampa: " + sdf.format(getToday()) + " " + sdfh.format(Long.valueOf(cal.getTimeInMillis())) + " pag. ");
|
|
HeaderFooter footer = new HeaderFooter(pH, true);
|
|
footer.setAlignment(2);
|
|
footer.setBorder(0);
|
|
this.document.setFooter(footer);
|
|
this.document.open();
|
|
DocumentoAgente bean = new DocumentoAgente(getApFull());
|
|
Table corpo = null;
|
|
corpo = new Table(40);
|
|
corpo.setWidth(100.0F);
|
|
corpo.setPadding((float)corpoPadding);
|
|
corpo.setSpacing(0.0F);
|
|
corpo.setWidths(colWidthsRighe40);
|
|
corpo.setBorder(0);
|
|
corpo.endHeaders();
|
|
long l_id_currentAgente = 0L;
|
|
Clifor currentAgente = null;
|
|
Vectumerator<DocumentoAgente> vec = bean.findByCR(CR, 0, 0);
|
|
DoubleOperator totProvvAgente = new DoubleOperator(), totProvvigioni = new DoubleOperator();
|
|
while (vec.hasMoreElements()) {
|
|
DocumentoAgente row = (DocumentoAgente)vec.nextElement();
|
|
if (row.getId_cliforDA() != l_id_currentAgente) {
|
|
if (l_id_currentAgente > 0L) {
|
|
cell = new Cell();
|
|
cell.add(new Chunk("TOTALE provvigioni per " + currentAgente.getDescrizioneCompleta(), PdfFontFactory.PDF_fGrandeB));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setBackgroundColor(Color.LIGHT_GRAY);
|
|
cell.setColspan(40 - col7);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk(getNf().format(totProvvAgente.getResult()), PdfFontFactory.PDF_fGrandeB));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setBackgroundColor(Color.LIGHT_GRAY);
|
|
cell.setColspan(col7);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
this.document.add((Element)corpo);
|
|
this.document.newPage();
|
|
corpo = new Table(40);
|
|
corpo.setWidth(100.0F);
|
|
corpo.setPadding((float)corpoPadding);
|
|
corpo.setSpacing(0.0F);
|
|
corpo.setWidths(colWidthsRighe40);
|
|
corpo.setBorder(0);
|
|
}
|
|
cell = new Cell();
|
|
cell.add(new Chunk("Elenco provvigioni per " + row.getAgente().getDescrizioneCompleta() + " (" +
|
|
row.getAgente().getDescrizioneAgenteResponsabileCommerciale() + ")", PdfFontFactory.PDF_fGrandeB));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setBackgroundColor(Color.LIGHT_GRAY);
|
|
cell.setColspan(40);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk("N. Doc.", PdfFontFactory.PDF_fMedioB));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setBackgroundColor(Color.LIGHT_GRAY);
|
|
cell.setColspan(col1);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk("Intestazione", PdfFontFactory.PDF_fMedioB));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setBackgroundColor(Color.LIGHT_GRAY);
|
|
cell.setColspan(col2);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk("Data Doc.", PdfFontFactory.PDF_fMedioB));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setBackgroundColor(Color.LIGHT_GRAY);
|
|
cell.setColspan(col3);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk("Tot. Doc.", PdfFontFactory.PDF_fMedioB));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setBackgroundColor(Color.LIGHT_GRAY);
|
|
cell.setColspan(col4);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk("Imponibile", PdfFontFactory.PDF_fMedioB));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setBackgroundColor(Color.LIGHT_GRAY);
|
|
cell.setColspan(col5);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk("Perc.%", PdfFontFactory.PDF_fMedioB));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setBackgroundColor(Color.LIGHT_GRAY);
|
|
cell.setColspan(col6);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk("Importo", PdfFontFactory.PDF_fMedioB));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setBackgroundColor(Color.LIGHT_GRAY);
|
|
cell.setColspan(col7);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
l_id_currentAgente = row.getId_cliforDA();
|
|
currentAgente = row.getAgente();
|
|
totProvvAgente = new DoubleOperator();
|
|
}
|
|
totProvvAgente.add(row.getImportoDocumentoAgente());
|
|
totProvvigioni.add(row.getImportoDocumentoAgente());
|
|
cell = new Cell();
|
|
cell.add(new Chunk(row.getDocumento().getNumeroDocumentoCompleto(), PDF_riga));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setColspan(col1);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk(row.getDocumento().getNominativoDocumento(), PDF_riga));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setColspan(col2);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk(getDataFormat().format(row.getDocumento().getDataDocumento()), PdfFontFactory.PDF_fPiccolo));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setColspan(col3);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk(getNf().format(row.getDocumento().getTotaleDocumento()), PDF_riga));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setColspan(col4);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk(getNf().format(row.getDocumento().getImponibileTotale()), PDF_riga));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setColspan(col5);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk(getNf().format(row.getPercDocumentoAgente()), PDF_riga));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setColspan(col6);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk(nf.format(row.getImportoDocumentoAgente()), PDF_riga));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setColspan(col7);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
}
|
|
if (l_id_currentAgente > 0L) {
|
|
cell = new Cell();
|
|
cell.add(new Chunk("TOTALE provvigioni per " + currentAgente.getDescrizioneCompleta(), PdfFontFactory.PDF_fGrandeB));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setBackgroundColor(Color.LIGHT_GRAY);
|
|
cell.setColspan(40 - col7);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk(getNf().format(totProvvAgente.getResult()), PdfFontFactory.PDF_fGrandeB));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setBackgroundColor(Color.LIGHT_GRAY);
|
|
cell.setColspan(col7);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
}
|
|
this.document.add((Element)corpo);
|
|
RigaDocumentoProgettista beanRDA = new RigaDocumentoProgettista(getApFull());
|
|
corpo = new Table(40);
|
|
corpo.setWidth(100.0F);
|
|
corpo.setPadding((float)corpoPadding);
|
|
corpo.setSpacing(0.0F);
|
|
corpo.setWidths(colWidthsRighe40);
|
|
corpo.setBorder(0);
|
|
corpo.endHeaders();
|
|
long l_id_currentProgettista = 0L;
|
|
Clifor currentProgettista = null;
|
|
Vectumerator<RigaDocumentoProgettista> vecP = beanRDA.findByCR(CRRDA, 0, 0);
|
|
if (vecP.hasMoreElements())
|
|
this.document.newPage();
|
|
DoubleOperator totProvvProgettista = new DoubleOperator(), totProvvigioniP = new DoubleOperator();
|
|
while (vecP.hasMoreElements()) {
|
|
RigaDocumentoProgettista row = (RigaDocumentoProgettista)vecP.nextElement();
|
|
if (row.getId_cliforRDA() != l_id_currentProgettista) {
|
|
if (l_id_currentProgettista > 0L) {
|
|
cell = new Cell();
|
|
cell.add(new Chunk("TOTALE provvigioni per " + row.getProgettista().getDescrizioneCompleta(), PdfFontFactory.PDF_fGrandeB));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setBackgroundColor(Color.LIGHT_GRAY);
|
|
cell.setColspan(40 - col7);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk(getNf().format(totProvvProgettista.getResult()), PdfFontFactory.PDF_fGrandeB));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setBackgroundColor(Color.LIGHT_GRAY);
|
|
cell.setColspan(col7);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
this.document.add((Element)corpo);
|
|
this.document.newPage();
|
|
corpo = new Table(40);
|
|
corpo.setWidth(100.0F);
|
|
corpo.setPadding((float)corpoPadding);
|
|
corpo.setSpacing(0.0F);
|
|
corpo.setWidths(colWidthsRighe40);
|
|
corpo.setBorder(0);
|
|
}
|
|
cell = new Cell();
|
|
cell.add(new Chunk("Elenco provvigioni per " + row.getProgettista().getDescrizioneCompleta(), PdfFontFactory.PDF_fGrandeB));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setBackgroundColor(Color.LIGHT_GRAY);
|
|
cell.setColspan(40);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk("N. Doc.", PdfFontFactory.PDF_fMedioB));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setBackgroundColor(Color.LIGHT_GRAY);
|
|
cell.setColspan(col1);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk("Intestazione", PdfFontFactory.PDF_fMedioB));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setBackgroundColor(Color.LIGHT_GRAY);
|
|
cell.setColspan(col2);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk("Data Doc.", PdfFontFactory.PDF_fMedioB));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setBackgroundColor(Color.LIGHT_GRAY);
|
|
cell.setColspan(col3);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk("Articolo", PdfFontFactory.PDF_fMedioB));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setBackgroundColor(Color.LIGHT_GRAY);
|
|
cell.setColspan(col4);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk("Imponibile", PdfFontFactory.PDF_fMedioB));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setBackgroundColor(Color.LIGHT_GRAY);
|
|
cell.setColspan(col5);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk("Perc.%", PdfFontFactory.PDF_fMedioB));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setBackgroundColor(Color.LIGHT_GRAY);
|
|
cell.setColspan(col6);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk("Importo", PdfFontFactory.PDF_fMedioB));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setBackgroundColor(Color.LIGHT_GRAY);
|
|
cell.setColspan(col7);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
l_id_currentProgettista = row.getId_cliforRDA();
|
|
currentProgettista = row.getProgettista();
|
|
totProvvProgettista = new DoubleOperator();
|
|
}
|
|
totProvvProgettista.add(row.getImportoRDA());
|
|
totProvvigioniP.add(row.getImportoRDA());
|
|
cell = new Cell();
|
|
cell.add(new Chunk(row.getRigaDocumento().getDocumento().getNumeroDocumentoCompleto(), PDF_riga));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setColspan(col1);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk(row.getRigaDocumento().getDocumento().getNominativoDocumento(), PDF_riga));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setColspan(col2);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk(getDataFormat().format(row.getRigaDocumento().getDocumento().getDataDocumento()), PdfFontFactory.PDF_fPiccolo));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setColspan(col3);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk(row.getRigaDocumento().getDescrizioneRigaCompleta(), PDF_riga));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setColspan(col4);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk(nf.format(row.getRigaDocumento().getTotImponibileRigaConSconto()), PDF_riga));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setColspan(col5);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk(getNf().format(row.getPercRDA()), PDF_riga));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setColspan(col6);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk(nf.format(row.getImportoRDA()), PDF_riga));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setColspan(col7);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
}
|
|
if (l_id_currentProgettista > 0L) {
|
|
cell = new Cell();
|
|
cell.add(new Chunk("TOTALE provvigioni per " + currentProgettista.getDescrizioneCompleta(), PdfFontFactory.PDF_fGrandeB));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setBackgroundColor(Color.LIGHT_GRAY);
|
|
cell.setColspan(40 - col7);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
cell = new Cell();
|
|
cell.add(new Chunk(getNf().format(totProvvProgettista.getResult()), PdfFontFactory.PDF_fGrandeB));
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setHorizontalAlignment(0);
|
|
cell.setBackgroundColor(Color.LIGHT_GRAY);
|
|
cell.setColspan(col7);
|
|
cell.setRowspan(1);
|
|
corpo.addCell(cell);
|
|
}
|
|
this.document.add((Element)corpo);
|
|
this.document.close();
|
|
this.document = null;
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
return ba;
|
|
}
|
|
}
|