nettoyer le contrôle html de la facture
This commit is contained in:
@ -64,11 +64,9 @@ namespace Yavsc.ApiControllers
|
||||
return new ChallengeResult();
|
||||
}
|
||||
|
||||
var filename = $"facture-{billingCode}-{id}.pdf";
|
||||
|
||||
FileInfo fi = new FileInfo(Path.Combine(Startup.UserBillsDirName, filename));
|
||||
var fi = BillingHelpers.GetBillInfo(billingCode,id);
|
||||
if (!fi.Exists) return Ok(new { Error = "Not generated" });
|
||||
return File(fi.OpenRead(), "application/x-pdf", filename); ;
|
||||
return File(fi.OpenRead(), "application/x-pdf", fi.Name);
|
||||
}
|
||||
|
||||
[HttpGet("facture-{billingCode}-{id}.tex"), Authorize]
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Yavsc.Billing;
|
||||
using Yavsc.Models.Billing;
|
||||
@ -18,5 +19,11 @@ namespace Yavsc.Helpers
|
||||
$"\n\nTotal: {total}";
|
||||
return bill;
|
||||
}
|
||||
|
||||
public static FileInfo GetBillInfo(string billingcode, long id)
|
||||
{
|
||||
var filename = $"facture-{billingcode}-{id}.pdf";
|
||||
return new FileInfo(Path.Combine(Startup.UserBillsDirName, filename));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,12 @@
|
||||
|
||||
@model IBillable
|
||||
<div class="bill">
|
||||
|
||||
<a class="btn btn-default" href="~/api/bill/facture-@(ViewBag.BillingCode)-@(Model.Id).tex" >Export au format LaTeX</a>
|
||||
|
||||
|
||||
@{ var fi = BillingHelpers.GetBillInfo(ViewBag.BillingCode,Model.Id); }
|
||||
@if (fi.Exists) {
|
||||
<a class="btn btn-link" href="~/api/bill/facture-@(ViewBag.BillingCode)-@(Model.Id).pdf" >La facture au format Pdf</a>
|
||||
} else {
|
||||
<form action="~/api/bill/genpdf/@ViewBag.BillingCode/@Model.Id" method="POST">
|
||||
<input class="btn btn-default" type="submit" value="Générer le Pdf"/>
|
||||
<input class="btn btn-default" type="submit" value="Générer la facture au format Pdf"/>
|
||||
</form>
|
||||
|
||||
<a class="btn btn-link" href="~/api/bill/facture-@(ViewBag.BillingCode)-@(Model.Id).pdf" >Télécharger le document généré</a>
|
||||
}
|
||||
</div>
|
||||
|
@ -1199,6 +1199,9 @@
|
||||
<Content Include="Views\Manage\ChangeUserName.cshtml" />
|
||||
<Content Include="Controllers\Haircut\HairCutCommandController.cs" />
|
||||
<Content Include="Views\Manage\Index.cshtml" />
|
||||
<Content Include="Helpers\BillingHelpers.cs" />
|
||||
<Content Include="ApiControllers\BillingController.cs" />
|
||||
<Content Include="Models\Payment\PaypalPayment.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="../Yavsc.Abstract/Yavsc.Abstract.csproj" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
|
Reference in New Issue
Block a user