private void btnSearch_Click(object sender, EventArgs e) { string BcDate; string DueDate; BcDate = Convert.ToString(dtpfromdate.Text); DueDate = Convert.ToString(dtpTodate.Text); ReportDocument reportDocument = new ReportDocument(); ParameterField paramField = new ParameterField(); ParameterFields paramFields = new ParameterFields(); ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue(); string ReportPath = ConfigurationManager.AppSettings["ReportPath"]; paramField.Name = "@BcDate"; paramField.Name = "@DueDate"; paramDiscreteValue.Value = 1; reportDocument.Load(ReportPath + "Reports\\DateWiseTransactionReport.rpt"); ConnectionInfo connectionInfo = new ConnectionInfo(); connectionInfo.DatabaseName = "DB_LoanApplication"; //connectionInfo.UserID = "wms"; //connectionInfo.Password = "******"; connectionInfo.IntegratedSecurity = true; SetDBLogonForReport(connectionInfo, reportDocument); reportDocument.SetParameterValue("@BcDate", BcDate); reportDocument.SetParameterValue("@DueDate", DueDate); DatewisecrystalReport.ReportSource = reportDocument; DatewisecrystalReport.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None; }
private void btnSearch_Click_1(object sender, EventArgs e) { try { string DoctorName; int MedicalShopID; int ProductID; string StartDate; string EndDate; DoctorName = Convert.ToString(cbDoctor.Text); MedicalShopID = Convert.ToInt32(cbMedicalShop.SelectedValue.ToString()); ProductID = Convert.ToInt32(cbProduct.SelectedValue.ToString()); StartDate = Convert.ToString(dtpStartDate.Text); EndDate = Convert.ToString(dtpEndDate.Text); ReportDocument reportDocument = new ReportDocument(); ParameterField paramField = new ParameterField(); ParameterFields paramFields = new ParameterFields(); ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue(); string ReportPath = ConfigurationManager.AppSettings["ReportPath"]; paramField.Name = "@DoctorName"; paramField.Name = "@MedicalShopID"; paramField.Name = "@ProductID"; paramField.Name = "@StartDate"; paramField.Name = "@EndDate"; paramDiscreteValue.Value = 1; reportDocument.Load(ReportPath+"Report\\Commission_CrystalReport.rpt"); ConnectionInfo connectionInfo = new ConnectionInfo(); connectionInfo.DatabaseName = "DB_MedicalShop_02Sept20159PM"; //connectionInfo.UserID = "wms"; //connectionInfo.Password = "******"; connectionInfo.IntegratedSecurity = true; SetDBLogonForReport(connectionInfo, reportDocument); reportDocument.SetParameterValue("@DoctorName", DoctorName); reportDocument.SetParameterValue("@MedicalShopID", MedicalShopID); reportDocument.SetParameterValue("@ProductID", ProductID); reportDocument.SetParameterValue("@StartDate", StartDate); reportDocument.SetParameterValue("@EndDate", EndDate); CommissionCrystalRpt.ReportSource = reportDocument; CommissionCrystalRpt.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
private void FormSupplierPayment_Print_Load(object sender, EventArgs e) { try { // int TransactionID; //SaleTransactionID = Convert.ToInt32(cbSupplier.SelectedValue.ToString()); ReportDocument reportDocument = new ReportDocument(); ParameterField paramField = new ParameterField(); ParameterFields paramFields = new ParameterFields(); ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue(); string ReportPath = ConfigurationManager.AppSettings["ReportPath"]; paramField.Name = "@SupplierPaymentID"; paramDiscreteValue.Value = @SupplierPaymentID; reportDocument.Load(ReportPath+"SupplierPay_Print_CrystalReport.rpt"); ConnectionInfo connectionInfo = new ConnectionInfo(); connectionInfo.DatabaseName = "DB_MedicalShop_02Sept20159PM"; //connectionInfo.UserID = "wms"; //connectionInfo.Password = "******"; connectionInfo.IntegratedSecurity = true; SetDBLogonForReport(connectionInfo, reportDocument); reportDocument.SetParameterValue("@SupplierPaymentID", SupplierPaymentID); SupplierPyCrystalPrint.ReportSource = reportDocument; SupplierPyCrystalPrint.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
private void InitializeReport() { ReportDocument REPORT_DOC = new ReportDocument(); REPORT_DOC = new RptSummaryMonthlySOIPilferageByLocation(); DataBaseLogIn(REPORT_DOC); ParameterField prmDateFrom = new ParameterField(); ParameterField prmDateTo = new ParameterField(); ParameterFields prmList = new ParameterFields(); prmDateFrom.ParameterFieldName = "@DateFrom"; prmDateTo.ParameterFieldName = "@DateTo"; ParameterDiscreteValue prmDateFromValue = new ParameterDiscreteValue(); ParameterDiscreteValue prmDateToValue = new ParameterDiscreteValue(); prmDateFromValue.Value = Request.QueryString["DateFrom"]; prmDateToValue.Value = Request.QueryString["DateTo"]; prmDateFrom.CurrentValues.Add(prmDateFromValue); prmDateTo.CurrentValues.Add(prmDateToValue); prmList.Add(prmDateFrom); prmList.Add(prmDateTo); this.SummaryOfMonthlyPilferageByLocation.ParameterFieldInfo = prmList; SummaryOfMonthlyPilferageByLocation.ReportSource = REPORT_DOC; }
private void RptCetakKwitansi_Load(object sender, EventArgs e) { string strPath = Application.StartupPath + @"\Form\Report\Kwitansi\RptKwitansi.rpt"; // Object for load report. ReportDocument rpt = new ReportDocument(); rpt.Load(strPath); //Set Parameter ParameterFields pfields = new ParameterFields(); ParameterField pfield = new ParameterField(); ParameterDiscreteValue disValue = new ParameterDiscreteValue(); pfield.Name = "spell"; disValue.Value = spell; pfield.CurrentValues.Add(disValue); pfields.Add(pfield); pfield = new ParameterField(); pfield.Name = "price"; disValue = new ParameterDiscreteValue(); disValue.Value = harga; pfield.CurrentValues.Add(disValue); pfields.Add(pfield); pfield = new ParameterField(); pfield.Name = "keterangan"; disValue = new ParameterDiscreteValue(); disValue.Value = ket; pfield.CurrentValues.Add(disValue); pfields.Add(pfield); crystalReportViewer1.ParameterFieldInfo = pfields; crystalReportViewer1.ReportSource = rpt; crystalReportViewer1.Refresh(); }
public PrintSI(string Supplier, string city, string kapal, string date) { InitializeComponent(); reportDocument = new ReportDocument(); paramFields = new ParameterFields(); paramField = new ParameterField(); paramField.Name = "supplier"; paramDiscreteValue = new ParameterDiscreteValue(); paramDiscreteValue.Value = Supplier; paramField.CurrentValues.Add(paramDiscreteValue); paramFields.Add(paramField); paramField = new ParameterField(); paramField.Name = "kapal"; paramDiscreteValue = new ParameterDiscreteValue(); paramDiscreteValue.Value = kapal; paramField.CurrentValues.Add(paramDiscreteValue); paramFields.Add(paramField); paramField = new ParameterField(); paramField.Name = "tujuan"; paramDiscreteValue = new ParameterDiscreteValue(); paramDiscreteValue.Value = city; paramField.CurrentValues.Add(paramDiscreteValue); paramFields.Add(paramField); paramField = new ParameterField(); paramField.Name = "ATD"; paramDiscreteValue = new ParameterDiscreteValue(); paramDiscreteValue.Value = date; paramField.CurrentValues.Add(paramDiscreteValue); paramFields.Add(paramField); crystalReportViewer1.ParameterFieldInfo = paramFields; }
public void setParameters(ReportDocument Rpt) { ParameterFields paramFields = new ParameterFields(); if (HttpContext.Current.Request.QueryString["MailingId"] != null && HttpContext.Current.Request.QueryString["MailingId"] != string.Empty) { ParameterField MailingId = new ParameterField(); MailingId.ParameterFieldName = "@CampaignId"; ParameterDiscreteValue dcMailingId = new ParameterDiscreteValue(); dcMailingId.Value = Convert.ToInt32(Request.QueryString["MailingId"].ToString()); MailingId.CurrentValues.Add(dcMailingId); paramFields.Add(MailingId); } else { ParameterField CampId = new ParameterField(); CampId.ParameterFieldName = "@AssignedCampaignID"; ParameterDiscreteValue dcCampId = new ParameterDiscreteValue(); dcCampId.Value = Convert.ToInt32(Request.QueryString["CampId"].ToString()); CampId.CurrentValues.Add(dcCampId); paramFields.Add(CampId); } CrystalReportViewer1.ParameterFieldInfo = paramFields; CrystalReportViewer1.ReportSource = Rpt; CrystalReportViewer1.DataBind(); }
private void InitializeReport() { ReportDocument REPORT_DOC = new ReportDocument(); REPORT_DOC = new RptSummaryMonthlyPilferageDeptStores(); DataBaseLogIn(REPORT_DOC); ParameterField prmBrand = new ParameterField(); ParameterField prmDateFrom = new ParameterField(); ParameterField prmDateTo = new ParameterField(); ParameterFields prmList = new ParameterFields(); prmBrand.ParameterFieldName = "@BRAND_NAME"; prmDateFrom.ParameterFieldName = "@DATE_FROM"; prmDateTo.ParameterFieldName = "@DATE_TO"; ParameterDiscreteValue prmBrandValue = new ParameterDiscreteValue(); ParameterDiscreteValue prmDateFromValue = new ParameterDiscreteValue(); ParameterDiscreteValue prmDateToValue = new ParameterDiscreteValue(); prmBrandValue.Value = Request.QueryString["Brand"]; prmDateFromValue.Value = Request.QueryString["DateFrom"]; prmDateToValue.Value = Request.QueryString["DateTo"]; prmBrand.CurrentValues.Add(prmBrandValue); prmDateFrom.CurrentValues.Add(prmDateFromValue); prmDateTo.CurrentValues.Add(prmDateToValue); prmList.Add(prmBrand); prmList.Add(prmDateFrom); prmList.Add(prmDateTo); this.SummaryOfMonthlyPilferagePerDepartmentStores.ParameterFieldInfo = prmList; SummaryOfMonthlyPilferagePerDepartmentStores.ReportSource = REPORT_DOC; }
private void Reporte_de_Gastos_de_Inversión_Load(object sender, EventArgs e) { //Diseño de la ventana this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(237)))), ((int)(((byte)(228)))), ((int)(((byte)(196))))); this.Icon = global::Sistema_Shajobe.Properties.Resources.Caja_ICO; //REPORTE CRISTAL REPORT //PRIMER PARAMETRO ReportDocument reporte = new ReportDocument(); ParameterField parametro = new ParameterField(); ParameterFields parametros = new ParameterFields(); ParameterDiscreteValue discretos = new ParameterDiscreteValue(); parametro.Name = "@Apartir"; discretos.Value = Convert.ToDateTime(_Apartir); parametro.CurrentValues.Add(discretos); parametros.Add(parametro); //SEGUNDO PARAMETRO ParameterField parametro1 = new ParameterField(); ParameterDiscreteValue discretos1 = new ParameterDiscreteValue(); parametro1.Name = "@Hasta"; discretos1.Value = Convert.ToDateTime(_Hasta); parametro1.CurrentValues.Add(discretos1); parametros.Add(parametro1); crystalReportViewer1.ParameterFieldInfo = parametros; crystalReportViewer1.ReportSource = RGastosInventario1; }
public void setParameters(ReportDocument Rpt) { if (HttpContext.Current.Request.QueryString["StartDate"] != null && HttpContext.Current.Request.QueryString["EndDate"] != null) { ParameterFields paramFields = new ParameterFields(); ParameterField StartDay, EndDay; ParameterDiscreteValue dcStartDay, dcEndDay; StartDay = new ParameterField(); StartDay.ParameterFieldName = "@FromDate"; dcStartDay = new ParameterDiscreteValue(); dcStartDay.Value = Request.QueryString["StartDate"].ToString(); EndDay = new ParameterField(); EndDay.ParameterFieldName = "@ToDate"; dcEndDay = new ParameterDiscreteValue(); dcEndDay.Value = Request.QueryString["EndDate"].ToString(); StartDay.CurrentValues.Add(dcStartDay); EndDay.CurrentValues.Add(dcEndDay); paramFields.Add(StartDay); paramFields.Add(EndDay); AdminActivityCRViewer.ParameterFieldInfo = paramFields; AdminActivityCRViewer.ReportSource = Rpt; AdminActivityCRViewer.DataBind(); } }
public void InitializeReport() { ReportDocument PullOutConsolidated; PullOutConsolidated = new PullOutConsolidatedMonthly(); DataBaseLogIn(PullOutConsolidated); ParameterField prmDateFrom = new ParameterField(); ParameterField prmDateTo = new ParameterField(); ParameterFields prmList = new ParameterFields(); prmDateFrom.ParameterFieldName = "date_from"; prmDateTo.ParameterFieldName = "date_to"; ParameterDiscreteValue prmDateFromValue = new ParameterDiscreteValue(); ParameterDiscreteValue prmDateToValue = new ParameterDiscreteValue(); prmDateFromValue.Value = Request.QueryString["DateFrom"]; prmDateToValue.Value = Request.QueryString["DateTo"]; prmDateFrom.CurrentValues.Add(prmDateFromValue); prmDateTo.CurrentValues.Add(prmDateToValue); prmList.Add(prmDateFrom); prmList.Add(prmDateTo); this.crViewerMonthlyConsolidatedReport.ParameterFieldInfo = prmList; crViewerMonthlyConsolidatedReport.ReportSource = PullOutConsolidated; }
private void btnSearch_Click(object sender, EventArgs e) { int DoctorID; DoctorID = Convert.ToInt32(cbDoctor.SelectedValue.ToString()); ReportDocument reportDocument = new ReportDocument(); ParameterField paramField = new ParameterField(); ParameterFields paramFields = new ParameterFields(); ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue(); string ReportPath = ConfigurationManager.AppSettings["ReportPath"]; paramField.Name = "@DoctorID"; paramDiscreteValue.Value = DoctorID; reportDocument.Load(ReportPath + "Report\\DoctorCrystalReport.rpt"); ConnectionInfo connectionInfo = new ConnectionInfo(); connectionInfo.DatabaseName = "DB_MedicalShop_02Sept20159PM"; //connectionInfo.UserID = "wms"; //connectionInfo.Password = "******"; connectionInfo.IntegratedSecurity = true; SetDBLogonForReport(connectionInfo, reportDocument); reportDocument.SetParameterValue("@DoctorID", DoctorID); DoctorCrystalRpt.ReportSource = reportDocument; DoctorCrystalRpt.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None; }
private void LoadReport() { try { string strSql = "select work_id,shipsup,cargosup,to_char(appdate,'yyyy-mm-dd') appdate, cargo_name,cargo_num from zjgdou_declare where to_char(appdate,'yyyy-mm-dd')>='2009-05-08'"; // DataTable tab = rpDocDB.GetDataTable(strSql); string strPath = Server.MapPath("../../rpt/declare.rpt"); this.rpDoc.Load(strPath); // rpDoc.SetDataSource(tab); this.Login(rpDoc); ParameterFields pfs = new ParameterFields(); ParameterField pf = new ParameterField(); ParameterDiscreteValue pfv = new ParameterDiscreteValue(); string strCode = "信息中心"; pfv.Value = strCode; pf.Name = "corp"; pf.CurrentValues.Add(pfv); pfs.Add(pf); this.CrystalReportViewer1.ParameterFieldInfo = pfs; this.CrystalReportViewer1.ReportSource = rpDoc; this.CrystalReportViewer1.DataBind(); //this.CrystalReportViewer1.RefreshReport(); //this.Session["REPORT"] = rpDoc; } catch (Exception err) { } }
public void InitializeReport() { ReportDocument PullOutSummaryPerCustomer; PullOutSummaryPerCustomer = new PullOutSummaryPerOutletRpt(); DataBaseLogIn(PullOutSummaryPerCustomer); ParameterField prmCustomerNumber = new ParameterField(); ParameterField prmDateFrom = new ParameterField(); ParameterField prmDateTo = new ParameterField(); ParameterFields prmList = new ParameterFields(); prmCustomerNumber.ParameterFieldName = "customer_number"; prmDateFrom.ParameterFieldName = "date_from"; prmDateTo.ParameterFieldName = "date_to"; ParameterDiscreteValue prmCustomerNumberValue = new ParameterDiscreteValue(); ParameterDiscreteValue prmDateFromValue = new ParameterDiscreteValue(); ParameterDiscreteValue prmDateToValue = new ParameterDiscreteValue(); prmCustomerNumberValue.Value = Request.QueryString["CustomerNumber"]; prmDateFromValue.Value = Request.QueryString["DateFrom"]; prmDateToValue.Value = Request.QueryString["DateTo"]; prmCustomerNumber.CurrentValues.Add(prmCustomerNumberValue); prmDateFrom.CurrentValues.Add(prmDateFromValue); prmDateTo.CurrentValues.Add(prmDateToValue); prmList.Add(prmCustomerNumber); prmList.Add(prmDateFrom); prmList.Add(prmDateTo); this.crViewerMonthlyPullOutSummaryPerCustomer.ParameterFieldInfo = prmList; crViewerMonthlyPullOutSummaryPerCustomer.ReportSource = PullOutSummaryPerCustomer; }
/// <summary> /// 產生報表 /// </summary> private void ConfigureCrystalReports() { try { string strDate = Session[string.Format("{0}QueryDateRange", Request["TimeStamp"].ToString())].ToString(); if (strDate == "~") strDate = ""; string strTime = Session[string.Format("{0}QueryTimeRange", Request["TimeStamp"].ToString())].ToString(); if (strTime == "~") strTime = ""; customerReport = new ReportDocument(); //取得報表格式檔RPT customerReport.Load(Server.MapPath("ITM061R.rpt")); customerReport.SetDataSource((DataTable)Session[string.Format("{0}ITM061", Request["TimeStamp"].ToString())]); ParameterFields par1 = new ParameterFields(); AddParameter("ProgramName", PageProgramName, par1); ParameterFields par2 = new ParameterFields(); AddParameter("UserName", Session["UID"].ToString(), par2); ParameterFields par3 = new ParameterFields(); AddParameter("QueryDateRange", strDate, par3); ParameterFields par4 = new ParameterFields(); AddParameter("QueryTime", strTime, par4); CRV1.ParameterFieldInfo.Add(par1[0]); CRV1.ParameterFieldInfo.Add(par2[0]); CRV1.ParameterFieldInfo.Add(par3[0]); CRV1.ParameterFieldInfo.Add(par4[0]); CRV1.ReportSource = customerReport; } catch (Exception ex) { lblErrorMessage.Text = ex.Message; } }//ConfigureCrystalReports
private void btnSearch_Click(object sender, EventArgs e) { int GroupId; GroupId = Convert.ToInt32(cbgroupNames.SelectedValue.ToString()); ReportDocument reportDocument = new ReportDocument(); ParameterField paramField = new ParameterField(); ParameterFields paramFields = new ParameterFields(); ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue(); string ReportPath = ConfigurationManager.AppSettings["ReportPath"]; paramField.Name = "@GroupId"; paramDiscreteValue.Value = 1; reportDocument.Load(ReportPath + "Reports\\GroupWise_CrystalReport.rpt"); ConnectionInfo connectionInfo = new ConnectionInfo(); connectionInfo.DatabaseName = "DB_LoanApplication"; //connectionInfo.UserID = "wms"; //connectionInfo.Password = "******"; connectionInfo.IntegratedSecurity = true; SetDBLogonForReport(connectionInfo, reportDocument); reportDocument.SetParameterValue("@GroupId", GroupId); GroupWisecrystalReport.ReportSource = reportDocument; GroupWisecrystalReport.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None; }
private void crystalReportViewer1_Load(object sender, EventArgs e) { reportDataBind(); ParameterFields paramFields = new ParameterFields(); ParameterField paramField1 = new ParameterField(); ParameterDiscreteValue discreteVal1 = new ParameterDiscreteValue(); paramField1.ParameterFieldName = "drawingno"; discreteVal1.Value = drawingno; paramField1.CurrentValues.Add(discreteVal1); paramFields.Add(paramField1); ParameterField paramField2 = new ParameterField(); ParameterDiscreteValue discreteVal2 = new ParameterDiscreteValue(); paramField2.ParameterFieldName = "blockno"; discreteVal2.Value = blockno; paramField2.CurrentValues.Add(discreteVal2); paramFields.Add(paramField2); ParameterField paramField3 = new ParameterField(); ParameterDiscreteValue discreteVal3 = new ParameterDiscreteValue(); paramField3.ParameterFieldName = "project"; discreteVal3.Value = project; paramField3.CurrentValues.Add(discreteVal3); paramFields.Add(paramField3); crystalReportViewer1.ParameterFieldInfo = paramFields; }
private void crystalReportViewer1_Load(object sender, EventArgs e) { DataSet ds = new DataSet(); ds = GetDs(); if (UserSecurity.HavingPrivilege(User.cur_user, "SPOOLWAREHOUSEUSERS")) { NestProjectMaterialRpt pmrpt = new NestProjectMaterialRpt(); pmrpt.SetDataSource(ds); crystalReportViewer1.ReportSource = pmrpt; } else { ProjectMaterialRpt pmrpt = new ProjectMaterialRpt(); pmrpt.SetDataSource(ds); crystalReportViewer1.ReportSource = pmrpt; } //crystalReportViewer1.DisplayGroupTree = false; ParameterFields paramFields = new ParameterFields(); ParameterField paramField1 = new ParameterField(); ParameterDiscreteValue discreteVal = new ParameterDiscreteValue(); // 第一个参数是具有多个值的离散参数。设置参数字段的名称,它必须和报表中的参数相符。 paramField1.ParameterFieldName = "kickoffdate"; // 设置离散值并将其传递给该参数。 discreteVal.Value = User .KickOffDate ; paramField1.CurrentValues.Add(discreteVal); // 将该参数添加到参数字段集合。 paramFields.Add(paramField1); ParameterField paramField2 = new ParameterField(); ParameterDiscreteValue discreteVal2 = new ParameterDiscreteValue(); paramField2.ParameterFieldName = "TotalBaseLength"; discreteVal2.Value = User.TotalBaseLength; paramField2.CurrentValues.Add(discreteVal2); paramFields.Add(paramField2); ParameterField paramField5 = new ParameterField(); ParameterDiscreteValue discreteVal5 = new ParameterDiscreteValue(); paramField5.ParameterFieldName = "kickoffdateStart"; discreteVal5.Value = User.KickOffDate_start; paramField5.CurrentValues.Add(discreteVal5); paramFields.Add(paramField5); ParameterField paramField6 = new ParameterField(); ParameterDiscreteValue discreteVal6 = new ParameterDiscreteValue(); paramField6.ParameterFieldName = "kickoffdateEnd"; discreteVal6.Value = User.KickOffDate_end; paramField6.CurrentValues.Add(discreteVal6); paramFields.Add(paramField6); ParameterField paramField7 = new ParameterField(); ParameterDiscreteValue discreteVal7 = new ParameterDiscreteValue(); paramField7.ParameterFieldName = "TotalWeight"; discreteVal7.Value = User.PipeBaseTotalWeight; paramField7.CurrentValues.Add(discreteVal7); paramFields.Add(paramField7); crystalReportViewer1.ParameterFieldInfo = paramFields; }
private void NestingDetailViewer_Load(object sender, EventArgs e) { DataSet ds = new DataSet(); ds = GetDs(); if (UserSecurity.HavingPrivilege(User.cur_user, "SPOOLWAREHOUSEUSERS")) { NestingPipeRpt pmrpt = new NestingPipeRpt(); pmrpt.SetDataSource(ds); NestingDetailViewer.ReportSource = pmrpt; } ParameterFields paramFields = new ParameterFields(); ParameterField paramField1 = new ParameterField(); ParameterDiscreteValue discreteVal = new ParameterDiscreteValue(); paramField1.ParameterFieldName = "kickoffdate"; discreteVal.Value = User.KickOffDate; paramField1.CurrentValues.Add(discreteVal); paramFields.Add(paramField1); ParameterField paramField2 = new ParameterField(); ParameterDiscreteValue discreteVa2 = new ParameterDiscreteValue(); paramField2.ParameterFieldName = "Margin"; discreteVa2.Value = User.Margin; paramField2.CurrentValues.Add(discreteVa2); paramFields.Add(paramField2); ParameterField paramField3 = new ParameterField(); ParameterDiscreteValue discreteVal3 = new ParameterDiscreteValue(); paramField3.ParameterFieldName = "TotalBaseLength"; discreteVal3.Value = User.TotalBaseLength; paramField3.CurrentValues.Add(discreteVal3); paramFields.Add(paramField3); ParameterField paramField4 = new ParameterField(); ParameterDiscreteValue discreteVal4 = new ParameterDiscreteValue(); paramField4.ParameterFieldName = "PipeRatio"; discreteVal4.Value = User.PipeRatio; paramField4.CurrentValues.Add(discreteVal4); paramFields.Add(paramField4); ParameterField paramField5 = new ParameterField(); ParameterDiscreteValue discreteVal5 = new ParameterDiscreteValue(); paramField5.ParameterFieldName = "kickoffdateStart"; discreteVal5.Value = User.KickOffDate_start; paramField5.CurrentValues.Add(discreteVal5); paramFields.Add(paramField5); ParameterField paramField6 = new ParameterField(); ParameterDiscreteValue discreteVal6= new ParameterDiscreteValue(); paramField6.ParameterFieldName = "kickoffdateEnd"; discreteVal6.Value = User.KickOffDate_end; paramField6.CurrentValues.Add(discreteVal6); paramFields.Add(paramField6); NestingDetailViewer.ParameterFieldInfo = paramFields; }
private void button1_Click(object sender, EventArgs e) { button1.Enabled = false; Start(); ParameterField paramField1 = new ParameterField(); //creating an object of ParameterFields class ParameterFields paramFields1 = new ParameterFields(); //creating an object of ParameterDiscreteValue class ParameterDiscreteValue paramDiscreteValue1 = new ParameterDiscreteValue(); //set the parameter field name paramField1.Name = "fId"; //set the parameter value paramDiscreteValue1.Value = x; //add the parameter value in the ParameterField object paramField1.CurrentValues.Add(paramDiscreteValue1); //add the parameter in the ParameterFields object paramFields1.Add(paramField1); // ReportViewer f2 = new ReportViewer(); TableLogOnInfos reportLogonInfos = new TableLogOnInfos(); TableLogOnInfo reportLogonInfo = new TableLogOnInfo(); ConnectionInfo reportConInfo = new ConnectionInfo(); Tables tables = default(Tables); // Table table = default(Table); var with1 = reportConInfo; with1.ServerName = "tcp:KyotoServer,49172"; with1.DatabaseName = "AccountDb_new"; with1.UserID = "sa"; with1.Password = "******"; LedgerListN cr = new LedgerListN(); tables = cr.Database.Tables; foreach (Table table in tables) { reportLogonInfo = table.LogOnInfo; reportLogonInfo.ConnectionInfo = reportConInfo; table.ApplyLogOnInfo(reportLogonInfo); } f2.crystalReportViewer1.ParameterFieldInfo = paramFields1; f2.crystalReportViewer1.ReportSource = cr; this.Visible = false; f2.ShowDialog(); this.Visible = true; Stop(); }
public void LoadReport(ReportState rptState) { if (rptState != ReportState.FromPostBack) { try { rptdoc = new ReportDocument(); ParameterField paramField = new ParameterField(); ParameterFields paramFields = new ParameterFields(); ParameterDiscreteValue paramDValue = new ParameterDiscreteValue(); DataTable dt = new DataTable(); dt = getdata(); ds.Tables[0].Merge(dt); rptdoc.Load(Server.MapPath("ExamDateCrt.rpt")); rptdoc.SetDataSource(dt); ExamForms.ReportSource = rptdoc; paramField.Name = "tittle"; paramDValue.Value = "Session:" + ddlSession.SelectedItem.Text + txtYear.Text; paramField.CurrentValues.Add(paramDValue); paramField.HasCurrentValue = true; paramFields.Add(paramField); ExamForms.ParameterFieldInfo = paramFields; ExamForms.EnableDatabaseLogonPrompt = false; ExamForms.EnableParameterPrompt = false; Session["cr"] = rptdoc; } catch (NullReferenceException ex) { ExamForms.Visible = false; } catch (CrystalReportsException ex) { ExamForms.Visible = false; } catch (IndexOutOfRangeException ex) { ExamForms.Visible = false; } catch (SqlException ex) { ExamForms.Visible = false; } catch (ArgumentNullException ex) { ExamForms.Visible = false; } catch (COMException ex) { Response.Redirect("../../Login.aspx"); } } else { ExamForms.ReportSource = (ReportDocument)Session["cr"]; } }
/// <summary> /// mau bao cao 2 - bao cao cuoc goi taxi theo ngay /// </summary> /// <param name="FullPathReport"></param> /// <param name="dtDataSource"></param> /// <param name="TuNgay"></param> /// <param name="DenNgay"></param> /// <param name="PathBieuDo1"></param> /// <param name="PathBieuDo2"></param> public void InBaoCaoBieuMau2(string FullPathReport, DataTable dtDataSource, DateTime TuNgay, DateTime DenNgay, string PathBieuDo1, string PathBieuDo2) { //Load lên mẫu in của giấy phép vào đối tượng report document mReportDocument.Load(FullPathReport); //Thực hiện gán Datasource cho report document mReportDocument.SetDataSource(dtDataSource); //Thực hiện view thông tin của giấy phép lên form in ParameterFields myParameterFields = new ParameterFields(); ParameterField FieldTuNgay = new ParameterField(); ParameterDiscreteValue DiscreteValueTuNgay = new ParameterDiscreteValue(); ParameterField FieldDenNgay = new ParameterField(); ParameterDiscreteValue DiscreteValueDenNgay = new ParameterDiscreteValue(); ParameterField FieldBieuDo1_Path = new ParameterField(); ParameterDiscreteValue DiscreteValueBieuDo1 = new ParameterDiscreteValue(); ParameterField FieldBieuDo2_Path = new ParameterField(); ParameterDiscreteValue DiscreteValueBieuDo2 = new ParameterDiscreteValue(); //TuNgay FieldTuNgay.ParameterFieldName = "TuNgay"; DiscreteValueTuNgay.Value = string.Format("{0: dd/MM/yyyy}", TuNgay); FieldTuNgay.CurrentValues.Add(DiscreteValueTuNgay); //DenNgay FieldDenNgay.ParameterFieldName = "DenNgay"; DiscreteValueDenNgay.Value = string.Format("{0: dd/MM/yyyy}", DenNgay); FieldDenNgay.CurrentValues.Add(DiscreteValueDenNgay); // duong dan bieu do 1 FieldBieuDo1_Path.ParameterFieldName = "BieuDo1_Path"; DiscreteValueBieuDo1.Value = PathBieuDo1; FieldBieuDo1_Path.CurrentValues.Add(DiscreteValueBieuDo1); // duong dan anh bieu do 2 FieldBieuDo2_Path.ParameterFieldName = "BieuDo2_Path"; DiscreteValueBieuDo2.Value = PathBieuDo2; FieldBieuDo2_Path.CurrentValues.Add(DiscreteValueBieuDo2); myParameterFields.Add(FieldTuNgay); myParameterFields.Add(FieldDenNgay); myParameterFields.Add(FieldBieuDo1_Path); myParameterFields.Add(FieldBieuDo2_Path); //-- Duong dan logo --- ParameterField FieldLogo_Path = new ParameterField(); ParameterDiscreteValue DiscreteValueLogo = new ParameterDiscreteValue(); FieldLogo_Path.ParameterFieldName = "pLogoPath"; DiscreteValueLogo.Value = g_LogoPath; FieldLogo_Path.CurrentValues.Add(DiscreteValueLogo); myParameterFields.Add(FieldLogo_Path); // --------------------- crGiayPhepViewer.ParameterFieldInfo = myParameterFields; crGiayPhepViewer.ReportSource = mReportDocument; }
private void letterOfIntroductionButton_Click(object sender, EventArgs e) { //creating an object of ParameterField class ParameterField paramField = new ParameterField(); //creating an object of ParameterFields class ParameterFields paramFields = new ParameterFields(); //creating an object of ParameterDiscreteValue class ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue(); //set the parameter field name paramField.Name = "District Name"; //set the parameter value paramDiscreteValue.Value = x; //add the parameter value in the ParameterField object paramField.CurrentValues.Add(paramDiscreteValue); //add the parameter in the ParameterFields object paramFields.Add(paramField); //set the parameterfield information in the crystal report ReportViewer f2 = new ReportViewer(); TableLogOnInfos reportLogonInfos = new TableLogOnInfos(); TableLogOnInfo reportLogonInfo = new TableLogOnInfo(); ConnectionInfo reportConInfo = new ConnectionInfo(); Tables tables = default(Tables); // Table table = default(Table); var with1 = reportConInfo; with1.ServerName = "tcp:KyotoServer,49172"; with1.DatabaseName = "PhoneBookDBKD22"; with1.UserID = "sa"; with1.Password = "******"; LOI cr = new LOI(); tables = cr.Database.Tables; foreach (Table table in tables) { reportLogonInfo = table.LogOnInfo; reportLogonInfo.ConnectionInfo = reportConInfo; table.ApplyLogOnInfo(reportLogonInfo); } f2.crystalReportViewer1.ParameterFieldInfo = paramFields; //set the parameterfield information in the crystal report f2.crystalReportViewer1.ReportSource = cr; this.Visible = false; f2.ShowDialog(); this.Visible = true; }
private void button1_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(benifiComboBox.Text)) { MessageBox.Show("Select Benificiary First", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); } else { ReportViewer f2 = new ReportViewer(); ParameterField paramField = new ParameterField(); //creating an object of ParameterFields class ParameterFields paramFields = new ParameterFields(); //creating an object of ParameterDiscreteValue class ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue(); //set the parameter field name paramField.Name = "Benificiary Name"; //set the parameter value paramDiscreteValue.Value = benifiComboBox.Text; //add the parameter value in the ParameterField object paramField.CurrentValues.Add(paramDiscreteValue); //add the parameter in the ParameterFields object paramFields.Add(paramField); //set the parameterfield information in the crystal report TableLogOnInfos reportLogonInfos = new TableLogOnInfos(); TableLogOnInfo reportLogonInfo = new TableLogOnInfo(); ConnectionInfo reportConInfo = new ConnectionInfo(); Tables tables = default(Tables); // Table table = default(Table); var with1 = reportConInfo; with1.ServerName = "tcp:KyotoServer,49172"; with1.DatabaseName = "BankReconciliationDB"; with1.UserID = "sa"; with1.Password = "******"; BenificiaryPaymentStatementCrystalReport cr = new BenificiaryPaymentStatementCrystalReport(); tables = cr.Database.Tables; foreach (Table table in tables) { reportLogonInfo = table.LogOnInfo; reportLogonInfo.ConnectionInfo = reportConInfo; table.ApplyLogOnInfo(reportLogonInfo); } f2.crystalReportViewer1.ParameterFieldInfo = paramFields; f2.crystalReportViewer1.ReportSource = cr; this.Visible = false; f2.ShowDialog(); this.Visible = true; } }
private void btnGenerar_Click(object sender, EventArgs e) { if(todos) { //C:\Users\Usuario\Documents\GitHub\ProyectoProgramacion5\ProyectoProgV\ProyectoProgV\Presentacion\reporteProveedor.rpt FormProveedor formulario = new FormProveedor(); ReportDocument crystalrpt = new ReportDocument(); crystalrpt.Load(@"C:\Users\Usuario\Documents\GitHub\ProyectoProgramacion5\ProyectoProgV\ProyectoProgV\Presentacion\reporteProveedor.rpt"); formulario.crystalReportViewer1.ReportSource = crystalrpt; formulario.crystalReportViewer1.Refresh(); formulario.Show(); } else { DateTime fecha = dateDesde.Value; string fechaDesde = fecha.ToString("d"); DateTime fecha2 = dateHasta.Value; string fechaHasta = fecha2.ToString("d"); FormProveedoresParametros form = new FormProveedoresParametros(); ReportDocument oRep = new ReportDocument(); ParameterField pf = new ParameterField(); ParameterFields pfs = new ParameterFields(); ParameterDiscreteValue pdv = new ParameterDiscreteValue(); pf.Name = "@fechaDesde"; pdv.Value = fechaDesde; pf.CurrentValues.Add(pdv); pfs.Add(pf); pfs.Clear(); pf.Name = "@fechaHasta"; pdv.Value = fechaHasta; pf.CurrentValues.Add(pdv); pfs.Add(pf); form.crystalReportViewer1.ParameterFieldInfo = pfs; oRep.Load(@"C:\Users\Usuario\Documents\GitHub\ProyectoProgramacion5\ProyectoProgV\ProyectoProgV\Presentacion\reporteProveedoresParametros.rpt"); form.crystalReportViewer1.ReportSource = oRep; form.Show(); } }
private void button1_Click(object sender, EventArgs e) { //creating an object of ParameterField class ParameterField paramField = new ParameterField(); //creating an object of ParameterFields class ParameterFields paramFields = new ParameterFields(); //creating an object of ParameterDiscreteValue class ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue(); //set the parameter field name paramField.Name = "account no"; //set the parameter value paramDiscreteValue.Value = accountNoComboBox.Text; //add the parameter value in the ParameterField object paramField.CurrentValues.Add(paramDiscreteValue); //add the parameter in the ParameterFields object paramFields.Add(paramField); //set the parameterfield information in the crystal report ReportViewer f2 = new ReportViewer(); TableLogOnInfos reportLogonInfos = new TableLogOnInfos(); TableLogOnInfo reportLogonInfo = new TableLogOnInfo(); ConnectionInfo reportConInfo = new ConnectionInfo(); Tables tables = default(Tables); // Table table = default(Table); var with1 = reportConInfo; with1.ServerName = "tcp:KyotoServer,49172"; with1.DatabaseName = "BankReconciliationDB"; with1.UserID = "sa"; with1.Password = "******"; StaetementOfOneAccountCrystalReportAll cr = new StaetementOfOneAccountCrystalReportAll(); tables = cr.Database.Tables; foreach (Table table in tables) { reportLogonInfo = table.LogOnInfo; reportLogonInfo.ConnectionInfo = reportConInfo; table.ApplyLogOnInfo(reportLogonInfo); } f2.crystalReportViewer1.ParameterFieldInfo = paramFields; //set the parameterfield information in the crystal report f2.crystalReportViewer1.ReportSource = cr; this.Visible = false; f2.ShowDialog(); this.Visible = true; }
public ReportParameterSelector(ReportDocument reportDocument, ReporterBO reporterBO) { InitializeComponent(); this.Text = base.Title + " - Report Parameters"; _reportDocument = reportDocument; _parameterFields = reportDocument.ParameterFields; _reporterBO = reporterBO; }
private void GetButton_Click(object sender, EventArgs e) { GetButton.Enabled = false; ParameterField paramField1 = new ParameterField(); //creating an object of ParameterFields class ParameterFields paramFields1 = new ParameterFields(); //creating an object of ParameterDiscreteValue class ParameterDiscreteValue paramDiscreteValue1 = new ParameterDiscreteValue(); //set the parameter field name paramField1.Name = "ShipmentId"; //set the parameter value paramDiscreteValue1.Value = ShipmentIdComboBox.Text; //add the parameter value in the ParameterField object paramField1.CurrentValues.Add(paramDiscreteValue1); //add the parameter in the ParameterFields object paramFields1.Add(paramField1); ReportViewer f2 = new ReportViewer(); TableLogOnInfos reportLogonInfos = new TableLogOnInfos(); TableLogOnInfo reportLogonInfo = new TableLogOnInfo(); ConnectionInfo reportConInfo = new ConnectionInfo(); Tables tables = default(Tables); // Table table = default(Table); var with1 = reportConInfo; with1.ServerName = "tcp:KyotoServer,49172"; with1.DatabaseName = "ProductNRelatedDB_newforSpecialPrice"; with1.UserID = "sa"; with1.Password = "******"; ShipmentAcknowledgement cr = new ShipmentAcknowledgement(); tables = cr.Database.Tables; foreach (Table table in tables) { reportLogonInfo = table.LogOnInfo; reportLogonInfo.ConnectionInfo = reportConInfo; table.ApplyLogOnInfo(reportLogonInfo); } f2.crystalReportViewer1.ParameterFieldInfo = paramFields1; f2.crystalReportViewer1.ReportSource = cr; this.Visible = false; f2.ShowDialog(); this.Visible = true; GetButton.Enabled = true; ShipmentIdComboBox.SelectedIndex = -1; }
public void GeraRelatorio() { //Session[RelatorioID] = _relatorio; Session[RelatorioID + "cache"] = _relatorio; // Abrir relatorio relatorio = new ReportDocument(); List <Parametro> parametros = _relatorio.parametros; String Relatorio_caminho = _relatorio.arquivo; Relatorio_caminho = Server.MapPath(@Relatorio_caminho); //relatorio.Load(Relatorio_caminho); NomeRelatorio.Text = "Relatorio " + _relatorio.titulo; CrystalReportViewer1.ReportSource = null; TableLogOnInfo tableLogOnInfo = null; relatorio.FileName = Relatorio_caminho; if (builder == null) { builder = new SqlConnectionStringBuilder(ConfigAplication.GetConnectString().ToString().Replace(";Unicode=True", "")); } foreach (CrystalDecisions.CrystalReports.Engine.Table tbl in relatorio.Database.Tables) { tableLogOnInfo = tbl.LogOnInfo; tableLogOnInfo.ConnectionInfo.ServerName = builder.DataSource; tableLogOnInfo.ConnectionInfo.DatabaseName = ""; tableLogOnInfo.ConnectionInfo.UserID = builder.UserID; tableLogOnInfo.ConnectionInfo.Password = builder.Password; tbl.ApplyLogOnInfo(tableLogOnInfo); } relatorio.SetDatabaseLogon(builder.UserID, builder.Password, builder.DataSource, ""); //CrystalReportViewer1.ReportSource = relatorio; // Passar os parametros para o relatorio CrystalReportViewer1.RefreshReport(); ParameterFields paramFields = new ParameterFields(); foreach (var p in parametros) { ParameterField pfItemYr = new ParameterField(); pfItemYr.ParameterFieldName = p.parametro; ParameterDiscreteValue dcItemYr = new ParameterDiscreteValue(); dcItemYr.Value = p.valor; pfItemYr.CurrentValues.Add(dcItemYr); paramFields.Add(pfItemYr); CrystalReportViewer1.ParameterFieldInfo = paramFields; } //CrystalReportSource1.Report.FileName = objrel.relatorio; CrystalReportViewer1.ReportSource = relatorio; //Session[Request.QueryString["Param"]+"rel"] = relatorio; }
private void ReportEFT() { //creating an object of ParameterField class ParameterField paramField = new ParameterField(); //creating an object of ParameterFields class ParameterFields paramFields = new ParameterFields(); //creating an object of ParameterDiscreteValue class ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue(); //set the parameter field name paramField.Name = "id"; //set the parameter value paramDiscreteValue.Value = newRowId; //add the parameter value in the ParameterField object paramField.CurrentValues.Add(paramDiscreteValue); //add the parameter in the ParameterFields object paramFields.Add(paramField); //set the parameterfield information in the crystal report ReportViewer f2 = new ReportViewer(); TableLogOnInfos reportLogonInfos = new TableLogOnInfos(); TableLogOnInfo reportLogonInfo = new TableLogOnInfo(); ConnectionInfo reportConInfo = new ConnectionInfo(); Tables tables = default(Tables); // Table table = default(Table); var with1 = reportConInfo; with1.ServerName = "LAPTOP-19NF5E9"; with1.DatabaseName = "BankReconciliationDBProNovember"; with1.UserID = "sa"; with1.Password = "******"; WithdrawInputCrystalReportEFT cr = new WithdrawInputCrystalReportEFT(); tables = cr.Database.Tables; foreach (Table table in tables) { reportLogonInfo = table.LogOnInfo; reportLogonInfo.ConnectionInfo = reportConInfo; table.ApplyLogOnInfo(reportLogonInfo); } f2.crystalReportViewer1.ParameterFieldInfo = paramFields; //set the parameterfield information in the crystal report f2.crystalReportViewer1.ReportSource = cr; this.Visible = false; f2.ShowDialog(); this.Visible = true; }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { if (Request.QueryString["InvoiceID"] != null) { ReportDocument reportDocument = new ReportDocument(); ParameterField paramField = new ParameterField(); ParameterFields paramFields = new ParameterFields(); ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue(); paramField.Name = "@InvoiceId"; paramDiscreteValue.Value = Convert.ToInt32(Request.QueryString["InvoiceID"]); paramField.CurrentValues.Add(paramDiscreteValue); paramFields.Add(paramField); paramFields.Add(paramField); CrystalReportViewer1.ParameterFieldInfo = paramFields; string reportPath = Server.MapPath("~/Admin/Invoice/crInvoice.rpt"); reportDocument.Load(reportPath); //reportDocument.SetParameterValue("@InvoiceId", 1770); CrystalReportViewer1.ReportSource = reportDocument; CrystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None; Session["ReportDocument"] = reportDocument; int InvoiceId = Convert.ToInt32(Request.QueryString["InvoiceID"]); ClientScript.RegisterStartupScript(this.GetType(), "newWindow", String.Format("<script>window.open('{0}');</script>", "Annexure.aspx?InvoiceID=" + InvoiceId)); //string strPopupAnnexure = "<script language='javascript' ID='script2'>" // // Passing intId to popup window. //+ "window.open('Annexure.aspx?InvoiceID=" + HttpUtility.UrlEncode(InvoiceId.ToString()) //+ "','new window', 'top=90, left=200, width=768, height=1024, dependant=no, location=0, alwaysRaised=no, menubar=no, resizeable=no, scrollbars=n, toolbar=no, status=no, center=yes')" //+ "</script>"; //ScriptManager.RegisterStartupScript((Page)HttpContext.Current.Handler, typeof(Page), "Script2", strPopupAnnexure, false); } else { string msg = "Session Expired."; } } else { if (Session["ReportDocument"] != null) { ReportDocument doc = (ReportDocument)Session["ReportDocument"]; CrystalReportViewer1.ReportSource = doc; } } } catch (Exception ex) { string error = ex.Message.ToString(); } }
private void frmcrystal_report_single_Load(object sender, EventArgs e) { if (SystemConst._Single_report_type == "Active") { this.WindowState = System.Windows.Forms.FormWindowState.Maximized; guard_single_report report = new guard_single_report(); ParameterFields paramFields = new ParameterFields(); ParameterField paramField = new ParameterField(); ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue(); foreach (CrystalDecisions.CrystalReports.Engine.Table tbCurrent in report.Database.Tables) { Set_Report_logons.SetTableLogin(tbCurrent); } report.SetDataSource(sg_Reports.RETURN_OFFICER_DETAILS("", SystemConst.guard_number)); report.SetParameterValue("QueryName", "SELECT_GUARD_REPORT_SINGLE"); report.SetParameterValue("guard_number", SystemConst.guard_number); report.SetParameterValue("guard_status", String.Empty); report.SetParameterValue("client_name", SystemConst.ClientName); crystalReportViewer1.ParameterFieldInfo = paramFields; this.crystalReportViewer1.ReportSource = report; //this.crystalReportViewer1.RefreshReport(); } else if (SystemConst._Single_report_type == "Archieve") { this.WindowState = System.Windows.Forms.FormWindowState.Maximized; guard_single_report report = new guard_single_report(); ParameterFields paramFields = new ParameterFields(); ParameterField paramField = new ParameterField(); ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue(); foreach (CrystalDecisions.CrystalReports.Engine.Table tbCurrent in report.Database.Tables) { Set_Report_logons.SetTableLogin(tbCurrent); } report.SetDataSource(sg_Reports.RETURN_OFFICER_DETAILS("", SystemConst.guard_number)); report.SetParameterValue("QueryName", "SELECT_ARCHIEVED_GUARD_REPORT_SINGLE"); report.SetParameterValue("guard_number", SystemConst.guard_number); report.SetParameterValue("guard_status", String.Empty); report.SetParameterValue("client_name", SystemConst.ClientName); crystalReportViewer1.ParameterFieldInfo = paramFields; this.crystalReportViewer1.ReportSource = report; //this.crystalReportViewer1.RefreshReport(); } }
private void PrintDoc(int typex, bool filter) { if (cmb_days.SelectedValue == null) { MessageBox.Show("Please select a day to continue", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string reporttitle = ""; ReportViwer rpt = new ReportViwer(); rpt.MdiParent = frm_main.ActiveForm; rpt.FormHeadertext = reporttitle; ParameterField paramField = new ParameterField(); ParameterFields paramFields = new ParameterFields(); ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue(); paramFields = ReportRepository.AddCrystalParamsWithLoca(reporttitle, commonFunctions.Loginuser.ToUpper(), commonFunctions.GlobalLocation, "01", commonFunctions.GlobalCompany, commonFunctions.CompanyAddress); paramField.Name = "status"; paramDiscreteValue.Value = "Original".ToUpper(); paramField.CurrentValues.Add(paramDiscreteValue); paramFields.Add(paramField); Rpt_SalesTypeWiseSale rptBank = new Rpt_SalesTypeWiseSale(); switch (options) { case 1: reporttitle = "Daily Cash Sales".ToUpper(); rptBank.SetDataSource(ReportRepository.GetSalesTypeWiseDetails(commonFunctions.ToInt(cmb_days.SelectedValue.ToString()), 0, 1)); break; case 2: reporttitle = "Daily Card Sales".ToUpper(); rptBank.SetDataSource(ReportRepository.GetSalesTypeWiseDetails(commonFunctions.ToInt(cmb_days.SelectedValue.ToString()), 0, 2)); break; case 3: reporttitle = "Daily Voucher Sales".ToUpper(); rptBank.SetDataSource(ReportRepository.GetSalesTypeWiseDetails(commonFunctions.ToInt(cmb_days.SelectedValue.ToString()), 0, 3)); break; } rpt.RepViewer.ParameterFieldInfo = paramFields; rpt.RepViewer.ReportSource = rptBank; rpt.RepViewer.Refresh(); rpt.MdiParent = frm_main.ActiveForm; rpt.Show(); }
private void OCPendienteEntrega(String codEmp, string _articulo) { try { StaCatalina.Forms.Reports _Reporte = new StaCatalina.Forms.Reports(); ReportDocument objReport = new ReportDocument(); String reportPath = ConfigurationManager.AppSettings["Reports"] + "\\Reporting\\" + "OrdenesDeCompraPendientesDeEntregaxArticulo.rpt"; objReport.Load(reportPath); objReport.Refresh(); objReport.ReportOptions.EnableSaveDataWithReport = false; // PARAMETROS DE CONEXION TableLogOnInfo logoninfo = new TableLogOnInfo(); logoninfo.ConnectionInfo.ServerName = ConfigurationManager.AppSettings["Source"]; logoninfo.ConnectionInfo.DatabaseName = ConfigurationManager.AppSettings["CatalogSTACATALINA"]; logoninfo.ConnectionInfo.UserID = ConfigurationManager.AppSettings["User ID"]; logoninfo.ConnectionInfo.Password = ConfigurationManager.AppSettings["Password"]; logoninfo.ConnectionInfo.IntegratedSecurity = false; Tables tables = objReport.Database.Tables; foreach (Table table in tables) { table.ApplyLogOnInfo(logoninfo); } // FIN PARAMETROS DE CONEXION ParameterFields Parametros = new ParameterFields(); ParameterField ParametroField = new ParameterField(); ParameterDiscreteValue ParametroValue = new ParameterDiscreteValue(); Parametros.Clear(); //1er PARAMETRO ParametroField.Name = "@codEmp"; ParametroValue.Value = codEmp; ParametroField.CurrentValues.Add(ParametroValue); Parametros.Add(ParametroField); //2do PARAMETRO ParametroField = new ParameterField(); ParametroValue = new ParameterDiscreteValue(); ParametroField.Name = "@articulo"; ParametroValue.Value = _articulo; ParametroField.CurrentValues.Add(ParametroValue); Parametros.Add(ParametroField); _Reporte.Parameters = Parametros; _Reporte.Reporte = objReport; _Reporte.Show(); } catch (Exception ex) { } }
private void frm_archieved_guard_list_report_Load(object sender, EventArgs e) { string _guard_status = SystemConst._guard_status; if (_guard_status != String.Empty) { try { this.WindowState = System.Windows.Forms.FormWindowState.Maximized; cr_archived_guard_lists report = new cr_archived_guard_lists(); ParameterFields paramFields = new ParameterFields(); ParameterField paramField = new ParameterField(); ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue(); foreach (CrystalDecisions.CrystalReports.Engine.Table tbCurrent in report.Database.Tables) { Set_Report_logons.SetTableLogin(tbCurrent); } report.SetDataSource(Archieve_Lists.SELECT_ARCHIEVED_GUARD_LIST_REPORT_BY_STATUS("SELECT_ARCHIEVED_GUARD_LIST_REPORT_BY_STATUS", _guard_status)); report.SetParameterValue("QueryName", "SELECT_ARCHIEVED_GUARD_LIST_REPORT_BY_STATUS"); report.SetParameterValue("guard_status", SystemConst._guard_status); cr_viewer_archieved_guards_report.ParameterFieldInfo = paramFields; this.cr_viewer_archieved_guards_report.ReportSource = report; //this.crystalReportViewer1.RefreshReport(); } catch (Exception ex) { throw ex; } } else { this.WindowState = System.Windows.Forms.FormWindowState.Maximized; cr_archived_guard_lists report = new cr_archived_guard_lists(); ParameterFields paramFields = new ParameterFields(); ParameterField paramField = new ParameterField(); ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue(); report.SetDatabaseLogon("sg_admin", "sg_admin123"); //hide the password from the code..get it from configuration file... report.SetDataSource(Archieve_Lists.SELECT_ARCHIEVED_GUARD_LIST_ALL("SELECT_ARCHIEVED_GUARD_LIST_ALL")); report.SetParameterValue("QueryName", "SELECT_ARCHIEVED_GUARD_LIST_ALL"); // report.SetParameterValue("guard_status", SystemConst._guard_status); cr_viewer_archieved_guards_report.ParameterFieldInfo = paramFields; this.cr_viewer_archieved_guards_report.ReportSource = report; //this.crystalReportViewer1.RefreshReport(); } }
public void LoadReport(ReportState rptState) { if (rptState != ReportState.FromPostBack) { try { ReportDocument rptdoc = new ReportDocument(); ParameterField paramField = new ParameterField(); ParameterFields paramFields = new ParameterFields(); paramDValue = new ParameterDiscreteValue(); DataTable dt = new DataTable(); dt = getdata(); ds.Tables[0].Merge(dt); rptdoc.Load(Server.MapPath("SubscriptionCrt.rpt")); rptdoc.SetDataSource(dt); Subscription_Details_Report.ReportSource = rptdoc; ds.Dispose(); Subscription_Details_Report.EnableDatabaseLogonPrompt = false; Subscription_Details_Report.EnableParameterPrompt = false; Session["cr"] = rptdoc; paramField.Name = "tittle"; paramField.CurrentValues.Add(paramDValue); paramField.HasCurrentValue = true; paramFields.Add(paramField); Subscription_Details_Report.ParameterFieldInfo = paramFields; Subscription_Details_Report.EnableDatabaseLogonPrompt = false; Subscription_Details_Report.EnableParameterPrompt = false; Session["cr"] = rptdoc; } catch (NullReferenceException ex) { Subscription_Details_Report.Visible = false; } catch (CrystalReportsException ex) { Subscription_Details_Report.Visible = false; } catch (IndexOutOfRangeException ex) { Subscription_Details_Report.Visible = false; } catch (SqlException ex) { Subscription_Details_Report.Visible = false; } catch (ArgumentNullException ex) { Subscription_Details_Report.Visible = false; } } else { Subscription_Details_Report.ReportSource = (ReportDocument)Session["cr"]; } }
public void LoadReport(ReportState rptState) { if (rptState != ReportState.FromPostBack) { try { ReportDocument rptdoc = new ReportDocument(); ParameterField paramField = new ParameterField(); ParameterFields paramFields = new ParameterFields(); ParameterDiscreteValue paramDValue = new ParameterDiscreteValue(); DataTable dt = new DataTable(); dt = getdata(); ds.Tables[0].Merge(dt); rptdoc.Load(Server.MapPath("D2DCrt.rpt")); rptdoc.SetDataSource(dt); DiaryToDepartment.ReportSource = rptdoc; paramField.Name = "title2"; paramDValue.Value = rptTitle; paramField.CurrentValues.Add(paramDValue); paramField.HasCurrentValue = true; paramFields.Add(paramField); DiaryToDepartment.ParameterFieldInfo = paramFields; // SetBDLoginInfo(cinfo); DiaryToDepartment.EnableDatabaseLogonPrompt = false; DiaryToDepartment.EnableParameterPrompt = false; Session["cr"] = rptdoc; } catch (NullReferenceException ex) { DiaryToDepartment.Visible = false; lblExceptioN.Text = ""; } catch (CrystalReportsException ex) { // Response.Write(ex); } catch (IndexOutOfRangeException ex) { // lblExceptioN.Text = "Null Date ."; } catch (SqlException ex) { // lblExceptioN.Text = "Null Date ."; } catch (ArgumentNullException ex) { // lblExceptioN.Text = "Null Date ."; } } else { DiaryToDepartment.ReportSource = (ReportDocument)Session["cr"]; } }
private void btnGenerarReporte_Click(object sender, EventArgs e) { if (cmbPeriodo.Text.Equals("") || comboBoxPeriodoFin.Text.Equals("")) { MessageBox.Show("Error, escoja un periodo de inicio y uno de fin"); } else { ReportDocument oRep = new ReportDocument(); Periodo periodoNuevo = new Periodo(); string nuevoEstado = this.cmbPeriodo.SelectedItem.ToString(); string[] tokens = nuevoEstado.Split('/'); string fechaini = tokens[0]; string nuevoEstadofin = this.comboBoxPeriodoFin.SelectedItem.ToString(); string[] tokensfin = nuevoEstadofin.Split('/'); string fechafin = tokensfin[1]; if (Reporte.Equals("BalanceComprobacion")) { ParameterField PfCompania = new ParameterField(); ParameterField PfFechaIni = new ParameterField(); ParameterField PfFechaFin = new ParameterField(); ParameterFields Pfs = new ParameterFields(); ParameterDiscreteValue PvdCompania = new ParameterDiscreteValue(); ParameterDiscreteValue PvdFechaIni = new ParameterDiscreteValue(); ParameterDiscreteValue PvdFechaFin = new ParameterDiscreteValue(); PfCompania.Name = "@Compañia"; PfFechaIni.Name = "@FechaInicio"; PfFechaFin.Name = "@FechaFinal"; PvdCompania.Value = Empresa; DateTimeFormatInfo dtfi = new DateTimeFormatInfo(); dtfi.ShortDatePattern = "yyyy-MM-dd"; dtfi.DateSeparator = "-"; DateTime objDate = Convert.ToDateTime(fechaini, dtfi); DateTimeFormatInfo dtffin = new DateTimeFormatInfo(); dtffin.ShortDatePattern = "yyyy-MM-dd"; dtffin.DateSeparator = "-"; DateTime objDatefin = Convert.ToDateTime(fechafin, dtffin); PfCompania.CurrentValues.Add(PvdCompania); PvdFechaIni.Value = objDate; PfFechaIni.CurrentValues.Add(PvdFechaIni); PvdFechaFin.Value = objDatefin; PfFechaFin.CurrentValues.Add(PvdFechaFin); Pfs.Add(PfFechaIni); Pfs.Add(PfFechaFin); Pfs.Add(PfCompania); crstlRComprobacion.ParameterFieldInfo = Pfs; oRep.Load(@"C:\Users\Hugo\Desktop\Proyecto SIA\SistemaContable\SistemaContable\Reportes\BalanceComprobacion.rpt");//cambiar por su direccion crstlRComprobacion.ReportSource = oRep; //oRepBalanceCom.SetDatabaseLogon("", "", "", "");User, Password, Server, Database(poner para no autentificarse siempre) } } }
private void btnSearch_Click(object sender, EventArgs e) { try { int DoctorID; //string DoctorName; string StartDate; string EndDate; DoctorID = Convert.ToInt32(cbDoctor.SelectedValue.ToString()); // DoctorName=Convert.ToString(cbDoctor.SelectedText.ToString()); StartDate = Convert.ToString(dtpStartDate.Text); EndDate = Convert.ToString(dtpEndDate.Text); ReportDocument reportDocument = new ReportDocument(); ParameterField paramField = new ParameterField(); ParameterFields paramFields = new ParameterFields(); ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue(); string ReportPath = ConfigurationManager.AppSettings["ReportPath"]; paramField.Name = "@DoctorID"; //paramField.Name = "@DoctorName"; paramField.Name = "@StartDate"; paramField.Name = "@EndDate"; paramDiscreteValue.Value = 1; if (chkdailyreport.Checked == true) { reportDocument.Load(ReportPath + "Report\\DoctorPay_CrystalReportNew1.rpt"); } else { reportDocument.Load(ReportPath + "Report\\DoctorPayment_ReportNew.rpt"); } ConnectionInfo connectionInfo = new ConnectionInfo(); connectionInfo.DatabaseName = "DB_MedicalShop_02Sept20159PM"; //connectionInfo.UserID = "wms"; //connectionInfo.Password = "******"; connectionInfo.IntegratedSecurity = true; SetDBLogonForReport(connectionInfo, reportDocument); reportDocument.SetParameterValue("@DoctorID", DoctorID); //reportDocument.SetParameterValue("@DoctorName", DoctorName); reportDocument.SetParameterValue("@StartDate", StartDate); reportDocument.SetParameterValue("@EndDate", EndDate); SupplierCrystalRpt.ReportSource = reportDocument; SupplierCrystalRpt.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
public void CreateParameterCollection(ParameterFields parameterFields) { Dictionary <string, string> paramValuesDictionary = new Dictionary <string, string>(); foreach (Parameter parameter in _parameterSetArg.Parameters) { paramValuesDictionary.Add(parameter.ParameterName, parameter.ParameterValue); } CreateParameterCollection(parameterFields, paramValuesDictionary); }
private void frmCrFuelUseageSelective_Load(object sender, EventArgs e) { //creating an object of Report Document class ReportDocument reportDocument = new ReportDocument(); //Passing vehicle number................................... //creating an object of ParameterField class ParameterField paramField = new ParameterField(); //creating an object of ParameterFields class ParameterFields paramFields = new ParameterFields(); //creating an object of ParameterDiscreteValue class ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue(); //set the parameter field name paramField.Name = "VehicleNo"; //set the parameter value paramDiscreteValue.Value = frmFuelFilling.vehicleno; //add the parameter value in the ParameterField object paramField.CurrentValues.Add(paramDiscreteValue); // add the parameter in the ParameterFields object paramFields.Add(paramField); //set the parameterfield information in the crystal report //passing start date ParameterField paramField2 = new ParameterField(); ParameterDiscreteValue paramDiscreteValue2 = new ParameterDiscreteValue(); paramField2.Name = "FromDate"; paramDiscreteValue2.Value = frmFuelFilling.fromDateSelective; paramField2.CurrentValues.Add(paramDiscreteValue2); paramFields.Add(paramField2); //passing end date ParameterField paramField3 = new ParameterField(); ParameterDiscreteValue paramDiscreteValue3 = new ParameterDiscreteValue(); paramField3.Name = "ToDate"; paramDiscreteValue3.Value = frmFuelFilling.toDateSelective; paramField3.CurrentValues.Add(paramDiscreteValue3); paramFields.Add(paramField3); crystalReportViewer1.ParameterFieldInfo = paramFields; //preparing root for preview reportDocument.Load(@"H:\MIT\Regain\Project VMS\Reports\CrFuelUseageSelective.rpt"); crystalReportViewer1.ReportSource = reportDocument; reportDocument.SetDatabaseLogon("reportuser", "890", @"CHAMINDA\MSSQLSERVER2", "VMS"); reportDocument.Refresh(); }
private void toolStripButtonSave_Click(object sender, EventArgs e) { try { StaCatalina.Forms.Reports _Reporte = new Reports(); ReportDocument objReport = new ReportDocument(); String reportPath = ConfigurationManager.AppSettings["Reports"] + "\\Reporting\\" + "ComprobantesInternosCompras.rpt"; objReport.Load(reportPath); objReport.Refresh(); objReport.ReportOptions.EnableSaveDataWithReport = false; // PARAMETROS DE CONEXION TableLogOnInfo logoninfo = new TableLogOnInfo(); logoninfo.ConnectionInfo.ServerName = ConfigurationManager.AppSettings["Source"]; logoninfo.ConnectionInfo.DatabaseName = ConfigurationManager.AppSettings["CatalogSTACATALINA"]; logoninfo.ConnectionInfo.UserID = ConfigurationManager.AppSettings["User ID"]; logoninfo.ConnectionInfo.Password = ConfigurationManager.AppSettings["Password"]; logoninfo.ConnectionInfo.IntegratedSecurity = false; Tables tables = objReport.Database.Tables; foreach (Table table in tables) { table.ApplyLogOnInfo(logoninfo); } // FIN PARAMETROS DE CONEXION ParameterFields Parametros = new ParameterFields(); ParameterField ParametroField = new ParameterField(); ParameterDiscreteValue ParametroValue = new ParameterDiscreteValue(); Parametros.Clear(); //1er PARAMETRO ParametroField.Name = "@FechaDesde"; ParametroValue.Value = Convert.ToDateTime(this.dateTimeDesde.Value.ToString("yyyy-MM-dd 00:00:00")); ParametroField.CurrentValues.Add(ParametroValue); Parametros.Add(ParametroField); //2° PARAMETRO ParametroField = new ParameterField(); ParametroValue = new ParameterDiscreteValue(); ParametroField.Name = "@FechaHasta"; ParametroValue.Value = Convert.ToDateTime(this.dateTimeHasta.Value.ToString("yyyy-MM-dd 23:59:59")); ParametroField.CurrentValues.Add(ParametroValue); Parametros.Add(ParametroField); _Reporte.Parameters = Parametros; _Reporte.Reporte = objReport; _Reporte.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void LoadReport(object pRpt, ParameterFields pParams) { if (this.InvokeRequired) { this.Invoke(new SetReportViewerDelegate(SetReportViewer), new object[] { pRpt, pParams }); } else { SetReportViewer(pRpt, pParams); } }
public static void addParameterField(ParameterFields paramFields, string name, string value) { ParameterField paramField = new ParameterField(); ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue(); paramField.Name = name; paramDiscreteValue.Value = value; paramField.CurrentValues.Add(paramDiscreteValue); paramField.HasCurrentValue = true; paramFields.Add(paramField); }
private void SetReportViewer(object pRpt, ParameterFields pParams) { label1.Visible = false; if (pParams != null) { crtView.ParameterFieldInfo = pParams; } crtView.ReportSource = pRpt; SendKeys.Send("{ESC}"); completed = true; }
protected void SetParameterReport(ParameterFields myParams, string ParamName, object ParamValue) { ParameterField myParam = new ParameterField(); ParameterDiscreteValue myDiscreteValue = new ParameterDiscreteValue(); // Add trung tam myParam.Name = ParamName; myDiscreteValue.Value = ParamValue; myParam.CurrentValues.Add(myDiscreteValue); myParams.Add(myParam); }
/// <summary> /// Set Connection Info /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int HHID = Convert.ToInt32(Request.QueryString["HHID"]); } ConnectionInfo ConnInfo = new ConnectionInfo(); ConnInfo.ServerName = System.Configuration.ConfigurationManager.AppSettings.Get("Rpt_ServerName"); ConnInfo.DatabaseName = System.Configuration.ConfigurationManager.AppSettings.Get("Rpt_DatabaseName"); ConnInfo.UserID = System.Configuration.ConfigurationManager.AppSettings.Get("Rpt_UserID"); ConnInfo.Password = System.Configuration.ConfigurationManager.AppSettings.Get("Rpt_Password"); CrystalReportViewer1.ReportSource = ResolveUrl("~/REPORTS/PkgPaymentACK.rpt"); foreach (TableLogOnInfo cnInfo in CrystalReportViewer1.LogOnInfo) { cnInfo.ConnectionInfo = ConnInfo; } CrystalReportViewer1.ParameterFieldInfo.Clear(); ParameterFields ParamFields = CrystalReportViewer1.ParameterFieldInfo; ParameterField paramHHID = new ParameterField(); // ParameterField paramPrintedby = new ParameterField(); paramHHID.Name = "p_hhid"; //paramPrintedby.Name = "P_PrintedBy"; ParameterDiscreteValue paramHHIDVal = new ParameterDiscreteValue(); // ParameterDiscreteValue paramPrintedbyVal = new ParameterDiscreteValue(); paramHHIDVal.Value = Convert.ToInt32(Session["HH_ID"]); // paramPrintedbyVal.Value = Session["userName"].ToString(); paramHHID.CurrentValues.Add(paramHHIDVal); // paramPrintedby.CurrentValues.Add(paramPrintedbyVal); ParamFields.Add(paramHHID); // ParamFields.Add(paramPrintedby); CrystalReportViewer1.RefreshReport(); }
protected void CrystalParameterPassing(ParameterFields parameterFields, string strParamFieldName, string strParamValue) { ParameterValues currentParameterValues = new ParameterValues(); ParameterDiscreteValue parameterDiscreteValue = new ParameterDiscreteValue(); parameterDiscreteValue.Value = strParamValue == null ? "" : strParamValue.Trim(); currentParameterValues.Add(parameterDiscreteValue); ParameterField parameterField = parameterFields[strParamFieldName.Trim()]; parameterField.CurrentValues = currentParameterValues; }
private void HistoricoPrecios() { try { StaCatalina.Forms.Reports _Reporte = new Reports(); ReportDocument objReport = new ReportDocument(); String reportPath = ConfigurationManager.AppSettings["Reports"] + "\\Reporting\\" + "HistoricoDePrecios.rpt"; objReport.Load(reportPath); objReport.Refresh(); objReport.ReportOptions.EnableSaveDataWithReport = false; // PARAMETROS DE CONEXION TableLogOnInfo logoninfo = new TableLogOnInfo(); logoninfo.ConnectionInfo.ServerName = ConfigurationManager.AppSettings["Source"]; logoninfo.ConnectionInfo.DatabaseName = ConfigurationManager.AppSettings["CatalogSTACATALINA"]; logoninfo.ConnectionInfo.UserID = ConfigurationManager.AppSettings["User ID"]; logoninfo.ConnectionInfo.Password = ConfigurationManager.AppSettings["Password"]; logoninfo.ConnectionInfo.IntegratedSecurity = false; Tables tables = objReport.Database.Tables; foreach (Table table in tables) { table.ApplyLogOnInfo(logoninfo); } // FIN PARAMETROS DE CONEXION ParameterFields Parametros = new ParameterFields(); ParameterField ParametroField = new ParameterField(); ParameterDiscreteValue ParametroValue = new ParameterDiscreteValue(); Parametros.Clear(); //1er PARAMETRO ParametroField.Name = "@codProducto"; ParametroValue.Value = this.comboBoxProductoxRubro.SelectedValue; ParametroField.CurrentValues.Add(ParametroValue); Parametros.Add(ParametroField); //2° PARAMETRO ParametroField = new ParameterField(); ParametroValue = new ParameterDiscreteValue(); ParametroField.Name = "@codEmp"; ParametroValue.Value = Clases.Usuario.EmpresaLogeada.EmpresaIngresada.Trim(); ParametroField.CurrentValues.Add(ParametroValue); Parametros.Add(ParametroField); _Reporte.Parameters = Parametros; _Reporte.Reporte = objReport; _Reporte.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnGenerar_Click(object sender, EventArgs e) { if (todos) { //C:\Users\Usuario\Documents\GitHub\ProyectoProgramacion5\ProyectoProgV\ProyectoProgV\Presentacion\reporteProveedor.rpt FormFacturaCliente formulario = new FormFacturaCliente(); ReportDocument crystalrpt = new ReportDocument(); crystalrpt.Load(@"C:\Users\Usuario\Documents\GitHub\ProyectoProgramacion5\ProyectoProgV\ProyectoProgV\Presentacion\reporteUser.rpt"); formulario.crystalReportViewer1.ReportSource = crystalrpt; formulario.crystalReportViewer1.Refresh(); formulario.Show(); } else { DateTime fecha = dateDesde.Value; string fechaDesde = fecha.ToString("d"); DateTime fecha2 = dateHasta.Value; string fechaHasta = fecha2.ToString("d"); FormProveedoresParametros form = new FormProveedoresParametros(); ReportDocument oRep = new ReportDocument(); ParameterField pf = new ParameterField(); ParameterFields pfs = new ParameterFields(); ParameterDiscreteValue pdv = new ParameterDiscreteValue(); pf.Name = "@fechaDesde"; pdv.Value = fechaDesde; pf.CurrentValues.Add(pdv); pfs.Add(pf); pfs.Clear(); pf.Name = "@fechaHasta"; pdv.Value = fechaHasta; pf.CurrentValues.Add(pdv); pfs.Add(pf); form.crystalReportViewer1.ParameterFieldInfo = pfs; oRep.Load(@"C:\Users\Usuario\Documents\GitHub\ProyectoProgramacion5\ProyectoProgV\ProyectoProgV\Presentacion\reporteUsuariosParametros.rpt"); form.crystalReportViewer1.ReportSource = oRep; form.Show(); } }
private void crystalReportViewer1_ReportRefresh(object source, CrystalDecisions.Windows.Forms.ViewerEventArgs e) { ParameterFields campos = new ParameterFields(); ParameterField nombreEDS = new ParameterField(); ParameterDiscreteValue value = new ParameterDiscreteValue(); nombreEDS.Name = "EDS_NOMBRE"; nombreEDS.ParameterValueType = ParameterValueKind.StringParameter; value.Value = Exportador_Ventas_ServP.Properties.Settings.Default.nombreEDS; nombreEDS.DefaultValues.Add(value); nombreEDS.CurrentValues.Add(value); this.crystalReportViewer1.ParameterFieldInfo.Add(nombreEDS); }
private void SetCurrentValuesForParameterField(ParameterFields parameterFields, ArrayList arrayList) { ParameterValues currentParameterValues = new ParameterValues(); foreach (object submittedValue in arrayList) { ParameterDiscreteValue parameterDiscreteValue = new ParameterDiscreteValue(); parameterDiscreteValue.Value = submittedValue.ToString(); currentParameterValues.Add(parameterDiscreteValue); } ParameterField parameterField = parameterFields[PARAMETER_FIELD_NAME]; parameterField.CurrentValues = currentParameterValues; }
private void report_Load(object sender, EventArgs e) { CompareReport crCompare = new CompareReport(); ParameterFields paramFields; ParameterField paramField; ParameterDiscreteValue paramDiscreteValue; paramFields = new ParameterFields(); //Заполняем шапку crCompare.DataDefinition.FormulaFields["dates"].Text = "\"" + Parameters.dates + "\""; crCompare.DataDefinition.FormulaFields["deps"].Text = "\"" + Parameters.deps + "\""; crCompare.DataDefinition.FormulaFields["tuGrps"].Text = "\"" + Parameters.tuGrps + "\""; crCompare.DataDefinition.FormulaFields["grpBy"].Text = "\"" + Parameters.grpBy + "\""; crCompare.DataDefinition.FormulaFields["srcs"].Text = "\"" + Parameters.srcs + "\""; //Заполняем полей по количеству колонок в гриде for (int i = 1; i <= Parameters.Data.Columns.Count; i++) { DataColumn dtColumn = Parameters.Data.Columns[i - 1]; if (dtColumn.ColumnName != "isPrint") { Parameters.Data.Columns[i - 1].ColumnName = "Col" + i.ToString(); paramField = new ParameterField(); paramField.Name = dtColumn.ColumnName; paramDiscreteValue = new ParameterDiscreteValue(); paramDiscreteValue.Value = Parameters.Data.Rows[0][dtColumn.ColumnName].ToString(); paramField.CurrentValues.Add(paramDiscreteValue); paramFields.Add(paramField); } } //Оставшиеся колонки в отчете заполняем пустыми значениями for (int i = Parameters.Data.Columns.Count; i <= 8; i++) { paramField = new ParameterField(); paramField.Name = "Col" + i.ToString(); paramDiscreteValue = new ParameterDiscreteValue(); paramDiscreteValue.Value = ""; paramField.CurrentValues.Add(paramDiscreteValue); paramFields.Add(paramField); } //Вставляем список полей в отчет CompReportViewer.ParameterFieldInfo = paramFields; Parameters.Data.Rows.RemoveAt(0); crCompare.SetDataSource(Parameters.Data); CompReportViewer.ReportSource = crCompare; CompReportViewer.Refresh(); }
protected void SetParameterFields() { myParams = new ParameterFields(); if (this.InvokeRequired) { this.Invoke(new SetParameterFieldsDelegate(OnSetParameterFields), new object[] { myParams }); } else { OnSetParameterFields(myParams); } }
private void crystalReportViewer1_Load(object sender, EventArgs e) { ParameterFields campos = new ParameterFields(); ParameterField nombreEDS = new ParameterField(); ParameterDiscreteValue value = new ParameterDiscreteValue(); nombreEDS.Name = "EDS_NOMBRE"; nombreEDS.ParameterValueType = ParameterValueKind.StringParameter; value.Value = Exportador_Ventas_ServP.Properties.Settings.Default.nombreEDS; nombreEDS.DefaultValues.Add(value); nombreEDS.CurrentValues.Add(value); this.crystalReportViewer1.ParameterFieldInfo.Add(nombreEDS); //this.crystalReportViewer1.RefreshReport(); }
public void show_Report(DataTable i_dt, string i_strPath, ParameterFields i_pfParameterFields = null) { ReportDocument v_crsReport = new ReportDocument(); v_crsReport.Load(i_strPath); v_crsReport.SetDataSource(i_dt); if (!(i_pfParameterFields == null)) { m_crvVIEW_REPORT.ParameterFieldInfo = i_pfParameterFields; } m_crvVIEW_REPORT.ReportSource = v_crsReport; this.ShowDialog(); }
public void hacer_report(String idcomprobante) { ParameterDiscreteValue parametro=new ParameterDiscreteValue(); ParameterFields paramlist = new ParameterFields(); DataSet ds = new DataSet("comprobante"); db.ejecutar("select envnumcomprobante,envfecha_registro,if(clitipo=0,(select concat(natnombres,' ',natapellidos) from ste_clinatural where idclinatural=idcliente),(select jurrazonsocial from ste_clijuridico where idste_clijuridico=idcliente)) as nomcliente, cliruc, envdestinatario, envrucdestinatario, envdireccion_destino,envdireccion_origen,'" + this.txtrucremitente.Text + "' as rucremitente, ste_envio.gremision from ste_envio inner join ste_cliente on ste_envio.envidcliente=ste_cliente.idcliente where idenvio=" + idcomprobante); ds.Tables.Add(db.gettabla()); db.ejecutar("select * from ste_detalleenvio where denidenvio=" + idcomprobante); ds.Tables.Add(db.gettabla()); db.ejecutar("select * from ste_camionero inner join ste_unidad on ste_unidad.uniidcamionero=ste_camionero.idcamionero where ste_unidad.idunidad=" + this.cbunidad.SelectedIndex); ds.Tables.Add(db.gettabla()); ds.WriteXmlSchema("./comprobante.xml"); CrystalDecisions.CrystalReports.Engine.ReportClass rpt; switch (cmbtipcomprobante.SelectedIndex) { case 0://boleta rpt = new reportes.boletadeventa(); break; case 1://factura rpt = new reportes.factura(); double subt=0; foreach (DataRow r in ds.Tables[1].Rows) { subt +=Double.Parse(r["dencantidad"].ToString()) * Double.Parse(r["denpreciounitario"].ToString()); //subt += ((Double)r["dencantidad"]) * ((Double)r["denpreciounitario"]); } parametro.Value = aletras(subt.ToString(),true); paramlist.Add("enletras", ParameterValueKind.StringParameter, DiscreteOrRangeKind.DiscreteValue).CurrentValues.Add(parametro); break; default://orden de despacho rpt = new reportes.ordendedespacho(); break; } rpt.SetDataSource(ds); //FACTURA formularios.Imprimir frmr = new formularios.Imprimir(rpt); frmr.crystalReportViewer1.ParameterFieldInfo = paramlist; frmr.ShowDialog(this); //GUIA DE REMISION if (cmbtipcomprobante.SelectedIndex==1) { rpt = new reportes.guiaderemision(); rpt.SetDataSource(ds); frmr = new formularios.Imprimir(rpt); //frmr.crystalReportViewer1.ParameterFieldInfo = paramlist; frmr.ShowDialog(this); } }
protected void btnppf_Click(object sender, EventArgs e) { string s, m, w; DateTime frd, td; CultureInfo cf = new CultureInfo("hi-IN"); frd = Convert.ToDateTime(txtfd.Text, cf); td = Convert.ToDateTime(txttd.Text, cf); w = txtwc.Text; m = txtsc.Text; //s = "{{CDOSU.SOC}= '" + m + "' and {CR.WCC}='" + w + "'} and {{cr.regdt}>=#" + frd + "# and {cr.regdt}<=#" + td + "#}"; s = "{CDOSU.SOC}= '" + m + "' and {CR.WCC}='" + w + "' and {CR.REGDT}>=#" + frd + "# and {CR.REGDT}<=#" + td + "#"; ParameterField pf = new ParameterField(); ParameterFields param = new ParameterFields(); ParameterDiscreteValue df = new ParameterDiscreteValue(); pf.ParameterFieldName = "statuscd"; df.Value = m; pf.CurrentValues.Add(df); param.Add(pf); ParameterField pf1 = new ParameterField(); ParameterDiscreteValue fd = new ParameterDiscreteValue(); pf1.ParameterFieldName = "wardcode"; fd.Value = w; pf1.CurrentValues.Add(fd); param.Add(pf1); ParameterField pf2 = new ParameterField(); ParameterDiscreteValue df1 = new ParameterDiscreteValue(); pf2.ParameterFieldName = "From"; df1.Value = frd; pf2.CurrentValues.Add(df1); param.Add(pf2); ParameterField pf3 = new ParameterField(); ParameterDiscreteValue df2 = new ParameterDiscreteValue(); pf3.ParameterFieldName = "To"; df2.Value = td; pf3.CurrentValues.Add(df2); param.Add(pf3); ReportDocument rpt = new ReportDocument(); rpt.Load(Server.MapPath("statusWise.rpt")); rpt.FileName=Server.MapPath("statusWise.rpt"); CrystalReportViewer1.ParameterFieldInfo = param; CrystalReportViewer1.ReportSource = rpt; CrystalReportViewer1.DisplayGroupTree = false; CrystalReportViewer1.DisplayToolbar = false; CrystalReportViewer1.SelectionFormula = s; rpt.SetDatabaseLogon("scott", "tiger", "ora9i", ""); CrystalReportViewer1.DataBind(); }
private ArrayList GetDefaultValuesFromParameterField(ParameterFields parameterFields) { ParameterField parameterField = parameterFields[PARAMETER_FIELD_NAME]; ParameterValues defaultParameterValues = parameterField.DefaultValues; ArrayList arrayList = new ArrayList(); foreach (ParameterValue parameterValue in defaultParameterValues) { if (!parameterValue.IsRange) { ParameterDiscreteValue parameterDiscreteValue = (ParameterDiscreteValue)parameterValue; arrayList.Add(parameterDiscreteValue.Value.ToString()); } } return arrayList; }