Beispiel #1
0
        /// <summary>
        /// Code to generate angebot report with material and montage prices
        /// </summary>
        /// <param name="stType"></param>
        /// <param name="dtPos"></param>
        /// <param name="LVSection"></param>
        private void GenerateReportWithputMAMO(string stType, DataTable dtPos, string LVSection)
        {
            try
            {
                dsProposal ds = new dsProposal();
                P_Rpt_PositionForProposalPriceTableAdapter adapter = new P_Rpt_PositionForProposalPriceTableAdapter();
                adapter.Connection.ConnectionString = SQLCon.ConnectionString();
                adapter.ClearBeforeFill             = true;
                adapter.Fill(ds.P_Rpt_PositionForProposalPrice, dtPos, _ProjectID, stType, LVSection);
                if (ds != null)
                {
                    DataTable dt = ObjBReport.GetProjectCustomerDetails(_ProjectID);
                    rptProposalPositionsWithoutMAMO rpt = new rptProposalPositionsWithoutMAMO();
                    rpt.DataSource = ds;
                    rpt.Parameters["ReportName"].Value      = txtReportName.Text;
                    rpt.Parameters["ReportDate"].Value      = dtpReportDate.DateTime;
                    rpt.Parameters["CustomerName"].Value    = dt.Rows[0]["CustomerFullName"];
                    rpt.Parameters["CustomerAddress"].Value = dt.Rows[0]["CustomerStreet"];
                    rpt.Parameters["ProjectDesc"].Value     = dt.Rows[0]["ProjectDescription"];
                    rpt.Parameters["ProjectNumber"].Value   = dt.Rows[0]["ProjectNumber"];
                    if (chkWithDetailKZ.Checked)
                    {
                        rpt.Parameters["DetKZ"].Value = true;
                    }
                    else
                    {
                        rpt.Parameters["DetKZ"].Value = false;
                    }

                    if (radioGroupShowText.SelectedIndex == 0)
                    {
                        rpt.Parameters["Langtext"].Value = true;
                    }
                    else if (radioGroupShowText.SelectedIndex == 1)
                    {
                        rpt.Parameters["Kurztext"].Value = true;
                    }
                    else
                    {
                        rpt.Parameters["Langtext"].Value = true;
                        rpt.Parameters["Kurztext"].Value = true;
                    }

                    if (chksender.Checked)
                    {
                        rpt.Parameters["CustomerSender"].Value = false;
                    }
                    else
                    {
                        rpt.Parameters["CustomerSender"].Value = true;
                    }

                    if (chkmenge.Checked)
                    {
                        rpt.Parameters["WithMenge"].Value = false;
                    }
                    else
                    {
                        rpt.Parameters["WithMenge"].Value = true;
                    }

                    if (chkGB.Checked)
                    {
                        rpt.Parameters["WithGP"].Value = false;
                    }
                    else
                    {
                        rpt.Parameters["WithGP"].Value = true;
                    }

                    if (chkEP.Checked)
                    {
                        rpt.Parameters["WithEP"].Value = false;
                    }
                    else
                    {
                        rpt.Parameters["WithEP"].Value = true;
                    }

                    if (chkprices.Checked)
                    {
                        rpt.Parameters["WithPrice"].Value = false;
                    }
                    else
                    {
                        rpt.Parameters["WithPrice"].Value = true;
                    }

                    if (chkTitlesPreises.Checked)
                    {
                        rpt.Parameters["WithPrices"].Value = false;
                    }
                    else
                    {
                        rpt.Parameters["WithPrices"].Value = true;
                    }

                    if (chkOnheMengePositions.Checked)
                    {
                        rpt.Parameters["OnheMenge"].Value = true;
                    }
                    else
                    {
                        rpt.Parameters["OnheMenge"].Value = false;
                    }

                    rpt.CreateDocument();

                    DataView dv = ds.Tables[0].DefaultView;
                    dv.RowFilter = "PositionKZ NOT IN ('H','VR','UB','AB','BA')";
                    DataTable dtsource = dv.ToTable();
                    rptProposalSummaryWithoutMAMO rptSummary = new rptProposalSummaryWithoutMAMO();
                    rptSummary.DataSource = dtsource;
                    rptSummary.Parameters["ReportName"].Value         = txtReportName.Text;
                    rptSummary.Parameters["ReportDate"].Value         = dtpReportDate.DateTime;
                    rptSummary.Parameters["ProjectDesc"].Value        = dt.Rows[0]["ProjectDescription"];
                    rptSummary.Parameters["ProjectNumber"].Value      = dt.Rows[0]["ProjectNumber"];
                    rptSummary.Parameters["Vat"].Value                = dt.Rows[0]["Vat"];
                    rptSummary.Parameters["AngebotDescription"].Value = dt.Rows[0]["AngebotDescription"];
                    if (chkGB.Checked)
                    {
                        rptSummary.Parameters["WithGP"].Value = false;
                    }
                    else
                    {
                        rptSummary.Parameters["WithGP"].Value = true;
                    }

                    if (chkprices.Checked)
                    {
                        rptSummary.Parameters["WithPrice"].Value = false;
                    }
                    else
                    {
                        rptSummary.Parameters["WithPrice"].Value = true;
                    }

                    rptSummary.CreateDocument();
                    rpt.Pages.AddRange(rptSummary.Pages);

                    rpt.PrintingSystem.ContinuousPageNumbering = true;
                    ReportPrintTool printTool = new ReportPrintTool(rpt);
                    printTool.ShowRibbonPreview();
                }
            }
            catch (Exception ex) { }
        }
Beispiel #2
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (ObjBProject == null)
            {
                ObjBProject = new BProject();
            }
            DataTable dt = new DataTable();

            dt = ObjBProject.GetProjectCustomerDetails(147);

            dsProposal ds = new dsProposal();
            P_Rpt_PositionForProposalPriceTableAdapter adapter = new P_Rpt_PositionForProposalPriceTableAdapter();

            adapter.Connection.ConnectionString = SQLCon.ConnectionString();
            adapter.ClearBeforeFill             = true;
            adapter.Fill(ds.P_Rpt_PositionForProposalPrice, "", 147, "", "");
            rptProposalPositions rpt = new rptProposalPositions();

            rpt.DataSource = ds;
            rpt.Parameters["ProjectID"].Value       = 147;
            rpt.Parameters["TitleList"].Value       = string.Empty;
            rpt.Parameters["Type"].Value            = "";
            rpt.Parameters["LVSection"].Value       = "";
            rpt.Parameters["ReportName"].Value      = "NEW ANGEBOT REPORT";
            rpt.Parameters["ReportDate"].Value      = DateTime.Now;
            rpt.Parameters["CustomerName"].Value    = dt.Rows[0]["CustomerFullName"];
            rpt.Parameters["CustomerAddress"].Value = dt.Rows[0]["CustomerStreet"];
            rpt.Parameters["ProjectDesc"].Value     = dt.Rows[0]["ProjectDescription"];
            rpt.Parameters["ProjectNumber"].Value   = dt.Rows[0]["ProjectNumber"];
            rpt.CreateDocument();
            rptProposalSummary rptSummary = new rptProposalSummary();

            rptSummary.DataSource = ds;
            rptSummary.Parameters["ProjectID"].Value          = 147;
            rptSummary.Parameters["TitleList"].Value          = string.Empty;
            rptSummary.Parameters["Type"].Value               = "";
            rptSummary.Parameters["LVSection"].Value          = "";
            rptSummary.Parameters["ReportName"].Value         = "NEW ANGEBOT REPORT";
            rptSummary.Parameters["ReportDate"].Value         = DateTime.Now;
            rpt.Parameters["ProjectDesc"].Value               = dt.Rows[0]["ProjectDescription"];
            rpt.Parameters["ProjectNumber"].Value             = dt.Rows[0]["ProjectNumber"];
            rptSummary.Parameters["Vat"].Value                = dt.Rows[0]["Vat"];
            rptSummary.Parameters["AngebotDescription"].Value = dt.Rows[0]["AngebotDescription"];
            rptSummary.CreateDocument();
            rpt.Pages.AddRange(rptSummary.Pages);

            rpt.PrintingSystem.ContinuousPageNumbering = true;
            ReportPrintTool printTool = new ReportPrintTool(rpt);

            printTool.ShowRibbonPreview();



            //rptSampleBreakdown rptMA = new rptSampleBreakdown();
            //ReportPrintTool printTool = new ReportPrintTool(rptMA);
            //rptMA.Parameters["ProjectID"].Value = 113;
            //printTool.ShowRibbonPreview();

            //try
            //{
            //    string strFilePath = string.Empty;
            //    OpenFileDialog dlg = new OpenFileDialog();

            //    dlg.InitialDirectory = @"C:\";
            //    dlg.Title = "Dateiauswahl für Data File Import";

            //    dlg.CheckFileExists = true;
            //    dlg.CheckPathExists = true;

            //    dlg.Filter = "All files (*.*)|*.*";
            //    dlg.RestoreDirectory = true;

            //    dlg.ReadOnlyChecked = true;
            //    dlg.ShowReadOnly = true;
            //    if (dlg.ShowDialog() == DialogResult.OK)
            //    {
            //        strFilePath = dlg.FileName;
            //        string fileExt = Path.GetExtension(strFilePath);
            //        if (fileExt.CompareTo(".xls") == 0 || fileExt.CompareTo(".xlsx") == 0)
            //        {
            //            DataTable dtExcel = new DataTable();
            //            dtExcel = Utility.ReadExcel(strFilePath, fileExt); //read excel file

            //            foreach(DataRow dr in dtExcel.Rows)
            //            {
            //                string str = Convert.ToString(dr["F2"]);
            //                if(str.Substring(0,1) == "\n")
            //                    str = str.Substring(1);
            //                if (str.Contains("\r"))
            //                    str = str.Replace("\r", "");
            //                dr["F2"] = str;
            //            }
            //            DataTable dt = dtExcel.Copy();
            //            BOTTO ObjBOTTO = new BOTTO();
            //            ObjBOTTO.ImportCustomerData(dt);
            //        }
            //    }
            //}
            //catch (Exception ex)
            //{
            //    Utility.ShowError(ex);
            //}
        }