protected void Page_Load(object sender, EventArgs e)
        {
            loggedInAdmin = Helpers.GetLoggedInAdmin();
            currentCompany = Helpers.GetCurrentCompany();
            currentInvoice = Helpers.GetCurrentInvoice();
            CheckPermission();

            PopulateInvoice();

            if (Request.QueryString["print"] == "true")
            {
                PrintHyperLink.Visible = false;
            }
            else
            {
                PopuplateBreadcrumbs();
            }
        }
        /// <summary>
        /// Gets a collection of BillingItem objects by a Invoice object.
        /// </summary>
        /// <param name="invoice">invoice</param>
        /// <param name="startRowIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalRows"></param>
        /// <returns>A collection BillingItem objects.</returns>
        public static EntityList<BillingItem> GetBillingItemsByinvoice_(Invoice @invoice_, long startRowIndex, int pageSize, out long totalRows)
        {
            string commandText = @"
            FROM
            [dbo].[BillingItems]
            WHERE
            [BillingItems].[invoice_id] = @invoice_id ";

            List<SqlParameter> parameters = new List<SqlParameter>();

            parameters.Add(new SqlParameter("@invoice_id", @invoice_.invoice_id));

            return GetList<BillingItem>(SelectFieldList, commandText, parameters, null, startRowIndex, pageSize, out totalRows);
        }
        /// <summary>
        /// Gets a collection of BillingItem objects by a Invoice object.
        /// </summary>
        /// <param name="invoice_">invoice_</param>
        /// <returns>A collection BillingItem objects.</returns>
        public static EntityList<BillingItem> GetBillingItemsByinvoice_(Invoice @invoice_)
        {
            string commandText = "BillingItemGetByInvoice";

            List<SqlParameter> parameters = new List<SqlParameter>();
            parameters.Add(new SqlParameter("@invoice_id", @invoice_.invoice_id));

            return GetList<BillingItem>(@invoice_, commandText, parameters);
        }
        /// <summary>
        /// Deletes BillingItem objects by a Invoice object.
        /// </summary>
        /// <param name="invoice">invoice</param>
        public static void DeleteBillingItemsByinvoice_(Invoice invoice)
        {
            string commandText = "BillingItemDeleteByInvoice";

            System.Collections.Generic.List<SqlParameter> parameters = new System.Collections.Generic.List<SqlParameter>();
            parameters.Add(new SqlParameter("@invoice_id", invoice.invoice_id));

            using (SqlHelper helper = new SqlHelper())
            {
                helper.Execute(commandText, CommandType.StoredProcedure, parameters);
            }
        }
        /// <summary>
        /// Create a new BillingItem object from a Invoice object.
        /// </summary>
        /// <param name="invoice_">invoice_</param>
        /// <returns>The newly created BillingItem object.</returns>
        public static BillingItem CreateBillingItemByinvoice_(Invoice @invoice_)
        {
            BillingItem billingItem = InitializeNew<BillingItem>();

            billingItem.invoice_id = @invoice_.invoice_id;

            billingItem.invoice_ = @invoice_;

            return billingItem;
        }