* Fixed the Pdf generation under Slackware

* Estimate view developpement
vnext
Paul Schneider 10 years ago
parent 312585d4f0
commit f695d108fb
27 changed files with 459 additions and 242 deletions

@ -230,9 +230,6 @@ namespace WorkFlowProvider
cmd.CommandText =
"insert into writtings (description, estimid, ucost, count, productid) VALUES (@dscr,@estid,@ucost,@count,@prdid) returning _id";
cmd.Parameters.Add ("@dscr", desc);
// cmd.Parameters.Add ("@prdid", productid);
// cmd.Parameters.Add("@ucost", ucost);
// cmd.Parameters.Add("@mult", count);
cmd.Parameters.Add("@estid", estid);
cmd.Parameters.Add("@ucost", ucost);

@ -143,7 +143,7 @@ namespace Yavsc.Controllers
return UserPost (BlogManager.GetPost (postid));
}
}
string prevstr = App_GlobalResources.LocalizedText.Preview;
string prevstr = LocalizedText.Preview;
return UserPost (BlogManager.GetPost (user, title));
}

@ -88,9 +88,12 @@ namespace Yavsc.ApiControllers
[AcceptVerbs("GET")]
public HttpResponseMessage GetEstimTex(long estimid)
{
string texest = getEstimTex (estimid);
if (texest == null)
throw new HttpRequestValidationException ("Not an estimation id:"+estimid);
return new HttpResponseMessage () {
Content = new ObjectContent (typeof(string),
getEstimTex (estimid),
texest,
new SimpleFormatter ("text/x-tex"))
};
}
@ -101,12 +104,21 @@ namespace Yavsc.ApiControllers
Estimate e = WorkFlowManager.GetEstimate (estimid);
tmpe.Session = new Dictionary<string,object>();
tmpe.Session.Add ("estim", e);
Profile pr = AccountController.GetProfile (e.Responsible);
tmpe.Session.Add ("from", pr);
tmpe.Session.Add ("to", pr);
Profile prpro = new Profile(ProfileBase.Create(e.Responsible));
if (!prpro.IsBankable)
throw new Exception ("NotBankable:"+e.Responsible);
Profile prcli = new Profile(ProfileBase.Create(e.Client));
if (!prcli.IsBillable)
throw new Exception ("NotBillable:"+e.Client);
tmpe.Session.Add ("from", prpro);
tmpe.Session.Add ("to", prcli);
tmpe.Init ();
return tmpe.TransformText ();
}
/// <summary>
/// Gets the estimate in pdf format from tex generation.
/// </summary>
@ -115,14 +127,7 @@ namespace Yavsc.ApiControllers
public HttpResponseMessage GetEstimPdf(long estimid)
{
Estimate estim = WorkFlowManager.GetEstimate (estimid);
Profile prpro = new Profile(ProfileBase.Create(estim.Responsible));
if (!prpro.IsBankable)
throw new Exception ("NotBankable:"+estim.Responsible);
Profile prcli = new Profile(ProfileBase.Create(estim.Client));
if (!prcli.IsBillable)
throw new Exception ("NotBillable:"+estim.Client);
//TODO better with pro.IsBankable && cli.IsBillable
return new HttpResponseMessage () {
Content = new ObjectContent (

@ -9,8 +9,8 @@ using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using Yavsc;
using System.Reflection;
using Yavsc.App_GlobalResources;
using System.Resources;
using Yavsc.Model;
namespace Yavsc.Controllers
{

@ -2,12 +2,13 @@
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using WorkFlowProvider;
using Yavsc.Model.WorkFlow;
using System.Web.Http.Controllers;
using System.Web.Security;
using System.Web.Http.ModelBinding;
using System.Net.Http;
using System.Web.Http;
namespace Yavsc.ApiControllers
{
@ -38,18 +39,8 @@ namespace Yavsc.ApiControllers
{
WorkFlowManager.DropWritting (wrid);
}
class Error {}
[Authorize]
[AcceptVerbs("POST")]
public object UpdateWritting([FromBody] Writting model)
{
if (!ModelState.IsValid) {
return ModelState.Where ( k => k.Value.Errors.Count>0) ;
}
WorkFlowManager.UpdateWritting (model);
return null;
}
[HttpGet]
[Authorize]
@ -67,17 +58,54 @@ namespace Yavsc.ApiControllers
return new { test=string.Format("Hello {0}!",username) };
}
private HttpResponseMessage CreateModelStateErrorResponse () {
// strip exceptions
Dictionary<string,string[]> errs = new Dictionary<string, string[]> ();
foreach (KeyValuePair<string,ModelState> st
in ModelState.Where (x => x.Value.Errors.Count > 0))
errs.Add(st.Key, st.Value.Errors.Select(x=>x.ErrorMessage).ToArray());
return Request.CreateResponse(System.Net.HttpStatusCode.BadRequest,
errs);
}
[Authorize]
[AcceptVerbs("POST")]
[ValidateAjax]
public HttpResponseMessage UpdateWritting([FromBody] Writting wr)
{
WorkFlowManager.UpdateWritting (wr);
return Request.CreateResponse (System.Net.HttpStatusCode.OK);
}
[AcceptVerbs("POST")]
[Authorize]
[ValidateAjax]
/// <summary>
/// Adds the specified imputation to the given estimation by estimation id.
/// </summary>
/// <param name="estid">Estimation identifier</param>
/// <param name="wr">Imputation to add</param>
public long Write ([FromUri] long estid, Writting wr) {
return WorkFlowManager.Write(estid, wr.Description,
wr.UnitaryCost, wr.Count, wr.ProductReference);
public HttpResponseMessage Write ([FromUri] long estid, [FromBody] Writting wr) {
if (estid <= 0) {
ModelState.AddModelError ("EstimationId", "Spécifier un identifiant d'estimation valide");
return Request.CreateResponse (System.Net.HttpStatusCode.BadRequest,
ValidateAjaxAttribute.GetErrorModelObject (ModelState));
}
try {
return Request.CreateResponse(System.Net.HttpStatusCode.OK,
WorkFlowManager.Write(estid, wr.Description,
wr.UnitaryCost, wr.Count, wr.ProductReference));
}
catch (Exception ex) {
return Request.CreateResponse (
System.Net.HttpStatusCode.InternalServerError,
"Internal server error:" + ex.Message + "\n" + ex.StackTrace);
}
}
}
}

@ -69,15 +69,17 @@ namespace Yavsc.Formatters
var pbc = ProfileBase.Create (e.Client);
Profile prcli = new Profile (pbc);
if (!prpro.IsBankable)
throw new Exception ("This provider is not bankable.");
if (!prpro.IsBankable || !prcli.IsBillable)
throw new Exception("not bankable or not billable.");
tmpe.Session.Add ("from", prpro);
tmpe.Session.Add ("to", prcli);
tmpe.Init ();
string content = tmpe.TransformText ();
string name = string.Format ("tmpestimtex{0}", e.Id);
string name = string.Format ("tmpestimtex-{0}", e.Id);
string fullname = Path.Combine (
HttpRuntime.CodegenDir, name);
FileInfo fi = new FileInfo(fullname + ".tex");
@ -92,11 +94,13 @@ namespace Yavsc.Formatters
p.StartInfo.UseShellExecute = false;
p.StartInfo.FileName = "/usr/bin/texi2pdf";
p.StartInfo.Arguments =
string.Format ("--batch -o {0} {1}",
string.Format ("--batch --build-dir={2} -o {0} {1}",
fo.FullName,
fi.FullName);
fi.FullName,HttpRuntime.CodegenDir);
p.Start ();
p.WaitForExit ();
if (p.ExitCode != 0)
throw new Exception ("Pdf generation failed with exit code:" + p.ExitCode);
}
using (StreamReader sr = new StreamReader (fo.FullName)) {

@ -52,23 +52,6 @@ namespace Yavsc
);
RegisterRoutes (RouteTable.Routes);
Error += HandleError;
}
void HandleError (object sender, EventArgs e)
{
if (Server.GetLastError ().GetBaseException () is System.Web.HttpRequestValidationException) {
Response.Clear ();
Response.Write ("Invalid characters.<br>");
Response.Write ("You may want to use your " +
"browser to go back to your form. " +
"You also can <a href=\"" +
Request.UrlReferrer +
"\">hit the url referrer</a>.");
Response.StatusCode = 200;
Response.End ();
}
}
}
}

@ -35,6 +35,8 @@
</asp:ContentPlaceHolder>
</main>
<aside>
<asp:ContentPlaceHolder ID="MASContent" runat="server">
</asp:ContentPlaceHolder>
<div id="login">
<% if (Membership.GetUser()==null) { %>
<%= Html.ActionLink( YavscHelpers.SiteName, "Index", "Home" ,null, new { @class="actionlink" } ) %>
@ -42,7 +44,7 @@
<%= Html.ActionLink("Login", "Login", "Account", new { returnUrl=Request.Url.PathAndQuery }, new { @class="actionlink" } ) %>
<span class="hidcom">Pour pouvoir poster ou commenter</span>
<% } else { %>
<%= Html.ActionLink(HttpContext.Current.User.Identity.Name, "Account", "Profile",null, new { @class="actionlink" }) %>
<%= Html.ActionLink(HttpContext.Current.User.Identity.Name, "Profile", "Account", null, new { @class="actionlink" }) %>
<span class="hidcom"> &Eacute;dition de votre profile </span>
@ <%= Html.ActionLink( YavscHelpers.SiteName, "Index", "Home" ,null, new { @class="actionlink" }) %>
<span class="hidcom"> Page d'accueil </span>
@ -51,8 +53,6 @@
<%= Html.ActionLink( "Deconnexion", "Logout", "Account", new { returnUrl=Request.Url.PathAndQuery }, new { @class="actionlink" }) %>
<% } %>
</div>
<asp:ContentPlaceHolder ID="MASContent" runat="server">
</asp:ContentPlaceHolder>
</aside>
<footer>
<% foreach ( string link in Yavsc.ThanksHelper.Links()) { %>

@ -4,7 +4,6 @@ table.tablesorter {
background-color: #333;
margin:10px 0pt 15px;
font-size: 8pt;
width: 100%;
text-align: left;
}
table.tablesorter thead tr th, table.tablesorter tfoot tr th {
@ -23,13 +22,17 @@ table.tablesorter tbody td {
color: #ffa;
padding: 4px;
vertical-align: top;
background-color: #002;
}
table.tablesorter .odd td {
background-color: #004;
background-color: rgba(0,0,32,0.5);
}
table.tablesorter .even td {
background-color: rgba(16,0,16,0.5);
}
table.tablesorter thead tr .headerSortUp {
background-image: url(/Theme/dark/asc.gif);
}
@ -39,6 +42,3 @@ table.tablesorter thead tr .headerSortDown {
table.tablesorter thead tr .headerSortDown, table.tablesorter thead tr .headerSortUp {
background-color: #123;
}
tr.selected td {
background-color:#102010;
}

@ -54,16 +54,14 @@ label {
}
.message {
color: #7FFF00;
font-size: large;
border: solid green;
background-color: rgba(32,0,32,0.3);
background-color: rgba(0,64,0,0.1);
}
.error {
color: #f88;
font-size: large;
border: solid green;
background-color: rgba(64,0,0,0.3);
background-color: rgba(64,0,0,0.1);
}
.validation-summary-errors{
color: #f88;

@ -0,0 +1,58 @@
//
// ValidateAjaxAttribute.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2014 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Linq;
using System.Net;
using System.Web.Http.Filters;
using System.Net.Http;
using System.Web.Http.ModelBinding;
namespace Yavsc
{
public class ValidateAjaxAttribute : ActionFilterAttribute
{
public static object GetErrorModelObject(ModelStateDictionary modelState) {
var errorModel =
from x in modelState.Keys
where modelState[x].Errors.Count > 0
select new
{
key = x,
errors = modelState[x].Errors.
Select(y => y.ErrorMessage).
ToArray()
};
return errorModel;
}
public override void OnActionExecuting (System.Web.Http.Controllers.HttpActionContext actionContext)
{
var modelState = actionContext.ModelState;
if (!modelState.IsValid)
{
actionContext.Response =
actionContext.Request.CreateResponse
(HttpStatusCode.BadRequest,GetErrorModelObject(modelState));
}
}
}
}

@ -121,10 +121,19 @@ Avatar </td><td> <img class="avatar" src="/Blogs/Avatar?user=<%=ViewData["User
<input type="submit"/>
<% } %>
</asp:Content>
<asp:Content ID="MASC1" ContentPlaceHolderID="MASContent" runat="server">
<% if (Roles.IsUserInRole("Admin")) { %>
Admin,
Bankable:<%= Model.IsBankable %>, Billable:<%=Model.IsBillable%>
<% } %>
<%= Html.ActionLink("Changer de mot de passe","ChangePassword", "Account")%>
</asp:Content>

@ -1,14 +1,14 @@
<%@ Page Title="Devis" Language="C#" Inherits="System.Web.Mvc.ViewPage<Estimate>" MasterPageFile="~/Models/App.master" %>
<asp:Content ContentPlaceHolderID="head" ID="head1" runat="server" >
<script type="text/javascript" src="/js/jquery-latest.js"></script>
<script type="text/javascript" src="/js/jquery.tablesorter.js"></script>
<link rel="stylesheet" href="/Theme/dark/style.css" type="text/css" media="print, projection, screen" />
<script type="text/javascript" src="<%=Url.Content("~/js/jquery-latest.js")%>"></script>
<script type="text/javascript" src="<%=Url.Content("~/js/jquery.tablesorter.js")%>"></script>
<script type="text/javascript" src="<%=Url.Content("~/js/jquery.validate.js")%>"></script>
<script type="text/javascript" src="<%=Url.Content("~/js/jquery.validate.unobtrusive.js")%>"></script>
<link rel="stylesheet" href="<%=Url.Content("~/Theme/dark/style.css")%>" type="text/css" media="print, projection, screen" />
</asp:Content>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
<%= Html.ValidationSummary("Devis") %>
<% using (Html.BeginForm("Estimate","FrontOffice")) { %>
<%= Html.LabelFor(model => model.Title) %>:<%= Html.TextBox( "Title" ) %>
@ -21,14 +21,12 @@
<%= Html.LabelFor(model => model.Description) %>:<%=Html.TextArea( "Description") %>
<%= Html.ValidationMessage("Description", "*") %>
<br/>
<%= Html.LabelFor(model => model.Id) %>:<%=Model.Id%>
<%= Html.Hidden( "Id" ) %>
<br/>
<% if (Model.Id==0) { %>
<input type="submit" name="submit" value="Create"/>
<% } else { %>
<input type="submit" name="submit" value="Update"/>
<% } %>
@ -36,17 +34,17 @@
<table class="tablesorter">
<thead>
<tr>
<th><%=LocalizedText.Description%></th>
<th><%=LocalizedText.Product_reference%></th>
<th><%=LocalizedText.Count%></th>
<th><%=LocalizedText.Unitary_cost%></th>
<th><%=Yavsc.Model.LocalizedText.Description%></th>
<th><%=Yavsc.Model.LocalizedText.Product_reference%></th>
<th><%=Yavsc.Model.LocalizedText.Count%></th>
<th><%=Yavsc.Model.LocalizedText.Unitary_cost%></th>
</tr>
</thead>
<tbody id="wrts">
<% int lc=0;
if (Model.Lines!=null)
foreach (Writting wr in Model.Lines) { lc++; %>
<tr class="<%= (lc%2==0)?"odd ":"" %>row" id="wr<%=wr.Id%>">
<tr class="<%= (lc%2==0)?"odd ":"even " %>row" id="wr<%=wr.Id%>">
<td><%=wr.Description%></td>
<td><%=wr.ProductReference%></td>
<td><%=wr.Count%></td>
@ -60,73 +58,61 @@
</asp:Content>
<asp:Content ContentPlaceHolderID="MASContent" ID="MASContent1" runat="server">
<script type="text/javascript" >
function ShowHideBtn(btn,id)
<div>
<% ViewData["EstimateId"]=Model.Id; %>
<%= Html.Partial("Writting",new Writting(),new ViewDataDictionary(ViewData)
{
var shdiv = document.getElementById(id);
var wanit = shdiv.style.display == "none"; // switch button
shdiv.style.display = wanit ? "block" : "none";
btn.value = wanit ? "-" : "+";
TemplateInfo = new System.Web.Mvc.TemplateInfo
{
HtmlFieldPrefix = ViewData.TemplateInfo.HtmlFieldPrefix==""?"wr":ViewData.TemplateInfo.HtmlFieldPrefix+"_wr"
}
</script>
<form id="writeform">
<input type="button" id="btndtl" value="+"/>
<div id="writearea" style="display:none;">
}) %>
<form>
<input type="button" id="btnnew" value="Nouvelle écriture"/>
<input type="hidden" name="estid" id="estid" value="<%=Model.Id%>"/>
<label for="Description">Description:</label>
<textarea name="Description" id="wrdesc" ></textarea>
<label for="UnitaryCost">Prix unitaire:</label>
<input type="number" name="UnitaryCost" id="UnitaryCost" step="0.01"/>
<label for="Count">Quantité:</label>
<input type="number" name="Count" id="Count"/>
<label for="ProductReference">Référence du produit:</label>
<input type="text" name="ProductReference" id="ProductReference"/>
<input type="button" name="btnmodify" id="btnmodify" value="Modifier"/>
<input type="button" name="btncreate" id="btncreate" value="Écrire"/>
<input type="button" name="btndrop" id="btndrop" value="Supprimer"/>
<input type="hidden" name="wrid" id="wrid" />
<tt id="msg" class="message" style="display:none;"></tt>
<input type="button" id="btncreate" value="Ecrire"/>
<input type="button" id="btnmodify" value="Modifier" class="hidden"/>
<input type="button" id="btndrop" value="Supprimer" class="hidden"/>
</form>
<tt id="msg" class="hidden message"></tt>
<style>
.row { cursor:pointer; }
table.tablesorter td:hover { background-color: rgba(0,64,0,0.5); }
.hidden { display:none; }
.selected *, .odd .selected { font-size-adjust: +1; background-color: rgb(0,64,0); }
.selected td { background-color: rgba(0,64,0,0.5); }
</style>
<script>
jQuery.support.cors = true;
function message(msg) {
if (msg) { $("#msg").css("display:inline");
$("#msg").text(msg);} else { $("#msg").css("display:hidden"); } }
if (msg) {
$("#msg").removeClass("hidden");
$("#msg").text(msg);
} else { $("#msg").addClass("hidden"); } }
function GetWritting () {
return {
Id: Number($("#wrid").val()),
UnitaryCost: Number($("#UnitaryCost").val()),
Count: parseInt($("#Count").val()),
ProductReference: $("#ProductReference").val(),
Description: $("#wrdesc").val()
Id: Number($("#wr_Id").val()),
UnitaryCost: Number($("#wr_UnitaryCost").val()),
Count: parseInt($("#wr_Count").val()),
ProductReference: $("#wr_ProductReference").val(),
Description: $("#wr_Description").val()
};
}
function wredit(pwrid)
{
$("#wr"+wrid.value).removeClass("selected");
$("#wrid").val(pwrid);
if (wrid.value!=0)
$("#wr"+wrid.value).addClass("selected");
$("#wr"+wr_Id.value).removeClass("selected");
$("#wr"+wr_Id.value).addClass((wr_Id.value%2==0)?"even":"odd");
$("#wr_Id").val(pwrid);
if (pwrid>0) {
$("#btncreate").addClass("hidden");
$("#btnmodify").removeClass("hidden");
$("#btndrop").removeClass("hidden");
$("#wr"+wr_Id.value).removeClass((wr_Id.value%2==0)?"even":"odd");
$("#wr"+wr_Id.value).addClass("selected");
} else {
$("#btncreate").removeClass("hidden");
$("#btnmodify").addClass("hidden");
@ -136,19 +122,19 @@
function delRow() {
$.ajax({
url: "<%=ViewData["WABASEWF"]+"/DropWritting"%>",
url: "<%=Url.Content("~/api/WorkFlow/DropWritting")%>",
type: "Get",
data: { wrid: wrid.value },
data: { wrid: wr_Id.value },
contentType: 'application/json; charset=utf-8',
success: function () {
var tr = document.getElementById("wr"+wrid.value);
$("#wr"+wrid.value).remove();
$("#wrid").val(0);
$("#ucost").val(0);
$("#Count").val(0);
$("#Description").val();
$("#ProductReference").val();
$("#wr"+wr_Id.value).remove();
$("#wr_Id").val(0);
$("#wr_UnitaryCost").val(0);
$("#wr_Count").val(0);
$("#wr_Description").val();
$("#wr_ProductReference").val();
wredit(0);
message(false);
},
error: function (xhr, ajaxOptions, thrownError) {
message(xhr.status+" : "+xhr.responseText);}
@ -159,22 +145,19 @@
function setRow() {
var wrt = GetWritting();
$.ajax({
url: "<%=ViewData["WABASEWF"]+"/UpdateWritting"%>",
url: "<%=Url.Content("~/api/WorkFlow/UpdateWritting")%>",
type: 'POST',
data: wrt,
success: function (ms) {
if (ms)
message(JSON.stringify(ms));
else {
success: function () {
var cells = document.getElementById("wr"+wrt.Id).getElementsByTagName("TD");
cells[0].innerHTML=wrt.Description;
cells[1].innerHTML=wrt.ProductReference;
cells[2].innerHTML=wrt.UnitaryCost;
cells[3].innerHTML=wrt.Count;
}
cells[2].innerHTML=wrt.Count;
cells[3].innerHTML=wrt.UnitaryCost;
message(false);
},
error: function (xhr, ajaxOptions, thrownError) {
$("#msg").text(xhr.status+" : "+xhr.responseText);}
message (xhr.status+" : "+xhr.responseText+" / "+thrownError);}
});
}
@ -183,15 +166,13 @@ function addRow(){
var wrt = GetWritting();
var estid = parseInt($("#Id").val());
$.ajax({
url: "<%=ViewData["WABASEWF"]+"/Write"%>/?estid="+estid,
url: "<%=Url.Content("~/api/WorkFlow/Write?estid=")%>"+estid,
type: "POST",
data: wrt,
success: function (data) {
wrt.Id = Number(data);
wrid.value = wrt.Id;
wr_Id.value = wrt.Id;
var wridval = 'wr'+wrt.Id;
//$("#wrts").append("<tr class=\"selected row\" id=\"wr"+wrt.Id+"\"><td>"+wrt.Description+"</td><td>"+wrt.ProductReference+"</td><td>"+wrt.Count+"</td><td>"+wrt.UnitaryCost+"</td></tr>");
jQuery('<tr/>', {
id: wridval,
"class": 'selected row',
@ -201,50 +182,56 @@ function addRow(){
$("<td>"+wrt.Count+"</td>").appendTo("#"+wridval);
$("<td>"+wrt.UnitaryCost+"</td>").appendTo("#"+wridval);
$("#"+wridval).click(function(ev){onEditRow(ev);});
$(".tablesorter").tablesorter( {sortList: [[0,0], [1,0]]} );
message(false);
},
error: function (xhr, ajaxOptions, thrownError) {
message(xhr.status+" : "+xhr.responseText);}});
statusCode: {
400: function(data) {
alert(JSON.stringify(data));
}
function ShowDtl(val)
{
document.getElementById("writearea").style.display = val ? "block" : "none";
document.getElementById("btndtl").value = val ? "-" : "+";
},
error: function (xhr, ajaxOptions, thrownError) {
message(xhr.status+" : "+xhr.responseText+" / "+thrownError);}});
}
function onEditRow(e) {
ShowDtl(true);
var cells = e.delegateTarget.getElementsByTagName("TD");
var hid=e.delegateTarget.id;
var vwrid = Number(hid.substr(2));
wredit(vwrid);
$("#wrdesc").val(cells[0].innerHTML);
$("#ProductReference").val(cells[1].innerHTML);
$("#Count").val(cells[2].innerHTML);
$("#UnitaryCost").val(Number(cells[3].innerHTML.replace(",",".")));
$("#wr_Description").val(cells[0].innerHTML);
$("#wr_ProductReference").val(cells[1].innerHTML);
$("#wr_Count").val(cells[2].innerHTML);
$("#wr_UnitaryCost").val(Number(cells[3].innerHTML.replace(",",".")));
}
$(document).ready(function () {
// bug when no row: $(".tablesorter").tablesorter( {sortList: [[0,0], [1,0]]} );
// bug when no row:
<% if (Model.Lines != null) if (Model.Lines.Length>0) { %>
$(".tablesorter").tablesorter( {sortList: [[0,0], [1,0]]} );
<% } %>
$("#btncreate").click(addRow);
$("#btnmodify").click(setRow);
$("#btndrop").click(delRow);
$("#btndtl").click(function(){ShowDtl(document.getElementById("writearea").style.display != "block");});
$(".row").click(function (e) {onEditRow(e);});
$("#btnnew").click(function () {
wredit(0);
$("#wrdesc").val("");
$("#ProductReference").val("");
$("#Count").val(1);
$("#UnitaryCost").val(0);
$("#wr_Description").val("");
$("#wr_ProductReference").val("");
$("#wr_Count").val(1);
$("#wr_UnitaryCost").val(0);
});
});
</script>
</div>
</form>
<a class="actionlink" href="<%=ViewData["WebApiBase"]%>/FrontOffice/GetEstimTex?estimid=<%=Model.Id%>"><%= LocalizedText.Tex_version %></a>
<a class="actionlink" href="<%=ViewData["WebApiBase"]%>/FrontOffice/GetEstimPdf?estimid=<%=Model.Id%>"><%= LocalizedText.Pdf_version %></a>
</div>
</asp:Content>

@ -1,14 +0,0 @@
<%@ Page Title="Ligne de devis" Language="C#" Inherits="System.Web.Mvc.ViewPage<Writting>" MasterPageFile="~/Models/App.master" %>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
<%= Html.ValidationSummary("Ligne de devis") %>
<% using (Html.BeginForm("Write","WorkFlow")) { %>
<%= Html.LabelFor(model => model.Id) %>:<%=Model.Id%>
<%= Html.Hidden( "Id" ) %>
<%= Html.Hidden( "EstimateId", (long) ViewData["EstimateId"]) %>
<%= Html.LabelFor(model => model.UnitaryCost) %>:<%= Html.TextBox( "UnitaryCost" ) %>
<%= Html.ValidationMessage("UnitaryCost", "*") %>
<% } %>
</asp:Content>

@ -0,0 +1,23 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Writting>" %>
<%= Html.ValidationSummary("Ligne de devis") %>
<% using (Html.BeginForm("Write","WorkFlow")) { %>
<%= Html.Hidden( "Id" ) %>
<%= Html.Hidden( "EstimateId", (long) ViewData["EstimateId"]) %>
<%= Html.LabelFor(model => model.Description) %>:<%= Html.TextBox( "Description" ) %>
<%= Html.ValidationMessage("Description", "*") %>
<br/>
<%= Html.LabelFor(model => model.ProductReference) %>:<%= Html.TextBox( "ProductReference" ) %>
<%= Html.ValidationMessage("ProductReference", "*") %>
<br/>
<%= Html.LabelFor(model => model.UnitaryCost) %>:<%= Html.TextBox( "UnitaryCost" ) %>
<%= Html.ValidationMessage("UnitaryCost", "*") %>
<br/>
<%= Html.LabelFor(model => model.Count) %>:<%= Html.TextBox( "Count" ) %>
<%= Html.ValidationMessage("Count", "*") %><br/>
<% } %>

@ -1,17 +0,0 @@
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<title>test</title>
</head>
<body>
<div>
test
</div>
</body>
</html>

@ -29,7 +29,6 @@
<add namespace="Yavsc.Model.Admin" />
<add namespace="Yavsc.Model.Blogs" />
<add namespace="Yavsc.Model.WorkFlow" />
<add namespace="Yavsc.App_GlobalResources" />
</namespaces>
</pages>
</system.web>

@ -227,5 +227,7 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
<add key="Name" value="Psc" />
<add key="DefaultAvatar" value="/images/noavatar.png;image/png" />
<add key="RegistrationMessage" value="/RegistrationMail.txt" />
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
</appSettings>
</configuration>

@ -155,14 +155,9 @@
<DependentUpon>Estim.tt</DependentUpon>
</Compile>
<Compile Include="templates\TexEstimInit.cs" />
<Compile Include="Formatters\TexFormatter.cs" />
<Compile Include="Formatters\EstimToPdfFormatter.cs" />
<Compile Include="App_GlobalResources\LocalizedText.Designer.cs">
<DependentUpon>LocalizedText.resx</DependentUpon>
</Compile>
<Compile Include="App_GlobalResources\LocalizedText.fr.Designer.cs">
<DependentUpon>LocalizedText.fr.resx</DependentUpon>
</Compile>
<Compile Include="Formatters\SimpleFormatter.cs" />
<Compile Include="ValidateAjaxAttribute.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Web.config" />
@ -221,12 +216,10 @@
<Content Include="Views\Admin\Restored.aspx" />
<Content Include="Views\Admin\Index.aspx" />
<Content Include="Views\FrontOffice\Estimate.aspx" />
<Content Include="Views\FrontOffice\test.cshtml" />
<Content Include="js\jquery.metadata.js" />
<Content Include="js\jquery.tablesorter.js" />
<Content Include="js\jquery.tablesorter.min.js" />
<Content Include="js\jquery-latest.js" />
<Content Include="Views\FrontOffice\Write.aspx" />
<Content Include="Theme\style.css" />
<Content Include="Theme\green\asc.png" />
<Content Include="Theme\green\bg.png" />
@ -247,6 +240,7 @@
<Content Include="Catalog.xml" />
<Content Include="RegistrationMail.txt" />
<Content Include="instdbws.sql" />
<Content Include="Views\FrontOffice\Writting.ascx" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
@ -301,14 +295,4 @@
<Name>NpgsqlWorkflow</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="App_GlobalResources\LocalizedText.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>LocalizedText.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="App_GlobalResources\LocalizedText.fr.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>LocalizedText.fr.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>

@ -75,10 +75,10 @@
\def\FactureNum {<#= estim.Id.ToString() #>} % Numéro de facture
\def\FactureAcquittee {non} % Facture acquittée : oui/non
\def\FactureLieu {<#= from.CityAndState #>} % Lieu de l'édition de la facture
\def\FactureObjet {Facture} % Objet du document
\def\FactureObjet {Facture : <#= estim.Title #>} % Objet du document
% Description de la facture
\def\FactureDescr {%
<#= estim.Title #>
<#= estim.Description #>
}
% Infos Client
@ -104,9 +104,6 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\geometry{verbose,tmargin=4em,bmargin=8em,lmargin=6em,rmargin=6em}
\setlength{\parindent}{0pt}
\setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}
@ -185,7 +182,5 @@ Facture n°\FactureNum
\hline
\end{tabular}
\end{center}
}
\end{document}

@ -0,0 +1,151 @@
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Mono Runtime Version: 4.0.30319.17020
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
namespace Yavsc.Model {
using System;
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class LocalizedText {
private static System.Resources.ResourceManager resourceMan;
private static System.Globalization.CultureInfo resourceCulture;
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal LocalizedText() {
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
public static System.Resources.ResourceManager ResourceManager {
get {
if (object.Equals(null, resourceMan)) {
System.Resources.ResourceManager temp = new System.Resources.ResourceManager("Yavsc.Model.LocalizedText", typeof(LocalizedText).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
public static System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
public static string Preview {
get {
return ResourceManager.GetString("Preview", resourceCulture);
}
}
public static string Register {
get {
return ResourceManager.GetString("Register", resourceCulture);
}
}
public static string Unitary_cost {
get {
return ResourceManager.GetString("Unitary_cost", resourceCulture);
}
}
public static string Not_Approuved {
get {
return ResourceManager.GetString("Not Approuved", resourceCulture);
}
}
public static string Remove {
get {
return ResourceManager.GetString("Remove", resourceCulture);
}
}
public static string Online {
get {
return ResourceManager.GetString("Online", resourceCulture);
}
}
public static string Product_reference {
get {
return ResourceManager.GetString("Product_reference", resourceCulture);
}
}
public static string Welcome {
get {
return ResourceManager.GetString("Welcome", resourceCulture);
}
}
public static string Title {
get {
return ResourceManager.GetString("Title", resourceCulture);
}
}
public static string Offline {
get {
return ResourceManager.GetString("Offline", resourceCulture);
}
}
public static string Ciffer {
get {
return ResourceManager.GetString("Ciffer", resourceCulture);
}
}
public static string Pdf_version {
get {
return ResourceManager.GetString("Pdf_version", resourceCulture);
}
}
public static string Description {
get {
return ResourceManager.GetString("Description", resourceCulture);
}
}
public static string User_name {
get {
return ResourceManager.GetString("User_name", resourceCulture);
}
}
public static string User_List {
get {
return ResourceManager.GetString("User List", resourceCulture);
}
}
public static string Tex_version {
get {
return ResourceManager.GetString("Tex_version", resourceCulture);
}
}
public static string Count {
get {
return ResourceManager.GetString("Count", resourceCulture);
}
}
}
}

@ -12,6 +12,13 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Count"><value>Nombre</value></data>
<data name="Ciffer"><value>Chiffre</value></data>
<data name="Title"><value>Titre</value></data>
<data name="Description"><value>Description</value></data>
<data name="Product_reference"><value>Référence produit</value></data>
<data name="Unitary_cost"><value>Coût unitaire</value></data>
<data name="Count"><value>Nombre</value></data>
<data name="Preview"><value>Prévisualiser</value><comment>Prévisualiser le document</comment></data>
<data name="Welcome"><value>Bienvenue</value><comment></comment></data>
<data name="User List"><value>Liste des utilisateurs</value><comment></comment></data>
@ -23,8 +30,4 @@
<data name="Pdf_version"><value>Version Pdf</value></data>
<data name="Tex_version"><value>Version LaTeX</value></data>
<data name="User_name"><value>Nom d'utilisateur</value></data>
<data name="Description"><value>Description</value></data>
<data name="Product_reference"><value>Référence produit</value></data>
<data name="Unitary_cost"><value>Coût unitaire</value></data>
<data name="Count"><value>Nombre</value></data>
</root>

@ -12,6 +12,13 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Count"><value>Count</value></data>
<data name="Ciffer"><value>Ciffer</value></data>
<data name="Title"><value>Title</value></data>
<data name="Description"><value>Description</value></data>
<data name="Product_reference"><value>Product_reference</value></data>
<data name="Unitary_cost"><value>Unitary_cost</value></data>
<data name="Count"><value>Count</value></data>
<data name="Preview"><value>Preview</value><comment>comment on preview</comment></data>
<data name="Welcome"><value>Welcome</value><comment></comment></data>
<data name="User List"><value>User List</value><comment></comment></data>
@ -23,9 +30,4 @@
<data name="Pdf_version"><value>Pdf version</value></data>
<data name="Tex_version"><value>LaTeX version</value></data>
<data name="User_name"><value>User name</value></data>
<data name="Description"><value>Description</value></data>
<data name="Product_reference"><value>Product_reference</value></data>
<data name="Unitary_cost"><value>Unitary_cost</value></data>
<data name="Count"><value>Count</value></data>
</root>

@ -11,7 +11,7 @@ namespace Yavsc.Model.WorkFlow
{
}
[Required]
[DisplayName("Titre")]
[Display(ResourceType = typeof(LocalizedText),Name="Title")]
public string Title { get; set; }
[Required]
[DisplayName("Description")]
@ -24,7 +24,7 @@ namespace Yavsc.Model.WorkFlow
public string Client { get; set; }
public long Id { get; set; }
[DisplayName("Chiffre")]
[Display(ResourceType = typeof(LocalizedText),Name="Ciffer")]
public decimal Ciffer {
get {
decimal total = 0;

@ -1,5 +1,6 @@
using System;
using System.ComponentModel.DataAnnotations;
using Yavsc.Model;
namespace Yavsc.Model.WorkFlow
{
@ -20,13 +21,14 @@ namespace Yavsc.Model.WorkFlow
/// Who knows?
/// </summary>
/// <value>The unitary cost.</value>
[Display(Name="Coût unitaire")]
[Display(ResourceType = typeof(LocalizedText),Name="Unitary_cost")]
[Required(ErrorMessage="Veuillez renseigner un coût unitaire")]
public decimal UnitaryCost { get; set; }
/// <summary>
/// Gets or sets the count.
/// </summary>
/// <value>The count.</value>
[Display(ResourceType = typeof(LocalizedText),Name="Count")]
[Required(ErrorMessage="Veuillez renseigner un multiplicateur pour cette imputation")]
public int Count { get; set; }
/// <summary>
@ -35,6 +37,7 @@ namespace Yavsc.Model.WorkFlow
/// <value>The product reference.</value>
[Required(ErrorMessage="Veuillez renseigner une référence produit")]
[StringLength(512)]
[Display(ResourceType = typeof(LocalizedText),Name="Product_reference")]
public string ProductReference { get; set; }
/// <summary>
/// Gets or sets the description.
@ -42,6 +45,7 @@ namespace Yavsc.Model.WorkFlow
/// <value>The description.</value>
[Required(ErrorMessage="Veuillez renseigner une description de cette imputation.")]
[StringLength (2048)]
[Display(ResourceType = typeof(LocalizedText),Name="Description")]
public string Description { get; set; }
public override string ToString ()

@ -7,7 +7,7 @@
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{68F5B80A-616E-4C3C-91A0-828AA40000BD}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>yavscModel</RootNamespace>
<RootNamespace>Yavsc.Model</RootNamespace>
<AssemblyName>YavscModel</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@ -78,6 +78,12 @@
<Compile Include="Blogs\Configuration\BlogProvidersConfigurationCollection.cs" />
<Compile Include="Blogs\Configuration\BlogProvidersConfigurationSection.cs" />
<Compile Include="WorkFlow\NewEstimateEvenArgs.cs" />
<Compile Include="LocalizedText.fr.Designer.cs">
<DependentUpon>LocalizedText.fr.resx</DependentUpon>
</Compile>
<Compile Include="LocalizedText.Designer.cs">
<DependentUpon>LocalizedText.resx</DependentUpon>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
@ -102,4 +108,14 @@
</Properties>
</MonoDevelop>
</ProjectExtensions>
<ItemGroup>
<EmbeddedResource Include="LocalizedText.fr.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>LocalizedText.fr.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="LocalizedText.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>LocalizedText.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>
Loading…