protected void GridView_Inv_Tax_Comp_RowDeleting(object sender, GridViewDeleteEventArgs e) { DataTable dt = (DataTable)Session[SessionFactory.ALL_SALE_ALL_POTENTIAL_CREATE_INV_TAX_COMP_DATA_GRID]; //GridViewRow gVR = GridView_Inv_Tax_Comp.Rows[e.RowIndex]; float taxDeductPerc = float.Parse(((TextBox)GridView_Inv_Tax_Comp.Rows[e.RowIndex].Cells[0].FindControl("TextBox_Value")).Text); float totalTaxPerc = (float)Session[SessionFactory.ALL_SALE_ALL_POTENTIAL_CREATE_INV_TOTAL_TAX_COMP_PERC]; Session[SessionFactory.ALL_SALE_ALL_POTENTIAL_CREATE_INV_TOTAL_TAX_COMP_PERC] = totalTaxPerc - taxDeductPerc; updateTotalINVAmount(); dt.Rows[e.RowIndex].Delete(); Label_Inv_Tax_Comp_Changed.Text = "Y"; /* Dictionary<String, String> whereCls = new Dictionary<string, string>(); * whereCls.Add(BackEndObjects.DocFormat.DOCFORMAT_COL_CMP_ID, Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()); * whereCls.Add(BackEndObjects.DocFormat.DOCFORMAT_COL_DOC_TYPE, BackEndObjects.DocFormat.DOCFORMAT_DOC_TYPE_INVOICE); * whereCls.Add(BackEndObjects.DocFormat.DOCFORMAT_COL_SECTION_TYPE, BackEndObjects.DocFormat.DOCFORMAT_DOC_TYPE_INVOICE_SECTION_TYPE_TAX); * whereCls.Add(BackEndObjects.DocFormat.DOCFORMAT_COL_SECTION_TYPE_NAME, ((Label)gVR.Cells[0].FindControl("Label_Name")).Text); * * Dictionary<String, String> targetVals = new Dictionary<string, string>(); * * * BackEndObjects.DocFormat.updateDocFormatObjsDB(whereCls, targetVals, DBConn.Connections.OPERATION_DELETE);*/ GridView_Inv_Tax_Comp.DataSource = dt; GridView_Inv_Tax_Comp.DataBind(); Session[SessionFactory.ALL_SALE_ALL_POTENTIAL_CREATE_INV_TAX_COMP_DATA_GRID] = dt; }
protected void loadInvDetails() { ArrayList invList = BackEndObjects.DocFormat. getDocFormatforEntityIdandDocTypeDB(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString(), BackEndObjects.DocFormat.DOCFORMAT_DOC_TYPE_INVOICE); DataTable dt = new DataTable(); dt.Columns.Add("Hidden"); dt.Columns.Add("Comp_Name"); dt.Columns.Add("Comp_Value"); int taxCompGridCounter = 0; for (int i = 0; i < invList.Count; i++) { DocFormat invObj = (DocFormat)invList[i]; String sectionType = invObj.getSection_type(); if (TextBox_INV_format_name.Text.Equals("")) { TextBox_INV_format_name.Text = invObj.getDocformat_name(); } switch (sectionType) { case BackEndObjects.DocFormat.DOCFORMAT_DOC_TYPE_INVOICE_SECTION_TYPE_TNC: TextBox_INV_TnC.Text = invObj.getText(); Label_TNC_flag_Inv.Text = TextBox_INV_TnC.Text.Equals("") ? "Y" : "N"; break; case BackEndObjects.DocFormat.DOCFORMAT_DOC_TYPE_INVOICE_SECTION_TYPE_TAX: dt.Rows.Add(); dt.Rows[taxCompGridCounter]["Hidden"] = invObj.getDocformat_id(); //Component name is the section type name dt.Rows[taxCompGridCounter]["Comp_Name"] = invObj.getSectionTypeName(); dt.Rows[taxCompGridCounter]["Comp_Value"] = invObj.getText(); taxCompGridCounter++; break; } } 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[2].Visible = false; Session[SessionFactory.ADMIN_PREF_DOCFORMAT_MGMT_TAX_COMP_GRID] = dt; } }
protected void GridView_Inv_Tax_Complete_List_SelectedIndexChanged(object sender, EventArgs e) { DataTable dt = (DataTable)Session[SessionFactory.ALL_SALE_ALL_POTENTIAL_CREATE_INV_TAX_COMP_DATA_GRID]; GridViewRow gVR = GridView_Inv_Tax_Complete_List.Rows[GridView_Inv_Tax_Complete_List.SelectedIndex]; Boolean alreadyExists = false; for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["Comp_Name"].Equals( ((Label)gVR.Cells[0].FindControl("Label_Name")).Text)) { alreadyExists = true; break; } } if (!alreadyExists) { Label_Inv_Tax_Comp_Changed.Text = "Y"; dt.Rows.Add(); dt.Rows[dt.Rows.Count - 1]["Hidden"] = ((Label)gVR.Cells[0].FindControl("Label_Hidden")).Text; dt.Rows[dt.Rows.Count - 1]["Comp_Name"] = ((Label)gVR.Cells[0].FindControl("Label_Name")).Text; dt.Rows[dt.Rows.Count - 1]["Comp_Value"] = ((Label)gVR.Cells[0].FindControl("Label_Value")).Text; GridView_Inv_Tax_Comp.DataSource = dt; GridView_Inv_Tax_Comp.DataBind(); Session[SessionFactory.ALL_SALE_ALL_POTENTIAL_CREATE_INV_TAX_COMP_DATA_GRID] = dt; float totalTaxPerc = (float)Session[SessionFactory.ALL_SALE_ALL_POTENTIAL_CREATE_INV_TOTAL_TAX_COMP_PERC]; totalTaxPerc += float.Parse(((Label)gVR.Cells[0].FindControl("Label_Value")).Text); Session[SessionFactory.ALL_SALE_ALL_POTENTIAL_CREATE_INV_TOTAL_TAX_COMP_PERC] = totalTaxPerc; updateTotalINVAmount(); Label_Tax_Comp_Addn_Stat.Visible = true; Label_Tax_Comp_Addn_Stat.ForeColor = System.Drawing.Color.Green; Label_Tax_Comp_Addn_Stat.Text = "Tax component added to the list"; } else { Label_Tax_Comp_Addn_Stat.Visible = true; Label_Tax_Comp_Addn_Stat.ForeColor = System.Drawing.Color.Red; Label_Tax_Comp_Addn_Stat.Text = "Tax component already in the list"; } }
protected void GridView_Inv_Tax_Comp_RowDeleting(object sender, GridViewDeleteEventArgs e) { DataTable dt = (DataTable)Session[SessionFactory.ADMIN_PREF_DOCFORMAT_MGMT_TAX_COMP_GRID]; GridViewRow gVR = GridView_Inv_Tax_Comp.Rows[e.RowIndex]; dt.Rows[e.RowIndex].Delete(); Dictionary <String, String> whereCls = new Dictionary <string, string>(); whereCls.Add(BackEndObjects.DocFormat.DOCFORMAT_COL_CMP_ID, Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()); whereCls.Add(BackEndObjects.DocFormat.DOCFORMAT_COL_DOC_TYPE, BackEndObjects.DocFormat.DOCFORMAT_DOC_TYPE_INVOICE); whereCls.Add(BackEndObjects.DocFormat.DOCFORMAT_COL_SECTION_TYPE, BackEndObjects.DocFormat.DOCFORMAT_DOC_TYPE_INVOICE_SECTION_TYPE_TAX); whereCls.Add(BackEndObjects.DocFormat.DOCFORMAT_COL_SECTION_TYPE_NAME, ((Label)gVR.Cells[0].FindControl("Label_Name")).Text); Dictionary <String, String> targetVals = new Dictionary <string, string>(); BackEndObjects.DocFormat.updateDocFormatObjsDB(whereCls, targetVals, DBConn.Connections.OPERATION_DELETE); GridView_Inv_Tax_Comp.DataSource = dt; GridView_Inv_Tax_Comp.DataBind(); Session[SessionFactory.ADMIN_PREF_DOCFORMAT_MGMT_TAX_COMP_GRID] = dt; }
protected void GridView_Inv_Tax_Comp_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) { GridView_Inv_Tax_Comp.EditIndex = -1; GridView_Inv_Tax_Comp.DataSource = (DataTable)Session[SessionFactory.ADMIN_PREF_DOCFORMAT_MGMT_TAX_COMP_GRID]; GridView_Inv_Tax_Comp.DataBind(); }
protected void GridView_Inv_Tax_Comp_PageIndexChanging(object sender, GridViewPageEventArgs e) { GridView_Inv_Tax_Comp.PageIndex = e.NewPageIndex; GridView_Inv_Tax_Comp.DataSource = (DataTable)Session[SessionFactory.ADMIN_PREF_DOCFORMAT_MGMT_TAX_COMP_GRID]; GridView_Inv_Tax_Comp.DataBind(); }
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"; } }