private void rptQuerKalkulation_DataSourceDemanded(object sender, EventArgs e) { try { this.p_Rpt_QuerCalculationTableAdapter.Connection.ConnectionString = SQLCon.ConnectionString(); this.p_Rpt_QuerCalculationTableAdapter.ClearBeforeFill = true; this.p_Rpt_QuerCalculationTableAdapter.Fill(dsQuerKalculation1.P_Rpt_QuerCalculation, dtValue, _PID, _Type, _LVSection); this.p_Rpt_QuerCalculation_SurchargePositionTableAdapter.Connection.ConnectionString = SQLCon.ConnectionString(); this.p_Rpt_QuerCalculation_SurchargePositionTableAdapter.ClearBeforeFill = true; this.p_Rpt_QuerCalculation_SurchargePositionTableAdapter.Fill(dsSurchargeCalculation1.P_Rpt_QuerCalculation_SurchargePosition, dtValue, _PID, _Type, _LVSection); DataTable dt = new DataTable(); dt = dsSurchargeCalculation1.P_Rpt_QuerCalculation_SurchargePosition; if (dt != null) { decimal _result = 0; if (decimal.TryParse(Convert.ToString(dt.Rows[0][0]), out _result)) { if (_result == 0) { tblSurchargeresult.Text = string.Empty; } else { tblSurchargeresult.Text = _result.ToString("n2"); } } } dsDiscountCalculation ds = new dsDiscountCalculation(); this.p_Rpt_QuerCalculation_DiscountPositionTableAdapter1.Connection.ConnectionString = SQLCon.ConnectionString(); this.p_Rpt_QuerCalculation_DiscountPositionTableAdapter1.ClearBeforeFill = true; this.p_Rpt_QuerCalculation_DiscountPositionTableAdapter1.Fill(ds.P_Rpt_QuerCalculation_DiscountPosition, dtValue, _PID, _Type, _LVSection); DataTable dtdiscount = new DataTable(); dtdiscount = ds.P_Rpt_QuerCalculation_DiscountPosition; if (dtdiscount != null) { decimal _result = 0; if (decimal.TryParse(Convert.ToString(dtdiscount.Rows[0][0]), out _result)) { if (_result > 0) { tbDiscountResult.Text = _result.ToString("n2"); _Discount = Convert.ToDouble(_result); } else { tbDiscountResult.Text = string.Empty; _Discount = 0; } } } } catch (Exception ex) { Utility.ShowError(ex); } }
private void rptProposalCommon_DataSourceDemanded(object sender, EventArgs e) { try { dsDiscountCalculation ds = new dsDiscountCalculation(); this.p_Rpt_QuerCalculation_DiscountPositionTableAdapter.Connection.ConnectionString = SQLCon.ConnectionString(); this.p_Rpt_QuerCalculation_DiscountPositionTableAdapter.ClearBeforeFill = true; this.p_Rpt_QuerCalculation_DiscountPositionTableAdapter.Fill(ds.P_Rpt_QuerCalculation_DiscountPosition, dtValue, _PID, _Type, _LVSection); dsProposalCommon _dsCommon = new dsProposalCommon(); this.p_Rpt_PositionForProposalPriceForCommonTableAdapter.Connection.ConnectionString = SQLCon.ConnectionString(); this.p_Rpt_PositionForProposalPriceForCommonTableAdapter.ClearBeforeFill = true; this.p_Rpt_PositionForProposalPriceForCommonTableAdapter.Fill(_dsCommon.P_Rpt_PositionForProposalPriceForCommon, dtValue, _PID, _Type, _LVSection); dsProposalCommonTotalSummery _dsTotalSum = new dsProposalCommonTotalSummery(); this.p_Rpt_GetTotalSummeryTableAdapter.Connection.ConnectionString = SQLCon.ConnectionString(); this.p_Rpt_GetTotalSummeryTableAdapter.ClearBeforeFill = true; this.p_Rpt_GetTotalSummeryTableAdapter.Fill(_dsTotalSum.P_Rpt_GetTotalSummery, dtValue, _PID, _Type, _LVSection); DataTable dtdiscount = new DataTable(); dtdiscount = ds.P_Rpt_QuerCalculation_DiscountPosition; if (dtdiscount != null) { decimal _result = 0; if (decimal.TryParse(Convert.ToString(dtdiscount.Rows[0][0]), out _result)) { if (_result != 0) //&& !ISWithGB) { tbDiscount.Text = '-' + _result.ToString("n2"); _Discount = Convert.ToDouble(_result); } else { tbDiscount.Text = string.Empty; _Discount = 0; lblDiscount.Visible = false; lblDiscountEuro.Visible = false; } } } } catch (Exception ex) { Utility.ShowError(ex); } }
private void rptFormBlatt_221_1_DataSourceDemanded(object sender, EventArgs e) { try { this.p_Rpt_Get_FormBlatt_221_2TableAdapter.Connection.ConnectionString = SQLCon.ConnectionString(); this.p_Rpt_Get_FormBlatt_221_2TableAdapter.ClearBeforeFill = true; this.p_Rpt_Get_FormBlatt_221_2TableAdapter.Fill(dsFormBlatt_221_21.P_Rpt_Get_FormBlatt_221_2, _PID, dtValue); } catch (Exception ex) { Utility.ShowError(ex); } }
/// <summary> /// Code to generate angebot report with minutes /// </summary> /// <param name="stType"></param> /// <param name="dtPos"></param> /// <param name="LVSection"></param> private void GenerateReportWithMinutes(string stType, DataTable dtPos, string LVSection) { try { dsProposalMinutes ds = new dsProposalMinutes(); P_Rpt_PositionForProposalMinutesTableAdapter adapter = new P_Rpt_PositionForProposalMinutesTableAdapter(); adapter.Connection.ConnectionString = SQLCon.ConnectionString(); adapter.ClearBeforeFill = true; adapter.Fill(ds.P_Rpt_PositionForProposalMinutes, dtPos, _ProjectID, stType, LVSection); if (ds != null) { DataTable dt = ObjBReport.GetProjectCustomerDetails(_ProjectID); rptProposalPositionswithminutes rpt = new rptProposalPositionswithminutes(); 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(); rptProposalSummarywithminutes rptSummary = new rptProposalSummarywithminutes(); 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) { } }
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); //} }