Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,CompanyId,PersonId,PersonId1,WorkStarted,WorkEnded,TimeWorked,FeePerHour,TotalPayment,PurchaseOrderId,WorkDescription,Paid,AmountPaid,DueToPay")] PROWorkReport pROWorkReport)
        {
            if (id != pROWorkReport.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pROWorkReport);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PROWorkReportExists(pROWorkReport.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PersonId"]        = new SelectList(_context.Person, "Id", "Id", pROWorkReport.PersonId);
            ViewData["CompanyId"]       = new SelectList(_context.Company, "Id", "Id", pROWorkReport.CompanyId);
            ViewData["PersonId1"]       = new SelectList(_context.Person, "Id", "Id", pROWorkReport.PersonId1);
            ViewData["PurchaseOrderId"] = new SelectList(_context.Set <PurchaseOrder>(), "Id", "Id", pROWorkReport.PurchaseOrderId);
            return(View(pROWorkReport));
        }
Пример #2
0
        public IActionResult Index(PROWorkReport pROWorkReport)
        {
            var applicationDbContext = _context.PROWorkReport.Include(p => p.AssignedPerson).Include(p => p.Company).Include(p => p.OrderedBy).Include(p => p.PurchaseOrder);

            pROWorkReport.TotalPayment = pROWorkReport.TimeWorked * pROWorkReport.PaymentPerHour;
            pROWorkReport.DueToPay     = pROWorkReport.TimeWorked * pROWorkReport.PaymentPerHour - pROWorkReport.AmountPayed;
            return(View(pROWorkReport));
        }
Пример #3
0
        public async Task <IActionResult> Create([Bind("Id,CompanyId,PersonId,PersonId1,WorkStarted,WorkEnded,TimeWorked,FeePerHour,TotalPayment,PurchaseOrderId,WorkDescription,Paid,AmountPaid,DueToPay")] PROWorkReport pROWorkReport)
        {
            if (ModelState.IsValid)
            {
                _context.Add(pROWorkReport);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PersonId"]        = new SelectList(_context.Person, "Id", "Id", pROWorkReport.PersonId);
            ViewData["CompanyId"]       = new SelectList(_context.Company, "Id", "Id", pROWorkReport.CompanyId);
            ViewData["PersonId1"]       = new SelectList(_context.Person, "Id", "Id", pROWorkReport.PersonId1);
            ViewData["PurchaseOrderId"] = new SelectList(_context.Set <PurchaseOrder>(), "Id", "Id", pROWorkReport.PurchaseOrderId);
            return(View(pROWorkReport));
        }
Пример #4
0
        public async Task <IActionResult> Create([Bind("Id,CompanyId,PersonId,PersonId1,WorkStarted,WorkEnded,TimeWorked,PaymentPerHour,TotalPayment,PurchaseOrderId,WorkNote,AmountPayed,Payed")] PROWorkReport pROWorkReport)
        {
            if (ModelState.IsValid)
            {
                var applicationDbContext = _context.PROWorkReport.Include(p => p.AssignedPerson).Include(p => p.Company).Include(p => p.OrderedBy).Include(p => p.PurchaseOrder);
                pROWorkReport.TotalPayment = pROWorkReport.TimeWorked * pROWorkReport.PaymentPerHour;
                pROWorkReport.DueToPay     = pROWorkReport.TimeWorked * pROWorkReport.PaymentPerHour - pROWorkReport.AmountPayed;

                _context.Add(pROWorkReport);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PersonId"]        = new SelectList(_context.Person, "Id", "CName", pROWorkReport.PersonId);
            ViewData["CompanyId"]       = new SelectList(_context.Company, "Id", "CompanyName", pROWorkReport.CompanyId);
            ViewData["PersonId1"]       = new SelectList(_context.Person, "Id", "CName", pROWorkReport.PersonId1);
            ViewData["PurchaseOrderId"] = new SelectList(_context.PurchaseOrder, "Id", "POName", pROWorkReport.PurchaseOrderId);
            return(View(pROWorkReport));
        }
Пример #5
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,CompanyId,PersonId,PersonId1,WorkStarted,WorkEnded,TimeWorked,PaymentPerHour,TotalPayment,PurchaseOrderId,WorkNote,AmountPayed,Payed")] PROWorkReport pROWorkReport)
        {
            if (id != pROWorkReport.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    var applicationDbContext = _context.PROWorkReport.Include(p => p.AssignedPerson).Include(p => p.Company).Include(p => p.OrderedBy).Include(p => p.PurchaseOrder);
                    pROWorkReport.TotalPayment = pROWorkReport.TimeWorked * pROWorkReport.PaymentPerHour;
                    pROWorkReport.DueToPay     = pROWorkReport.TimeWorked * pROWorkReport.PaymentPerHour - pROWorkReport.AmountPayed;

                    _context.Update(pROWorkReport);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PROWorkReportExists(pROWorkReport.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PersonId"]        = new SelectList(_context.Person, "Id", "CName", pROWorkReport.PersonId);
            ViewData["CompanyId"]       = new SelectList(_context.Company, "Id", "CompanyName", pROWorkReport.CompanyId);
            ViewData["PersonId1"]       = new SelectList(_context.Person, "Id", "CName", pROWorkReport.PersonId1);
            ViewData["PurchaseOrderId"] = new SelectList(_context.PurchaseOrder, "Id", "POName", pROWorkReport.PurchaseOrderId);
            return(View(pROWorkReport));
        }