private Challan CreateObject(NullHandler oReader) { Challan oChallan = new Challan(); MapObject(oChallan, oReader); return(oChallan); }
public bool UpDateChallan(Challan oChallan, int nEditID) { try { SqlCommand cmd = new SqlCommand("SP_Challan_Update", _conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@ChallanType", SqlDbType.VarChar)).Value = oChallan.ChallanType; cmd.Parameters.Add(new SqlParameter("@ChallanNo", SqlDbType.VarChar)).Value = oChallan.ChallanNo; cmd.Parameters.Add(new SqlParameter("@Description", SqlDbType.VarChar)).Value = oChallan.Description; cmd.Parameters.Add(new SqlParameter("@DBUUID", SqlDbType.Int)).Value = EMSGlobal._nCurrentUserID; cmd.Parameters.Add(new SqlParameter("@ChallanID", SqlDbType.Int)).Value = nEditID; if (_conn.State == ConnectionState.Open) { } else { cmd.Connection.Open(); } cmd.ExecuteNonQuery(); cmd.Dispose(); cmd.Connection.Close(); return(true); } catch (Exception e) { throw new ServiceException(e.Message, e); } }
public ID Save(Challan oChallan) { try { if (oChallan.IsNew) { SqlCommand cmd = new SqlCommand("SP_Challan_Insert", _conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@ChallanType", SqlDbType.VarChar)).Value = oChallan.ChallanType; cmd.Parameters.Add(new SqlParameter("@ChallanNo", SqlDbType.VarChar)).Value = oChallan.ChallanNo; cmd.Parameters.Add(new SqlParameter("@Description", SqlDbType.VarChar)).Value = oChallan.Description; cmd.Parameters.Add(new SqlParameter("@DBUserID", SqlDbType.Int)).Value = EMSGlobal._nCurrentUserID; if (_conn.State == ConnectionState.Open) { } else { cmd.Connection.Open(); } int NewID = Convert.ToInt32(cmd.ExecuteScalar()); cmd.Dispose(); cmd.Connection.Close(); BusinessObject.Factory.SetID(oChallan, new ID(NewID)); } BusinessObject.Factory.SetObjectState(oChallan, ObjectState.Saved); } catch (Exception e) { throw new ServiceException(e.Message, e); } return(oChallan.ID); }
public ActionResult Delete(string id) { if (Request.Cookies.Get("tAdmin") != null) { string t = Request.Cookies.Get("tAdmin").Value; if (t == "Yes") { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Challan ch = db.Challans.Find(id); if (ch == null) { return(HttpNotFound()); } db.Challans.Remove(ch); db.SaveChanges(); return(RedirectToAction("Index"));; } else { return(RedirectToAction("Index", "TrafficLogin")); } } else { return(RedirectToAction("Index", "TrafficLogin")); } }
// GET: Challans/Details/5 public ActionResult Details(string id) { if (Request.Cookies.Get("tAdmin") != null) { string t = Request.Cookies.Get("tAdmin").Value; if (t == "Yes") { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Challan challan = db.Challans.Find(id); if (challan == null) { return(HttpNotFound()); } return(View(challan)); } else { return(RedirectToAction("Index", "TrafficLogin")); } } else { return(RedirectToAction("Index", "TrafficLogin")); } }
public ActionResult Create([Bind(Include = "ChallanNo,IssueDate,LicenceNo,RCNo,totalFine,Paid")] Challan challan) { if (Request.Cookies.Get("tAdmin") != null) { string t = Request.Cookies.Get("tAdmin").Value; if (t == "Yes") { if (ModelState.IsValid) { db.Challans.Add(challan); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(challan)); } else { return(RedirectToAction("Index", "TrafficLogin")); } } else { return(RedirectToAction("Index", "TrafficLogin")); } }
public Challan GetByID(int nID) { Challan oChallan = new Challan(); try { SqlCommand cmd = new SqlCommand("SP_Challan_GetByID", _conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@ChallanID", SqlDbType.Int)).Value = nID; if (_conn.State == ConnectionState.Open) { } else { cmd.Connection.Open(); } IDataReader reader = cmd.ExecuteReader(); NullHandler oReader = new NullHandler(reader); if (reader.Read()) { oChallan = CreateObject(oReader); } cmd.Dispose(); cmd.Connection.Close(); } catch (Exception e) { throw new ServiceException(e.Message, e); } return(oChallan); }
public ChallanPageSide(PageLoader pageLoader, Challan challan) : base(pageLoader) { InitializeComponent(); DataContext = this; Challan = challan; NotifyPropertyChanged("Challan"); }
public ChallanPageNav(PageLoader pageLoader, Challan orderChallan, ChallanPage pageRef) : base(pageLoader) { InitializeComponent(); DataContext = this; OrderChallan = orderChallan; challanPageRef = pageRef; }
private void btnSave_Click(object sender, EventArgs e) { if (ValidateControl()) { List <Challan> lstChallan = new List <Challan>(); List <ChallanItem> lstChallanItem = new List <ChallanItem>(); List <ChallanDriver> lstChallanDriver = new List <ChallanDriver>(); List <ChallanFarmer> lstChallanFarmer = new List <ChallanFarmer>(); List <ChallanVehicle> lstChallanVehicle = new List <ChallanVehicle>(); Challan oChallan = new Challan(); oChallan.ChallanID = 0; oChallan.ChallanNo = lblChallanNo.Text.Trim().ToString(); oChallan.ChallanDate = Convert.ToDateTime(mskChallanDate.Text); oChallan.ChallanTime = Convert.ToDateTime(mskChallanTime.Text); oChallan.WeighingReceiptNo = Convert.ToString(txtWeighingReceiptNo.Text); oChallan.SessionID = eGlobal.LoginSessionID; lstChallan.Add(oChallan); ChallanItem oChallanItem = new ChallanItem(); oChallanItem.ItemTypeCode = Convert.ToInt16(cmbChallanItem.SelectedValue); oChallanItem.ItemTypeDesc = Convert.ToString(cmbChallanItem.Text); oChallanItem.QunatityInKg = Convert.ToDecimal(txtQuantityInKg.Text); oChallanItem.Rate = Convert.ToDecimal(txtRate.Text); lstChallanItem.Add(oChallanItem); ChallanDriver oChallanDriver = null; ChallanFarmer oChallanFarmer = null; if (rdReceiverType_Driver.Checked) { oChallanDriver = new ChallanDriver(); oChallanDriver.PersonID = Convert.ToInt64(cmbDriversList.SelectedValue); lstChallanDriver.Add(oChallanDriver); } if (rdReceiverType_Farmer.Checked) { oChallanFarmer = new ChallanFarmer(); oChallanFarmer.PersonID = Convert.ToInt64(cmbFamersList.SelectedValue); lstChallanFarmer.Add(oChallanFarmer); } ChallanVehicle oChallanVehicle = new ChallanVehicle(); oChallanVehicle.VehicleRegNo = txtVehicleRegNo.Text; oChallanVehicle.VechileTypeCode = Convert.ToInt16(cmbVehicleList.SelectedValue); oChallanVehicle.VechileTypeDesc = cmbVehicleList.Text; oChallanVehicle.LoaddedWeight = Convert.ToDecimal(txtLoadedWeight.Text); oChallanVehicle.EmptyWeight = Convert.ToDecimal(txtEmptyWeight.Text); lstChallanVehicle.Add(oChallanVehicle); DataTable dtChallan = null, dtChallanItem = null, dtChallanDriver = null, dtChallanFarmer = null, dtChallanVehicle = null; dtChallan = eGlobal.CreateDataTable(lstChallan); dtChallanItem = eGlobal.CreateDataTable(lstChallanItem); dtChallanDriver = eGlobal.CreateDataTable(lstChallanDriver.Count > 0 ? lstChallanDriver : null); dtChallanFarmer = eGlobal.CreateDataTable(lstChallanFarmer.Count > 0 ? lstChallanFarmer : null); dtChallanVehicle = eGlobal.CreateDataTable(lstChallanVehicle); } }
public ActionResult Delete(int id) { Challan ch = _context.Challans.Find(id); _context.Challans.Remove(ch); _context.SaveChanges(); TempData["message"] = "Challan deleted successfully"; return(RedirectToAction("Index", new { id = ch.CustomerId })); }
public ActionResult challanDL(string dl_no, string IssueDate, string[] Rules, string paid) { if (Request.Cookies.Get("tpid") != null) { Challan chln = new Challan(); chln.IssueDate = DateTime.Parse(IssueDate); int sum = 0; int ct = 1; foreach (string item in Rules) { int i = int.Parse(item); if (ct == 1) { ICollection <RULES> rl = db.RULESs.Where(m => m.RuleId == i).ToList(); chln.rules = rl; sum += (rl.First().Fine); } else { RULES rl = db.RULESs.Where(m => m.RuleId == i).First(); chln.rules.Add(rl); sum += (rl.Fine); } ct++; } chln.totalFine = sum; if (paid == "true") { chln.Paid = true; } else { chln.Paid = false; } if (ModelState.IsValid) { } chln.LicenceNo = dl_no; chln.ChallanNo = "CH" + DateTime.Now.GetHashCode().ToString().Substring(6) + "DL" + DateTime.Now.GetHashCode().ToString().Substring(6); db.Challans.Add(chln); db.SaveChanges(); return(RedirectToAction("Home", "TPHome")); } else { return(RedirectToAction("Index", "TPLogin")); } }
async void InitPage(PageLoader pageLoader) { OrderChallan = new Challan(); await OrderChallan.AssignChallanBookSerialNo(); PageNav = new ChallanPageNav(pageLoader, OrderChallan, this); PageSide = new ChallanPageSide(pageLoader, OrderChallan); VatList = await Tax.RetriveTaxesByType("VAT"); CstList = await Tax.RetriveTaxesByType("CST"); }
public ActionResult Edit(int id) { ViewData["CustomerList"] = new SelectList( _context.Customers .Select(x => new { x.Id, x.Name }) .OrderBy(x => x.Name) .ToList(), "Id", "Name", id); Challan ch = _context.Challans.Where(x => x.Id == id).FirstOrDefault(); return(View(ch)); }
private Challans CreateObjects(IDataReader oReader) { Challans oChallans = new Challans(); NullHandler oHandler = new NullHandler(oReader); while (oReader.Read()) { Challan oItem = CreateObject(oHandler); oChallans.Add(oItem); } return(oChallans); }
private void MapObject(Challan oChallan, NullHandler oReader) { BusinessObject.Factory.SetID(oChallan, new ID(oReader.GetInt32("ChallanID"))); oChallan.ChallanType = oReader.GetString("ChallanType"); oChallan.ChallanNo = oReader.GetString("ChallanNo"); oChallan.Description = oReader.GetString("Description"); BusinessObject.Factory.SetObjectState(oChallan, ObjectState.Saved); }
public ActionResult Edit(Challan ch) { if (ModelState.IsValid) { _context.Entry(ch).State = System.Data.Entity.EntityState.Modified; _context.SaveChanges(); return(RedirectToAction("Index", new { id = ch.CustomerId })); } else { ViewData["CustomerList"] = new SelectList( _context.Customers .Select(x => new { x.Id, x.Name }) .OrderBy(x => x.Name) .ToList(), "Id", "Name", ch.CustomerId); } return(View(ch)); }
public ActionResult Search(Challan challan) { if (challan.StudentID == null) { challan.StudentID = 0; } model.Challans = db.GetAllChallans(challan.BatchProgramID, challan.StudentID, challan.YearSemesterNo).ToList(); model.SelectedChallan = null; model.DisplayMode = "WriteOnly"; ViewBag.BatchProgramID = new SelectList(db.GetBatchProgramNameConcat("", 0), "ID", "Name", challan.BatchProgramID); ViewBag.YearSemesterNo = new SelectList(db.Semesters, "YearSemesterNo", "YearSemesterNo", challan.YearSemesterNo); if (model.Challans.Count == 0) { ViewBag.MessageType = "error"; ViewBag.Message = "No record found."; } return(View("ApproveChallans", model)); }
public void Create(Challan challan, List <ChallanDetails> challanDetails) { cmd = new SqlCommand("proc_CreateChallan", con); cmd.CommandType = CommandType.StoredProcedure; con.Open(); SqlParameter outparam = new SqlParameter("@OutChallanId", SqlDbType.Int) { Direction = ParameterDirection.Output }; cmd.Parameters.AddWithValue("@CustomerId", challan.CustomerId); cmd.Parameters.AddWithValue("@CompanyId", challan.CompanyId); cmd.Parameters.AddWithValue("@Amount_without_Tax", challan.AmountWithoutTax); cmd.Parameters.AddWithValue("@Tax_Amount", challan.TaxAmount); cmd.Parameters.AddWithValue("@Total_Amount", challan.TotalAmount); if (challan.Remarks != null) { cmd.Parameters.AddWithValue("@Remarks", challan.Remarks); } else { cmd.Parameters.AddWithValue("@Remarks", DBNull.Value); } cmd.Parameters.AddWithValue("@CST", challan.cst); cmd.Parameters.AddWithValue("@Vat", challan.vat); cmd.Parameters.AddWithValue("@E_CESS", challan.ecess); cmd.Parameters.AddWithValue("@SHE_CESS", challan.shecess); cmd.Parameters.AddWithValue("@Freight", challan.freight); cmd.Parameters.AddWithValue("@TCS", challan.tcs); cmd.Parameters.AddWithValue("@CreatedBy", "Admin"); cmd.Parameters.AddWithValue("@CreatedDate", DateTime.Now); cmd.Parameters.Add(outparam); cmd.ExecuteNonQuery(); int ChallanId = int.Parse(outparam.Value.ToString()); con.Close(); InsertChallanDetails(ChallanId, challanDetails, challan.CompanyId); }
public List <Challan> ReadChallanReportDetailsByChallanId(int ChallanId) { cmd = new SqlCommand("proc_ReadChallanReportByChallanId", con); cmd.CommandType = CommandType.StoredProcedure; con.Open(); cmd.Parameters.AddWithValue("@Challan_Id", ChallanId); SqlDataReader dr = cmd.ExecuteReader(); List <Challan> challan = new List <Challan>(); while (dr.Read()) { Challan Challan = new Challan(); Challan.ChallanId = Convert.ToInt32(dr["ChallanId"]); Challan.CompanyName = dr["CompanyName"].ToString(); Challan.CompanyAddress = dr["CompanyAddress"].ToString(); Challan.CreatedOn = Convert.ToDateTime(dr["CreatedOn"]); Challan.CustomerName = dr["CustomerName"].ToString(); Challan.CustomerAddress = dr["CustomerAddress"].ToString(); Challan.TinNumber = Convert.ToInt32(dr["TinNumber"]); Challan.AmountWithoutTax = Convert.ToDecimal(dr["AmountWithoutTax"]); Challan.cst = Convert.ToDecimal(dr["cst"]); Challan.vat = Convert.ToDecimal(dr["vat"]); Challan.ecess = Convert.ToDecimal(dr["ecess"]); Challan.shecess = Convert.ToDecimal(dr["shecess"]); Challan.freight = Convert.ToDecimal(dr["freight"]); Challan.tcs = Convert.ToDecimal(dr["tcs"]); Challan.TaxAmount = Convert.ToDecimal(dr["TaxAmount"]); Challan.TotalAmount = Convert.ToDecimal(dr["TotalAmount"]); challan.Add(Challan); } con.Close(); return(challan); }
public ActionResult InsertStudentChallan(int?StudentID, FormCollection fc) { GetEnrolledStudent_Result objES = db.GetEnrolledStudent(StudentID.ToString()).FirstOrDefault(); string ErrorMessage = ""; int count = 0; int? QuantityMain = 0; if (objES != null) { try { objES.IssueDate = fc["IssueDate"]; objES.LastDate = fc["LastDate"]; objES.YearSemesterNo = Convert.ToInt32(fc["YearSemesterNo"]); objES.AccountID = fc["AccountID"]; if (objES.YearSemesterNo == 0) { count++; ErrorMessage += count + "-" + string.Concat("Please select Year/Semester.") + "<br />"; ViewBag.MessageType = "error"; } if (string.IsNullOrEmpty(objES.IssueDate)) { count++; ErrorMessage += count + "-" + string.Concat("Please enter valid Issue Date.") + "<br />"; ViewBag.MessageType = "error"; } if (string.IsNullOrEmpty(objES.LastDate)) { count++; ErrorMessage += count + "-" + string.Concat("Please enter valid Last Date.") + "<br />"; ViewBag.MessageType = "error"; } if (string.IsNullOrEmpty(objES.AccountID)) { count++; ErrorMessage += count + "-" + string.Concat("Please select Bank Account.") + "<br />"; ViewBag.MessageType = "error"; } if (string.IsNullOrEmpty(ErrorMessage)) { Challan ch = new Challan(); ch.FormNo = objES.FormNo; ch.StudentID = objES.StudentID; ch.BatchProgramID = objES.BatchProgramID; ch.IssueDate = Convert.ToDateTime(objES.IssueDate); ch.LastDate = Convert.ToDateTime(objES.LastDate); ch.AccountID = Convert.ToInt32(objES.AccountID); ch.IsDeposited = "No"; ch.YearSemesterNo = objES.YearSemesterNo; ch.Voucher_Trans_ID = 0; ch.CreatedBy = Convert.ToInt32(Session["emp_id"]); ch.IsActive = "Yes"; db.Challans.Add(ch); db.SaveChanges(); //Getting Scope Identity int ChallanID = ch.ChallanID; //Inserting ChallanServices int totalRows = Convert.ToInt32(fc["TotalRows"]); for (int i = 1; i <= totalRows; i++) { if (fc["Amount_" + i] != null && fc["Amount_" + i] != "" && fc["Amount_" + i] != "0") { try { int?Quantity = Convert.ToInt32(fc["Quantity_" + i]); if (Quantity == 0 || Quantity == null) { QuantityMain = 1; } else { QuantityMain = Quantity; } int CollegeServiceID = Convert.ToInt32(fc["CollegeServiceID_" + i]); ChallanService chs = new ChallanService(); chs.ChallanID = ChallanID; chs.CollegeServiceID = CollegeServiceID; chs.Amount = Convert.ToInt32(fc["Amount_" + i]); chs.Quantity = QuantityMain; db.ChallanServices.Add(chs); db.SaveChanges(); } catch (EntityCommandExecutionException) { } } } ViewBag.MessageType = "success"; ViewBag.Message = "Data has been saved successfully."; } else { ViewBag.Message = ErrorMessage; } } catch (Exception ex) { ViewBag.MessageType = "error"; ViewBag.Message = ex.Message; } } else { ViewBag.MessageType = "error"; ViewBag.Message = "No student found to add challan."; } ViewBag.objES = objES; ViewBag.AccountID = new SelectList(dbFinance.Bank_Account, "Account_ID", "Account_No"); ViewBag.YearSemesterNo = new SelectList(db.Semesters, "YearSemesterNo", "YearSemesterNo"); ViewBag.StudentID = StudentID; return(View("SingleStudentChallan")); }
public ActionResult Create(Challan challan, FormCollection fc) { string ErrorMessage = ""; int count = 0; try { if (challan.StudentID == null) { challan.StudentID = 0; } challan.IsDeposited = "No"; if (challan.BatchProgramID == 0 || challan.BatchProgramID == null) { count++; ErrorMessage += count + "-" + string.Concat("Please select Program.") + "<br />"; ViewBag.MessageType = "error"; } if (challan.YearSemesterNo == 0 || challan.YearSemesterNo == null) { count++; ErrorMessage += count + "-" + string.Concat("Please select Year/Semester.") + "<br />"; ViewBag.MessageType = "error"; } if (challan.IssueDate == null) { count++; ErrorMessage += count + "-" + string.Concat("Please enter valid Issue Date.") + "<br />"; ViewBag.MessageType = "error"; } if (challan.LastDate == null) { count++; ErrorMessage += count + "-" + string.Concat("Please enter valid Last Date.") + "<br />"; ViewBag.MessageType = "error"; } if (challan.AccountID == null || challan.AccountID == 0) { count++; ErrorMessage += count + "-" + string.Concat("Please select Bank Account.") + "<br />"; ViewBag.MessageType = "error"; } if (string.IsNullOrEmpty(ErrorMessage)) { List <StudentProgramEnrollment> lstSPE = db.StudentProgramEnrollments.Where(s => s.BatchProgramID == challan.BatchProgramID).ToList(); foreach (var item in lstSPE) { Challan ch = new Challan(); ch.FormNo = db.Students.FirstOrDefault(s => s.StudentID == item.StudentID).FormNo; ch.StudentID = item.StudentID; ch.BatchProgramID = item.BatchProgramID; ch.IssueDate = challan.IssueDate; ch.LastDate = challan.LastDate; ch.AccountID = challan.AccountID; ch.IsDeposited = "No"; ch.YearSemesterNo = challan.YearSemesterNo; ch.Voucher_Trans_ID = 0; ch.CreatedBy = Convert.ToInt32(Session["emp_id"]); ch.IsActive = "Yes"; db.Challans.Add(ch); db.SaveChanges(); //Getting Scope Identity challan.ChallanID = ch.ChallanID; //Inserting ChallanServices int totalRows = Convert.ToInt32(fc["TotalRows"]); for (int i = 1; i <= totalRows; i++) { if (fc["Amount_" + i] != null && fc["Amount_" + i] != "" && fc["Amount_" + i] != "0") { try { int?Quantity = Convert.ToInt32(fc["Quantity_" + i]); if (Quantity == 0 || Quantity == null) { challan.Quantity = 1; } else { challan.Quantity = Quantity; } int CollegeServiceID = Convert.ToInt32(fc["CollegeServiceID_" + i]); ChallanService chs = new ChallanService(); chs.ChallanID = challan.ChallanID; chs.CollegeServiceID = CollegeServiceID; chs.Amount = Convert.ToInt32(fc["Amount_" + i]); chs.Quantity = challan.Quantity; db.ChallanServices.Add(chs); db.SaveChanges(); } catch (EntityCommandExecutionException) { ViewBag.MessageType = "success"; ViewBag.Message = "Data has been saved successfully."; } } } } ViewBag.MessageType = "success"; ViewBag.Message = "Data has been saved successfully."; } else { ViewBag.Message = ErrorMessage; } } catch (Exception ex) { ViewBag.MessageType = "error"; ViewBag.Message = ex.Message; } model.Challans = db.GetAllChallans(challan.BatchProgramID, challan.StudentID, challan.YearSemesterNo).ToList(); model.SelectedChallan = null; model.DisplayMode = "WriteOnly"; ViewBag.IsActive = new SelectList(db.Options, "OptionDesc", "OptionDesc", challan.IsActive); ViewBag.BatchProgramID = new SelectList(db.GetBatchProgramNameConcat("", 0), "ID", "Name", challan.BatchProgramID); ViewBag.YearSemesterNo = new SelectList(db.Semesters, "YearSemesterNo", "YearSemesterNo", challan.YearSemesterNo); ViewBag.AccountID = new SelectList(dbFinance.Bank_Account, "Account_ID", "Account_No", challan.AccountID); return(View("Index", model)); }
public ActionResult Index(ChallanViewModel model) { List <ChallanDetails> challanDetails = new List <ChallanDetails>(); Challan challan = new Challan(); decimal grandTotal = 0; if (ModelState.IsValid) { foreach (var item in model.lstChallanDetails) { ChallanDetails challanDetail = new ChallanDetails(); decimal amt = Convert.ToDecimal(item.Rate * item.Quantity); amt -= Convert.ToDecimal(amt * item.Discount) / 100; grandTotal += amt; challanDetail.CategoryId = item.CategoryId; challanDetail.Rate = item.Rate; challanDetail.Discount = item.Discount; challanDetail.Quantity = item.Quantity; challanDetails.Add(challanDetail); } model.AmountWithoutTax = grandTotal; if (model.vat != 0) { decimal ecess = (grandTotal * model.ecess) / 100; decimal shecess = (grandTotal * model.shecess) / 100; decimal tcs = (grandTotal * model.tcs) / 100; decimal freight = (grandTotal * model.freight) / 100; decimal vat = (grandTotal * model.vat) / 100; model.TaxAmount = ecess + shecess + tcs + freight + vat; } else { decimal ecess = (grandTotal * model.ecess) / 100; decimal shecess = (grandTotal * model.shecess) / 100; decimal tcs = (grandTotal * model.tcs) / 100; decimal freight = (grandTotal * model.freight) / 100; decimal cst = (grandTotal * model.cst) / 100; model.TaxAmount = ecess + shecess + tcs + freight + cst; } model.TotalAmount = model.AmountWithoutTax + model.TaxAmount; challan.AmountWithoutTax = model.AmountWithoutTax; challan.TaxAmount = model.TaxAmount; challan.TotalAmount = model.TotalAmount; challan.ecess = model.ecess; challan.shecess = model.shecess; challan.cst = model.cst; challan.vat = model.vat; challan.freight = model.freight; challan.tcs = model.tcs; challan.CustomerId = model.CustomerId; challan.Remarks = model.Remarks; challan.CompanyId = model.CompanyId; challanDAL.Create(challan, challanDetails); TempData["SuccessMsg"] = "Challan Created Successfully"; return(RedirectToAction("Index")); } model = GetData(); return(View(model)); }
private void LoadChallanData() { DataSet ds = GetChallanLoadInfo(); if (ds != null && ds.Tables.Count > 0) { Challan oChallan = new Challan(); if (ds.Tables[0] != null) { foreach (DataRow dr in ds.Tables[0].Rows) { lblChallanNo.Text = Convert.ToString(dr["ChallanNo"]); mskChallanDate.Text = Convert.ToDateTime(dr["ChallanDateTime"]).ToString("dd-MM-yyyy"); mskChallanTime.Text = Convert.ToDateTime(dr["ChallanDateTime"]).ToString("HH:mm:ss"); lblUserName.Text = eGlobal.UserName; } } if (ds.Tables[1] != null) { DataRow dr = ds.Tables[1].NewRow(); dr["PersonID"] = "-1"; dr["PersonCode"] = "-1"; dr["PersonName"] = "--Select--"; ds.Tables[1].Rows.InsertAt(dr, 0); cmbFamersList.DataSource = ds.Tables[1]; cmbFamersList.DisplayMember = "PersonName"; cmbFamersList.ValueMember = "PersonID"; } if (ds.Tables[2] != null) { DataRow dr = ds.Tables[2].NewRow(); dr["PersonID"] = "-1"; dr["PersonCode"] = "-1"; dr["PersonName"] = "--Select--"; ds.Tables[2].Rows.InsertAt(dr, 0); cmbDriversList.DataSource = ds.Tables[2]; cmbDriversList.DisplayMember = "PersonName"; cmbDriversList.ValueMember = "PersonID"; } if (ds.Tables[3] != null) { DataRow dr = ds.Tables[3].NewRow(); dr["Code"] = "0"; dr["Description"] = "--Select--"; ds.Tables[3].Rows.InsertAt(dr, 0); cmbChallanItem.DataSource = ds.Tables[3]; cmbChallanItem.DisplayMember = "Description"; cmbChallanItem.ValueMember = "Code"; } if (ds.Tables[4] != null) { DataRow dr = ds.Tables[4].NewRow(); dr["Code"] = "-1"; dr["Description"] = "--Select--"; ds.Tables[4].Rows.InsertAt(dr, 0); cmbVehicleList.DataSource = ds.Tables[4]; cmbVehicleList.DisplayMember = "Description"; cmbVehicleList.ValueMember = "Code"; } } }