devis sans signature, en Pdf

vnext
Paul Schneider 8 years ago
parent 1af0196694
commit 3c23cf0286
8 changed files with 24 additions and 12 deletions

@ -7,7 +7,6 @@ using Microsoft.Extensions.DependencyInjection;
namespace Yavsc
{
public partial class Startup
{
public void ConfigureProtectionServices(IServiceCollection services)

@ -7,7 +7,6 @@ using Microsoft.AspNet.StaticFiles;
namespace Yavsc
{
public partial class Startup
{
public static string UserFilesDirName { get; private set; }

@ -20,7 +20,6 @@ using Yavsc.Models;
namespace Yavsc
{
public partial class Startup
{
public static CookieAuthenticationOptions ExternalCookieAppOptions { get; private set; }

@ -37,6 +37,7 @@ namespace Yavsc
public static string AvatarsDirName { private set; get; }
public static string Authority { get; private set; }
public static string Audience { get; private set; }
public static string Temp { get; set; }
public static SiteSettings SiteSetup { get; private set; }
private static ILogger logger;
@ -234,6 +235,7 @@ namespace Yavsc
SiteSetup = siteSettings.Value;
Startup.UserFilesDirName = new DirectoryInfo(siteSettings.Value.UserFiles.Blog).FullName;
Startup.UserBillsDirName = new DirectoryInfo(siteSettings.Value.UserFiles.Bills).FullName;
Startup.Temp = siteSettings.Value.TempDir;
// TODO implement an installation & upgrade procedure
// Create required directories
@ -285,7 +287,7 @@ namespace Yavsc
if (ex.InnerException is InvalidOperationException)
// nothing to do ?
{
// TODO Send an email to the Admin
// TODO (or not) Hit the developper
}
else throw ex;
}
@ -346,4 +348,4 @@ namespace Yavsc
}
}
//
//

@ -21,8 +21,11 @@ namespace Yavsc.ViewComponents
{
return await InvokeAsync(id,"Html");
}
public async Task<IViewComponentResult> InvokeAsync(long id, string outputFormat ="Html")
public async Task<IViewComponentResult> InvokeAsync(long id, string outputFormat ="Html")
{
return await InvokeAsync(id,outputFormat,false,false);
}
public async Task<IViewComponentResult> InvokeAsync(long id, string outputFormat ="Html", bool asBill = false, bool acquitted = false)
{
return await Task.Run( ()=> {
Estimate estimate =
@ -38,6 +41,8 @@ namespace Yavsc.ViewComponents
var dia = new DirectoryInfo(Startup.SiteSetup.UserFiles.Avatars);
ViewBag.BillsDir = di.FullName;
ViewBag.AvatarsDir = dia.FullName;
ViewBag.AsBill = asBill;
ViewBag.Acquitted = acquitted;
if (outputFormat == "LaTeX") {
return this.View("Estimate_tex", estimate);
}
@ -59,6 +64,7 @@ namespace Yavsc.ViewComponents
return this.View("Estimate_pdf",
new PdfGenerationViewModel{
Temp = Startup.Temp,
TeXSource = tex,
DestDir = Startup.UserBillsDirName,
BaseFileName = $"estimate-{id}"
@ -70,4 +76,4 @@ namespace Yavsc.ViewComponents
}
}
}
}

@ -14,5 +14,6 @@ namespace Yavsc.ViewModels.Gen
public string DestDir { get; set; }
public bool Generated { get; set; }
public HtmlString GenerationErrorMessage { get; set; }
public string Temp { get; set; }
}
}

@ -1,5 +1,6 @@
@model Estimate
<div class="estimate">
<a href="~/api/pdfestimate/estimate-@(Model.Id).tex" >Export au format LaTeX</a>
@ -9,3 +10,4 @@
</form>
<a href="~/api/pdfestimate/get/@(Model.Id)" >Télécharger le document généré</a>
</div>

@ -1,4 +1,5 @@
@using Yavsc.Helpers
@using System.IO
@using System.Globalization
@model Estimate
@{
@ -9,8 +10,8 @@
var PostalAddress = to.PostalAddress?.Address.SplitAddressToTeX();
var proaddr = Model.Query.PerformerProfile.OrganizationAddress.Address.SplitAddressToTeX();
var proaddrm = new HtmlString(Model.Query.PerformerProfile.OrganizationAddress.Address);
var isestimate = true;
var ack = false;
var isestimate = !ViewBag.AsBill;
var prosign = new FileInfo($"{ViewBag.BillsDir}/estimate-prosign-{Model.Id}.png");
}
\documentclass[french,11pt]{article}
@ -65,7 +66,7 @@
%%%%%%%%%%%%%%%%%%%%% A MODIFIER DANS LA FACTURE %%%%%%%%%%%%%%%%%%%%%
\def\FactureNum {@Model.Id.ToString()} % Numéro de facture
\def\FactureAcquittee {non} % Facture acquittée : oui/non
\def\FactureAcquittee {@ViewBag.Acquitted?"oui":"non"} % Facture acquittée : oui/non
\def\FactureLieu {@proaddrm} % Lieu de l'édition de la facture
\def\FactureObjet {@(new HtmlString(isestimate?"Devis":"Facture")) @TeXHelpers.ToTeX(Model.Title)} % Objet du document
% Description de la facture
@ -193,11 +194,14 @@
@(new HtmlString(isestimate?"Devis validé":"Facture validée")) le @TeXHelpers.ToTeX(Model.ProviderValidationDate.ToString("dddd dd MMMM yyyy",
CultureInfo.CreateSpecificCulture("fr-FR"))).ToHtmlString()
\end{flushright}
@if (prosign.Exists) {
<text>
\begin{center}
\hspace{263pt}
\includegraphics[height=60pt]{@(ViewBag.BillsDir)/estimate-prosign-@(Model.Id).png}
\end{center}
</text>
}
</text>
}
\end{document}

Loading…