restores the bill

This commit is contained in:
2017-06-08 11:08:33 +02:00
parent a73744bd47
commit 7296f7177d
6 changed files with 23 additions and 19 deletions

View File

@ -78,10 +78,16 @@ namespace Yavsc.Models.Haircut
bill.Add(new CommandLine { Name = "Shampoing", UnitaryCost = SelectedProfile.ShampooPrice });
// la coupe
if (Prestation.Cut)
bill.Add(new CommandLine
if (Prestation.Cut) {
bill.Add(new CommandLine
{
Name = "Coupe",
Description = $"Coupe "+Startup.GlobalLocalizer[Prestation.Gender.ToString()]+ " "+
(Prestation.Gender == HairCutGenders.Women ?
Prestation.Length == HairLength.Long ? longhairsuffix :
Prestation.Length == HairLength.HalfLong ? halflonghairsuffix :
shorthairsuffix: null),
UnitaryCost =
Prestation.Gender == HairCutGenders.Women ?
Prestation.Length == HairLength.Long ? SelectedProfile.WomenLongCutPrice :
@ -90,6 +96,8 @@ Prestation.Gender == HairCutGenders.Women ?
SelectedProfile.ManCutPrice : SelectedProfile.KidCutPrice
});
}
// Les techniques
switch (Prestation.Tech)
{

View File

@ -42,8 +42,7 @@ namespace Yavsc.Services
public async Task<IBillable> GetBillAsync(string billingCode, long queryId)
{
var dbFunc = Startup.Billing[billingCode];
IBillable query = null;
await Task.Run(()=> dbFunc(DbContext, queryId));
IBillable query = await Task.Run(()=> dbFunc(DbContext, queryId));
return query;
}

View File

@ -7,15 +7,12 @@ using Yavsc.Billing;
using Yavsc.Helpers;
using Yavsc.Models;
using Yavsc.Services;
using Yavsc.ViewModels;
using Yavsc.ViewModels.Gen;
namespace Yavsc.ViewComponents
{
public enum OutputFormat {
Html,
LaTeX,
Pdf
}
public class BillViewComponent : ViewComponent
{
ApplicationDbContext dbContext;

View File

@ -86,15 +86,15 @@
\def\ClientAdresse{
% Adresse du client
@PostalAddress
@if (PostalAddress!=null) {<text>@PostalAddress</text>}
@if (!string.IsNullOrWhiteSpace(to.PhoneNumber)) {<text>@TeXHelpers.ToTeX(to.PhoneNumber)<text>\\</text>
</text>}
E-mail: @TeXHelpers.ToTeX(to.Email)
@if (!string.IsNullOrWhiteSpace(to.PhoneNumber)) {<text>\\
@TeXHelpers.ToTeX(to.PhoneNumber)
</text>}\\
E-mail: @TeXHelpers.ToTeX(to.Email)
}
% Liste des produits facturés : Désignation, prix
@foreach (var line in bill) {
<text>\AjouterService{@TeXHelpers.ToTeX(line.Description)}{@line.Count}{@line.UnitaryCost.ToString("F2",CultureInfo.InvariantCulture)}
<text>\AjouterService{@TeXHelpers.ToTeXCell(line.Description)}{@line.Count}{@line.UnitaryCost.ToString("F2",CultureInfo.InvariantCulture)}
</text>}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View File

@ -2,12 +2,12 @@
@model IBillable
<div class="bill">
<a href="~/api/pdfbill/bill-@(Model.ActivityCode)-@(Model.Id).tex" >Export au format LaTeX</a>
<a class="btn btn-default" href="~/api/bill/facture-@(ViewBag.BillingCode)-@(Model.Id).tex" >Export au format LaTeX</a>
<form action="~/api/pdfbill/gen/@(Model.ActivityCode)-@Model.Id" method="POST">
<input type="submit" value="Générer le Pdf"/>
<form action="~/api/bill/genpdf/@ViewBag.BillingCode-@Model.Id" method="POST">
<input class="btn btn-default" type="submit" value="Générer le Pdf"/>
</form>
<a href="~/api/pdfbill/get/@(Model.Id)" >Télécharger le document généré</a>
<a class="btn btn-link" href="~/api/bill/facture-@(ViewBag.BillingCode)-@(Model.Id).pdf" >Télécharger le document généré</a>
</div>

View File

@ -22,7 +22,7 @@
</dd>
<dt>@SR["La facture"]
</dt>
<dd>@await Component.InvokeAsync("Bill", "Brush", Model, "html", false, false )
<dd>@await Component.InvokeAsync("Bill", "Brush", Model, OutputFormat.Html, false, false )
</dd>
<dt>@Html.DisplayNameFor(m=>m.Regularisation)</dt>
<dd>