WIP estimate tex

This commit is contained in:
2016-11-03 17:34:19 +01:00
parent 583adaa09b
commit 828819ca5c
5 changed files with 155 additions and 31 deletions

View File

@ -32,7 +32,10 @@ namespace Yavsc.Controllers
public IActionResult Index()
{
var uid = User.GetUserId();
return View(_context.Estimates.Where(
return View(_context.Estimates.Include(e=>e.Query)
.Include(e=>e.Query.PerformerProfile)
.Include(e=>e.Query.PerformerProfile.Performer)
.Where(
e=>e.OwnerId == uid || e.ClientId == uid
).ToList());
}

View File

@ -89,13 +89,22 @@ namespace Yavsc.Controllers
}
[Produces("text/x-tex"), Authorize,
Route("Release/Estimate-{id}.tex")]
public Estimate Estimate(long id)
Route("estimate-{id}.tex")]
public ViewResult Estimate(long id)
{
var estimate = _context.Estimates.Include(x=>x.Query).
Include(x=>x.Query.Client).FirstOrDefault(x=>x.Id==id);
var adc = estimate.Query.Client.UserName;
return estimate;
var estimate = _context.Estimates.Include(x=>x.Query)
.Include(x=>x.Query.Client)
.Include(x=>x.Query.PerformerProfile)
.Include(x=>x.Query.PerformerProfile.OrganizationAddress)
.Include(x=>x.Query.PerformerProfile.Performer)
.Include(e=>e.Bill).FirstOrDefault(x=>x.Id==id);
// var poa = estimate.Query.PerformerProfile.OrganizationAddress;
// var adc = estimate.Query.Client.UserName;
ViewBag.From = estimate.Query.PerformerProfile.Performer;
ViewBag.To = estimate.Query.Client;
Response.ContentType = "text/x-tex";
// estimate.Query.Client.PostalAddress.
return View("Estimate.tex", estimate);
}
}
}

View File

@ -20,6 +20,15 @@
<th>
@Html.DisplayNameFor(model => model.Title)
</th>
<th>
@Html.DisplayNameFor(model => model.Query.Client)
</th>
<th>
@SR["Performer"]
</th>
<th>
@SR["Id"]
</th>
<th></th>
</tr>
@ -34,6 +43,15 @@
<td>
@Html.DisplayFor(modelItem => item.Title)
</td>
<td>
@Html.DisplayFor(modelItem => item.Query.Client.UserName)
</td>
<td>
@Html.DisplayFor(modelItem => item.Query.PerformerProfile.Performer.UserName)
</td>
<td>
@Html.DisplayFor(modelItem => item.Id)
</td>
<td>
<a asp-action="Edit" asp-route-id="@item.Id">Edit</a> |
<a asp-action="Details" asp-route-id="@item.Id">Details</a> |

View File

@ -1,5 +1,7 @@
@model Estimate
@{
Layout = null;
}
\documentclass[french,11pt]{article}
\usepackage{babel}
\usepackage[T1]{fontenc}
@ -53,14 +55,11 @@
\newcommand{\ListeProduits}{}
%%%%%%%%%%%%%%%%%%%%% A MODIFIER DANS LA FACTURE %%%%%%%%%%%%%%%%%%%%%
\def\FactureNum {@Model.Id.ToString()} % Numéro de facture
\def\FactureAcquittee {non} % Facture acquittée : oui/non
\def\FactureLieu {@Model.Command.Performer.PostalAddress} % Lieu de l'édition de la facture
\def\FactureLieu {@Model.Query.PerformerProfile.OrganizationAddress} % Lieu de l'édition de la facture
\def\FactureObjet {Facture : @Model.Title} % Objet du document
% Description de la facture
\def\FactureDescr {
@ -68,27 +67,33 @@
}
% Infos Client
\def\ClientNom{@Model.Command.Client.Name} % Nom du client
\def\ClientAdresse{% % Adresse du client
@if (!string.IsNullOrWhiteSpace(Model.Command.Client.PostalAddress.Address)) {
@string.Split("\n",Model.Command.Client.PostalAddress.Address).Join("\\\\\n")
}
if (!string.IsNullOrWhiteSpace(@Model.Command.Client.PhoneNumber)) {
Téléphone fixe: @Model.Command.Client.PhoneNumber \\
}
\def\ClientNom{@ViewBag.To.UserName} % Nom du client
if (!string.IsNullOrWhiteSpace(eto)) {
E-mail: @Model.Command.Client.Email }
\def\ClientAdresse{
% Adresse du client
@if (ViewBag.To.PostalAddress!=null) {
@ViewBag.To.PostalAddress.Address.Replace("\n","\\\\\n")
}
@if (!string.IsNullOrWhiteSpace(ViewBag.To.PhoneNumber)) {<text>
\\ Téléphone fixe: @ViewBag.To.PhoneNumber
</text>}
@if (!string.IsNullOrWhiteSpace(ViewBag.To.Email)) {<text>
\\ E-mail: @ViewBag.To.Email </text>}
}
% Liste des produits facturés : Désignation, prix
@foreach (CommandLine line in Model.Command.Bill) {
\AjouterService { @line.Article.Name - @line.Comment (Ref:YPR@line.Article.Id) } {@line.Count} {@line.UnitaryCost}
}
@if (Model.Bill!=null) { 
foreach (CommandLine line in Model.Bill) {
<text>
\AjouterService {@line.Description} {@line.Count} {@line.UnitaryCost}
</text>
} }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\geometry{verbose,tmargin=4em,bmargin=8em,lmargin=6em,rmargin=6em}
\setlength{\parindent}{0pt}
\setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}
@ -99,13 +104,11 @@ if (!string.IsNullOrWhiteSpace(eto)) {
\renewcommand{\headrulewidth}{0pt}
\cfoot{
@if (!string.IsNullOrWhiteSpace(from.Name)) { from.Name }
@if (!string.IsNullOrWhiteSpace(from.Address)) { @"-" @from.Address }
@if (!string.IsNullOrWhiteSpace(from.CityAndState)) { @"-" @from.CityAndState } \newline
@if (!string.IsNullOrWhiteSpace(ViewBag.From.UserName)) { @ViewBag.From.UserName }
@if (!string.IsNullOrWhiteSpace(ViewBag.From.PostalAddress)) { <text> - @ViewBag.From.PostalAddress.Address </text> } } \newline
\small{
@if (!string.IsNullOrWhiteSpace(efrom)) { E-mail: efrom }
@if (!string.IsNullOrWhiteSpace(from.Mobile)) { @"-" Téléphone mobile: @from.Mobile }
@if (!string.IsNullOrWhiteSpace(from.Phone)) { @"-" Téléphone fixe: @from.Phone }
@if (!string.IsNullOrWhiteSpace(ViewBag.From.Email)) { <text> E-mail: @ViewBag.From.Email </text> }
@if (!string.IsNullOrWhiteSpace(ViewBag.From.PhoneNumber)) { <text> - Téléphone fixe: @ViewBag.From.PhoneNumber </text> }
}
}

View File

@ -0,0 +1,91 @@
\geometry{verbose,tmargin=4em,bmargin=8em,lmargin=6em,rmargin=6em}
\setlength{\parindent}{0pt}
\setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}
\thispagestyle{fancy}
\pagestyle{fancy}
\setlength{\parindent}{0pt}
\renewcommand{\headrulewidth}{0pt}
\cfoot{
@if (!string.IsNullOrWhiteSpace(ViewBag.From.Name)) { @ViewBag.From.Name }
@if (!string.IsNullOrWhiteSpace(ViewBag.From.Address)) { <text> - @ViewBag.From.Address </text> }
@if (!string.IsNullOrWhiteSpace(ViewBag.From.CityAndState)) { <text> - @ViewBag.From.CityAndState </text> } \newline
\small{
@if (!string.IsNullOrWhiteSpace(ViewBag.From.Email)) { <text> E-mail: @ViewBag.From.Email </text> }
@if (!string.IsNullOrWhiteSpace(ViewBag.From.Mobile)) { <text> - Téléphone mobile: @ViewBag.From.Mobile </text> }
@if (!string.IsNullOrWhiteSpace(ViewBag.From.Phone)) { <text> - Téléphone fixe: @ViewBag.From.Phone </text> }
}
}
\begin{document}
% Logo de la société
%\includegraphics{logo.jpg}
% Nom et adresse de la société
from.Name \\
from.Address \\
from.ZipCode from.CityAndState\\
Facture n°\FactureNum
{\addtolength{\leftskip}{10.5cm} %in ERT
\textbf{\ClientNom} \\
\ClientAdresse \\
} %in ERT
\hspace*{10.5cm}
\FactureLieu, le \today
~\\~\\
\textbf{Objet : \FactureObjet \\}
\textnormal{\FactureDescr}
~\\
\begin{center}
\begin{tabular}{lrrr}
\textbf{Désignation ~~~~~~} & \textbf{Prix unitaire} & \textbf{Quantité} & \textbf{Montant (EUR)} \\
\hline
\AfficheResultat{}
\end{tabular}
\end{center}
\begin{flushright}
\textit{Auto entreprise en franchise de TVA}\\
\end{flushright}
~\\
\ifthenelse{\equal{\FactureAcquittee}{oui}}{
Facture acquittée.
}{
À régler par chèque ou par virement bancaire :
\begin{center}
\begin{tabular}{|c c c c|}
if (!string.IsNullOrWhiteSpace(from.BankCode) && !string.IsNullOrWhiteSpace(from.WicketCode)
&& !string.IsNullOrWhiteSpace(from.AccountNumber) ) {
\hline \textbf{Code banque} & \textbf{Code guichet} & \textbf{N° de Compte} & \textbf{Clé RIB} \\
from.BankCode & from.WicketCode & from.AccountNumber & from.BankedKey \\
}
if (!string.IsNullOrWhiteSpace(from.IBAN) && !string.IsNullOrWhiteSpace(from.BIC)) {
\hline \textbf{IBAN N°} & \multicolumn{3}{|l|}{ from.IBAN } \\
\hline \textbf{Code BIC} & \multicolumn{3}{|l|}{ from.BIC }
} \\
\hline
\end{tabular}
\end{center}
}
\end{document}