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

View File

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

View File

@ -7,24 +7,36 @@ using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using FakturyWeb.Data; using FakturyWeb.Data;
using RazorPagesMovie.Models; using RazorPagesMovie.Models;
using FakturyWeb.Models;
namespace FakturyWeb.Pages.Faktury namespace FakturyWeb.Pages.Faktury
{ {
public class IndexModel : PageModel public class IndexModel : PageModel
{
private readonly FakturyWeb.Data.FakturyWebContext _context;
public IndexModel(FakturyWeb.Data.FakturyWebContext context)
{ {
private readonly FakturyWeb.Data.FakturyWebContext _context; _context = context;
public IndexModel(FakturyWeb.Data.FakturyWebContext context)
{
_context = context;
}
public IList<FAKTURA> FAKTURA { get;set; }
public async Task OnGetAsync()
{
FAKTURA = await _context.FAKTURA
.Include(f => f.ZAKAZNIK).ToListAsync();
}
} }
public IList<FakturaSeznam> FAKTURA { get;set; }
public async Task OnGetAsync()
{
//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();
}
}
} }