devis sans signature, en Pdf
This commit is contained in:
parent
cf1f1e77b8
commit
c1bb7a1dce
8 changed files with 24 additions and 12 deletions
|
|
@ -7,7 +7,6 @@ using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace Yavsc
|
namespace Yavsc
|
||||||
{
|
{
|
||||||
|
|
||||||
public partial class Startup
|
public partial class Startup
|
||||||
{
|
{
|
||||||
public void ConfigureProtectionServices(IServiceCollection services)
|
public void ConfigureProtectionServices(IServiceCollection services)
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ using Microsoft.AspNet.StaticFiles;
|
||||||
|
|
||||||
namespace Yavsc
|
namespace Yavsc
|
||||||
{
|
{
|
||||||
|
|
||||||
public partial class Startup
|
public partial class Startup
|
||||||
{
|
{
|
||||||
public static string UserFilesDirName { get; private set; }
|
public static string UserFilesDirName { get; private set; }
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ using Yavsc.Models;
|
||||||
|
|
||||||
namespace Yavsc
|
namespace Yavsc
|
||||||
{
|
{
|
||||||
|
|
||||||
public partial class Startup
|
public partial class Startup
|
||||||
{
|
{
|
||||||
public static CookieAuthenticationOptions ExternalCookieAppOptions { get; private set; }
|
public static CookieAuthenticationOptions ExternalCookieAppOptions { get; private set; }
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ namespace Yavsc
|
||||||
public static string AvatarsDirName { private set; get; }
|
public static string AvatarsDirName { private set; get; }
|
||||||
public static string Authority { get; private set; }
|
public static string Authority { get; private set; }
|
||||||
public static string Audience { get; private set; }
|
public static string Audience { get; private set; }
|
||||||
|
public static string Temp { get; set; }
|
||||||
public static SiteSettings SiteSetup { get; private set; }
|
public static SiteSettings SiteSetup { get; private set; }
|
||||||
|
|
||||||
private static ILogger logger;
|
private static ILogger logger;
|
||||||
|
|
@ -234,6 +235,7 @@ namespace Yavsc
|
||||||
SiteSetup = siteSettings.Value;
|
SiteSetup = siteSettings.Value;
|
||||||
Startup.UserFilesDirName = new DirectoryInfo(siteSettings.Value.UserFiles.Blog).FullName;
|
Startup.UserFilesDirName = new DirectoryInfo(siteSettings.Value.UserFiles.Blog).FullName;
|
||||||
Startup.UserBillsDirName = new DirectoryInfo(siteSettings.Value.UserFiles.Bills).FullName;
|
Startup.UserBillsDirName = new DirectoryInfo(siteSettings.Value.UserFiles.Bills).FullName;
|
||||||
|
Startup.Temp = siteSettings.Value.TempDir;
|
||||||
|
|
||||||
// TODO implement an installation & upgrade procedure
|
// TODO implement an installation & upgrade procedure
|
||||||
// Create required directories
|
// Create required directories
|
||||||
|
|
@ -285,7 +287,7 @@ namespace Yavsc
|
||||||
if (ex.InnerException is InvalidOperationException)
|
if (ex.InnerException is InvalidOperationException)
|
||||||
// nothing to do ?
|
// nothing to do ?
|
||||||
{
|
{
|
||||||
// TODO Send an email to the Admin
|
// TODO (or not) Hit the developper
|
||||||
}
|
}
|
||||||
else throw ex;
|
else throw ex;
|
||||||
}
|
}
|
||||||
|
|
@ -346,4 +348,4 @@ namespace Yavsc
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,11 @@ namespace Yavsc.ViewComponents
|
||||||
{
|
{
|
||||||
return await InvokeAsync(id,"Html");
|
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( ()=> {
|
return await Task.Run( ()=> {
|
||||||
Estimate estimate =
|
Estimate estimate =
|
||||||
|
|
@ -38,6 +41,8 @@ namespace Yavsc.ViewComponents
|
||||||
var dia = new DirectoryInfo(Startup.SiteSetup.UserFiles.Avatars);
|
var dia = new DirectoryInfo(Startup.SiteSetup.UserFiles.Avatars);
|
||||||
ViewBag.BillsDir = di.FullName;
|
ViewBag.BillsDir = di.FullName;
|
||||||
ViewBag.AvatarsDir = dia.FullName;
|
ViewBag.AvatarsDir = dia.FullName;
|
||||||
|
ViewBag.AsBill = asBill;
|
||||||
|
ViewBag.Acquitted = acquitted;
|
||||||
if (outputFormat == "LaTeX") {
|
if (outputFormat == "LaTeX") {
|
||||||
return this.View("Estimate_tex", estimate);
|
return this.View("Estimate_tex", estimate);
|
||||||
}
|
}
|
||||||
|
|
@ -59,6 +64,7 @@ namespace Yavsc.ViewComponents
|
||||||
|
|
||||||
return this.View("Estimate_pdf",
|
return this.View("Estimate_pdf",
|
||||||
new PdfGenerationViewModel{
|
new PdfGenerationViewModel{
|
||||||
|
Temp = Startup.Temp,
|
||||||
TeXSource = tex,
|
TeXSource = tex,
|
||||||
DestDir = Startup.UserBillsDirName,
|
DestDir = Startup.UserBillsDirName,
|
||||||
BaseFileName = $"estimate-{id}"
|
BaseFileName = $"estimate-{id}"
|
||||||
|
|
@ -70,4 +76,4 @@ namespace Yavsc.ViewComponents
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,5 +14,6 @@ namespace Yavsc.ViewModels.Gen
|
||||||
public string DestDir { get; set; }
|
public string DestDir { get; set; }
|
||||||
public bool Generated { get; set; }
|
public bool Generated { get; set; }
|
||||||
public HtmlString GenerationErrorMessage { get; set; }
|
public HtmlString GenerationErrorMessage { get; set; }
|
||||||
|
public string Temp { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
|
|
||||||
@model Estimate
|
@model Estimate
|
||||||
|
<div class="estimate">
|
||||||
|
|
||||||
<a href="~/api/pdfestimate/estimate-@(Model.Id).tex" >Export au format LaTeX</a>
|
<a href="~/api/pdfestimate/estimate-@(Model.Id).tex" >Export au format LaTeX</a>
|
||||||
|
|
||||||
|
|
@ -9,3 +10,4 @@
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<a href="~/api/pdfestimate/get/@(Model.Id)" >Télécharger le document généré</a>
|
<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 Yavsc.Helpers
|
||||||
|
@using System.IO
|
||||||
@using System.Globalization
|
@using System.Globalization
|
||||||
@model Estimate
|
@model Estimate
|
||||||
@{
|
@{
|
||||||
|
|
@ -9,8 +10,8 @@
|
||||||
var PostalAddress = to.PostalAddress?.Address.SplitAddressToTeX();
|
var PostalAddress = to.PostalAddress?.Address.SplitAddressToTeX();
|
||||||
var proaddr = Model.Query.PerformerProfile.OrganizationAddress.Address.SplitAddressToTeX();
|
var proaddr = Model.Query.PerformerProfile.OrganizationAddress.Address.SplitAddressToTeX();
|
||||||
var proaddrm = new HtmlString(Model.Query.PerformerProfile.OrganizationAddress.Address);
|
var proaddrm = new HtmlString(Model.Query.PerformerProfile.OrganizationAddress.Address);
|
||||||
var isestimate = true;
|
var isestimate = !ViewBag.AsBill;
|
||||||
var ack = false;
|
var prosign = new FileInfo($"{ViewBag.BillsDir}/estimate-prosign-{Model.Id}.png");
|
||||||
|
|
||||||
}
|
}
|
||||||
\documentclass[french,11pt]{article}
|
\documentclass[french,11pt]{article}
|
||||||
|
|
@ -65,7 +66,7 @@
|
||||||
%%%%%%%%%%%%%%%%%%%%% A MODIFIER DANS LA FACTURE %%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%% A MODIFIER DANS LA FACTURE %%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
\def\FactureNum {@Model.Id.ToString()} % Numéro de 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\FactureLieu {@proaddrm} % Lieu de l'édition de la facture
|
||||||
\def\FactureObjet {@(new HtmlString(isestimate?"Devis":"Facture")) @TeXHelpers.ToTeX(Model.Title)} % Objet du document
|
\def\FactureObjet {@(new HtmlString(isestimate?"Devis":"Facture")) @TeXHelpers.ToTeX(Model.Title)} % Objet du document
|
||||||
% Description de la facture
|
% 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",
|
@(new HtmlString(isestimate?"Devis validé":"Facture validée")) le @TeXHelpers.ToTeX(Model.ProviderValidationDate.ToString("dddd dd MMMM yyyy",
|
||||||
CultureInfo.CreateSpecificCulture("fr-FR"))).ToHtmlString()
|
CultureInfo.CreateSpecificCulture("fr-FR"))).ToHtmlString()
|
||||||
\end{flushright}
|
\end{flushright}
|
||||||
|
@if (prosign.Exists) {
|
||||||
|
<text>
|
||||||
\begin{center}
|
\begin{center}
|
||||||
\hspace{263pt}
|
\hspace{263pt}
|
||||||
\includegraphics[height=60pt]{@(ViewBag.BillsDir)/estimate-prosign-@(Model.Id).png}
|
\includegraphics[height=60pt]{@(ViewBag.BillsDir)/estimate-prosign-@(Model.Id).png}
|
||||||
\end{center}
|
\end{center}
|
||||||
|
</text>
|
||||||
|
}
|
||||||
</text>
|
</text>
|
||||||
}
|
}
|
||||||
\end{document}
|
\end{document}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue