コード例 #1
0
    protected void ImgExpExcel_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            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());
            }

            DataTable dt = BLL_PB_PhoneCard.PhoneCord_Kitty_Export(txtSatatus.Text != "" ? txtSatatus.Text : null, null, txtTitle.Text != "" ? txtTitle.Text : null, null, null, null, (DataTable)Session["sVesselCode"], UDFLib.ConvertToDate(txtFromDate.Text.Trim(), UDFLib.GetDateFormat()).ToShortDateString(), UDFLib.ConvertToDate(txtToDate.Text.Trim(), UDFLib.GetDateFormat()).ToShortDateString(), sortbycoloumn, sortdirection
                                                                   , ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dt.Rows[i]["DATE_OF_CREATION"] = "&nbsp;" + UDFLib.ConvertUserDateFormat(Convert.ToString(dt.Rows[i]["DATE_OF_CREATION"]));
            }

            string[] HeaderCaptions  = { "Vessel Name", "Request Date", "Card Number", "Card Pin", "Unit", "Title", "Sub Title", "Supplier ", "Voyage" };
            string[] DataColumnsName = { "VESSEL_NAME", "DATE_OF_CREATION", "CARD_NUM", "CARD_PIN", "CARD_UNITS", "TITLE", "SUBTITLE", "Full_NAME", "STAFF_NAME" };

            GridViewExportUtil.ExportToExcel(dt, HeaderCaptions, DataColumnsName, "KittyList", "Kitty List");
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
コード例 #2
0
    protected void ImgExpExcel_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            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());
            }

            DataTable dt = BLL_PB_PhoneCard.PhoneCord_Request_Export(txtCardNumber.Text != "" ? txtCardNumber.Text : null, (DataTable)Session["sVesselCode"], UDFLib.ConvertToDate(txtFromDate.Text).ToShortDateString(), UDFLib.ConvertToDate(txtToDate.Text).ToShortDateString(), ddlStatus.SelectedIndex == 0 ? null : ddlStatus.SelectedValue);

            UDFLib.ChangeColumnDataType(dt, "DATE_OF_CREATION", typeof(string));
            UDFLib.ChangeColumnDataType(dt, "PBILL_DATE", typeof(string));

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dt.Rows[i]["DATE_OF_CREATION"] = "&nbsp;" + UDFLib.ConvertUserDateFormat(Convert.ToString(dt.Rows[i]["DATE_OF_CREATION"]));
                dt.Rows[i]["PBILL_DATE"]       = "&nbsp;" + UDFLib.ConvertUserDateFormat(Convert.ToString(dt.Rows[i]["PBILL_DATE"]));
            }

            string[] HeaderCaptions  = { "Request Number", "Vessel Name", "Status", "Request Date", "Total Cards", "Bill Date" };
            string[] DataColumnsName = { "REQUEST_NUMBER", "VESSEL_NAME", "REQUEST_STATUS", "DATE_OF_CREATION", "TOTAL_REQUEST", "PBILL_DATE" };

            GridViewExportUtil.ExportToExcel(dt, HeaderCaptions, DataColumnsName, "PhoneCardRequest", "Request List");
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
コード例 #3
0
ファイル: PI_Details.aspx.cs プロジェクト: 15831944/JIBE-ERP
 /// <summary>
 /// Method to export data to excel
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnExport_Click(object sender, ImageClickEventArgs e)
 {
     try
     {
         int    rowcount = ucCustomPager1.isCountRecord;
         string PIName   = "PI Name: ";
         PI_ID = Convert.ToInt32(Request.QueryString["PI_ID"]);
         DateTime?dtWEF = null;
         DateTime?dtWET = null;
         if (txtSearchFrom.Text != "")
         {
             dtWEF = Convert.ToDateTime(txtSearchFrom.Text);
         }
         if (txtSearchTo.Text != "")
         {
             dtWET = Convert.ToDateTime(txtSearchTo.Text);
         }
         if (ViewState["PI_Name"] != null)
         {
             PIName = PIName + ViewState["PI_Name"].ToString();
         }
         DataTable dt              = BLL_TMSA_PI.Get_Vessel_Values(Convert.ToInt32(ddlVessel.SelectedValue), dtWEF, dtWET, PI_ID, null, null, ref rowcount).Tables[0];
         string[]  HeaderCaptions  = { "Vessel", "Effect From", "Effect To", "PI Value", "Created ON" };
         string[]  DataColumnsName = { "Vessel_Name", "Effective_From", "Effective_To", "Value", "Date_Of_Creation" };
         GridViewExportUtil.ExportToExcel(dt, HeaderCaptions, DataColumnsName, PIName, PIName);
     }
     catch (Exception ex)
     {
         UDFLib.WriteExceptionLog(ex);
     }
 }
コード例 #4
0
ファイル: ERLogIndex.aspx.cs プロジェクト: 15831944/JIBE-ERP
    protected void ImgExpExcel_Click(object sender, ImageClickEventArgs 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());

        DataTable dt = BLL_Tec_ErLog.ErLog_ME_00_Search(UDFLib.ConvertIntegerToNull(DDLVessel.SelectedValue), txtFromDate.Text, txtToDate.Text, sortbycoloumn, sortdirection
            , 1, int.MaxValue, ref  rowcount);

        dt.Columns.Add("AML", typeof(string));
        foreach (DataRow item in dt.Rows)
        {
            if (item["Anomaly_Value"].ToString() == "1")
            {
                item["AML"] = "Yes";
            }
            else
            {
                item["AML"] = "No";
            }
        }

        string[] HeaderCaptions = { "Voyage Numbe", "Vessel Name", "From", "TO", "Date", "Remarks", "Anomaly Present" };
        string[] DataColumnsName = { "VOYAGE_NUM", "VESSEL_NAME", "FROMPORT", "TOPORT", "LOG_DATE", "CE_REMARKS", "AML" };

        GridViewExportUtil.ExportToExcel(dt, HeaderCaptions, DataColumnsName, "EngineRoomLogBookIndex", "Engine Room Log Book Index ");
    }
コード例 #5
0
    /// <summary>
    /// Method to export data to excel
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnExport_Click(object sender, ImageClickEventArgs e)
    {
        int    rowcount = ucCustomPager1.isCountRecord;
        string PIName   = "PI Name: ";

        PI_ID = Convert.ToInt32(Request.QueryString["PI_ID"]);
        DateTime?dtWEF = null;
        DateTime?dtWET = null;

        if (txtSearchFrom.Text != "")
        {
            dtWEF = Convert.ToDateTime(txtSearchFrom.Text);
        }
        if (txtSearchTo.Text != "")
        {
            dtWET = Convert.ToDateTime(txtSearchTo.Text);
        }

        DataSet   ds = BLL_TMSA_PI.Get_RankWise_Values(Convert.ToInt32(ddlRank.SelectedValue), dtWEF, dtWET, PI_ID, null, null, ref rowcount);
        DataTable dt = ds.Tables[0];

        PIName = "PI Rankwise : " + ds.Tables[1].Rows[0]["Name"];

        string[] HeaderCaptions  = { "Rank", "Effect From", "Effect To", "PI Value", "Created On", "Last Modified" };
        string[] DataColumnsName = { "Rank", "Effective_From_Str", "Effective_To", "Value", "Date_Of_Creation", "Date_Of_Modification" };
        GridViewExportUtil.ExportToExcel(dt, HeaderCaptions, DataColumnsName, PIName, PIName);
    }
コード例 #6
0
    protected void btnExport_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            if (checkVoyage.Checked == false)
            {
                if (txtStartDate.Text != "")
                {
                    Startdate = Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtStartDate.Text));
                }
                if (txtEndDate.Text != "")
                {
                    EndDate = Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtEndDate.Text));
                }
                DataTable dt = BLL_TMSA_PI.Search_PI_ValuesNOX(Convert.ToInt32(ddlvessel.SelectedValue), Convert.ToDateTime(txtStartDate.Text).ToString("yyyy-MM-dd"), Convert.ToDateTime(txtEndDate.Text).ToString("yyyy-MM-dd")).Tables[0];

                string[] HeaderCaptions  = { "Record_Date", "Value" };
                string[] DataColumnsName = { "Record_Date", "Value" };
                GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "NOX Effeciency-" + ddlvessel.SelectedItem.Text, "NOX Effeciency-" + ddlvessel.SelectedItem.Text);
            }
            else
            {
                DataTable liTable = new DataTable();
                if (listVoyage.Items.Count > 0)
                {
                    for (int x = 0; x < listVoyage.Items.Count; x++)
                    {
                        //string v1 = listVoyage.Items[0].Value.Split(':')[1].Trim();
                        //string v2 = listVoyage.Items[listVoyage.Items.Count - 1].Value.Split(':')[0].Trim();
                        string val = listVoyage.Items[x].Value.Split(':')[0] + ":" + listVoyage.Items[x].Value.Split(':')[1];

                        DataTable dtq = BLL_TMSA_PI.GetTelDate(val.Trim(), Convert.ToInt32(ddlvessel.SelectedValue)).Tables[0];
                        if (dtq.Rows[0]["Telegram_Date_DDMM"].ToString() != "")
                        {
                            Startdate = Convert.ToDateTime(dtq.Rows[0]["Telegram_Date_DDMM"].ToString());
                        }
                        if (dtq.Rows[dtq.Rows.Count - 1]["Telegram_Date_DDMM"].ToString() != "")
                        {
                            EndDate = Convert.ToDateTime(dtq.Rows[dtq.Rows.Count - 1]["Telegram_Date_DDMM"].ToString());
                        }



                        DataTable dt = BLL_TMSA_PI.GetVoyageDataNOx(listVoyage.Items[x].Value.Trim(), Convert.ToInt32(ddlvessel.SelectedValue)).Tables[0];

                        liTable.Merge(dt);
                    }
                    string[] HeaderCaptions  = { "From Port", "To Port", "Effective From", "Effective To", "Efficiency" };
                    string[] DataColumnsName = { "FromPort", "ToPort", "EffectiveFrom", "EffectiveTo", "Value" };
                    GridViewExportUtil.ExportToExcel(liTable, HeaderCaptions, DataColumnsName, "NOX Effeciency-" + ddlvessel.SelectedItem.Text, "NOX Effeciency(Voyage)-" + ddlvessel.SelectedItem.Text);
                }
            }
        }
        catch (Exception ex)
        { }
    }
コード例 #7
0
    /// <summary>
    /// Method to export values displayed on the grid applying same search criteria
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnExport_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            hdnVessel_IDs.Value = null;
            string Qtr        = "";
            string sStartDate = txtStartDate.Text;
            string sEndDate   = txtEndDate.Text;
            if (sStartDate != "" && sEndDate != "")
            {
                DateTime StartDate = Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtStartDate.Text));      //ConvertToDefaultDt() method is used to change the user selected date format to the default format, the format in which date is saved in database.
                DateTime EndDate   = Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtEndDate.Text));

                //hdnLastMonth.Value = lastMonth;
                DataSet   ds        = objKPI.Get_Vetting_KPI_ByCompany(Qtr, 0, StartDate, EndDate);
                DataTable dt        = ds.Tables[0];
                string[]  Pkey_cols = new string[] { "KPI_ID" };
                string[]  Hide_cols = new string[] { "ID", "Qtr_Start", "Qtr_End", "Code" };
                DataTable dt1       = objKPI.PivotTable("Qtr", "KPI_Value", "", Pkey_cols, Hide_cols, dt);



                string[] HeaderCaptions  = new string[dt1.Columns.Count - 1];
                string[] DataColumnsName = new string[dt1.Columns.Count - 1];
                string   ColumnName;
                int      i = 0;
                foreach (DataColumn column in dt1.Columns)
                {
                    ColumnName = column.ColumnName;
                    if (ColumnName != "KPI_ID")
                    {
                        if (ColumnName == "KPI_Name")
                        {
                            HeaderCaptions[i] = "KPI Name";
                        }
                        else
                        {
                            HeaderCaptions[i] = ColumnName;
                        }
                        DataColumnsName[i] = ColumnName;
                    }

                    i++;
                }

                GridViewExportUtil.ExportToExcel(dt1, HeaderCaptions, DataColumnsName, "Vetting Company KPIs", "Vetting Company KPIs");
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
コード例 #8
0
    protected void ImgExportToExcel_Click(object sender, EventArgs e)
    {
        string Sign_On_From      = "";
        string Sign_On_To        = "";
        string SearchString      = txtSearch.Text;
        int    TotalDays         = 0;
        int    PAGE_SIZE         = -1;
        int    PAGE_INDEX        = -1;
        int    SelectRecordCount = 0;

        int FleetCode = UDFLib.ConvertToInteger(ddlFleet.SelectedValue);
        int VesselID  = UDFLib.ConvertToInteger(ddlVessel.SelectedValue);

        if (txtSignOnFrom.Text != "")
        {
            Sign_On_From = UDFLib.ConvertToDate(Convert.ToString(txtSignOnFrom.Text), UDFLib.GetDateFormat()).ToString();
        }

        if (txtSignOnTo.Text != "")
        {
            Sign_On_To = UDFLib.ConvertToDate(Convert.ToString(txtSignOnTo.Text), UDFLib.GetDateFormat()).ToString();
        }

        DataTable dt = BLL_Crew_CrewList.Get_Super_Att_Vessel_Report(FleetCode, VesselID, Sign_On_From, Sign_On_To, SearchString, GetSessionUserID(), PAGE_SIZE, PAGE_INDEX, ref SelectRecordCount, ref TotalDays);

        dt.Columns.Add("Joining_Date1");
        dt.Columns.Add("Sign_On_Date1");
        dt.Columns.Add("Sign_Off_Date1");

        foreach (DataRow dr in dt.Rows)
        {
            if (dr["Joining_Date"].ToString() != "" && dr["Joining_Date"] != null)
            {
                dr["Joining_Date1"] = "&nbsp;" + UDFLib.ConvertUserDateFormat(Convert.ToString(dr["Joining_Date"]), Convert.ToString(Session["User_DateFormat"]));
            }
            if (dr["Sign_On_Date"].ToString() != "" && dr["Sign_On_Date"] != null)
            {
                dr["Sign_On_Date1"] = "&nbsp;" + UDFLib.ConvertUserDateFormat(Convert.ToString(dr["Sign_On_Date"]));
            }

            if (dr["Sign_Off_Date"].ToString() != "" && dr["Sign_Off_Date"] != null)
            {
                dr["Sign_Off_Date1"] = "&nbsp;" + UDFLib.ConvertUserDateFormat(Convert.ToString(dr["Sign_Off_Date"]));
            }
        }
        dt.AcceptChanges();

        string[] HeaderCaptions  = { "Vessel", "S/Code", "Name", "Rank", "Contract Date", "S/On Date", "S/Off Date", "Days ONBD" };
        string[] DataColumnsName = { "Vessel_Short_Name", "Staff_Code", "Staff_Name", "Rank_Short_Name", "Joining_Date1", "Sign_On_Date1", "Sign_Off_Date1", "DaysOnBoard" };


        GridViewExportUtil.ExportToExcel(dt, HeaderCaptions, DataColumnsName, "Superintendents_attending_vessels.xls", "Superintendents attending vessels Report");
    }
コード例 #9
0
    protected void lnkExportToExcel_Click(object sender, EventArgs e)
    {
        string[] HeaderCaptions  = { };
        string[] DataColumnsName = { };

        DataTable dtFilters = GetSearchDataTable();

        DataTable dtExportColumns = new DataTable();

        dtExportColumns.Columns.Add("ParamName", typeof(String));
        dtExportColumns.Columns.Add("ParamValue", typeof(String));

        foreach (ListItem li in CheckBoxList1.Items)
        {
            if (li.Selected == true)
            {
                dtExportColumns.Rows.Add(li.Value.ToString(), "1");

                Array.Resize(ref HeaderCaptions, HeaderCaptions.Length + 1); HeaderCaptions[HeaderCaptions.Length - 1]     = li.Text.ToString();
                Array.Resize(ref DataColumnsName, DataColumnsName.Length + 1); DataColumnsName[DataColumnsName.Length - 1] = li.Value.ToString();
            }
        }
        if (dtExportColumns.Rows.Count == 0)
        {
            string js = "alert('Please Select at least one column!');";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", js, true);
            return;
        }
        DataTable dt = BLL_Crew_CrewList.Get_Crewlist_Export(dtFilters, dtExportColumns, GetSessionUserID());

        ChangeColumnDataType(dt, "EOC", typeof(string));
        ChangeColumnDataType(dt, "Joining_date", typeof(string));
        ChangeColumnDataType(dt, "Staff_Birth_Date", typeof(string));

        foreach (DataRow item in dt.Rows)
        {
            if (!string.IsNullOrEmpty(item["EOC"].ToString()))
            {
                item["EOC"] = "&nbsp;" + UDFLib.ConvertUserDateFormat(Convert.ToString(item["EOC"]), UDFLib.GetDateFormat());
            }
            if (!string.IsNullOrEmpty(item["Joining_date"].ToString()))
            {
                item["Joining_date"] = "&nbsp;" + UDFLib.ConvertUserDateFormat(Convert.ToString(item["Joining_date"]), UDFLib.GetDateFormat());
            }
            if (!string.IsNullOrEmpty(item["Staff_Birth_Date"].ToString()))
            {
                item["Staff_Birth_Date"] = "&nbsp;" + UDFLib.ConvertUserDateFormat(Convert.ToString(item["Staff_Birth_Date"]), UDFLib.GetDateFormat());
            }
        }

        GridViewExportUtil.ExportToExcel(dt, HeaderCaptions, DataColumnsName, "CrewListExport.xls", "CrewList Export");
    }
コード例 #10
0
    protected void btnExport_Click(object sender, ImageClickEventArgs e)
    {
        if (checkVoyage.Checked == false)
        {
            if (txtStartDate.Text != "")
            {
                Startdate = Convert.ToDateTime(txtStartDate.Text);
            }
            if (txtEndDate.Text != "")
            {
                EndDate = Convert.ToDateTime(txtEndDate.Text);
            }
            string Value_Type = rdListValue.SelectedValue;
            KPI_ID = Convert.ToInt32(ddlKPIList.SelectedValue);
            DataTable dt = objKPI.Get_Vessel_KPI_Values(Convert.ToInt32(ddlvessel.SelectedValue), KPI_ID, ddlInterval.SelectedValue, Value_Type, Startdate, EndDate).Tables[0];

            string[] HeaderCaptions  = { "Record Duration", "KPI Value" };
            string[] DataColumnsName = { "Record_Date_Str", "Value" };
            GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, ddlvessel.SelectedItem.Text, ddlvessel.SelectedItem.Text);
        }
        else
        {
            DataTable liTable = new DataTable();
            if (listVoyage.Items.Count > 0)
            {
                for (int x = 0; x < listVoyage.Items.Count; x++)
                {
                    //string v1 = listVoyage.Items[0].Value.Split(':')[1].Trim();
                    //string v2 = listVoyage.Items[listVoyage.Items.Count - 1].Value.Split(':')[0].Trim();
                    string val = listVoyage.Items[x].Value.Split(':')[0] + ":" + listVoyage.Items[x].Value.Split(':')[1];

                    DataTable dtq = BLL_TMSA_PI.GetTelDate(val.Trim(), Convert.ToInt32(ddlvessel.SelectedValue)).Tables[0];
                    if (dtq.Rows[0][0].ToString() != "")
                    {
                        Startdate = Convert.ToDateTime(dtq.Rows[0][0].ToString());
                    }
                    if (dtq.Rows[dtq.Rows.Count - 1][0].ToString() != "")
                    {
                        EndDate = Convert.ToDateTime(dtq.Rows[dtq.Rows.Count - 1][0].ToString());
                    }

                    DataTable dt = BLL_TMSA_PI.GetVoyageDataNOx(listVoyage.Items[x].Value.Trim(), Convert.ToInt32(ddlvessel.SelectedValue)).Tables[0];

                    liTable.Merge(dt);
                }
                string[] HeaderCaptions  = { "Deperture Date", "Arrival Date", "From Port", "To Port", "Average" };
                string[] DataColumnsName = { "EffectiveFrom", "EffectiveTo", "FromPort", "ToPort", "Value" };
                GridViewExportUtil.ExportToExcel(liTable, HeaderCaptions, DataColumnsName, ddlvessel.SelectedItem.Text, ddlvessel.SelectedItem.Text);
            }
        }
    }
コード例 #11
0
    protected void lnkExportUniform_Click(object sender, EventArgs e)
    {
        string[] HeaderCaptions  = { };
        string[] DataColumnsName = { };

        DataTable dtFilters = GetSearchDataTable();

        DataTable dt = objCrew.Get_UniformSizeReport(dtFilters, GetSessionUserID());

        HeaderCaptions  = new string[] { "Vessel", "Staff Code", "Staff Name", "Shoe Size", "T-Shirt Size", "Cargo Pant Size", "Overall Size" };
        DataColumnsName = new string[] { "Vessel_Name", "Staff_Code", "staff_fullname", "SHOE_SIZE", "TSHIRT_SIZE", "PANT_SIZE", "OVERALL_SIZE" };

        GridViewExportUtil.ExportToExcel(dt, HeaderCaptions, DataColumnsName, "UniformSize.xls", "Uniform Size Report");
    }
コード例 #12
0
    protected void ImgExportToExcel_Click(object sender, EventArgs e)
    {
        try
        {
            int    FleetCode       = UDFLib.ConvertToInteger(ddlFleet.SelectedValue);
            int    VesselID        = UDFLib.ConvertToInteger(ddlVessel.SelectedValue);
            int    ManningOfficeID = UDFLib.ConvertToInteger(ddlManningOffice.SelectedValue);
            int    Rank_Category   = UDFLib.ConvertToInteger(ddlRankCategory.SelectedValue);
            int    Crew_Status     = UDFLib.ConvertToInteger(ddlStatus.SelectedValue);
            int    Fee_Type        = UDFLib.ConvertToInteger(ddlFeeType.SelectedValue);
            int    Approved_Status = UDFLib.ConvertToInteger(rdoApprovedStatus.SelectedValue);
            string Sign_On_From    = txtSignOnFrom.Text;
            string Sign_On_To      = txtSignOnTo.Text;
            string Approved_From   = txtApprovedFrom.Text;
            string Approved_To     = txtApprovedTo.Text;
            string SearchText      = txtSearchText.Text;

            string[] HeaderCaptions  = { "Manning Office", "Vessel", "S/Code", "Name", "Rank", "S/On Date", "S/Off Date", "Fee Type", "Due Date", "Due Amt", "Approved Amt", "Approved By", "Approved Date", "Remarks" };
            string[] DataColumnsName = { "manning_Office", "Vessel_Short_Name", "Staff_Code", "Staff_FullName", "Rank_Short_Name", "Sign_On_Date1", "Sign_Off_Date1", "FeeTypeName", "Due_Date1", "Due_Amount", "Approved_Amount", "ApprovedBy", "Approved_Date1", "Remarks" };


            int     PAGE_SIZE         = 0;
            int     PAGE_INDEX        = 0;
            int     SelectRecordCount = 0;
            decimal GrandTotal        = 0;

            DataTable dt = BLL_Crew_Disbursement.Get_AllCrewFeeStatus(FleetCode, VesselID, ManningOfficeID, Rank_Category, GetSessionUserID(), Crew_Status, Fee_Type, Approved_Status, UDFLib.ConvertToDefaultDt(Sign_On_From), UDFLib.ConvertToDefaultDt(Sign_On_To), UDFLib.ConvertToDefaultDt(Approved_From), UDFLib.ConvertToDefaultDt(Approved_To), UDFLib.ConvertIntegerToNull(PAGE_SIZE), UDFLib.ConvertIntegerToNull(PAGE_INDEX), ref SelectRecordCount, ref GrandTotal, int.Parse(ddlMonth.SelectedValue), int.Parse(ddlYear.SelectedValue), SearchText);

            DataTable dt1 = new DataTable();
            dt.Columns.Add("Sign_On_Date1", typeof(string));
            dt.Columns.Add("Sign_Off_Date1", typeof(string));
            dt.Columns.Add("Due_Date1", typeof(string));
            dt.Columns.Add("Approved_Date1", typeof(string));

            foreach (DataRow dr in dt.Rows)
            {
                dr["Sign_On_Date1"]  = "&nbsp;" + (Convert.ToString(dr["Sign_On_Date"])) != "" ? UDFLib.ConvertUserDateFormat(Convert.ToString(dr["Sign_On_Date"])) : "";
                dr["Sign_Off_Date1"] = "&nbsp;" + (Convert.ToString(dr["Sign_Off_Date"])) != "" ? UDFLib.ConvertUserDateFormat(Convert.ToString(dr["Sign_Off_Date"])) : "";
                dr["Due_Date1"]      = "&nbsp;" + (Convert.ToString(dr["Due_Date"])) != "" ? UDFLib.ConvertUserDateFormat(Convert.ToString((dr["Due_Date"]))) : "";
                dr["Approved_Date1"] = "&nbsp;" + (Convert.ToString(dr["Approved_Date"])) != "" ? UDFLib.ConvertUserDateFormat(Convert.ToString(dr["Approved_Date"])) : "";
            }


            GridViewExportUtil.ExportToExcel(dt, HeaderCaptions, DataColumnsName, "AgencyFee.xls", "Agency Fee Export");
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
コード例 #13
0
ファイル: FileIndex.aspx.cs プロジェクト: 15831944/JIBE-ERP
    protected void ImgExpExcel_Click(object sender, ImageClickEventArgs 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());
        }

        DataTable dtPendingList = BLL_QMSDB_Procedures.QMSDBProcedures_Search((DataTable)Session["sFleet"], (DataTable)Session["sVesselCode"], UDFLib.ConvertIntegerToNull(lstDept.SelectedValue), UDFLib.ConvertIntegerToNull(lstUser.SelectedValue), txtSearch.Text, sortbycoloumn, sortdirection, ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount);

        string[] HeaderCaptions  = { "Vessel", "Folder Name", "Procedure Code", "Procedure Name", "Department", "Access User", "Publish Date", "Publish Version", "Created By", "Approved By" };
        string[] DataColumnsName = { "Vessel_Name", "Folder_Name", "PROCEDURE_CODE", "PROCEDURES_NAME", "Department", "User_name", "CREATED_DATE", "PUBLISH_VERSION", "CREATED_USER", "User_name" };

        GridViewExportUtil.ExportToExcel(dtPendingList, HeaderCaptions, DataColumnsName, "ProcedureList", "Procedure List");
    }
コード例 #14
0
    protected void ImgExpExcel_Click(object sender, ImageClickEventArgs 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());
        }

        DataTable dt = objBLLconfig.PURC_POConfigSearch_BLL(txtSearchPOType.Text != "" ? txtSearchPOType.Text : null, sortbycoloumn, sortdirection
                                                            , ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount);

        string[] HeaderCaptions  = { "ROWNUM", "Id", "typeid", "VARIABLE_NAME", "AutoOwnerSelection", "CopyToVessel", "AutoPOClosing" };
        string[] DataColumnsName = { "ROWNUM", "Id", "typeid", "VARIABLE_NAME", "AutoOwnerSelection", "CopyToVessel", "AutoPOClosing" };

        GridViewExportUtil.ExportToExcel(dt, HeaderCaptions, DataColumnsName, "PurchaseConfig", "PurchaseConfig");
    }
コード例 #15
0
    /// <summary>
    /// Description: Event added to export the gridview data to excel.
    /// Created By: Krishnapriya
    /// </summary>
    protected void btnExportToExcel_Click(object sender, EventArgs e)
    {
        try
        {
            Category_Id = 0;
            string    RankIDs = hdnRanks.Value;
            string    Year    = hdnYears.Value;
            DataTable dt      = objKPI.Search_CrewRetention(RankIDs, Year, Category_Id).Tables[0];

            string[] HeaderCaptions  = { "Quarter", "Employed Crew(PI06)", "NTBR(PI16)", "Total Left(PI41)", "Retention Rate" };
            string[] DataColumnsName = { "Qtr", "AvgAvailable", "NTBR", "LeftAll", "KPI_Value" };
            GridViewExportUtil.ExportToExcel(dt, HeaderCaptions, DataColumnsName, "Crew_Retention_Details", "Crew Retention Details:Selected Ranks");
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
コード例 #16
0
    protected void btnExport_Click(object sender, ImageClickEventArgs e)
    {
        int    rowcount   = ucCustomPager1.isCountRecord;
        string SearchText = txtSearch.Text;
        string Category   = null;

        if (ddlCategory.SelectedIndex == 0)
        {
            Category = "";
        }
        else
        {
            Category = ddlCategory.SelectedValue;
        }
        DataTable dt = null;

        dt = BLL_TMSA_PI.Get_PI_List(SearchText, Category, null, null, ref rowcount).Tables[0];

        string[] HeaderCaptions  = { "PI Name", "Code", "Interval", "Description", "Unit", "Status" };
        string[] DataColumnsName = { "Name", "Code", "Interval", "Description", "UOM", "Status" };
        GridViewExportUtil.ExportToExcel(dt, HeaderCaptions, DataColumnsName, "PI List", "PI List");
    }
コード例 #17
0
    /// <summary>
    /// Event to export the tabular data to excel sheet
    /// Created By: Harshal
    /// Created On: 17-MAR-2017
    /// </summary>
    protected void btnExportToExcel_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=ObservationbyOilMajor.xls");
            HttpContext.Current.Response.ContentType = "application/ms-excel";

            string Year = hdnYear.Value;
            string VesselID = hdnVessel.Value;           
            string CategoryID = hdnCategory.Value;
            string VettingTypeID = hdnVettingType.Value;
            string ObvTypeID = hdnObvType.Value;
            string FleetID = hdnFleet.Value;
            string OilID = hdnOilMajor.Value;
            int[] columnCnt = new int[4];

            //Fetch  Observation by OilMajorCount Yearwise 
            DataTable dtRawdata;
            dtRawdata = objVTReports.GetVesselwiseOilMajors(Year, VesselID, CategoryID, VettingTypeID, ObvTypeID, FleetID,OilID).Tables[0];

            string[] Pkey_cols = new string[] { "Year" };
            string[] Hide_cols = new string[] { "ID", "Year" };
            DataTable dt = objKPI.PivotTable("OilMajorName", "Rec_Count", "", Pkey_cols, Hide_cols, dtRawdata);
            columnCnt[0] = dt.Columns.Count;
            string[] columnNames = dt.Columns.Cast<DataColumn>()
                                 .Select(x => x.ColumnName)
                                 .ToArray();

            //Fetch  Observation by OilMajorName Count yearwise
            DataTable dtRawdata1;
            dtRawdata1 = objVTReports.GetOilMajorCountYearwise(Year, VesselID, CategoryID, VettingTypeID, ObvTypeID, FleetID,OilID).Tables[0];

            string[] Pkey_cols1 = new string[] { "OilMajorID" };
            string[] Hide_cols1 = new string[] { "OilMajorID" };
            DataTable dt1 = objKPI.PivotTable("Year", "Rec_Count", "", Pkey_cols1, Hide_cols1, dtRawdata1);
            columnCnt[1] = dt1.Columns.Count;
            string[] columnNames1 = dt1.Columns.Cast<DataColumn>()
                                .Select(x => x.ColumnName)
                                .ToArray();

            int maxColumnCnt = columnCnt.Max();
            //Observation by Oil Major Count TABLE
            HttpContext.Current.Response.Write("<TABLE BORDER='1' CELLPADDING='2' CELLSPACING='0' width='100%'>");
            HttpContext.Current.Response.Write("<tr>");
            HttpContext.Current.Response.Write("<td style='text-align:center;' colspan='" + maxColumnCnt + "'><h3>Observations by Oil Major</h3></td>");
            HttpContext.Current.Response.Write("</tr>");
            HttpContext.Current.Response.Write("</TABLE>");
            HttpContext.Current.Response.Write("<TABLE BORDER='1' CELLPADDING='2' CELLSPACING='2' width='100%'>");
            HttpContext.Current.Response.Write("<tr style='background-color: #F2F2F2;'>");
            for (int i = 0; i < columnNames.Length; i++)
            {
                HttpContext.Current.Response.Write("<td width='20%'>");
                HttpContext.Current.Response.Write("<b>" + columnNames[i] + "</b>");
                HttpContext.Current.Response.Write("</td>");
            }
            HttpContext.Current.Response.Write("</tr>");
            foreach (DataRow dr in dt.Rows)
            {
                HttpContext.Current.Response.Write("<tr>");
                for (int i = 0; i < columnNames.Length; i++)
                {
                    HttpContext.Current.Response.Write("<td>");
                    HttpContext.Current.Response.Write(dr[columnNames[i]]);
                    HttpContext.Current.Response.Write("</td>");
                }
                HttpContext.Current.Response.Write("</tr>");
            }
            HttpContext.Current.Response.Write("</TABLE>");
            HttpContext.Current.Response.Write("<br />");

            //Observation by Oil MajorName TABLE YearWise

            HttpContext.Current.Response.Write("<TABLE BORDER='1' CELLPADDING='2' CELLSPACING='0' width='100%'>");
            HttpContext.Current.Response.Write("<tr>");
            HttpContext.Current.Response.Write("<td style='text-align:center;' colspan='" + columnCnt[1] + "'><h3>Observations by Oil Major</h3></td>");
            HttpContext.Current.Response.Write("</tr>");
            HttpContext.Current.Response.Write("</TABLE>");
            HttpContext.Current.Response.Write("<TABLE BORDER='1' CELLPADDING='2' CELLSPACING='2' width='100%'>");
            HttpContext.Current.Response.Write("<tr style='background-color: #F2F2F2;'>");
            for (int i = 0; i < columnNames1.Length; i++)
            {
                HttpContext.Current.Response.Write("<td width='20%'>");
                HttpContext.Current.Response.Write("<b>" + columnNames1[i] + "</b>");
                HttpContext.Current.Response.Write("</td>");
            }
            HttpContext.Current.Response.Write("</tr>");
            foreach (DataRow dr in dt1.Rows)
            {
                HttpContext.Current.Response.Write("<tr>");
                for (int i = 0; i < columnNames1.Length; i++)
                {
                    HttpContext.Current.Response.Write("<td>");
                    HttpContext.Current.Response.Write(dr[columnNames1[i]]);
                    HttpContext.Current.Response.Write("</td>");
                }
                HttpContext.Current.Response.Write("</tr>");
            }
            HttpContext.Current.Response.Write("</TABLE>");
            HttpContext.Current.Response.Write("<br />");
            
            HttpContext.Current.Response.Write("</TABLE>");
            HttpContext.Current.Response.Write("<br />");

            HttpContext.Current.Response.End();
            GridViewExportUtil.ExportToExcel(dt1, columnNames, columnNames, "Observation_by_OilMajor", "Observation by OilMajor");
        }

        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
コード例 #18
0
    /// <summary>
    /// Event to export the tabular data to excel sheet
    /// Created By: Harshal
    /// Created On: 18-MAR-2017
    /// </summary>
    protected void btnExportToExcel_Click(object sender, ImageClickEventArgs e)
    {
        HttpContext.Current.Response.Clear();
        HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=ObservationByRiskLevel.xls");
        HttpContext.Current.Response.ContentType = "application/ms-excel";

        string Year          = hdnYear.Value;
        string VesselID      = hdnVessel.Value;
        string FleetID       = hdnFleet.Value;
        string RiskLevel     = hdnRisk.Value;
        string VettingTypeID = hdnVettingType.Value;
        string ObvTypeID     = hdnObvType.Value;
        string CategoryID    = hdnCategory.Value;

        //int columnCnt, columnCnt1, columnCnt2, columnCnt3;
        int[] columnCnt = new int[4];

        //Fetch  Observation by Risk Level with count grid1
        DataTable dtRawdata;

        dtRawdata = objVTReports.GetRiskLevelObservation(Year, VesselID, FleetID, RiskLevel, VettingTypeID, ObvTypeID, CategoryID).Tables[0];

        string[]  Pkey_cols = new string[] { "Year" };
        string[]  Hide_cols = new string[] { "ID", "Year" };
        DataTable dt        = objKPI.PivotTable("Risk_Level", "Rec_Count", "", Pkey_cols, Hide_cols, dtRawdata);

        columnCnt[0] = dt.Columns.Count;
        string[] columnNames = dt.Columns.Cast <DataColumn>()
                               .Select(x => x.ColumnName)
                               .ToArray();

        //Fetch  Observation by Risk Level Count for Vessels with yearwise grid2
        DataTable dtRawdata1;

        dtRawdata1 = objVTReports.GetRiskLevelObservationgrid(Year, VesselID, FleetID, RiskLevel, VettingTypeID, ObvTypeID, CategoryID).Tables[0];

        string[]  Pkey_cols1 = new string[] { "Vessel_ID" };
        string[]  Hide_cols1 = new string[] { "Vessel_ID" };
        DataTable dt1        = objKPI.PivotTable("Year", "Rec_Count", "", Pkey_cols1, Hide_cols1, dtRawdata1);

        columnCnt[1] = dt1.Columns.Count;
        string[] columnNames1 = dt1.Columns.Cast <DataColumn>()
                                .Select(x => x.ColumnName)
                                .ToArray();



        //Fetch  Observation by Risk Level Count for Vessel With yearwise grid3
        DataTable dtRawdata2;

        dtRawdata2 = objVTReports.GetRiskLevelObservationgrid(Year, VesselID, FleetID, RiskLevel, VettingTypeID, ObvTypeID, CategoryID).Tables[0];

        string[]  Pkey_cols2 = new string[] { "Vessel_ID" };
        string[]  Hide_cols2 = new string[] { "Vessel_ID" };
        DataTable dt2        = objKPI.PivotTable("Year", "Rec_Count", "", Pkey_cols2, Hide_cols2, dtRawdata2);

        columnCnt[2] = dt2.Columns.Count;
        string[] columnNames2 = dt2.Columns.Cast <DataColumn>()
                                .Select(x => x.ColumnName)
                                .ToArray();


        int maxColumnCnt = columnCnt.Max();

        //Observation by Risk Level1 for grid1 Count TABLE
        HttpContext.Current.Response.Write("<TABLE BORDER='1' CELLPADDING='2' CELLSPACING='0' width='100%'>");
        HttpContext.Current.Response.Write("<tr>");
        HttpContext.Current.Response.Write("<td style='text-align:center;' colspan='" + maxColumnCnt + "'><h3>Observations by Risk Level</h3></td>");
        HttpContext.Current.Response.Write("</tr>");
        HttpContext.Current.Response.Write("</TABLE>");
        HttpContext.Current.Response.Write("<TABLE BORDER='1' CELLPADDING='2' CELLSPACING='2' width='100%'>");
        HttpContext.Current.Response.Write("<tr style='background-color: #F2F2F2;'>");
        for (int i = 0; i < columnNames.Length; i++)
        {
            HttpContext.Current.Response.Write("<td width='20%'>");
            HttpContext.Current.Response.Write("<b>" + columnNames[i] + "</b>");
            HttpContext.Current.Response.Write("</td>");
        }
        HttpContext.Current.Response.Write("</tr>");
        foreach (DataRow dr in dt.Rows)
        {
            HttpContext.Current.Response.Write("<tr>");
            for (int i = 0; i < columnNames.Length; i++)
            {
                HttpContext.Current.Response.Write("<td>");
                HttpContext.Current.Response.Write(dr[columnNames[i]]);
                HttpContext.Current.Response.Write("</td>");
            }
            HttpContext.Current.Response.Write("</tr>");
        }
        HttpContext.Current.Response.Write("</TABLE>");
        HttpContext.Current.Response.Write("<br />");



        //Observation by Risk Level with vessels for grid2 TABLE YearWise
        HttpContext.Current.Response.Write("<TABLE BORDER='1' CELLPADDING='2' CELLSPACING='0' width='100%'>");
        HttpContext.Current.Response.Write("<tr>");
        HttpContext.Current.Response.Write("<td style='text-align:center;' colspan='" + columnCnt[1] + "'><h3>High Risk by Vessel</h3></td>");
        HttpContext.Current.Response.Write("</tr>");
        HttpContext.Current.Response.Write("</TABLE>");
        HttpContext.Current.Response.Write("<TABLE BORDER='1' CELLPADDING='2' CELLSPACING='2' width='100%'>");
        HttpContext.Current.Response.Write("<tr style='background-color: #F2F2F2;'>");
        for (int i = 0; i < columnNames1.Length; i++)
        {
            HttpContext.Current.Response.Write("<td width='20%'>");
            HttpContext.Current.Response.Write("<b>" + columnNames1[i] + "</b>");
            HttpContext.Current.Response.Write("</td>");
        }
        HttpContext.Current.Response.Write("</tr>");
        foreach (DataRow dr in dt1.Rows)
        {
            HttpContext.Current.Response.Write("<tr>");
            for (int i = 0; i < columnNames1.Length; i++)
            {
                HttpContext.Current.Response.Write("<td style='text-align:center;'>");
                HttpContext.Current.Response.Write(dr[columnNames1[i]]);
                HttpContext.Current.Response.Write("</td>");
            }
            HttpContext.Current.Response.Write("</tr>");
        }
        HttpContext.Current.Response.Write("</TABLE>");
        HttpContext.Current.Response.Write("<br />");

        HttpContext.Current.Response.Write("</TABLE>");
        HttpContext.Current.Response.Write("<br />");


        //Observation by Risk Level with Fleets TABLE YearWise
        HttpContext.Current.Response.Write("<TABLE BORDER='1' CELLPADDING='2' CELLSPACING='0' width='100%'>");
        HttpContext.Current.Response.Write("<tr>");
        HttpContext.Current.Response.Write("<td style='text-align:center;' colspan='" + columnCnt[2] + "'><h3>Medium Risk by Vessel</h3></td>");
        HttpContext.Current.Response.Write("</tr>");
        HttpContext.Current.Response.Write("</TABLE>");
        HttpContext.Current.Response.Write("<TABLE BORDER='1' CELLPADDING='2' CELLSPACING='2' width='100%'>");
        HttpContext.Current.Response.Write("<tr style='background-color: #F2F2F2;'>");
        for (int i = 0; i < columnNames2.Length; i++)
        {
            HttpContext.Current.Response.Write("<td width='20%'>");
            HttpContext.Current.Response.Write("<b>" + columnNames2[i] + "</b>");
            HttpContext.Current.Response.Write("</td>");
        }
        HttpContext.Current.Response.Write("</tr>");
        foreach (DataRow dr in dt2.Rows)
        {
            HttpContext.Current.Response.Write("<tr>");
            for (int i = 0; i < columnNames2.Length; i++)
            {
                HttpContext.Current.Response.Write("<td style='text-align:center;'>");
                HttpContext.Current.Response.Write(dr[columnNames2[i]]);
                HttpContext.Current.Response.Write("</td>");
            }
            HttpContext.Current.Response.Write("</tr>");
        }
        HttpContext.Current.Response.Write("</TABLE>");
        HttpContext.Current.Response.Write("<br />");

        HttpContext.Current.Response.Write("</TABLE>");
        HttpContext.Current.Response.Write("<br />");


        HttpContext.Current.Response.End();
        GridViewExportUtil.ExportToExcel(dt2, columnNames, columnNames, "Observation_by_RiskLevel", "Observation by RiskLevel");
    }
コード例 #19
0
    protected void btnExportExcel_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            string _SortOrderColumns = "DOA_HomePort , RANK_SORT_ORDER ";
            Dictionary <string, UDCHyperLink> DicLink = new Dictionary <string, UDCHyperLink>();
            lblPageTitle.Text = "Portage Bill : " + Convert.ToString(ViewState["Vessel_Name"]) + "&nbsp-&nbsp" + DateTime.Parse(ViewState["PBDt"].ToString()).ToString("MMM-yyyy");

            UDCHyperLink alink = new UDCHyperLink();
            alink.Target                = "_blank";
            alink.NaviagteURL           = "../crew/CrewDetails.aspx";
            alink.QueryStringDataColumn = new string[] { "VoyageID", "CrewID" };
            alink.QueryStringText       = new string[] { "VoyageID", "ID" };
            DicLink.Add("Code", alink);

            DataSet dsPb = BLL_PB_PortageBill.Get_PortageBill(Convert.ToInt32(DateTime.Parse(ViewState["PBDt"].ToString()).Month), Convert.ToInt32(DateTime.Parse(ViewState["PBDt"].ToString()).Year), Convert.ToInt32(ViewState["Vessel_ID"]), UDFLib.ConvertStringToNull(null), 0);
            dtcomment   = dsPb.Tables["Comment"];
            dtEntryType = dsPb.Tables["EntryType"];

            DataTable dtpb = UDFLib.PivotTable("Description",
                                               "Amount",
                                               "Sort_Order",
                                               new string[] { "VOYAGEID", "PBMONTH", "PBYEAR" },
                                               new string[] { "VOYAGEID", "PBMONTH", "PBYEAR", "RANK_SORT_ORDER", "IsFinalized", "DOA_HomePort", "RANK_SORT_ORDER", "Amount", "Description", "Sort_Order", "CrewID" },
                                               _SortOrderColumns,
                                               DicLink,
                                               dsPb.Tables["Data"]
                                               );
            totalEarnID = dtpb.Columns.IndexOf("Total Earning");
            totalDedID  = dtpb.Columns.IndexOf("Total Deduction");
            BFid        = dtpb.Columns.IndexOf("balance");
            dtpb.DefaultView.RowFilter = "rank <> ''";


            DataTable dt = new DataTable();
            dt = dtpb.DefaultView.ToTable();

            string[] HeaderCaptions  = { };
            string[] DataColumnsName = { };

            for (int i = 0; i < dt.Columns.Count; i++)
            {
                Array.Resize(ref HeaderCaptions, HeaderCaptions.Length + 1); HeaderCaptions[HeaderCaptions.Length - 1]     = dt.Columns[i].ColumnName;
                Array.Resize(ref DataColumnsName, DataColumnsName.Length + 1); DataColumnsName[DataColumnsName.Length - 1] = dt.Columns[i].ColumnName;
            }

            foreach (DataRow row in dt.Rows)
            {
                string st = row["Code"].ToString();

                int start = st.IndexOf('>');
                int end   = st.IndexOf('<', start);
                st = st.Substring(start + 1, end - start - 1);

                row["Code"] = st;
            }
            UDFLib.ChangeColumnDataType(dt, "To", typeof(string));
            UDFLib.ChangeColumnDataType(dt, "From", typeof(string));
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    dt.Rows[i]["From"] = "&nbsp;" + UDFLib.ConvertUserDateFormat(Convert.ToString(dt.Rows[i]["From"].ToString()), UDFLib.GetDateFormat());
                    dt.Rows[i]["To"]   = "&nbsp;" + UDFLib.ConvertUserDateFormat(Convert.ToString(dt.Rows[i]["To"].ToString()), UDFLib.GetDateFormat());
                }
            }

            //RemoveLinks(GridViewPB);
            GridViewExportUtil.ExportToExcel(dt, HeaderCaptions, DataColumnsName, "PortageBill-" + Request.QueryString["arg"].Split('~')[2] + "-" + DateTime.Parse(Request.QueryString["arg"].Split('~')[1]).ToString("MMM-yyyy") + ".xls", "PortageBill-" + Request.QueryString["arg"].Split('~')[2] + "-" + DateTime.Parse(Request.QueryString["arg"].Split('~')[1]).ToString("MMM-yyyy"));
            //GridViewExportUtil.Export("PortageBill-" + Request.QueryString["arg"].Split('~')[2] + "-" + DateTime.Parse(Request.QueryString["arg"].Split('~')[1]).ToString("MMM-yyyy") + ".xls", GridView1);

            // GridView1.GridLines = GridLines.None;
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }