protected void ImgExpExcel_Click(object sender, EventArgs e) { int rowcount = ucCustomPagerItems.isCountRecord; string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } ChkStatus(); DataSet ds = new DataSet(); if (POStatus != null || UnpaidInvoiceStatus != null || InvoiceStatus != null) { ds = BLL_POLOG_Register.POLOG_Get_Invoice_Summary_Report(UDFLib.ConvertStringToNull(ddlSupplier.SelectedValue), UDFLib.ConvertIntegerToNull(ddlVessel.SelectedValue), UDFLib.ConvertStringToNull(ddlOwner.SelectedValue), POStatus, UnpaidInvoiceStatus, InvoiceStatus, txtFromDate.Text != "" ? Convert.ToDateTime(txtFromDate.Text) : Convert.ToDateTime("01/01/1900") , txtToDate.Text != "" ? Convert.ToDateTime(txtToDate.Text) : Convert.ToDateTime("01/01/1900"), txtFromPayment.Text != "" ? Convert.ToDateTime(txtFromPayment.Text) : Convert.ToDateTime("01/01/1900"), txtToPayment.Text != "" ? Convert.ToDateTime(txtToPayment.Text) : Convert.ToDateTime("01/01/1900"), UDFLib.ConvertIntegerToNull(GetSessionUserID()), sortbycoloumn, sortdirection , null, null, ref rowcount); } string[] HeaderCaptions = { "PO Date", "PO Code", "Supplier Name", "Amount", "Cur", "USD Amt", "Invoice Date", "Invoice Due Date", "Invoice Reference", "Invoice Status", "Invoice Amount", "Invoice Currency", "USD Amount", "Payment Mode", "Payment Date", "Payment Status" }; string[] DataColumnsName = { "Line_Date", "Office_Ref_Code", "Supplier_Display_Name", "Line_Amount", "Line_Currency", "PO_USD_Amount", "Invoice_Date", "Invoice_Due_Date", "Invoice_Reference", "Invoice_Status", "Invoice_Amount", "Invoice_Currency", "Invoice_Book_Value", "Payment_Mode", "PAYMENT_DATE", "Invoice_PAYMENT_STATUS" }; GridViewExportUtil.ShowExcel(ds.Tables[0], HeaderCaptions, DataColumnsName, "Invoice_Summary_Report", "Invoice Summary Report", ""); }
public void BindGridView() { try { objChangeReqstMerge.AddMergedColumns(new int[] { 0, 1, 2, 3, 4, 5 }, "PO", "HeaderStyle-center"); objChangeReqstMerge.AddMergedColumns(new int[] { 6, 7, 8, 9, 10, 11, 12 }, "Invoice", "HeaderStyle-center"); objChangeReqstMerge.AddMergedColumns(new int[] { 13, 14, 15 }, "Payment", "HeaderStyle-center"); ViewState["SupplyID"] = ""; ChkStatus(); int rowcount = ucCustomPagerItems.isCountRecord; string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } DataSet ds = new DataSet(); if (POStatus != null || UnpaidInvoiceStatus != null || InvoiceStatus != null) { ds = BLL_POLOG_Register.POLOG_Get_Invoice_Summary_Report(UDFLib.ConvertStringToNull(ddlSupplier.SelectedValue), UDFLib.ConvertIntegerToNull(ddlVessel.SelectedValue), UDFLib.ConvertStringToNull(ddlOwner.SelectedValue), POStatus, UnpaidInvoiceStatus, InvoiceStatus, txtFromDate.Text != "" ? Convert.ToDateTime(txtFromDate.Text) : Convert.ToDateTime("01/01/1900") , txtToDate.Text != "" ? Convert.ToDateTime(txtToDate.Text) : Convert.ToDateTime("01/01/1900"), txtFromPayment.Text != "" ? Convert.ToDateTime(txtFromPayment.Text) : Convert.ToDateTime("01/01/1900"), txtToPayment.Text != "" ? Convert.ToDateTime(txtToPayment.Text) : Convert.ToDateTime("01/01/1900"), UDFLib.ConvertIntegerToNull(GetSessionUserID()), sortbycoloumn, sortdirection , ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount); } //} if (ucCustomPagerItems.isCountRecord == 1) { ucCustomPagerItems.CountTotalRec = rowcount.ToString(); ucCustomPagerItems.BuildPager(); } if (ds.Tables[0].Rows.Count > 0) { divPurchase.Visible = true; gvPurchase.DataSource = ds.Tables[0]; gvPurchase.DataBind(); Label lblPOUSDAmount1 = (Label)gvPurchase.FooterRow.FindControl("lblPOUSDAmount1"); Label lblInvBookValue1 = (Label)gvPurchase.FooterRow.FindControl("lblInvBookValue1"); lblPOUSDAmount1.Text = ds.Tables[1].Rows[0]["PO_USD_Value"].ToString(); lblInvBookValue1.Text = ds.Tables[2].Rows[0]["Invoice_USD_Amount"].ToString(); } else { divPurchase.Visible = false; gvPurchase.DataSource = ds.Tables[0]; gvPurchase.DataBind(); gvPurchase.EmptyDataText = "NO RECORDS FOUND"; } } catch { } { } }