Odstranjenn projekt

dodan vnos pozicije fakture
This commit is contained in:
David Štaleker
2023-05-13 16:42:01 +02:00
parent 03b92525d7
commit a45fe73754
76 changed files with 407 additions and 37538 deletions

View File

@@ -7,7 +7,6 @@ using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
using EveryThing.Data;
using EveryThing.Models;
using EveryThing.Models.Project;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using ClosedXML.Excel;
@@ -16,7 +15,7 @@ using Microsoft.AspNetCore.Hosting;
namespace EveryThing.Pages.Invoices
{
[Authorize(Roles = "Administrator,InvoicingUser,ProjecThingUser")]
[Authorize(Roles = "Administrator,InvoicingUser")]
public class IndexModel : PageModel
{
private readonly IWebHostEnvironment _hostingEnvironment;
@@ -37,8 +36,6 @@ namespace EveryThing.Pages.Invoices
{
var user = _userManager.GetUserAsync(User).Result;
ShowProjects = User.IsInRole("ProjecThingUser") || User.IsInRole("Administrator");
var invoiceType = (Models.Invoice.Invoice.InvoiceType)type;
//Kako spraviti type preko osvezovanja
@@ -46,30 +43,13 @@ namespace EveryThing.Pages.Invoices
ViewData["SearchString"] = searchString;
ViewData["FinishedProjects"] = finishedProjects == "on" ? "checked" : "";
if (ShowProjects)
{
Invoice = await _context.Invoices
.Include(p => p.Company)
.Include(p => p.Partner)
.Include(x => x.InvoiceInvoiceItem)
.ThenInclude(x => x.ProjectPartItem)
.ThenInclude(x => x.ProjectPart)
.ThenInclude(x => x.Project)
.Where(x => x.Type == invoiceType)
.OrderBy(x => x.InvoiceYear)
.ThenBy(x => x.InvoiceNumber)
.ToListAsync();
}
else
{
Invoice = await _context.Invoices
.Include(p => p.Company)
.Include(p => p.Partner)
.Where(x => x.Type == invoiceType)
.OrderBy(x => x.InvoiceYear)
.ThenBy(x => x.InvoiceNumber)
.ToListAsync();
}
Invoice = await _context.Invoices
.Include(p => p.Company)
.Include(p => p.Partner)
.Where(x => x.Type == invoiceType)
.OrderBy(x => x.InvoiceYear)
.ThenBy(x => x.InvoiceNumber)
.ToListAsync();
// Search string
if (!string.IsNullOrEmpty(searchString))