//------------------------------------------------------------------------------------------30.10.2004
        /// <summary>Creates this report.</summary>
        /// <remarks>
        /// This method overrides the method <see cref="Root.Reports.Report.Create"/> of the base class <see cref="Root.Reports.Report"/>.
        /// </remarks>
        protected override void Create()
        {
            fontDef_Helvetica = new FontDef(this, FontDef.StandardFont.TimesRoman);
            FontProp fontProp_Text = new FontPropMM(fontDef_Helvetica, 1.9);  // standard font
            FontProp fontProp_Header = new FontPropMM(fontDef_Helvetica, 1.9);  // font of the table header
            fontProp_Header.bBold = true;

            // create table
            TableLayoutManager tlm;
            using (tlm = new TableLayoutManager(fontProp_Header))
            {
                tlm.rContainerHeightMM = rPosBottom - rPosTop;  // set height of table
                tlm.tlmCellDef_Header.rAlignV = RepObj.rAlignCenter;  // set vertical alignment of all header cells
                tlm.tlmCellDef_Default.penProp_LineBottom = new PenProp(this, 0.05, Color.LightGray);  // set bottom line for all cells
                tlm.tlmHeightMode = TlmHeightMode.AdjustLast;
                tlm.eNewContainer += new TableLayoutManager.NewContainerEventHandler(Tlm_NewContainer);

                // define columns
                TlmColumn col;
                

                col = new TlmColumnMM(tlm, "Assistido", 50);
                col.tlmCellDef_Default.tlmTextMode = TlmTextMode.MultiLine;

                col = new TlmColumnMM(tlm, "Dt. Nascimento", 24);

                col = new TlmColumnMM(tlm, "Dt. Entrada", 20);

                col = new TlmColumnMM(tlm, "Dt. Saída", 20);

                col = new TlmColumnMM(tlm, "Estado Saúde", 22);

                col = new TlmColumnMM(tlm, "Status", 26);

                col = new TlmColumnMM(tlm, "Ativo", 15);

                System.Collections.Generic.List<Assistido> listaAssistido = (System.Collections.Generic.List<Assistido>)RelatorioDTO.DadosRelatorio;
                foreach (Assistido assistido in listaAssistido)
                {
                    tlm.NewRow();
                    tlm.Add(0, new RepString(fontProp_Text, assistido.Nome));

                    if (assistido.DataNascimento.HasValue) tlm.Add(1, new RepString(fontProp_Text, assistido.DataNascimento.Value.ToString("dd/MM/yyyy")));
                    else tlm.Add(1, new RepString(fontProp_Text, ""));
                    
                    tlm.Add(2, new RepString(fontProp_Text, assistido.DataEntrada.Value.ToString("dd/MM/yyyy")));

                    if (assistido.DataSaida.HasValue) tlm.Add(3, new RepString(fontProp_Text, assistido.DataSaida.Value.ToString("dd/MM/yyyy")));
                    else tlm.Add(3, new RepString(fontProp_Text, ""));
                    
                    tlm.Add(4, new RepString(fontProp_Text, assistido.EstadoSaude));

                    tlm.Add(5, new RepString(fontProp_Text, assistido.StatusAssistido));

                    tlm.Add(6, new RepString(fontProp_Text, assistido.AssistidoAtivo));
                }
            }
            //page_Cur.AddCT_MM(rPosLeft + tlm.rWidthMM / 2, rPosTop + tlm.rCurY_MM + 2, new RepString(fontProp_Text, "- end of table -"));

            // print page number and current date/time
            Double rY = rPosBottom + 1.5;
            foreach (Page page in enum_Page)
            {
                page.AddLT_MM(rPosLeft, rY, new RepString(fontProp_Text, DateTime.Now.ToShortDateString() + "  " + DateTime.Now.ToShortTimeString()));
                page.AddRT_MM(rPosRight, rY, new RepString(fontProp_Text, page.iPageNo + " / " + iPageCount));
            }
        }
        //------------------------------------------------------------------------------------------30.10.2004
        /// <summary>Creates this report.</summary>
        /// <remarks>
        /// This method overrides the method <see cref="Root.Reports.Report.Create"/> of the base class <see cref="Root.Reports.Report"/>.
        /// </remarks>
        protected override void Create()
        {
            fontDef_Helvetica = new FontDef(this, FontDef.StandardFont.TimesRoman);
            FontProp fontProp_Text = new FontPropMM(fontDef_Helvetica, 1.9);  // standard font
            FontProp fontProp_Header = new FontPropMM(fontDef_Helvetica, 1.9);  // font of the table header
            fontProp_Header.bBold = true;

            // create table
            TableLayoutManager tlm;
            using (tlm = new TableLayoutManager(fontProp_Header))
            {
                tlm.rContainerHeightMM = rPosBottom - rPosTop;  // set height of table
                tlm.tlmCellDef_Header.rAlignV = RepObj.rAlignCenter;  // set vertical alignment of all header cells
                tlm.tlmCellDef_Default.penProp_LineBottom = new PenProp(this, 0.05, Color.LightGray);  // set bottom line for all cells
                tlm.tlmHeightMode = TlmHeightMode.AdjustLast;
                tlm.eNewContainer += new TableLayoutManager.NewContainerEventHandler(Tlm_NewContainer);

                // define columns
                TlmColumn col;

                col = new TlmColumnMM(tlm, "Natureza Lançamento", 80);
                col.tlmCellDef_Default.tlmTextMode = TlmTextMode.MultiLine;

                col = new TlmColumnMM(tlm, "Tipo", 40);

                col = new TlmColumnMM(tlm, "Data", 30);

                col = new TlmColumnMM(tlm, "Valor", 30);


                 List<Financas> listaFinancas = (List<Financas>)RelatorioDTO.DadosRelatorio;
                Decimal valorTotal = 0;
                foreach (Financas financas in listaFinancas)
                {
                    tlm.NewRow();
                    tlm.Add(0, new RepString(fontProp_Text, financas.NaturezaLancamento.NomeNatureza));

                    tlm.Add(1, new RepString(fontProp_Text, financas.TipoLancamento));

                    tlm.Add(2, new RepString(fontProp_Text, financas.DataLancamento.Value.ToString("dd/MM/yyyy")));

                    tlm.Add(3, new RepString(fontProp_Text, String.Format("{0:C2}", financas.Valor.Value)));

                    valorTotal += financas.Valor.Value;
                }

                if (listaFinancas.Count > 0)
                {
                    tlm.NewRow();
                    tlm.Add(0, new RepString(fontProp_Text, ""));
                    tlm.Add(1, new RepString(fontProp_Text, ""));
                    tlm.Add(2, new RepString(fontProp_Text, "Total:"));
                    tlm.Add(3, new RepString(fontProp_Text, String.Format("{0:C2}", valorTotal)));
                }

            }


            //page_Cur.AddCT_MM(rPosLeft + tlm.rWidthMM / 2, rPosTop + tlm.rCurY_MM + 2, new RepString(fontProp_Text, "- end of table -"));

            // print page number and current date/time
            Double rY = rPosBottom + 1.5;
            foreach (Page page in enum_Page)
            {
                page.AddLT_MM(rPosLeft, rY, new RepString(fontProp_Text, DateTime.Now.ToShortDateString() + "  " + DateTime.Now.ToShortTimeString()));
                page.AddRT_MM(rPosRight, rY, new RepString(fontProp_Text, page.iPageNo + " / " + iPageCount));
            }
        }
        //------------------------------------------------------------------------------------------30.10.2004
        /// <summary>Creates a new page.</summary>
        /// <param name="oSender">Sender</param>
        /// <param name="ea">Event argument</param>
        /// <remarks>
        /// The first page has a caption. The following pages have no caption and therefore the table can be made higher.
        /// </remarks>
        public void Tlm_NewContainer(Object oSender, TableLayoutManager.NewContainerEventArgs ea)
        {  // only "public" for NDoc, should be "private"
            new Page(this);

            // first page with caption
            if (page_Cur.iPageNo == 1)
            {
                FontProp fontProp_Title = new FontPropMM(fontDef_Helvetica, 4);
                fontProp_Title.bBold = true;
                page_Cur.AddCT_MM(rPosLeft + (rPosRight - rPosLeft) / 2, rPosTop, new RepString(fontProp_Title, "SGS - Relatório Assistido"));
                ea.container.rHeightMM -= fontProp_Title.rLineFeedMM;  // reduce height of table container for the first page
            }

            // the new container must be added to the current page
            page_Cur.AddMM(rPosLeft, rPosBottom - ea.container.rHeightMM, ea.container);
        }
        //------------------------------------------------------------------------------------------30.10.2004
        /// <summary>Creates this report.</summary>
        /// <remarks>
        /// This method overrides the method <see cref="Root.Reports.Report.Create"/> of the base class <see cref="Root.Reports.Report"/>.
        /// </remarks>
        protected override void Create()
        {
            fontDef_Helvetica = new FontDef(this, FontDef.StandardFont.TimesRoman);
            FontProp fontProp_Text = new FontPropMM(fontDef_Helvetica, 1.9);  // standard font
            FontProp fontProp_Header = new FontPropMM(fontDef_Helvetica, 1.9);  // font of the table header
            fontProp_Header.bBold = true;

            // create table
            TableLayoutManager tlm;
            using (tlm = new TableLayoutManager(fontProp_Header))
            {
                tlm.rContainerHeightMM = rPosBottom - rPosTop;  // set height of table
                tlm.tlmCellDef_Header.rAlignV = RepObj.rAlignCenter;  // set vertical alignment of all header cells
                tlm.tlmCellDef_Default.penProp_LineBottom = new PenProp(this, 0.05, Color.LightGray);  // set bottom line for all cells
                tlm.tlmHeightMode = TlmHeightMode.AdjustLast;
                tlm.eNewContainer += new TableLayoutManager.NewContainerEventHandler(Tlm_NewContainer);

                // define columns
                TlmColumn col;


                col = new TlmColumnMM(tlm, "Nome Plano", 35);
                col.tlmCellDef_Default.tlmTextMode = TlmTextMode.MultiLine;

                col = new TlmColumnMM(tlm, "Data Início", 25);

                col = new TlmColumnMM(tlm, "Data Fim", 25);

                col = new TlmColumnMM(tlm, "Valor Orçamento", 30);

                col = new TlmColumnMM(tlm, "Valor Gasto", 30);

                col = new TlmColumnMM(tlm, "Saldo Orçamento", 30);

                List<Orcamento> listaOrcamento = (List<Orcamento>)RelatorioDTO.DadosRelatorio;
                foreach (Orcamento orcamento in listaOrcamento)
                {
                    tlm.NewRow();
                    tlm.Add(0, new RepString(fontProp_Text, orcamento.NomePlano));

                    tlm.Add(1, new RepString(fontProp_Text, orcamento.InicioVigencia.Value.ToString("dd/MM/yyyy") ));

                    tlm.Add(2, new RepString(fontProp_Text, orcamento.FimVigencia.Value.ToString("dd/MM/yyyy")));

                    tlm.Add(3, new RepString(fontProp_Text, String.Format("{0:C2}", orcamento.ValorOrcamento.Value)));

                    tlm.Add(4, new RepString(fontProp_Text, String.Format("{0:C2}", orcamento.ValorFinanceiroReal)));

                    tlm.Add(5, new RepString(fontProp_Text, String.Format("{0:C2}", orcamento.SaldoDisponivelOrcamento)));
                }
            }

            //page_Cur.AddCT_MM(rPosLeft + tlm.rWidthMM / 2, rPosTop + tlm.rCurY_MM + 2, new RepString(fontProp_Text, "- end of table -"));

            // print page number and current date/time
            Double rY = rPosBottom + 1.5;
            foreach (Page page in enum_Page)
            {
                page.AddLT_MM(rPosLeft, rY, new RepString(fontProp_Text, DateTime.Now.ToShortDateString() + "  " + DateTime.Now.ToShortTimeString()));
                page.AddRT_MM(rPosRight, rY, new RepString(fontProp_Text, page.iPageNo + " / " + iPageCount));
            }
        }
    private Double rPosBottom = 278;  // millimeters

    //------------------------------------------------------------------------------------------30.10.2004
    /// <summary>Creates this report.</summary>
    /// <remarks>
    /// This method overrides the method <see cref="Root.Reports.Report.Create"/> of the base class <see cref="Root.Reports.Report"/>.
    /// </remarks>
    protected override void Create() {  
      fontDef_Helvetica = new FontDef(this, FontDef.StandardFont.TimesRoman);
      FontProp fontProp_Text = new FontPropMM(fontDef_Helvetica, 1.9);  // standard font
      FontProp fontProp_Header = new FontPropMM(fontDef_Helvetica, 1.9);  // font of the table header
      fontProp_Header.bBold = true;

      Stream stream_Phone = GetType().Assembly.GetManifestResourceStream("SGS.Componentes.Phone.jpg");
      Random random = new Random(6);

      // create table
      TableLayoutManager tlm;
      using (tlm = new TableLayoutManager(fontProp_Header)) { 
        tlm.rContainerHeightMM = rPosBottom - rPosTop;  // set height of table
        tlm.tlmCellDef_Header.rAlignV = RepObj.rAlignCenter;  // set vertical alignment of all header cells
        tlm.tlmCellDef_Default.penProp_LineBottom = new PenProp(this, 0.05, Color.LightGray);  // set bottom line for all cells
        tlm.tlmHeightMode = TlmHeightMode.AdjustLast;
        tlm.eNewContainer += new TableLayoutManager.NewContainerEventHandler(Tlm_NewContainer);

        // define columns
        TlmColumn col;
        col = new TlmColumnMM(tlm, "ID", 13);

        col = new TlmColumnMM(tlm, "Company Name", 40);
        col.tlmCellDef_Default.tlmTextMode = TlmTextMode.MultiLine;

        col = new TlmColumnMM(tlm, "Address", 30);

        col = new TlmColumnMM(tlm, "City", 22);

        col = new TlmColumnMM(tlm, "Postal Code", 16);

        col = new TlmColumnMM(tlm, "Country", 18);

        //col = new TlmColumnMM(tlm, "Pais", 24);

        TlmColumn col_Phone = new TlmColumnMM(tlm, "Phone", rPosRight - rPosLeft - tlm.rWidthMM);
        col_Phone.fontProp_Header = new FontPropMM(fontDef_Helvetica, 1.9, Color.Brown);
        col_Phone.tlmCellDef_Header.rAlignH = RepObj.rAlignRight;
        col_Phone.tlmCellDef_Default.rAlignH = RepObj.rAlignRight;
        BrushProp brushProp_Phone = new BrushProp(this, Color.FromArgb(255, 255, 200));
        col_Phone.tlmCellDef_Default.brushProp_Back = brushProp_Phone;
        BrushProp brushProp_USA = new BrushProp(this, Color.FromArgb(255, 180, 180));

        // open data set
        DataSet dataSet = new DataSet();
        using (Stream stream_Customers = GetType().Assembly.GetManifestResourceStream("SGS.Componentes.Customers.xml"))
        {
          dataSet.ReadXml(stream_Customers);
        }
        DataTable dataTable_Customers = dataSet.Tables[0];

        foreach (DataRow dr in dataTable_Customers.Rows) {
          String sCountry = (String)dr["Country"];
          tlm.tlmCellDef_Default.brushProp_Back = (sCountry == "USA" ? brushProp_USA : null);
          col_Phone.tlmCellDef_Default.brushProp_Back = (sCountry == "USA" ? new BrushProp(this, Color.FromArgb(255, 227, 50)) : brushProp_Phone);
          tlm.NewRow();
          tlm.Add(0, new RepString(fontProp_Text, (String)dr["CustomerID"]));
          tlm.Add(1, new RepString(fontProp_Text, (String)dr["CompanyName"]));
          tlm.Add(2, new RepString(fontProp_Text, (String)dr["Address"]));
          tlm.Add(3, new RepString(fontProp_Text, (String)dr["City"]));
          tlm.Add(4, new RepString(fontProp_Text, (String)dr["PostalCode"]));
          tlm.Add(5, new RepString(fontProp_Text, sCountry));
          tlm.Add(6, new RepString(fontProp_Text, (String)dr["Phone"]));
          if (random.NextDouble() < 0.2) {  // mark randomly selected row with a phone icon
            tlm.tlmRow_Cur.aTlmCell[col_Phone].AddMM(1, 0.25, new RepImageMM(stream_Phone, 2.1, 2.3));
          }
        }
      }
      page_Cur.AddCT_MM(rPosLeft + tlm.rWidthMM / 2, rPosTop + tlm.rCurY_MM + 2, new RepString(fontProp_Text, "- end of table -"));

      // print page number and current date/time
      Double rY = rPosBottom + 1.5;
      foreach (Page page in enum_Page) {
        page.AddLT_MM(rPosLeft, rY, new RepString(fontProp_Text, DateTime.Now.ToShortDateString()  + "  " + DateTime.Now.ToShortTimeString()));
        page.AddRT_MM(rPosRight, rY, new RepString(fontProp_Text, page.iPageNo + " / " + iPageCount));
      }
    }
        public void StampaStrForClientiInGrid(string sIDcli)
        {
            _sTitolo = "Stampa strumenti per cliente";
            FontProp fp = new FontPropMM(fd, 1.9);
            FontProp fp_Header = new FontPropMM(fd, 1.9);
            fp_Header.bBold = true;
            fp_Header.color = HeaderForeColor;

            //Carico la matrice delle tipologie di strumenti disponibili

            string[] sTipologia = null;//gestData.tipologiaStringGet();

            foreach (string sActualTipologia in sTipologia)
            {

                // create table
                using (TableLayoutManager tlm = new TableLayoutManager(fp_Header))
                {
                    tlm.rContainerHeightMM = rPosBottom - rPosTop;  // set height of table
                    tlm.headerCellDef.rAlignV = RepObj.rAlignCenter;  // set vertical alignment of all header cells
                    tlm.headerCellDef.bp_Back.color = HeaderBackColor;

                    tlm.cellDef.pp_LineBottom = new PenProp(rpt, 0.05, Color.LightGray);
                    tlm.eNewContainer += new TableLayoutManager.NewContainerEventHandler(Tlm_NewContainer);

                    // define columns
                    TableLayoutManager.Column col;
                    col = new TableLayoutManager.ColumnMM(tlm, "Tipo", 20);
                    col = new TableLayoutManager.ColumnMM(tlm, "Marca", 25);
                    col.cellDef.textMode = TableLayoutManager.TextMode.MultiLine;
                    col = new TableLayoutManager.ColumnMM(tlm, "Modello", 30);
                    col = new TableLayoutManager.ColumnMM(tlm, "Matricola", 20);
                    col = new TableLayoutManager.ColumnMM(tlm, "Omologazione 1", 30);
                    col = new TableLayoutManager.ColumnMM(tlm, "Omologazione 2", 30);
                    col = new TableLayoutManager.ColumnMM(tlm, "Num. serie rulli", 20);
                    col = new TableLayoutManager.ColumnMM(tlm, "Num. serie pesa", 20);
                    col = new TableLayoutManager.ColumnMM(tlm, "P.E.F.", 10);
                    col = new TableLayoutManager.ColumnMM(tlm, "Data scadenza", 20);

                    //	Ritorna il dataset
                    string strWhere = "SELECT tblScadenze.Tipologia, tblScadenze.DataScadenza, tblScadenze.IDSca," +
                        " Clienti.RagioneSoc, tblScadenze.IDCliente, qryStrumenti.Marca, qryStrumenti.Tipo," +
                        " tblScadenze.DataAttivazione,tblScadenze.Omologazione1,tblScadenze.Omologazione2," +
                        " qryStrumenti.Nome , tblScadenze.NumeroDiSerie, tblScadenze.PEF, tblScadenze.NumSerieRulli," +
                        " tblScadenze.NumSeriePesa , tblScadenze.TipoCalibratore, tblScadenze.NumSerCalibratore" +

                        " FROM (Clienti INNER JOIN tblScadenze ON Clienti.IDCliente = tblScadenze.IDCliente) INNER JOIN qryStrumenti ON tblScadenze.IdStrumento = qryStrumenti.idStrumenti  " +
                        " WHERE (((tblScadenze.Tipologia)='" + sActualTipologia + "') AND ((tblScadenze.IDCliente)=" + sIDcli + "))  " +
                        " ORDER BY tblScadenze.Tipologia DESC , tblScadenze.DataScadenza DESC , Clienti.RagioneSoc DESC";

                    DataSet objDS = null;// gestData.CreateDataSet(strWhere);				

                    DataTable DT = objDS.Tables[0];

                    //				read rows
                    for (int r = 0; r < DT.Rows.Count; r++)
                    {
                        tlm.NewRow();
                        tlm.Add(0, new RepString(fp, DT.Rows[r]["Tipo"].ToString()));
                        tlm.Add(1, new RepString(fp, DT.Rows[r]["Marca"].ToString()));
                        tlm.Add(2, new RepString(fp, DT.Rows[r]["Nome"].ToString()));
                        tlm.Add(3, new RepString(fp, DT.Rows[r]["NumeroDiSerie"].ToString()));
                        tlm.Add(4, new RepString(fp, DT.Rows[r]["Omologazione1"].ToString()));
                        tlm.Add(5, new RepString(fp, DT.Rows[r]["Omologazione2"].ToString()));
                        tlm.Add(6, new RepString(fp, DT.Rows[r]["NumSerieRulli"].ToString()));
                        tlm.Add(7, new RepString(fp, DT.Rows[r]["NumSeriePesa"].ToString()));
                        tlm.Add(8, new RepString(fp, DT.Rows[r]["PEF"].ToString()));
                        tlm.Add(9, new RepString(fp, DT.Rows[r]["DataScadenza"].ToString()));
                    }
                }
            }

            // print page number and current date/time
            foreach (Root.Reports.Page page in rpt.enum_Page)
            {
                Double rY = rPosBottom + 1.5;
                page.AddLT_MM(rPosLeft, rY, new RepString(fp, DateTime.Now.ToShortDateString() + "  " + DateTime.Now.ToShortTimeString()));
                page.AddRT_MM(rPosRight, rY, new RepString(fp, page.iPageNo.ToString() + " / " + rpt.iPageCount.ToString()));
            }
        }
        public void StampaAllClienti()
        {
            _sTitolo = "Stampa complessiva di tutti i clienti";
            FontProp fp = new FontPropMM(fd, 1.9);
            FontProp fp_Header = new FontPropMM(fd, 1.9);
            fp_Header.bBold = true;
            fp_Header.color = HeaderForeColor;

            // create table
            using (TableLayoutManager tlm = new TableLayoutManager(fp_Header))
            {
                tlm.rContainerHeightMM = rPosBottom - rPosTop;  // set height of table
                tlm.headerCellDef.rAlignV = RepObj.rAlignCenter;  // set vertical alignment of all header cells
                tlm.headerCellDef.bp_Back.color = HeaderBackColor;

                tlm.cellDef.pp_LineBottom = new PenProp(rpt, 0.05, Color.LightGray);
                tlm.eNewContainer += new TableLayoutManager.NewContainerEventHandler(Tlm_NewContainer);

                // define columns
                TableLayoutManager.Column col;
                col = new TableLayoutManager.ColumnMM(tlm, "ID", 8);
                col = new TableLayoutManager.ColumnMM(tlm, "Ragione sociale", 40);
                col.cellDef.textMode = TableLayoutManager.TextMode.MultiLine;
                col = new TableLayoutManager.ColumnMM(tlm, "Indirizzo", 36);
                col = new TableLayoutManager.ColumnMM(tlm, "Località", 30);
                col = new TableLayoutManager.ColumnMM(tlm, "Cap", 12);
                col = new TableLayoutManager.ColumnMM(tlm, "Prov", 8);
                col = new TableLayoutManager.ColumnMM(tlm, "Telefono", 25);
                col = new TableLayoutManager.ColumnMM(tlm, "Fax", 25);

                //				Ritorna il dataset
                string strWhere = "SELECT * FROM Clienti;";
                SqlCommand cmd = new SqlCommand(strWhere, sqlCn);
                SqlDataAdapter adap = new SqlDataAdapter(cmd);
                DataTable DT = new DataTable();
                adap.Fill(DT);

                //				read rows
                for (int r = 0; r < DT.Rows.Count; r++)
                {
                    tlm.NewRow();
                    tlm.Add(0, new RepString(fp, DT.Rows[r]["IDCliente"].ToString()));
                    tlm.Add(1, new RepString(fp, DT.Rows[r]["RagioneSoc"].ToString()));
                    tlm.Add(2, new RepString(fp, DT.Rows[r]["Indirizzo"].ToString()));
                    tlm.Add(3, new RepString(fp, DT.Rows[r]["Localita"].ToString()));
                    tlm.Add(4, new RepString(fp, DT.Rows[r]["Cap"].ToString()));
                    tlm.Add(5, new RepString(fp, DT.Rows[r]["Provincia"].ToString()));
                    tlm.Add(6, new RepString(fp, DT.Rows[r]["Telefono"].ToString()));
                    tlm.Add(7, new RepString(fp, DT.Rows[r]["Fax"].ToString()));
                }
            }


            // print page number and current date/time
            foreach (Root.Reports.Page page in rpt.enum_Page)
            {
                Double rY = rPosBottom + 1.5;
                page.AddLT_MM(rPosLeft, rY, new RepString(fp, DateTime.Now.ToShortDateString() + "  " + DateTime.Now.ToShortTimeString()));
                page.AddRT_MM(rPosRight, rY, new RepString(fp, page.iPageNo.ToString() + " / " + rpt.iPageCount.ToString()));
            }
        }
        /// <summary>Creates a new page</summary>
        /// <param name="oSender">Sender</param>
        /// <param name="ea">Event argument</param>
        private void Tlm_NewContainer(Object oSender, TableLayoutManager.NewContainerEventArgs ea)
        {

            if (bfirstPas)
                new Root.Reports.Page(rpt);
            bfirstPas = true;
            // first page with heading
            if (rpt.page_Cur.iPageNo == 1)
            {
                FontProp fp_Title = new FontPropMM(fd, 6);
                fp_Title.bBold = true;
                rpt.page_Cur.AddCT_MM(rPosLeft + (rPosRight - rPosLeft) / 2, rPosTop, new RepString(fp_Title, _sTitolo));
                ea.container.rHeightMM -= fp_Title.rLineFeedMM;  // reduce height of table container for the first page
            }

            // the new container must be added to the current page
            rpt.page_Cur.AddMM(rPosLeft, rPosBottom - ea.container.rHeightMM, ea.container);
        }
        public void StampaScaDA_A(DateTime dataDA, DateTime dataA)
        {
            _sTitolo = "Scadenze Dal:" + dataDA.ToShortDateString() + " A:" + dataA.ToShortDateString();
            FontProp fp = new FontPropMM(fd, 1.9);
            FontProp fp_Header = new FontPropMM(fd, 1.9);

            //imposto le informazioni per HEADER della tabella
            fp_Header.bBold = true;
            fp_Header.color = HeaderForeColor;

            // create table
            using (TableLayoutManager tlm = new TableLayoutManager(fp_Header))
            {
                tlm.rContainerHeightMM = rPosBottom - rPosTop;  // set height of table

                //Imposto le informazioni di allineamento e di sfondo del HEADER
                tlm.headerCellDef.rAlignV = RepObj.rAlignCenter;  // set vertical alignment of all header cells
                tlm.headerCellDef.bp_Back.color = HeaderBackColor;

                tlm.cellDef.pp_LineBottom = new PenProp(rpt, 0.05, Color.LightGray);

                //Creo l'eento per ogni nuova pagina
                tlm.eNewContainer += new TableLayoutManager.NewContainerEventHandler(Tlm_NewContainer);

                // Definizione dell colonne
                TableLayoutManager.Column col;
                col = new TableLayoutManager.ColumnMM(tlm, "Ragione sociale", 70);
                col.cellDef.textMode = TableLayoutManager.TextMode.MultiLine;
                col = new TableLayoutManager.ColumnMM(tlm, "Localita", 25);
                col = new TableLayoutManager.ColumnMM(tlm, "Prov", 10);
                col = new TableLayoutManager.ColumnMM(tlm, "Telefono", 20);
                col = new TableLayoutManager.ColumnMM(tlm, "Tipologia", 30);
                col = new TableLayoutManager.ColumnMM(tlm, "Scadenza", 20);

                string sDA = dataDA.Month + "/" + dataDA.Day + "/" + dataDA.Year;
                string sA = dataA.Month + "/" + dataA.Day + "/" + dataA.Year;

                //Ritorna il dataset
                string strWhere = @"SELECT tblScadenze.DataScadenza, Clienti.RagioneSoc, Clienti.Localita, Clienti.Provincia, Clienti.Telefono, Clienti.bElimina, tblScadenze.Tipologia
FROM Tipo INNER JOIN ((Marche INNER JOIN Strumenti ON Marche.IDMarca = Strumenti.IDMarca) INNER JOIN (Clienti INNER JOIN tblScadenze ON Clienti.IDCliente = tblScadenze.IDCliente) ON Strumenti.idStrumenti = tblScadenze.IdStrumento) ON Tipo.IDTipo = Strumenti.IDTipo
GROUP BY tblScadenze.DataScadenza, Clienti.RagioneSoc, Clienti.Localita, Clienti.Provincia, Clienti.Telefono, Clienti.bElimina, tblScadenze.Tipologia, Clienti.bElimina
						HAVING (tblScadenze.DataScadenza Between #" + sDA + "# And #" + sA + "#) AND (Clienti.bElimina=False)" +
                        " ORDER BY tblScadenze.DataScadenza";
                SqlCommand cmd = new SqlCommand(strWhere, sqlCn);
                SqlDataAdapter adap = new SqlDataAdapter(cmd);
                DataTable DT = new DataTable();
                adap.Fill(DT);

                //				read rows
                string ripRag = "";
                string ripTipologia = "";
                string s = "";
                for (int r = 0; r < DT.Rows.Count; r++)
                {
                    tlm.NewRow();

                    if (ripRag == DT.Rows[r]["RagioneSoc"].ToString())
                        s = "";
                    else
                    {
                        s = ripRag = DT.Rows[r]["RagioneSoc"].ToString();
                        ripTipologia = "";
                    }
                    tlm.Add(0, new RepString(fp, s));


                    if (ripTipologia == DT.Rows[r]["Tipologia"].ToString())
                        s = "";
                    else
                        s = ripTipologia = DT.Rows[r]["Tipologia"].ToString();

                    tlm.Add(1, new RepString(fp, DT.Rows[r]["Localita"].ToString()));
                    tlm.Add(2, new RepString(fp, DT.Rows[r]["Provincia"].ToString()));
                    tlm.Add(3, new RepString(fp, DT.Rows[r]["Telefono"].ToString()));
                    tlm.Add(4, new RepString(fp, s));
                    DateTime dtData = (DateTime)DT.Rows[r]["DataScadenza"];
                    tlm.Add(5, new RepString(fp, dtData.ToShortDateString()));

                }
            }


            // print page number and current date/time
            foreach (Root.Reports.Page page in rpt.enum_Page)
            {
                Double rY = rPosBottom + 1.5;
                page.AddLT_MM(rPosLeft, rY, new RepString(fp, DateTime.Now.ToShortDateString() + "  " + DateTime.Now.ToShortTimeString()));
                page.AddRT_MM(rPosRight, rY, new RepString(fp, page.iPageNo.ToString() + " / " + rpt.iPageCount.ToString()));
            }
        }
Exemple #10
0
    public Report StampaRigheRapportino(int IDRapportino)
    {
        _sTitolo = "";

        rPosLeft = 3;
        rPosRight = 215;
        rPosTop = 142;
        rPosBottom = 230;

        mMarginLeft = 10;
        mMarginRight = 190;
        mMarginTop = 140;
        mMarginBottom = 200;



        rPosTop = rPosTop + 30;

        FontProp fp = new FontPropMM(fd, 2);
        FontProp fp_Header = new FontPropMM(fd, 2);

        //imposto le informazioni per HEADER della tabella
        fp_Header.bBold = true;
        fp_Header.color = HeaderForeColor;

        // create table
        using (TableLayoutManager tlm = new TableLayoutManager(fp_Header))
        {
            tlm.rContainerHeightMM = rPosBottom - rPosTop;  // set height of table
            
            //Imposto le informazioni di allineamento e di sfondo del HEADER
            tlm.headerCellDef.rAlignV = RepObj.rAlignLeft;  // set vertical alignment of all header cells
            tlm.headerCellDef.bp_Back.color = HeaderBackColor;

            tlm.cellDef.pp_LineBottom = new PenProp(rpt, 0.05, Color.LightGray);

            //Creo l'eento per ogni nuova pagina
            tlm.eNewContainer += new TableLayoutManager.NewContainerEventHandler(Tlm_NewContainer);

            // Definizione delle colonne
            TableLayoutManager.Column col;

            col = new TableLayoutManager.ColumnMM(tlm, "Q.ta", 15);
            col.cellDef.textMode = TableLayoutManager.TextMode.MultiLine;
            col = new TableLayoutManager.ColumnMM(tlm, "Modello", 25);
            col = new TableLayoutManager.ColumnMM(tlm, "Descrizione", 103);
            col = new TableLayoutManager.ColumnMM(tlm, "Prezzo Unitario", 30);
            col = new TableLayoutManager.ColumnMM(tlm, "Importo", 30);

            //Ritorna il dataset
            string strWhere = @"SELECT     IDRapportinoRighe, IDRapportino,IDArticolo, Descrizione, PrezzoUnitario, Quantita, Totale
                                    FROM         dbo.RapportinoRighe
                                    WHERE     (IDRapportino = @Rapportino)";
            SqlCommand cmd = new SqlCommand(strWhere, _sqlCn);


            SqlParameter parIDRapportino = new SqlParameter("@Rapportino", SqlDbType.Int);
            parIDRapportino.Value = IDRapportino;
            cmd.Parameters.Add(parIDRapportino);

            SqlDataAdapter adap = new SqlDataAdapter(cmd);
            DataTable DT = new DataTable();
            adap.Fill(DT);

            //Imposto intestazione
            cReport objReport = new cReport(rpt, rptPage);

            //				read rows
            for (int r = 0; r < DT.Rows.Count; r++)
            {
                tlm.NewRow();
                float f = 0;
                float.TryParse(DT.Rows[r]["Quantita"].ToString(), out f);
                tlm.Add(0, new RepString(fp, f.ToString("0.##")));
                
                tlm.Add(1, new RepString(fp, DT.Rows[r]["IDArticolo"].ToString()));
                tlm.Add(2, new RepString(fp, DT.Rows[r]["Descrizione"].ToString()));
                float.TryParse(DT.Rows[r]["PrezzoUnitario"].ToString(), out f);
                tlm.Add(3, new RepString(fp, f.ToString("0.00")));
                float.TryParse(DT.Rows[r]["Totale"].ToString(), out f);
                tlm.Add(4, new RepString(fp, f.ToString("0.00")));

            }
            if (DT.Rows.Count == 0)
            {
                tlm.NewRow();
                tlm.Add(0, new RepString(fp, ""));
                tlm.Add(1, new RepString(fp, ""));
                tlm.Add(2, new RepString(fp, ""));
                tlm.Add(3, new RepString(fp, ""));
                tlm.Add(4, new RepString(fp, ""));
            }

        }


        // print page number and current date/time
        foreach (Root.Reports.Page page in rpt.enum_Page)
        {
            Double rY = rPosBottom + 1.5;
            //page.AddLT_MM(rPosLeft, rY, new RepString(fp, DateTime.Now.ToShortDateString() + "  " + DateTime.Now.ToShortTimeString()));
            page.AddRT_MM(rPosRight, rY, new RepString(fp, page.iPageNo.ToString() + " / " + rpt.iPageCount.ToString()));
        }
        return rpt;
    }
Exemple #11
0
    public Report StampaScadenzeClientePerPianificazione(int IDCliente)
    {
        _sTitolo = "";

        rPosLeft = 10;
        rPosRight = 190;
        rPosTop = 150;
        rPosBottom = 288;

        mMarginLeft = 20;
        mMarginRight = 190;
        mMarginTop = 150;
        mMarginBottom = 278;



        rPosTop = rPosTop + 30;

        FontProp fp = new FontPropMM(fd, 1.6);
        FontProp fp_Header = new FontPropMM(fd, 1.6);

        //imposto le informazioni per HEADER della tabella
        fp_Header.bBold = true;
        fp_Header.color = HeaderForeColor;

        // create table
        using (TableLayoutManager tlm = new TableLayoutManager(fp_Header))
        {
            tlm.rContainerHeightMM = rPosBottom - rPosTop;  // set height of table

            //Imposto le informazioni di allineamento e di sfondo del HEADER
            tlm.headerCellDef.rAlignV = RepObj.rAlignLeft;  // set vertical alignment of all header cells
            tlm.headerCellDef.bp_Back.color = HeaderBackColor;

            tlm.cellDef.pp_LineBottom = new PenProp(rpt, 0.05, Color.LightGray);

            //Creo l'eento per ogni nuova pagina
            tlm.eNewContainer += new TableLayoutManager.NewContainerEventHandler(Tlm_NewContainer);

            // Definizione delle colonne
            TableLayoutManager.Column col;

            col = new TableLayoutManager.ColumnMM(tlm, "Tipologia", 20);
            col.cellDef.textMode = TableLayoutManager.TextMode.MultiLine;
            col = new TableLayoutManager.ColumnMM(tlm, "Tipo", 23);
            col = new TableLayoutManager.ColumnMM(tlm, "Marca", 23);
            col = new TableLayoutManager.ColumnMM(tlm, "Modello", 25);
            col = new TableLayoutManager.ColumnMM(tlm, "Matricola", 18);
            col = new TableLayoutManager.ColumnMM(tlm, "Omologazione", 35);
            col = new TableLayoutManager.ColumnMM(tlm, "Pef", 8);
            col = new TableLayoutManager.ColumnMM(tlm, "Data scadenza", 17);
            col = new TableLayoutManager.ColumnMM(tlm, "Nuova data", 21);



            //Ritorna il dataset
            string strWhere = @"SELECT     tblScadenze.DataScadenza, Clienti.RagioneSoc, Clienti.bElimina, Marche.Marca, Tipo.Tipo, tblScadenze.Tipologia, Clienti.IDCliente, 
                      tblScadenze.NumeroDiSerie, Strumenti.Nome, tblScadenze.Omologazione1, tblScadenze.PEF, Clienti.Localita, Clienti.Provincia, Clienti.Telefono, 
                      Clienti.Cap, Clienti.Indirizzo, Clienti.Fax, Clienti.Cellulare, Clienti.Mail, Clienti.kmDistanza, Clienti.Note
                        FROM         Tipo INNER JOIN
                      Marche INNER JOIN
                      Strumenti INNER JOIN
                      Clienti INNER JOIN
                      tblScadenze ON Clienti.IDCliente = tblScadenze.IDCliente ON Strumenti.idStrumenti = tblScadenze.IdStrumento ON 
                      Marche.IDMarca = Strumenti.IDMarca ON Tipo.IDTipo = Strumenti.IDTipo
                        GROUP BY tblScadenze.DataScadenza, Clienti.RagioneSoc, Clienti.bElimina, Marche.Marca, Tipo.Tipo, tblScadenze.Tipologia, Clienti.bElimina, Clienti.IDCliente, 
                      tblScadenze.NumeroDiSerie, Strumenti.Nome, tblScadenze.Omologazione1, tblScadenze.PEF, Clienti.Localita, Clienti.Provincia, Clienti.Telefono, 
                      Clienti.Cap, Clienti.Indirizzo, Clienti.Fax, Clienti.Cellulare, Clienti.Mail, Clienti.kmDistanza, Clienti.Note
                        HAVING      (Clienti.IDCliente = @IDCliente)
                        ORDER BY tblScadenze.Tipologia";
            SqlCommand cmd = new SqlCommand(strWhere, _sqlCn);
            SqlParameter parIDCliente = new SqlParameter("@IDCliente", SqlDbType.Int);
            parIDCliente.Value = IDCliente;
            cmd.Parameters.Add(parIDCliente);

            SqlDataAdapter adap = new SqlDataAdapter(cmd);
            DataTable DT = new DataTable();
            adap.Fill(DT);

            //Imposto intestazione
            cReport objReport = new cReport(rpt, rptPage);

            string ripTipologia = "";
            string s = "";
            for (int r = 0; r < DT.Rows.Count; r++)
            {
                tlm.NewRow();


                if (ripTipologia == DT.Rows[r]["Tipologia"].ToString())
                    s = "";
                else
                    s = ripTipologia = DT.Rows[r]["Tipologia"].ToString();

                tlm.Add(0, new RepString(fp, s));
                tlm.Add(1, new RepString(fp, DT.Rows[r]["Tipo"].ToString()));
                tlm.Add(2, new RepString(fp, DT.Rows[r]["Marca"].ToString()));
                tlm.Add(3, new RepString(fp, DT.Rows[r]["Nome"].ToString()));
                tlm.Add(4, new RepString(fp, DT.Rows[r]["NumeroDiSerie"].ToString()));
                tlm.Add(5, new RepString(fp, DT.Rows[r]["Omologazione1"].ToString()));
                tlm.Add(6, new RepString(fp, DT.Rows[r]["Pef"].ToString()));
                string sDate = ((DateTime)DT.Rows[r]["DataScadenza"]).ToShortDateString();
                tlm.Add(7, new RepString(fp, sDate));
            }

        }


        // print page number and current date/time
        foreach (Root.Reports.Page page in rpt.enum_Page)
        {
            Double rY = rPosBottom + 1.5;
            page.AddLT_MM(rPosLeft, rY, new RepString(fp, DateTime.Now.ToShortDateString() + "  " + DateTime.Now.ToShortTimeString()));
            page.AddRT_MM(rPosRight, rY, new RepString(fp, page.iPageNo.ToString() + " / " + rpt.iPageCount.ToString()));
        }
        return rpt;
    }
Exemple #12
0
    public void StampaSca15gg(int iIDGruppo)
    {
        _sTitolo = "Scadenze 31gg e già scadute";
        FontProp fp = new FontPropMM(fd, 1.9);
        FontProp fp_Header = new FontPropMM(fd, 1.9);

        //imposto le informazioni per HEADER della tabella
        fp_Header.bBold = true;
        fp_Header.color = HeaderForeColor;

        // create table
        using (TableLayoutManager tlm = new TableLayoutManager(fp_Header))
        {
            tlm.rContainerHeightMM = rPosBottom - rPosTop;  // set height of table

            //Imposto le informazioni di allineamento e di sfondo del HEADER
            tlm.headerCellDef.rAlignV = RepObj.rAlignCenter;  // set vertical alignment of all header cells
            tlm.headerCellDef.bp_Back.color = HeaderBackColor;

            tlm.cellDef.pp_LineBottom = new PenProp(rpt, 0.05, Color.LightGray);

            //Creo l'eento per ogni nuova pagina
            tlm.eNewContainer += new TableLayoutManager.NewContainerEventHandler(Tlm_NewContainer);

            // Definizione dell colonne
            TableLayoutManager.Column col;
            col = new TableLayoutManager.ColumnMM(tlm, "Ragione sociale", 55);
            col.cellDef.textMode = TableLayoutManager.TextMode.MultiLine;
            col = new TableLayoutManager.ColumnMM(tlm, "Tipologia", 40);
            col = new TableLayoutManager.ColumnMM(tlm, "Scadenza", 17);
            col = new TableLayoutManager.ColumnMM(tlm, "Marca", 25);
            col = new TableLayoutManager.ColumnMM(tlm, "Tipo", 30);
            col = new TableLayoutManager.ColumnMM(tlm, "Matricola", 30);


            //Ritorna il dataset
            string strWhere = @"SELECT     tblScadenze.DataScadenza, Clienti.RagioneSoc, Clienti.bElimina, Marche.Marca, Tipo.Tipo, tblScadenze.Tipologia, tblScadenze.NumeroDiSerie, 
                      tblScadenze.IDGruppoScadenza
FROM         Tipo INNER JOIN
                      Marche INNER JOIN
                      Strumenti INNER JOIN
                      Clienti INNER JOIN
                      tblScadenze ON Clienti.IDCliente = tblScadenze.IDCliente ON Strumenti.idStrumenti = tblScadenze.IdStrumento ON 
                      Marche.IDMarca = Strumenti.IDMarca ON Tipo.IDTipo = Strumenti.IDTipo
WHERE     (tblScadenze.bScadenzaAnnullata = @bScaAnnullata)
GROUP BY tblScadenze.DataScadenza, Clienti.RagioneSoc, Clienti.bElimina, Marche.Marca, Tipo.Tipo, tblScadenze.Tipologia, Clienti.bElimina, 
                      tblScadenze.NumeroDiSerie, tblScadenze.IDGruppoScadenza
HAVING      (tblScadenze.DataScadenza < @DataLimite) AND (Clienti.bElimina = @bElimina) AND (tblScadenze.IDGruppoScadenza = @IDGruppo)
ORDER BY tblScadenze.DataScadenza";
            SqlCommand cmd = new SqlCommand(strWhere, _sqlCn);

            SqlParameter parDate = new SqlParameter("@DataLimite", SqlDbType.DateTime);
            parDate.Value = DateTime.Now.AddDays(31); ;
            cmd.Parameters.Add(parDate);
            SqlParameter parElimati = new SqlParameter("@bElimina", SqlDbType.Bit);
            parElimati.Value = 0;
            cmd.Parameters.Add(parElimati);
            SqlParameter parScaAnnullata = new SqlParameter("@bScaAnnullata", SqlDbType.Bit);
            parScaAnnullata.Value = 0;
            cmd.Parameters.Add(parScaAnnullata);
            SqlParameter parGruppo = new SqlParameter("@IDGruppo", SqlDbType.Int);
            parGruppo.Value = iIDGruppo;
            cmd.Parameters.Add(parGruppo);

            SqlDataAdapter adap = new SqlDataAdapter(cmd);
            DataTable DT = new DataTable();
            adap.Fill(DT);

            //				read rows
            string ripRag = "";
            string ripTipologia = "";
            string s = "";
            for (int r = 0; r < DT.Rows.Count; r++)
            {
                tlm.NewRow();

                if (ripRag == DT.Rows[r]["RagioneSoc"].ToString())
                    s = "";
                else
                {
                    s = ripRag = DT.Rows[r]["RagioneSoc"].ToString();
                    ripTipologia = "";
                }
                tlm.Add(0, new RepString(fp, s));


                if (ripTipologia == DT.Rows[r]["Tipologia"].ToString())
                    s = "";
                else
                    s = ripTipologia = DT.Rows[r]["Tipologia"].ToString();

                tlm.Add(1, new RepString(fp, s));
                tlm.Add(2, new RepString(fp, ((DateTime)DT.Rows[r]["DataScadenza"]).ToShortDateString()));
                tlm.Add(3, new RepString(fp, DT.Rows[r]["Marca"].ToString()));
                tlm.Add(4, new RepString(fp, DT.Rows[r]["Tipo"].ToString()));
                tlm.Add(5, new RepString(fp, DT.Rows[r]["NumeroDiSerie"].ToString()));
            }
        }


        // print page number and current date/time
        foreach (Root.Reports.Page page in rpt.enum_Page)
        {
            Double rY = rPosBottom + 1.5;
            page.AddLT_MM(rPosLeft, rY, new RepString(fp, DateTime.Now.ToShortDateString() + "  " + DateTime.Now.ToShortTimeString()));
            page.AddRT_MM(rPosRight, rY, new RepString(fp, page.iPageNo.ToString() + " / " + rpt.iPageCount.ToString()));
        }
    }