diff --git a/Yavsc/Controllers/EstimateController.cs b/Yavsc/Controllers/EstimateController.cs
index a3374f8d..e142560a 100644
--- a/Yavsc/Controllers/EstimateController.cs
+++ b/Yavsc/Controllers/EstimateController.cs
@@ -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());
}
diff --git a/Yavsc/Controllers/FrontOfficeController.cs b/Yavsc/Controllers/FrontOfficeController.cs
index 5899e561..0e0ffea8 100644
--- a/Yavsc/Controllers/FrontOfficeController.cs
+++ b/Yavsc/Controllers/FrontOfficeController.cs
@@ -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);
}
}
}
\ No newline at end of file
diff --git a/Yavsc/Views/Estimate/Index.cshtml b/Yavsc/Views/Estimate/Index.cshtml
index f7ed5930..a05b342a 100644
--- a/Yavsc/Views/Estimate/Index.cshtml
+++ b/Yavsc/Views/Estimate/Index.cshtml
@@ -20,6 +20,15 @@
@Html.DisplayNameFor(model => model.Title)
|
+
+ @Html.DisplayNameFor(model => model.Query.Client)
+ |
+
+ @SR["Performer"]
+ |
+
+ @SR["Id"]
+ |
|
@@ -34,6 +43,15 @@
@Html.DisplayFor(modelItem => item.Title)
|
+
+ @Html.DisplayFor(modelItem => item.Query.Client.UserName)
+ |
+
+ @Html.DisplayFor(modelItem => item.Query.PerformerProfile.Performer.UserName)
+ |
+
+ @Html.DisplayFor(modelItem => item.Id)
+ |
Edit |
Details |
diff --git a/Yavsc/Views/FrontOffice/Estimate.tex.cshtml b/Yavsc/Views/FrontOffice/Estimate.tex.cshtml
index 050004b2..ad5d034e 100644
--- a/Yavsc/Views/FrontOffice/Estimate.tex.cshtml
+++ b/Yavsc/Views/FrontOffice/Estimate.tex.cshtml
@@ -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)) {
+ \\ Téléphone fixe: @ViewBag.To.PhoneNumber
+ }
+@if (!string.IsNullOrWhiteSpace(ViewBag.To.Email)) {
+ \\ E-mail: @ViewBag.To.Email }
}
% 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) {
+
+\AjouterService {@line.Description} {@line.Count} {@line.UnitaryCost}
+
+} }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
\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)) { - @ViewBag.From.PostalAddress.Address } } \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)) { E-mail: @ViewBag.From.Email }
+ @if (!string.IsNullOrWhiteSpace(ViewBag.From.PhoneNumber)) { - Téléphone fixe: @ViewBag.From.PhoneNumber }
}
}
diff --git a/Yavsc/Views/FrontOffice/tmp.cshtml b/Yavsc/Views/FrontOffice/tmp.cshtml
new file mode 100644
index 00000000..1b1e9f81
--- /dev/null
+++ b/Yavsc/Views/FrontOffice/tmp.cshtml
@@ -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)) { - @ViewBag.From.Address }
+ @if (!string.IsNullOrWhiteSpace(ViewBag.From.CityAndState)) { - @ViewBag.From.CityAndState } \newline
+ \small{
+ @if (!string.IsNullOrWhiteSpace(ViewBag.From.Email)) { E-mail: @ViewBag.From.Email }
+ @if (!string.IsNullOrWhiteSpace(ViewBag.From.Mobile)) { - Téléphone mobile: @ViewBag.From.Mobile }
+ @if (!string.IsNullOrWhiteSpace(ViewBag.From.Phone)) { - Téléphone fixe: @ViewBag.From.Phone }
+ }
+}
+
+\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}
|