public ActionResult Edit(int id) { ViewBag.ActiveMenu = "admin"; var model = new CashReceiptModel().GetCashReceiptDetails(id); return(View("..\\CashReceipt\\Edit", model)); }
internal DataTable LoadNarration(CashReceiptModel objCashRec) { try { ClsCon.cmd = new SqlCommand(); ClsCon.cmd.CommandType = CommandType.StoredProcedure; ClsCon.cmd.CommandText = "SPMasters"; ClsCon.cmd.Parameters.AddWithValue("@DataInd", objCashRec.Ind); ClsCon.cmd.Parameters.AddWithValue("@OrgID", objCashRec.OrgID); ClsCon.cmd.Parameters.AddWithValue("@BrID", objCashRec.BrID); ClsCon.cmd.Parameters.AddWithValue("@YrCD", objCashRec.YrCD); ClsCon.cmd.Parameters.AddWithValue("@VchType", objCashRec.VchType); con = ClsCon.SqlConn(); ClsCon.cmd.Connection = con; dtCashReceipt = new DataTable(); ClsCon.da = new SqlDataAdapter(ClsCon.cmd); ClsCon.da.Fill(dtCashReceipt); dtCashReceipt.TableName = "success"; } catch (Exception) { dtCashReceipt = new DataTable(); dtCashReceipt.TableName = "error"; return(dtCashReceipt); } finally { con.Close(); con.Dispose(); ClsCon.da.Dispose(); ClsCon.cmd.Dispose(); } return(dtCashReceipt); }
internal DataTable PartySelect(CashReceiptModel objCashRec) { try { ClsCon.cmd = new SqlCommand(); ClsCon.cmd.CommandType = CommandType.StoredProcedure; ClsCon.cmd.CommandText = "SPSearchByAccount"; ClsCon.cmd.Parameters.AddWithValue("@Ind", objCashRec.Ind); ClsCon.cmd.Parameters.AddWithValue("@OrgID", objCashRec.OrgID); ClsCon.cmd.Parameters.AddWithValue("@BrID", objCashRec.BrID); ClsCon.cmd.Parameters.AddWithValue("@AccCode", objCashRec.AccCode); con = ClsCon.SqlConn(); ClsCon.cmd.Connection = con; dtCashReceipt = new DataTable(); ClsCon.da = new SqlDataAdapter(ClsCon.cmd); ClsCon.da.Fill(dtCashReceipt); dtCashReceipt.TableName = "success"; } catch (Exception) { dtCashReceipt = new DataTable(); dtCashReceipt.TableName = "error"; return(dtCashReceipt); } finally { con.Close(); con.Dispose(); ClsCon.da.Dispose(); ClsCon.cmd.Dispose(); } return(dtCashReceipt); }
internal DataTable CheckBudgetHead(CashReceiptModel plcashrec) { try { ClsCon.cmd = new SqlCommand(); ClsCon.cmd.CommandType = CommandType.StoredProcedure; ClsCon.cmd.CommandText = "SPCashVoucher"; ClsCon.cmd.Parameters.AddWithValue("@DataInd", plcashrec.Ind); ClsCon.cmd.Parameters.AddWithValue("@OrgID", plcashrec.OrgID); ClsCon.cmd.Parameters.AddWithValue("@BrID", plcashrec.BrID); ClsCon.cmd.Parameters.AddWithValue("@YrCD", plcashrec.YrCD); ClsCon.cmd.Parameters.AddWithValue("@AccCode", plcashrec.AccCode); con = ClsCon.SqlConn(); ClsCon.cmd.Connection = con; dtCashReceipt = new DataTable(); ClsCon.da = new SqlDataAdapter(ClsCon.cmd); ClsCon.da.Fill(dtCashReceipt); dtCashReceipt.TableName = "success"; } catch (Exception) { dtCashReceipt = new DataTable(); dtCashReceipt.TableName = "error"; return(dtCashReceipt); } finally { con.Close(); con.Dispose(); ClsCon.da.Dispose(); ClsCon.cmd.Dispose(); } return(dtCashReceipt); }
public DataSet PartySelect(CashReceiptModel plcashrec) { DataSet dsPartySelect = new DataSet(); plcashrec.Ind = 2; DataTable SecondaryParty = dlCashReceipt.PartySelect(plcashrec); if (SecondaryParty.Rows.Count > 0) { SecondaryParty.TableName = "SecondaryParty"; dsPartySelect.Tables.Add(SecondaryParty); return(dsPartySelect); } plcashrec.Ind = 3; DataTable OutstandingBill = dlCashReceipt.PartySelect(plcashrec); if (SecondaryParty.Rows.Count > 0) { SecondaryParty.TableName = "OutstandingBill"; dsPartySelect.Tables.Add(OutstandingBill); return(dsPartySelect); } return(dsPartySelect); }
public ActionResult SaveUpdateCashReceipt(CashReceiptModel model) { try { return(Json(new { Msg = (new CashReceiptModel().SaveUpdateCashReceipt(model)) }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { Msg = ex.Message }, JsonRequestBehavior.AllowGet)); } }
/// <summary> /// Starts the process of reconciling a cash receipt. /// </summary> /// <param name="currentUser">The user that started the process.</param> /// <param name="cashReceipt">The cash receipt being reconciled.</param> /// <returns></returns> public async Task ReconcileCashReceipt(PortalUser currentUser, CashReceiptModel cashReceipt) { CashReceipt dbCashReceipt = await repository.GetCashReceiptById(cashReceipt.CashReceiptId); dbCashReceipt.TransactionStatusTypeId = (int)TransactionStatusType.Enum.Reconciled; dbCashReceipt.ModifiedBy = currentUser.PortalUsername; dbCashReceipt.ModifiedDate = DateTime.UtcNow; await repository.SaveChanges(); await CreateCashReceiptRevision(currentUser, cashReceipt.CashReceiptId, "Reconciled"); }
internal DataTable SaveCashReceipt(CashReceiptModel objCashRec) { try { ClsCon.cmd = new SqlCommand(); ClsCon.cmd.CommandType = CommandType.StoredProcedure; ClsCon.cmd.CommandText = "SPCashVoucher"; ClsCon.cmd.Parameters.AddWithValue("@DataInd", objCashRec.Ind); ClsCon.cmd.Parameters.AddWithValue("@OrgID", objCashRec.OrgID); ClsCon.cmd.Parameters.AddWithValue("@BrID", objCashRec.BrID); ClsCon.cmd.Parameters.AddWithValue("@YrCD", objCashRec.YrCD); ClsCon.cmd.Parameters.AddWithValue("@VchType", objCashRec.VchType); ClsCon.cmd.Parameters.AddWithValue("@CCCode", objCashRec.CCCode); //ClsCon.cmd.Parameters.AddWithValue("@TblCash", objCashRec.Dt); ClsCon.cmd.Parameters.AddWithValue("@TblCash", JsonConvert.DeserializeObject <DataTable>(objCashRec.Dt)); ClsCon.cmd.Parameters.AddWithValue("@RevenuePartyName", objCashRec.PartyName); ClsCon.cmd.Parameters.AddWithValue("@RevenuePartyAddress", objCashRec.PartyAddress); ClsCon.cmd.Parameters.AddWithValue("@RevenuePartyGSTIN", objCashRec.PartyGstIN); ClsCon.cmd.Parameters.AddWithValue("@RevenueServiceNo", objCashRec.ServiceNo); con = ClsCon.SqlConn(); ClsCon.cmd.Connection = con; dtCashReceipt = new DataTable(); ClsCon.da = new SqlDataAdapter(ClsCon.cmd); ClsCon.da.Fill(dtCashReceipt); dtCashReceipt.TableName = "success"; } catch (Exception) { dtCashReceipt = new DataTable(); dtCashReceipt.TableName = "error"; return(dtCashReceipt); } finally { con.Close(); con.Dispose(); ClsCon.da.Dispose(); ClsCon.cmd.Dispose(); } return(dtCashReceipt); }
/// <summary> /// This method will convert from the database model of cash receipt to the DTO verison. /// </summary> /// <param name="cashReceipt">The database model of cash receipt.</param> /// <returns>The DTO of cash receipt.</returns> public CashReceiptModel LoadCashReceipt(CashReceipt cashReceipt) { CashReceiptModel resp = new CashReceiptModel() { PaymentDate = cashReceipt.PaymentDate, PaymentNumber = cashReceipt.PaymentNumber, DispatchLoadNumber = cashReceipt.DispatchLoadNumber, Driver = null, DriverFuelSurcharge = cashReceipt.DriverFuelSurcharge, DriverRate = cashReceipt.DriverRate, CashReceiptId = cashReceipt.CashReceiptId, ManufacturerFuelSurcharge = cashReceipt.ManufacturerFuelSurcharge, ManufacturerRate = cashReceipt.ManufacturerRate, Terminal = cashReceipt.CenterId, TrackingIdNumber = cashReceipt.VIN, VendorId = cashReceipt.ManufacturerId, IsReconciled = false, IsDeleted = false }; //if (cashReceipt.Driver != null) //{ // resp.Driver = new DriverModel() // { // DriverId = cashReceipt.Driver.DriverId, // DriverFirstName = cashReceipt.Driver.FirstName, // DriverLastName = cashReceipt.Driver.LastName, // DriverFullName = $"{cashReceipt.Driver.FirstName} {cashReceipt.Driver.LastName}" // }; //} if (cashReceipt.Truck != null) { resp.TruckId = cashReceipt.Truck.TruckId; resp.TruckNumber = cashReceipt.Truck.TruckNumber; } return(resp); }
public DataTable AccountHead(CashReceiptModel plcashrec) { DataTable AccHeadList = dlCashReceipt.AccountHead(plcashrec); return(AccHeadList); }
public SaveCashReceiptRequest() { CurrentCashReceipt = new CashReceiptModel(); CurrentUser = new UserModel(); }
public DataTable CheckBudgetHead(CashReceiptModel plcashrec) { DataTable lstcashrec = dlCashReceipt.CheckBudgetHead(plcashrec); return(lstcashrec); }
/// <summary> /// This will save the data supplied in cashReciept to the databased as an insert or an update. /// A 0 id denotes a new records(insert). An id > 0 will denote a record being updated. /// </summary> /// <param name="currentUser">The user performing the operation.</param> /// <param name="cashReceipt">The data to update the databased with.</param> /// <exception cref="NullReferenceException">This exception will be thrown when no driver or cash receipt exists with the data provided.</exception> /// <exception cref="UnauthorizedAccessException">Denotes that you tried to update a record that does not belong to the user's company.</exception> /// <returns>The updated cash receipt model.</returns> public async Task <CashReceiptModel> SaveCashReceipt(PortalUser currentUser, CashReceiptModel cashReceipt) { var existingCashReceipt = await repository.GetCashReceiptById(cashReceipt.CashReceiptId); if (existingCashReceipt == null & cashReceipt.CashReceiptId > 0) { throw new NullReferenceException("The cash receipt does not exist."); } else if (existingCashReceipt == null) { existingCashReceipt = new CashReceipt() { CreatedBy = currentUser.PortalUsername, CreatedDate = DateTime.UtcNow, ModifiedBy = currentUser.PortalUsername, ModifiedDate = DateTime.UtcNow }; } else if (existingCashReceipt.CompanyId != currentUser.CompanyId) { throw new UnauthorizedAccessException("You cannot access this cash receipt as this user."); } existingCashReceipt.CenterId = cashReceipt.Terminal; existingCashReceipt.PaymentDate = cashReceipt.PaymentDate; existingCashReceipt.PaymentNumber = cashReceipt.PaymentNumber; existingCashReceipt.DispatchLoadNumber = cashReceipt.DispatchLoadNumber; existingCashReceipt.DriverFuelSurcharge = cashReceipt.DriverFuelSurcharge; existingCashReceipt.DriverRate = cashReceipt.DriverRate; existingCashReceipt.CompanyId = currentUser.CompanyId; existingCashReceipt.IsActive = true; existingCashReceipt.ManufacturerFuelSurcharge = cashReceipt.ManufacturerFuelSurcharge; existingCashReceipt.ManufacturerId = cashReceipt.VendorId; existingCashReceipt.ManufacturerRate = cashReceipt.ManufacturerRate; existingCashReceipt.VIN = cashReceipt.TrackingIdNumber; existingCashReceipt.TransactionStatusTypeId = (int)TransactionStatusType.Enum.Open; if (cashReceipt.Driver != null) { var driver = cashReceipt.Driver != null ? await repository.GetDriverById(cashReceipt.Driver.DriverId) : null; if (driver != null) { existingCashReceipt.DriverId = driver.DriverId; } else { throw new NullReferenceException("Driver was not found."); } } var truck = await repository.GetTruckByTruckNumber(cashReceipt.TruckNumber); if (truck != null) { existingCashReceipt.TruckId = truck.TruckId; } if (cashReceipt.CashReceiptId == 0) { repository.Insert(existingCashReceipt); await repository.SaveChanges(); await CreateCashReceiptRevision(currentUser, existingCashReceipt.CashReceiptId, "Created"); } else { existingCashReceipt.ModifiedBy = currentUser.PortalUsername; existingCashReceipt.ModifiedDate = DateTime.UtcNow; repository.Attach(existingCashReceipt); await repository.SaveChanges(); await CreateCashReceiptRevision(currentUser, existingCashReceipt.CashReceiptId, "Updated"); } return(LoadCashReceipt(existingCashReceipt)); }
public DataTable SaveCashReceipt(CashReceiptModel plcashrec) { DataTable lstcashrec = dlCashReceipt.SaveCashReceipt(plcashrec); return(lstcashrec); }
public DataTable LastVoucherNo(CashReceiptModel plcashrec) { DataTable LastVoucherNo = dlCashReceipt.LastVoucherNo(plcashrec); return(LastVoucherNo); }
public DataSet BindAllCashReceiptDDL(CashReceiptModel plcashrec) { DataSet dsBindAllCRDDL = dlCashReceipt.BindAllCashReceiptDDL(plcashrec); return(dsBindAllCRDDL); }
public DataTable LoadCashAccount(CashReceiptModel plcashrec) { DataTable lstcashrec = dlCashReceipt.LoadCashAccount(plcashrec); return(lstcashrec); }
public DataTable LoadNarration(CashReceiptModel plcashrec) { DataTable NarrationList = dlCashReceipt.LoadNarration(plcashrec); return(NarrationList); }