private void buttonPrintInvoice_Click(object sender, EventArgs e) { var UsedClass = new BasicClass(); var dt = new DataTable(); //if ( dataGridViewItems.Rows.Count > 0 || textBoxInvoiceNO.Text != "" ) //{ if (textBoxCustomerName.Text == "") { MessageBox.Show("يرجى ادخال أسم الزبون", "Message"); textBoxCustomerName.Focus(); } else { SqlParameter[] param = new SqlParameter[2]; param[0] = new SqlParameter("@InvoiceNo", SqlDbType.Int); param[1] = new SqlParameter("@CustomerName", SqlDbType.NVarChar, 250); param[0].Value = textBoxInvoiceNO.Text; param[1].Value = textBoxCustomerName.Text.Trim(); dt = UsedClass.selectdata("Casher_PrintForma", param); var crp = new Reports.PurshaceReport(); CrystalDecisions.CrystalReports.Engine.TextObject invoiceType = (CrystalDecisions.CrystalReports.Engine.TextObject)crp.ReportDefinition.Sections["Section2"].ReportObjects["Text15"]; invoiceType.Text = textBoxInvoiceNO.Text; crp.SetDataSource(dt); PrintForm form = new PrintForm(); form.crystalReportViewer1.ReportSource = crp; form.ShowDialog(); } //} }
protected void Page_Init(object sender, EventArgs e) { string SearchStr = string.Empty; try { if (Session["CurrentSchoolYearId"] == null) { Response.Redirect("~/Login.aspx"); } crdata.Report = rpt; rpt1 = crdata.ReportDocument; DataSet dsReport = new xmlClassWiseStudentAttendTime(); DataSet ds = new DataSet(); if (Session["FamilyTitle"] != null) { //rpt.FileName = Server.MapPath("rptFamilyChildListReport.rpt"); rpt.FileName = Server.MapPath("rptFamilyChildList1Report.rpt"); DayCareBAL.LedgerService proxy = new DayCareBAL.LedgerService(); SearchStr += Session["FamilyTitle"].ToString(); SearchStr = Session["FamilyTitle"].ToString().Replace("'00000000-0000-0000-0000-000000000000',", ""); //string[] str = SearchStr.Remove(SearchStr.Length - 1).Remove(0, 1).Replace("','", "$").Split('$'); //string strFinalSearhString = ""; //foreach (string s in str) //{ // string s1 = ""; // s1 = s.Replace("'", ""); // s1 = "''" + s1 + "'',"; // strFinalSearhString += s1; //} //strFinalSearhString = strFinalSearhString.Remove(strFinalSearhString.Length - 1); //strFinalSearhString = "'" + strFinalSearhString + "'"; CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text1"]; CrystalDecisions.CrystalReports.Engine.TextObject footer = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"]; footer.Text = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString())); titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper(); //ds = proxy.GetAccountReceiable(new Guid(Session["CurrentSchoolYearId"].ToString(), new Guid(Request.QueryString["StartDate"].ToString()))); ds = proxy.GetFamilyChildListReport(new Guid(Session["SchoolId"].ToString()), new Guid(Session["CurrentSchoolYearId"].ToString()), SearchStr); dsReport.Tables["dtFamilyChildList"].Merge(ds.Tables[0]); rpt1.SetDataSource(dsReport.Tables["dtFamilyChildList"]); } crp.DisplayGroupTree = false; crp.ReportSource = rpt1; crp.RefreshReport(); crp.DataBind(); } catch (Exception ex) { DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.Ledger, "rptFamilyChildListReport Page_Load", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT); } }
//9列显示 public static bool showReport(CrystalDecisions.Windows.Forms.CrystalReportViewer crpvWater, DataTable dtRep, Hashtable htRep, BengZhan.comReport._9.crp9 crp, string strTitle, string strTime) { try { if (dtRep == null) { return(false); } if (htRep == null) { return(false); } for (int i = 0; i < crp.Section2.ReportObjects.Count; i++) { if (crp.Section2.ReportObjects[i] is CrystalDecisions.CrystalReports.Engine.TextObject) { CrystalDecisions.CrystalReports.Engine.TextObject to = (CrystalDecisions.CrystalReports.Engine.TextObject)crp.Section2.ReportObjects[i]; if (to.Text.IndexOf("field") >= 0) { to.Text = htRep[to.Text.Trim()].ToString(); } if (to.Text.Trim() == "") { to.Text = strTitle; } if (to.Text.Trim() == "time") { to.Text = strTime; } } } for (int i = 0; i < dtRep.Columns.Count; i++) { int j = i + 1; string strField = "field" + j.ToString(); dtRep.Columns[i].ColumnName = strField; } crp.SetDataSource(dtRep); crpvWater.ReportSource = crp; return(true); } catch (Exception ex) { MessageBox.Show(ex.ToString()); return(false); } }
private void paintReport(string strWellNo) { //已审 try { string strFrom = String.Format("{0}-{1}-{2}", this.dtpFrom.Value.Year.ToString(), this.dtpFrom.Value.Month.ToString(), this.dtpFrom.Value.Day.ToString()); string strTo = String.Format("{0}-{1}-{2}", this.dtpTo.Value.Year.ToString(), this.dtpTo.Value.Month.ToString(), this.dtpTo.Value.Day.ToString()); string strTitle = String.Format("时间范围:{0}至{1}", strFrom, strTo); string[] strText = new string[7]; strText[0] = "监测站编号"; strText[1] = "单位名称"; strText[2] = "已用水量"; strText[3] = "剩余水量"; strText[4] = "总水量"; strText[5] = "流量"; strText[6] = "上报时间"; printDoc.crpPrint crpPrintObj = new BengZhan.printDoc.crpPrint(); CrystalDecisions.CrystalReports.Engine.TextObject toTitle = (CrystalDecisions.CrystalReports.Engine.TextObject)crpPrintObj.ReportDefinition.ReportObjects["txtTime"]; toTitle.Text = strTitle; for (int i = 0; i < 7; i++) { int iNum = i + 1; string strTextTitle = "Text" + iNum.ToString(); CrystalDecisions.CrystalReports.Engine.TextObject to = (CrystalDecisions.CrystalReports.Engine.TextObject)crpPrintObj.ReportDefinition.ReportObjects[strTextTitle]; to.Text = strText[i].ToString(); } //*************************************************Sql查询部分*************** //wellNo不为空 string strSql = String.Format("select wellNo as Field1,depName as Field2,usedWaterAmount as Field3,leftWaterAmount as Field4,allWaterAmount as Field5,flowWaterAmount as Field6,time as Field7 from tbWellAmount where (cast(floor(cast(time as float)) as datetime) between '{0}' and '{1}') and wellNo='{2}' order by time", strFrom, strTo, strWellNo); if (strWellNo.Trim() == "") { //wellNo为空 strSql = String.Format("select wellNo as Field1,depName as Field2,usedWaterAmount as Field3,leftWaterAmount as Field4,allWaterAmount as Field5,flowWaterAmount as Field6,time as Field7 from tbWellAmount where (cast(floor(cast(time as float)) as datetime) between '{0}' and '{1}') order by time", strFrom, strTo); } //**************************************************************************** DataTable dt = null; CDBConnection.getDataTable(ref dt, strSql, "tbWellAmount"); crpPrintObj.SetDataSource(dt); this.crpvWater.ReportSource = crpPrintObj; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void FeeStatementWithAmountDue_Load(object sender, EventArgs e) { Reports.ReportSudentFeeStatementByClassAndSessionWithBalance mr = new Reports.ReportSudentFeeStatementByClassAndSessionWithBalance(); CrystalDecisions.CrystalReports.Engine.TextObject txtSession = mr.ReportDefinition.ReportObjects["txtSession"] as CrystalDecisions.CrystalReports.Engine.TextObject; txtSession.Text = Session; CrystalDecisions.CrystalReports.Engine.TextObject txtClass = mr.ReportDefinition.ReportObjects["txtClass"] as CrystalDecisions.CrystalReports.Engine.TextObject; txtClass.Text = Class; CrystalDecisions.CrystalReports.Engine.TextObject TillMonth = mr.ReportDefinition.ReportObjects["TillMonth"] as CrystalDecisions.CrystalReports.Engine.TextObject; TillMonth.Text = TillMonthValue; mr.SetDataSource(dsReport); mr.SetDatabaseLogon("sa", "abc123"); rvFeeStatement.ReportSource = mr; }
private void Form2_Load(object sender, EventArgs e) { UncertainityReport uR = new UncertainityReport(); T = uR.Section4.ReportObjects["Text10"] as CrystalDecisions.CrystalReports.Engine.TextObject; T.Text = T.Text + " " + std_dev; T = uR.Section4.ReportObjects["Text11"] as CrystalDecisions.CrystalReports.Engine.TextObject; T.Text = T.Text + " " + mum_unc; T = uR.Section4.ReportObjects["Text12"] as CrystalDecisions.CrystalReports.Engine.TextObject; T.Text = T.Text + " " + least_count; T = uR.Section4.ReportObjects["Text14"] as CrystalDecisions.CrystalReports.Engine.TextObject; T.Text = T.Text + " " + error_speed; T = uR.Section4.ReportObjects["Text15"] as CrystalDecisions.CrystalReports.Engine.TextObject; T.Text = T.Text + " " + error_machine; uR.Refresh(); crystalReportViewer1.ReportSource = uR; crystalReportViewer1.Show(); }
protected void Page_Init(object sender, EventArgs e) { try { if (Session["CurrentSchoolYearId"] == null) { Response.Redirect("~/Login.aspx"); } crdata.Report = rpt; rpt1 = crdata.ReportDocument; DataSet dsReport = new xmlClassWiseStudentAttendTime(); DataSet ds = new DataSet(); if (!string.IsNullOrEmpty(Request.QueryString["StartDate"])) { rpt.FileName = Server.MapPath("rptAccountReceivablesReport.rpt"); DayCareBAL.LedgerService proxy = new DayCareBAL.LedgerService(); CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text9"]; CrystalDecisions.CrystalReports.Engine.TextObject footer = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"]; footer.Text = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString())); titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper(); //ds = proxy.GetAccountReceiable(new Guid(Session["CurrentSchoolYearId"].ToString(), new Guid(Request.QueryString["StartDate"].ToString()))); ds = proxy.GetAccountReceiable(new Guid(Session["CurrentSchoolYearId"].ToString()), Convert.ToDateTime(Request.QueryString["StartDate"].ToString()), "AccountsReceivable"); dsReport.Tables["dtAccountReceiable_Credit"].Merge(ds.Tables[0]); rpt1.SetDataSource(dsReport.Tables["dtAccountReceiable_Credit"]); } crp.DisplayGroupTree = false; crp.ReportSource = rpt1; crp.RefreshReport(); crp.DataBind(); } catch (Exception ex) { DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.Ledger, "rptAccountReciableReport Page_Load", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT); } }
/// <summary> /// 日统计 /// </summary> /// <param name="strWellNo"></param> private void paintDayStatic(string strWellNo) { //已审 try { string strFrom = String.Format("{0}-{1}-{2}", this.dtpFrom.Value.Year.ToString(), this.dtpFrom.Value.Month.ToString(), this.dtpFrom.Value.Day.ToString()); string strTo = String.Format("{0}-{1}-{2}", this.dtpTo.Value.Year.ToString(), this.dtpTo.Value.Month.ToString(), this.dtpTo.Value.Day.ToString()); string strTitle = String.Format("时间范围:{0}至{1}", strFrom, strTo); string[] strText = new string[7]; strText[0] = "监测站编号"; strText[1] = "单位名称"; strText[2] = "已用水量"; strText[3] = "剩余水量"; strText[4] = "总水量"; strText[5] = "流量"; strText[6] = "上报时间"; printDoc.crpPrint crpPrintObj = new BengZhan.printDoc.crpPrint(); CrystalDecisions.CrystalReports.Engine.TextObject toTitle = (CrystalDecisions.CrystalReports.Engine.TextObject)crpPrintObj.ReportDefinition.ReportObjects["txtTime"]; toTitle.Text = strTitle; for (int i = 0; i < 7; i++) { int iNum = i + 1; string strTextTitle = "Text" + iNum.ToString(); CrystalDecisions.CrystalReports.Engine.TextObject to = (CrystalDecisions.CrystalReports.Engine.TextObject)crpPrintObj.ReportDefinition.ReportObjects[strTextTitle]; to.Text = strText[i].ToString(); } DataTable dt = new DataTable(); dt = this.getStaticDt(strWellNo, strFrom, strTo); crpPrintObj.SetDataSource(dt); this.crpvWater.ReportSource = crpPrintObj; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void FeeReportView_Load(object sender, EventArgs e) { if (purpose.Contains("Fee Collection for date")) { Reports.DailyFeeReport mr = new Reports.DailyFeeReport(); CrystalDecisions.CrystalReports.Engine.TextObject Purpose = mr.ReportDefinition.ReportObjects["Purpose"] as CrystalDecisions.CrystalReports.Engine.TextObject; Purpose.Text = purpose; mr.SetDataSource(dataSet.Tables[0]); mr.SetDatabaseLogon("sa", "abc123"); crystalReportViewer1.ReportSource = mr; } else { Reports.FeeReport mr = new Reports.FeeReport(); CrystalDecisions.CrystalReports.Engine.TextObject Purpose = mr.ReportDefinition.ReportObjects["Purpose"] as CrystalDecisions.CrystalReports.Engine.TextObject; Purpose.Text = purpose; mr.SetDataSource(dataSet.Tables[0]); mr.SetDatabaseLogon("sa", "abc123"); crystalReportViewer1.ReportSource = mr; } }
protected void Page_Init(object sender, EventArgs e) { if (Session["CurrentSchoolYearId"] == null) { Response.Redirect("~/Login.aspx"); } crdata.Report = rpt; rpt1 = crdata.ReportDocument; DataSet dsReport = new xmlClassWiseStudentAttendTime(); DataSet ds = new DataSet(); String strLastNameFrom = Convert.ToString(Request.QueryString["lastnamefrom"]); String strLastNameTo = Convert.ToString(Request.QueryString["lastnameto"]); // crp.AfterRender += this.crp_AfterRender; rpt.FileName = Server.MapPath("rptStudentSchedule.rpt"); DayCareBAL.ClassRoomService proxy = new DayCareBAL.ClassRoomService(); CrystalDecisions.CrystalReports.Engine.TextObject titleText = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text3"]; CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text1"]; CrystalDecisions.CrystalReports.Engine.TextObject footer = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"]; footer.Text = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString())); //CrystalDecisions.CrystalReports.Engine.TextObject titleText4 = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text4"]; //titleText4.Text = ViewState["title"].ToString(); titleText.Text = "Student Schedule"; titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper(); ds = proxy.GetStudentSchedule(new Guid(DayCarePL.Common.GUID_DEFAULT), new Guid(Session["CurrentSchoolYearId"].ToString()), strLastNameFrom, strLastNameTo); dsReport.Tables["dtClassWiseStudent"].Merge(ds.Tables[0]); rpt1.SetDataSource(dsReport.Tables["dtClassWiseStudent"]); crp.DisplayGroupTree = false; crp.ReportSource = rpt1; crp.RefreshReport(); crp.DataBind(); }
private void ProfitLossPrint_Load(object sender, EventArgs e) { Reports.ProfitLossReport mr = new Reports.ProfitLossReport(); CrystalDecisions.CrystalReports.Engine.TextObject txtPurpose = mr.ReportDefinition.ReportObjects["Purpose"] as CrystalDecisions.CrystalReports.Engine.TextObject; CrystalDecisions.CrystalReports.Engine.TextObject txtTotal = mr.ReportDefinition.ReportObjects["txtTotal"] as CrystalDecisions.CrystalReports.Engine.TextObject; CrystalDecisions.CrystalReports.Engine.TextObject txtCash = mr.ReportDefinition.ReportObjects["txtCash"] as CrystalDecisions.CrystalReports.Engine.TextObject; CrystalDecisions.CrystalReports.Engine.TextObject txtCheque = mr.ReportDefinition.ReportObjects["txtCheque"] as CrystalDecisions.CrystalReports.Engine.TextObject; CrystalDecisions.CrystalReports.Engine.TextObject txtPaytm = mr.ReportDefinition.ReportObjects["txtPaytm"] as CrystalDecisions.CrystalReports.Engine.TextObject; CrystalDecisions.CrystalReports.Engine.TextObject txtCard = mr.ReportDefinition.ReportObjects["txtCard"] as CrystalDecisions.CrystalReports.Engine.TextObject; CrystalDecisions.CrystalReports.Engine.TextObject txtBankTranfer = mr.ReportDefinition.ReportObjects["txtBankTransfer"] as CrystalDecisions.CrystalReports.Engine.TextObject; // CrystalDecisions.CrystalReports.Engine.TextObject txtPurpose = mr.ReportDefinition.ReportObjects["txtPurpose"] as CrystalDecisions.CrystalReports.Engine.TextObject; txtPurpose.Text = Purpose; txtTotal.Text = Total; txtCash.Text = Cash; txtCheque.Text = Cheque; txtPaytm.Text = Paytm; txtCard.Text = Card; txtBankTranfer.Text = BankTransfer; ProfitLossView.ReportSource = mr; }
private void buttonInvoicePrint_Click(object sender, EventArgs e) { var UsedClass = new BasicClass(); var dt = new DataTable(); SqlParameter[] param = new SqlParameter[2]; param[0] = new SqlParameter("@InvoiceNo", SqlDbType.Int); param[1] = new SqlParameter("@CustomerName", SqlDbType.NVarChar, 250); param[0].Value = int.Parse(textBoxInvoiceNo.Text); param[1].Value = textBoxCustomerName.Text.Trim(); dt = UsedClass.selectdata("Casher_PrintForma", param); var crp = new Reports.CrystalReport1(); CrystalDecisions.CrystalReports.Engine.TextObject invoiceType = (CrystalDecisions.CrystalReports.Engine.TextObject)crp.ReportDefinition.Sections["Section2"].ReportObjects["Text15"]; invoiceType.Text = textBoxInvoiceNo.Text; crp.SetDataSource(dt); PrintForm form = new PrintForm(); form.crystalReportViewer1.ReportSource = crp; form.ShowDialog(); //crp.PrintToPrinter ( 1 , false , 0 , 0 ); }
private void FeeStatement_Load(object sender, EventArgs e) { Reports.ReportSudentFeeStatementByClassAndSession mr = new Reports.ReportSudentFeeStatementByClassAndSession(); CrystalDecisions.CrystalReports.Engine.TextObject txtSession = mr.ReportDefinition.ReportObjects["txtSession"] as CrystalDecisions.CrystalReports.Engine.TextObject; txtSession.Text = Session; CrystalDecisions.CrystalReports.Engine.TextObject txtClass = mr.ReportDefinition.ReportObjects["txtClass"] as CrystalDecisions.CrystalReports.Engine.TextObject; txtClass.Text = Class; SqlParameter[] m = new SqlParameter[2]; m[0] = new SqlParameter("@Session", Session); m[1] = new SqlParameter("@Class", Class); DataSet ds1 = SqlHelper.ExecuteDataset(Connection.Connection_string, "Student_FeeStatementBySessionAndClass", m); //mr.SetParameterValue("@Session", Session); //mr.SetParameterValue("@Class", Class); //// mr.PrintToPrinter(); //// mr.SetDataSource(ds1); //SqlConnection con = Connection.Connection_string; mr.SetDataSource(ds1.Tables[0]); mr.SetDatabaseLogon("sa", "abc123"); rvFeeStatement.ReportSource = mr; }
protected void Page_Init(object sender, EventArgs e) { try { if (Session["SchoolId"] == null || Session["CurrentSchoolYearId"] == null) { Response.Redirect("~/Login.aspx"); } crdata.Report = rpt; rpt1 = crdata.ReportDocument; string SearchText = ""; Guid ChildFamilyId = new Guid(); DataSet dsReport = new xmlClassWiseStudentAttendTime(); DataSet ds = new DataSet(); if (!String.IsNullOrEmpty(Request.QueryString["ChildFamilyId"])) { ChildFamilyId = new Guid(Request.QueryString["ChildFamilyId"].ToString()); } if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && String.IsNullOrEmpty(Request.QueryString["EndDate"])) { SearchText += " transactiondate>='" + Request.QueryString["StartDate"].ToString() + "'"; } if (String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"])) { SearchText += " transactiondate<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00 AM", "11:59:58 PM") + " '"; } else if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"])) { SearchText += " transactiondate>='" + Request.QueryString["StartDate"].ToString() + "' and transactiondate<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00 AM", "11:59:58 PM") + "'"; } rpt.FileName = Server.MapPath("rptLateFeesReport.rpt"); DayCareBAL.LedgerService proxy = new DayCareBAL.LedgerService(); string StartDate = string.Empty; string EndDate = string.Empty; if (Request.QueryString["StartDate"] != "") { StartDate = Convert.ToDateTime(Request.QueryString["StartDate"].ToString()).ToString("MM/dd/yyyy"); } if (Request.QueryString["EndDate"] != "") { EndDate = Convert.ToDateTime(Request.QueryString["EndDate"].ToString()).ToString("MM/dd/yyyy"); } CrystalDecisions.CrystalReports.Engine.TextObject titleText = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text4"]; CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text3"]; CrystalDecisions.CrystalReports.Engine.TextObject footer = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"]; footer.Text = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString())); titleText.Text = "Late Fee Report From " + StartDate + " To " + EndDate; titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper(); ds = proxy.GetFamilyWiseLateFeesReport(new Guid(Session["SchoolId"].ToString()), new Guid(Session["CurrentSchoolYearId"].ToString()), ChildFamilyId, SearchText); dsReport.Tables["dtLateFees"].Merge(ds.Tables[0]); rpt1.SetDataSource(dsReport.Tables["dtLateFees"]); crp.DisplayGroupTree = false; crp.ReportSource = rpt1; crp.RefreshReport(); crp.DataBind(); } catch (Exception ex) { DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.rptFamilyWiseLateFeesReport, "Page_Init", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT); } }
public bool printDt(DataTable dt) { try { string strTitle = String.Format("打印时间:{0}", System.DateTime.Now.ToString()); string[] strText = new string[7]; strText[0] = "监测站编号"; strText[1] = "单位名称"; strText[2] = "已用水量"; strText[3] = "剩余水量"; strText[4] = "总水量"; strText[5] = "流量"; strText[6] = "上报时间"; printDoc.crpPrint crpPrintObj = new BengZhan.printDoc.crpPrint(); CrystalDecisions.CrystalReports.Engine.TextObject toTitle = (CrystalDecisions.CrystalReports.Engine.TextObject)crpPrintObj.ReportDefinition.ReportObjects["txtTime"]; toTitle.Text = strTitle; for (int i = 0; i < 7; i++) { int iNum = i + 1; string strTextTitle = "Text" + iNum.ToString(); CrystalDecisions.CrystalReports.Engine.TextObject to = (CrystalDecisions.CrystalReports.Engine.TextObject)crpPrintObj.ReportDefinition.ReportObjects[strTextTitle]; to.Text = strText[i].ToString(); } DataTable dtPrint = new DataTable(); dtPrint.Columns.Add(new DataColumn("Field1")); dtPrint.Columns.Add(new DataColumn("Field2")); dtPrint.Columns.Add(new DataColumn("Field3")); dtPrint.Columns.Add(new DataColumn("Field4")); dtPrint.Columns.Add(new DataColumn("Field5")); dtPrint.Columns.Add(new DataColumn("Field6")); dtPrint.Columns.Add(new DataColumn("Field7")); for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dtPrint.NewRow(); dr["Field1"] = dt.Rows[i][0].ToString(); dr["Field2"] = dt.Rows[i][1].ToString(); dr["Field3"] = dt.Rows[i][2].ToString(); dr["Field4"] = dt.Rows[i][3].ToString(); dr["Field5"] = dt.Rows[i][4].ToString(); dr["Field6"] = dt.Rows[i][5].ToString(); dr["Field7"] = dt.Rows[i][7].ToString(); dtPrint.Rows.Add(dr); } crpPrintObj.SetDataSource(dtPrint); //打印窗体 Form rptForm = new Form(); rptForm.Text = "预览"; rptForm.FormBorderStyle = FormBorderStyle.FixedToolWindow; rptForm.WindowState = System.Windows.Forms.FormWindowState.Maximized; CrystalDecisions.Windows.Forms.CrystalReportViewer rptView = new CrystalDecisions.Windows.Forms.CrystalReportViewer(); rptForm.Controls.Add(rptView); rptView.Dock = System.Windows.Forms.DockStyle.Fill; rptView.ReportSource = crpPrintObj; rptView.ShowCloseButton = true; rptForm.ShowDialog(); return(true); } catch (Exception ex) { MessageBox.Show(ex.ToString()); return(false); } }
//*******************数据库操作区***************** #region "数据库查询" /// <summary> /// 已审 /// </summary> /// <param name="strWellNo">监测站编号</param> /// <param name="strUserName">操作员名称</param> private void paintReport(string strWellNo, string strUserName) { try { string strFrom = String.Format("{0}-{1}-{2}", this.dtpFrom.Value.Year.ToString(), this.dtpFrom.Value.Month.ToString(), this.dtpFrom.Value.Day.ToString()); string strTo = String.Format("{0}-{1}-{2}", this.dtpTo.Value.Year.ToString(), this.dtpTo.Value.Month.ToString(), this.dtpTo.Value.Day.ToString()); string strTitle = ""; //监测站统计sql1******************************sql语句 string strSql = String.Format("select tbSal.wellNo as Field1,depName as Field2,price as Field3,salMony as Field4,salAmount as Field5,salPer as Field6,time as Field7 from tbSal,tbWell where (cast(floor(cast(time as float)) as datetime) between '{0}' and '{1}') and tbSal.wellNo=tbWell.wellNo and tbSal.wellNo='{2}' order by time", strFrom, strTo, strWellNo); strTitle = "单位购水统计表"; if (strWellNo.Trim() == "") { if (strUserName.Trim() == "") { //无查询条件sql2 strSql = String.Format("select tbSal.wellNo as Field1,depName as Field2,price as Field3,salMony as Field4,salAmount as Field5,salPer as Field6,time as Field7 from tbSal,tbWell where (cast(floor(cast(time as float)) as datetime) between '{0}' and '{1}') and tbSal.wellNo=tbWell.wellNo order by time", strFrom, strTo); } else { //操作员统计sql3***** strSql = String.Format("select tbSal.wellNo as Field1,depName as Field2,price as Field3,salMony as Field4,salAmount as Field5,salPer as Field6,time as Field7 from tbSal,tbWell where (cast(floor(cast(time as float)) as datetime) between '{0}' and '{1}') and tbSal.wellNo=tbWell.wellNo and tbSal.salPer='{2}' order by time", strFrom, strTo, strUserName); strTitle = "操作员售水统计表"; } } //************************************** //统计合计 DataTable dt = null; CDBConnection.getDataTable(ref dt, strSql, "tbSalWater"); double iSalAmount = 0, iSalMony = 0; for (int i = 0; i < dt.Rows.Count; i++) { iSalAmount = iSalAmount + Convert.ToDouble(dt.Rows[i]["Field5"]); iSalMony = iSalMony + Convert.ToDouble(dt.Rows[i]["Field4"]); } DataRow dr = dt.NewRow(); dr["Field1"] = "合计"; dr["Field4"] = iSalMony.ToString(); dr["Field5"] = iSalAmount.ToString(); dt.Rows.Add(dr); //************************ //报表显示 string strTime = String.Format("时间范围:{0}至{1}", strFrom, strTo); string[] strText = new string[7]; strText[0] = "监测站编号"; strText[1] = "单位名称"; strText[2] = "售水单价"; strText[3] = "售水金额"; strText[4] = "售水量"; strText[5] = "售水人"; strText[6] = "售水时间"; printDoc.crpPrint crpPrintObj = new BengZhan.printDoc.crpPrint(); CrystalDecisions.CrystalReports.Engine.TextObject toTitle = (CrystalDecisions.CrystalReports.Engine.TextObject)crpPrintObj.ReportDefinition.ReportObjects["txtTime"]; toTitle.Text = strTime; toTitle = (CrystalDecisions.CrystalReports.Engine.TextObject)crpPrintObj.ReportDefinition.ReportObjects["txtTitle"]; if (strTitle != "") { toTitle.Text = strTitle; } for (int i = 0; i < 7; i++) { int iNum = i + 1; string strTextTitle = "Text" + iNum.ToString(); CrystalDecisions.CrystalReports.Engine.TextObject to = (CrystalDecisions.CrystalReports.Engine.TextObject)crpPrintObj.ReportDefinition.ReportObjects[strTextTitle]; to.Text = strText[i].ToString(); } crpPrintObj.SetDataSource(dt); this.crpSalWater.ReportSource = crpPrintObj; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
/// <summary> /// 根据传入的患者基本信息和查询日期检索费用明细 /// </summary> /// <param name="alPatient">患者信息(RADT.PatientInfo)</param> /// <param name="dtQuery">日期(datetime型)</param> public void queryPatientFee(ArrayList alPatient, DateTime dtQuery) { if (alPatient == null) { return; } string sDtFrom = dtQuery.ToShortDateString() + " 00:00:00"; string sDtTo = dtQuery.ToShortDateString() + " 23:59:59"; string sPrintDt = this.repMgr.GetDateTimeFromSysDateTime().ToString(); Report.InpatientFee.dsFeeList dsFeeList = new dsFeeList(); Neusoft.NFC.Object.NeuObject obj; try { foreach (Neusoft.HISFC.Object.RADT.PatientInfo patientInfo in alPatient) { DataSet ds = this.repMgr.GetPatientDuimalFee(patientInfo.ID, sDtFrom, sDtTo); //取那一时刻(end)的费用情况 obj = this.repMgr.GetPatientFeeTot(patientInfo.ID, DateTime.Parse(sDtTo)); if (obj == null || ds == null) { MessageBox.Show("查询患者费用信息出错" + this.repMgr.Err); return; } decimal decTotCost = Neusoft.NFC.Function.NConvert.ToDecimal(ds.Tables[0].Compute("sum(TOT_COST)", "").ToString()); decimal decOwnCost = Neusoft.NFC.Function.NConvert.ToDecimal(ds.Tables[0].Compute("sum(OWNCOST)", "").ToString()); decimal decPayCost = Neusoft.NFC.Function.NConvert.ToDecimal(ds.Tables[0].Compute("sum(PAYCOST)", "").ToString()); decimal decPubCost = Neusoft.NFC.Function.NConvert.ToDecimal(ds.Tables[0].Compute("sum(PUBCOST)", "").ToString()); ////广州医保 //if (patientInfo.Patient.Pact.ID == "2") //{ // decimal decSiPub = 0; // decimal decSiOwn = 0; // decimal decSiRealPub = 0; // decimal decSiRealOwn = 0; // string sErr = ""; // if(this.siMgr.ExecutePackage(patientInfo.ID, // DateTime.MinValue, // Neusoft.NFC.Function.NConvert.ToDateTime(sDtTo), // ref decSiOwn, // ref decSiPub, // ref decSiRealOwn, // ref decSiRealPub, // ref sErr ) == -1) // { // MessageBox.Show("计算医保费用出错" + Err); // return; // } // decSiPub = System.Convert.ToDecimal(obj.ID) - decSiOwn; // obj.User01 = decSiPub.ToString(); // obj.Name = decSiOwn.ToString(); //} foreach (DataRow row in ds.Tables[0].Rows) { DataRow newRow = dsFeeList.Tables[0].NewRow(); newRow[0] = row[1]; //分类, newRow[1] = row[0]; //项目名称, newRow[2] = row[9]; //规格, newRow[3] = row[2]; //单价, newRow[4] = row[3]; //数量, newRow[5] = row[4]; //单位, newRow[6] = row[5]; //金额, newRow[7] = row[6]; //自费, newRow[8] = row[7]; //自付, newRow[9] = row[8]; //公费, newRow[10] = patientInfo.PID.ID; //住院号, newRow[11] = patientInfo.Name; //姓名, newRow[12] = patientInfo.PVisit.PatientLocation.Dept.Name; //病区, newRow[13] = patientInfo.PVisit.PatientLocation.Bed.Name; //床号, newRow[14] = Neusoft.NFC.Function.NConvert.ToDecimal(obj.ID); newRow[15] = Neusoft.NFC.Function.NConvert.ToDecimal(obj.User01); //info.Fee.Pub_Cost;// 总公费, newRow[16] = Neusoft.NFC.Function.NConvert.ToDecimal(obj.User02); //info.Fee.Balance_Cost;// 已清费用, newRow[17] = Neusoft.NFC.Function.NConvert.ToDecimal(obj.Name); //info.Fee.Own_Cost+info.Fee.Pay_Cost;// 未清费用, newRow[18] = Neusoft.NFC.Function.NConvert.ToDecimal(obj.User03); //info.Fee.Prepay_Cost;// 预交金, newRow[19] = Neusoft.NFC.Function.NConvert.ToDecimal(obj.User03) - Neusoft.NFC.Function.NConvert.ToDecimal(obj.Name); // 结余, newRow[20] = decTotCost; //今天发生, newRow[21] = decPubCost; //今天公费, newRow[22] = decPayCost + decOwnCost; //应交 newRow[23] = dtQuery; newRow[24] = patientInfo.PVisit.PatientLocation.Dept.ID; //病区代码 newRow[25] = row[10]; dsFeeList.Tables[0].Rows.Add(newRow); } } CrystalDecisions.CrystalReports.Engine.TextObject printTime = cr.ReportDefinition.ReportObjects["txtPrintDate"] as CrystalDecisions.CrystalReports.Engine.TextObject; if (printTime != null) { printTime.Text = sPrintDt; } rep.ReportView.ShowCloseButton = false; rep.ReportView.ShowPageNavigateButtons = true; rep.ReportView.ShowRefreshButton = false; rep.ReportView.ShowTextSearchButton = true; rep.ShowReportOnce(this.panel1, cr, dsFeeList.Tables[0]); ReportrowsCount = dsFeeList.Tables[0].Rows.Count; } catch (Exception e) { MessageBox.Show(e.Message); return; } }