pdf bill
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
namespace Yavsc.Billing
|
||||
{
|
||||
public interface IBillItem {
|
||||
|
||||
string Name { get; set; }
|
||||
string Description { get; set; }
|
||||
int Count { get; set; }
|
||||
|
@ -74,11 +74,10 @@ namespace Yavsc.ApiControllers
|
||||
[HttpGet("facture-{billingCode}-{id}.tex"), Authorize]
|
||||
public async Task<IActionResult> GetTex(string billingCode, long id)
|
||||
{
|
||||
logger.LogWarning ( $"################################\n# Searching for bill {id} in {billingCode}");
|
||||
var bill = await billingService.GetBillAsync(billingCode, id);
|
||||
|
||||
if (bill==null) {
|
||||
logger.LogCritical ( $"# not found !! ##########\n################################");
|
||||
logger.LogCritical ( $"# not found !! {id} in {billingCode}");
|
||||
return this.HttpNotFound();
|
||||
}
|
||||
logger.LogVerbose(JsonConvert.SerializeObject(bill));
|
||||
@ -94,14 +93,13 @@ namespace Yavsc.ApiControllers
|
||||
[HttpPost("genpdf/{billingCode}/{id}")]
|
||||
public async Task<IActionResult> GeneratePdf(string billingCode, long id)
|
||||
{
|
||||
var estimate = dbContext.Estimates.Include(
|
||||
e=>e.Query
|
||||
).FirstOrDefault(e=>e.Id == id);
|
||||
if (!await authorizationService.AuthorizeAsync(User, estimate, new ViewRequirement()))
|
||||
{
|
||||
return new ChallengeResult();
|
||||
var bill = await billingService.GetBillAsync(billingCode, id);
|
||||
|
||||
if (bill==null) {
|
||||
logger.LogCritical ( $"# not found !! {id} in {billingCode}");
|
||||
return this.HttpNotFound();
|
||||
}
|
||||
return ViewComponent("Bill",new object[] { billingCode, id, OutputFormat.Pdf } );
|
||||
return ViewComponent("Bill",new object[] { billingCode, bill, OutputFormat.Pdf, true, false } );
|
||||
}
|
||||
|
||||
|
||||
|
@ -170,8 +170,8 @@ namespace Yavsc.Helpers
|
||||
};
|
||||
}
|
||||
|
||||
public static bool IsSuccess(PaymentInfo info) {
|
||||
return info.DbContent.State == PayPal.PayPalAPIInterfaceService.Model.PaymentStatusCodeType.COMPLETED.ToString();
|
||||
public static bool IsSuccess(this PayPalPayment info) {
|
||||
return info.State == PayPal.PayPalAPIInterfaceService.Model.PaymentStatusCodeType.COMPLETED.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -70,8 +70,9 @@ namespace Yavsc.Helpers
|
||||
new Replacement("–","\\textendash")
|
||||
};
|
||||
|
||||
public static TeXString ToTeX(this string source)
|
||||
public static TeXString ToTeX(this string source, string defaultValue="\\textit{néant}")
|
||||
{
|
||||
if (source==null) return new TeXString(defaultValue);
|
||||
string result=source;
|
||||
foreach (var r in SpecialCharsDefaultRendering)
|
||||
{
|
||||
@ -80,8 +81,9 @@ namespace Yavsc.Helpers
|
||||
return new TeXString(result);
|
||||
}
|
||||
|
||||
public static TeXString ToTeXCell(this string source)
|
||||
public static TeXString ToTeXCell(this string source, string defaultValue="\\textit{néant}")
|
||||
{
|
||||
if (source==null) return new TeXString(defaultValue);
|
||||
string result=source;
|
||||
foreach (var r in SpecialCharsDefaultRendering)
|
||||
{
|
||||
@ -100,17 +102,18 @@ namespace Yavsc.Helpers
|
||||
return string.Join(separator, items);
|
||||
}
|
||||
|
||||
public static TeXString ToTeX(this string target, string lineSeparator = "\n\\\\")
|
||||
public static TeXString ToTeXLines(this string source, string defaultValue, string lineSeparator = "\n\\\\")
|
||||
{
|
||||
if (target == null) return null;
|
||||
return new TeXString( target.ToTeX().ToString().NewLinesWith(lineSeparator) );
|
||||
if (source == null) return new TeXString(defaultValue);
|
||||
return new TeXString( source.ToTeX().ToString().NewLinesWith(lineSeparator) );
|
||||
}
|
||||
|
||||
public static TeXString SplitAddressToTeX (this string target)
|
||||
public static TeXString SplitAddressToTeX (this string source, string lineSeparator = "\n\\\\", string defaultValue = "\\textit{pas d'adresse postale}")
|
||||
{
|
||||
var alines = target.Split(',');
|
||||
if (string.IsNullOrWhiteSpace(source)) return new TeXString(defaultValue);
|
||||
var alines = source.Split(',');
|
||||
var texlines = alines.Select(l=>l.ToTeX().ToString());
|
||||
return new TeXString(string.Join("\\\\\n",texlines));
|
||||
return new TeXString(string.Join(lineSeparator,texlines));
|
||||
}
|
||||
|
||||
public static bool GenerateEstimatePdf(this PdfGenerationViewModel Model)
|
||||
@ -173,6 +176,7 @@ namespace Yavsc.Helpers
|
||||
// try to find the specified view
|
||||
controller.TryValidateModel(model);
|
||||
ViewEngineResult viewResult = engine.FindPartialView(controller.ActionContext, viewName);
|
||||
|
||||
// create the associated context
|
||||
ViewContext viewContext = new ViewContext();
|
||||
viewContext.ActionDescriptor = controller.ActionContext.ActionDescriptor;
|
||||
|
@ -1,5 +1,6 @@
|
||||
DESTDIR=/srv/www/yavscpre
|
||||
PRODDESTDIR=/srv/www/yavsc
|
||||
ASPNET_ENV=Development
|
||||
|
||||
git_status := $(shell git status -s --porcelain |wc -l)
|
||||
|
||||
@ -13,35 +14,38 @@ endif
|
||||
default: pushInPre
|
||||
|
||||
watch:
|
||||
ASPNET_ENV=Development dnx-watch web --configuration=Debug
|
||||
@ASPNET_ENV=$(ASPNET_ENV) dnx-watch web --configuration=Debug
|
||||
|
||||
run:
|
||||
@ASPNET_ENV=$(ASPNET_ENV) dnx web --configuration=Debug
|
||||
|
||||
clean:
|
||||
rm -rf bin/Release
|
||||
rm -rf bin/output
|
||||
@rm -rf bin/Release
|
||||
@rm -rf bin/output
|
||||
|
||||
bin/Release:
|
||||
dnu build --configuration=Release
|
||||
@dnu build --configuration=Release
|
||||
|
||||
bin/output: bin/Release
|
||||
dnu publish
|
||||
@dnu publish
|
||||
|
||||
bin/output/wwwroot/version: bin/output
|
||||
git log -1 --pretty=format:%h > bin/output/wwwroot/version
|
||||
@git log -1 --pretty=format:%h > bin/output/wwwroot/version
|
||||
|
||||
pushInPre: bin/output/wwwroot/version
|
||||
ssh root@localhost systemctl stop kestrel-pre
|
||||
ssh root@localhost rm -rf $(DESTDIR)/approot
|
||||
(cd bin/output && rsync -ravu ./ root@localhost:$(DESTDIR) >/dev/null)
|
||||
ssh root@localhost sync
|
||||
ssh root@localhost systemctl start kestrel-pre
|
||||
@ssh root@localhost systemctl stop kestrel-pre
|
||||
@ssh root@localhost rm -rf $(DESTDIR)/approot
|
||||
@(cd bin/output && rsync -ravu ./ root@localhost:$(DESTDIR) >/dev/null)
|
||||
@ssh root@localhost sync
|
||||
@ssh root@localhost systemctl start kestrel-pre
|
||||
|
||||
pushInProd: bin/output/wwwroot/version
|
||||
ifeq ($(git_status),0)
|
||||
ssh root@localhost systemctl stop kestrel
|
||||
ssh root@localhost rm -rf $(PRODDESTDIR)/approot
|
||||
(cd bin/output && rsync -ravu ./ root@localhost:$(PRODDESTDIR) >/dev/null)
|
||||
ssh root@localhost sync
|
||||
ssh root@localhost systemctl start kestrel
|
||||
@ssh root@localhost systemctl stop kestrel
|
||||
@ssh root@localhost rm -rf $(PRODDESTDIR)/approot
|
||||
@(cd bin/output && rsync -ravu ./ root@localhost:$(PRODDESTDIR) >/dev/null)
|
||||
@ssh root@localhost sync
|
||||
@ssh root@localhost systemctl start kestrel
|
||||
else
|
||||
@echo Err! Refus de pousser en production: des changements doivent être validés auprès du contrôle de versions.
|
||||
@git status
|
||||
|
@ -39,7 +39,7 @@ namespace Yavsc.Models
|
||||
// Customize the ASP.NET Identity model and override the defaults if needed.
|
||||
// For example, you can rename the ASP.NET Identity table names and more.
|
||||
// Add your customizations after calling base.OnModelCreating(builder);
|
||||
builder.Entity<Contact>().HasKey(x => new { x.OwnerId, x.UserId });
|
||||
builder.Entity<Relationship.Contact>().HasKey(x => new { x.OwnerId, x.UserId });
|
||||
builder.Entity<GoogleCloudMobileDeclaration>().Property(x=>x.DeclarationDate).HasDefaultValueSql("LOCALTIMESTAMP");
|
||||
builder.Entity<PostTag>().HasKey(x=>new { x.PostId, x.TagId});
|
||||
builder.Entity<ApplicationUser>().HasMany<Connection>( c=>c.Connections );
|
||||
@ -209,7 +209,7 @@ namespace Yavsc.Models
|
||||
|
||||
public DbSet<EstimateTemplate> EstimateTemplates { get; set; }
|
||||
|
||||
public DbSet<Contact> Contacts { get; set; }
|
||||
public DbSet<Relationship.Contact> Contacts { get; set; }
|
||||
|
||||
public DbSet<ClientProviderInfo> ClientProviderInfo { get; set; }
|
||||
|
||||
|
@ -19,8 +19,9 @@ namespace Yavsc.Models.Haircut
|
||||
// Bill description
|
||||
public override string GetDescription()
|
||||
{
|
||||
var type = Startup.GlobalLocalizer[this.GetType().Name];
|
||||
var gender = Startup.GlobalLocalizer[this.Prestation.Gender.ToString()];
|
||||
string type = Startup.GlobalLocalizer[this.GetType().Name];
|
||||
string gender = Startup.GlobalLocalizer[this.Prestation.Gender.ToString()];
|
||||
|
||||
return $"{type} ({gender})";
|
||||
}
|
||||
|
||||
@ -75,7 +76,7 @@ namespace Yavsc.Models.Haircut
|
||||
#endif
|
||||
// Le shampoing
|
||||
if (this.Prestation.Shampoo)
|
||||
bill.Add(new CommandLine { Name = "Shampoing", UnitaryCost = SelectedProfile.ShampooPrice });
|
||||
bill.Add(new CommandLine { Name = "Shampoing", Description="Shampoing", UnitaryCost = SelectedProfile.ShampooPrice });
|
||||
|
||||
// la coupe
|
||||
if (Prestation.Cut) {
|
||||
@ -110,7 +111,8 @@ Prestation.Gender == HairCutGenders.Women ?
|
||||
case HairLength.Long:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + longhairsuffix,
|
||||
Name = name,
|
||||
Description = name + longhairsuffix,
|
||||
UnitaryCost = multicolor ? SelectedProfile.LongMultiColorPrice :
|
||||
SelectedProfile.LongColorPrice
|
||||
});
|
||||
@ -118,7 +120,8 @@ Prestation.Gender == HairCutGenders.Women ?
|
||||
case HairLength.HalfLong:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + halflonghairsuffix,
|
||||
Name = name,
|
||||
Description = name + halflonghairsuffix,
|
||||
UnitaryCost = multicolor ? SelectedProfile.HalfMultiColorPrice : SelectedProfile.HalfColorPrice
|
||||
});
|
||||
break;
|
||||
@ -126,7 +129,8 @@ Prestation.Gender == HairCutGenders.Women ?
|
||||
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + shorthairsuffix,
|
||||
Name = name,
|
||||
Description = name = name + shorthairsuffix,
|
||||
UnitaryCost = multicolor ? SelectedProfile.ShortMultiColorPrice : SelectedProfile.ShortColorPrice
|
||||
});
|
||||
|
||||
@ -142,21 +146,24 @@ Prestation.Gender == HairCutGenders.Women ?
|
||||
case HairLength.Long:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + longhairsuffix,
|
||||
Name = name,
|
||||
Description = name + longhairsuffix,
|
||||
UnitaryCost = SelectedProfile.LongBalayagePrice
|
||||
});
|
||||
break;
|
||||
case HairLength.HalfLong:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + halflonghairsuffix,
|
||||
Name = name,
|
||||
Description = name + halflonghairsuffix,
|
||||
UnitaryCost = SelectedProfile.HalfBalayagePrice
|
||||
});
|
||||
break;
|
||||
default:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + shorthairsuffix,
|
||||
Name = name,
|
||||
Description = name + shorthairsuffix,
|
||||
UnitaryCost = SelectedProfile.ShortBalayagePrice
|
||||
});
|
||||
break;
|
||||
@ -171,21 +178,24 @@ Prestation.Gender == HairCutGenders.Women ?
|
||||
case HairLength.Long:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + longhairsuffix,
|
||||
Name = name,
|
||||
Description = name + longhairsuffix,
|
||||
UnitaryCost = SelectedProfile.LongDefrisPrice
|
||||
});
|
||||
break;
|
||||
case HairLength.HalfLong:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + halflonghairsuffix,
|
||||
Name = name,
|
||||
Description = name + halflonghairsuffix,
|
||||
UnitaryCost = SelectedProfile.HalfDefrisPrice
|
||||
});
|
||||
break;
|
||||
default:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + shorthairsuffix,
|
||||
Name = name,
|
||||
Description = name + shorthairsuffix,
|
||||
UnitaryCost = SelectedProfile.ShortDefrisPrice
|
||||
});
|
||||
break;
|
||||
@ -200,21 +210,24 @@ Prestation.Gender == HairCutGenders.Women ?
|
||||
case HairLength.Long:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + longhairsuffix,
|
||||
Name = name,
|
||||
Description = name + longhairsuffix,
|
||||
UnitaryCost = SelectedProfile.LongMechPrice
|
||||
});
|
||||
break;
|
||||
case HairLength.HalfLong:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + halflonghairsuffix,
|
||||
Name = name,
|
||||
Description = name + halflonghairsuffix,
|
||||
UnitaryCost = SelectedProfile.HalfMechPrice
|
||||
});
|
||||
break;
|
||||
default:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + shorthairsuffix,
|
||||
Name = name,
|
||||
Description = name + shorthairsuffix,
|
||||
UnitaryCost = SelectedProfile.ShortMechPrice
|
||||
});
|
||||
break;
|
||||
@ -229,21 +242,24 @@ Prestation.Gender == HairCutGenders.Women ?
|
||||
case HairLength.Long:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + longhairsuffix,
|
||||
Name = name,
|
||||
Description = name + longhairsuffix,
|
||||
UnitaryCost = SelectedProfile.LongPermanentPrice
|
||||
});
|
||||
break;
|
||||
case HairLength.HalfLong:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + halflonghairsuffix,
|
||||
Name = name,
|
||||
Description = name + halflonghairsuffix,
|
||||
UnitaryCost = SelectedProfile.HalfPermanentPrice
|
||||
});
|
||||
break;
|
||||
default:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + shorthairsuffix,
|
||||
Name = name,
|
||||
Description = name + shorthairsuffix,
|
||||
UnitaryCost = SelectedProfile.ShortPermanentPrice
|
||||
});
|
||||
break;
|
||||
@ -268,21 +284,24 @@ Prestation.Gender == HairCutGenders.Women ?
|
||||
case HairLength.Long:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + longhairsuffix,
|
||||
Name = name,
|
||||
Description = name + longhairsuffix,
|
||||
UnitaryCost = SelectedProfile.LongBrushingPrice
|
||||
});
|
||||
break;
|
||||
case HairLength.HalfLong:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + halflonghairsuffix,
|
||||
Name = name,
|
||||
Description = name + halflonghairsuffix,
|
||||
UnitaryCost = SelectedProfile.HalfBrushingPrice
|
||||
});
|
||||
break;
|
||||
default:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + shorthairsuffix,
|
||||
Name = name,
|
||||
Description = name + shorthairsuffix,
|
||||
UnitaryCost = SelectedProfile.ShortBrushingPrice
|
||||
});
|
||||
break;
|
||||
@ -291,7 +310,8 @@ Prestation.Gender == HairCutGenders.Women ?
|
||||
case HairCutGenders.Man:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + shorthairsuffix,
|
||||
Name = name,
|
||||
Description = name + shorthairsuffix,
|
||||
UnitaryCost = SelectedProfile.ManBrushPrice
|
||||
});
|
||||
break;
|
||||
@ -315,21 +335,24 @@ Prestation.Gender == HairCutGenders.Women ?
|
||||
case HairLength.Long:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + longhairsuffix,
|
||||
Name = name,
|
||||
Description = name + longhairsuffix,
|
||||
UnitaryCost = SelectedProfile.LongFoldingPrice
|
||||
});
|
||||
break;
|
||||
case HairLength.HalfLong:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + halflonghairsuffix,
|
||||
Name = name,
|
||||
Description = name + halflonghairsuffix,
|
||||
UnitaryCost = SelectedProfile.HalfFoldingPrice
|
||||
});
|
||||
break;
|
||||
default:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + shorthairsuffix,
|
||||
Name = name,
|
||||
Description = name + shorthairsuffix,
|
||||
UnitaryCost = SelectedProfile.ShortFoldingPrice
|
||||
});
|
||||
break;
|
||||
@ -341,6 +364,7 @@ Prestation.Gender == HairCutGenders.Women ?
|
||||
// les soins
|
||||
if (Prestation.Cares) {
|
||||
bill.Add(new CommandLine { Name = "Soins",
|
||||
Description = "Soins",
|
||||
UnitaryCost = SelectedProfile.CarePrice });
|
||||
|
||||
}
|
||||
|
14
Yavsc/Models/Relationship/PostalAddress.cs
Normal file
14
Yavsc/Models/Relationship/PostalAddress.cs
Normal file
@ -0,0 +1,14 @@
|
||||
namespace Yavsc.Models.Relationship
|
||||
{
|
||||
public class PostalAddress
|
||||
{
|
||||
public string Street1 { get; set; }
|
||||
public string Street2 { get; set; }
|
||||
public string PostalCode { get; set; }
|
||||
public string City { get; set; }
|
||||
public string State { get; set; }
|
||||
public string Province { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -243,7 +243,8 @@
|
||||
<data name="Google error"><value>Erreur Google : {0}</value></data>
|
||||
<data name="Google registration id"><value>Identifiant d'enregistrement Google</value></data>
|
||||
<data name="HalfLong"><value>mi-long</value></data>
|
||||
<data name="HairCutQuery"><value>Demande de préstation en coiffure à domicile</value></data>
|
||||
<data name="MobileHairCut"><value>Coiffure à domicile</value></data>
|
||||
<data name="HairCutQuery"><value>Préstation en coiffure à domicile</value></data>
|
||||
<data name="HairCutQueryValidation"><value>Une demande (de {0}) en coiffure à domicile vient d'être validée</value></data>
|
||||
<data name="Hide source"><value>Cacher le texte source de l'article</value></data>
|
||||
<data name="Home"><value>Accueil</value></data>
|
||||
|
@ -63,7 +63,7 @@ namespace Yavsc.Services
|
||||
MimeMessage msg = new MimeMessage();
|
||||
msg.From.Add(new MailboxAddress(
|
||||
siteSettings.Owner.Name,
|
||||
siteSettings.Owner.Address));
|
||||
siteSettings.Owner.EMail));
|
||||
msg.To.Add(new MailboxAddress("", email));
|
||||
msg.Body = new TextPart("plain")
|
||||
{
|
||||
|
@ -1,9 +1,13 @@
|
||||
using Yavsc.Models.Relationship;
|
||||
|
||||
namespace Yavsc
|
||||
{
|
||||
public class EmailEntry
|
||||
public class Contact
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Address { get; set; }
|
||||
public string EMail { get; set; }
|
||||
|
||||
public PostalAddress PostalAddress { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
@ -22,12 +22,12 @@ namespace Yavsc
|
||||
/// Owner's email
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public EmailEntry Owner { get; set; }
|
||||
public Contact Owner { get; set; }
|
||||
/// <summary>
|
||||
/// Administrator's email
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public EmailEntry Admin { get; set; }
|
||||
public Contact Admin { get; set; }
|
||||
/// <summary>
|
||||
/// User's files directory
|
||||
/// </summary>
|
||||
|
@ -3,6 +3,7 @@ using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Yavsc.Billing;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
@ -15,12 +16,15 @@ namespace Yavsc.ViewComponents
|
||||
{
|
||||
ApplicationDbContext dbContext;
|
||||
IStringLocalizer<Yavsc.Resources.YavscLocalisation> localizer;
|
||||
ILogger logger ;
|
||||
|
||||
public BillViewComponent(ApplicationDbContext dbContext,
|
||||
IStringLocalizer<Yavsc.Resources.YavscLocalisation> localizer)
|
||||
IStringLocalizer<Yavsc.Resources.YavscLocalisation> localizer,
|
||||
ILoggerFactory loggerFactory)
|
||||
{
|
||||
this.dbContext = dbContext;
|
||||
this.localizer = localizer;
|
||||
logger = loggerFactory.CreateLogger<BillViewComponent>();
|
||||
}
|
||||
|
||||
public async Task<IViewComponentResult> InvokeAsync(string code, IBillable billable, OutputFormat format, bool asBill, bool acquitted)
|
||||
@ -31,9 +35,8 @@ namespace Yavsc.ViewComponents
|
||||
ViewBag.AvatarsDir = dia.FullName;
|
||||
ViewBag.AsBill = asBill; // vrai pour une facture, sinon, c'est un devis
|
||||
ViewBag.Acquitted = acquitted;
|
||||
|
||||
ViewBag.BillingCode = code;
|
||||
switch (format) {
|
||||
case OutputFormat.LaTeX :
|
||||
var client = await dbContext.Users
|
||||
.Include(u=>u.PostalAddress)
|
||||
.SingleAsync(u=>u.Id == billable.ClientId);
|
||||
@ -43,16 +46,23 @@ namespace Yavsc.ViewComponents
|
||||
.Include(u=>u.PostalAddress)
|
||||
.SingleAsync(u=>u.Id == billable.PerformerId);
|
||||
ViewBag.Performer = performer;
|
||||
string clientAddress = client.PostalAddress?.Address ?? null;
|
||||
ViewBag.ClientAddress = clientAddress.SplitAddressToTeX();
|
||||
|
||||
ViewBag.ClientAddress = client.PostalAddress?.Address.SplitAddressToTeX();
|
||||
|
||||
var profile = await dbContext.Performers
|
||||
.Include(p=>p.OrganizationAddress)
|
||||
.SingleAsync(p=>p.PerformerId == billable.PerformerId);
|
||||
ViewBag.PerformerProfile = profile;
|
||||
ViewBag.ActivityLabel = localizer[billable.ActivityCode];
|
||||
ViewBag.PerformerOrganizationAddress = profile.OrganizationAddress.Address.SplitAddressToTeX() ;
|
||||
ViewBag.ActivityLabel = (await dbContext.Activities.SingleAsync(a => a.Code == billable.ActivityCode)).Name;
|
||||
|
||||
var proaddr = profile.OrganizationAddress.Address;
|
||||
ViewBag.PerformerOrganizationAddress = proaddr.SplitAddressToTeX() ;
|
||||
ViewBag.FooterPerformerOrganizationAddress = proaddr.SplitAddressToTeX(", ");
|
||||
|
||||
ViewBag.PerformerAddress = performer.PostalAddress?.Address.SplitAddressToTeX() ;
|
||||
switch (format) {
|
||||
case OutputFormat.LaTeX :
|
||||
return this.View("Bill_tex", billable);
|
||||
case OutputFormat.Pdf :
|
||||
string tex = null;
|
||||
@ -60,11 +70,9 @@ namespace Yavsc.ViewComponents
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
this.ViewComponentContext.ViewContext.Writer = writer;
|
||||
|
||||
var resultTex = View("Bill_tex", billable);
|
||||
await resultTex.ExecuteAsync(this.ViewComponentContext);
|
||||
tex = writer.ToString();
|
||||
|
||||
}
|
||||
ViewComponentContext.ViewContext.Writer = oldWriter;
|
||||
|
||||
@ -73,7 +81,7 @@ namespace Yavsc.ViewComponents
|
||||
Temp = Startup.Temp,
|
||||
TeXSource = tex,
|
||||
DestDir = Startup.UserBillsDirName,
|
||||
BaseFileName = $"bill-{code}-{billable.Id}"
|
||||
BaseFileName = $"facture-{code}-{billable.Id}"
|
||||
} );
|
||||
}
|
||||
return View("Default",billable);
|
||||
|
@ -81,12 +81,10 @@
|
||||
<dt>Numéro identifiant votre commande</dt>
|
||||
<dd>@Model.Id</dd>
|
||||
|
||||
<environment names="Development">
|
||||
|
||||
<dt>TODO Facture</dt>
|
||||
<dd>Facture</dd>
|
||||
|
||||
</environment>
|
||||
<dt>@SR["La facture"]
|
||||
</dt>
|
||||
<dd>@await Component.InvokeAsync("Bill", "Brush", Model, OutputFormat.Html, false, false )
|
||||
</dd>
|
||||
|
||||
<dt>@Html.DisplayNameFor(m=>m.Regularisation)</dt>
|
||||
<dd> @Component.Invoke("PayPalButton", Model, "haircut", "HairCutCommand" )
|
||||
|
@ -9,7 +9,6 @@
|
||||
var to = ViewBag.Client;
|
||||
var PostalAddress = ViewBag.ClientAddress;
|
||||
var proaddr = ViewBag.PerformerOrganizationAddress;
|
||||
var proaddrm = proaddr;
|
||||
var isestimate = !ViewBag.AsBill;
|
||||
var prosign = new FileInfo($"{ViewBag.BillsDir}/sign-{ViewBag.BillingCode}-{Model.Id}.png");
|
||||
var clisign = new FileInfo($"{ViewBag.BillsDir}/sign-{ViewBag.BillingCode}-{Model.Id}.png");
|
||||
@ -72,8 +71,8 @@
|
||||
%%%%%%%%%%%%%%%%%%%%% A MODIFIER DANS LA FACTURE %%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\def\FactureNum {@Model.Id.ToString()} % Numéro de facture
|
||||
\def\FactureAcquittee {@ViewBag.Acquitted?"oui":"non"} % Facture acquittée : oui/non
|
||||
\def\FactureLieu {@proaddrm} % Lieu de l'édition de la facture
|
||||
\def\FactureAcquittee {@(ViewBag.Acquitted?"oui":"non")} % Facture acquittée : oui/non
|
||||
\def\FactureLieu {@proaddr} % Lieu de l'édition de la facture
|
||||
\def\FactureObjet {@(new HtmlString(isestimate?"Devis":"Facture")) en @TeXHelpers.ToTeX(activity)} % Objet du document
|
||||
% Description de la facture
|
||||
\def\FactureDescr {
|
||||
@ -85,8 +84,7 @@
|
||||
|
||||
\def\ClientAdresse{
|
||||
% Adresse du client
|
||||
@PostalAddress
|
||||
@if (!string.IsNullOrWhiteSpace(to.PhoneNumber)) {<text>\\
|
||||
@PostalAddress @if (!string.IsNullOrWhiteSpace(to.PhoneNumber)) {<text>\\
|
||||
@TeXHelpers.ToTeX(to.PhoneNumber)
|
||||
</text>}\\
|
||||
E-mail: @TeXHelpers.ToTeX(to.Email)
|
||||
@ -110,8 +108,8 @@
|
||||
\setlength{\parindent}{0pt}
|
||||
|
||||
\renewcommand{\headrulewidth}{0pt}
|
||||
\cfoot{ @TeXHelpers.ToTeX(from.UserName) @if (proaddrm!=null) { <text> - @proaddrm </text> } \newline
|
||||
\small{ E-mail: @TeXHelpers.ToTeX(from.Email) @if (!string.IsNullOrWhiteSpace(from.PhoneNumber)) { <text> - Téléphone fixe: @TeXHelpers.ToTeX(from.PhoneNumber) </text> }
|
||||
\cfoot{ @TeXHelpers.ToTeX(from.UserName) - @ViewBag.FooterPerformerOrganizationAddress \\
|
||||
\small{ E-mail: @TeXHelpers.ToTeX(from.Email) @if (!string.IsNullOrWhiteSpace(from.PhoneNumber)) { <text> - Téléphone : @TeXHelpers.ToTeX(from.PhoneNumber) </text> }
|
||||
}
|
||||
}
|
||||
|
||||
@ -164,8 +162,7 @@
|
||||
\end{flushright}
|
||||
~\\
|
||||
@if (ViewBag.AsBill) {
|
||||
|
||||
} else if (ViewBag.Acquitted) {
|
||||
if (ViewBag.Acquitted) {
|
||||
<text>
|
||||
\ifthenelse{\equal{\FactureAcquittee}{oui}}{
|
||||
Facture acquittée.
|
||||
@ -173,7 +170,11 @@
|
||||
</text>
|
||||
} else {
|
||||
var bi = from.BankInfo;
|
||||
if (bi!=null) {
|
||||
if (bi==null){
|
||||
<text>À régler sur site, en utilisant le paiment PayPal:\\
|
||||
Le relevé d'identité bancaire de ce prestaire n'est pas renseigné.
|
||||
</text>
|
||||
} else {
|
||||
<text>À régler par chèque ou par virement bancaire :
|
||||
|
||||
\begin{center}
|
||||
@ -195,6 +196,7 @@
|
||||
\end{center}</text>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@if (validationDate!=null) {
|
||||
@ -207,10 +209,20 @@
|
||||
<text>
|
||||
\begin{center}
|
||||
\hspace{263pt}
|
||||
\includegraphics[height=60pt]{@(ViewBag.BillsDir)/estimate-prosign-@(Model.Id).png}
|
||||
\includegraphics[height=60pt]{@(ViewBag.BillsDir)/{ViewBag.BillingCode}-prosign-@(Model.Id).png}
|
||||
\end{center}
|
||||
</text>
|
||||
}
|
||||
|
||||
@if (clisign.Exists) {
|
||||
<text>
|
||||
\begin{center}
|
||||
\hspace{263pt}
|
||||
\includegraphics[height=60pt]{@(ViewBag.BillsDir)/{ViewBag.BillingCode}-clisign-@(Model.Id).png}
|
||||
\end{center}
|
||||
</text>
|
||||
}
|
||||
|
||||
</text>
|
||||
}
|
||||
\end{document}
|
||||
|
@ -5,7 +5,7 @@
|
||||
<a class="btn btn-default" href="~/api/bill/facture-@(ViewBag.BillingCode)-@(Model.Id).tex" >Export au format LaTeX</a>
|
||||
|
||||
|
||||
<form action="~/api/bill/genpdf/@ViewBag.BillingCode-@Model.Id" method="POST">
|
||||
<form action="~/api/bill/genpdf/@ViewBag.BillingCode/@Model.Id" method="POST">
|
||||
<input class="btn btn-default" type="submit" value="Générer le Pdf"/>
|
||||
</form>
|
||||
|
||||
|
@ -1,4 +1,15 @@
|
||||
@model HairCutQuery
|
||||
@{
|
||||
var paid = false;
|
||||
if (Model.PaymentId!=null) {
|
||||
if (Model.Regularisation!=null) {
|
||||
if (Model.Regularisation.IsSuccess()) {
|
||||
paid=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
<dl class="dl-horizontal">
|
||||
<dt>@Html.DisplayNameFor(m=>m.Prestation)
|
||||
</dt>
|
||||
@ -22,7 +33,7 @@
|
||||
</dd>
|
||||
<dt>@SR["La facture"]
|
||||
</dt>
|
||||
<dd>@await Component.InvokeAsync("Bill", "Brush", Model, OutputFormat.Html, false, false )
|
||||
<dd>@await Component.InvokeAsync("Bill", "Brush", Model, OutputFormat.Html, true, paid )
|
||||
</dd>
|
||||
<dt>@Html.DisplayNameFor(m=>m.Regularisation)</dt>
|
||||
<dd>
|
||||
|
@ -18,12 +18,12 @@
|
||||
"Banner": "/images/banner.jpg",
|
||||
"Authority": "http://127.0.0.1:5000/",
|
||||
"Owner": {
|
||||
"Name": "[query]",
|
||||
"Address": "bigchief@company.com"
|
||||
"Name": "[Site owner's name]",
|
||||
"EMail": "[Site owner's e-mail address]"
|
||||
},
|
||||
"Admin": {
|
||||
"Name": "[answer]",
|
||||
"Address": "contact@company.com"
|
||||
"Name": "[a name for a site admin]",
|
||||
"EMail": "[an e-mail for a site admin]"
|
||||
},
|
||||
"UserFiles": {
|
||||
"Avatars": "Avatars",
|
||||
|
Reference in New Issue
Block a user