1707 lines
71 KiB
Java
1707 lines
71 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.Paragraph;
|
|
import com.lowagie.text.Phrase;
|
|
import com.lowagie.text.Table;
|
|
import com.lowagie.text.pdf.PdfWriter;
|
|
import it.acxent.anag.Iva;
|
|
import it.acxent.contab.iva.RiepilogoIva;
|
|
import it.acxent.contab.iva.RiepilogoIvaItem;
|
|
import it.acxent.contab.iva.RigaRegistroIvaItem;
|
|
import it.acxent.contab.iva.RigheRegistroIva;
|
|
import it.acxent.db.ApplParmFull;
|
|
import it.acxent.db.DBAdapter;
|
|
import it.acxent.db.WcString;
|
|
import it.acxent.util.DoubleOperator;
|
|
import it.acxent.util.PdfFontFactory;
|
|
import it.acxent.util.SimpleDateFormat;
|
|
import it.acxent.util.StringTokenizer;
|
|
import it.acxent.util.Vectumerator;
|
|
import java.io.File;
|
|
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;
|
|
import java.util.Enumeration;
|
|
|
|
public class RegistroIva extends _ContabAdapter implements Serializable {
|
|
private long id_registroIva;
|
|
|
|
private long anno;
|
|
|
|
private Date dataUltimaStampa;
|
|
|
|
private long ultimaPagina;
|
|
|
|
private String flgTipoRegistro;
|
|
|
|
private long ultimaRiga;
|
|
|
|
private long flgTipoLiquidazione;
|
|
|
|
private long flgMeseStampato;
|
|
|
|
private long flgAnnoStampato;
|
|
|
|
private long flgTrimestreStampato;
|
|
|
|
private static long RI_ACQUISTI = 2L;
|
|
|
|
private static long RI_VENDITA = 1L;
|
|
|
|
private Date dataA;
|
|
|
|
private Date dataDa;
|
|
|
|
private String fileName;
|
|
|
|
private long flgOss;
|
|
|
|
private long paginaPdf;
|
|
|
|
private boolean rivaOk = false;
|
|
|
|
private long pagIniziale;
|
|
|
|
private long rigaIniziale;
|
|
|
|
private long flgDefinitivo;
|
|
|
|
private boolean riepOk = false;
|
|
|
|
private String flgPeriodo;
|
|
|
|
static String PERIODO_I_TRIM = "1T";
|
|
|
|
static String PERIODO_II_TRIM = "2T";
|
|
|
|
static String PERIODO_IV_TRIM = "4T";
|
|
|
|
static String PERIODO_III_TRIM = "3T";
|
|
|
|
public RegistroIva() {}
|
|
|
|
private RegistroIva(ApplParmFull newApplParmFull) {
|
|
super(newApplParmFull);
|
|
}
|
|
|
|
public void setId_registroIva(long newId_registroIva) {
|
|
this.id_registroIva = newId_registroIva;
|
|
}
|
|
|
|
public void setAnno(long newAnno) {
|
|
this.anno = newAnno;
|
|
}
|
|
|
|
public void setDataUltimaStampa(Date newDataUltimaStampa) {
|
|
this.dataUltimaStampa = newDataUltimaStampa;
|
|
}
|
|
|
|
public void setUltimaPagina(long newUltimaPagina) {
|
|
this.ultimaPagina = newUltimaPagina;
|
|
}
|
|
|
|
public void setFlgTipoRegistro(String newFlgTipoRegistro) {
|
|
this.flgTipoRegistro = newFlgTipoRegistro;
|
|
}
|
|
|
|
public void setUltimaRiga(long newUltimaRiga) {
|
|
this.ultimaRiga = newUltimaRiga;
|
|
}
|
|
|
|
public void setFlgTipoLiquidazione(long newFlgTipoLiquidazione) {
|
|
this.flgTipoLiquidazione = newFlgTipoLiquidazione;
|
|
}
|
|
|
|
public void setFlgMeseStampato(long newFlgMeseStampato) {
|
|
this.flgMeseStampato = newFlgMeseStampato;
|
|
}
|
|
|
|
public void setFlgAnnoStampato(long newFlgAnnoStampato) {
|
|
this.flgAnnoStampato = newFlgAnnoStampato;
|
|
}
|
|
|
|
public void setFlgTrimestreStampato(long newFlgTrimestreStampato) {
|
|
this.flgTrimestreStampato = newFlgTrimestreStampato;
|
|
}
|
|
|
|
public long getId_registroIva() {
|
|
return this.id_registroIva;
|
|
}
|
|
|
|
public long getAnno() {
|
|
return this.anno;
|
|
}
|
|
|
|
public Date getDataUltimaStampa() {
|
|
return this.dataUltimaStampa;
|
|
}
|
|
|
|
public long getUltimaPagina() {
|
|
return this.ultimaPagina;
|
|
}
|
|
|
|
public String getFlgTipoRegistro() {
|
|
return (this.flgTipoRegistro == null) ? "" : this.flgTipoRegistro.trim();
|
|
}
|
|
|
|
public long getUltimaRiga() {
|
|
return this.ultimaRiga;
|
|
}
|
|
|
|
public long getFlgTipoLiquidazione() {
|
|
return this.flgTipoLiquidazione;
|
|
}
|
|
|
|
public long getFlgMeseStampato() {
|
|
return this.flgMeseStampato;
|
|
}
|
|
|
|
public long getFlgAnnoStampato() {
|
|
return this.flgAnnoStampato;
|
|
}
|
|
|
|
public long getFlgTrimestreStampato() {
|
|
return this.flgTrimestreStampato;
|
|
}
|
|
|
|
protected void deleteCascade() {}
|
|
|
|
public Vectumerator findByCR(RegistroIvaCR CR, int pageNumber, int pageRows) {
|
|
String s_Sql_Find = "select A.* from REGISTRO_IVA 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) {
|
|
removeCPConnection();
|
|
handleDebug(e);
|
|
return AB_EMPTY_VECTUMERATOR;
|
|
}
|
|
}
|
|
|
|
public static final RegistroIva getInstance(ApplParmFull newApplParmFull, long l_tipo) {
|
|
RegistroIva ri = new RegistroIva(newApplParmFull);
|
|
try {
|
|
ri.findByPrimaryKey(l_tipo);
|
|
if (ri.getDBState() == 0) {
|
|
ri.setId_registroIva(l_tipo);
|
|
ri.setPagIniziale(1L);
|
|
ri.setAnno((long)Calendar.getInstance().get(1));
|
|
ri.save();
|
|
}
|
|
return ri;
|
|
} catch (Exception e) {
|
|
ri.handleDebug(e);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
private void creaIntestazione() {
|
|
try {
|
|
int cellLeading = 12;
|
|
Font fMedioB = new Font(2, 10.0F, 1);
|
|
Cell cell = new Cell(new Chunk("Riga", fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(2);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Data Reg.", fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(3);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("N. Doc.", fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(3);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Data Doc.", fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(3);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Ragione Sociale", fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(9);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Tipo", fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(5);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Totale Doc.", fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(3);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Imponibile", fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(3);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Iva", fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(3);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Cod. Iva", fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(6);
|
|
this.pdfcorpo.addCell(cell);
|
|
} catch (Exception e) {}
|
|
}
|
|
|
|
public void creaRegistroIvaPdf() {
|
|
RiepilogoIva riepilogoIva = new RiepilogoIva();
|
|
this.paginaPdf = 0L;
|
|
String fullFileName = getPathTmpFull() + getPathTmpFull();
|
|
if (isFileExist(fullFileName))
|
|
new File(fullFileName).delete();
|
|
try {
|
|
this.document = new Document(PageSize.A4.rotate(), 20.0F, 20.0F, 20.0F, 10.0F);
|
|
PdfWriter theWriter = PdfWriter.getInstance(this.document, new FileOutputStream(fullFileName));
|
|
long numeroPagina = getPagIniziale();
|
|
int cellLeading = 12;
|
|
Cell blankCell = new Cell();
|
|
blankCell.setLeading((float)cellLeading);
|
|
blankCell.setBorder(0);
|
|
NumberFormat nf = getNf();
|
|
SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
|
|
Paragraph paragraph = creaParagrafoConGrassetto(getHeaderDoocumento(1) + "\n" + getHeaderDoocumento(1), PDF_fMedio, PDF_fMedioB);
|
|
Iva iva20 = new Iva(getApFull());
|
|
iva20.findByPrimaryKey(getCodiceIvaVendStd());
|
|
String temp = "";
|
|
if (getPeriodo().isEmpty()) {
|
|
temp = temp + " - " + temp + " - " + df.format(getDataDa());
|
|
} else {
|
|
temp = temp + " - " + temp;
|
|
}
|
|
if (getFlgDefinitivo() == 0L)
|
|
temp = temp + " - STAMPA DI PROVA";
|
|
temp = temp + " pag. ";
|
|
if (getId_registroIva() == RI_ACQUISTI) {
|
|
paragraph.add(new Chunk("\nRegistro iva ACQUISTI " + temp, PdfFontFactory.PDF_fGrandeB));
|
|
} else {
|
|
paragraph.add(new Chunk("\nRegistro iva VENDITE " + temp, PdfFontFactory.PDF_fGrandeB));
|
|
}
|
|
HeaderFooter header = new HeaderFooter((Phrase)paragraph, true);
|
|
header.setAlignment(0);
|
|
header.setBorder(0);
|
|
this.document.setHeader(header);
|
|
this.document.setPageCount((int)numeroPagina - 1);
|
|
this.document.open();
|
|
long numeroRiga = getRigaIniziale();
|
|
prepareNewPdfCorpoDocument();
|
|
this.pdfcorpo.setBorderWidth(1.0F);
|
|
creaIntestazione();
|
|
this.pdfcorpo.endHeaders();
|
|
Documento documento = new Documento(getApFull());
|
|
DocumentoCR CR = new DocumentoCR(getApFull());
|
|
CR.setDataDocumentoDa(getDataDa());
|
|
CR.setDataDocumentoA(getDataA());
|
|
CR.setFlgStato(1L);
|
|
CR.setFlgOrderBy(9L);
|
|
CR.setFlgOss(getFlgOss());
|
|
if (getId_registroIva() == RI_ACQUISTI) {
|
|
CR.setFlgTipologia(20L);
|
|
CR.setFlgClienteFornitore("F");
|
|
} else {
|
|
CR.setFlgTipologia(20L);
|
|
CR.setFlgClienteFornitore("C");
|
|
}
|
|
Vectumerator<Documento> vec = documento.findByCR(CR, 0, 0);
|
|
while (vec.hasMoreElements()) {
|
|
Date dataDoc;
|
|
String numDoc;
|
|
Documento row = (Documento)vec.nextElement();
|
|
if (row.getProgDocumento() == 5L)
|
|
System.out.println("555");
|
|
Date dataReg = row.getDataDocumento();
|
|
if (getId_registroIva() == RI_ACQUISTI) {
|
|
numDoc = row.getRiferimento();
|
|
dataDoc = row.getDataRiferimento();
|
|
} else {
|
|
numDoc = row.getNumeroDocumento();
|
|
dataDoc = row.getDataDocumento();
|
|
}
|
|
String ragSoc = row.getClifor().getDescrizioneCompleta();
|
|
if (ragSoc.length() > 30)
|
|
ragSoc = ragSoc.substring(0, 30);
|
|
String tipo = row.getTipoDocumento().getDescrizione();
|
|
double totDoc = row.getTotaleDocumentoSenzaRitenuta();
|
|
RigheRegistroIva rri = row.getRigaRegistroIvaCompleto();
|
|
if (row.getTipoDocumento().getFlgTipologia() == 1L) {
|
|
boolean fatturaPositiva = true;
|
|
} else {
|
|
boolean fatturaPositiva = false;
|
|
}
|
|
boolean isNotaDiCredito = true;
|
|
if (row.getTipoDocumento().getFlgTipologia() == 1L)
|
|
isNotaDiCredito = false;
|
|
boolean isPIva = !row.getClifor().getPIva().isEmpty();
|
|
Enumeration<RigaRegistroIvaItem> enuRrri = rri.elements();
|
|
boolean flgPrimaRiga = true;
|
|
while (enuRrri.hasMoreElements()) {
|
|
RigaRegistroIvaItem rrii = enuRrri.nextElement();
|
|
double imponibile = rrii.getImponibile();
|
|
double iva = rrii.getImportoIva();
|
|
String codIva = rrii.getIva().getDescrizione();
|
|
creaRigaRegistro(numeroRiga, row, dataReg, dataDoc, numDoc, ragSoc, tipo, codIva, totDoc, imponibile, iva, flgPrimaRiga);
|
|
flgPrimaRiga = false;
|
|
riepilogoIva.addRigaRegistroIvaItem(rrii, isNotaDiCredito, isPIva,
|
|
(row.getClifor().getFlgSplitPayment() == 1L));
|
|
}
|
|
numeroRiga++;
|
|
}
|
|
Cell cell = new Cell(new Chunk("\n\n\n", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(8);
|
|
this.pdfcorpo.addCell(cell);
|
|
this.document.add((Element)this.pdfcorpo);
|
|
this.document.newPage();
|
|
float[] colWidthsRiepilogo = { 30.0F, 10.0F, 10.0F, 10.0F, 10.0F, 10.0F, 10.0F, 10.0F };
|
|
if (getId_registroIva() == RI_VENDITA) {
|
|
this.pdfcorpo = new Table(8);
|
|
this.pdfcorpo.setWidth(100.0F);
|
|
this.pdfcorpo.setPadding(2.0F);
|
|
this.pdfcorpo.setSpacing(0.0F);
|
|
this.pdfcorpo.setWidths(colWidthsRiepilogo);
|
|
cell = new Cell(new Chunk("Codice IVA CON P.I./Cod. Fisc.", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Imponibile", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Imposta", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Esente/N.I.", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Imponibile Indetr.", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Imposta Indetr.", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Split Payment", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("% Ind.", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
Enumeration<RiepilogoIvaItem> enumeration = riepilogoIva.elementsConPI();
|
|
DoubleOperator doubleOperator1 = new DoubleOperator(0.0F);
|
|
DoubleOperator doubleOperator2 = new DoubleOperator(0.0F);
|
|
DoubleOperator doubleOperator3 = new DoubleOperator(0.0F);
|
|
DoubleOperator doubleOperator4 = new DoubleOperator(0.0F);
|
|
DoubleOperator doubleOperator5 = new DoubleOperator(0.0F);
|
|
DoubleOperator doubleOperator6 = new DoubleOperator(0.0F);
|
|
while (enumeration.hasMoreElements()) {
|
|
RiepilogoIvaItem riepilogoIvaItem = enumeration.nextElement();
|
|
doubleOperator1.add(riepilogoIvaItem.getImponibile());
|
|
doubleOperator2.add(riepilogoIvaItem.getImposta());
|
|
doubleOperator3.add(riepilogoIvaItem.getEsente());
|
|
doubleOperator4.add(riepilogoIvaItem.getImponibileIndetraibile());
|
|
doubleOperator5.add(riepilogoIvaItem.getImpostaIndetraibile());
|
|
doubleOperator6.add(riepilogoIvaItem.getSplit());
|
|
cell = new Cell(new Chunk(riepilogoIvaItem.getIva().getDescrizione(), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((riepilogoIvaItem.getImponibile() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getImponibile()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((riepilogoIvaItem.getImposta() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getImposta()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((riepilogoIvaItem.getEsente() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getEsente()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((riepilogoIvaItem.getImponibileIndetraibile() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getImponibileIndetraibile()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((riepilogoIvaItem.getImponibileIndetraibile() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getImponibileIndetraibile()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((riepilogoIvaItem.getSplit() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getSplit()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((riepilogoIvaItem.getIva().getAliquotaIndetraibile() == 0L) ? "\n" : nf.format(riepilogoIvaItem.getIva().getAliquotaIndetraibile()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
}
|
|
cell = new Cell(new Chunk("TOTALI", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((doubleOperator1.getResult() == 0.0D) ? "\n" : nf.format(doubleOperator1.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((doubleOperator2.getResult() == 0.0D) ? "\n" : nf.format(doubleOperator2.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((doubleOperator3.getResult() == 0.0D) ? "\n" : nf.format(doubleOperator3.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((doubleOperator4.getResult() == 0.0D) ? "\n" : nf.format(doubleOperator4.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((doubleOperator5.getResult() == 0.0D) ? "\n" : nf.format(doubleOperator5.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((doubleOperator6.getResult() == 0.0D) ? "\n" : nf.format(doubleOperator6.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("\n", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
this.document.add((Element)this.pdfcorpo);
|
|
this.pdfcorpo = new Table(8);
|
|
this.pdfcorpo.setWidth(100.0F);
|
|
this.pdfcorpo.setPadding(2.0F);
|
|
this.pdfcorpo.setSpacing(0.0F);
|
|
this.pdfcorpo.setWidths(colWidthsRiepilogo);
|
|
cell = new Cell(new Chunk("Codice IVA SENZA P.I./Cod. Fisc.", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Imponibile", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Imposta", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Esente/N.I.", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Imponibile Indetr.", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Imposta Indetr.", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Split Payment", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("% Ind.", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
enumeration = riepilogoIva.elementsSenzaPI();
|
|
doubleOperator1 = new DoubleOperator(0.0F);
|
|
doubleOperator2 = new DoubleOperator(0.0F);
|
|
doubleOperator3 = new DoubleOperator(0.0F);
|
|
doubleOperator4 = new DoubleOperator(0.0F);
|
|
doubleOperator5 = new DoubleOperator(0.0F);
|
|
doubleOperator6 = new DoubleOperator(0.0F);
|
|
while (enumeration.hasMoreElements()) {
|
|
RiepilogoIvaItem riepilogoIvaItem = enumeration.nextElement();
|
|
doubleOperator1.add(riepilogoIvaItem.getImponibile());
|
|
doubleOperator2.add(riepilogoIvaItem.getImposta());
|
|
doubleOperator3.add(riepilogoIvaItem.getEsente());
|
|
doubleOperator4.add(riepilogoIvaItem.getImponibileIndetraibile());
|
|
doubleOperator5.add(riepilogoIvaItem.getImpostaIndetraibile());
|
|
doubleOperator6.add(riepilogoIvaItem.getSplit());
|
|
cell = new Cell(new Chunk(riepilogoIvaItem.getIva().getDescrizione(), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((riepilogoIvaItem.getImponibile() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getImponibile()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((riepilogoIvaItem.getImposta() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getImposta()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((riepilogoIvaItem.getEsente() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getEsente()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((riepilogoIvaItem.getImponibileIndetraibile() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getImponibileIndetraibile()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((riepilogoIvaItem.getImpostaIndetraibile() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getImpostaIndetraibile()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((riepilogoIvaItem.getSplit() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getSplit()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((riepilogoIvaItem.getIva().getAliquotaIndetraibile() == 0L) ? "\n" : nf.format(riepilogoIvaItem.getIva().getAliquotaIndetraibile()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
}
|
|
cell = new Cell(new Chunk("TOTALI", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((doubleOperator1.getResult() == 0.0D) ? "\n" : nf.format(doubleOperator1.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((doubleOperator2.getResult() == 0.0D) ? "\n" : nf.format(doubleOperator2.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((doubleOperator3.getResult() == 0.0D) ? "\n" : nf.format(doubleOperator3.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((doubleOperator4.getResult() == 0.0D) ? "\n" : nf.format(doubleOperator4.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((doubleOperator5.getResult() == 0.0D) ? "\n" : nf.format(doubleOperator5.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((doubleOperator6.getResult() == 0.0D) ? "\n" : nf.format(doubleOperator6.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("\n", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
this.document.add((Element)this.pdfcorpo);
|
|
}
|
|
this.pdfcorpo = new Table(8);
|
|
this.pdfcorpo.setWidth(100.0F);
|
|
this.pdfcorpo.setPadding(2.0F);
|
|
this.pdfcorpo.setSpacing(0.0F);
|
|
this.pdfcorpo.setWidths(colWidthsRiepilogo);
|
|
cell = new Cell(new Chunk("Codice IVA TOTALI", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Imponibile", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Imposta", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Esente/N.I.", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Imponibile Indetr.", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Imposta Indetr.", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Split Payment", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("% Ind.", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
Enumeration<RiepilogoIvaItem> vriep = riepilogoIva.elements();
|
|
DoubleOperator totImponibile = new DoubleOperator(0.0F);
|
|
DoubleOperator totImposta = new DoubleOperator(0.0F);
|
|
DoubleOperator totEsente = new DoubleOperator(0.0F);
|
|
DoubleOperator totImponibileIndetraibile = new DoubleOperator(0.0F);
|
|
DoubleOperator totImpostaIndetraibile = new DoubleOperator(0.0F);
|
|
DoubleOperator totSplit = new DoubleOperator(0.0F);
|
|
while (vriep.hasMoreElements()) {
|
|
RiepilogoIvaItem riepilogoIvaItem = vriep.nextElement();
|
|
totImponibile.add(riepilogoIvaItem.getImponibile());
|
|
totImposta.add(riepilogoIvaItem.getImposta());
|
|
totEsente.add(riepilogoIvaItem.getEsente());
|
|
totImponibileIndetraibile.add(riepilogoIvaItem.getImponibileIndetraibile());
|
|
totImpostaIndetraibile.add(riepilogoIvaItem.getImpostaIndetraibile());
|
|
totSplit.add(riepilogoIvaItem.getSplit());
|
|
cell = new Cell(new Chunk(riepilogoIvaItem.getIva().getDescrizione(), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((riepilogoIvaItem.getImponibile() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getImponibile()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((riepilogoIvaItem.getImposta() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getImposta()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((riepilogoIvaItem.getEsente() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getEsente()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((riepilogoIvaItem.getImponibileIndetraibile() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getImponibileIndetraibile()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((riepilogoIvaItem.getImpostaIndetraibile() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getImpostaIndetraibile()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((riepilogoIvaItem.getSplit() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getSplit()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((riepilogoIvaItem.getIva().getAliquotaIndetraibile() == 0L) ? "\n" : nf.format(riepilogoIvaItem.getIva().getAliquotaIndetraibile()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
}
|
|
cell = new Cell(new Chunk("TOTALI", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((totImponibile.getResult() == 0.0D) ? "\n" : nf.format(totImponibile.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((totImposta.getResult() == 0.0D) ? "\n" : nf.format(totImposta.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((totEsente.getResult() == 0.0D) ? "\n" : nf.format(totEsente.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((totImponibileIndetraibile.getResult() == 0.0D) ? "\n" : nf.format(totImponibileIndetraibile.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((totImpostaIndetraibile.getResult() == 0.0D) ? "\n" : nf.format(totImpostaIndetraibile.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((totSplit.getResult() == 0.0D) ? "\n" : nf.format(totSplit.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("\n", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
this.document.add((Element)this.pdfcorpo);
|
|
this.document.close();
|
|
numeroPagina = (long)theWriter.getPageNumber();
|
|
if (getFlgDefinitivo() == 1L) {
|
|
setDataUltimaStampa(getDataA());
|
|
Calendar cal = Calendar.getInstance();
|
|
cal.setTime(getDataA());
|
|
setAnno((long)cal.get(1));
|
|
setUltimaPagina(numeroPagina - 1L);
|
|
setUltimaRiga(numeroRiga - 1L);
|
|
save();
|
|
}
|
|
setRivaOk(true);
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
private void creaRigaRegistro(long numeroRiga, Documento bean, Date dataReg, Date dataDoc, String numDoc, String ragSoc, String flgTipoFattura, String codIva, double totDoc, double imponibile, double iva, boolean flgPR) {
|
|
try {
|
|
int cellLeading = 12;
|
|
NumberFormat nf = getNf();
|
|
SimpleDateFormat df = getDataFormat();
|
|
String segno = (bean.getTipoDocumento().getFlgTipologia() == 1L) ?
|
|
"" :
|
|
"-";
|
|
if (flgPR) {
|
|
cell = new Cell(new Chunk(String.valueOf(numeroRiga), PdfFontFactory.PDF_fMedio));
|
|
} else {
|
|
cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedio));
|
|
}
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(2);
|
|
this.pdfcorpo.addCell(cell);
|
|
if (flgPR) {
|
|
cell = new Cell(new Chunk(df.format(dataReg), PdfFontFactory.PDF_fMedio));
|
|
} else {
|
|
cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedio));
|
|
}
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(3);
|
|
this.pdfcorpo.addCell(cell);
|
|
if (flgPR) {
|
|
cell = new Cell(new Chunk(numDoc, PdfFontFactory.PDF_fPiccolo));
|
|
} else {
|
|
cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedio));
|
|
}
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(3);
|
|
this.pdfcorpo.addCell(cell);
|
|
if (flgPR) {
|
|
cell = new Cell(new Chunk(df.format(dataDoc), PdfFontFactory.PDF_fMedio));
|
|
} else {
|
|
cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedio));
|
|
}
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(3);
|
|
this.pdfcorpo.addCell(cell);
|
|
if (flgPR) {
|
|
cell = new Cell(new Chunk(ragSoc, PdfFontFactory.PDF_fMedio));
|
|
} else {
|
|
cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedio));
|
|
}
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(9);
|
|
this.pdfcorpo.addCell(cell);
|
|
if (flgPR) {
|
|
cell = new Cell(new Chunk(bean.getTipoDocumento().getDescrizione(), PdfFontFactory.PDF_fPiccolissimo));
|
|
} else {
|
|
cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedio));
|
|
}
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(5);
|
|
this.pdfcorpo.addCell(cell);
|
|
if (flgPR) {
|
|
cell = new Cell(new Chunk(segno + segno, PdfFontFactory.PDF_fMedio));
|
|
} else {
|
|
cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedio));
|
|
}
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(3);
|
|
this.pdfcorpo.addCell(cell);
|
|
Cell cell = new Cell(new Chunk(segno + segno, PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(3);
|
|
this.pdfcorpo.addCell(cell);
|
|
if (bean.getClifor().getFlgSplitPayment() == 1L) {
|
|
cell = new Cell(new Chunk(segno + segno + " (split)", PdfFontFactory.PDF_fMedioRosso));
|
|
} else {
|
|
cell = new Cell(new Chunk(segno + segno, PdfFontFactory.PDF_fMedio));
|
|
}
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(3);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk(codIva, PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(6);
|
|
this.pdfcorpo.addCell(cell);
|
|
} catch (Exception e) {}
|
|
}
|
|
|
|
public void aggiustaRPAIniziale() {
|
|
long currentAnno;
|
|
Calendar cal = Calendar.getInstance();
|
|
if (getDataUltimaStampa() == null) {
|
|
setAnno((long)getCurrentYear());
|
|
currentAnno = getAnno();
|
|
} else {
|
|
cal.setTime(getDataUltimaStampa());
|
|
currentAnno = (long)cal.get(1);
|
|
cal.add(6, 1);
|
|
setAnno((long)cal.get(1));
|
|
}
|
|
if (currentAnno == getAnno()) {
|
|
setPagIniziale(getUltimaPagina() + 1L);
|
|
setRigaIniziale(getUltimaRiga() + 1L);
|
|
} else {
|
|
setPagIniziale(1L);
|
|
setRigaIniziale(1L);
|
|
}
|
|
}
|
|
|
|
public boolean isProtocolloConBuchi(long anno) {
|
|
if (getApFull() == null)
|
|
return false;
|
|
if (anno == 0L) {
|
|
Calendar cal = Calendar.getInstance();
|
|
anno = (long)cal.get(1);
|
|
}
|
|
Documento bean = new Documento(getApFull());
|
|
return bean.isProgConBuchi(anno);
|
|
}
|
|
|
|
public boolean isRivaOk() {
|
|
return this.rivaOk;
|
|
}
|
|
|
|
public void setDataA(Date date) {
|
|
if (getFlgPeriodo().isEmpty())
|
|
this.dataA = date;
|
|
}
|
|
|
|
public void setDataDa(Date date) {
|
|
if (getFlgPeriodo().isEmpty())
|
|
this.dataDa = date;
|
|
}
|
|
|
|
public void setRivaOk(boolean b) {
|
|
this.rivaOk = b;
|
|
}
|
|
|
|
public String trovaPrimoBuco(long anno) {
|
|
if (getApFull() == null)
|
|
return "Protocolli F.A. anno" + anno + " ok";
|
|
if (anno == 0L) {
|
|
Calendar cal = Calendar.getInstance();
|
|
anno = (long)cal.get(1);
|
|
}
|
|
Documento bean = new Documento(getApFull());
|
|
return bean.trovaPrimoBuco(anno);
|
|
}
|
|
|
|
public long getPagIniziale() {
|
|
return (this.pagIniziale == 0L) ? (getUltimaPagina() + 1L) : this.pagIniziale;
|
|
}
|
|
|
|
public void setPagIniziale(long newPagIniziale) {
|
|
this.pagIniziale = newPagIniziale;
|
|
}
|
|
|
|
public long getRigaIniziale() {
|
|
return (this.rigaIniziale == 0L) ? (getUltimaRiga() + 1L) : this.rigaIniziale;
|
|
}
|
|
|
|
public void setRigaIniziale(long l) {
|
|
this.rigaIniziale = l;
|
|
}
|
|
|
|
public Date getDataA() {
|
|
return this.dataA;
|
|
}
|
|
|
|
public Date getDataDa() {
|
|
return this.dataDa;
|
|
}
|
|
|
|
public long getFlgDefinitivo() {
|
|
return this.flgDefinitivo;
|
|
}
|
|
|
|
public void setFlgDefinitivo(long flgDefinitivo) {
|
|
this.flgDefinitivo = flgDefinitivo;
|
|
}
|
|
|
|
public void setFileName(String fileName) {
|
|
this.fileName = fileName;
|
|
}
|
|
|
|
public String getNomeRegistro() {
|
|
if (!getFileName().isEmpty())
|
|
return getFileName().substring(getFileName().lastIndexOf(File.separator) + 1);
|
|
return "";
|
|
}
|
|
|
|
public boolean isRiepOk() {
|
|
return this.riepOk;
|
|
}
|
|
|
|
public void setRiepOk(boolean riepOk) {
|
|
this.riepOk = riepOk;
|
|
}
|
|
|
|
public String getFlgPeriodo() {
|
|
return (this.flgPeriodo == null) ? "" : this.flgPeriodo.trim();
|
|
}
|
|
|
|
public void setFlgPeriodo(String l_flgPeriodo) {
|
|
this.flgPeriodo = (l_flgPeriodo == null) ? "" : l_flgPeriodo.trim();
|
|
Calendar cal = Calendar.getInstance();
|
|
cal.set(1, (int)getAnno());
|
|
if (this.flgPeriodo.equals(PERIODO_I_TRIM)) {
|
|
Calendar temp = Calendar.getInstance();
|
|
this.dataDa = DBAdapter.getFirstOfYear((int)getAnno());
|
|
temp.set(cal.get(1), 2, 31);
|
|
Date td = new Date(temp.getTime().getTime());
|
|
this.dataA = td;
|
|
} else if (this.flgPeriodo.equals(PERIODO_II_TRIM)) {
|
|
Calendar temp = Calendar.getInstance();
|
|
temp.set(cal.get(1), 3, 1);
|
|
Date td = new Date(temp.getTime().getTime());
|
|
this.dataDa = td;
|
|
temp.set(cal.get(1), 5, 30);
|
|
td = new Date(temp.getTime().getTime());
|
|
this.dataA = td;
|
|
} else if (this.flgPeriodo.equals(PERIODO_III_TRIM)) {
|
|
Calendar temp = Calendar.getInstance();
|
|
temp.set(cal.get(1), 6, 1);
|
|
Date td = new Date(temp.getTime().getTime());
|
|
this.dataDa = td;
|
|
temp.set(cal.get(1), 8, 30);
|
|
td = new Date(temp.getTime().getTime());
|
|
this.dataA = td;
|
|
} else if (this.flgPeriodo.equals(PERIODO_IV_TRIM)) {
|
|
Calendar temp = Calendar.getInstance();
|
|
temp.set(cal.get(1), 9, 1);
|
|
Date td = new Date(temp.getTime().getTime());
|
|
this.dataDa = td;
|
|
this.dataA = DBAdapter.getLastOfYear((int)getAnno());
|
|
}
|
|
}
|
|
|
|
public void creaRiepilogoIvaPdf() {
|
|
RiepilogoIva riepilogoIvaAcquisti = new RiepilogoIva();
|
|
RiepilogoIva riepilogoIvaVendite = new RiepilogoIva();
|
|
this.paginaPdf = 0L;
|
|
try {
|
|
this.document = new Document(PageSize.A4.rotate(), 20.0F, 20.0F, 20.0F, 10.0F);
|
|
PdfWriter theWriter = PdfWriter.getInstance(this.document, new FileOutputStream(getFileName()));
|
|
int cellLeading = 12;
|
|
Cell blankCell = new Cell();
|
|
blankCell.setLeading((float)cellLeading);
|
|
blankCell.setBorder(0);
|
|
NumberFormat nf = getNf();
|
|
SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
|
|
Paragraph paragraph = creaParagrafoConGrassetto(getHeaderDoocumento(1) + "\n" + getHeaderDoocumento(1), PDF_fMedio, PDF_fMedioB);
|
|
Iva iva20 = new Iva(getApFull());
|
|
iva20.findByPrimaryKey(getCodiceIvaVendStd());
|
|
String temp = "";
|
|
if (getPeriodo().isEmpty()) {
|
|
temp = temp + " - " + temp + " - " + df.format(getDataDa());
|
|
} else {
|
|
temp = temp + " - " + temp;
|
|
}
|
|
temp = temp + " pag. ";
|
|
paragraph.add(new Chunk("\n\nSTAMPA RIEPILOGATIVA REGISTRI IVA " + temp, PdfFontFactory.PDF_fGrandeB));
|
|
HeaderFooter header = new HeaderFooter((Phrase)paragraph, true);
|
|
header.setAlignment(0);
|
|
header.setBorder(0);
|
|
this.document.setHeader(header);
|
|
this.document.open();
|
|
prepareNewPdfCorpoDocument();
|
|
this.pdfcorpo.setBorderWidth(1.0F);
|
|
this.pdfcorpo.endHeaders();
|
|
float[] colWidthsRiepilogo = { 30.0F, 10.0F, 10.0F, 10.0F, 10.0F, 10.0F, 10.0F, 10.0F };
|
|
Documento documento = new Documento(getApFull());
|
|
DocumentoCR CR = new DocumentoCR(getApFull());
|
|
CR.setDataDocumentoDa(getDataDa());
|
|
CR.setDataDocumentoA(getDataA());
|
|
CR.setFlgStato(1L);
|
|
CR.setFlgOrderBy(1L);
|
|
CR.setId_contatore(1L);
|
|
Vectumerator<Documento> vec = documento.findByCR(CR, 0, 0);
|
|
System.out.println("Vendite");
|
|
while (vec.hasMoreElements()) {
|
|
Documento row = (Documento)vec.nextElement();
|
|
System.out.println(row.getNumeroDocumentoCompleto());
|
|
RigheRegistroIva rri = row.getRigaRegistroIvaCompleto();
|
|
Enumeration<RigaRegistroIvaItem> enuRrri = rri.elements();
|
|
while (enuRrri.hasMoreElements())
|
|
RigaRegistroIvaItem rrii = enuRrri.nextElement();
|
|
}
|
|
this.pdfcorpo = new Table(8);
|
|
this.pdfcorpo.setWidth(100.0F);
|
|
this.pdfcorpo.setBorder(0);
|
|
this.pdfcorpo.setPadding(2.0F);
|
|
this.pdfcorpo.setSpacing(0.0F);
|
|
this.pdfcorpo.setWidths(colWidthsRiepilogo);
|
|
Cell cell = new Cell(new Chunk("REGISTRO IVA VENDITE", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(8);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Codice IVA ", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Imponibile", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Imposta", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Esente/N.I.", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Impon. Indetr.", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Imposta Indetr.", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Split Payment", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("% Ind.", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
Enumeration<RiepilogoIvaItem> vriep = riepilogoIvaVendite.elements();
|
|
DoubleOperator totImponibileVendite = new DoubleOperator(0.0F);
|
|
DoubleOperator totImpostaVendite = new DoubleOperator(0.0F);
|
|
DoubleOperator totEsenteVendite = new DoubleOperator(0.0F);
|
|
DoubleOperator totImponibileIndetraibileVendite = new DoubleOperator(0.0F);
|
|
DoubleOperator totImpostaIndetraibileVendite = new DoubleOperator(0.0F);
|
|
DoubleOperator totSplit = new DoubleOperator(0.0F);
|
|
while (vriep.hasMoreElements()) {
|
|
RiepilogoIvaItem ri = vriep.nextElement();
|
|
totImponibileVendite.add(ri.getImponibile());
|
|
totImpostaVendite.add(ri.getImposta());
|
|
totEsenteVendite.add(ri.getEsente());
|
|
totImponibileIndetraibileVendite.add(ri.getImponibileIndetraibile());
|
|
totImpostaIndetraibileVendite.add(ri.getImpostaIndetraibile());
|
|
totSplit.add(ri.getSplit());
|
|
cell = new Cell(new Chunk(ri.getIva().getDescrizione(), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((ri.getImponibile() == 0.0D) ? "\n" : nf.format(ri.getImponibile()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((ri.getImposta() == 0.0D) ? "\n" : nf.format(ri.getImposta()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((ri.getEsente() == 0.0D) ? "\n" : nf.format(ri.getEsente()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((ri.getImponibileIndetraibile() == 0.0D) ? "\n" : nf.format(ri.getImponibileIndetraibile()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((ri.getImpostaIndetraibile() == 0.0D) ? "\n" : nf.format(ri.getImpostaIndetraibile()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((ri.getSplit() == 0.0D) ? "\n" : nf.format(ri.getSplit()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((ri.getIva().getAliquotaIndetraibile() == 0L) ? "\n" : nf.format(ri.getIva().getAliquotaIndetraibile()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
}
|
|
cell = new Cell(new Chunk("TOTALI", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((totImponibileVendite.getResult() == 0.0D) ? "\n" : nf.format(totImponibileVendite.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((totImpostaVendite.getResult() == 0.0D) ? "\n" : nf.format(totImpostaVendite.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((totEsenteVendite.getResult() == 0.0D) ? "\n" : nf.format(totEsenteVendite.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((totImponibileIndetraibileVendite.getResult() == 0.0D) ? "\n" : nf.format(totImponibileIndetraibileVendite.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((totImpostaIndetraibileVendite.getResult() == 0.0D) ? "\n" : nf.format(totImpostaIndetraibileVendite.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((totSplit.getResult() == 0.0D) ? "\n" : nf.format(totSplit.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("\n", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("\n\n\n", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(8);
|
|
this.pdfcorpo.addCell(cell);
|
|
this.document.add((Element)this.pdfcorpo);
|
|
documento = new Documento(getApFull());
|
|
CR = new DocumentoCR(getApFull());
|
|
CR.setDataDocumentoDa(getDataDa());
|
|
CR.setDataDocumentoA(getDataA());
|
|
CR.setFlgStato(1L);
|
|
CR.setFlgOrderBy(1L);
|
|
CR.setId_contatore(2L);
|
|
vec = documento.findByCR(CR, 0, 0);
|
|
System.out.println("Acquisti");
|
|
while (vec.hasMoreElements()) {
|
|
Documento row = (Documento)vec.nextElement();
|
|
System.out.println(row.getNumeroDocumentoCompleto());
|
|
RigheRegistroIva rri = row.getRigaRegistroIvaCompleto();
|
|
Enumeration<RigaRegistroIvaItem> enuRrri = rri.elements();
|
|
while (enuRrri.hasMoreElements())
|
|
RigaRegistroIvaItem rrii = enuRrri.nextElement();
|
|
}
|
|
this.pdfcorpo = new Table(8);
|
|
this.pdfcorpo.setWidth(100.0F);
|
|
this.pdfcorpo.setBorder(0);
|
|
this.pdfcorpo.setPadding(2.0F);
|
|
this.pdfcorpo.setSpacing(0.0F);
|
|
this.pdfcorpo.setWidths(colWidthsRiepilogo);
|
|
cell = new Cell(new Chunk("REGISTRO IVA ACQUISTI", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(8);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Codice IVA ", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Imponibile", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Imposta", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Esente/N.I.", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Impon. Indetr.", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Imposta Indetr.", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Split Payment", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("% Ind.", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
vriep = riepilogoIvaAcquisti.elements();
|
|
DoubleOperator totImponibileAcquisti = new DoubleOperator(0.0F);
|
|
DoubleOperator totImpostaAcquisti = new DoubleOperator(0.0F);
|
|
DoubleOperator totEsenteAcquisti = new DoubleOperator(0.0F);
|
|
DoubleOperator totImponibileIndetraibileAcquisti = new DoubleOperator(0.0F);
|
|
DoubleOperator totImpostaIndetraibileAcquisti = new DoubleOperator(0.0F);
|
|
DoubleOperator totSplitAcquisti = new DoubleOperator(0.0F);
|
|
while (vriep.hasMoreElements()) {
|
|
RiepilogoIvaItem ri = vriep.nextElement();
|
|
totImponibileAcquisti.add(ri.getImponibile());
|
|
totImpostaAcquisti.add(ri.getImposta());
|
|
totEsenteAcquisti.add(ri.getEsente());
|
|
totImponibileIndetraibileAcquisti.add(ri.getImponibileIndetraibile());
|
|
totImpostaIndetraibileAcquisti.add(ri.getImpostaIndetraibile());
|
|
totSplitAcquisti.add(ri.getSplit());
|
|
cell = new Cell(new Chunk(ri.getIva().getDescrizione(), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((ri.getImponibile() == 0.0D) ? "\n" : nf.format(ri.getImponibile()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((ri.getImposta() == 0.0D) ? "\n" : nf.format(ri.getImposta()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((ri.getEsente() == 0.0D) ? "\n" : nf.format(ri.getEsente()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((ri.getImponibileIndetraibile() == 0.0D) ? "\n" : nf.format(ri.getImponibileIndetraibile()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((ri.getImpostaIndetraibile() == 0.0D) ? "\n" : nf.format(ri.getImpostaIndetraibile()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((ri.getSplit() == 0.0D) ? "\n" : nf.format(ri.getSplit()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((ri.getIva().getAliquotaIndetraibile() == 0L) ? "\n" : nf.format(ri.getIva().getAliquotaIndetraibile()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
}
|
|
cell = new Cell(new Chunk("TOTALI", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((totImponibileAcquisti.getResult() == 0.0D) ? "\n" : nf.format(totImponibileAcquisti.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((totImpostaAcquisti.getResult() == 0.0D) ? "\n" : nf.format(totImpostaAcquisti.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((totEsenteAcquisti.getResult() == 0.0D) ? "\n" : nf.format(totEsenteAcquisti.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((totImponibileIndetraibileAcquisti.getResult() == 0.0D) ? "\n" : nf.format(totImponibileIndetraibileAcquisti.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((totImpostaIndetraibileAcquisti.getResult() == 0.0D) ? "\n" : nf.format(totImpostaIndetraibileAcquisti.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((totSplitAcquisti.getResult() == 0.0D) ? "\n" : nf.format(totSplitAcquisti.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("\n", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("\n\n\n", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(8);
|
|
this.pdfcorpo.addCell(cell);
|
|
this.document.add((Element)this.pdfcorpo);
|
|
float[] colWidthsPagamento = { 30.0F, 10.0F, 10.0F, 50.0F };
|
|
this.pdfcorpo = new Table(4);
|
|
this.pdfcorpo.setWidth(100.0F);
|
|
this.pdfcorpo.setBorder(0);
|
|
this.pdfcorpo.setPadding(2.0F);
|
|
this.pdfcorpo.setSpacing(0.0F);
|
|
this.pdfcorpo.setWidths(colWidthsPagamento);
|
|
cell = new Cell(new Chunk("TOTALE IVA VENDITE", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("+", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setHorizontalAlignment(1);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((totImpostaVendite.getResult() == 0.0D) ? "\n" : nf.format(totImpostaVendite.getResult()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setHorizontalAlignment(2);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setHorizontalAlignment(1);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("TOTALE IVA ACQUISTI", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("-", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setHorizontalAlignment(1);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk((totImpostaAcquisti.getResult() == 0.0D) ? "\n" : nf.format(totImpostaAcquisti.getResult()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setHorizontalAlignment(2);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setHorizontalAlignment(1);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("IMPOSTA DA PAGARE", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorderWidthLeft(1.0F);
|
|
cell.setBorderWidthRight(1.0F);
|
|
cell.setBorderWidthBottom(2.0F);
|
|
cell.setBorderWidthTop(2.0F);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("=", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setHorizontalAlignment(1);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorderWidthLeft(1.0F);
|
|
cell.setBorderWidthRight(1.0F);
|
|
cell.setBorderWidthBottom(2.0F);
|
|
cell.setBorderWidthTop(2.0F);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
DoubleOperator impostaDaPagare = new DoubleOperator(totImpostaVendite.getResult());
|
|
impostaDaPagare.subtract(totImpostaAcquisti);
|
|
cell = new Cell(new Chunk((impostaDaPagare.getResult() == 0.0D) ? "\n" : nf.format(impostaDaPagare.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setHorizontalAlignment(2);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorderWidthLeft(1.0F);
|
|
cell.setBorderWidthRight(1.0F);
|
|
cell.setBorderWidthBottom(2.0F);
|
|
cell.setBorderWidthTop(2.0F);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setHorizontalAlignment(1);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("Interessi 1%", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("+", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setHorizontalAlignment(1);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
DoubleOperator impostaDaVersare = new DoubleOperator(impostaDaPagare.getResult());
|
|
impostaDaVersare.divide(100.0F);
|
|
impostaDaVersare.setScale(2, 5);
|
|
System.out.println(impostaDaVersare.getResult());
|
|
cell = new Cell(new Chunk((impostaDaVersare.getResult() == 0.0D) ? "\n" : nf.format(impostaDaVersare.getResult()), PdfFontFactory.PDF_fMedio));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setHorizontalAlignment(2);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setHorizontalAlignment(1);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("IMPOSTA DA VERSARE", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorderWidthLeft(1.0F);
|
|
cell.setBorderWidthRight(1.0F);
|
|
cell.setBorderWidthBottom(1.0F);
|
|
cell.setBorderWidthTop(2.0F);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk("=", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setHorizontalAlignment(1);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorderWidthLeft(1.0F);
|
|
cell.setBorderWidthRight(1.0F);
|
|
cell.setBorderWidthBottom(1.0F);
|
|
cell.setBorderWidthTop(2.0F);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
impostaDaVersare.add(impostaDaPagare);
|
|
cell = new Cell(new Chunk((impostaDaVersare.getResult() == 0.0D) ? "\n" : nf.format(impostaDaVersare.getResult()), PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setHorizontalAlignment(2);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorderWidthLeft(1.0F);
|
|
cell.setBorderWidthRight(1.0F);
|
|
cell.setBorderWidthBottom(1.0F);
|
|
cell.setBorderWidthTop(2.0F);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fMedioB));
|
|
cell.setVerticalAlignment(4);
|
|
cell.setHorizontalAlignment(1);
|
|
cell.setLeading((float)cellLeading);
|
|
cell.setBorder(0);
|
|
cell.setColspan(1);
|
|
this.pdfcorpo.addCell(cell);
|
|
this.document.add((Element)this.pdfcorpo);
|
|
this.document.close();
|
|
setRiepOk(true);
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
public String getFileName() {
|
|
return (this.fileName == null) ? "" : this.fileName;
|
|
}
|
|
|
|
public static final String getPeriodo(String l_flgPeriodo) {
|
|
if (l_flgPeriodo.equals(PERIODO_I_TRIM))
|
|
return "I TRIMESTRE";
|
|
if (l_flgPeriodo.equals(PERIODO_II_TRIM))
|
|
return "II TRIMESTRE";
|
|
if (l_flgPeriodo.equals(PERIODO_III_TRIM))
|
|
return "III TRIMESTRE";
|
|
if (l_flgPeriodo.equals(PERIODO_IV_TRIM))
|
|
return "IV TRIMESTRE";
|
|
return "";
|
|
}
|
|
|
|
public String getPeriodo() {
|
|
return getPeriodo(getFlgPeriodo()) + " " + getPeriodo(getFlgPeriodo());
|
|
}
|
|
|
|
public String getOss() {
|
|
return TipoDocumento.getOss(getFlgOss());
|
|
}
|
|
|
|
public static String getOss(long l_flgOss) {
|
|
return TipoDocumento.getOss(l_flgOss);
|
|
}
|
|
|
|
public long getFlgOss() {
|
|
return this.flgOss;
|
|
}
|
|
|
|
public void setFlgOss(long flgOss) {
|
|
this.flgOss = flgOss;
|
|
}
|
|
}
|