Esempio n. 1
0
 protected void GridView_Inv_Tax_Complete_List_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     GridView_Inv_Tax_Complete_List.PageIndex  = e.NewPageIndex;
     GridView_Inv_Tax_Complete_List.DataSource = (DataTable)Session[SessionFactory.ALL_SALE_ALL_POTENTIAL_CREATE_INV_TOTAL_TAX_COMP_GRID];
     GridView_Inv_Tax_Complete_List.DataBind();
 }
Esempio n. 2
0
        protected void loadInvTaxCompGrid(String invId)
        {
            String context = Request.QueryString.GetValues("context")[0];

            DataTable dt = new DataTable();

            dt.Columns.Add("Hidden");
            dt.Columns.Add("Comp_Name");
            dt.Columns.Add("Comp_Value");

            DataTable dtComplete = new DataTable();

            dtComplete.Columns.Add("Hidden");
            dtComplete.Columns.Add("Comp_Name");
            dtComplete.Columns.Add("Comp_Value");

            float totalTaxPerc = 0;

            if (invId == null || invId.Equals(""))
            {
                totalTaxPerc = getTotalTaxCompGridandTaxPerc(dt);
                dtComplete   = dt;
            }
            else
            {
                //If invoice was already created populate the tax component values from the invoice component table
                ArrayList invTaxCompList = BackEndObjects.InvoiceComponents.getInvoiceComponentByInvIdandSecType(invId, BackEndObjects.InvoiceComponents.INVOICE_SECTION_TYPE_TAX);

                for (int i = 0; i < invTaxCompList.Count; i++)
                {
                    dt.Rows.Add();

                    BackEndObjects.InvoiceComponents invCompObj = (BackEndObjects.InvoiceComponents)invTaxCompList[i];

                    dt.Rows[i]["Hidden"] = invCompObj.getInvoice_Id();
                    //Component name is the section type name
                    dt.Rows[i]["Comp_Name"]  = invCompObj.getSection_type_name();
                    dt.Rows[i]["Comp_Value"] = invCompObj.getSection_value();

                    totalTaxPerc += float.Parse(invCompObj.getSection_value());
                }
            }

            if (dtComplete.Rows.Count == 0)
            {
                getTotalTaxCompGridandTaxPerc(dtComplete);
            }

            GridView_Inv_Tax_Complete_List.DataSource = dtComplete;
            GridView_Inv_Tax_Complete_List.DataBind();
            GridView_Inv_Tax_Complete_List.Columns[1].Visible = false;



            Session[SessionFactory.ALL_SALE_ALL_POTENTIAL_CREATE_INV_TOTAL_TAX_COMP_GRID] = dtComplete;

            if (dt.Rows.Count > 0)
            {
                GridView_Inv_Tax_Comp.DataSource = dt;
                GridView_Inv_Tax_Comp.DataBind();
                GridView_Inv_Tax_Comp.Visible            = true;
                GridView_Inv_Tax_Comp.Columns[1].Visible = false;

                //Hide the delete link if the context is client
                if (context.Equals("client"))
                {
                    GridView_Inv_Tax_Comp.Columns[0].Visible = false;

                    foreach (GridViewRow gVR in GridView_Inv_Tax_Comp.Rows)
                    {
                        ((TextBox)gVR.Cells[0].FindControl("TextBox_Value")).Enabled = false;
                    }
                }

                Session[SessionFactory.ALL_SALE_ALL_POTENTIAL_CREATE_INV_TAX_COMP_DATA_GRID]  = dt;
                Session[SessionFactory.ALL_SALE_ALL_POTENTIAL_CREATE_INV_TOTAL_TAX_COMP_PERC] = totalTaxPerc;
            }
            else
            {
                Label_No_Tax_Comp_Warning.Visible = true;
                Label_No_Tax_Comp_Warning.Text    = "Tax components for invoice not defined for your organization - set it up from Administration screen";
            }
        }