protected void btnExportExcel_Click(object sender, ImageClickEventArgs e) { int total = lblTotal.Text == "" ? 0 : lblTotal.Text.ToInt(); if (total > base.EXCEL_SIZE_Key) { UCModalError1.ShowMessageError = SysMessage.ExcelSizeError; UCModalError1.ShowModalError(); UpdatePanelSearch.Update(); } else { try { Dictionary <string, string> columns = new Dictionary <string, string>(); columns.Add("ลำดับที่", "RUN_NO"); columns.Add("ประเภทใบเสร็จ", "PETITION_TYPE_NAME"); columns.Add("เลขที่ใบเสร็จ", "RECEIPT_NO"); columns.Add("ชื่อ-นามสกุล", "FLNAME"); columns.Add("เลขบัตรประชาชน", "ID_CARD_NO"); columns.Add("วันที่สั่งจ่าย", "PAYMENT_DATE"); columns.Add("วันที่ชำระเงิน", "ORDER_DATE"); columns.Add("เลขที่ใบอนุญาต", "LICENSE_NO"); columns.Add("จำนวนเงิน", "AMOUNT"); columns.Add("จำนวนครั้งที่พิมพ์", "PRINT_TIMES"); ExportBiz export = new ExportBiz(); var biz = new BLL.PaymentBiz(); var res = biz.GetReportNumberPrintBill(txtIDCard.Text, ddlLicenseType.SelectedValue, txtFirstName.Text, txtLastName.Text, 1, base.EXCEL_SIZE_Key, false); export.CreateExcel(res.DataResponse, columns); } catch { } } }
private void InitData() { try { string IDCard = Request.QueryString["IDCard"].Trim(); string LicenseType = Request.QueryString["LicenseType"].Trim(); string FirstName = Request.QueryString["FirstName"].Trim(); string LastName = Request.QueryString["LastName"].Trim(); string Click = Request.QueryString["Click"]; BLL.PaymentBiz biz = new BLL.PaymentBiz(); var res = biz.GetReportNumberPrintBill(IDCard, LicenseType, FirstName, LastName, 0, 0, false); DataTable dt = res.DataResponse.Tables.Count > 0 ? res.DataResponse.Tables[0] : null; string ReportFolder = base.ReportFilePath_Key; if (Click == "Print") { //if ((base.UserProfile.MemberType == DTO.RegistrationType.OIC.GetEnumValue()) || // (base.UserProfile.MemberType == DTO.RegistrationType.OICFinace.GetEnumValue())) if (base.UserProfile.MemberType == DTO.RegistrationType.OIC.GetEnumValue()) //แก้ตามเอกสารของ SA { rpt.Load(Server.MapPath(ReportFolder + "RptElectronicReceipt.rpt")); rpt.DataDefinition.FormulaFields["UserName"].Text = "'" + base.UserProfile.Name + "'"; rpt.SetDataSource(dt); rpt.SetParameterValue("datethai", DateTime.Now.ToShortDateString()); BindReport(rpt); //downloadexcel(rpt); } } } catch (Exception ex) { Response.Write(ex.Message); } }
protected void btnPrint_Click(object sender, EventArgs e) { BLL.PaymentBiz biz = new BLL.PaymentBiz(); var res = biz.GetReportNumberPrintBill(txtIDCard.Text, ddlLicenseType.SelectedValue, txtFirstName.Text, txtLastName.Text, 0, 0, false); DataTable dt = res.DataResponse.Tables.Count > 0 ? res.DataResponse.Tables[0] : null; string ReportFolder = base.ReportFilePath_Key; ReportDocument report = new ReportDocument(); report.Load(Server.MapPath(ReportFolder + "RptElectronicReceipt.rpt")); report.DataDefinition.FormulaFields["UserName"].Text = "'" + base.UserProfile.Name + "'"; report.SetDataSource(dt); report.SetParameterValue("datethai", DateTime.Now.ToShortDateString()); CRVStatic.ReportSource = report; CRVStatic.DataBind(); }
private void BindDataInGridView(Boolean CountAgain) { var biz = new BLL.PaymentBiz(); int Rpage = (txtNumberGvSearch.Text.Trim() == "") ? 0 : txtNumberGvSearch.Text.Trim().ToInt(); int resultPage = (Rpage == 0) ? 1 : txtNumberGvSearch.Text.Trim().ToInt(); resultPage = resultPage == 0 ? 1 : resultPage; if ((rowPerpage.Text.Trim() == null) || (rowPerpage.Text.Trim() == "") || (rowPerpage.Text.ToInt() == 0)) { rowPerpage.Text = PageSize.ToString(); } else { PageSize = Convert.ToInt32(rowPerpage.Text); } if (CountAgain) { #region Page var CountPage = biz.GetReportNumberPrintBill(txtIDCard.Text, ddlLicenseType.SelectedValue, txtFirstName.Text, txtLastName.Text, resultPage, PageSize, true); if (CountPage.DataResponse != null) { if (CountPage.DataResponse.Tables[0].Rows.Count > 0) { Int64 totalROWs = Convert.ToInt32(CountPage.DataResponse.Tables[0].Rows[0]["CCount"].ToString()); VisibleGV(gvSearch, totalROWs, Convert.ToInt32(rowPerpage.Text), true); if (Rpage == 0) { NPbutton(btnPreviousGvSearch, txtNumberGvSearch, btnNextGvSearch, "", txtTotalPage); } } else { VisibleGV(gvSearch, 0, Convert.ToInt32(rowPerpage.Text), true); if (Rpage == 0) { NPbutton(btnPreviousGvSearch, txtNumberGvSearch, btnNextGvSearch, "", txtTotalPage); } txtTotalPage.Text = "1"; } } #endregion Page } var res = biz.GetReportNumberPrintBill(txtIDCard.Text, ddlLicenseType.SelectedValue, txtFirstName.Text, txtLastName.Text, resultPage, PageSize, false); if (res.IsError) { var errorMsg = res.ErrorMsg; AlertMessage.ShowAlertMessage(string.Empty, errorMsg); } else { gvSearch.DataSource = res.DataResponse; gvSearch.DataBind(); bluediv.Visible = true; } }