diff --git a/Yavsc.Abstract/Billing/IBillItem.cs b/Yavsc.Abstract/Billing/IBillItem.cs index e9d7330d..92196b74 100644 --- a/Yavsc.Abstract/Billing/IBillItem.cs +++ b/Yavsc.Abstract/Billing/IBillItem.cs @@ -1,6 +1,7 @@ namespace Yavsc.Billing { public interface IBillItem { + string Name { get; set; } string Description { get; set; } int Count { get; set; } diff --git a/Yavsc/ApiControllers/BillingController.cs b/Yavsc/ApiControllers/BillingController.cs index 848bc450..0de4bdc0 100644 --- a/Yavsc/ApiControllers/BillingController.cs +++ b/Yavsc/ApiControllers/BillingController.cs @@ -74,11 +74,10 @@ namespace Yavsc.ApiControllers [HttpGet("facture-{billingCode}-{id}.tex"), Authorize] public async Task GetTex(string billingCode, long id) { - logger.LogWarning ( $"################################\n# Searching for bill {id} in {billingCode}"); var bill = await billingService.GetBillAsync(billingCode, id); if (bill==null) { - logger.LogCritical ( $"# not found !! ##########\n################################"); + logger.LogCritical ( $"# not found !! {id} in {billingCode}"); return this.HttpNotFound(); } logger.LogVerbose(JsonConvert.SerializeObject(bill)); @@ -94,14 +93,13 @@ namespace Yavsc.ApiControllers [HttpPost("genpdf/{billingCode}/{id}")] public async Task GeneratePdf(string billingCode, long id) { - var estimate = dbContext.Estimates.Include( - e=>e.Query - ).FirstOrDefault(e=>e.Id == id); - if (!await authorizationService.AuthorizeAsync(User, estimate, new ViewRequirement())) - { - return new ChallengeResult(); + var bill = await billingService.GetBillAsync(billingCode, id); + + if (bill==null) { + logger.LogCritical ( $"# not found !! {id} in {billingCode}"); + return this.HttpNotFound(); } - return ViewComponent("Bill",new object[] { billingCode, id, OutputFormat.Pdf } ); + return ViewComponent("Bill",new object[] { billingCode, bill, OutputFormat.Pdf, true, false } ); } diff --git a/Yavsc/Helpers/PayPalHelpers.cs b/Yavsc/Helpers/PayPalHelpers.cs index 69feb233..b06bc6ae 100644 --- a/Yavsc/Helpers/PayPalHelpers.cs +++ b/Yavsc/Helpers/PayPalHelpers.cs @@ -170,8 +170,8 @@ namespace Yavsc.Helpers }; } - public static bool IsSuccess(PaymentInfo info) { - return info.DbContent.State == PayPal.PayPalAPIInterfaceService.Model.PaymentStatusCodeType.COMPLETED.ToString(); + public static bool IsSuccess(this PayPalPayment info) { + return info.State == PayPal.PayPalAPIInterfaceService.Model.PaymentStatusCodeType.COMPLETED.ToString(); } } } diff --git a/Yavsc/Helpers/TeXHelpers.cs b/Yavsc/Helpers/TeXHelpers.cs index 0f08e0e7..07314232 100644 --- a/Yavsc/Helpers/TeXHelpers.cs +++ b/Yavsc/Helpers/TeXHelpers.cs @@ -70,8 +70,9 @@ namespace Yavsc.Helpers new Replacement("–","\\textendash") }; - public static TeXString ToTeX(this string source) + public static TeXString ToTeX(this string source, string defaultValue="\\textit{néant}") { + if (source==null) return new TeXString(defaultValue); string result=source; foreach (var r in SpecialCharsDefaultRendering) { @@ -80,8 +81,9 @@ namespace Yavsc.Helpers return new TeXString(result); } - public static TeXString ToTeXCell(this string source) + public static TeXString ToTeXCell(this string source, string defaultValue="\\textit{néant}") { + if (source==null) return new TeXString(defaultValue); string result=source; foreach (var r in SpecialCharsDefaultRendering) { @@ -100,17 +102,18 @@ namespace Yavsc.Helpers return string.Join(separator, items); } - public static TeXString ToTeX(this string target, string lineSeparator = "\n\\\\") + public static TeXString ToTeXLines(this string source, string defaultValue, string lineSeparator = "\n\\\\") { - if (target == null) return null; - return new TeXString( target.ToTeX().ToString().NewLinesWith(lineSeparator) ); + if (source == null) return new TeXString(defaultValue); + return new TeXString( source.ToTeX().ToString().NewLinesWith(lineSeparator) ); } - public static TeXString SplitAddressToTeX (this string target) + public static TeXString SplitAddressToTeX (this string source, string lineSeparator = "\n\\\\", string defaultValue = "\\textit{pas d'adresse postale}") { - var alines = target.Split(','); + if (string.IsNullOrWhiteSpace(source)) return new TeXString(defaultValue); + var alines = source.Split(','); var texlines = alines.Select(l=>l.ToTeX().ToString()); - return new TeXString(string.Join("\\\\\n",texlines)); + return new TeXString(string.Join(lineSeparator,texlines)); } public static bool GenerateEstimatePdf(this PdfGenerationViewModel Model) @@ -173,6 +176,7 @@ namespace Yavsc.Helpers // try to find the specified view controller.TryValidateModel(model); ViewEngineResult viewResult = engine.FindPartialView(controller.ActionContext, viewName); + // create the associated context ViewContext viewContext = new ViewContext(); viewContext.ActionDescriptor = controller.ActionContext.ActionDescriptor; diff --git a/Yavsc/Makefile b/Yavsc/Makefile index e3445b65..47a673f1 100644 --- a/Yavsc/Makefile +++ b/Yavsc/Makefile @@ -1,5 +1,6 @@ DESTDIR=/srv/www/yavscpre PRODDESTDIR=/srv/www/yavsc +ASPNET_ENV=Development git_status := $(shell git status -s --porcelain |wc -l) @@ -13,35 +14,38 @@ endif default: pushInPre watch: - ASPNET_ENV=Development dnx-watch web --configuration=Debug + @ASPNET_ENV=$(ASPNET_ENV) dnx-watch web --configuration=Debug + +run: + @ASPNET_ENV=$(ASPNET_ENV) dnx web --configuration=Debug clean: - rm -rf bin/Release - rm -rf bin/output + @rm -rf bin/Release + @rm -rf bin/output bin/Release: - dnu build --configuration=Release + @dnu build --configuration=Release bin/output: bin/Release - dnu publish + @dnu publish bin/output/wwwroot/version: bin/output - git log -1 --pretty=format:%h > bin/output/wwwroot/version + @git log -1 --pretty=format:%h > bin/output/wwwroot/version pushInPre: bin/output/wwwroot/version - ssh root@localhost systemctl stop kestrel-pre - ssh root@localhost rm -rf $(DESTDIR)/approot - (cd bin/output && rsync -ravu ./ root@localhost:$(DESTDIR) >/dev/null) - ssh root@localhost sync - ssh root@localhost systemctl start kestrel-pre + @ssh root@localhost systemctl stop kestrel-pre + @ssh root@localhost rm -rf $(DESTDIR)/approot + @(cd bin/output && rsync -ravu ./ root@localhost:$(DESTDIR) >/dev/null) + @ssh root@localhost sync + @ssh root@localhost systemctl start kestrel-pre pushInProd: bin/output/wwwroot/version ifeq ($(git_status),0) - ssh root@localhost systemctl stop kestrel - ssh root@localhost rm -rf $(PRODDESTDIR)/approot - (cd bin/output && rsync -ravu ./ root@localhost:$(PRODDESTDIR) >/dev/null) - ssh root@localhost sync - ssh root@localhost systemctl start kestrel + @ssh root@localhost systemctl stop kestrel + @ssh root@localhost rm -rf $(PRODDESTDIR)/approot + @(cd bin/output && rsync -ravu ./ root@localhost:$(PRODDESTDIR) >/dev/null) + @ssh root@localhost sync + @ssh root@localhost systemctl start kestrel else @echo Err! Refus de pousser en production: des changements doivent être validés auprès du contrôle de versions. @git status diff --git a/Yavsc/Models/ApplicationDbContext.cs b/Yavsc/Models/ApplicationDbContext.cs index 8820e92c..012f00ab 100644 --- a/Yavsc/Models/ApplicationDbContext.cs +++ b/Yavsc/Models/ApplicationDbContext.cs @@ -39,7 +39,7 @@ namespace Yavsc.Models // Customize the ASP.NET Identity model and override the defaults if needed. // For example, you can rename the ASP.NET Identity table names and more. // Add your customizations after calling base.OnModelCreating(builder); - builder.Entity().HasKey(x => new { x.OwnerId, x.UserId }); + builder.Entity().HasKey(x => new { x.OwnerId, x.UserId }); builder.Entity().Property(x=>x.DeclarationDate).HasDefaultValueSql("LOCALTIMESTAMP"); builder.Entity().HasKey(x=>new { x.PostId, x.TagId}); builder.Entity().HasMany( c=>c.Connections ); @@ -209,7 +209,7 @@ namespace Yavsc.Models public DbSet EstimateTemplates { get; set; } - public DbSet Contacts { get; set; } + public DbSet Contacts { get; set; } public DbSet ClientProviderInfo { get; set; } diff --git a/Yavsc/Models/HairCut/HairCutQuery.cs b/Yavsc/Models/HairCut/HairCutQuery.cs index 6e6ad4b0..dcfe64c7 100644 --- a/Yavsc/Models/HairCut/HairCutQuery.cs +++ b/Yavsc/Models/HairCut/HairCutQuery.cs @@ -19,8 +19,9 @@ namespace Yavsc.Models.Haircut // Bill description public override string GetDescription() { - var type = Startup.GlobalLocalizer[this.GetType().Name]; - var gender = Startup.GlobalLocalizer[this.Prestation.Gender.ToString()]; + string type = Startup.GlobalLocalizer[this.GetType().Name]; + string gender = Startup.GlobalLocalizer[this.Prestation.Gender.ToString()]; + return $"{type} ({gender})"; } @@ -75,7 +76,7 @@ namespace Yavsc.Models.Haircut #endif // Le shampoing if (this.Prestation.Shampoo) - bill.Add(new CommandLine { Name = "Shampoing", UnitaryCost = SelectedProfile.ShampooPrice }); + bill.Add(new CommandLine { Name = "Shampoing", Description="Shampoing", UnitaryCost = SelectedProfile.ShampooPrice }); // la coupe if (Prestation.Cut) { @@ -110,7 +111,8 @@ Prestation.Gender == HairCutGenders.Women ? case HairLength.Long: bill.Add(new CommandLine { - Name = name + longhairsuffix, + Name = name, + Description = name + longhairsuffix, UnitaryCost = multicolor ? SelectedProfile.LongMultiColorPrice : SelectedProfile.LongColorPrice }); @@ -118,7 +120,8 @@ Prestation.Gender == HairCutGenders.Women ? case HairLength.HalfLong: bill.Add(new CommandLine { - Name = name + halflonghairsuffix, + Name = name, + Description = name + halflonghairsuffix, UnitaryCost = multicolor ? SelectedProfile.HalfMultiColorPrice : SelectedProfile.HalfColorPrice }); break; @@ -126,7 +129,8 @@ Prestation.Gender == HairCutGenders.Women ? bill.Add(new CommandLine { - Name = name + shorthairsuffix, + Name = name, + Description = name = name + shorthairsuffix, UnitaryCost = multicolor ? SelectedProfile.ShortMultiColorPrice : SelectedProfile.ShortColorPrice }); @@ -142,21 +146,24 @@ Prestation.Gender == HairCutGenders.Women ? case HairLength.Long: bill.Add(new CommandLine { - Name = name + longhairsuffix, + Name = name, + Description = name + longhairsuffix, UnitaryCost = SelectedProfile.LongBalayagePrice }); break; case HairLength.HalfLong: bill.Add(new CommandLine { - Name = name + halflonghairsuffix, + Name = name, + Description = name + halflonghairsuffix, UnitaryCost = SelectedProfile.HalfBalayagePrice }); break; default: bill.Add(new CommandLine { - Name = name + shorthairsuffix, + Name = name, + Description = name + shorthairsuffix, UnitaryCost = SelectedProfile.ShortBalayagePrice }); break; @@ -171,21 +178,24 @@ Prestation.Gender == HairCutGenders.Women ? case HairLength.Long: bill.Add(new CommandLine { - Name = name + longhairsuffix, + Name = name, + Description = name + longhairsuffix, UnitaryCost = SelectedProfile.LongDefrisPrice }); break; case HairLength.HalfLong: bill.Add(new CommandLine { - Name = name + halflonghairsuffix, + Name = name, + Description = name + halflonghairsuffix, UnitaryCost = SelectedProfile.HalfDefrisPrice }); break; default: bill.Add(new CommandLine { - Name = name + shorthairsuffix, + Name = name, + Description = name + shorthairsuffix, UnitaryCost = SelectedProfile.ShortDefrisPrice }); break; @@ -200,21 +210,24 @@ Prestation.Gender == HairCutGenders.Women ? case HairLength.Long: bill.Add(new CommandLine { - Name = name + longhairsuffix, + Name = name, + Description = name + longhairsuffix, UnitaryCost = SelectedProfile.LongMechPrice }); break; case HairLength.HalfLong: bill.Add(new CommandLine { - Name = name + halflonghairsuffix, + Name = name, + Description = name + halflonghairsuffix, UnitaryCost = SelectedProfile.HalfMechPrice }); break; default: bill.Add(new CommandLine { - Name = name + shorthairsuffix, + Name = name, + Description = name + shorthairsuffix, UnitaryCost = SelectedProfile.ShortMechPrice }); break; @@ -229,21 +242,24 @@ Prestation.Gender == HairCutGenders.Women ? case HairLength.Long: bill.Add(new CommandLine { - Name = name + longhairsuffix, + Name = name, + Description = name + longhairsuffix, UnitaryCost = SelectedProfile.LongPermanentPrice }); break; case HairLength.HalfLong: bill.Add(new CommandLine { - Name = name + halflonghairsuffix, + Name = name, + Description = name + halflonghairsuffix, UnitaryCost = SelectedProfile.HalfPermanentPrice }); break; default: bill.Add(new CommandLine { - Name = name + shorthairsuffix, + Name = name, + Description = name + shorthairsuffix, UnitaryCost = SelectedProfile.ShortPermanentPrice }); break; @@ -268,21 +284,24 @@ Prestation.Gender == HairCutGenders.Women ? case HairLength.Long: bill.Add(new CommandLine { - Name = name + longhairsuffix, + Name = name, + Description = name + longhairsuffix, UnitaryCost = SelectedProfile.LongBrushingPrice }); break; case HairLength.HalfLong: bill.Add(new CommandLine { - Name = name + halflonghairsuffix, + Name = name, + Description = name + halflonghairsuffix, UnitaryCost = SelectedProfile.HalfBrushingPrice }); break; default: bill.Add(new CommandLine { - Name = name + shorthairsuffix, + Name = name, + Description = name + shorthairsuffix, UnitaryCost = SelectedProfile.ShortBrushingPrice }); break; @@ -291,7 +310,8 @@ Prestation.Gender == HairCutGenders.Women ? case HairCutGenders.Man: bill.Add(new CommandLine { - Name = name + shorthairsuffix, + Name = name, + Description = name + shorthairsuffix, UnitaryCost = SelectedProfile.ManBrushPrice }); break; @@ -315,21 +335,24 @@ Prestation.Gender == HairCutGenders.Women ? case HairLength.Long: bill.Add(new CommandLine { - Name = name + longhairsuffix, + Name = name, + Description = name + longhairsuffix, UnitaryCost = SelectedProfile.LongFoldingPrice }); break; case HairLength.HalfLong: bill.Add(new CommandLine { - Name = name + halflonghairsuffix, + Name = name, + Description = name + halflonghairsuffix, UnitaryCost = SelectedProfile.HalfFoldingPrice }); break; default: bill.Add(new CommandLine { - Name = name + shorthairsuffix, + Name = name, + Description = name + shorthairsuffix, UnitaryCost = SelectedProfile.ShortFoldingPrice }); break; @@ -341,6 +364,7 @@ Prestation.Gender == HairCutGenders.Women ? // les soins if (Prestation.Cares) { bill.Add(new CommandLine { Name = "Soins", + Description = "Soins", UnitaryCost = SelectedProfile.CarePrice }); } diff --git a/Yavsc/Models/Relationship/PostalAddress.cs b/Yavsc/Models/Relationship/PostalAddress.cs new file mode 100644 index 00000000..a05be231 --- /dev/null +++ b/Yavsc/Models/Relationship/PostalAddress.cs @@ -0,0 +1,14 @@ +namespace Yavsc.Models.Relationship +{ + public class PostalAddress + { + public string Street1 { get; set; } + public string Street2 { get; set; } + public string PostalCode { get; set; } + public string City { get; set; } + public string State { get; set; } + public string Province { get; set; } + + + } +} \ No newline at end of file diff --git a/Yavsc/Resources/Yavsc.Resources.YavscLocalisation.fr.resx b/Yavsc/Resources/Yavsc.Resources.YavscLocalisation.fr.resx index 27fe25a1..b12bbd05 100644 --- a/Yavsc/Resources/Yavsc.Resources.YavscLocalisation.fr.resx +++ b/Yavsc/Resources/Yavsc.Resources.YavscLocalisation.fr.resx @@ -243,7 +243,8 @@ Erreur Google : {0} Identifiant d'enregistrement Google mi-long - Demande de préstation en coiffure à domicile + Coiffure à domicile + Préstation en coiffure à domicile Une demande (de {0}) en coiffure à domicile vient d'être validée Cacher le texte source de l'article Accueil diff --git a/Yavsc/Services/MessageServices.cs b/Yavsc/Services/MessageServices.cs index 30a299a1..7bc48b2c 100755 --- a/Yavsc/Services/MessageServices.cs +++ b/Yavsc/Services/MessageServices.cs @@ -63,7 +63,7 @@ namespace Yavsc.Services MimeMessage msg = new MimeMessage(); msg.From.Add(new MailboxAddress( siteSettings.Owner.Name, - siteSettings.Owner.Address)); + siteSettings.Owner.EMail)); msg.To.Add(new MailboxAddress("", email)); msg.Body = new TextPart("plain") { diff --git a/Yavsc/Settings/EmailEntry.cs b/Yavsc/Settings/EmailEntry.cs index 18b7a9ec..18608352 100644 --- a/Yavsc/Settings/EmailEntry.cs +++ b/Yavsc/Settings/EmailEntry.cs @@ -1,9 +1,13 @@ +using Yavsc.Models.Relationship; + namespace Yavsc { - public class EmailEntry + public class Contact { public string Name { get; set; } - public string Address { get; set; } + public string EMail { get; set; } + + public PostalAddress PostalAddress { get; set; } } diff --git a/Yavsc/Settings/SiteSettings.cs b/Yavsc/Settings/SiteSettings.cs index 32898c48..5c91481c 100644 --- a/Yavsc/Settings/SiteSettings.cs +++ b/Yavsc/Settings/SiteSettings.cs @@ -22,12 +22,12 @@ namespace Yavsc /// Owner's email /// /// - public EmailEntry Owner { get; set; } + public Contact Owner { get; set; } /// /// Administrator's email /// /// - public EmailEntry Admin { get; set; } + public Contact Admin { get; set; } /// /// User's files directory /// diff --git a/Yavsc/ViewComponents/BillViewComponent.cs b/Yavsc/ViewComponents/BillViewComponent.cs index cd84ce36..88aa8498 100644 --- a/Yavsc/ViewComponents/BillViewComponent.cs +++ b/Yavsc/ViewComponents/BillViewComponent.cs @@ -3,6 +3,7 @@ using System.Threading.Tasks; using Microsoft.AspNet.Mvc; using Microsoft.Data.Entity; using Microsoft.Extensions.Localization; +using Microsoft.Extensions.Logging; using Yavsc.Billing; using Yavsc.Helpers; using Yavsc.Models; @@ -15,12 +16,15 @@ namespace Yavsc.ViewComponents { ApplicationDbContext dbContext; IStringLocalizer localizer; + ILogger logger ; public BillViewComponent(ApplicationDbContext dbContext, - IStringLocalizer localizer) + IStringLocalizer localizer, + ILoggerFactory loggerFactory) { this.dbContext = dbContext; this.localizer = localizer; + logger = loggerFactory.CreateLogger(); } public async Task InvokeAsync(string code, IBillable billable, OutputFormat format, bool asBill, bool acquitted) @@ -31,28 +35,34 @@ namespace Yavsc.ViewComponents ViewBag.AvatarsDir = dia.FullName; ViewBag.AsBill = asBill; // vrai pour une facture, sinon, c'est un devis ViewBag.Acquitted = acquitted; + ViewBag.BillingCode = code; - switch (format) { - case OutputFormat.LaTeX : - var client = await dbContext.Users - .Include(u=>u.PostalAddress) - .SingleAsync(u=>u.Id == billable.ClientId); - ViewBag.Client = client; - var performer = await dbContext.Users - .Include(u=>u.BankInfo) - .Include(u=>u.PostalAddress) - .SingleAsync(u=>u.Id == billable.PerformerId); - ViewBag.Performer = performer; + var client = await dbContext.Users + .Include(u=>u.PostalAddress) + .SingleAsync(u=>u.Id == billable.ClientId); + ViewBag.Client = client; + var performer = await dbContext.Users + .Include(u=>u.BankInfo) + .Include(u=>u.PostalAddress) + .SingleAsync(u=>u.Id == billable.PerformerId); + ViewBag.Performer = performer; + string clientAddress = client.PostalAddress?.Address ?? null; + ViewBag.ClientAddress = clientAddress.SplitAddressToTeX(); + + + var profile = await dbContext.Performers + .Include(p=>p.OrganizationAddress) + .SingleAsync(p=>p.PerformerId == billable.PerformerId); + ViewBag.PerformerProfile = profile; + ViewBag.ActivityLabel = (await dbContext.Activities.SingleAsync(a => a.Code == billable.ActivityCode)).Name; - ViewBag.ClientAddress = client.PostalAddress?.Address.SplitAddressToTeX(); + var proaddr = profile.OrganizationAddress.Address; + ViewBag.PerformerOrganizationAddress = proaddr.SplitAddressToTeX() ; + ViewBag.FooterPerformerOrganizationAddress = proaddr.SplitAddressToTeX(", "); - var profile = await dbContext.Performers - .Include(p=>p.OrganizationAddress) - .SingleAsync(p=>p.PerformerId == billable.PerformerId); - ViewBag.PerformerProfile = profile; - ViewBag.ActivityLabel = localizer[billable.ActivityCode]; - ViewBag.PerformerOrganizationAddress = profile.OrganizationAddress.Address.SplitAddressToTeX() ; - ViewBag.PerformerAddress = performer.PostalAddress?.Address.SplitAddressToTeX() ; + ViewBag.PerformerAddress = performer.PostalAddress?.Address.SplitAddressToTeX() ; + switch (format) { + case OutputFormat.LaTeX : return this.View("Bill_tex", billable); case OutputFormat.Pdf : string tex = null; @@ -60,11 +70,9 @@ namespace Yavsc.ViewComponents using (var writer = new StringWriter()) { this.ViewComponentContext.ViewContext.Writer = writer; - var resultTex = View("Bill_tex", billable); await resultTex.ExecuteAsync(this.ViewComponentContext); tex = writer.ToString(); - } ViewComponentContext.ViewContext.Writer = oldWriter; @@ -73,7 +81,7 @@ namespace Yavsc.ViewComponents Temp = Startup.Temp, TeXSource = tex, DestDir = Startup.UserBillsDirName, - BaseFileName = $"bill-{code}-{billable.Id}" + BaseFileName = $"facture-{code}-{billable.Id}" } ); } return View("Default",billable); diff --git a/Yavsc/Views/HairCutCommand/CommandConfirmation.cshtml b/Yavsc/Views/HairCutCommand/CommandConfirmation.cshtml index 7f14c9ec..ab60dda4 100644 --- a/Yavsc/Views/HairCutCommand/CommandConfirmation.cshtml +++ b/Yavsc/Views/HairCutCommand/CommandConfirmation.cshtml @@ -80,13 +80,11 @@
Numéro identifiant votre commande
@Model.Id
- - - -
TODO Facture
-
Facture
-
+
@SR["La facture"] +
+
@await Component.InvokeAsync("Bill", "Brush", Model, OutputFormat.Html, false, false ) +
@Html.DisplayNameFor(m=>m.Regularisation)
@Component.Invoke("PayPalButton", Model, "haircut", "HairCutCommand" ) diff --git a/Yavsc/Views/Shared/Components/Bill/Bill_tex.cshtml b/Yavsc/Views/Shared/Components/Bill/Bill_tex.cshtml index 6bfe9187..a174e9d3 100644 --- a/Yavsc/Views/Shared/Components/Bill/Bill_tex.cshtml +++ b/Yavsc/Views/Shared/Components/Bill/Bill_tex.cshtml @@ -9,7 +9,6 @@ var to = ViewBag.Client; var PostalAddress = ViewBag.ClientAddress; var proaddr = ViewBag.PerformerOrganizationAddress; - var proaddrm = proaddr; var isestimate = !ViewBag.AsBill; var prosign = new FileInfo($"{ViewBag.BillsDir}/sign-{ViewBag.BillingCode}-{Model.Id}.png"); var clisign = new FileInfo($"{ViewBag.BillsDir}/sign-{ViewBag.BillingCode}-{Model.Id}.png"); @@ -72,8 +71,8 @@ %%%%%%%%%%%%%%%%%%%%% A MODIFIER DANS LA FACTURE %%%%%%%%%%%%%%%%%%%%% \def\FactureNum {@Model.Id.ToString()} % Numéro de facture -\def\FactureAcquittee {@ViewBag.Acquitted?"oui":"non"} % Facture acquittée : oui/non -\def\FactureLieu {@proaddrm} % Lieu de l'édition de la facture +\def\FactureAcquittee {@(ViewBag.Acquitted?"oui":"non")} % Facture acquittée : oui/non +\def\FactureLieu {@proaddr} % Lieu de l'édition de la facture \def\FactureObjet {@(new HtmlString(isestimate?"Devis":"Facture")) en @TeXHelpers.ToTeX(activity)} % Objet du document % Description de la facture \def\FactureDescr { @@ -85,8 +84,7 @@ \def\ClientAdresse{ % Adresse du client -@PostalAddress -@if (!string.IsNullOrWhiteSpace(to.PhoneNumber)) {\\ +@PostalAddress @if (!string.IsNullOrWhiteSpace(to.PhoneNumber)) {\\ @TeXHelpers.ToTeX(to.PhoneNumber) }\\ E-mail: @TeXHelpers.ToTeX(to.Email) @@ -110,8 +108,8 @@ \setlength{\parindent}{0pt} \renewcommand{\headrulewidth}{0pt} -\cfoot{ @TeXHelpers.ToTeX(from.UserName) @if (proaddrm!=null) { - @proaddrm } \newline - \small{ E-mail: @TeXHelpers.ToTeX(from.Email) @if (!string.IsNullOrWhiteSpace(from.PhoneNumber)) { - Téléphone fixe: @TeXHelpers.ToTeX(from.PhoneNumber) } +\cfoot{ @TeXHelpers.ToTeX(from.UserName) - @ViewBag.FooterPerformerOrganizationAddress \\ + \small{ E-mail: @TeXHelpers.ToTeX(from.Email) @if (!string.IsNullOrWhiteSpace(from.PhoneNumber)) { - Téléphone : @TeXHelpers.ToTeX(from.PhoneNumber) } } } @@ -164,8 +162,7 @@ \end{flushright} ~\\ @if (ViewBag.AsBill) { - -} else if (ViewBag.Acquitted) { + if (ViewBag.Acquitted) { \ifthenelse{\equal{\FactureAcquittee}{oui}}{ Facture acquittée. @@ -173,7 +170,11 @@ } else { var bi = from.BankInfo; - if (bi!=null) { + if (bi==null){ + À régler sur site, en utilisant le paiment PayPal:\\ + Le relevé d'identité bancaire de ce prestaire n'est pas renseigné. + + } else { À régler par chèque ou par virement bancaire : \begin{center} @@ -195,6 +196,7 @@ \end{center} } } +} @if (validationDate!=null) { @@ -207,10 +209,20 @@ \begin{center} \hspace{263pt} - \includegraphics[height=60pt]{@(ViewBag.BillsDir)/estimate-prosign-@(Model.Id).png} + \includegraphics[height=60pt]{@(ViewBag.BillsDir)/{ViewBag.BillingCode}-prosign-@(Model.Id).png} \end{center} } + +@if (clisign.Exists) { + +\begin{center} + \hspace{263pt} + \includegraphics[height=60pt]{@(ViewBag.BillsDir)/{ViewBag.BillingCode}-clisign-@(Model.Id).png} +\end{center} + +} + } \end{document} diff --git a/Yavsc/Views/Shared/Components/Bill/Default.cshtml b/Yavsc/Views/Shared/Components/Bill/Default.cshtml index 8d8d5d33..7270452c 100644 --- a/Yavsc/Views/Shared/Components/Bill/Default.cshtml +++ b/Yavsc/Views/Shared/Components/Bill/Default.cshtml @@ -5,7 +5,7 @@ Export au format LaTeX -
+
diff --git a/Yavsc/Views/Shared/DisplayTemplates/HairCutQuery.cshtml b/Yavsc/Views/Shared/DisplayTemplates/HairCutQuery.cshtml index 51eb6197..e826d7b3 100644 --- a/Yavsc/Views/Shared/DisplayTemplates/HairCutQuery.cshtml +++ b/Yavsc/Views/Shared/DisplayTemplates/HairCutQuery.cshtml @@ -1,4 +1,15 @@ @model HairCutQuery +@{ + var paid = false; + if (Model.PaymentId!=null) { + if (Model.Regularisation!=null) { + if (Model.Regularisation.IsSuccess()) { + paid=true; + } + } + } + +}
@Html.DisplayNameFor(m=>m.Prestation)
@@ -22,7 +33,7 @@
@SR["La facture"]
-
@await Component.InvokeAsync("Bill", "Brush", Model, OutputFormat.Html, false, false ) +
@await Component.InvokeAsync("Bill", "Brush", Model, OutputFormat.Html, true, paid )
@Html.DisplayNameFor(m=>m.Regularisation)
diff --git a/Yavsc/appsettings.json b/Yavsc/appsettings.json index 746a07e4..8dfea474 100755 --- a/Yavsc/appsettings.json +++ b/Yavsc/appsettings.json @@ -18,12 +18,12 @@ "Banner": "/images/banner.jpg", "Authority": "http://127.0.0.1:5000/", "Owner": { - "Name": "[query]", - "Address": "bigchief@company.com" + "Name": "[Site owner's name]", + "EMail": "[Site owner's e-mail address]" }, "Admin": { - "Name": "[answer]", - "Address": "contact@company.com" + "Name": "[a name for a site admin]", + "EMail": "[an e-mail for a site admin]" }, "UserFiles": { "Avatars": "Avatars",