Пример #1
0
        public async Task <IActionResult> PutStaffAdvanceReceipt(int id, StaffAdvanceReceipt staffAdvanceReceipt)
        {
            if (id != staffAdvanceReceipt.StaffAdvanceReceiptId)
            {
                return(BadRequest());
            }

            _context.Entry(staffAdvanceReceipt).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!StaffAdvanceReceiptExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            StaffAdvanceReceipt staffAdvanceReceipt = db.StaffAdvanceReceipts.Find(id);

            db.StaffAdvanceReceipts.Remove(staffAdvanceReceipt);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #3
0
        //public void OnUpdate(eStoreDbContext db, StaffAdvancePayment salPayment)
        //{
        //    var old = db.StaffAdvancePayments.Where(c => c.StaffAdvancePaymentId == salPayment.StaffAdvancePaymentId).Select(d => new { d.Amount, d.PaymentDate, d.PayMode }).FirstOrDefault();
        //    if (old != null)
        //    {
        //        UpdateOutAmount(db, old.Amount, old.PayMode, old.PaymentDate, true);
        //    }
        //    UpdateOutAmount(db, salPayment.Amount, salPayment.PayMode, salPayment.PaymentDate, false);
        //    HRMBot.NotifyStaffPayment(db, "", salPayment.EmployeeId, salPayment.Amount, "Advance Payment: " + salPayment.Details);
        //}

        public void OnUpdate(eStoreDbContext db, StaffAdvanceReceipt salPayment)
        {
            //var old = db.StaffAdvanceReceipts.Where(c => c.StaffAdvanceReceiptId == salPayment.StaffAdvanceReceiptId).Select(d => new { d.Amount, d.ReceiptDate, d.PayMode }).FirstOrDefault();
            //if (old != null)
            //{
            //    UpdateInAmount(db, old.Amount, old.PayMode, old.ReceiptDate, true);
            //}
            //UpdateInAmount(db, salPayment.Amount, salPayment.PayMode, salPayment.ReceiptDate, false);
            //HRMBot.NotifyStaffPayment(db, "", salPayment.EmployeeId, salPayment.Amount, "Advance Receipt: " + salPayment.Details, true);
        }
Пример #4
0
 private void ProcessAccounts(StaffAdvanceReceipt objectName)
 {
     if (objectName.PayMode == PayModes.Cash)
     {
         Utils.UpDateCashInHand(db, objectName.ReceiptDate, objectName.Amount);
     }
     //TODO: in future make it more robust
     if (objectName.PayMode != PayModes.Cash && objectName.PayMode != PayModes.Coupons && objectName.PayMode != PayModes.Points)
     {
         Utils.UpDateCashInBank(db, objectName.ReceiptDate, objectName.Amount);
     }
 }
Пример #5
0
 public ActionResult Edit([Bind(Include = "StaffAdvanceReceiptId,EmployeeId,ReceiptDate,Amount,PayMode,Details")] StaffAdvanceReceipt staffAdvanceReceipt)
 {
     if (ModelState.IsValid)
     {
         ProcessAccounts(staffAdvanceReceipt);
         db.Entry(staffAdvanceReceipt).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.EmployeeId = new SelectList(db.Employees, "EmployeeId", "StaffName", staffAdvanceReceipt.EmployeeId);
     return(View(staffAdvanceReceipt));
 }
        public async Task <IActionResult> Create([Bind("StaffAdvanceReceiptId,EmployeeId,ReceiptDate,Amount,PayMode,Details")] StaffAdvanceReceipt staffAdvanceReceipt)
        {
            if (ModelState.IsValid)
            {
                _context.Add(staffAdvanceReceipt);
                new PayRollManager().OnInsert(_context, staffAdvanceReceipt);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeId"] = new SelectList(_context.Employees, "EmployeeId", "StaffName", staffAdvanceReceipt.EmployeeId);
            return(PartialView(staffAdvanceReceipt));
        }
Пример #7
0
        // GET: StaffAdvanceReceipts/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StaffAdvanceReceipt staffAdvanceReceipt = db.StaffAdvanceReceipts.Find(id);

            if (staffAdvanceReceipt == null)
            {
                return(HttpNotFound());
            }
            return(PartialView(staffAdvanceReceipt));
        }
Пример #8
0
        // GET: StaffAdvanceReceipts/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StaffAdvanceReceipt staffAdvanceReceipt = db.StaffAdvanceReceipts.Find(id);

            if (staffAdvanceReceipt == null)
            {
                return(HttpNotFound());
            }
            ViewBag.EmployeeId = new SelectList(db.Employees, "EmployeeId", "StaffName", staffAdvanceReceipt.EmployeeId);
            return(View(staffAdvanceReceipt));
        }
Пример #9
0
        public async Task <ActionResult <StaffAdvanceReceipt> > PostStaffAdvanceReceipt(StaffAdvanceReceipt staffAdvanceReceipt)
        {
            _context.StaffAdvanceReceipts.Add(staffAdvanceReceipt);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetStaffAdvanceReceipt", new { id = staffAdvanceReceipt.StaffAdvanceReceiptId }, staffAdvanceReceipt));
        }
 public void OnDelete(AprajitaRetailsContext db, StaffAdvanceReceipt salPayment)
 {
     UpdateOutAmount(db, salPayment.Amount, salPayment.PayMode, salPayment.ReceiptDate, true);
 }
 public void OnInsert(AprajitaRetailsContext db, StaffAdvanceReceipt salPayment)
 {
     UpdateInAmount(db, salPayment.Amount, salPayment.PayMode, salPayment.ReceiptDate, false);
     HRMBot.NotifyStaffPayment(db, "", salPayment.EmployeeId, salPayment.Amount, "Advance Receipt: " + salPayment.Details, true);
 }
        [Authorize(Roles = "Admin,PowerUser")]     public async Task <IActionResult> Edit(int id, [Bind("StaffAdvanceReceiptId,EmployeeId,ReceiptDate,Amount,PayMode,Details")] StaffAdvanceReceipt staffAdvanceReceipt)
        {
            if (id != staffAdvanceReceipt.StaffAdvanceReceiptId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    new PayRollManager().OnUpdate(_context, staffAdvanceReceipt);
                    _context.Update(staffAdvanceReceipt);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StaffAdvanceReceiptExists(staffAdvanceReceipt.StaffAdvanceReceiptId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeId"] = new SelectList(_context.Employees, "EmployeeId", "StaffName", staffAdvanceReceipt.EmployeeId);
            return(PartialView(staffAdvanceReceipt));
        }
Пример #13
0
 public void OnDelete(eStoreDbContext db, StaffAdvanceReceipt salPayment)
 {
     UpdateOutAmount(db, salPayment.Amount, salPayment.PayMode, salPayment.ReceiptDate, true);
 }