adding properties to invoice view

This commit is contained in:
Frede Hundewadt 2023-11-28 12:09:06 +01:00
parent 64766abd48
commit 92d9ef1de7
13 changed files with 2361 additions and 54 deletions

View file

@ -1,5 +1,13 @@
@using Wonky.Entity.Views @using Wonky.Entity.Views
@if (ReportItem.Express)
{
<div class="row d-print-block">
<div class="col-9"></div>
<div class="col-3">
<h5 class="fw-bold"><i class="bi-lightning-charge the-fast" style="font-size: 2rem;"></i> HASTER</h5>
</div>
</div>
}
<table class="table table-striped table-bordered d-print-table"> <table class="table table-striped table-bordered d-print-table">
<thead> <thead>
<tr class="bg-light text-black"> <tr class="bg-light text-black">
@ -24,33 +32,28 @@
<td class="text-end">@($"{line.Price:N2}")</td> <td class="text-end">@($"{line.Price:N2}")</td>
<td class="text-end">@($"{line.Discount:N2}")</td> <td class="text-end">@($"{line.Discount:N2}")</td>
<td class="text-end">@($"{line.LineSum:N2}")</td> <td class="text-end">@($"{line.LineSum:N2}")</td>
<td class="text-center"><i class="bi- @(line.Sas ? "bi-check-square" : "bi-square")"></i></td> <td class="text-center">
<i class="bi- @(line.Sas ? "bi-check-square" : "bi-square")"></i>
</td>
</tr> </tr>
} }
@if (ReportItem.Express)
{
<td colspan="4"></td>
<td class="text-end" colspan="2">
<h5 class="fw-bold"><i class="bi-lightning-charge the-fast" style="font-size: 2rem;"></i> HASTER</h5>
</td>
}
</tbody> </tbody>
<tfoot> <tfoot>
<tr> <tr>
<td colspan="5" class="text-end">SAS</td> <td colspan="6" class="text-end">SAS</td>
<td class="text-end">@ReportItem.SasAmount</td> <td class="text-end">@ReportItem.SasAmount</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td colspan="5" class="text-end">NORMAL</td> <td colspan="6" class="text-end">NORMAL</td>
<td class="text-end">@ReportItem.OrderAmount</td> <td class="text-end">@ReportItem.OrderAmount</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td colspan="5" class="text-end">TOTAL</td> <td colspan="6" class="text-end">TOTAL</td>
<td class="text-end">@(ReportItem.OrderAmount + ReportItem.SasAmount)</td> <td class="text-end">@(ReportItem.OrderAmount + ReportItem.SasAmount)</td>
<td></td> <td></td>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>

View file

@ -52,7 +52,7 @@
<div class="row"> <div class="row">
<div class="col-md-1"></div> <div class="col-md-1"></div>
<div class="col-md-1"><i class="bi-card-text"></i></div> <div class="col-md-1"><i class="bi-card-text"></i></div>
<div class="col-md-10 fw-bold">@invoice.OrderNote</div> <div class="col-md-10">@invoice.OrderNote</div>
</div> </div>
} }
</div> </div>

View file

@ -17,7 +17,7 @@
<div class="modal-dialog modal-dialog-scrollable modal-lg"> <div class="modal-dialog modal-dialog-scrollable modal-lg">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title">@ProductName</h5> <h2 class="modal-title">@ProductName</h2>
<button type="button" class="btn btn-danger" @onclick="@Hide" data-bs-dismiss="modal" aria-label="Luk"> <button type="button" class="btn btn-danger" @onclick="@Hide" data-bs-dismiss="modal" aria-label="Luk">
<i class="bi-x-lg"></i> <i class="bi-x-lg"></i>
</button> </button>
@ -25,7 +25,6 @@
<div class="modal-body"> <div class="modal-body">
<div class="alert alert-info"> <div class="alert alert-info">
Antallet er et forslag baseret på sidste køb.<br /> Antallet er et forslag baseret på sidste køb.<br />
Priser er historiske priser.<br />
Kontakt venligst din konsulent for oplysning om gældende listepris. Kontakt venligst din konsulent for oplysning om gældende listepris.
</div> </div>
<div class="row"> <div class="row">
@ -42,7 +41,6 @@
<tr> <tr>
<th scope="col">Dato</th> <th scope="col">Dato</th>
<th scope="col">Antal</th> <th scope="col">Antal</th>
<th scope="col">Pris</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -51,7 +49,6 @@
<tr> <tr>
<td>@entry.DeliveryDate</td> <td>@entry.DeliveryDate</td>
<td>@entry.Quantity</td> <td>@entry.Quantity</td>
<td>@entry.Price</td>
</tr> </tr>
} }
</tbody> </tbody>

View file

@ -96,6 +96,12 @@
</tr> </tr>
} }
</tbody> </tbody>
<tfoot>
<tr>
<td colspan="3">SAS</td>
<td></td>
</tr>
</tfoot>
</table> </table>
</div> </div>
</div> </div>

View file

@ -19,7 +19,7 @@
<div class="modal-dialog modal-dialog-scrollable modal-fullscreen"> <div class="modal-dialog modal-dialog-scrollable modal-fullscreen">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title">Faktura</h5> <h2 class="modal-title">Salgsfaktura @(Invoice.DocumentNumber.Split("-")[1])</h2>
<button type="button" class="btn btn-danger" @onclick="@Hide" data-bs-dismiss="modal" aria-label="Luk"><i class="bi-x-lg"></i></button> <button type="button" class="btn btn-danger" @onclick="@Hide" data-bs-dismiss="modal" aria-label="Luk"><i class="bi-x-lg"></i></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
@ -32,35 +32,41 @@
<tr> <tr>
<th scope="row">Dato</th> <th scope="row">Dato</th>
<td>@Invoice.DocumentDate</td> <td>@Invoice.DocumentDate</td>
<th scope="row">Faktura nr.</th> <th scope="row">Eordre</th>
<td>@Invoice.DocumentNumber</td> <td>@Invoice.ESalesNumber</td>
<td colspan="2"></td> </tr>
<tr>
<th scope="row">Navn</th>
<td >@Invoice.Company.Name</td>
<th scope="row">Ordre No.</th>
<td>@Invoice.OrderNo</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Konto</th> <th scope="row">Konto</th>
<td>@Invoice.Account</td> <td>@Invoice.Account</td>
<th scope="row">Moms Nr.</th> <th scope="row">Faktura nr.</th>
<td>@Invoice.DocumentNumber</td>
</tr>
<tr>
<th scope="row">Moms No.</th>
<td>@Invoice.VatNumber</td> <td>@Invoice.VatNumber</td>
<td colspan="2"></td>
</tr>
<tr>
<th scope="row">Eordre</th>
<td>@Invoice.ESalesNumber</td>
<th scope="row">Vores Ref.</th>
<td>@Invoice.OurRef</td>
<td colspan="2"></td>
</tr>
<tr>
<th scope="row">Rekv.</th>
<td>@Invoice.ReferenceNumber</td>
<th scope="row">Deres Ref.</th>
<td>@Invoice.YourRef</td>
<th scope="row">Pakke nr.</th> <th scope="row">Pakke nr.</th>
<td>@Invoice.TrackingNumber</td> <td>@Invoice.TrackingNumber</td>
</tr> </tr>
<tr>
<th scope="row">Rekv.</th>
<td>@Invoice.ReferenceNumber</td>
<th scope="row">Vores Ref.</th>
<td>@Invoice.OurRef</td>
</tr>
<tr>
<th scope="row">Deres Ref.</th>
<td>@Invoice.YourRef</td>
<td colspan="2"></td>
</tr>
<tr> <tr>
<th scope="row">Notat</th> <th scope="row">Notat</th>
<td class="fw-bold" colspan="5">@Invoice.OrderNote</td> <td colspan="3">@Invoice.OrderNote</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -72,6 +78,7 @@
<th class="text-end" scope="col">Antal</th> <th class="text-end" scope="col">Antal</th>
<th class="text-end" scope="col">Pris</th> <th class="text-end" scope="col">Pris</th>
<th class="text-end" scope="col">Rabat</th> <th class="text-end" scope="col">Rabat</th>
<th class="text-end" scope="col">Beløb</th>
<th class="text-center" scope="col">SAS</th> <th class="text-center" scope="col">SAS</th>
</tr> </tr>
</thead> </thead>
@ -84,10 +91,37 @@
<td class="text-end">@line.Qty</td> <td class="text-end">@line.Qty</td>
<td class="text-end">@line.Price</td> <td class="text-end">@line.Price</td>
<td class="text-end">@line.Discount</td> <td class="text-end">@line.Discount</td>
<td class="text-end">@line.LineAmount</td>
<td class="text-center"><i class="bi- @(line.Sas ? "bi-check-square" : "bi-square")"></i></td> <td class="text-center"><i class="bi- @(line.Sas ? "bi-check-square" : "bi-square")"></i></td>
</tr> </tr>
} }
</tbody> </tbody>
<tfoot>
@*
<tr>
<td colspan="3" class="text-end">Salg</td>
<td class="text-end">@NormalAmount</td>
<td colspan="2"></td>
</tr>
<tr>
<td colspan="3" class="text-end">Heraf SAS</td>
<td></td>
<td class="text-end">@SasAmount</td>
<td></td>
</tr>
<tr>
<td colspan="3" class="text-end">Rabat</td>
<td></td>
<td class="text-end">@DiscountAmount</td>
<td></td>
</tr>
*@
<tr>
<td colspan="5" class="text-end">Faktura beløb</td>
<td class="text-end">@Invoice.InvoiceAmount</td>
<td colspan="1"></td>
</tr>
</tfoot>
</table> </table>
} }
else else

View file

@ -14,6 +14,7 @@
// //
using System.Globalization;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Wonky.Client.HttpInterceptors; using Wonky.Client.HttpInterceptors;
using Wonky.Client.HttpRepository; using Wonky.Client.HttpRepository;
@ -37,6 +38,9 @@ public partial class OfficeCustomerInvoiceViewOverlay : IDisposable
private string _modalDisplay = ""; private string _modalDisplay = "";
private bool _showBackdrop; private bool _showBackdrop;
private InvoiceView Invoice { get; set; } = new(); private InvoiceView Invoice { get; set; } = new();
// private string SasAmount { get; set; } = "0.00";
// private string NormalAmount { get; set; } = "0.00";
// private string DiscountAmount { get; set; } = "0.00";
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()
{ {
@ -46,8 +50,31 @@ public partial class OfficeCustomerInvoiceViewOverlay : IDisposable
if (!string.IsNullOrWhiteSpace(InvoiceId)) if (!string.IsNullOrWhiteSpace(InvoiceId))
{ {
Invoice = await HistoryRepo.GetInvoice( CountryCode, CompanyId, InvoiceId); Invoice = await HistoryRepo.GetInvoice( CountryCode, CompanyId, InvoiceId);
// CalculateDisplaySums();
} }
} }
// private void CalculateDisplaySums()
// {
// var invoiceAmount = decimal.Parse(Invoice.InvoiceAmount);
// var normalLines = Invoice.Lines.Where(x => !x.Sas && !x.Price.Contains("-"));
// var normalSale = (
// from line in normalLines
// let price = int.Parse(line.Qty) * decimal.Parse(line.Price)
// select decimal.Parse(line.Qty) == 0
// ? price : price + price * decimal.Parse(line.Qty) / 100).Sum();
// NormalAmount = $"{normalSale:N2}";
//
// var sasLines = Invoice.Lines.Where(x => x.Sas && !x.Price.Contains("-"));
// var sasSale = (
// from line in sasLines
// let price = int.Parse(line.Qty) * decimal.Parse(line.Price)
// select price).Sum();
// SasAmount = $"{sasSale:N2}";
//
// if (normalSale > invoiceAmount)
// DiscountAmount = $"{normalSale - invoiceAmount:N2}";
// }
public void Show() public void Show()
{ {

View file

@ -43,7 +43,7 @@
<span class="input-group-text" id="at"> <span class="input-group-text" id="at">
<i class="bi-at"></i> <i class="bi-at"></i>
</span> </span>
<InputText id="username" name="username" type="email" class="form-control" aria-described-by="at" <InputText id="username" type="email" class="form-control" aria-described-by="at"
@bind-Value="CredentialDto.Email" autocomplete="username"/> @bind-Value="CredentialDto.Email" autocomplete="username"/>
<ValidationMessage For="@(() => CredentialDto.Email)"/> <ValidationMessage For="@(() => CredentialDto.Email)"/>
</div> </div>
@ -52,7 +52,7 @@
<span class="input-group-text" id="key"> <span class="input-group-text" id="key">
<i class="bi-key"></i> <i class="bi-key"></i>
</span> </span>
<InputText id="password" name="password" type="password" class="form-control" aria-described-by="key" <InputText id="password" type="password" class="form-control" aria-described-by="key"
@bind-Value="CredentialDto.Password" autocomplete="current-password"/> @bind-Value="CredentialDto.Password" autocomplete="current-password"/>
<ValidationMessage For="@(() => CredentialDto.Password)"/> <ValidationMessage For="@(() => CredentialDto.Password)"/>
</div> </div>

View file

@ -1,7 +1,7 @@
{ {
"appInfo": { "appInfo": {
"name": "Wonky Online", "name": "Wonky Online",
"version": "306.0", "version": "308.0",
"rc": false, "rc": false,
"sandBox": true, "sandBox": true,
"image": "grumpy-coder.png", "image": "grumpy-coder.png",

File diff suppressed because one or more lines are too long

1
Wonky.Client/wwwroot/decode.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -30,6 +30,6 @@
</div> </div>
<script src="/bootstrap/js/bootstrap.bundle.js"></script> <script src="/bootstrap/js/bootstrap.bundle.js"></script>
<script src="/_framework/blazor.webassembly.js"></script> <script src="/_framework/blazor.webassembly.js"></script>
<script src="/scripts/print-invoke.js"></script> <script type="module" src="/scripts/print-invoke.js"></script>
</body> </body>
</html> </html>

View file

@ -19,9 +19,10 @@ namespace Wonky.Entity.Views;
public class InvoiceLineView public class InvoiceLineView
{ {
public string Discount { get; set; } = ""; public string Discount { get; set; } = "";
public string LineAmount { get; set; } = "";
public string Price { get; set; } = ""; public string Price { get; set; } = "";
public string Qty { get; set; } = ""; public string Qty { get; set; } = "";
public bool Sas { get; set; }
public string Sku { get; set; } = ""; public string Sku { get; set; } = "";
public string Text { get; set; } = ""; public string Text { get; set; } = "";
public bool Sas { get; set; }
} }

View file

@ -27,6 +27,7 @@ public class InvoiceView
public string DocumentNumber { get; set; } = ""; public string DocumentNumber { get; set; } = "";
public string ESalesNumber { get; set; } = ""; public string ESalesNumber { get; set; } = "";
public string InvoiceAmount { get; set; } = ""; public string InvoiceAmount { get; set; } = "";
public string OrderNo { get; set; } = "";
public string OrderNote { get; set; } = ""; public string OrderNote { get; set; } = "";
public string OurRef { get; set; } = ""; public string OurRef { get; set; } = "";
public string ReferenceNumber { get; set; } = ""; public string ReferenceNumber { get; set; } = "";