public void addTrinhKy_OnFormLoad() { //Ham nay XuanDT them vao try { //doan gan cac bien: doan nay co the phai thay doi ten bien cho phu hop mv_oRptDoc = RptDoc; mv_oViewDoc = this.crptViewer; //ket thuc doan gan bien mv_oRptFieldObj = mv_oRptDoc.ReportDefinition.ReportObjects["Field150181"] as FieldObject; mv_oNguoiKy = new cls_SignInfor(mv_oRptDoc.ToString(), ""); //chkPrint_CheckedChanged(chkPrint, New System.EventArgs) if (mv_oNguoiKy._TonTai) { mv_oNguoiKy.setValueToRPT(ref mv_oRptFieldObj); if (mv_bSetContent) { mv_oRptDoc.DataDefinition.FormulaFields["Formula_1"].Text = Strings.Chr(34) + mv_oNguoiKy.mv_NOI_DUNG.Replace("&NHANVIEN", globalVariables.gv_sStaffName).Replace("#$X$#", Strings.Chr(34) + "&Chr(13)&" + Strings.Chr(34)) + Strings.Chr(34); } else { mv_oRptDoc.DataDefinition.FormulaFields["Formula_1"].Text = ""; } mv_oViewDoc.ReportSource = RptDoc; } else { mv_oNguoiKy = new cls_SignInfor(mv_oRptFieldObj, "", RptDoc.ToString(), mv_oRptDoc.DataDefinition.FormulaFields["Formula_1"].Text); } } catch (Exception ex) { mv_oRptText = null; //an nut tuy chon di this.cmdTrinhKy.Visible = false; } }
private void button1_Click(object sender, System.EventArgs e) { ReportDocument rd = new ReportDocument(); rd.Load("crp2.rpt"); DataTable dt = new DataTable(); dt.Columns.Add("field1"); dt.Columns.Add("field2"); dt.Columns.Add("field3"); dt.Columns.Add("field4"); dt.Columns.Add("field5"); dt.Columns.Add("field6"); dt.Columns.Add("field7"); dt.Columns.Add("field8"); dt.TableName = "tbRep"; DataRow dr = dt.NewRow(); dr["field1"] = "hello"; dt.Rows.Add(dr); CrystalDecisions.CrystalReports.Engine.TextObject ReportTextPrintDate = (CrystalDecisions.CrystalReports.Engine.TextObject)rd.ReportDefinition.ReportObjects["Text1"]; ReportTextPrintDate.Text = "thank god"; this.crystalReportViewer1.ReportSource = rd; }
private void showReport(DataSet ds) { CrystalReportViewer reportViewer = new CrystalReportViewer(); InvoiceWithoutPicture invoiceWithoutPictureReport = new InvoiceWithoutPicture(); invoiceWithoutPictureReport.SetDataSource(ds); //invoiceWithPictureReport.SetDataSource(ds.Tables[1]); //invoiceWithPictureReport.SetDataSource(ds.Tables[0]); List <string> customerList = getCustomerDetailByID(); if (customerList.Count > 0) { CrystalDecisions.CrystalReports.Engine.TextObject txtCustomerName = (CrystalDecisions.CrystalReports.Engine.TextObject)invoiceWithoutPictureReport.Section1.ReportObjects["txtName"]; CrystalDecisions.CrystalReports.Engine.TextObject txtCustomerAddress = (CrystalDecisions.CrystalReports.Engine.TextObject)invoiceWithoutPictureReport.Section1.ReportObjects["txtAddress"]; txtCustomerName.Text = customerList[0]; txtCustomerAddress.Text = customerList[1]; } CrystalDecisions.CrystalReports.Engine.TextObject txtInvoiceType = (CrystalDecisions.CrystalReports.Engine.TextObject)invoiceWithoutPictureReport.Section1.ReportObjects["txtInvoiceType"]; if (rdoOriginal.Checked) { txtInvoiceType.Text = rdoOriginal.Text; } else { txtInvoiceType.Text = rdoDuplicate.Text; } reportViewer.crystalReportViewer1.ReportSource = invoiceWithoutPictureReport; reportViewer.crystalReportViewer1.Refresh(); reportViewer.Visible = true; }
public void addTrinhKy_OnFormLoad() { try { LoadPrintNumberByReportCode(); mv_oRptFieldObj = GetTrinhky(this.crptViewer.ParameterFieldInfo); mv_oNguoiKy = new cls_SignInfor(string.IsNullOrEmpty(mv_sReportFileName) ? RptDoc.ToString() : mv_sReportFileName, ""); if (mv_oNguoiKy != null) { if (mv_oNguoiKy._TonTai) { this.Text += " Ton tai TK"; SetParamAgain(); } else { this.Text += " Ko Ton tai TK"; string sPvalue = ""; Utility.SetParameterValue(RptDoc, "txtTrinhky", sPvalue); } } else { Utility.ShowMsg("No Trình ký"); } this.crptViewer.ReportSource = RptDoc; } catch (Exception ex) { mv_oRptText = null; Utility.CatchException("addTrinhKy_OnFormLoad-->", ex); this.cmdTrinhKy.Visible = false; } }
private void ms_SetPositionForTextObj(string pv_sName) { try { CrystalDecisions.CrystalReports.Engine.TextObject sv_oRptText = default(CrystalDecisions.CrystalReports.Engine.TextObject); sv_oRptText = mv_oRptDoc.ReportDefinition.ReportObjects[pv_sName] as TextObject; sv_oRptText.Top = mv_oRptFieldObj.Top + mv_oRptFieldObj.Height + 5; } catch (Exception ex) { } }
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 SearchText = ""; rpt.FileName = Server.MapPath("rptDeposit.rpt"); DayCareBAL.FamilyPaymentService proxyPayment = new DayCareBAL.FamilyPaymentService(); if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && String.IsNullOrEmpty(Request.QueryString["EndDate"])) { SearchText += " l.transactiondate>='" + Request.QueryString["StartDate"].ToString() + "'"; } if (String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"])) { SearchText += " l.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 += " l.transactiondate>='" + Request.QueryString["StartDate"].ToString() + "' and l.transactiondate<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00 AM", "11:59:58 PM") + "'"; } 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["Text14"]; CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text4"]; CrystalDecisions.CrystalReports.Engine.TextObject footer = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"]; footer.Text = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString())); titleText.Text = "Deposit Report From " + StartDate + " To " + EndDate; titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper(); ds = proxyPayment.LoadPaymentDeposits(SearchText, new Guid(Session["CurrentSchoolYearId"].ToString())); dsReport.Tables["dtDiposit"].Merge(ds.Tables[0]); rpt1.SetDataSource(dsReport.Tables["dtDiposit"]); crp.DisplayGroupTree = false; crp.ReportSource = rpt1; crp.RefreshReport(); crp.DataBind(); }
private void showPhotoReport(DataSet ds) { CrystalReportViewer reportViewer = new CrystalReportViewer(); StockSummaryReportWithPicture stockSummaryReport = new StockSummaryReportWithPicture(); stockSummaryReport.SetDataSource(ds.Tables[0]); CrystalDecisions.CrystalReports.Engine.TextObject txtReportDate = (CrystalDecisions.CrystalReports.Engine.TextObject)stockSummaryReport.Section1.ReportObjects["txtReportDate"]; txtReportDate.Text = txtReportDate.Text + dtDate.Value.ToShortDateString(); reportViewer.crystalReportViewer1.ReportSource = stockSummaryReport; reportViewer.crystalReportViewer1.Refresh(); reportViewer.Visible = true; }
public void addTrinhKy_OnFormLoad() { //Ham nay XuanDT them vao try { //doan gan cac bien: doan nay co the phai thay doi ten bien cho phu hop mv_oRptDoc = RptDoc; mv_oViewDoc = this.crptViewer; //ket thuc doan gan bien mv_oRptFieldObj = GetTrinhky(RptDoc.ParameterFields); // if (mv_oRptFieldObj == null) return; mv_oNguoiKy = new cls_SignInfor(string.IsNullOrEmpty(crptTrinhKyName) ? mv_oRptDoc.ToString() : crptTrinhKyName, ""); //chkPrint_CheckedChanged(chkPrint, New System.EventArgs) if (mv_oNguoiKy._TonTai) { SetParamAgain(RptDoc.ParameterFields); //if (mv_bSetContent) //{ // mv_oRptDoc.ReportDefinition.ReportObjects["txtTrinhky"]..Text = mv_oNguoiKy.mv_NOI_DUNG.Replace("&NHANVIEN", globalVariables.gv_strTenNhanvien); //} //else //{ // mv_oRptDoc.DataDefinition.FormulaFields["Formula_1"].Text = ""; //} } else { SetParamAgain(RptDoc.ParameterFields); if (string.IsNullOrEmpty(crptTrinhKyName)) { mv_oNguoiKy = new cls_SignInfor(mv_oRptFieldObj, "", RptDoc.ToString(), ""); } else { mv_oNguoiKy = new cls_SignInfor(mv_oRptFieldObj, "", crptTrinhKyName, ""); } } mv_oViewDoc.ReportSource = RptDoc; } catch (Exception ex) { mv_oRptText = null; //an nut tuy chon di log.Error("Loi trong qua trinh load thong tin trih ky={0}", ex); this.cmdTrinhKy.Visible = false; } }
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["ChildList"] != null) { //rpt.FileName = Server.MapPath("rptFamilyChildListReport.rpt"); rpt.FileName = Server.MapPath("rptChildDataListReport.rpt"); DayCareBAL.ChildListService proxy = new DayCareBAL.ChildListService(); SearchStr += Session["ChildList"].ToString(); SearchStr = Session["ChildList"].ToString().Replace("'00000000-0000-0000-0000-000000000000',", ""); 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.GetChildList(new Guid(Session["SchoolId"].ToString()), new Guid(Session["CurrentSchoolYearId"].ToString()), SearchStr); dsReport.Tables["dtChildDataList"].Merge(ds.Tables[0]); rpt1.SetDataSource(dsReport.Tables["dtChildDataList"]); } crp.DisplayGroupTree = false; crp.ReportSource = rpt1; crp.RefreshReport(); crp.DataBind(); } catch (Exception ex) { DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.Ledger, "rptChildDataListReport.rpt Page_Load", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT); } }
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(); DataSet dsForReport = new DataSet(); DataTable dt = new DataTable(); //strConnection = ConfigurationSettings.AppSettings["8CA767A0-5E36-4343-8B1D-5ECC40EB9E1B"]; strConnection = ConfigurationSettings.AppSettings[Session["SchoolId"].ToString()]; if (!String.IsNullOrEmpty(Request.QueryString["StartDate"])) { StartDate = Request.QueryString["StartDate"].ToString(); } if (!String.IsNullOrEmpty(Request.QueryString["EndDate"])) { EndDate = Request.QueryString["EndDate"].ToString(); } if (!String.IsNullOrEmpty(Request.QueryString["ChildFamilyId"])) { ViewState["ChildFamilyId"] = new Guid(Request.QueryString["ChildFamilyId"].ToString()); } if (!String.IsNullOrEmpty(ViewState["ChildFamilyId"].ToString())) { if (string.IsNullOrEmpty(StartDate) && string.IsNullOrEmpty(EndDate)) { rpt.FileName = Server.MapPath("rptLedgerOfFamily.rpt"); DayCarePL.LedgerProperties objLedger = new DayCarePL.LedgerProperties(); DayCareBAL.LedgerService proxyLedger = new DayCareBAL.LedgerService(); CrystalDecisions.CrystalReports.Engine.TextObject titleText = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text9"]; CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text5"]; CrystalDecisions.CrystalReports.Engine.TextObject LedgerEIN = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text15"]; CrystalDecisions.CrystalReports.Engine.TextObject footer = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"]; footer.Text = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString())); if (!string.IsNullOrEmpty(strConnection)) { LedgerEIN.Text = "EIN#: " + strConnection; } //titleText.Text = "Ledger Of Family report as on " + Convert.ToDateTime(StartDate).ToShortDateString() + " to " + Convert.ToDateTime(EndDate).ToShortDateString(); titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper(); ds = proxyLedger.LoadLedgerOfFamily(new Guid(Session["CurrentSchoolYearId"].ToString()), new Guid(ViewState["ChildFamilyId"].ToString())); List <DayCarePL.ClosingBalance> lstOpeningBalance = proxyLedger.GetPreviousYearClosingBalance(new Guid(ViewState["ChildFamilyId"].ToString()), new Guid(Session["CurrentSchoolYearId"].ToString())); if (ds != null && ds.Tables.Count > 0) { try { titleText.Text = "Ledger of Family Report for period:" + Convert.ToDateTime(ds.Tables[0].Rows[0]["TransactionDate"].ToString()).ToShortDateString() + " to " + Convert.ToDateTime(ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["TransactionDate"].ToString()).ToShortDateString(); } catch { } } if (ds != null && ds.Tables.Count > 0 && lstOpeningBalance != null)// && lstOpeningBalance.Count > 0) { DataRow dr = ds.Tables[0].NewRow(); //dr["Id"] = DBNull.Value; //dr["SchoolYearId"] = Session["CurrentSchoolYearId"].ToString(); //dr["ChildFamilyId"] = ViewState["ChildFamilyId"].ToString(); //dr["PaymentId"] = ""; //dr["TransactionDate"] = ""; //dr["Detail"] = ""; //dr["ChildDataId"] = ""; dr["Comment"] = "OPENING BALANCE :"; if (ds.Tables[0].Rows.Count > 0) { dr["FamilyTitle"] = ds.Tables[0].Rows[0]["FamilyTitle"].ToString(); } else { dr["FamilyTitle"] = Common.GetFamilyName(new Guid(ViewState["ChildFamilyId"].ToString())); } //dr["Debit"] = ""; //dr["Credit"] = ""; dr["Balance"] = lstOpeningBalance.Sum(i => i.ClosingBalanceAmount); ds.Tables[0].Rows.InsertAt(dr, 0); } decimal debit = 0; decimal credit = 0; decimal balance = 0; int i1 = 0; if (lstOpeningBalance != null)// && lstOpeningBalance.Count > 0) { i1 = 1; balance = lstOpeningBalance.Sum(i => i.ClosingBalanceAmount); } for (int i = i1; i < ds.Tables[0].Rows.Count; i++) { debit = Convert.ToDecimal(ds.Tables[0].Rows[i]["Debit"].ToString()); if (debit > 0) { balance += debit; } else { credit = Convert.ToDecimal(ds.Tables[0].Rows[i]["Credit"].ToString()); balance -= credit; } ds.Tables[0].Rows[i]["Balance"] = balance; } dsReport.Tables["dtLedgerOfFamily"].Merge(ds.Tables[0]); rpt1.SetDataSource(dsReport.Tables["dtLedgerOfFamily"]); } else { rpt.FileName = Server.MapPath("rptLedgerOfFamily.rpt"); DayCarePL.LedgerProperties objLedger = new DayCarePL.LedgerProperties(); DayCareBAL.LedgerService proxyLedger = new DayCareBAL.LedgerService(); CrystalDecisions.CrystalReports.Engine.TextObject titleText = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text9"]; CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text5"]; CrystalDecisions.CrystalReports.Engine.TextObject LedgerEIN = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text15"]; if (!string.IsNullOrEmpty(strConnection)) { LedgerEIN.Text = "EIN#: " + strConnection; } titleText.Text = "Ledger of Family Report for period: " + Convert.ToDateTime(StartDate).ToShortDateString() + " to " + Convert.ToDateTime(EndDate).ToShortDateString(); titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper(); ds = proxyLedger.LoadLedgerOfFamily(new Guid(Session["CurrentSchoolYearId"].ToString()), new Guid(ViewState["ChildFamilyId"].ToString())); if (ds != null && ds.Tables.Count > 0) { DataView dv = ds.Tables[0].DefaultView; dv.Sort = "TransactionDate ASC"; } List <DayCarePL.ClosingBalance> lstOpeningBalance = proxyLedger.GetPreviousYearClosingBalance(new Guid(ViewState["ChildFamilyId"].ToString()), new Guid(Session["CurrentSchoolYearId"].ToString())); if (ds != null && lstOpeningBalance != null) { //DataRow dr = ds.Tables[0].NewRow(); DataColumn Id = new DataColumn("Id", typeof(System.Guid)); dt.Columns.Add(Id); DataColumn SchoolYearId = new DataColumn("SchoolYearId", typeof(System.Guid)); dt.Columns.Add(SchoolYearId); DataColumn ChildFamilyId = new DataColumn("ChildFamilyId", typeof(System.Guid)); dt.Columns.Add(ChildFamilyId); DataColumn PaymentId = new DataColumn("PaymentId", typeof(System.Guid)); dt.Columns.Add(PaymentId); DataColumn TransactionDate = new DataColumn("TransactionDate", typeof(System.DateTime)); dt.Columns.Add(TransactionDate); DataColumn Detail = new DataColumn("Detail", typeof(System.String)); dt.Columns.Add(Detail); DataColumn ChildDataId = new DataColumn("ChildDataId", typeof(System.Guid)); dt.Columns.Add(ChildDataId); DataColumn Comment = new DataColumn("Comment", typeof(System.String)); dt.Columns.Add(Comment); DataColumn FamilyTitle = new DataColumn("FamilyTitle", typeof(System.String)); dt.Columns.Add(FamilyTitle); DataColumn Debit = new DataColumn("Debit", typeof(System.Decimal)); dt.Columns.Add(Debit); DataColumn Credit = new DataColumn("Credit", typeof(System.Decimal)); dt.Columns.Add(Credit); DataColumn Balance = new DataColumn("Balance", typeof(System.Decimal)); dt.Columns.Add(Balance); DataColumn PaymentMethodOrCharges = new DataColumn("PaymentMethodOrCharges", typeof(System.String)); dt.Columns.Add(PaymentMethodOrCharges); DataRow dr = dt.NewRow(); //dr["Id"] = DBNull.Value; //dr["SchoolYearId"] = Session["CurrentSchoolYearId"].ToString(); //dr["ChildFamilyId"] = ViewState["ChildFamilyId"].ToString(); //dr["PaymentId"] = ""; //dr["TransactionDate"] = ""; //dr["Detail"] = ""; //dr["ChildDataId"] = ""; dr["Comment"] = "OPENING BALANCE :"; if (ds.Tables[0].Rows.Count > 0) { dr["FamilyTitle"] = ds.Tables[0].Rows[0]["FamilyTitle"].ToString(); } else { dr["FamilyTitle"] = Common.GetFamilyName(new Guid(ViewState["ChildFamilyId"].ToString())); } //dr["Debit"] = ""; //dr["Credit"] = ""; dr["Balance"] = lstOpeningBalance.Sum(i => i.ClosingBalanceAmount); //ds.Tables[0].Rows.InsertAt(dr, 0); dt.Rows.Add(dr); dsForReport.Tables.Add(dt); //dsForReport.Tables[0].Rows.InsertAt(dr, 0); } //else //{ // //DataRow dr = ds.Tables[0].NewRow(); // DataColumn Id = new DataColumn("Id", typeof(System.Guid)); // dt.Columns.Add(Id); // DataColumn SchoolYearId = new DataColumn("SchoolYearId", typeof(System.Guid)); // dt.Columns.Add(SchoolYearId); // DataColumn ChildFamilyId = new DataColumn("ChildFamilyId", typeof(System.Guid)); // dt.Columns.Add(ChildFamilyId); // DataColumn PaymentId = new DataColumn("PaymentId", typeof(System.Guid)); // dt.Columns.Add(PaymentId); // DataColumn TransactionDate = new DataColumn("TransactionDate", typeof(System.DateTime)); // dt.Columns.Add(TransactionDate); // DataColumn Detail = new DataColumn("Detail", typeof(System.String)); // dt.Columns.Add(Detail); // DataColumn ChildDataId = new DataColumn("ChildDataId", typeof(System.Guid)); // dt.Columns.Add(ChildDataId); // DataColumn Comment = new DataColumn("Comment", typeof(System.String)); // dt.Columns.Add(Comment); // DataColumn FamilyTitle = new DataColumn("FamilyTitle", typeof(System.String)); // dt.Columns.Add(FamilyTitle); // DataColumn Debit = new DataColumn("Debit", typeof(System.Decimal)); // dt.Columns.Add(Debit); // DataColumn Credit = new DataColumn("Credit", typeof(System.Decimal)); // dt.Columns.Add(Credit); // DataColumn Balance = new DataColumn("Balance", typeof(System.Decimal)); // dt.Columns.Add(Balance); // DataColumn PaymentMethodOrCharges = new DataColumn("PaymentMethodOrCharges", typeof(System.String)); // dt.Columns.Add(PaymentMethodOrCharges); // //DataRow dr = dt.NewRow(); // //dr["Comment"] = "OPENING BALANCE :"; // //if (ds.Tables[0].Rows.Count > 0) // //{ // // dr["FamilyTitle"] = ds.Tables[0].Rows[0]["FamilyTitle"].ToString(); // //} // //else // //{ // // dr["FamilyTitle"] = Common.GetFamilyName(new Guid(ViewState["ChildFamilyId"].ToString())); // //} // //dr["Balance"] = lstOpeningBalance.Sum(i => i.ClosingBalanceAmount); // //dt.Rows.Add(dr); // dsForReport.Tables.Add(dt); //} decimal debit = 0; decimal credit = 0; decimal balance = 0; int i1 = 0; if (lstOpeningBalance != null) { //i1 = 1; balance = lstOpeningBalance.Sum(i => i.ClosingBalanceAmount); } for (int i = i1; i < ds.Tables[0].Rows.Count; i++) { if (Convert.ToDateTime(ds.Tables[0].Rows[i]["TransactionDate"].ToString()).Date <= Convert.ToDateTime(EndDate).Date) { debit = Convert.ToDecimal(ds.Tables[0].Rows[i]["Debit"].ToString()); if (debit > 0) { balance += debit; } else { credit = Convert.ToDecimal(ds.Tables[0].Rows[i]["Credit"].ToString()); balance -= credit; } } if (Convert.ToDateTime(ds.Tables[0].Rows[i]["TransactionDate"].ToString()).Date >= Convert.ToDateTime(StartDate).Date&& Convert.ToDateTime(ds.Tables[0].Rows[i]["TransactionDate"].ToString()).Date <= Convert.ToDateTime(EndDate).Date) { DataRow dr = dt.NewRow(); if (OpeningBalance == false) { if (debit > 0) { balance -= debit; } else { credit = Convert.ToDecimal(ds.Tables[0].Rows[i]["Credit"].ToString()); balance += credit; } if (dsForReport.Tables.Count > 0) { dsForReport.Tables[0].Rows[0]["Balance"] = balance; } OpeningBalance = true; if (debit > 0) { balance += debit; } else { credit = Convert.ToDecimal(ds.Tables[0].Rows[i]["Credit"].ToString()); balance -= credit; } } dr["Id"] = ds.Tables[0].Rows[i]["Id"].ToString(); dr["SchoolYearId"] = new Guid(Session["CurrentSchoolYearId"].ToString()); dr["ChildFamilyId"] = new Guid(ViewState["ChildFamilyId"].ToString()); // dr["PaymentId"] =new Guid( ds.Tables[0].Rows[i]["PaymentId"].ToString()); dr["TransactionDate"] = Convert.ToDateTime(ds.Tables[0].Rows[i]["TransactionDate"].ToString()); dr["Detail"] = ds.Tables[0].Rows[i]["Detail"].ToString(); //dr["ChildDataId"] =new Guid( ds.Tables[0].Rows[i]["ChildDataId"].ToString()); dr["Comment"] = ds.Tables[0].Rows[i]["Comment"].ToString(); dr["FamilyTitle"] = ds.Tables[0].Rows[0]["FamilyTitle"].ToString(); dr["Debit"] = Convert.ToDecimal(ds.Tables[0].Rows[i]["Debit"].ToString()); dr["Credit"] = Convert.ToDecimal(ds.Tables[0].Rows[i]["Credit"].ToString()); dr["Balance"] = balance; if (!string.IsNullOrEmpty(ds.Tables[0].Rows[i]["PaymentMethodOrCharges"].ToString())) { dr["PaymentMethodOrCharges"] = ds.Tables[0].Rows[i]["PaymentMethodOrCharges"].ToString(); } if (dsForReport.Tables.Count > 0) { dsForReport.Tables[0].Rows.Add(dr); } } //if (Convert.ToDateTime(ds.Tables[0].Rows[i]["TransactionDate"].ToString()).Date >= Convert.ToDateTime(StartDate).Date && Convert.ToDateTime(ds.Tables[0].Rows[i]["TransactionDate"].ToString()).Date <= Convert.ToDateTime(EndDate).Date) //{ // break; //} //ds.Tables[0].Rows[i]["Balance"] = balance; } if (dsForReport.Tables.Count == 0) { dsForReport.Tables.Add(dt); } if (OpeningBalance == false) { dsForReport.Tables[0].Rows[0]["Balance"] = balance; } dsReport.Tables["dtLedgerOfFamily"].Merge(dsForReport.Tables[0]); rpt1.SetDataSource(dsReport.Tables["dtLedgerOfFamily"]); } } crp.DisplayGroupTree = false; crp.ReportSource = rpt1; crp.RefreshReport(); crp.DataBind(); }
public void addTrinhKy_OnFormLoad() { //Ham nay XuanDT them vao try { //doan gan cac bien: doan nay co the phai thay doi ten bien cho phu hop mv_oRptDoc = RptDoc; mv_oViewDoc = this.crptViewer; //ket thuc doan gan bien mv_oRptFieldObj = GetTrinhky(RptDoc.ParameterFields); // if (mv_oRptFieldObj == null) return; mv_oNguoiKy = new cls_SignInfor(string.IsNullOrEmpty(crptTrinhKyName) ? mv_oRptDoc.ToString() : crptTrinhKyName, ""); //chkPrint_CheckedChanged(chkPrint, New System.EventArgs) if (mv_oNguoiKy._TonTai) { SetParamAgain(RptDoc.ParameterFields); //if (mv_bSetContent) //{ // mv_oRptDoc.ReportDefinition.ReportObjects["txtTrinhky"]..Text = mv_oNguoiKy.mv_NOI_DUNG.Replace("&NHANVIEN", globalVariables.gv_strTenNhanvien); //} //else //{ // mv_oRptDoc.DataDefinition.FormulaFields["Formula_1"].Text = ""; //} } else { SetParamAgain(RptDoc.ParameterFields); if (string.IsNullOrEmpty(crptTrinhKyName)) mv_oNguoiKy = new cls_SignInfor(mv_oRptFieldObj, "", RptDoc.ToString(), ""); else { mv_oNguoiKy = new cls_SignInfor(mv_oRptFieldObj, "", crptTrinhKyName, ""); } } mv_oViewDoc.ReportSource = RptDoc; } catch (Exception ex) { mv_oRptText = null; //an nut tuy chon di log.Error("Loi trong qua trinh load thong tin trih ky={0}", ex); this.cmdTrinhKy.Visible = false; } }
protected void Page_Init(object sender, EventArgs e) { #region if (Session["CurrentSchoolYearId"] == null) { Response.Redirect("~/Login.aspx"); } crdata.Report = rpt; rpt1 = crdata.ReportDocument; DataSet dsReport = new xmlClassWiseStudentAttendTime(); DataSet ds = new DataSet(); if (Request.QueryString["RepId"] == "Staff") { if (!String.IsNullOrEmpty(Session["StaffResult"].ToString())) { rpt.FileName = Server.MapPath("rptStaffAttendanceReport.rpt"); DayCareBAL.StaffService proxyAttendance = new DayCareBAL.StaffService(); string ReportFor = ""; ReportFor = "Staff"; string SearchText = ""; string SearchStr = ""; string SchoolYear = ""; if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && String.IsNullOrEmpty(Request.QueryString["EndDate"])) { SearchText += " sah.checkincheckoutdatetime>='" + Request.QueryString["StartDate"].ToString() + "'"; // SchoolYear += "and ssy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'"; if (Session["StaffResult"] != null) { SearchStr += "Name in(" + Session["StaffResult"].ToString() + ")"; } } else if (String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"])) { SearchText += " sah.checkincheckoutdatetime<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00 PM", "11:59:58") + "'"; // SchoolYear += "and ssy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'"; if (Session["StaffResult"] != null) { SearchStr += "Name in(" + Session["StaffResult"].ToString() + ")"; } } else if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"])) { SearchText += " sah.checkincheckoutdatetime>='" + Request.QueryString["StartDate"].ToString() + "' and sah.checkincheckoutdatetime<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00", "11:59:58") + "'"; //SchoolYear += "and ssy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'"; if (!String.IsNullOrEmpty(Session["StaffResult"].ToString())) { SearchStr += "Name in(" + Session["StaffResult"].ToString() + ")"; } } if (String.IsNullOrEmpty(Request.QueryString["EndDate"]) && String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Session["StaffResult"].ToString())) { SearchStr += "Name in(" + Session["StaffResult"].ToString() + ")"; } SearchStr = Session["StaffResult"].ToString().Replace("'--Select All--',", ""); 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 = "Name in(" + strFinalSearhString.Remove(strFinalSearhString.Length - 1) + ")"; ds = proxyAttendance.LoadAttendanceHistory1(SearchText, strFinalSearhString, new Guid(Session["CurrentSchoolYearId"].ToString())); dsReport.Tables["dtAttendance"].Merge(ds.Tables[0]); } else { rpt.FileName = Server.MapPath("rptStaffAttendanceReport.rpt"); DayCareBAL.StaffService proxyAttendance = new DayCareBAL.StaffService(); string ReportFor = ""; ReportFor = "Staff"; string SearchText = ""; string SearchStr = ""; string SchoolYear = ""; if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && String.IsNullOrEmpty(Request.QueryString["EndDate"])) { SearchText += " sah.checkincheckoutdatetime>='" + Request.QueryString["StartDate"].ToString() + "'"; // SchoolYear += "and ssy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'"; } else if (String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"])) { SearchText += " sah.checkincheckoutdatetime<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00 PM", "11:59:58") + "'"; // SchoolYear += "and ssy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'"; } else if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"])) { SearchText += " sah.checkincheckoutdatetime>='" + Request.QueryString["StartDate"].ToString() + "' and sah.checkincheckoutdatetime<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00", "11:59:58") + "'"; //SchoolYear += "and ssy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'"; } ds = proxyAttendance.LoadAttendanceHistory1(SearchText, SearchStr, new Guid(Session["CurrentSchoolYearId"].ToString())); dsReport.Tables["dtAttendance"].Merge(ds.Tables[0]); } CrystalDecisions.CrystalReports.Engine.TextObject titleText = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text7"]; CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text8"]; CrystalDecisions.CrystalReports.Engine.TextObject footer = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"]; footer.Text = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString())); if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"])) { titleText.Text = "Staff Attendance Report From " + Convert.ToDateTime(Request.QueryString["StartDate"].ToString()).ToString("MM/dd/yyyy") + " To " + Convert.ToDateTime(Request.QueryString["EndDate"].ToString()).ToString("MM/dd/yyyy"); } titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper(); if (String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"])) { titleText.Text = "Staff Attendance Report From " + Convert.ToDateTime(Request.QueryString["StartDate"].ToString()).ToString("MM/dd/yyyy"); } titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper(); if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && String.IsNullOrEmpty(Request.QueryString["StartDate"])) { titleText.Text = "Staff Attendance Report To " + Convert.ToDateTime(Request.QueryString["EndDate"].ToString()).ToString("MM/dd/yyyy"); } titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper(); rpt1.SetDataSource(dsReport.Tables["dtAttendance"]); } if (Request.QueryString["RepId"] == "Student") { if (!String.IsNullOrEmpty(Session["Result"].ToString())) { rpt.FileName = Server.MapPath("rptStudentAttendanceReport.rpt"); DayCareBAL.StaffService proxyAttendance = new DayCareBAL.StaffService(); string ReportFor = ""; ReportFor = "Student"; string SearchText = ""; string SearchStr = ""; string SchoolYear = ""; if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && String.IsNullOrEmpty(Request.QueryString["EndDate"])) { SearchText += " cah.checkincheckoutdatetime>='" + Request.QueryString["StartDate"].ToString() + "'"; // SchoolYear += "and csy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'"; if (Session["Result"] != null) { SearchStr += "Name in(" + Session["Result"].ToString() + ")"; } } else if (String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"])) { SearchText += " cah.checkincheckoutdatetime<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00 PM", "11:59:58") + "'"; // SchoolYear += "and csy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'"; if (Session["Result"] != null) { SearchStr += "Name in(" + Session["Result"].ToString() + ")"; } } else if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"])) { SearchText += " cah.checkincheckoutdatetime>='" + Request.QueryString["StartDate"].ToString() + "' and cah.checkincheckoutdatetime<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00", "11:59:58") + "'"; //SchoolYear += "and csy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'"; if (Session["Result"] != null) { SearchStr += "Name in(" + Session["Result"].ToString() + ")"; } } if (String.IsNullOrEmpty(Request.QueryString["EndDate"]) && String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Session["Result"].ToString())) { SearchStr += "Name in(" + Session["Result"].ToString() + ")"; } SearchStr = Session["Result"].ToString().Replace("'--Select All--',", ""); 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 = "Name in(" + strFinalSearhString.Remove(strFinalSearhString.Length - 1) + ")"; ds = proxyAttendance.LoadChildAttendanceHistory(SearchText, strFinalSearhString, new Guid(Session["CurrentSchoolYearId"].ToString())); if (ds.Tables.Count > 0) { dsReport.Tables["dtAttendance"].Merge(ds.Tables[0]); } } else { rpt.FileName = Server.MapPath("rptStudentAttendanceReport.rpt"); DayCareBAL.StaffService proxyAttendance = new DayCareBAL.StaffService(); string ReportFor = ""; ReportFor = "Student"; string SearchText = ""; string SearchStr = ""; string SchoolYear = ""; if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && String.IsNullOrEmpty(Request.QueryString["EndDate"])) { SearchText += " cah.checkincheckoutdatetime>='" + Request.QueryString["StartDate"].ToString() + "'"; // SchoolYear += "and csy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'"; } else if (String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"])) { SearchText += " cah.checkincheckoutdatetime<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00 PM", "11:59:58") + "'"; // SchoolYear += "and csy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'"; } else if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"])) { SearchText += " cah.checkincheckoutdatetime>='" + Request.QueryString["StartDate"].ToString() + "' and cah.checkincheckoutdatetime<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00", "11:59:58") + "'"; //SchoolYear += "and csy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'"; } ds = proxyAttendance.LoadChildAttendanceHistory(SearchText, SearchStr, new Guid(Session["CurrentSchoolYearId"].ToString())); dsReport.Tables["dtAttendance"].Merge(ds.Tables[0]); } CrystalDecisions.CrystalReports.Engine.TextObject titleText = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text7"]; CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text4"]; CrystalDecisions.CrystalReports.Engine.TextObject footer = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"]; footer.Text = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString())); if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"])) { titleText.Text = "Student Attendance Report From " + Convert.ToDateTime(Request.QueryString["StartDate"].ToString()).ToString("MM/dd/yyyy") + " To " + Convert.ToDateTime(Request.QueryString["EndDate"].ToString()).ToString("MM/dd/yyyy"); } titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper(); if (String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"])) { titleText.Text = "Student Attendance Report From " + Convert.ToDateTime(Request.QueryString["StartDate"].ToString()).ToString("MM/dd/yyyy"); } titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper(); if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && String.IsNullOrEmpty(Request.QueryString["StartDate"])) { titleText.Text = "Student Attendance Report To " + Convert.ToDateTime(Request.QueryString["EndDate"].ToString()).ToString("MM/dd/yyyy"); } titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper(); rpt1.SetDataSource(dsReport.Tables["dtAttendance"]); } if (Request.QueryString["RepId"] == "StudentDate") { rpt.FileName = Server.MapPath("rptStudentAttendanceByDate.rpt"); DayCareBAL.StaffService proxyAttendance = new DayCareBAL.StaffService(); string ReportFor = ""; ReportFor = "Student"; string SearchText = ""; string SearchStr = ""; string SchoolYear = ""; if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && String.IsNullOrEmpty(Request.QueryString["EndDate"])) { SearchText += " cah.checkincheckoutdatetime>='" + Request.QueryString["StartDate"].ToString() + "'"; // SchoolYear += "and csy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'"; } else if (String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"])) { SearchText += " cah.checkincheckoutdatetime<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00 PM", "11:59:58") + "'"; // SchoolYear += "and csy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'"; } else if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"])) { SearchText += " cah.checkincheckoutdatetime>='" + Request.QueryString["StartDate"].ToString() + "' and cah.checkincheckoutdatetime<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00", "11:59:58") + "'"; //SchoolYear += "and csy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'"; } ds = proxyAttendance.LoadChildAttendanceHistory(SearchText, SearchStr, new Guid(Session["CurrentSchoolYearId"].ToString())); dsReport.Tables["dtAttendance"].Merge(ds.Tables[0]); CrystalDecisions.CrystalReports.Engine.TextObject titleText = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text2"]; CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text8"]; CrystalDecisions.CrystalReports.Engine.TextObject footer = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"]; footer.Text = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString())); if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"])) { titleText.Text = "Student Attendance Report From " + Convert.ToDateTime(Request.QueryString["StartDate"].ToString()).ToString("MM/dd/yyyy") + " To " + Convert.ToDateTime(Request.QueryString["EndDate"].ToString()).ToString("MM/dd/yyyy"); } titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper(); if (String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"])) { titleText.Text = "Student Attendance Report From " + Convert.ToDateTime(Request.QueryString["StartDate"].ToString()).ToString("MM/dd/yyyy"); } titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper(); if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && String.IsNullOrEmpty(Request.QueryString["StartDate"])) { titleText.Text = "Student Attendance Report To " + Convert.ToDateTime(Request.QueryString["EndDate"].ToString()).ToString("MM/dd/yyyy"); } titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper(); rpt1.SetDataSource(dsReport.Tables["dtAttendance"]); } if (Request.QueryString["RepId"] == "StudentClass") { rpt.FileName = Server.MapPath("rptStudentAttendanceByClassName.rpt"); DayCareBAL.StaffService proxyAttendance = new DayCareBAL.StaffService(); string ReportFor = ""; ReportFor = "Student"; string SearchText = ""; string SearchStr = ""; string SchoolYear = ""; if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && String.IsNullOrEmpty(Request.QueryString["EndDate"])) { SearchText += " cah.checkincheckoutdatetime>='" + Request.QueryString["StartDate"].ToString() + "'"; // SchoolYear += "and csy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'"; } else if (String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"])) { SearchText += " cah.checkincheckoutdatetime<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00 PM", "11:59:58") + "'"; // SchoolYear += "and csy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'"; } else if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"])) { SearchText += " cah.checkincheckoutdatetime>='" + Request.QueryString["StartDate"].ToString() + "' and cah.checkincheckoutdatetime<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00", "11:59:58") + "'"; //SchoolYear += "and csy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'"; } ds = proxyAttendance.LoadChildAttendanceHistory(SearchText, SearchStr, new Guid(Session["CurrentSchoolYearId"].ToString())); dsReport.Tables["dtAttendance"].Merge(ds.Tables[0]); CrystalDecisions.CrystalReports.Engine.TextObject titleText = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text2"]; 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())); if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"])) { titleText.Text = "Student Attendance Report From " + Convert.ToDateTime(Request.QueryString["StartDate"].ToString()).ToString("MM/dd/yyyy") + " To " + Convert.ToDateTime(Request.QueryString["EndDate"].ToString()).ToString("MM/dd/yyyy"); } titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper(); if (String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"])) { titleText.Text = "Student Attendance Report From " + Convert.ToDateTime(Request.QueryString["StartDate"].ToString()).ToString("MM/dd/yyyy"); } titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper(); if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && String.IsNullOrEmpty(Request.QueryString["StartDate"])) { titleText.Text = "Student Attendance Report To " + Convert.ToDateTime(Request.QueryString["EndDate"].ToString()).ToString("MM/dd/yyyy"); } titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper(); rpt1.SetDataSource(dsReport.Tables["dtAttendance"]); } if (Request.QueryString["RepId"] == "StaffDate") { rpt.FileName = Server.MapPath("rptStaffAttendanceByDate.rpt"); DayCareBAL.StaffService proxyAttendance = new DayCareBAL.StaffService(); string ReportFor = ""; ReportFor = "Staff"; string SearchText = ""; string SearchStr = ""; string SchoolYear = ""; if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && String.IsNullOrEmpty(Request.QueryString["EndDate"])) { SearchText += " sah.checkincheckoutdatetime>='" + Request.QueryString["StartDate"].ToString() + "'"; // SchoolYear += "and ssy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'"; // } else if (String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"])) { SearchText += " sah.checkincheckoutdatetime<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00 PM", "11:59:58") + "'"; // SchoolYear += "and ssy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'"; } else if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"])) { SearchText += " sah.checkincheckoutdatetime>='" + Request.QueryString["StartDate"].ToString() + "' and sah.checkincheckoutdatetime<='" + Request.QueryString["EndDate"].ToString().Replace("00:00:00", "11:59:58") + "'"; //SchoolYear += "and ssy.SchoolYearId='" + new Guid(Session["CurrentSchoolYearId"].ToString()) + "'"; } ds = proxyAttendance.LoadAttendanceHistory1(SearchText, SearchStr, new Guid(Session["CurrentSchoolYearId"].ToString())); dsReport.Tables["dtAttendance"].Merge(ds.Tables[0]); CrystalDecisions.CrystalReports.Engine.TextObject titleText = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text7"]; CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text2"]; CrystalDecisions.CrystalReports.Engine.TextObject footer = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"]; footer.Text = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString())); if (!String.IsNullOrEmpty(Request.QueryString["StartDate"]) && !String.IsNullOrEmpty(Request.QueryString["EndDate"])) { titleText.Text = "Staff Attendance Report From " + Convert.ToDateTime(Request.QueryString["StartDate"].ToString()).ToString("MM/dd/yyyy") + " To " + Convert.ToDateTime(Request.QueryString["EndDate"].ToString()).ToString("MM/dd/yyyy"); } titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper(); if (String.IsNullOrEmpty(Request.QueryString["EndDate"]) && !String.IsNullOrEmpty(Request.QueryString["StartDate"])) { titleText.Text = "Staff Attendance Report From " + Convert.ToDateTime(Request.QueryString["StartDate"].ToString()).ToString("MM/dd/yyyy"); } titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper(); if (!String.IsNullOrEmpty(Request.QueryString["EndDate"]) && String.IsNullOrEmpty(Request.QueryString["StartDate"])) { titleText.Text = "Staff Attendance Report To " + Convert.ToDateTime(Request.QueryString["EndDate"].ToString()).ToString("MM/dd/yyyy"); } titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper(); rpt1.SetDataSource(dsReport.Tables["dtAttendance"]); } crp.DisplayGroupTree = false; crp.ReportSource = rpt1; crp.RefreshReport(); crp.DataBind(); #endregion }
public void addTrinhKy_OnFormLoad() { //Ham nay XuanDT them vao try { //doan gan cac bien: doan nay co the phai thay doi ten bien cho phu hop mv_oRptDoc = RptDoc; mv_oViewDoc = this.crptViewer; //ket thuc doan gan bien mv_oRptFieldObj = mv_oRptDoc.ReportDefinition.ReportObjects["Field150181"] as FieldObject; mv_oNguoiKy = new cls_SignInfor(mv_oRptDoc.ToString(), ""); //chkPrint_CheckedChanged(chkPrint, New System.EventArgs) if (mv_oNguoiKy._TonTai) { mv_oNguoiKy.setValueToRPT(ref mv_oRptFieldObj); if (mv_bSetContent) { mv_oRptDoc.DataDefinition.FormulaFields["Formula_1"].Text = Strings.Chr(34) + mv_oNguoiKy.mv_NOI_DUNG.Replace("&NHANVIEN", globalVariables. gv_sStaffName). Replace("#$X$#", Strings.Chr(34) + "&Chr(13)&" + Strings.Chr(34)) + Strings.Chr(34); } else { mv_oRptDoc.DataDefinition.FormulaFields["Formula_1"].Text = ""; } mv_oViewDoc.ReportSource = RptDoc; } else { mv_oNguoiKy = new cls_SignInfor(mv_oRptFieldObj, "", RptDoc.ToString(), mv_oRptDoc.DataDefinition.FormulaFields["Formula_1"].Text); } } catch (Exception ex) { mv_oRptText = null; //an nut tuy chon di log.Error("Loi trong qua trinh load thong tin trih ky={0}",ex); this.cmdTrinhKy.Visible = false; } }
private void CustomerStatement(ref int id) { ADODB.Recordset rsInterest = default(ADODB.Recordset); ADODB.Recordset rsCustTransCheck = default(ADODB.Recordset); ADODB.Recordset rsTransaction = default(ADODB.Recordset); ADODB.Recordset rsCompany = default(ADODB.Recordset); string lNumber = null; string lAddress = null; ADODB.Recordset rs = new ADODB.Recordset(); string sql = null; //Dim Report As New cryCustomerStatement_AGING 'cryCustomerStatement CrystalDecisions.CrystalReports.Engine.ReportDocument Report = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); Report.Load("cryCustomerStatement_AGING.rpt"); System.DateTime lDate = default(System.DateTime); rs = modRecordSet.getRS(ref "SELECT MonthEnd.MonthEnd_Date From MonthEnd WHERE (((MonthEnd.MonthEndID)=" + gMonth - (this.cmbMonthEnd.SelectedIndex - 1) + "));"); Report.SetParameterValue("txtStatementDate", Strings.Format(rs.Fields("MonthEnd_Date").Value, "dd mmm yyyy")); lDate = rs.Fields("MonthEnd_Date").Value; rs.Close(); rs = modRecordSet.getRS(ref "SELECT * FROM Company"); lDate = System.Date.FromOADate(lDate.ToOADate() + 10); lDate = System.Date.FromOADate(lDate.ToOADate() - DateAndTime.Day(lDate)) + rs.Fields("Company_PaymentDay").Value; if (chkFields.CheckState) { Report.SetParameterValue("txtPaymentDate", " "); Report.SetParameterValue("Text7", " "); } else { Report.SetParameterValue("txtPaymentDate", Strings.Format(lDate, "dd mmm yyyy")); } lAddress = Strings.Replace(rs.Fields("Company_PhysicalAddress").Value, Constants.vbCrLf, ", "); if (Strings.Right(lAddress, 2) == ", ") { lAddress = Strings.Left(lAddress, Strings.Len(lAddress) - 2); } Report.Database.Tables(1).SetDataSource(rs); Report.SetParameterValue("txtAddress", lAddress); lNumber = ""; if (!string.IsNullOrEmpty(rs.Fields("Company_Telephone").Value)) { lNumber = lNumber + "Tel: " + rs.Fields("Company_Telephone").Value; } if (!string.IsNullOrEmpty(rs.Fields("Company_Fax").Value)) { if (!string.IsNullOrEmpty(lNumber)) { lNumber = lNumber + " / "; } lNumber = lNumber + "Fax: " + rs.Fields("Company_Fax").Value; } if (!string.IsNullOrEmpty(rs.Fields("Company_Email").Value)) { if (!string.IsNullOrEmpty(lNumber)) { lNumber = lNumber + " / "; } lNumber = lNumber + "Email: " + rs.Fields("Company_Email").Value; } Report.SetParameterValue("txtNumbers", lNumber); //New banking details if (Information.IsDBNull(rs.Fields("Company_BankName").Value)) { } else { Report.SetParameterValue("txtBankName", rs.Fields("Company_BankName")); } if (Information.IsDBNull(rs.Fields("Company_BranchName").Value)) { } else { Report.SetParameterValue("txtBranchName", rs.Fields("Company_BranchName")); } if (Information.IsDBNull(rs.Fields("Company_BranchCode").Value)) { } else { Report.SetParameterValue("txtBranchCode", rs.Fields("Company_BranchCode")); } if (Information.IsDBNull(rs.Fields("Company_AccountNumber").Value)) { } else { Report.SetParameterValue("txtAccountNumber", rs.Fields("Company_AccountNumber")); } //................... rsCompany = new ADODB.Recordset(); rsCompany.Open("SELECT * FROM Customer Where CustomerID = " + id, cnnDBStatement, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText); Report.SetParameterValue("txtDaysCurr", "R " + Strings.FormatNumber(rsCompany("Customer_Current"), 2)); Report.SetParameterValue("txtDays30", "R " + Strings.FormatNumber(rsCompany("Customer_30Days"), 2)); Report.SetParameterValue("txtDays60", "R " + Strings.FormatNumber(rsCompany("Customer_60Days"), 2)); Report.SetParameterValue("txtDays90", "R " + Strings.FormatNumber(rsCompany("Customer_90Days"), 2)); Report.SetParameterValue("txtDays120", "R " + Strings.FormatNumber(rsCompany("Customer_120Days"), 2)); Report.SetParameterValue("txtDays150", "R " + Strings.FormatNumber(rsCompany("Customer_150Days"), 2)); rsCompany.Close(); rsCompany.Open("SELECT * FROM Customer Where CustomerID = " + id, modRecordSet.cnnDB, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText); Report.Database.Tables(2).SetDataSource(rsCompany); rsTransaction = new ADODB.Recordset(); //rsTransaction.Open "SELECT CustomerTransaction.CustomerTransactionID, CustomerTransaction.CustomerTransaction_CustomerID, CustomerTransaction.CustomerTransaction_TransactionTypeID, CustomerTransaction.CustomerTransaction_DayEndID, CustomerTransaction.CustomerTransaction_MonthEndID, CustomerTransaction.CustomerTransaction_ReferenceID, CustomerTransaction.CustomerTransaction_Date, CustomerTransaction.CustomerTransaction_Description, CustomerTransaction.CustomerTransaction_Amount, CustomerTransaction.CustomerTransaction_Reference, CustomerTransaction.CustomerTransaction_PersonName," & _ //'" TransactionType.TransactionType_Name, IIf([CustomerTransaction_Amount]>0,[CustomerTransaction_Amount],Null) AS debit, IIf([CustomerTransaction_Amount]<0,[CustomerTransaction_Amount],Null) AS credit FROM CustomerTransaction INNER JOIN TransactionType ON CustomerTransaction.CustomerTransaction_TransactionTypeID = TransactionType.TransactionTypeID WHERE (((CustomerTransaction.CustomerTransaction_CustomerID)=" & id & "));", cnnDBStatement, adOpenStatic, adLockReadOnly, adCmdText //changed for OPEN ITEM //rsTransaction.Open "SELECT CustomerTransaction.CustomerTransactionID, CustomerTransaction.CustomerTransaction_CustomerID, CustomerTransaction.CustomerTransaction_TransactionTypeID, CustomerTransaction.CustomerTransaction_DayEndID, CustomerTransaction.CustomerTransaction_MonthEndID, CustomerTransaction.CustomerTransaction_ReferenceID, CustomerTransaction.CustomerTransaction_Date, CustomerTransaction.CustomerTransaction_Description, CustomerTransaction.CustomerTransaction_Amount, CustomerTransaction.CustomerTransaction_Reference, CustomerTransaction.CustomerTransaction_PersonName," & _ //'" TransactionType.TransactionType_Name, IIf([CustomerTransaction_Amount]>0,[CustomerTransaction_Amount],Null) AS debit, IIf([CustomerTransaction_Amount]<0,[CustomerTransaction_Amount],Null) AS credit FROM CustomerTransaction INNER JOIN TransactionType ON CustomerTransaction.CustomerTransaction_TransactionTypeID = TransactionType.TransactionTypeID WHERE (((CustomerTransaction.CustomerTransaction_CustomerID)=" & id & "));", cnnDBStatement, adOpenStatic, adLockReadOnly, adCmdText rsCustTransCheck = new ADODB.Recordset(); rsCustTransCheck.Open("SELECT * FROM CustomerTransaction Where CustomerTransaction_CustomerID = " + id, cnnDBStatement, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText); if (rsCustTransCheck.Fields.Count <= 12) { rsTransaction.Open("SELECT CustomerTransaction.CustomerTransactionID, CustomerTransaction.CustomerTransaction_CustomerID, CustomerTransaction.CustomerTransaction_TransactionTypeID, CustomerTransaction.CustomerTransaction_DayEndID, CustomerTransaction.CustomerTransaction_MonthEndID, CustomerTransaction.CustomerTransaction_ReferenceID, CustomerTransaction.CustomerTransaction_Date, CustomerTransaction.CustomerTransaction_Description, CustomerTransaction.CustomerTransaction_Amount, CustomerTransaction.CustomerTransaction_Reference, CustomerTransaction.CustomerTransaction_PersonName," + " TransactionType.TransactionType_Name, IIf([CustomerTransaction_Amount]>0,[CustomerTransaction_Amount],Null) AS debit, IIf([CustomerTransaction_Amount]<0,[CustomerTransaction_Amount],Null) AS credit, 0, 0, 0 FROM CustomerTransaction INNER JOIN TransactionType ON CustomerTransaction.CustomerTransaction_TransactionTypeID = TransactionType.TransactionTypeID WHERE (((CustomerTransaction.CustomerTransaction_CustomerID)=" + id + "));", cnnDBStatement, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText); } else { rsTransaction.Open("SELECT CustomerTransaction.CustomerTransactionID, CustomerTransaction.CustomerTransaction_CustomerID, CustomerTransaction.CustomerTransaction_TransactionTypeID, CustomerTransaction.CustomerTransaction_DayEndID, CustomerTransaction.CustomerTransaction_MonthEndID, CustomerTransaction.CustomerTransaction_ReferenceID, CustomerTransaction.CustomerTransaction_Date, CustomerTransaction.CustomerTransaction_Description, CustomerTransaction.CustomerTransaction_Amount-IIf(IsNull([CustomerTransaction.CustomerTransaction_Allocated]),0,[CustomerTransaction.CustomerTransaction_Allocated]), CustomerTransaction.CustomerTransaction_Reference & IIf([CustomerTransaction.CustomerTransaction_Allocated]<>[CustomerTransaction_Amount] AND [CustomerTransaction.CustomerTransaction_Allocated]<>0,' (P)',Null), CustomerTransaction.CustomerTransaction_PersonName, TransactionType.TransactionType_Name," + " IIf(([CustomerTransaction_Amount]-IIf(IsNull([CustomerTransaction.CustomerTransaction_Allocated]),0,[CustomerTransaction.CustomerTransaction_Allocated]))>0,([CustomerTransaction_Amount]-IIf(IsNull([CustomerTransaction.CustomerTransaction_Allocated]),0,[CustomerTransaction.CustomerTransaction_Allocated])),Null) AS debit," + " IIf(([CustomerTransaction_Amount]-IIf(IsNull([CustomerTransaction.CustomerTransaction_Allocated]),0,[CustomerTransaction.CustomerTransaction_Allocated]))<0,([CustomerTransaction_Amount]-IIf(IsNull([CustomerTransaction.CustomerTransaction_Allocated]),0,[CustomerTransaction.CustomerTransaction_Allocated])),Null) AS credit, CustomerTransaction.CustomerTransaction_Main, CustomerTransaction.CustomerTransaction_Child, CustomerTransaction.CustomerTransaction_Allocated FROM CustomerTransaction INNER JOIN TransactionType ON CustomerTransaction.CustomerTransaction_TransactionTypeID = TransactionType.TransactionTypeID WHERE (((CustomerTransaction.CustomerTransaction_CustomerID)=" + id + ") AND ((CustomerTransaction.CustomerTransaction_Amount-IIf(IsNull([CustomerTransaction.CustomerTransaction_Allocated]),0,[CustomerTransaction.CustomerTransaction_Allocated]))<>0));", cnnDBStatement, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText); } //Report.Database.Tables(3).SetDataSource rsTransaction, 3 if (rsTransaction.BOF | rsTransaction.EOF) { rsTransaction = new ADODB.Recordset(); rsTransaction.Open("SELECT 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0," + " 0, 0 AS debit, 0 AS credit;", cnnDBStatement, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, ADODB.CommandTypeEnum.adCmdText); Report.Database.Tables(3).SetDataSource(rsTransaction); //Exit Sub } else { Report.Database.Tables(3).SetDataSource(rsTransaction); } if (rsTransaction.BOF | rsTransaction.EOF) { return; } //Set rsInterest = New Recordset //rsInterest.Open ("SELECT * FROM Interest WHERE (((CustomerID)=" & id & ")) and (Debit>0);"), cnnDBStatement, adOpenStatic, adLockReadOnly, adCmdText rsInterest = modRecordSet.getRS(ref "SELECT * FROM Interest WHERE (((CustomerID)=" + id + ")) and (Debit>0);"); //If rsInterest.BOF Or rsInterest.EOF Then if (rsInterest.RecordCount > 0) { Report.ReportDefinition.ReportObjects("Field20").Top = 280; Report.ReportDefinition.ReportObjects("Field21").Top = 280; Report.ReportDefinition.ReportObjects("Field22").Top = 280; Report.ReportDefinition.ReportObjects("Field23").Top = 280; Report.Database.Tables(4).SetDataSource(rsInterest); } else { //Set rsInterest = New Recordset //rsInterest.Open "SELECT 0 AS CustomerID, 0 AS CDate, 0 AS Description, 0 AS Debit, 0 AS Credit, 0 AS SumIntBal ;", cnnDBStatement, adOpenStatic, adLockReadOnly, adCmdText rsInterest = modRecordSet.getRS(ref "SELECT 0 AS CustomerID, 0 AS CDate, 0 AS Description, 0 AS Debit, 0 AS Credit, 0 AS SumIntBal ;"); Report.ReportDefinition.Sections("Field20").SectionFormat.EnableSuppress = true; Report.ReportDefinition.Sections("Field21").SectionFormat.EnableSuppress = true; Report.ReportDefinition.Sections("Field22").SectionFormat.EnableSuppress = true; Report.ReportDefinition.Sections("Field23").SectionFormat.EnableSuppress = true; Report.Database.Tables(4).SetDataSource(rsInterest); //Exit Sub //Set rsInterest = New Recordset //rsInterest.Open "SELECT * FROM Interest WHERE (((CustomerID)=" & id & "));", cnnDBStatement, adOpenStatic, adLockReadOnly, adCmdText } if (rs.Fields("Company_DebtorPrintBal").Value == true) { CrystalDecisions.CrystalReports.Engine.TextObject tObj = Report.ReportDefinition.ReportObjects("Text5"); tObj.Color = Color.White; } My.MyProject.Forms.frmReportShow.CRViewer1.ReportSource = Report; My.MyProject.Forms.frmReportShow.mReport = Report; My.MyProject.Forms.frmReportShow.sMode = "0"; // frmReportShow.CRViewer1.PrintReport My.MyProject.Forms.frmReportShow.CRViewer1.Refresh(); // Unload frmReportShow System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; My.MyProject.Forms.frmReportShow.ShowDialog(); }
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(); // crp.AfterRender += this.crp_AfterRender; if (!String.IsNullOrEmpty(Request.QueryString["ClassRoomId"]) && !String.IsNullOrEmpty(Request.QueryString["RepId"])) { if (Convert.ToString(Request.QueryString["RepId"]).Equals("ClassWiseStudent")) { rpt.FileName = Server.MapPath("rptClassroomWiseStudent.rpt"); } if (Convert.ToString(Request.QueryString["RepId"]).Equals("ClassWiseStudentWithFee")) { rpt.FileName = Server.MapPath("rptClassroomWiseStudentWithFee.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 = "Class room wise student list report"; if (Convert.ToString(Request.QueryString["RepId"]).Equals("ClassWiseStudent")) { titleText.Text = "Student list by class report"; } if (Convert.ToString(Request.QueryString["RepId"]).Equals("ClassWiseStudentWithFee")) { titleText.Text = "Student fees by class report"; } titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper(); ds = proxy.GetClassroomWiseStudentWeeklySchedule(new Guid(Request.QueryString["ClassRoomId"].ToString()), new Guid(Session["CurrentSchoolYearId"].ToString())); dsReport.Tables["dtClassWiseStudent"].Merge(ds.Tables[0]); rpt1.SetDataSource(dsReport.Tables["dtClassWiseStudent"]); } if (!String.IsNullOrEmpty(Request.QueryString["ProgramId"]) && !String.IsNullOrEmpty(Request.QueryString["RepId"])) { if (Convert.ToString(Request.QueryString["RepId"]).Equals("ProgramWiseStudent")) { rpt.FileName = Server.MapPath("rptProgramWiseStudentWeeklySchedule.rpt"); } if (Convert.ToString(Request.QueryString["RepId"]).Equals("ProgramWiseStudentWithFee")) { rpt.FileName = Server.MapPath("rptProgramWiseStudentWeeklyScheduleWithFee.rpt"); } DayCareBAL.SchoolProgramService proxy = new DayCareBAL.SchoolProgramService(); CrystalDecisions.CrystalReports.Engine.TextObject titleText = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text13"]; CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text10"]; CrystalDecisions.CrystalReports.Engine.TextObject footer = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"]; footer.Text = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString())); // titleText.Text = "Program wise student list report"; if (Convert.ToString(Request.QueryString["RepId"]).Equals("ProgramWiseStudent")) { titleText.Text = "Student list by Program report"; } if (Convert.ToString(Request.QueryString["RepId"]).Equals("ProgramWiseStudentWithFee")) { titleText.Text = "Student fees by Program report"; } titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper(); ds = proxy.GetSchoolProgramWiseStudentWeeklySchedule(new Guid(Session["CurrentSchoolYearId"].ToString()), new Guid(Request.QueryString["ProgramId"].ToString())); dsReport.Tables["dtProgramWiseStudent"].Merge(ds.Tables[0]); rpt1.SetDataSource(dsReport.Tables["dtProgramWiseStudent"]); } crp.DisplayGroupTree = false; crp.ReportSource = rpt1; crp.RefreshReport(); crp.DataBind(); }
private void ucPatientDayList_Load(object sender, EventArgs e) { CrystalDecisions.CrystalReports.Engine.TextObject field = (CrystalDecisions.CrystalReports.Engine.TextObject)ucDayList1.cr.ReportDefinition.ReportObjects["txtTitle"]; field.Text = sTitle; }