Seznam Faktur

master
Kowalski 2023-09-19 17:57:36 +02:00
parent ed5fbe6e26
commit 0890b761f2
5 changed files with 109 additions and 173 deletions

Binary file not shown.

24
Models/FakturaSeznam.cs Normal file
View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace FakturyWeb.Models
{
public class FakturaSeznam
{
public int ID { get; set; }
public string CISLO { get; set; }
public DateTime VYSTAVENI { get; set; }
public DateTime SPLATNOST { get; set; }
public string O_PRAJM { get; set; }
public decimal CASTKA { get; set; }
public decimal ZAPLACENO { get; set; }
}
}

View File

@ -19,7 +19,7 @@
</h2>
<div id="collapseBase" class="accordion-collapse collapse show" aria-labelledby="headingOne" data-bs-parent="#accordionFaktura">
<div class="accordion-body row g-3">
<div class="form-group col-md-1">
<div class="form-group col-md-2">
<label asp-for="FAKTURA.CISLO" class="control-label"></label>
<input asp-for="FAKTURA.CISLO" class="form-control" />
<span asp-validation-for="FAKTURA.CISLO" class="text-danger"></span>
@ -31,6 +31,7 @@
<select id="fakturaZakaznikSelect" asp-for="FAKTURA.ZakaznikID" class="form-select" asp-items="ViewBag.Zakaznici">
<option value="-1" selected>(vyberte zákazníka)</option>
</select>
<span asp-validation-for="FAKTURA.ZakaznikID" class="text-danger"></span>
</div>
<div class="form-group col-md-4">
@ -41,7 +42,7 @@
<div class="form-group col-md-4">
<label asp-for="FAKTURA.FORMA_UHRADY" class="control-label"></label>
<select asp-for="FAKTURA.FORMA_UHRADY" class="form-control" asp-items="ViewBag.FormyUhrady"></select>
<select asp-for="FAKTURA.FORMA_UHRADY" class="form-select" asp-items="ViewBag.FormyUhrady"></select>
</div>
<div class="form-group col-md-4">

View File

@ -8,154 +8,53 @@
<h1>Index</h1>
<p>
<a asp-page="Create">Create New</a>
<a asp-page="Create">Přidat fakturu</a>
</p>
<table class="table">
<table class="table table-striped">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.FAKTURA[0].ZAKAZNIK)
</th>
<th>
@Html.DisplayNameFor(model => model.FAKTURA[0].CISLO)
</th>
<th>
@Html.DisplayNameFor(model => model.FAKTURA[0].CISLO_ABS)
</th>
<th>
@Html.DisplayNameFor(model => model.FAKTURA[0].VYSTAVENI)
</th>
<th>
@Html.DisplayNameFor(model => model.FAKTURA[0].SPLATNOST)
</th>
<th>
@Html.DisplayNameFor(model => model.FAKTURA[0].D_PRAJM)
</th>
<th>
@Html.DisplayNameFor(model => model.FAKTURA[0].D_ULICE)
</th>
<th>
@Html.DisplayNameFor(model => model.FAKTURA[0].D_MESTO)
</th>
<th>
@Html.DisplayNameFor(model => model.FAKTURA[0].D_PSC)
</th>
<th>
@Html.DisplayNameFor(model => model.FAKTURA[0].D_IC)
</th>
<th>
@Html.DisplayNameFor(model => model.FAKTURA[0].D_DIC)
</th>
<th>
@Html.DisplayNameFor(model => model.FAKTURA[0].D_BANKA)
</th>
<th>
@Html.DisplayNameFor(model => model.FAKTURA[0].D_TELEFON)
</th>
<th>
@Html.DisplayNameFor(model => model.FAKTURA[0].D_EMAIL)
</th>
<th>
@Html.DisplayNameFor(model => model.FAKTURA[0].D_WEB)
</th>
<th>
@Html.DisplayNameFor(model => model.FAKTURA[0].O_PRAJM)
</th>
<th>
@Html.DisplayNameFor(model => model.FAKTURA[0].O_ULICE)
Částka
</th>
<th>
@Html.DisplayNameFor(model => model.FAKTURA[0].O_MESTO)
</th>
<th>
@Html.DisplayNameFor(model => model.FAKTURA[0].O_PSC)
</th>
<th>
@Html.DisplayNameFor(model => model.FAKTURA[0].O_IC)
</th>
<th>
@Html.DisplayNameFor(model => model.FAKTURA[0].O_DIC)
</th>
<th>
@Html.DisplayNameFor(model => model.FAKTURA[0].FORMA_UHRADY)
</th>
<th>
@Html.DisplayNameFor(model => model.FAKTURA[0].CINNOSTI)
Zaplaceno
</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.FAKTURA) {
@foreach (var item in Model.FAKTURA)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.ZAKAZNIK.ID)
</td>
<td>
<td class="fw-bold">
@Html.DisplayFor(modelItem => item.CISLO)
</td>
<td>
@Html.DisplayFor(modelItem => item.CISLO_ABS)
</td>
<td>
@Html.DisplayFor(modelItem => item.VYSTAVENI)
</td>
<td>
@Html.DisplayFor(modelItem => item.SPLATNOST)
</td>
<td>
@Html.DisplayFor(modelItem => item.D_PRAJM)
</td>
<td>
@Html.DisplayFor(modelItem => item.D_ULICE)
</td>
<td>
@Html.DisplayFor(modelItem => item.D_MESTO)
</td>
<td>
@Html.DisplayFor(modelItem => item.D_PSC)
</td>
<td>
@Html.DisplayFor(modelItem => item.D_IC)
</td>
<td>
@Html.DisplayFor(modelItem => item.D_DIC)
</td>
<td>
@Html.DisplayFor(modelItem => item.D_BANKA)
</td>
<td>
@Html.DisplayFor(modelItem => item.D_TELEFON)
</td>
<td>
@Html.DisplayFor(modelItem => item.D_EMAIL)
</td>
<td>
@Html.DisplayFor(modelItem => item.D_WEB)
</td>
<td>
@Html.DisplayFor(modelItem => item.O_PRAJM)
</td>
<td>
@Html.DisplayFor(modelItem => item.O_ULICE)
@Html.DisplayFor(modelItem => item.CASTKA)
</td>
<td>
@Html.DisplayFor(modelItem => item.O_MESTO)
</td>
<td>
@Html.DisplayFor(modelItem => item.O_PSC)
</td>
<td>
@Html.DisplayFor(modelItem => item.O_IC)
</td>
<td>
@Html.DisplayFor(modelItem => item.O_DIC)
</td>
<td>
@Html.DisplayFor(modelItem => item.FORMA_UHRADY)
</td>
<td>
@Html.DisplayFor(modelItem => item.CINNOSTI)
@Html.DisplayFor(modelItem => item.ZAPLACENO)
</td>
<td>
<a asp-page="./Edit" asp-route-id="@item.ID">Edit</a> |

View File

@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
using FakturyWeb.Data;
using RazorPagesMovie.Models;
using FakturyWeb.Models;
namespace FakturyWeb.Pages.Faktury
{
@ -19,12 +20,23 @@ namespace FakturyWeb.Pages.Faktury
_context = context;
}
public IList<FAKTURA> FAKTURA { get;set; }
public IList<FakturaSeznam> FAKTURA { get;set; }
public async Task OnGetAsync()
{
FAKTURA = await _context.FAKTURA
.Include(f => f.ZAKAZNIK).ToListAsync();
//FAKTURA = await _context.FAKTURA
// .Include(f => f.ZAKAZNIK).ToListAsync();
FAKTURA = await (from f in _context.FAKTURA
select new FakturaSeznam {
ID = f.ID,
CISLO = f.CISLO,
VYSTAVENI = f.VYSTAVENI,
SPLATNOST = f.SPLATNOST,
O_PRAJM = f.O_PRAJM,
CASTKA = f.POLOZKY.Sum(p => p.CENA),
ZAPLACENO = f.PLATBY.Sum(p => p.CASTKA)
}
).ToListAsync();
}
}
}