protected void GridCdnr_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteRecords") { DataTable CDNRTable = (DataTable)ViewState["CDNRTable"]; CDNRTable.Rows.RemoveAt(int.Parse(e.CommandArgument.ToString())); ViewState["CdnrTable"] = CDNRTable; GridCdnr.DataSource = CDNRTable; GridCdnr.DataBind(); } }
protected void clearGrid() // clear all grid or view state all tab data { grdB2B.DataSource = null; grdB2B.DataBind(); GridB2cl.DataSource = null; GridB2cl.DataBind(); GridB2cs.DataSource = null; GridB2cs.DataBind(); GridCdnr.DataSource = null; GridCdnr.DataBind(); GridCdnur.DataSource = null; GridCdnur.DataBind(); GridExp.DataSource = null; GridExp.DataBind(); GridAt.DataSource = null; GridAt.DataBind(); GridAtAdj.DataSource = null; GridAtAdj.DataBind(); GridHsn.DataSource = null; GridHsn.DataBind(); GridExeMp.DataSource = null; GridExeMp.DataBind(); GridDocs.DataSource = null; GridDocs.DataBind(); ViewState["B2BTable"] = null; ViewState["B2ClTable"] = null; ViewState["B2CSTable"] = null; ViewState["CDNRTable"] = null; ViewState["CDNURTable"] = null; ViewState["ExpTable"] = null; ViewState["AtTable"] = null; ViewState["AtAdjTable"] = null; ViewState["HsnTable"] = null; ViewState["ExeMpTable"] = null; ViewState["DocsTable"] = null; ClearB2B(); ClearB2cl(); ClearB2cs(); ClearCdnur(); ClearExp(); ClearAt(); ClearDocs(); ClearAtAdj(); ClearExeMp(); ClearHsn(); ClearCdnr(); }
protected void btnCdnrAdd_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); lblCdnrErrorMsg.Text = ""; if (ViewState["CDNRTable"] == null) { dt.Columns.Add("GSTIN/UIN of Recipient"); dt.Columns.Add("Invoice/Advance Receipt Number"); dt.Columns.Add("Invoice/Advance Receipt date"); dt.Columns.Add("Note/Refund Voucher Number"); dt.Columns.Add("Note/Refund Voucher date"); dt.Columns.Add("Document Type"); dt.Columns.Add("Reason For Issuing document"); dt.Columns.Add("PlaceOfSupplyCode"); dt.Columns.Add("Place Of Supply"); dt.Columns.Add("Note/Refund Voucher Value"); dt.Columns.Add("Rate"); dt.Columns.Add("Taxable Value"); dt.Columns.Add("Cess Amount"); dt.Columns.Add("Pre GST"); dt.Columns.Add("ItemIGSTValue"); dt.Columns.Add("ItemCGSTValue"); dt.Columns.Add("ItemSGSTValue"); } else { dt = (DataTable)ViewState["CDNRTable"]; } DataRow dr = dt.NewRow(); dr["GSTIN/UIN of Recipient"] = txtCdnrGstin.Text; dr["Invoice/Advance Receipt Number"] = txtCdnrInvoiceNo.Text; dr["Invoice/Advance Receipt date"] = CLSCommon.DateFormat(txtCdnrInvoiceDate.Text); dr["Note/Refund Voucher Number"] = txtCdnrVoucherNo.Text; dr["PlaceOfSupplyCode"] = ddlCdnrPlaceOfSupply.Text.ToString(); dr["Place Of Supply"] = ddlCdnrPlaceOfSupply.SelectedItem.Text; dr["Note/Refund Voucher date"] = CLSCommon.DateFormat(txtCdnrVoucherDate.Text); dr["Document Type"] = ddlCdnrDocType.Text; dr["Reason For Issuing document"] = ddltxtCdnrReasonForIssueDoc.SelectedItem.Text.ToString(); dr["Note/Refund Voucher Value"] = txtCdnrVoucherValue.Text; dr["Rate"] = ddltxtCdnrRate.SelectedItem.Text.ToString(); dr["Taxable Value"] = txtCdnrTaxableValue.Text; dr["Cess Amount"] = txtCdnrCessAmount.Text.Trim() == "" ? "0" : txtCdnrCessAmount.Text.Trim(); if (ddlCdnrPreGst.SelectedItem.Text.ToString() == "Yes") { dr["Pre GST"] = "Y"; } else { dr["Pre GST"] = "N"; } string GSTIN = Session["ClientGSTNNO"].ToString(); int stateCode = Convert.ToInt32(ddlCdnrPlaceOfSupply.SelectedValue); int gst = Convert.ToInt32(GSTIN.Substring(0, 2)); if (gst != stateCode) { dr["ItemIGSTValue"] = ((Convert.ToDecimal(ddltxtCdnrRate.SelectedItem.Text.ToString()) * Convert.ToDecimal(txtCdnrTaxableValue.Text)) / 100).ToString(); dr["ItemCGSTValue"] = "0"; dr["ItemSGSTValue"] = "0"; } else { dr["ItemIGSTValue"] = "0"; dr["ItemCGSTValue"] = (((Convert.ToDecimal(ddltxtCdnrRate.SelectedItem.Text.ToString()) * Convert.ToDecimal(txtCdnrTaxableValue.Text)) / 100) / 2).ToString(); dr["ItemSGSTValue"] = (((Convert.ToDecimal(ddltxtCdnrRate.SelectedItem.Text.ToString()) * Convert.ToDecimal(txtCdnrTaxableValue.Text)) / 100) / 2).ToString();; } dt.Rows.Add(dr); ViewState["CDNRTable"] = dt; GridCdnr.DataSource = dt; GridCdnr.DataBind(); ClearCdnr(); }