using System; using System.Collections.Generic; using System.Linq; using Consulenza.ExternalServices; using Consulenza.ReportWriter.Business; using Consulenza.ReportWriter.Business.OBJ_PDF; using System.Data; using Consulenza.ReportWriter.Business.CHART_PDF; using Consulenza.ReportCommon; using Consulenza.ReportWriter.Business.Entity; using System.Text; namespace Consulenza.ReportWriter.Manager.Section.Immobiliare.MonitoraggioNucleo { /// /// Scheda 19 /// public class S19 : Entity.Section { public bool bPrintAltri = false; public S19(EnvironmentFacade environmentFacade, int idSection) : base(environmentFacade, idSection) { try { Draw(); } catch (Exception ex) { SectionLogger.Write("S19", ex.Message, SectionLoggerMessageLevel.E, EnvironmentFacade.ReportEnvironment); } } /// /// Scheda2. Patrimonio immobiliare –Sintesi (distribuzione del patrimonio complessivo del cliente diviso per tipologia e cointestatari) /// protected override sealed void Draw() { var dataset = GetDataSet(); FormattedTextAreaPDF testoPagina = null; FormattedTextAreaPDF notaTabella = null; DataTable clientiTable = dataset.Tables["clienti"]; foreach (DataTable table in dataset.Tables) { if (table.TableName != "clienti" && table != null && table.Rows.Count > 0) { testoPagina = new FormattedTextAreaPDF("Di seguito si rappresenta l'elenco degli immobili con finalità d'investimento.", 35) { FontSize = 10, FontColor = ColorPDF.Immobiliare_Grigio_TitoloPiccolo, AutoIncrementYWritable = true, Width = 740, FixedHeight = 20 }; notaTabella = new FormattedTextAreaPDF("Nota(*): Il \"Reddito dominicale\" dei terreni è esposto nella colonna \"Rendita catastale\"
", 60, 680) { AutoIncrementYWritable = false, Y = EnvironmentFacade.RendererFacade.YLowerLimit - 23, FontSize = 6, FontColor = ColorPDF.Nero, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify, DeltaX = 5, DeltaY = 5 }; var listaOggettiDaRipetere = new List { new SpacePDF(30), testoPagina, new SpacePDF(10), notaTabella }; AddElement(listaOggettiDaRipetere); AddElement(new RepeaterPDF(listaOggettiDaRipetere)); const int larghezzaTabella = 730; // massima larghezza tabella const int larghezzaSingoloCliente = 65; const int larghezzaCategoriaCatastale = 40; const int larghezzaSuperficieStimata = 50; const int larghezzaRenditaCatastale = 55; const int larghezzaTotale = 70; const int larghezzaParziale = 70; const int tabellaFissa = larghezzaTotale + larghezzaParziale + larghezzaRenditaCatastale + larghezzaSuperficieStimata + larghezzaCategoriaCatastale; //La colonna descrizione è l'unica variabile. var larghezzaDescrizione = larghezzaTabella - 10 - tabellaFissa - (larghezzaSingoloCliente * System.Math.Min(clientiTable.Rows.Count, 5)); TablePDF tablePDF = new TablePDF(35, table) { Style = Style.Immobiliare, RowsPadding = 3, Footer = false, HeaderHeight = 120, MinimumRowHeight = 12, ShowBorderLastLine = true }; tablePDF.Columns.Add(new ColumnPDF("AnomaliaCatastale", 10, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Immagine, "codAnomalia", "") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, ScaleColumnTypeImage = 0.1F, DeltaYContent = 2, PaddingLeft = -10 }); tablePDF.Columns.Add(new ColumnPDF("descrizione", larghezzaDescrizione, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "descrizione", "Immobili d'investimento") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderVerticalAlignment = VerticalAlignmentType.Basso }); tablePDF.Columns.Add(new ColumnPDF("codTipologiaCatasto", larghezzaCategoriaCatastale, HorizontalAlignmentType.Centrato, false, false, 7, ColumnType.Testo, "CategoriaCatastale", "Categoria catastale") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderTextVerticalDirection = true, HeaderVerticalAlignment = VerticalAlignmentType.Centrato }); tablePDF.Columns.Add(new ColumnPDF("superficie", larghezzaSuperficieStimata, HorizontalAlignmentType.Centrato, false, false, 7, ColumnType.Testo, "SuperficieStimata", "Superficie Stimata") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderTextVerticalDirection = true, HeaderVerticalAlignment = VerticalAlignmentType.Centrato }); tablePDF.Columns.Add(new ColumnPDF("codTipologiaCatasto", larghezzaRenditaCatastale, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "renditaCatastale", "Rendita catastale*") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderTextVerticalDirection = true, HeaderVerticalAlignment = VerticalAlignmentType.Centrato }); for (int i = 1; i <= (System.Math.Min(clientiTable.Rows.Count, 5)); i++) tablePDF.Columns.Add(new ColumnPDF("cliente" + i, larghezzaSingoloCliente, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "cliente" + i, clientiTable.Rows[i - 1]["cognome"].ToString() + " " + clientiTable.Rows[i - 1]["nome"].ToString()) { HeaderTextVerticalDirection = true, HeaderVerticalAlignment = VerticalAlignmentType.Centrato }); if (bPrintAltri == true) tablePDF.Columns.Add(new ColumnPDF("Parziale", larghezzaParziale, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "Parziale", "Altri") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderTextVerticalDirection = true, HeaderVerticalAlignment = VerticalAlignmentType.Centrato }); tablePDF.Columns.Add(new ColumnPDF("valoreImmobileTotale", larghezzaTotale, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "Totale", "Valore stimato
totale (€)") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderTextVerticalDirection = true, HeaderVerticalAlignment = VerticalAlignmentType.Centrato }); for (int k = 0; k < table.Rows.Count; k++) { //if (table.Rows[k].Field("AnomaliaCatastale") == "True") // tablePDF.Cells[2, k].Value = "Warning.png"; //else // tablePDF.Cells[2, k].Value = ""; // Old Version 20170919 //if (table.Rows[k].Field("CategoriaCatastale").All(Char.IsDigit)) //{ // int column = table.Rows[k].Table.Columns["CategoriaCatastale"].Ordinal; // tablePDF.Cells[column, k].Value = "-"; //} //else if (table.Rows[k].Field("CategoriaCatastale").Equals("F/5")) //{ // tablePDF.Cells[3, k].Value = "n.d."; // tablePDF.Cells[4, k].Value = "n.d."; //} //if (table.Rows[k].Field("CategoriaCatastale").Substring(0, 1) == "M") // tablePDF.Cells[2, k].Value = "-"; //else // tablePDF.Cells[2, k].Value = table.Rows[k].Field("CategoriaCatastale"); //if (table.Rows[k].Field("renditaCatastale").Equals("") || Convert.ToDecimal(table.Rows[k].Field("renditaCatastale")) == 0) // tablePDF.Cells[4, k].Value = "-"; //else // tablePDF.Cells[4, k].Value = Helper.FormatCurrency(Convert.ToDecimal(table.Rows[k].Field("renditaCatastale")).ToString()); if (table.Rows[k].Field("CategoriaCatastale").All(Char.IsDigit)) { int column = table.Rows[k].Table.Columns["CategoriaCatastale"].Ordinal; tablePDF.Cells[column, k].Value = "-"; } else { if (table.Rows[k].Field("CategoriaCatastale").Equals("F/5")) { tablePDF.Cells[3, k].Value = "n.d."; tablePDF.Cells[4, k].Value = "n.d."; } else { if (table.Rows[k].Field("CategoriaCatastale").Substring(0, 1) == "M") tablePDF.Cells[2, k].Value = "-"; else tablePDF.Cells[2, k].Value = table.Rows[k].Field("CategoriaCatastale"); } } if (table.Rows[k].Field("renditaCatastale").Equals("") || Convert.ToDecimal(table.Rows[k].Field("renditaCatastale")) == 0) if (table.Rows[k].Field("CategoriaCatastale").Equals("F/5")) tablePDF.Cells[4, k].Value = "n.d."; else tablePDF.Cells[4, k].Value = "-"; else tablePDF.Cells[4, k].Value = Helper.FormatCurrency(Convert.ToDecimal(table.Rows[k].Field("renditaCatastale")).ToString()); for (int i = 1; i <= (System.Math.Min(clientiTable.Rows.Count, 5)); i++) { if (Convert.ToDecimal(table.Rows[k].Field("cliente" + i)) <= 0) tablePDF.Cells[4 + i, k].Value = "-"; else tablePDF.Cells[4 + i, k].Value = Helper.FormatCurrency(Convert.ToDecimal(table.Rows[k].Field("cliente" + i)).ToString()); } if (bPrintAltri != true) { if (Convert.ToDecimal(table.Rows[k].Field("Totale")) <= 0) tablePDF.Cells[System.Math.Min(clientiTable.Rows.Count, 5) + 5, k].Value = "-"; else tablePDF.Cells[System.Math.Min(clientiTable.Rows.Count, 5) + 5, k].Value = Helper.FormatCurrency(Convert.ToDecimal(table.Rows[k].Field("Totale")).ToString()); } else { if (Convert.ToDecimal(table.Rows[k].Field("Parziale")) <= 0) tablePDF.Cells[System.Math.Min(clientiTable.Rows.Count, 5) + 5, k].Value = "-"; else tablePDF.Cells[System.Math.Min(clientiTable.Rows.Count, 5) + 5, k].Value = Helper.FormatCurrency(Convert.ToDecimal(table.Rows[k].Field("Parziale")).ToString()); if (Convert.ToDecimal(table.Rows[k].Field("Totale")) <= 0) tablePDF.Cells[System.Math.Min(clientiTable.Rows.Count, 5) + 6, k].Value = "-"; else tablePDF.Cells[System.Math.Min(clientiTable.Rows.Count, 5) + 6, k].Value = Helper.FormatCurrency(Convert.ToDecimal(table.Rows[k].Field("Totale")).ToString()); } // Modificato il 22/09/2017 in attesa di sapere cosa vuole Carnevali Paolo //if (table.Rows[k].Field("AnomaliaCatastale") != "") // tablePDF.Cells[System.Math.Min(clientiTable.Rows.Count, 5) + 5, k].Value = "n.d."; //if (bPrintAltri != true) // tablePDF.Cells[System.Math.Min(clientiTable.Rows.Count, 5) + 5, k].Value = "n.d."; //else // tablePDF.Cells[System.Math.Min(clientiTable.Rows.Count, 5) + 6, k].Value = Helper.FormatCurrency(Convert.ToDecimal(table.Rows[k].Field("Totale")).ToString()); // Fabbricati e Terreni if (table.Rows[k].Field("SuperficieStimata") == null || table.Rows[k].Field("SuperficieStimata") == "0,0000000") tablePDF.Cells[3, k].Value = "-"; else { if (table.Rows[k].Field("SuperficieStimata").Equals("")) tablePDF.Cells[3, k].Value = "n.d."; else { if (table.Rows[k].Field("tipoImmobile").Equals("F")) tablePDF.Cells[3, k].Value = Helper.FormatInteger(Helper.FormatDecimal(table.Rows[k].Field("SuperficieStimata"), 0)) + " mq"; else tablePDF.Cells[3, k].Value = Helper.FormatDecimal(table.Rows[k].Field("SuperficieStimata"), 3) + " ha"; } } //if (table.Rows[k].Field("tipoImmobile").Equals("T")) //{ // if (table.Rows[k].Field("SuperficieStimata").Equals("")) // tablePDF.Cells[3, k].Value = "n.d."; // else // tablePDF.Cells[3, k].Value = Helper.FormatDecimal(table.Rows[k].Field("SuperficieStimata"), 3) + " ha"; //} //else // tablePDF.Cells[3, k].Value = Helper.FormatDecimal(table.Rows[k].Field("SuperficieStimata"), 0) + " mq"; //if (!table.Rows[k].Field("redditoDominicale").Equals("")) // tablePDF.Cells[4, k].Value = Helper.FormatCurrency(Convert.ToDecimal(table.Rows[k].Field("redditoDominicale")).ToString()); } AddElement(tablePDF); if (table.TableName != "clienti" && table != null && table.Rows.Count > 0) { //List legenda = table.AsEnumerable().Select(z => z.Field("codAnomalia")).Distinct() != null ? // table.AsEnumerable().Select(z => z.Field("codAnomalia")).Distinct().ToList() : null; List legenda = table.AsEnumerable().Select(z => z.Field("AnomaliaCatastale")).Distinct() != null ? table.AsEnumerable().Select(z => z.Field("AnomaliaCatastale")).Distinct().ToList() : null; if (legenda != null && legenda.Count > 0) AddLegend(legenda); } } } } /// /// Recupera i dati necessari alla Section restituendo un DataSet. /// /// protected override DataSet GetDataSet() { DataSet data = new DataSet(); data.Tables.Add(new DataTable("clienti")); // U data.Tables["clienti"].Columns.Add(new DataColumn("nome", typeof(string))); data.Tables["clienti"].Columns.Add(new DataColumn("cognome", typeof(string))); data.Tables.Add(new DataTable("1")); // U data.Tables.Add(new DataTable("2")); // S data.Tables.Add(new DataTable("3")); // I data.Tables.Add(new DataTable("4")); // NS #region Definizione dei parametri var parametri = new List { new Parametro { Direction = ParameterDirection.Input, DbType = DbType.Int64, ParameterName = "ChiaveNucleo", Value = EnvironmentFacade.ReportEnvironment.NucleoImmobiliare.ChiaveNucleo } }; #endregion var dsOriginal = DataAccess.ExecuteDataSetStoredProcedure(DBProvider.SqlServerConsulenzaUnica, "REP_ImmobiliareMonitoraggio_S_DettaglioFabbricatiNucleo", parametri); if (dsOriginal.Tables[0].Rows.Count == 0) return null; decimal nTotaleAltri = 0; for (int k = 0; k < dsOriginal.Tables[0].Rows.Count; k++) nTotaleAltri = nTotaleAltri + Convert.ToDecimal(dsOriginal.Tables[0].Rows[k]["parziale"]); if (nTotaleAltri > 0) bPrintAltri = true; List clientiList = dsOriginal.Tables[1].AsEnumerable() .Select(z => z.Field("Cliente")).Distinct().ToList(); foreach (var cliente in clientiList) { data.Tables["clienti"].Rows.Add(cliente); } if (dsOriginal.Tables[0].AsEnumerable().Where(x => x.Field("ordinamento") == 3).Count() > 0) { DataTable copyDataTable = dsOriginal.Tables[0].AsEnumerable().GroupBy(x => x.Field("idImmobileCatasto")).Select(x => x.First()).Where(x => x.Field("ordinamento") == 3).OrderBy(x => x.Field("tipoimmobile")).ThenBy(x => x.Field("ordfabbricati")).CopyToDataTable(); for (int i = 0; i < copyDataTable.Rows.Count; i++) { if (copyDataTable.Rows[i]["AnomaliaCatastale"].ToString() == "1") copyDataTable.Rows[i]["AnomaliaCatastale"] = "Warning.png"; else copyDataTable.Rows[i]["AnomaliaCatastale"] = ""; //copyDataTable.Rows[i]["codAnomalia"] = copyDataTable.Rows[i]["quotaDiritto"] != DBNull.Value && // copyDataTable.Rows[i]["quotaDiritto"] != null ? // "detagglio2.png" : copyDataTable.Rows[i]["codAnomalia"]; if (copyDataTable.Rows[i]["cliente1"] != DBNull.Value) copyDataTable.Rows[i]["cliente1"] = Helper.FormatCurrency(copyDataTable.Rows[i]["cliente1"].ToString()); else copyDataTable.Rows[i]["cliente1"] = "0"; if (copyDataTable.Rows[i]["cliente2"] != DBNull.Value) copyDataTable.Rows[i]["cliente2"] = Helper.FormatCurrency(copyDataTable.Rows[i]["cliente2"].ToString()); else copyDataTable.Rows[i]["cliente2"] = "0"; if (copyDataTable.Rows[i]["cliente3"] != DBNull.Value) copyDataTable.Rows[i]["cliente3"] = Helper.FormatCurrency(copyDataTable.Rows[i]["cliente3"].ToString()); else copyDataTable.Rows[i]["cliente3"] = "0"; if (copyDataTable.Rows[i]["cliente4"] != DBNull.Value) copyDataTable.Rows[i]["cliente4"] = Helper.FormatCurrency(copyDataTable.Rows[i]["cliente4"].ToString()); else copyDataTable.Rows[i]["cliente4"] = "0"; if (copyDataTable.Rows[i]["cliente5"] != DBNull.Value) copyDataTable.Rows[i]["cliente5"] = Helper.FormatCurrency(copyDataTable.Rows[i]["cliente5"].ToString()); else copyDataTable.Rows[i]["cliente5"] = "0"; if (copyDataTable.Rows[i]["Totale"] != DBNull.Value) copyDataTable.Rows[i]["Totale"] = Helper.FormatCurrency(copyDataTable.Rows[i]["Totale"].ToString()); else copyDataTable.Rows[i]["Totale"] = "0"; if (copyDataTable.Rows[i]["Parziale"] != DBNull.Value) copyDataTable.Rows[i]["Parziale"] = Helper.FormatCurrency(copyDataTable.Rows[i]["Parziale"].ToString()); else copyDataTable.Rows[i]["Parziale"] = "0"; //copyDataTable.Rows[i]["ProQuota"] = Helper.FormatCurrency(copyDataTable.Rows[i]["ProQuota"].ToString()); //copyDataTable.Rows[i]["valoreImmobileTotale"] = Helper.FormatCurrency(copyDataTable.Rows[i]["valoreImmobileTotale"].ToString()); } //copyDataTable.Rows[0]["codAnomalia"] = "Warning.png"; var name = copyDataTable.Rows[0]["ordinamento"]; DataTable dtCloned = copyDataTable.Clone(); dtCloned.Columns[0].DataType = typeof(Int32); for (int i = 0; i < copyDataTable.Columns.Count; i++) dtCloned.Columns[i].DataType = typeof(string); for (int row = 0; row < copyDataTable.Rows.Count; row++) { object[] array = new object[copyDataTable.Columns.Count]; for (int column = 0; column < copyDataTable.Columns.Count; column++) array[column] = copyDataTable.Rows[row][column].ToString(); dtCloned.Rows.Add(array); } //for (int i = 1; i <= (System.Math.Min(data.Tables["clienti"].Rows.Count, 5)); i++) //{ // dtCloned.Columns.Add(new DataColumn("cliente" + i, typeof(string))); // int indexrow = 0; // foreach (var row in dtCloned.AsEnumerable()) // { // dtCloned.Rows[indexrow]["cliente" + i] = dtCloned.Rows[indexrow]["ProQuota"]; // indexrow++; // } //} //for (int index_row = 0; index_row < dtCloned.Rows.Count; index_row++) //{ // // cerco index in tabella cliente // DataRow anotherRow = data.Tables["clienti"].AsEnumerable().FirstOrDefault(row1 => row1["nome"].Equals(dtCloned.Rows[index_row]["NomeCliente"]) // && row1["cognome"].Equals(dtCloned.Rows[index_row]["CognomeCliente"])); // int indiceCliente = data.Tables["clienti"].Rows.IndexOf(anotherRow); // for (int i = 1; i <= (System.Math.Min(data.Tables["clienti"].Rows.Count, 5)); i++) // { // if (i - 1 == indiceCliente) // dtCloned.Rows[index_row]["cliente" + i] = dtCloned.Rows[index_row]["ProQuota"]; // else // dtCloned.Rows[index_row]["cliente" + i] = "0"; // //dtCloned.Rows[index_row]["valoreImmobileTotale"] = dtCloned.Rows[index_row]["ProQuota"]; // } //} data.Tables[name.ToString()].Merge(dtCloned); } return data; } public void AddLegend(List legenda) { AddElement(new SpacePDF(2)); var xSx = 35; foreach (string valore in legenda) { var listaLegend = new List(); ImagePDF image = null; FormattedTextAreaPDF testo = null; switch (valore) { case "Warning.png": image = new ImagePDF(xSx, 0.1F, valore) { AutoIncrementYWritable = false }; testo = new FormattedTextAreaPDF("Immobile con anomalie catastali. Vedi Dettaglio immobili - Anomalie catastali.", xSx + 15) { DeltaY = 1, AutoIncrementYWritable = true }; listaLegend.Add(image); listaLegend.Add(testo); break; case "detagglio2.png": image = new ImagePDF(xSx, 0.15F, valore) { AutoIncrementYWritable = false }; testo = new FormattedTextAreaPDF("Immobile con diritti e/o quote variate. Vedi Dettaglio immobili – Immobili con diritti e/o quote di diritto variate.", xSx + 15) { DeltaY = 3, AutoIncrementYWritable = true }; listaLegend.Add(image); listaLegend.Add(testo); break; case "New.png": image = new ImagePDF(xSx, 0.1F, valore) { AutoIncrementYWritable = false }; testo = new FormattedTextAreaPDF("Immobile di nuova acquisizione.", xSx + 15) { DeltaY = 1, AutoIncrementYWritable = true }; listaLegend.Add(image); listaLegend.Add(testo); break; } AddElement(listaLegend); AddElement(new SpacePDF(5)); } } /// /// Recupera i dati necessari alla Section restituendo un DataTable. /// /// protected override DataTable GetDataTable() { return null; } // Draw e GetDataSet del 14.09.2017 ///// ///// Scheda2. Patrimonio immobiliare –Sintesi (distribuzione del patrimonio complessivo del cliente diviso per tipologia e cointestatari) ///// //protected override sealed void Draw() //{ // var dataset = GetDataSet(); // FormattedTextAreaPDF testoPagina = null; // FormattedTextAreaPDF notaTabella = null; // DataTable clientiTable = dataset.Tables["clienti"]; // foreach (DataTable table in dataset.Tables) // { // if (table.TableName != "clienti" && table != null && table.Rows.Count > 0) // { // testoPagina = new FormattedTextAreaPDF("Di seguito si rappresenta l'elenco degli immobili con finalità d'investimento.", 35) { FontSize = 10, FontColor = ColorPDF.Immobiliare_Grigio_TitoloPiccolo, AutoIncrementYWritable = true, Width = 740, FixedHeight = 20 }; // notaTabella = new FormattedTextAreaPDF("Nota(*): Il \"Reddito dominicale\" dei terreni è esposto nella colonna \"Rendita catastale\"
", 60, 680) { AutoIncrementYWritable = false, Y = EnvironmentFacade.RendererFacade.YLowerLimit - 25, FontSize = 6, FontColor = ColorPDF.Nero, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify, DeltaX = 5, DeltaY = 5 }; // var listaOggettiDaRipetere = new List { new SpacePDF(30), testoPagina, new SpacePDF(10), notaTabella }; // AddElement(listaOggettiDaRipetere); // AddElement(new RepeaterPDF(listaOggettiDaRipetere)); // const int larghezzaTabella = 730; // massima larghezza tabella // const int larghezzaSingoloCliente = 70; // const int larghezzaCategoriaCatastale = 40; // const int larghezzaSuperficieStimata = 50; // const int larghezzaRenditaCatastale = 55; // const int larghezzaTotale = 80; // const int tabellaFissa = larghezzaTotale + larghezzaRenditaCatastale + larghezzaSuperficieStimata + larghezzaCategoriaCatastale; // //La colonna descrizione è l'unica variabile. // var larghezzaDescrizione = larghezzaTabella - 10 - tabellaFissa - (larghezzaSingoloCliente * System.Math.Min(clientiTable.Rows.Count, 5)); // TablePDF tablePDF = new TablePDF(35, table) // { // Style = Style.Immobiliare, // RowsPadding = 3, // Footer = false, // HeaderHeight = 130, // MinimumRowHeight = 12, // ShowBorderLastLine = true // }; // tablePDF.Columns.Add(new ColumnPDF("codAnomalia", 10, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Immagine, "codAnomalia", "") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, ScaleColumnTypeImage = 0.1F, DeltaYContent = 2, PaddingLeft = -10 }); // tablePDF.Columns.Add(new ColumnPDF("descrizione", larghezzaDescrizione, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "descrizione", "Immobili d'investimento") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderVerticalAlignment = VerticalAlignmentType.Basso }); // tablePDF.Columns.Add(new ColumnPDF("codTipologiaCatasto", larghezzaCategoriaCatastale, HorizontalAlignmentType.Centrato, false, false, 7, ColumnType.Testo, "codTipologiaCatasto", "Categoria catastale") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderTextVerticalDirection = true, HeaderVerticalAlignment = VerticalAlignmentType.Centrato }); // tablePDF.Columns.Add(new ColumnPDF("superficie", larghezzaSuperficieStimata, HorizontalAlignmentType.Centrato, false, false, 7, ColumnType.Testo, "superficie", "Superficie Stimata") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderTextVerticalDirection = true, HeaderVerticalAlignment = VerticalAlignmentType.Centrato }); // tablePDF.Columns.Add(new ColumnPDF("codTipologiaCatasto", larghezzaRenditaCatastale, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "renditaCatastale", "Rendita catastale*") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderTextVerticalDirection = true, HeaderVerticalAlignment = VerticalAlignmentType.Centrato }); // for (int i = 1; i <= (System.Math.Min(clientiTable.Rows.Count, 5)); i++) // tablePDF.Columns.Add(new ColumnPDF("cliente" + i, larghezzaSingoloCliente, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "cliente" + i, clientiTable.Rows[i - 1]["cognome"].ToString() + " " + clientiTable.Rows[i - 1]["nome"].ToString()) { HeaderTextVerticalDirection = true, HeaderVerticalAlignment = VerticalAlignmentType.Centrato }); // tablePDF.Columns.Add(new ColumnPDF("valoreImmobileTotale", larghezzaTotale, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "valoreImmobileTotale", "Valore stimato
totale (€)") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderTextVerticalDirection = true, HeaderVerticalAlignment = VerticalAlignmentType.Centrato }); // for (int k = 0; k < table.Rows.Count; k++) // { // if (table.Rows[k].Field("codTipologiaCatasto").All(Char.IsDigit)) // { // int column = table.Rows[k].Table.Columns["codTipologiaCatasto"].Ordinal; // tablePDF.Cells[column, k].Value = "-"; // } // else if (table.Rows[k].Field("codTipologiaCatasto").Equals("F/5")) // { // tablePDF.Cells[3, k].Value = "n.d."; // tablePDF.Cells[4, k].Value = "n.d."; // } // if (table.Rows[k].Field("codTipologiaCatasto").Substring(0, 1) == "M") // tablePDF.Cells[2, k].Value = "-"; // else // tablePDF.Cells[2, k].Value = table.Rows[k].Field("codTipologiaCatasto"); // if (table.Rows[k].Field("renditaCatastale").Equals("") || Convert.ToDecimal(table.Rows[k].Field("renditaCatastale")) == 0) // tablePDF.Cells[4, k].Value = "-"; // else // tablePDF.Cells[4, k].Value = Helper.FormatCurrency(Convert.ToDecimal(table.Rows[k].Field("renditaCatastale")).ToString()); // for (int i = 1; i <= (System.Math.Min(clientiTable.Rows.Count, 5)); i++) // { // if (Convert.ToDecimal(table.Rows[k].Field("cliente" + i)) == 0) // tablePDF.Cells[4 + i, k].Value = "-"; // else // tablePDF.Cells[4 + i, k].Value = Helper.FormatCurrency(Convert.ToDecimal(table.Rows[k].Field("ProQuota")).ToString()); // } // if (Convert.ToDecimal(table.Rows[k].Field("valoreImmobileTotale")) == 0) // tablePDF.Cells[System.Math.Min(clientiTable.Rows.Count, 5) + 5, k].Value = "-"; // else // tablePDF.Cells[System.Math.Min(clientiTable.Rows.Count, 5) + 5, k].Value = Helper.FormatCurrency(Convert.ToDecimal(table.Rows[k].Field("valoreImmobileTotale")).ToString()); // if (table.Rows[k].Field("tipoImmobile").Equals("F")) // tablePDF.Cells[3, k].Value = Helper.FormatDecimal(table.Rows[k].Field("superficie"), 0) + " mq"; // if (table.Rows[k].Field("tipoImmobile").Equals("T")) // { // if (table.Rows[k].Field("superficie").Equals("")) // tablePDF.Cells[3, k].Value = "n.d."; // else // tablePDF.Cells[3, k].Value = Helper.FormatDecimal(table.Rows[k].Field("superficie"), 3) + " ha"; // } // if (!table.Rows[k].Field("redditoDominicale").Equals("")) // tablePDF.Cells[4, k].Value = Helper.FormatCurrency(Convert.ToDecimal(table.Rows[k].Field("redditoDominicale")).ToString()); // } // AddElement(tablePDF); // if (table.TableName != "clienti" && table != null && table.Rows.Count > 0) // { // List legenda = table.AsEnumerable().Select(z => z.Field("codAnomalia")).Distinct() != null ? // table.AsEnumerable().Select(z => z.Field("codAnomalia")).Distinct().ToList() : null; // if (legenda != null && legenda.Count > 0) // AddLegend(legenda); // } // } // } //} ///// ///// Recupera i dati necessari alla Section restituendo un DataSet. ///// ///// //protected override DataSet GetDataSet() //{ // DataSet data = new DataSet(); // data.Tables.Add(new DataTable("clienti")); // U // data.Tables["clienti"].Columns.Add(new DataColumn("nome", typeof(string))); // data.Tables["clienti"].Columns.Add(new DataColumn("cognome", typeof(string))); // data.Tables.Add(new DataTable("1")); // U // data.Tables.Add(new DataTable("2")); // S // data.Tables.Add(new DataTable("3")); // I // data.Tables.Add(new DataTable("4")); // NS // #region Definizione dei parametri // var parametri = new List // { // new Parametro // { // Direction = ParameterDirection.Input, // DbType = DbType.Int64, // ParameterName = "ChiaveNucleo", // Value = EnvironmentFacade.ReportEnvironment.NucleoImmobiliare.ChiaveNucleo // } // }; // #endregion // var dsOriginal = DataAccess.ExecuteDataSetStoredProcedure(DBProvider.SqlServerConsulenzaUnica, "REP_ImmobiliareMonitoraggio_S_DettaglioFabbricatiNucleo", parametri); // if (dsOriginal.Tables[0].Rows.Count == 0) // return null; // List clientiList = dsOriginal.Tables[0].AsEnumerable() // .Select(z => z.Field("NomeCliente") + "$" + z.Field("CognomeCliente")).Distinct().ToList(); // foreach (var cliente in clientiList) // { // var nomeCognome = cliente.Split('$'); // data.Tables["clienti"].Rows.Add(nomeCognome[0], nomeCognome[1]); // } // if (dsOriginal.Tables[0].AsEnumerable().Where(x => x.Field("ordinamento") == 3).Count() > 0) // { // DataTable copyDataTable = dsOriginal.Tables[0].AsEnumerable().GroupBy(x => x.Field("idImmobileCatasto")).Select(x => x.First()).Where(x => x.Field("ordinamento") == 3).OrderBy(x => x.Field("Tipo")).CopyToDataTable(); // for (int i = 0; i < copyDataTable.Rows.Count; i++) // { // copyDataTable.Rows[i]["codAnomalia"] = copyDataTable.Rows[i]["codAnomalia"] != DBNull.Value && // copyDataTable.Rows[i]["codAnomalia"] != null ? // "Warning.png" : ""; // if (copyDataTable.Rows[i]["ProQuota"] != DBNull.Value) // copyDataTable.Rows[i]["ProQuota"] = Helper.FormatCurrency(copyDataTable.Rows[i]["ProQuota"].ToString()); // else // copyDataTable.Rows[i]["ProQuota"] = "0"; // if (copyDataTable.Rows[i]["valoreImmobileTotale"] != DBNull.Value) // copyDataTable.Rows[i]["valoreImmobileTotale"] = Helper.FormatCurrency(copyDataTable.Rows[i]["valoreImmobileTotale"].ToString()); // else // copyDataTable.Rows[i]["valoreImmobileTotale"] = "0"; // //copyDataTable.Rows[i]["ProQuota"] = Helper.FormatCurrency(copyDataTable.Rows[i]["ProQuota"].ToString()); // //copyDataTable.Rows[i]["valoreImmobileTotale"] = Helper.FormatCurrency(copyDataTable.Rows[i]["valoreImmobileTotale"].ToString()); // } // //copyDataTable.Rows[0]["codAnomalia"] = "Warning.png"; // var name = copyDataTable.Rows[0]["ordinamento"]; // DataTable dtCloned = copyDataTable.Clone(); // dtCloned.Columns[0].DataType = typeof(Int32); // for (int i = 0; i < copyDataTable.Columns.Count; i++) // dtCloned.Columns[i].DataType = typeof(string); // for (int row = 0; row < copyDataTable.Rows.Count; row++) // { // object[] array = new object[copyDataTable.Columns.Count]; // for (int column = 0; column < copyDataTable.Columns.Count; column++) // array[column] = copyDataTable.Rows[row][column].ToString(); // dtCloned.Rows.Add(array); // } // for (int i = 1; i <= (System.Math.Min(data.Tables["clienti"].Rows.Count, 5)); i++) // { // dtCloned.Columns.Add(new DataColumn("cliente" + i, typeof(string))); // int indexrow = 0; // foreach (var row in dtCloned.AsEnumerable()) // { // dtCloned.Rows[indexrow]["cliente" + i] = dtCloned.Rows[indexrow]["ProQuota"]; // indexrow++; // } // } // for (int index_row = 0; index_row < dtCloned.Rows.Count; index_row ++) // { // // cerco index in tabella cliente // DataRow anotherRow = data.Tables["clienti"].AsEnumerable().FirstOrDefault(row1 => row1["nome"].Equals(dtCloned.Rows[index_row]["NomeCliente"]) // && row1["cognome"].Equals(dtCloned.Rows[index_row]["CognomeCliente"])); // int indiceCliente = data.Tables["clienti"].Rows.IndexOf(anotherRow); // for (int i = 1; i <= (System.Math.Min(data.Tables["clienti"].Rows.Count, 5)); i++) // { // if (i - 1 == indiceCliente) // dtCloned.Rows[index_row]["cliente" + i] = dtCloned.Rows[index_row]["ProQuota"]; // else // dtCloned.Rows[index_row]["cliente" + i] = "0"; // //dtCloned.Rows[index_row]["valoreImmobileTotale"] = dtCloned.Rows[index_row]["ProQuota"]; // } // } // data.Tables[name.ToString()].Merge(dtCloned); // } // return data; //} } }