protected void lkbSac_Click(object sender, EventArgs e) { try { GST_MST_ITEM sac = new GST_MST_ITEM(); LinkButton lkbItem = (LinkButton)sender; if (!string.IsNullOrEmpty(lkbItem.CommandArgument.ToString())) { int itemID = Convert.ToInt32(lkbItem.CommandArgument); ViewState["Item_ID"] = itemID; btnsave.Attributes.Add("Item_ID", lkbItem.CommandArgument); var item = unitOfwork.ItemRepository.Filter(f => f.Item_ID == itemID).FirstOrDefault(); ddlSubClass.SelectedValue = Convert.ToString(item.SubClassID); txtSacCode.Text = item.ItemCode; txtCgst.Text = Convert.ToString(item.CGST); txtCess.Text = Convert.ToString(item.CESS); txtIgst.Text = Convert.ToString(item.IGST); txtSgst.Text = Convert.ToString(item.SGST); txtUgst.Text = Convert.ToString(item.UGST); txtDescription.Text = item.Description; //ddlSpclCondition.SelectedItem.Text = Convert.ToString(item.SpecialConditionApplied); //ddlNonGSTGoods.SelectedItem.Text = Convert.ToString(item.IsNonGSTGoods); } } catch (Exception ex) { cls_ErrorLog ob = new cls_ErrorLog(); cls_ErrorLog.LogError(ex, Common.LoggedInUserID()); } }
protected void btnSave_Click(object sender, EventArgs e) { GST_MST_ITEM hsn = new GST_MST_ITEM(); try { hsn.ItemCode = txtHsnNo.Text.Trim(); hsn.SpecialConditionApplied = (byte)(EnumConstants.SpecialCondition)Enum.Parse(typeof(EnumConstants.SpecialCondition), ddlSpclCondition.SelectedItem.Value);//Enum.IsDefined(typeof(EnumConstants.SpecialCondition), strDOWFake);ddlSpclCondition.SelectedItem.Text); hsn.IsNotified = ddlNotified.SelectedIndex > 0 ? Convert.ToBoolean(ddlNotified.SelectedItem.Text) : false; hsn.IsNilRated = ddlNilRated.SelectedIndex > 0 ? Convert.ToBoolean(ddlNilRated.SelectedItem.Text) : false; hsn.IsExempted = ddlExempted.SelectedIndex > 0 ? Convert.ToBoolean(ddlExempted.SelectedItem.Text) : false; hsn.IsZeroRated = ddlZeroRated.SelectedIndex > 0 ? Convert.ToBoolean(ddlZeroRated.SelectedItem.Text) : false; hsn.IsNonGSTGoods = ddlNonGSTGoods.SelectedIndex > 0 ? Convert.ToBoolean(ddlNonGSTGoods.SelectedItem.Text) : false; hsn.Description = txtDescription.Text.Trim(); hsn.BuisnessTypeId = Convert.ToInt32(ddlBusinessType.SelectedValue); string itemid = Convert.ToString(ViewState["Item_ID"]); if (itemid == "" || itemid == null) { string itemcode = Convert.ToString(hsn.ItemCode); bool getitemcode = unitOfwork.ItemRepository.Contains(c => c.ItemCode == itemcode); if (getitemcode) { uc_sucess.ErrorMessage = "HSN No. already exists."; uc_sucess.VisibleError = true; return; } if (ddlUnit.SelectedIndex < 0) { uc_sucess.ErrorMessage = "!Kindly select unit name."; uc_sucess.VisibleError = true; return; } hsn.Unit = ddlUnit.SelectedItem.Text; hsn.IGST = Convert.ToDecimal(txtIgst.Text.Trim()); hsn.CGST = Convert.ToDecimal(txtCgst.Text.Trim()); hsn.SGST = Convert.ToDecimal(txtSgst.Text.Trim()); hsn.UGST = Convert.ToDecimal(txtUgst.Text.Trim()); hsn.CESS = Convert.ToDecimal(txtCess.Text.Trim()); if (ddlSubGroup.SelectedIndex <= 0) { uc_sucess.ErrorMessage = "!Kindly select Sub-Group."; uc_sucess.VisibleError = true; return; } hsn.SubGroupID = Convert.ToInt32(ddlSubGroup.SelectedValue.ToString()); //if (getitemcode) //{ // uc_sucess.ErrorMessage = "Sub-Group already exist."; // uc_sucess.VisibleError = true; // return; //} hsn.Status = true; hsn.ItemType = 1; hsn.ActiveFrom = DateTime.Now; hsn.CreatedBy = Common.LoggedInUserID(); hsn.CreatedDate = DateTime.Now; hsn.ItemType = 0; hsn.UserId = Common.LoggedInUserID(); //string itemHsn = Convert.ToString(hsn.ItemCode); //bool getitemHsn = unitOfwork.ItemRepository.Contains(c => c.ItemCode == itemHsn); //if (getitemHsn) //{ // uc_sucess.ErrorMessage = "Sub-Group already exist."; // uc_sucess.VisibleError = true; // return; //} unitOfwork.ItemRepository.Create(hsn); unitOfwork.Save(); uc_sucess.SuccessMessage = "HSN created successfully."; uc_sucess.Visible = true; ddlSubGroup.DataBind(); ClearItem(); BindSubGroup(); BindNotifiedHSN(); BindHSN(); } else { string itemcode = Convert.ToString(hsn.ItemCode); bool getitemcode = unitOfwork.ItemRepository.Contains(c => c.ItemCode == itemcode); if (ddlSubGroup.SelectedIndex <= 0) { uc_sucess.ErrorMessage = "!Kindly select Sub-Group."; uc_sucess.VisibleError = true; return; } int itemsid = Convert.ToInt32(itemid); var getitemId = unitOfwork.ItemRepository.Filter(f => f.Item_ID == itemsid).FirstOrDefault(); getitemId.SpecialConditionApplied = Convert.ToByte(ddlSpclCondition.SelectedIndex); getitemId.SubGroupID = Convert.ToInt32(ddlSubGroup.SelectedValue.ToString()); getitemId.ItemCode = txtHsnNo.Text.Trim(); getitemId.Unit = Convert.ToString(ddlUnit.SelectedValue.ToString()); getitemId.Unit = ddlUnit.SelectedItem.Text; getitemId.IGST = Convert.ToDecimal(txtIgst.Text.Trim()); getitemId.CGST = Convert.ToDecimal(txtCgst.Text.Trim()); getitemId.SGST = Convert.ToDecimal(txtSgst.Text.Trim()); getitemId.UGST = Convert.ToDecimal(txtUgst.Text.Trim()); getitemId.CESS = Convert.ToDecimal(txtCess.Text.Trim()); getitemId.IsNotified = Convert.ToBoolean(ddlNotified.SelectedItem.Text); getitemId.IsNilRated = Convert.ToBoolean(ddlNilRated.SelectedItem.Text); getitemId.IsExempted = Convert.ToBoolean(ddlExempted.SelectedItem.Text); getitemId.IsZeroRated = Convert.ToBoolean(ddlZeroRated.SelectedItem.Text); getitemId.IsNonGSTGoods = Convert.ToBoolean(ddlNonGSTGoods.SelectedItem.Text); getitemId.Description = txtDescription.Text.Trim(); getitemId.UpdatedBy = Common.LoggedInUserID(); unitOfwork.ItemRepository.Update(getitemId); unitOfwork.Save(); uc_sucess.SuccessMessage = "Items successfully updated."; uc_sucess.Visible = true; itemid = string.Empty; ClearItem(); BindSubGroup(); BindNotifiedHSN(); BindHSN(); } } catch (Exception ex) { cls_ErrorLog ob = new cls_ErrorLog(); cls_ErrorLog.LogError(ex, Common.LoggedInUserID()); uc_sucess.ErrorMessage = ex.Message; uc_sucess.VisibleError = true; } }
public static decimal TaxRate(GST_MST_ITEM item, bool isInterState, bool isExportedInvoice, bool isImport, bool isUTState, bool jobWork, bool isEcom, bool isUN, EnumConstants.TaxType taxType, decimal taxableValue, decimal taxRate) { decimal tax = 0; if (taxType == EnumConstants.TaxType.IGST) { if (jobWork) { tax = 0; } else if (item.IsNilRated.Value) { tax = 0; } else { //if (isUTState) //{ tax = 0; } if (isUTState && isInterState) { tax = taxRate; } else if (isUTState) { tax = 0; } else { if (isInterState) { tax = taxRate; } else { if (isExportedInvoice) { tax = taxRate; } else { if (isImport) { tax = taxRate; } else { tax = 0; } } } } } } else if (taxType == EnumConstants.TaxType.CGST) { if (jobWork) { tax = 0; } else if (item.IsNilRated.Value) { tax = 0; } else { if (isUTState && isInterState) { tax = 0; } else if (isUTState) { tax = taxRate; } //if (isUTState) //{ // tax = taxRate;//0; //}//(isUTState ? 0 : (isInter ? 0 : (isExport ? 0 : Calculate.CalculateCGSTLineIDWise(invo.TaxableValueLineIDWise, invo.Item.CGST.Value)))) else { if (isInterState) { tax = 0; } else { if (isExportedInvoice) { tax = 0; } else { tax = taxRate; } } } } } else if (taxType == EnumConstants.TaxType.SGST) { //isJobwork ? 0 : (isUTState ? 0 : (isInter ? 0 : (isExport ? 0 : Calculate.CalculateSGSTLineIDWise(invo.TaxableValueLineIDWise, invo.Item.SGST.Value)))), if (jobWork) { tax = 0; } else if (item.IsNilRated.Value) { tax = 0; } else { if (isUTState && isInterState) { tax = 0; } //else if (isUTState) //{ tax = taxRate; } else if (isUTState) { tax = 0; } else { if (isInterState) { tax = 0; } else { if (isExportedInvoice) { tax = 0; } else { tax = taxRate; } } } } } else if (taxType == EnumConstants.TaxType.UTGST) {// isJobwork ? 0 : (isExport ? 0 : (isUTState ? Calculate.CalculateUGSTLineIDWise(invo.TaxableValueLineIDWise, invo.Item.UGST.Value) : 0)), if (jobWork) { tax = 0; } else if (item.IsNilRated.Value) { tax = 0; } else { if (isExportedInvoice) { tax = 0; } else { if (isUTState && isInterState) { tax = 0; } else if (isUTState) { tax = taxRate; } //if (isUTState) //{ // tax = taxRate; //} else { tax = 0; } } } } else { tax = 0; } return(tax); }