private void ShowFormElement(UniTerm.frmRepForm RepForm) { string strForm = ""; XmlDocument xmlDoc = _repXMLForm; XmlNode appSettingsNode = xmlDoc.SelectSingleNode("//reports"); //xmlDoc.SelectSingleNode("//report[@code='" + _repName + "']"); foreach (XmlNode node in appSettingsNode.ChildNodes) { if (node.Attributes["code"].Value.ToString() == _repName) { strForm = node.Attributes["form"].Value.ToString(); } } if (strForm != "") { appSettingsNode = xmlDoc.SelectSingleNode("//form[@name='" + strForm + "']"); foreach (XmlNode node in appSettingsNode.ChildNodes) { RepForm.ShowElement(node.Attributes["code"].Value.ToString()); } } }
private void SetDataReportLast() { DataSet DS = new DataSet(); //DBAdapter DBA = new DBAdapter(); int dMonth; dMonth = DateTime.Now.Month; // Диалоговое окно frmRepForm RepForm = new frmRepForm(); //ProcParams PP = new ProcParams("month", "N", dMonth.ToString()); //ReportDocument Report = new ReportDocument(); //ReportMKTC Report = new ReportMKTC(); //DBA.ProcParams = PP; //DBA.SetDbData(DS, _repDBProcName); //Вызов процедуры отчета /*.Select("month = 11")*/ myReportDocument.SetDataSource(DS.Tables[0]); // @TODO добавить загрузку отчета //Report.Load("path"); /*CrystalDecisions.CrystalReports.Engine.TextObject root; * root = (CrystalDecisions.CrystalReports.Engine.TextObject) * reportMKTC.ReportDefinition.ReportObjects["CurrDate"]; * root.; */ /* Параметры отчета */ /*ParameterFieldDefinitions crParameterFieldDefinitions; * ParameterFieldDefinition crParameterFieldDefinition; * ParameterValues crParameterValues = new ParameterValues(); * ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue(); * * crParameterDiscreteValue.Value = Convert.ToInt32("2010"); * crParameterFieldDefinitions = Report.DataDefinition.ParameterFields; * crParameterFieldDefinition = crParameterFieldDefinitions["Year"]; * * crParameterValues = crParameterFieldDefinition.CurrentValues; * * crParameterValues.Clear(); * crParameterValues.Add(crParameterDiscreteValue); * crParameterFieldDefinition.ApplyCurrentValues(crParameterValues); */ //ReportViewer.ReportSource = Report; //ReportViewer.Refresh(); ReportViewer.ReportSource = myReportDocument; //ReportViewer.Bi DataBind(); }
private void SetDataReport(string repName) { //DataSet DS = new DataSet(); //DBAdapter DBA = new DBAdapter(); //ProcParams PP = new ProcParams(); // Диалоговое окно frmRepForm RepForm = new frmRepForm(); try { ShowFormElement(RepForm); if (DialogResult.Yes == RepForm.ShowDialog(this)) { if (RepForm.DateFrom != "") { sReport.DateFrom = Convert.ToDateTime(RepForm.DateFrom); } if (RepForm.DateTo != "") { sReport.DateTo = Convert.ToDateTime(RepForm.DateTo); } //DBA.ProcParams = PP; //DBA.SetDbData(DS, _repDBProcName); //Вызов процедуры отчета } } catch (Exception e) { MessageBox.Show(_repName + "\n" + e.Message, "Ошибка обработки формы параметров отчета.", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void SetDataReportLast() { DataSet DS = new DataSet(); //DBAdapter DBA = new DBAdapter(); int dMonth; dMonth = DateTime.Now.Month; // Диалоговое окно frmRepForm RepForm = new frmRepForm(); //ProcParams PP = new ProcParams("month", "N", dMonth.ToString()); //ReportDocument Report = new ReportDocument(); //ReportMKTC Report = new ReportMKTC(); //DBA.ProcParams = PP; //DBA.SetDbData(DS, _repDBProcName); //Вызов процедуры отчета /*.Select("month = 11")*/ myReportDocument.SetDataSource(DS.Tables[0]); // @TODO добавить загрузку отчета //Report.Load("path"); /*CrystalDecisions.CrystalReports.Engine.TextObject root; root = (CrystalDecisions.CrystalReports.Engine.TextObject) reportMKTC.ReportDefinition.ReportObjects["CurrDate"]; root.; */ /* Параметры отчета */ /*ParameterFieldDefinitions crParameterFieldDefinitions; ParameterFieldDefinition crParameterFieldDefinition; ParameterValues crParameterValues = new ParameterValues(); ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue(); crParameterDiscreteValue.Value = Convert.ToInt32("2010"); crParameterFieldDefinitions = Report.DataDefinition.ParameterFields; crParameterFieldDefinition = crParameterFieldDefinitions["Year"]; crParameterValues = crParameterFieldDefinition.CurrentValues; crParameterValues.Clear(); crParameterValues.Add(crParameterDiscreteValue); crParameterFieldDefinition.ApplyCurrentValues(crParameterValues); */ //ReportViewer.ReportSource = Report; //ReportViewer.Refresh(); ReportViewer.ReportSource = myReportDocument; //ReportViewer.Bi DataBind(); }