Beispiel #1
0
    private void Load_PortageBill()
    {
        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 = dtpb.DefaultView.ToTable();
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    if (!string.IsNullOrEmpty(dr["From"].ToString()))
                    {
                        dr["From"] = UDFLib.ConvertUserDateFormat(Convert.ToDateTime(dr["From"].ToString()).ToString("dd/MM/yyyy"), UDFLib.GetDateFormat());
                    }
                    if (!string.IsNullOrEmpty(dr["To"].ToString()))
                    {
                        dr["To"] = UDFLib.ConvertUserDateFormat(Convert.ToDateTime(dr["To"].ToString()).ToString("dd/MM/yyyy"), UDFLib.GetDateFormat());
                    }
                }
            }
            GridViewPB.DataSource = dt;
            GridViewPB.DataBind();
        }
        catch (Exception ex) { UDFLib.WriteExceptionLog(ex); }
    }
Beispiel #2
0
    public string asyncGet_Portage_Bill_Attachments(int Vessel_ID, string month, string year, int Doc_type)
    {
        UDCHyperLink aLink = new UDCHyperLink("DocURL", "../uploads/CrewAccount", new string[] { }, new string[] { }, "_blank");
        Dictionary <string, UDCHyperLink> dicLink = new Dictionary <string, UDCHyperLink>();

        dicLink.Add("Doc_Name", aLink);

        return(UDFLib.CreateHtmlTableFromDataTable(BLL_PB_PortageBill.Get_Portage_Bill_Attachments(Vessel_ID, month, year, Doc_type),
                                                   new string[] { },
                                                   new string[] { "Doc_Name" },
                                                   dicLink,
                                                   new Dictionary <string, UDCToolTip>(),
                                                   new string[] { "left" },
                                                   "CreateHtmlTableFromDataTable-table",
                                                   "CreateHtmlTableFromDataTable-DataHedaer",
                                                   "CreateHtmlTableFromDataTable-Data"));
    }
Beispiel #3
0
    public string asyncGet_CTM_Attachments(int CTM_ID, int Vessel_ID)
    {
        UDCHyperLink aLink = new UDCHyperLink("DocURL", "../uploads/CrewAccount", new string[] { }, new string[] { }, "_blank");
        Dictionary <string, UDCHyperLink> dicLink = new Dictionary <string, UDCHyperLink>();

        dicLink.Add("Doc_Name", aLink);

        return(UDFLib.CreateHtmlTableFromDataTable(BLL_PB_PortageBill.Get_CTM_Attachments(CTM_ID, Vessel_ID),
                                                   new string[] { "Attachments" },
                                                   new string[] { "Doc_Name" },
                                                   dicLink,
                                                   new Dictionary <string, UDCToolTip>(),
                                                   new string[] { "center" },
                                                   "CreateHtmlTableFromDataTable-table",
                                                   "CreateHtmlTableFromDataTable-DataHedaer",
                                                   "CreateHtmlTableFromDataTable-Data"));
    }
Beispiel #4
0
    public string asyncGet_Inventory_UpdatedBy(int ID, int Office_ID, int Vessel_ID)
    {
        UDCHyperLink aLink = new UDCHyperLink("", "../Crew/CrewDetails.aspx", new string[] { "ID" }, new string[] { "ID" }, "_blank");
        Dictionary <string, UDCHyperLink> dicLink = new Dictionary <string, UDCHyperLink>();

        dicLink.Add("Staff_Code", aLink);

        return(UDFLib.CreateHtmlTableFromDataTable(BLL_PURC_Report.Get_Inventory_UpdatedBy(ID, Office_ID, Vessel_ID),
                                                   new string[] { "Staff Code", "Name", "Rank", "Updated On" },
                                                   new string[] { "Staff_Code", "Staff_Name", "Rank_Short_Name", "UpdatedOn" },
                                                   dicLink,
                                                   new Dictionary <string, UDCToolTip>(),
                                                   new string[] { "center", "left", "left", "left" },
                                                   "CreateHtmlTableFromDataTable-table",
                                                   "CreateHtmlTableFromDataTable-DataHedaer",
                                                   "CreateHtmlTableFromDataTable-Data"));
    }
Beispiel #5
0
    public string Get_CrewQuery_Attachments(int QueryID, int VesselID, int UserID)
    {
        DataTable dt = BLL_Crew_Queries.Get_CrewQuery_Attachments(QueryID, VesselID, UserID);

        UDCHyperLink aLink = new UDCHyperLink("DocURL", "", new string[] { }, new string[] { }, "_blank");
        Dictionary <string, UDCHyperLink> dicLink = new Dictionary <string, UDCHyperLink>();

        dicLink.Add("Attachment_Name", aLink);

        return(UDFLib.CreateHtmlTableFromDataTable(dt,
                                                   new string[] { "Attachments" },
                                                   new string[] { "Attachment_Name" },
                                                   dicLink,
                                                   new Dictionary <string, UDCToolTip>(),
                                                   new string[] { "left" },
                                                   "CrewQuery-Attachments-table",
                                                   "CrewQuery-Attachments-DataHeder",
                                                   "CrewQuery-Attachments-Data"));
    }
Beispiel #6
0
    public string Get_Med_CostItem_Attachments(int Cost_Item_ID, int Case_ID, int Vessel_ID, int Office_ID, int UserID)
    {
        DataTable dt = BLL_Crew_MedHistory.Get_Med_CostItem_Attachments(Cost_Item_ID, Case_ID, Vessel_ID, Office_ID, UserID);

        UDCHyperLink aLink = new UDCHyperLink("DocURL", "", new string[] { }, new string[] { }, "_blank");
        Dictionary <string, UDCHyperLink> dicLink = new Dictionary <string, UDCHyperLink>();

        dicLink.Add("Attachment_Name", aLink);

        return(UDFLib.CreateHtmlTableFromDataTable(dt,
                                                   new string[] { "Attachments" },
                                                   new string[] { "Attachment_Name" },
                                                   dicLink,
                                                   new Dictionary <string, UDCToolTip>(),
                                                   new string[] { "left" },
                                                   "CrewQuery-Attachments-table",
                                                   "CrewQuery-Attachments-DataHeder",
                                                   "CrewQuery-Attachments-Data"));
    }
Beispiel #7
0
    public string async_Purc_Supplier_Attachments(string Reqsnno, int vesselID, string SuppCode)
    {
        BLL_PURC_Purchase objPurch = new BLL_PURC_Purchase();

        UDCHyperLink aLink = new UDCHyperLink("File_Path", "../Uploads/Purchase", new string[] { }, new string[] { }, "_blank");
        Dictionary <string, UDCHyperLink> dicLink = new Dictionary <string, UDCHyperLink>();

        dicLink.Add("File_Name", aLink);

        return(UDFLib.CreateHtmlTableFromDataTableNew(objPurch.Purc_Get_Reqsn_Attachments_Supplier(Reqsnno, vesselID, SuppCode),
                                                      new string[] { },
                                                      new string[] { "File_Name" },
                                                      dicLink,
                                                      new Dictionary <string, UDCToolTip>(),
                                                      new string[] { "left" },
                                                      "CreateHtmlTableFromDataTable-table",
                                                      "CreateHtmlTableFromDataTable-DataHedaer",
                                                      "CreateHtmlTableFromDataTable-Data"));
    }
Beispiel #8
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);
        }
    }