コード例 #1
0
ファイル: SuitForm.cs プロジェクト: Levanrw/CreateSuitPdf
        private void SuitForm_Load(object sender, EventArgs e)
        {
            try {
                ReportViewer _reportViewer1 = new ReportViewer();
                _reportViewer1.ProcessingMode = ProcessingMode.Local;
                string deviceInfo =
                    "<DeviceInfo>" +
                    "  <OutputFormat>EMF</OutputFormat>" +
                    "  <PageWidth>8.27in</PageWidth>" +
                    "  <PageHeight>11.69in</PageHeight>" +
                    "  <MarginTop>0in</MarginTop>" +
                    "  <MarginLeft>0in</MarginLeft>" +
                    "  <MarginRight>0in</MarginRight>" +
                    "  <MarginBottom>0in</MarginBottom>" +
                    "</DeviceInfo>";
                Warning[] warnings;
                string[]  streamids;
                string    mimeType;
                string    encoding;
                string    extension;

                byte[] bytesa;
                try
                {
                    _reportViewer1.LocalReport.ReportPath = @"C:\Users\admin\Desktop\LevanProjects\CreatePdf\Sarcheli\Sarcheli.rdlc";
                    // C:\Users\admin\Desktop\LevanProjects\CreatePdf\Sarcheli

                    _reportViewer1.LocalReport.Refresh();
                    bytesa = _reportViewer1.LocalReport.Render("PDF", deviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings);
                }

                catch (Exception ex)
                {
                    throw new Exception(ex.InnerException.ToString());
                }

                // using (FileStream fs = new FileStream(@"C:\Users\PAB\Desktop\Levan\sarcheli\PDF\" + Suits[i].ToString() + "_" + DateTime.Now.ToString("dd.MM.yyyy") + ".PDF", FileMode.Create))
                //using (FileStream fs = new FileStream(@"C:\Users\admin\Desktop\hotels\" + Suits[i].ToString() + "_" + DateTime.Now.ToString("dd.MM.yyyy") + ".PDF", FileMode.Create))

                {
                    //fs.Write(bytesa, 0, bytesa.Length);
                    //fs.Close();
                    //fs.Dispose();
                    bytesa = null;
                    _reportViewer1.Refresh();
                    _reportViewer1.Clear();
                }
            }


            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #2
0
        public PenjualanForm(ReportViewer report)
        {
            InitializeComponent();

            this.DataContext = new PenjualanViewModel();
            reportViewer     = report;
            report.Clear();
            reportViewer.LocalReport.ReportEmbeddedResource = "MainApp.Reports.Layouts.Penjualan.rdlc";
            reportViewer.SetDisplayMode(DisplayMode.PrintLayout);
            reportViewer.ZoomMode = ZoomMode.PageWidth;
        }
コード例 #3
0
 private void btnClear_Click(object sender, RoutedEventArgs e)
 {
     cmbBank.Text                 = "";
     cmbBranch.Text               = "";
     cmbNubeBranch.Text           = "";
     dtpDOB.Text                  = "";
     lblState.Visibility          = Visibility.Collapsed;
     chkMelaka.Visibility         = Visibility.Collapsed;
     chkNegeriSembilan.Visibility = Visibility.Collapsed;
     ReportViewer.Clear();
 }
コード例 #4
0
 public BorderelCargo(ReportViewer report)
 {
     InitializeComponent();
     vm           = new BorderelViewModel();
     reportViewer = report;
     reportViewer.Clear();
     reportViewer.RefreshReport();
     this.DataContext = vm;
     reportViewer.LocalReport.ReportEmbeddedResource = "MainApp.Reports.Layouts.BorderelCargoLayout.rdlc";
     reportViewer.SetDisplayMode(DisplayMode.PrintLayout);
     reportViewer.ZoomMode = ZoomMode.PageWidth;
 }
コード例 #5
0
 private void btnClear_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         cmbNubeBranch.Text = "";
         cmbBank.Text       = "";
         cmbBranch.Text     = "";
         txtMemberNo.Text   = "";
         ReportViewer.Clear();
     }
     catch (Exception ex)
     {
         ExceptionLogging.SendErrorToText(ex);
     }
 }
コード例 #6
0
        private void button3_Click(object sender, RoutedEventArgs e)
        {
            host.Visibility = Visibility.Visible;
            ReportViewer.Reset();
            Connection con = new Connection();

            con.open_connection();
            OdbcCommand     cmd1 = new OdbcCommand("select  user_name,designation,last_login from log_table", con.conn);
            OdbcDataAdapter da   = new OdbcDataAdapter(cmd1);
            DataTable       dt   = new DataTable();

            da.Fill(dt);
            ReportViewer.Clear();
            ReportDataSource ds = new ReportDataSource("DataSet1", dt);

            ReportViewer.LocalReport.DataSources.Add(ds);
            ReportViewer.LocalReport.ReportEmbeddedResource = "Project_Transport.Report1.rdlc";
            ReportViewer.RefreshReport();
        }
コード例 #7
0
ファイル: ReportHelper.cs プロジェクト: Camel-RD/Klons
        public static byte[] RenderToPdf(ReportViewerData rd)
        {
            var rv = new ReportViewer();

            foreach (var source in rd.Sources)
            {
                rv.LocalReport.DataSources.Add(new ReportDataSource(source.Key, source.Value));
            }
            //reportViewer1.LocalReport.ReportEmbeddedResource = "KlonsF.Reports.Report1.rdlc";
            rv.LocalReport.ReportPath = MyData.GetBasePath() + "\\Reports\\" + rd.FileName + ".rdlc";
            if (rd.ReportParameters != null)
            {
                rv.LocalReport.SetParameters(rd.ReportParameters);
            }

            rv.LocalReport.SubreportProcessing += (sender, e) =>
            {
                rd.SubreportProcessing(e);
            };
            var ret = rv.LocalReport.Render(format: "PDF", deviceInfo: "");

            rv.Clear();
            return(ret);
        }
コード例 #8
0
        private void Form2_Load(object sender, EventArgs e)
        {
            try
            {
                List <int> Suits = new List <int>();

                ReportViewer rv1 = new ReportViewer();


                LegalCounselTableAdapters.GetSuitInfoTableAdapter GetSuitInfoAll = new LegalCounselTableAdapters.GetSuitInfoTableAdapter();
                var SuitIds = GetSuitInfoAll.GetData(null);

                foreach (var item in SuitIds)
                {
                    Suits.Add(item.ID);
                }

                for (int i = 0; i < Suits.Count; i++)
                {
                    ReportDataSource GetSuitInfo1 = new ReportDataSource();
                    LegalCounselTableAdapters.GetSuitInfoTableAdapter GetSuitInfo = new LegalCounselTableAdapters.GetSuitInfoTableAdapter();
                    GetSuitInfo1.Name  = "GetSuitInfo";
                    GetSuitInfo1.Value = GetSuitInfo.GetData(Suits[i]);

                    int StageCount = Convert.ToInt32(GetSuitInfo.GetData(Suits[i])[0].StageCount);

                    ReportDataSource GetSuitAgents1 = new ReportDataSource();
                    LegalCounselTableAdapters.GetSuitAgentsTableAdapter GetSuitAgents = new LegalCounselTableAdapters.GetSuitAgentsTableAdapter();
                    GetSuitAgents1.Name  = "GetSuitAgents";
                    GetSuitAgents1.Value = GetSuitAgents.GetData(Suits[i]);

                    List <GetSuitCircumstances> GetSuitCircumstancesList = new List <Sarcheli.GetSuitCircumstances>();

                    LegalCounselTableAdapters.GetSuitCircumstancesTableAdapter GetSuitCircumstances = new LegalCounselTableAdapters.GetSuitCircumstancesTableAdapter();
                    ReportDataSource GetSuitCircumstances1 = new ReportDataSource();
                    GetSuitCircumstances1.Name = "GetSuitCircumstances";
                    DataTable Data = new DataTable();
                    Data.Columns.Add("suitid");
                    Data.Columns.Add("stageid");
                    Data.Columns.Add("Circumstance");
                    Data.Columns.Add("activeid");
                    Data.Columns.Add("priority");
                    Data.Columns.Add("TextPriority");
                    for (int j = 1; j <= StageCount; j++)
                    {
                        var cumstances = GetSuitCircumstances.GetData(Suits[i], j);
                        foreach (var item in cumstances)
                        {
                            Data.Rows.Add(item.ItemArray);
                        }
                    }
                    GetSuitCircumstances1.Value = Data;
                    ReportDataSource GetSuitDebtors1 = new ReportDataSource();
                    LegalCounselTableAdapters.GetSuitDebtorsTableAdapter GetSuitDebtors = new LegalCounselTableAdapters.GetSuitDebtorsTableAdapter();
                    GetSuitDebtors1.Name  = "GetSuitDebtors";
                    GetSuitDebtors1.Value = GetSuitDebtors.GetData(Suits[i]);

                    ReportDataSource GetSuitOverview1 = new ReportDataSource();
                    LegalCounselTableAdapters.GetSuitOverviewTableAdapter GetSuitOverview = new LegalCounselTableAdapters.GetSuitOverviewTableAdapter();
                    GetSuitOverview1.Name  = "GetSuitOverview";
                    GetSuitOverview1.Value = GetSuitOverview.GetData(Suits[i]);

                    ReportDataSource GetSuitRequests1 = new ReportDataSource();
                    LegalCounselTableAdapters.GetSuitRequestsTableAdapter GetSuitRequests = new LegalCounselTableAdapters.GetSuitRequestsTableAdapter();
                    GetSuitRequests1.Name = "GetSuitRequests";
                    DataTable Requests = new DataTable();
                    Requests.Columns.Add("article");
                    Requests.Columns.Add("activeid");
                    Requests.Columns.Add("priority");
                    Requests.Columns.Add("TextPriority");
                    for (int j = 1; j <= 3; j++)
                    {
                        var SuitRequest = GetSuitRequests.GetData(Suits[i], j);
                        foreach (var item in SuitRequest)
                        {
                            Requests.Rows.Add(item.ItemArray);
                        }
                    }

                    GetSuitRequests1.Value = Requests;
                    int StageCountPetitions = Convert.ToInt32(GetSuitInfo.GetData(Suits[i])[0].StageCountPetitions);

                    ReportDataSource GetSuitPetitions1 = new ReportDataSource();
                    LegalCounselTableAdapters.GetSuitPetitionsTableAdapter GetSuitPetitions = new LegalCounselTableAdapters.GetSuitPetitionsTableAdapter();
                    GetSuitPetitions1.Name = "GetSuitPetitions";
                    DataTable Petitions = new DataTable();
                    Petitions.Columns.Add("article");
                    Petitions.Columns.Add("activeid");
                    Petitions.Columns.Add("priority");
                    Petitions.Columns.Add("TextPriority");
                    for (int j = 1; j <= StageCountPetitions; j++)
                    {
                        var Petition = GetSuitPetitions.GetData(Suits[i], j);
                        foreach (var item in Petition)
                        {
                            Petitions.Rows.Add(item.ItemArray);
                        }
                    }

                    GetSuitPetitions1.Value = Petitions;

                    ReportDataSource GetSuitActivesInfo1 = new ReportDataSource();
                    LegalCounselTableAdapters.GetSuitActivesInfoTableAdapter GetSuitActivesInfo = new LegalCounselTableAdapters.GetSuitActivesInfoTableAdapter();
                    GetSuitActivesInfo1.Name  = "GetSuitActivesInfo";
                    GetSuitActivesInfo1.Value = GetSuitActivesInfo.GetData(Suits[i]);


                    ReportDataSource GetSuitAttachments1 = new ReportDataSource();
                    LegalCounselTableAdapters.GetSuitAttachmentsTableAdapter GetSuitAttachments = new LegalCounselTableAdapters.GetSuitAttachmentsTableAdapter();
                    GetSuitAttachments1.Name  = "GetSuitAttachments";
                    GetSuitAttachments1.Value = GetSuitAttachments.GetData(Suits[i]);

                    ReportViewer _reportViewer1 = new ReportViewer();
                    _reportViewer1.ProcessingMode = ProcessingMode.Local;

                    _reportViewer1.LocalReport.ReportPath = @"C:\Users\PAB\Desktop\Levan\pdfgenerator (2)\pdfgenerator (2)\pdfgenerator\New folder\CreatePdf\Sarcheli\Sarcheli2.rdlc";

                    // _reportViewer1.LocalReport.ReportPath = @"C:\Users\admin\Desktop\pdfgenerator (2)\pdfgenerator (2)\pdfgenerator\New folder\CreatePdf\Sarcheli\Sarcheli2.rdlc";

                    _reportViewer1.RefreshReport();
                    _reportViewer1.Clear();

                    // var rv1 = new LocalReport();
                    _reportViewer1.LocalReport.DataSources.Add(GetSuitInfo1);
                    _reportViewer1.LocalReport.DataSources.Add(GetSuitAgents1);
                    _reportViewer1.LocalReport.DataSources.Add(GetSuitCircumstances1);
                    _reportViewer1.LocalReport.DataSources.Add(GetSuitDebtors1);
                    _reportViewer1.LocalReport.DataSources.Add(GetSuitOverview1);
                    _reportViewer1.LocalReport.DataSources.Add(GetSuitRequests1);
                    _reportViewer1.LocalReport.DataSources.Add(GetSuitPetitions1);
                    _reportViewer1.LocalReport.DataSources.Add(GetSuitActivesInfo1);
                    _reportViewer1.LocalReport.DataSources.Add(GetSuitAttachments1);
                    GetSuitInfo1          = null;
                    GetSuitAgents1        = null;
                    GetSuitCircumstances1 = null;
                    GetSuitDebtors1       = null;
                    GetSuitOverview1      = null;
                    GetSuitRequests1      = null;
                    GetSuitPetitions1     = null;
                    GetSuitActivesInfo1   = null;
                    GetSuitAttachments1   = null;
                    // _reportViewer1.LocalReport.ReportPath = string.Format(@"C:\Users\admin\Downloads\pdfgenerator (2)\pdfgenerator\New folder\CreatePdf\Sarcheli\Sarcheli.rdlc");

                    string deviceInfo =
                        "<DeviceInfo>" +
                        "  <OutputFormat>EMF</OutputFormat>" +
                        "  <PageWidth>8.27in</PageWidth>" +
                        "  <PageHeight>11.69in</PageHeight>" +
                        "  <MarginTop>0in</MarginTop>" +
                        "  <MarginLeft>0in</MarginLeft>" +
                        "  <MarginRight>0in</MarginRight>" +
                        "  <MarginBottom>0in</MarginBottom>" +
                        "</DeviceInfo>";
                    Warning[] warnings;
                    string[]  streamids;
                    string    mimeType;
                    string    encoding;
                    string    extension;

                    byte[] bytesa;
                    try
                    {
                        _reportViewer1.LocalReport.Refresh();
                        bytesa = _reportViewer1.LocalReport.Render("PDF", deviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings);
                    }

                    catch (Exception ex)
                    {
                        throw new Exception(ex.InnerException.ToString());
                    }

                    using (FileStream fs = new FileStream(@"C:\Users\PAB\Desktop\Levan\sarcheli\PDF\" + Suits[i].ToString() + "_" + DateTime.Now.ToString("dd.MM.yyyy") + ".PDF", FileMode.Create))
                    //using (FileStream fs = new FileStream(@"C:\Users\admin\Desktop\hotels\" + Suits[i].ToString() + "_" + DateTime.Now.ToString("dd.MM.yyyy") + ".PDF", FileMode.Create))
                    {
                        fs.Write(bytesa, 0, bytesa.Length);
                        fs.Close();
                        fs.Dispose();
                        bytesa = null;
                        _reportViewer1.Refresh();
                        _reportViewer1.Clear();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #9
0
        private void SuitForm_Load(object sender, EventArgs e)
        {
            try
            {
                DataSet1 ds = new DataSet1();

                List <int> Suits = new List <int>();



                DataSet1TableAdapters.getSimplifiedProccesDataTableAdapter GetSuitInfoAll = new DataSet1TableAdapters.getSimplifiedProccesDataTableAdapter();
                var SuitIds = GetSuitInfoAll.GetData(null);

                foreach (var item in SuitIds)
                {
                    Suits.Add(item.ID);
                }
                for (int i = 0; i < Suits.Count; i++)
                {
                    ReportDataSource GetSuitInfo1 = new ReportDataSource();
                    DataSet1TableAdapters.getSimplifiedProccesDataTableAdapter GetSuitInfo = new DataSet1TableAdapters.getSimplifiedProccesDataTableAdapter();
                    GetSuitInfo1.Name  = "getSimplifiedProccesData";
                    GetSuitInfo1.Value = GetSuitInfo.GetData(Suits[i]);


                    ReportViewer _reportViewer1 = new ReportViewer(); //
                    _reportViewer1.ProcessingMode = ProcessingMode.Local;
                    // var DesktopPath =  Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                    string DesktopPath = @"C:\Users\Administrator\Desktop\CreatePDF\PDF";
                    string _Path       = Directory.GetCurrentDirectory();

                    // _Path = _Path.Replace(@"bin\Debug", "Suit.rdlc");
                    //chemi
                    // _reportViewer1.LocalReport.ReportPath =  @"C:\Users\admin\Desktop\LevanProjects\CreatePdf\Suit\Suit.rdlc";
                    //gio   C:\Users\PAB\Desktop\suit
                    _reportViewer1.LocalReport.ReportPath = @"C:\Users\Administrator\Desktop\CreatePDF\RDLC\Suit.rdlc";

                    _reportViewer1.RefreshReport();
                    _reportViewer1.Clear();

                    _reportViewer1.LocalReport.DataSources.Add(GetSuitInfo1);
                    GetSuitInfo1 = null;

                    string deviceInfo =
                        "<DeviceInfo> " +
                        "  <OutputFormat>EMF</OutputFormat>" +
                        "  <PageWidth>8.27in</PageWidth>" +
                        "  <PageHeight>11.69in</PageHeight>" +
                        "  <MarginTop>0in</MarginTop>" +
                        "  <MarginLeft>0in</MarginLeft>" +
                        "  <MarginRight>0in</MarginRight>" +
                        "  <MarginBottom>0in</MarginBottom>" +
                        "</DeviceInfo>";
                    Warning[] warnings;
                    string[]  streamids;
                    string    mimeType;
                    string    encoding;
                    string    extension;

                    byte[] bytesa;
                    try
                    {
                        // C:\Users\admin\Desktop\LevanProjects\CreatePdf\Sarcheli

                        _reportViewer1.LocalReport.Refresh();
                        bytesa = _reportViewer1.LocalReport.Render("PDF", deviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings);
                    }

                    catch (Exception ex)
                    {
                        throw new Exception(ex.InnerException.ToString());
                    }

                    using (FileStream fs = new FileStream(DesktopPath + @"\" + Suits[i] + ".PDF", FileMode.Create))
                    //using (FileStream fs = new FileStream(@"C:\Users\admin\Desktop\hotels\" + Suits[i].ToString() + "_" + DateTime.Now.ToString("dd.MM.yyyy") + ".PDF", FileMode.Create))
                    {
                        fs.Write(bytesa, 0, bytesa.Length);
                        fs.Close();
                        fs.Dispose();
                        bytesa = null;
                        _reportViewer1.Refresh();
                        _reportViewer1.Clear();
                    }
                }

                DataSet1TableAdapters.getSimplifiedProccesDoucmentationTableAdapter ProccesDocumentation = new DataSet1TableAdapters.getSimplifiedProccesDoucmentationTableAdapter();

                ProccesDocumentation.GetData();
                ConcatenatePDF();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #10
0
 private void Load_Tyre_Back_Click(object sender, RoutedEventArgs e)
 {
     ReportViewer.Clear();
     host.Visibility = Visibility.Hidden;
     back.Visibility = Visibility.Hidden;
 }
コード例 #11
0
        void print_data()
        {
            ReportParameter[] param = new ReportParameter[63];
            try
            {
                List <string> date = new List <string>();
                Connection    con  = new Connection();
                con.connection_string();
                OdbcCommand    cmd1 = new OdbcCommand("select fl_date,fr_date,fbl_date,fbr_date,cl_date,cr_date,bfol_date,bfil_date,bfor_date,bfir_date,bbol_date,bbil_date,bbor_date,bbir_date,add_date from load_tyre where vechile_no='" + tyre_vehicle_number.Text + "'", con.str);
                OdbcDataReader dr1  = cmd1.ExecuteReader();
                while (dr1.Read())
                {
                    for (int j = 0; j < 15; j++)
                    {
                        date.Add(dr1[j].ToString());
                    }
                }
                con.close_string();

                con.connection_string();
                OdbcCommand    cmd = new OdbcCommand("select fl_id,fr_id,fbl_id,fbr_id,cl_id,cr_id,bfol_id,bfil_id,bfir_id,bfor_id,bbol_id,bbil_id,bbir_id,bbor_id,add_id from load_tyre where vechile_no='" + tyre_vehicle_number.Text + "'", con.str);
                OdbcDataReader dr  = cmd.ExecuteReader();
                while (dr.Read())
                {
                    int p = 0, q = 1, r = 2, s = 3;
                    for (int i = 0; i < 15; i++)
                    {
                        int    A = p + 1, B = q + 1, C = r + 1, D = s + 1;
                        string id = dr[i].ToString();
                        if (!string.IsNullOrWhiteSpace(id))
                        {
                            OdbcCommand    cmd2 = new OdbcCommand("select no,starting_km,company from load_tyre_details where id=" + id + "", con.str);
                            OdbcDataReader dr2  = cmd2.ExecuteReader();
                            while (dr2.Read())
                            {
                                if (!string.IsNullOrWhiteSpace(dr2[0].ToString()))
                                {
                                    param[p] = new ReportParameter("param" + A + "", dr2[0].ToString());
                                    param[q] = new ReportParameter("param" + B + "", dr2[1].ToString());
                                    param[r] = new ReportParameter("param" + C + "", dr2[2].ToString());
                                    param[s] = new ReportParameter("param" + D + "", Convert.ToDateTime(date[i]).ToString("dd/MM/yyyy"));
                                }
                                else
                                {
                                    param[p] = new ReportParameter("param" + A + "", " ");
                                    param[q] = new ReportParameter("param" + B + "", " ");
                                    param[r] = new ReportParameter("param" + C + "", " ");
                                    param[s] = new ReportParameter("param" + D + "", " ");
                                }
                            }
                        }
                        else
                        {
                            param[p] = new ReportParameter("param" + A + "", " ");
                            param[q] = new ReportParameter("param" + B + "", " ");
                            param[r] = new ReportParameter("param" + C + "", " ");
                            param[s] = new ReportParameter("param" + D + "", " ");
                        }
                        p += 4; q += 4; r += 4; s += 4;
                    }
                }
                ReportViewer.Clear();
                ReportViewer.LocalReport.ReportEmbeddedResource = "Project_Transport.load_tyre.rdlc";
                param[60] = new ReportParameter("param61", Properties.Settings.Default.Title.ToString());
                param[61] = new ReportParameter("param62", (tyre_vehicle_number.Text).ToString());
                param[62] = new ReportParameter("param63", Convert.ToDateTime(DateTime.Now).ToString("dd/MM/yyyy"));
                ReportViewer.LocalReport.SetParameters(param);
                ReportViewer.RefreshReport();
            }
            catch (OdbcException ex)
            {
                MessageBox.Show("Error :" + ex);
            }
        }
コード例 #12
0
 private void button2_Click(object sender, RoutedEventArgs e)
 {
     host.Visibility = Visibility.Hidden;
     ReportViewer.Clear();
 }