From 7296f7177d460658ecbceca87fbe7f24a8c9dfa1 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Thu, 8 Jun 2017 11:08:33 +0200 Subject: [PATCH] restores the bill --- Yavsc/Models/HairCut/HairCutQuery.cs | 12 ++++++++++-- Yavsc/Services/BillingService.cs | 3 +-- Yavsc/ViewComponents/BillViewComponent.cs | 7 ++----- Yavsc/Views/Shared/Components/Bill/Bill_tex.cshtml | 10 +++++----- Yavsc/Views/Shared/Components/Bill/Default.cshtml | 8 ++++---- .../Shared/DisplayTemplates/HairCutQuery.cshtml | 2 +- 6 files changed, 23 insertions(+), 19 deletions(-) diff --git a/Yavsc/Models/HairCut/HairCutQuery.cs b/Yavsc/Models/HairCut/HairCutQuery.cs index c4ab62ec..6e6ad4b0 100644 --- a/Yavsc/Models/HairCut/HairCutQuery.cs +++ b/Yavsc/Models/HairCut/HairCutQuery.cs @@ -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) { diff --git a/Yavsc/Services/BillingService.cs b/Yavsc/Services/BillingService.cs index 254a7aa3..ff3ed200 100644 --- a/Yavsc/Services/BillingService.cs +++ b/Yavsc/Services/BillingService.cs @@ -42,8 +42,7 @@ namespace Yavsc.Services public async Task 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; } diff --git a/Yavsc/ViewComponents/BillViewComponent.cs b/Yavsc/ViewComponents/BillViewComponent.cs index 29e659ed..185c1e2b 100644 --- a/Yavsc/ViewComponents/BillViewComponent.cs +++ b/Yavsc/ViewComponents/BillViewComponent.cs @@ -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; diff --git a/Yavsc/Views/Shared/Components/Bill/Bill_tex.cshtml b/Yavsc/Views/Shared/Components/Bill/Bill_tex.cshtml index ef9ea7eb..6bfe9187 100644 --- a/Yavsc/Views/Shared/Components/Bill/Bill_tex.cshtml +++ b/Yavsc/Views/Shared/Components/Bill/Bill_tex.cshtml @@ -86,15 +86,15 @@ \def\ClientAdresse{ % Adresse du client @PostalAddress -@if (PostalAddress!=null) {@PostalAddress} -@if (!string.IsNullOrWhiteSpace(to.PhoneNumber)) {@TeXHelpers.ToTeX(to.PhoneNumber)\\ - } - E-mail: @TeXHelpers.ToTeX(to.Email) +@if (!string.IsNullOrWhiteSpace(to.PhoneNumber)) {\\ + @TeXHelpers.ToTeX(to.PhoneNumber) + }\\ + E-mail: @TeXHelpers.ToTeX(to.Email) } % Liste des produits facturés : Désignation, prix @foreach (var line in bill) { -\AjouterService{@TeXHelpers.ToTeX(line.Description)}{@line.Count}{@line.UnitaryCost.ToString("F2",CultureInfo.InvariantCulture)} +\AjouterService{@TeXHelpers.ToTeXCell(line.Description)}{@line.Count}{@line.UnitaryCost.ToString("F2",CultureInfo.InvariantCulture)} } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/Yavsc/Views/Shared/Components/Bill/Default.cshtml b/Yavsc/Views/Shared/Components/Bill/Default.cshtml index a13070f2..8d8d5d33 100644 --- a/Yavsc/Views/Shared/Components/Bill/Default.cshtml +++ b/Yavsc/Views/Shared/Components/Bill/Default.cshtml @@ -2,12 +2,12 @@ @model IBillable diff --git a/Yavsc/Views/Shared/DisplayTemplates/HairCutQuery.cshtml b/Yavsc/Views/Shared/DisplayTemplates/HairCutQuery.cshtml index a9c32e36..51eb6197 100644 --- a/Yavsc/Views/Shared/DisplayTemplates/HairCutQuery.cshtml +++ b/Yavsc/Views/Shared/DisplayTemplates/HairCutQuery.cshtml @@ -22,7 +22,7 @@
@SR["La facture"]
-
@await Component.InvokeAsync("Bill", "Brush", Model, "html", false, false ) +
@await Component.InvokeAsync("Bill", "Brush", Model, OutputFormat.Html, false, false )
@Html.DisplayNameFor(m=>m.Regularisation)