Esempio n. 1
0
        private static void CreateExcelReport(string filePathInfo)
        {
            var excelGen = new ExcelReportWriter();
            var helper   = new FilePathHelper(filePathInfo);

            excelGen.CreateReport(helper.FilePath, helper.FileName);
        }
        private void btnPrint_Click(object sender, EventArgs e)
        {
            frmRaporDialog frm = new frmRaporDialog(true, true, true, false);

            frm.ShowDialog();
            try {
                ReportTo?dest = frm.GetReportDestination();
                if (dest.HasValue)
                {
                    if (dest.Value != ReportTo.CrytalReport)
                    {
                        // Create the report and turn our query into a ReportSource
                        var report = new Report(_data.ToReportSource());
                        // Customize the Text Fields
                        report.TextFields.Title  = "Gün gün Kasa Raporu";
                        report.TextFields.Header = string.Format(@"
    Kasa  :{0}
    Rapor Tarihi: {1}
    Tarih Aralığı:{2}
",
                                                                 cmboxKasalar.Text, DateTime.Now, GetTarihAraligi());


                        // Render hints allow you to pass additional hints to the reports as they are being rendered
                        report.DataFields["Gelir"].ShowTotals  = true;
                        report.DataFields["Gider"].ShowTotals  = true;
                        report.DataFields["Bakiye"].ShowTotals = true;
                        // Customize the data fields
                        report.RenderHints["HtmlStyle"]              = "th { font-size: 14px !important;font-weight:bold !important}";
                        report.DataFields["Gelir"].DataFormatString  = "{0:F2}";
                        report.DataFields["Gider"].DataFormatString  = "{0:F2}";
                        report.DataFields["Bakiye"].DataFormatString = "{0:F2}";
                        report.DataFields["Tarih"].DataFormatString  = "{0:d}";
                        string        fileName = "gunGunKasaRaporu.xls";
                        IReportWriter writer   = new ExcelReportWriter();
                        if (dest.Value == ReportTo.Html)
                        {
                            writer   = new HtmlReportWriter();
                            fileName = "gunGunKasaRaporu.html";
                        }
                        else if (dest.Value == ReportTo.Csv)
                        {
                            writer   = new DelimitedTextReportWriter();
                            fileName = "gunGunKasaRaporu.txt";
                        }
                        string     file = Path.Combine(Engine.DokumanPath(), fileName);
                        FileStream fs   = new FileStream(file, FileMode.Create);

                        writer.WriteReport(report, fs);
                        fs.Close();
                        Process prc = new Process();
                        prc.StartInfo.FileName = file;
                        prc.Start();
                    }
                }
            } catch (Exception exc) {
                MessageBox.Show(exc.Message);
                LogWrite.Write(exc);
            }
        }
Esempio n. 3
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            frmRaporDialog frm = new frmRaporDialog(true, true, true, false);

            frm.ShowDialog();
            ReportTo?dest = frm.GetReportDestination();

            if (dest.HasValue)
            {
                try {
                    if (dest != ReportTo.CrytalReport)
                    {
                        var report = new Report(_source.ToReportSource());
                        // Customize the Text Fields
                        report.RenderHints.IncludePageNumbers = true;
                        report.TextFields.Title  = tabPage2.Text;
                        report.TextFields.Header = string.Format(@"
            Rapor Tarihi:{0}
            Rapor Tarih Aralığı:{1}
            Cari:{2}         
            ", DateTime.Now, GetTarihAraligi(), RaporCariString());
                        report.DataFields["Tarih"].DataFormatString  = "{0:d}";
                        report.DataFields["Borc"].DataFormatString   = "{0:F2}";
                        report.DataFields["Alacak"].DataFormatString = "{0:F2}";
                        report.DataFields["Alacak"].ShowTotals       = true;
                        report.DataFields["Borc"].ShowTotals         = true;
                        string        fileName = "cariHareketDokumu.xls";
                        IReportWriter writer   = new ExcelReportWriter();

                        if (dest.Value == ReportTo.Html)
                        {
                            writer   = new HtmlReportWriter();
                            fileName = "cariHareketDokumu.html";
                        }
                        else if (dest.Value == ReportTo.Csv)
                        {
                            writer   = new DelimitedTextReportWriter();
                            fileName = "cariHareketDokumu.txt";
                        }
                        string     file = Path.Combine(Engine.DokumanPath(), fileName);
                        FileStream fs   = new FileStream(file, FileMode.Create);

                        writer.WriteReport(report, fs);
                        fs.Close();
                        Process prc = new Process();
                        prc.StartInfo.FileName = file;
                        prc.Start();
                    }
                    else
                    {
                        //frmStokAlisSatisRaporCrytalRapor frm2 = new frmStokAlisSatisRaporCrytalRapor(_source);
                        //frm2.Show();
                    }
                } catch (Exception exc) {
                    MessageBox.Show(exc.Message);
                    LogWrite.Write(exc);
                }
            }
        }
Esempio n. 4
0
    private void btnPrint_Click(object sender, EventArgs e) {
        frmRaporDialog frm = new frmRaporDialog(true, true, true, false);
        frm.ShowDialog();
        ReportTo? dest = frm.GetReportDestination();
        if (dest.HasValue) {
            try {
                if (dest.Value != ReportTo.CrytalReport) {


                    // Create the report and turn our query into a ReportSource
                    var report = new Report(_source.ToReportSource());
                    // Customize the Text Fields

                    report.TextFields.Title = "Kasa Hareket Dökümü";
                    report.TextFields.Header = string.Format(@"
            Rapor Tarihi:{0}
            Tarih Aralığı:{1}
            Kasa:{2} 
            ", DateTime.Now,GetTarihAraligi(), _source.Rows[0]["KasaKod"].ToStringOrEmpty());
                    // Render hints allow you to pass additional hints to the reports as they are being rendered
                    report.RenderHints.BooleanCheckboxes = true;
                    // Customize the data fields
                    report.DataFields["Tutar"].ShowTotals = true;
                    report.DataFields["KasaKod"].Hidden = true;
                    //report.DataFields["Tutar"].DataFormatString = "{0:c}";
                    report.DataFields["Tarih"].DataFormatString = "{0:d}";
                    string fileName = "kasahareketDokumu.xls";
                    IReportWriter writer = new ExcelReportWriter();
                    if (dest.Value == ReportTo.Html) {
                        writer = new HtmlReportWriter();
                        fileName = "kasahareketDokumu.html";
                    } else if (dest.Value == ReportTo.Csv) {
                        writer = new DelimitedTextReportWriter();
                        fileName = "kasahareketDokumu.txt";
                    }
                    string file = Path.Combine(Engine.DokumanPath(), fileName);
                    FileStream fs = new FileStream(file, FileMode.Create);

                    writer.WriteReport(report, fs);
                    fs.Close();
                    Process prc = new Process();
                    prc.StartInfo.FileName = file;
                    prc.Start();

                }
            } catch (Exception exc) {
                MessageBox.Show(exc.Message);
                LogWrite.Write(exc);
            }

        }
    }
Esempio n. 5
0
        private static void Bw_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                using (FileStream fs = new FileStream("export.xls", FileMode.Create))
                {
                    var writer = new ExcelReportWriter();
                    writer.WriteReport(report, fs);
                }

                Process.Start("export.xls");
            }
            catch (Exception s)
            {
                DataHelpers.ShowMessage(s.Message);
            }
        }
Esempio n. 6
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            frmRaporDialog frm = new frmRaporDialog(true, true, true, false);

            frm.ShowDialog();
            ReportTo?dest = frm.GetReportDestination();

            if (dest.HasValue)
            {
                try {
                    if (dest != ReportTo.CrytalReport)
                    {
                        var report = new Report(_source.ToReportSource());
                        // Customize the Text Fields
                        report.RenderHints.IncludePageNumbers = true;
                        report.TextFields.Title  = tabPageFiltre.Text;
                        report.TextFields.Header = string.Format(@"
            Rapor Tarihi:{0}
            Stok:{1}
            Rapor Tarih Aralığı:{2}            
            ", DateTime.Now, SecilenStok(), GetTarihAraligi()
                                                                 );

                        //report.DataFields["Tarih"].DataFormatString = "{0:d}";
                        //report.DataFields["BirimFiyat"].DataFormatString = "{0:F2}";
                        //report.DataFields["Tutar"].DataFormatString = "{0:F2}";
                        report.RenderHints["HtmlStyle"]                    = "th { font-size: 13px !important;font-weight:bold !important;}";
                        report.RenderHints["HtmlStyle"]                    = "td { font-size: 11px !important;line-height:1em; }";
                        report.DataFields["KalanMiktar"].ShowTotals        = true;
                        report.DataFields["SatisMiktar"].ShowTotals        = true;
                        report.DataFields["AlisMiktar"].ShowTotals         = true;
                        report.DataFields["OrtalamaAlisFiyat"].ShowTotals  = true;
                        report.DataFields["OrtalamaSatisFiyat"].ShowTotals = true;
                        report.DataFields["AlisTutar"].ShowTotals          = true;

                        report.DataFields["SatisTutar"].ShowTotals         = true;
                        report.DataFields["KalanMalinMaliyeti"].ShowTotals = true;

                        string        fileName = "malMaliyetRaporu";
                        IReportWriter writer   = new ExcelReportWriter();

                        if (dest.Value == ReportTo.Excel)
                        {
                            fileName = fileName + ".xls";
                        }
                        else if (dest.Value == ReportTo.Html)
                        {
                            writer   = new HtmlReportWriter();
                            fileName = fileName + ".html";
                        }
                        else if (dest.Value == ReportTo.Csv)
                        {
                            writer   = new DelimitedTextReportWriter();
                            fileName = fileName + ".txt";
                        }
                        string     file = Path.Combine(Engine.DokumanPath(), fileName);
                        FileStream fs   = new FileStream(file, FileMode.Create);

                        writer.WriteReport(report, fs);
                        fs.Close();
                        Process prc = new Process();
                        prc.StartInfo.FileName = file;
                        prc.Start();
                    }
                    else
                    {
                        //frmStokAlisSatisRaporCrytalRapor frm2 = new frmStokAlisSatisRaporCrytalRapor(_source);
                        //frm2.Show();
                    }
                } catch (Exception exc) {
                    MessageBox.Show(exc.Message);
                    LogWrite.Write(exc);
                }
            }
        }
Esempio n. 7
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            frmRaporDialog frm = new frmRaporDialog(true, true, true, false);

            frm.ShowDialog();
            ReportTo?dest = frm.GetReportDestination();

            if (dest.HasValue)
            {
                try {
                    if (dest != ReportTo.CrytalReport)
                    {
                        var report = new Report(_source.ToReportSource());
                        // Customize the Text Fields
                        report.RenderHints.IncludePageNumbers = true;
                        report.TextFields.Title  = tabPage2.Text;
                        report.TextFields.Header = string.Format(@"
            Rapor Tarihi:{0}
            Stok:{2}
            Toplam Adet:{2}
            Toplam Tutar:{3}
            Rapor Tarih Aralığı:{4} 
            ", DateTime.Now, SecilenStok(), _source.Compute("sum(Miktar)", ""), _source.Compute("sum(Tutar)", ""), GetTarihAraligi());
                        report.DataFields["Tarih"].DataFormatString      = "{0:d}";
                        report.DataFields["BirimFiyat"].DataFormatString = "{0:F2}";
                        report.DataFields["Tutar"].DataFormatString      = "{0:F2}";
                        string        fileName = StokAlisSatisRapor.AlisRapor == _alisSatis ? "malAlisRapor" : "malSatisRapor";
                        IReportWriter writer   = new ExcelReportWriter();
                        if (dest.Value == ReportTo.Excel)
                        {
                            fileName = fileName + ".xls";
                        }
                        else if (dest.Value == ReportTo.Html)
                        {
                            writer   = new HtmlReportWriter();
                            fileName = fileName + ".html";
                        }
                        else if (dest.Value == ReportTo.Csv)
                        {
                            writer   = new DelimitedTextReportWriter();
                            fileName = fileName + ".txt";
                        }
                        string     file = Path.Combine(Engine.DokumanPath(), fileName);
                        FileStream fs   = new FileStream(file, FileMode.Create);

                        writer.WriteReport(report, fs);
                        fs.Close();
                        Process prc = new Process();
                        prc.StartInfo.FileName = file;
                        prc.Start();
                    }
                    else
                    {
                        //frmStokAlisSatisRaporCrytalRapor frm2 = new frmStokAlisSatisRaporCrytalRapor(_source);
                        //frm2.Show();
                    }
                } catch (Exception exc) {
                    MessageBox.Show(exc.Message);
                    LogWrite.Write(exc);
                }
            }
        }
Esempio n. 8
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            frmRaporDialog frm = new frmRaporDialog(true, true, true, false);

            frm.ShowDialog();
            ReportTo?dest = frm.GetReportDestination();

            if (dest.HasValue)
            {
                try {
                    if (dest != ReportTo.CrytalReport)
                    {
                        var report = new Report(ListToDataTable().ToReportSource());
                        // Customize the Text Fields

                        report.TextFields.Title  = "Banka Hareket Raporu";
                        report.TextFields.Header = string.Format(@"
            Rapor Tarihi  :{0}
            HesapNo       :{1}
            BankaAdı      :{2}
            HesapSahibi   :{3}
            ŞubeAdı       :{4}
            ParaBirimi    :{5}           
            Tarih Aralığı :{6} 
            ", DateTime.Now, txtHesapNo.Text, txtBankaAdi.Text, txtHesapSahip.Text, txtSubeAdi.Text
                                                                 , txtParaBirimi.Text, GetTarihAraligi());
                        report.DataFields["Tarih"].DataFormatString = "{0:d}";
                        report.DataFields["Tutar"].DataFormatString = "{0:F2}";
                        report.DataFields["Tutar"].ShowTotals       = true;
                        string        fileName = "bankaRaporu";
                        IReportWriter writer   = new ExcelReportWriter();
                        if (dest.Value == ReportTo.Excel)
                        {
                            fileName = fileName + ".xls";
                        }
                        else if (dest.Value == ReportTo.Html)
                        {
                            writer   = new HtmlReportWriter();
                            fileName = fileName + ".html";
                        }
                        else if (dest.Value == ReportTo.Csv)
                        {
                            writer   = new DelimitedTextReportWriter();
                            fileName = fileName + ".txt";
                        }
                        string     file = Path.Combine(Engine.DokumanPath(), fileName);
                        FileStream fs   = new FileStream(file, FileMode.Create);

                        writer.WriteReport(report, fs);
                        fs.Close();
                        Process prc = new Process();
                        prc.StartInfo.FileName = file;
                        prc.Start();
                    }
                    else
                    {
                        //frmBankaHarReport frm2 = new frmBankaHarReport(hareketList);
                        //frm2.Show();
                    }
                } catch (Exception exc) {
                    MessageBox.Show(exc.Message);
                    LogWrite.Write(exc);
                }
            }
        }
Esempio n. 9
0
        public static void GenerateExcel(IEnumerable <dynamic> items, List <PropertyInfo> choosedPrperties, string titre, out string statusText)
        {
            statusText = "...";
            bw         = new BackgroundWorker();
            bw.DoWork += Bw_DoWork;
            try
            {
                // Get the data for the report (any IEnumerable will work)



                var query = items.ToList();

                // Create the report and turn our query into a ReportSource
                report = new DoddleReport.Report(query.ToReportSource());

                // Customize the Text Fields report.TextFields.Title = "Products Report";
                report.TextFields.SubTitle = titre;
                report.TextFields.Footer   = "Copyright 2018 © Ovresko.com - [email protected] - [email protected] - +213 665 97 76 79)";

                // Render hints allow you to pass additional hints to the reports as they are being rendered
                report.RenderHints.BooleanCheckboxes = false;
                //report.RenderHints.Orientation = ReportOrientation.Landscape;

                // Customize the data fields report.DataFields["Id"].Hidden = true;
                var sample = items.ElementAt(0);
                if (sample != null)
                {
                    var properties = sample.GetType().GetProperties();
                    foreach (PropertyInfo item in properties)
                    {
                        try
                        {
                            if (item.PropertyType == typeof(decimal) || item.PropertyType == typeof(int))
                            {
                                report.DataFields[item.Name].ShowTotals = true;
                            }
                            report.DataFields[item.Name].Hidden = true;


                            if (choosedPrperties.Contains(item))
                            {
                                report.DataFields[item.Name].Hidden = false;
                            }

                            if (item.PropertyType.FullName.Contains("Guid") || item.PropertyType.FullName.Contains("List"))
                            {
                                report.DataFields[item.Name].Hidden = true;
                            }


                            //var showInTable = item.GetCustomAttribute(typeof(ShowInTableAttribute)) as ShowInTableAttribute;
                            //var display = item.GetCustomAttribute(typeof(DisplayNameAttribute)) as DisplayNameAttribute;
                            //if (display != null && display.DisplayName != "Crée le" && display.DisplayName != "Status" && showInTable?.IsShow == true)
                            //{
                            //    report.DataFields[item.Name].Hidden = false;
                            //}

                            //  report.DataFields[item.Name].Hidden = false;
                        }
                        catch
                        {
                            continue;
                        }
                    }

                    foreach (var row in report.Source.GetItems())
                    {
                        //var objectid = row.GetType().GetProperties().Where(z => z.PropertyType.FullName.Contains("Guid"));
                        //foreach (var oi in objectid)
                        //{
                        //    Guid value = (Guid)oi.GetValue(row);
                        //    if (value != null)
                        //    {
                        //        var link = oi.GetCustomAttribute(typeof(ColumnAttribute)) as ColumnAttribute;
                        //        if (link.FieldType == ModelFieldType.Lien )
                        //        {
                        //           // report.
                        //           // oi.SetValue(row, value?.GetObject(link.Options)?.Name);
                        //        }

                        //    }

                        //}
                    }
                }


                // bw.RunWorkerAsync();
                try
                {
                    using (FileStream fs = new FileStream("export.xls", FileMode.Create))
                    {
                        var writer = new ExcelReportWriter();
                        writer.WriteReport(report, fs);
                    }

                    Process.Start("export.xls");
                }
                catch (Exception s)
                {
                    DataHelpers.ShowMessage(s.Message);
                }
            }
            catch (Exception s)
            {
                DataHelpers.ShowMessage(s.Message);
            }
        }
Esempio n. 10
0
        public static void GenerateExcel(IEnumerable <dynamic> list, string titre, out string StatusText)
        {
            StatusText = "...";
            bw         = new BackgroundWorker();
            bw.DoWork += Bw_DoWork;
            try
            {
                // Get the data for the report (any IEnumerable will work)
                var query = list.ToList();

                // Create the report and turn our query into a ReportSource
                report = new DoddleReport.Report(query.ToReportSource());

                // Customize the Text Fields report.TextFields.Title = "Products Report";
                report.TextFields.SubTitle = titre;
                report.TextFields.Footer   = "Copyright 2018 © www.ovresko.com - Bouziane Khaled (0665 97 76 79)";

                // Render hints allow you to pass additional hints to the reports as they are being rendered
                report.RenderHints.BooleanCheckboxes = false;
                //report.RenderHints.Orientation = ReportOrientation.Landscape;

                // Customize the data fields report.DataFields["Id"].Hidden = true;
                var sample = list.ElementAt(0);
                if (sample != null)
                {
                    var properties = sample.GetType().GetProperties();
                    foreach (PropertyInfo item in properties)
                    {
                        try
                        {
                            //report.DataFields[item.Name].Hidden = true;

                            //var showInTable = item.GetCustomAttribute(typeof(ShowInTableAttribute)) as ShowInTableAttribute;
                            //var display = item.GetCustomAttribute(typeof(DisplayNameAttribute)) as DisplayNameAttribute;
                            //if (display != null && display.DisplayName != "Crée le" && display.DisplayName != "Status" && showInTable?.IsShow == true)
                            //{
                            //    report.DataFields[item.Name].Hidden = false;
                            //}

                            //  report.DataFields[item.Name].Hidden = false;
                        }
                        catch
                        {
                            continue;
                        }
                    }
                }


                // bw.RunWorkerAsync();
                try
                {
                    using (FileStream fs = new FileStream("export.xls", FileMode.Create))
                    {
                        var writer = new ExcelReportWriter();
                        writer.WriteReport(report, fs);
                    }

                    Process.Start("export.xls");
                }
                catch (Exception s)
                {
                    DataHelpers.ShowMessage(s.Message);
                }
            }
            catch (Exception s)
            {
                DataHelpers.ShowMessage(s.Message);
            }
        }
Esempio n. 11
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            frmRaporDialog frm = new frmRaporDialog(true, true, true, false);

            frm.ShowDialog();
            ReportTo?dest = frm.GetReportDestination();

            if (dest.HasValue)
            {
                try {
                    if (dest != ReportTo.CrytalReport)
                    {
                        List <DurumGelirGider> liste = new List <DurumGelirGider>();

                        liste.Add(_gelirler);

                        var report = new Report(liste.ToReportSource());


                        // Customize the Text Fields
                        report.RenderHints.IncludePageNumbers = true;
                        report.TextFields.Title  = "Genel Durum Raporu";
                        report.TextFields.Header = string.Format(@"
            Rapor Tarihi:{0} 
            Toplam Gelir:{1:F}
            Toplam Gider:{2:F}
            Bakiye:{3:F}
            Rapor Tarih Aralığı:{4}
            
            ", DateTime.Now, toplamGelir(), toplamGider(), bakiye(), GetTarihAraligi());
                        //report.DataFields["Alacak"].DataFormatString = "{0:F2}";
                        //report.DataFields["Borc"].DataFormatString = "{0:F2}";
                        //report.DataFields["AlacakBakiyesi"].DataFormatString = "{0:F2}";
                        //report.DataFields["BorcBakiyesi"].DataFormatString = "{0:F2}";
                        string        fileName = "genelDurumRaporu.xls";
                        IReportWriter writer   = new ExcelReportWriter();

                        if (dest.Value == ReportTo.Html)
                        {
                            writer   = new HtmlReportWriter();
                            fileName = "genelDurumRaporu.html";
                        }
                        else if (dest.Value == ReportTo.Csv)
                        {
                            writer   = new DelimitedTextReportWriter();
                            fileName = "genelDurumRaporu.txt";
                        }
                        string     file = Path.Combine(Engine.DokumanPath(), fileName);
                        FileStream fs   = new FileStream(file, FileMode.Create);

                        writer.WriteReport(report, fs);
                        fs.Close();
                        Process prc = new Process();
                        prc.StartInfo.FileName = file;
                        prc.Start();
                    }
                    else
                    {
                        //frmStokHareketDokumuForCrytalReport frm2 = new frmStokHareketDokumuForCrytalReport(_source);
                        //frm2.Show();
                    }
                } catch (Exception exc) {
                    MessageBox.Show(exc.Message);
                    LogWrite.Write(exc);
                }
            }
        }