billing
This commit is contained in:
parent
7b9078c6da
commit
42c08797e3
44 changed files with 2798 additions and 350 deletions
|
|
@ -5,7 +5,6 @@ using Newtonsoft.Json;
|
|||
|
||||
namespace Yavsc.Models.Billing
|
||||
{
|
||||
using System;
|
||||
using YavscLib.Billing;
|
||||
|
||||
public class CommandLine : ICommandLine {
|
||||
|
|
@ -13,10 +12,14 @@ namespace Yavsc.Models.Billing
|
|||
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public long Id { get; set; }
|
||||
|
||||
[Required,MaxLength(256)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Required,MaxLength(512)]
|
||||
public string Description { get; set; }
|
||||
|
||||
public int Count { get; set; }
|
||||
[Display(Name="Nombre")]
|
||||
public int Count { get; set; } = 1;
|
||||
|
||||
[DisplayFormat(DataFormatString="{0:C}")]
|
||||
public decimal UnitaryCost { get; set; }
|
||||
|
|
@ -31,7 +34,15 @@ namespace Yavsc.Models.Billing
|
|||
get;
|
||||
|
||||
set;
|
||||
} = "EUR";
|
||||
|
||||
[NotMapped]
|
||||
public string Reference {
|
||||
get {
|
||||
return "CL/"+this.Id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using YavscLib.Billing;
|
||||
|
||||
namespace Yavsc.Models.Billing {
|
||||
public class FixedImpacter : IBillingImpacter
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace Yavsc.Models.Billing
|
|||
using Workflow;
|
||||
using YavscLib;
|
||||
using YavscLib.Billing;
|
||||
using YavscLib.Models.Workflow;
|
||||
using YavscLib.Workflow;
|
||||
|
||||
public abstract class NominativeServiceCommand : IBaseTrackedEntity, IQuery, IIdentified<long>
|
||||
{
|
||||
|
|
@ -71,9 +71,6 @@ namespace Yavsc.Models.Billing
|
|||
[ForeignKey("ActivityCode"),JsonIgnore,Display(Name="Domaine d'activité")]
|
||||
public virtual Activity Context { get; set ; }
|
||||
|
||||
public System.Collections.Generic.List<IBillItem> GetBillItems()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public abstract System.Collections.Generic.List<IBillItem> GetBillItems();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
using YavscLib.Billing;
|
||||
|
||||
namespace Yavsc.Models.Billing {
|
||||
public class ProportionalImpacter : IBillingImpacter
|
||||
public class ProportionalImpacter : IBillingImpacter
|
||||
{
|
||||
public decimal K { get; set; }
|
||||
public decimal Impact(decimal orgValue)
|
||||
|
|
@ -8,4 +10,4 @@ namespace Yavsc.Models.Billing {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using YavscLib.Billing;
|
||||
|
||||
namespace Yavsc.Models.Billing {
|
||||
|
||||
public class ReductionCode : IBillingClause
|
||||
|
|
@ -28,4 +30,4 @@ public class ReductionCode : IBillingClause
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +1,27 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using Yavsc.Models.Billing;
|
||||
using Yavsc.Models.Payment;
|
||||
using Yavsc.Models.Relationship;
|
||||
using YavscLib.Billing;
|
||||
|
||||
namespace Yavsc.Models.Haircut
|
||||
{
|
||||
public class HairCutQuery : NominativeServiceCommand
|
||||
{
|
||||
|
||||
// Bill description
|
||||
public override string Description
|
||||
{
|
||||
get;
|
||||
|
||||
set;
|
||||
} = "Prestation en coiffure à domicile";
|
||||
}
|
||||
= "Prestation en coiffure à domicile";
|
||||
|
||||
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
override public long Id { get; set; }
|
||||
|
|
@ -23,17 +29,17 @@ namespace Yavsc.Models.Haircut
|
|||
[Required]
|
||||
public long PrestationId { get; set; }
|
||||
|
||||
[ForeignKey("PrestationId"),Required,Display(Name="Préstation")]
|
||||
public virtual HairPrestation Prestation { get; set; }
|
||||
[ForeignKey("PrestationId"), Required, Display(Name = "Préstation")]
|
||||
public virtual HairPrestation Prestation { get; set; }
|
||||
|
||||
[ForeignKey("LocationId")]
|
||||
[Display(Name="Lieu du rendez-vous")]
|
||||
[Display(Name = "Lieu du rendez-vous")]
|
||||
[DisplayFormat(ConvertEmptyStringToNull = true, NullDisplayText = "[Pas de lieu spécifié]")]
|
||||
public virtual Location Location { get; set; }
|
||||
public virtual Location Location { get; set; }
|
||||
|
||||
[Display(Name="Date et heure")]
|
||||
[DisplayFormat(NullDisplayText = "[Pas de date ni heure]",ApplyFormatInEditMode=true, DataFormatString = "{0:d}")]
|
||||
public DateTime? EventDate
|
||||
[Display(Name = "Date et heure")]
|
||||
[DisplayFormat(NullDisplayText = "[Pas de date ni heure]", ApplyFormatInEditMode = true, DataFormatString = "{0:d}")]
|
||||
public DateTime? EventDate
|
||||
{
|
||||
get;
|
||||
set;
|
||||
|
|
@ -46,9 +52,293 @@ namespace Yavsc.Models.Haircut
|
|||
set;
|
||||
}
|
||||
|
||||
[Display(Name="Informations complémentaires"),
|
||||
[Display(Name = "Informations complémentaires"),
|
||||
StringLengthAttribute(512)]
|
||||
[DisplayFormat(ConvertEmptyStringToNull = true, NullDisplayText = "[pas d'informations complémentaires]")]
|
||||
public string AdditionalInfo { get; set; }
|
||||
|
||||
public string PaymentId { get; set; }
|
||||
|
||||
[ForeignKey("PaymentId"), Display(Name = "Acquittement de la facture")]
|
||||
public virtual PaypalPayment Regularisation { get; set; }
|
||||
|
||||
public override List<IBillItem> GetBillItems()
|
||||
{
|
||||
string longhairsuffix = " (cheveux longs)";
|
||||
string halflonghairsuffix = " (cheveux mi-longs)";
|
||||
string shorthairsuffix = " (cheveux courts)";
|
||||
|
||||
List<IBillItem> bill = new List<IBillItem>();
|
||||
|
||||
// Le shampoing
|
||||
if (this.Prestation.Shampoo)
|
||||
bill.Add(new CommandLine { Name = "Shampoing", UnitaryCost = SelectedProfile.ShampooPrice });
|
||||
|
||||
// la coupe
|
||||
if (Prestation.Cut)
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = "Coupe",
|
||||
UnitaryCost =
|
||||
Prestation.Gender == HairCutGenders.Women ?
|
||||
Prestation.Length == HairLength.Long ? SelectedProfile.WomenLongCutPrice :
|
||||
Prestation.Length == HairLength.HalfLong ? SelectedProfile.WomenHalfCutPrice :
|
||||
SelectedProfile.WomenShortCutPrice : Prestation.Gender == HairCutGenders.Man ?
|
||||
SelectedProfile.ManCutPrice : SelectedProfile.KidCutPrice
|
||||
});
|
||||
|
||||
// Les techniques
|
||||
switch (Prestation.Tech)
|
||||
{
|
||||
case HairTechnos.Color:
|
||||
{
|
||||
bool multicolor = Prestation.Taints.Count > 1;
|
||||
string name = multicolor ? "Couleur" : "Multi-couleur";
|
||||
switch (Prestation.Length)
|
||||
{
|
||||
case HairLength.Long:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + longhairsuffix,
|
||||
UnitaryCost = multicolor ? SelectedProfile.LongMultiColorPrice :
|
||||
SelectedProfile.LongColorPrice
|
||||
});
|
||||
break;
|
||||
case HairLength.HalfLong:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + halflonghairsuffix,
|
||||
UnitaryCost = multicolor ? SelectedProfile.HalfMultiColorPrice : SelectedProfile.HalfColorPrice
|
||||
});
|
||||
break;
|
||||
default:
|
||||
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + shorthairsuffix,
|
||||
UnitaryCost = multicolor ? SelectedProfile.ShortMultiColorPrice : SelectedProfile.ShortColorPrice
|
||||
});
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HairTechnos.Balayage:
|
||||
{
|
||||
string name = "Balayage";
|
||||
switch (Prestation.Length)
|
||||
{
|
||||
case HairLength.Long:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + longhairsuffix,
|
||||
UnitaryCost = SelectedProfile.LongBalayagePrice
|
||||
});
|
||||
break;
|
||||
case HairLength.HalfLong:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + halflonghairsuffix,
|
||||
UnitaryCost = SelectedProfile.HalfBalayagePrice
|
||||
});
|
||||
break;
|
||||
default:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + shorthairsuffix,
|
||||
UnitaryCost = SelectedProfile.ShortBalayagePrice
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HairTechnos.Defris:
|
||||
{
|
||||
string name = "Defrisage";
|
||||
switch (Prestation.Length)
|
||||
{
|
||||
case HairLength.Long:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + longhairsuffix,
|
||||
UnitaryCost = SelectedProfile.LongDefrisPrice
|
||||
});
|
||||
break;
|
||||
case HairLength.HalfLong:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + halflonghairsuffix,
|
||||
UnitaryCost = SelectedProfile.HalfDefrisPrice
|
||||
});
|
||||
break;
|
||||
default:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + shorthairsuffix,
|
||||
UnitaryCost = SelectedProfile.ShortDefrisPrice
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HairTechnos.Mech:
|
||||
{
|
||||
string name = "Mèches";
|
||||
switch (Prestation.Length)
|
||||
{
|
||||
case HairLength.Long:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + longhairsuffix,
|
||||
UnitaryCost = SelectedProfile.LongMechPrice
|
||||
});
|
||||
break;
|
||||
case HairLength.HalfLong:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + halflonghairsuffix,
|
||||
UnitaryCost = SelectedProfile.HalfMechPrice
|
||||
});
|
||||
break;
|
||||
default:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + shorthairsuffix,
|
||||
UnitaryCost = SelectedProfile.ShortMechPrice
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HairTechnos.Permanent:
|
||||
{
|
||||
string name = "Mèches";
|
||||
switch (Prestation.Length)
|
||||
{
|
||||
case HairLength.Long:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + longhairsuffix,
|
||||
UnitaryCost = SelectedProfile.LongPermanentPrice
|
||||
});
|
||||
break;
|
||||
case HairLength.HalfLong:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + halflonghairsuffix,
|
||||
UnitaryCost = SelectedProfile.HalfPermanentPrice
|
||||
});
|
||||
break;
|
||||
default:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + shorthairsuffix,
|
||||
UnitaryCost = SelectedProfile.ShortPermanentPrice
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Les coiffages
|
||||
switch (Prestation.Dressing)
|
||||
{
|
||||
case HairDressings.Brushing:
|
||||
{
|
||||
string name = "Brushing";
|
||||
|
||||
|
||||
switch (Prestation.Gender)
|
||||
{
|
||||
case HairCutGenders.Women:
|
||||
switch (Prestation.Length)
|
||||
{
|
||||
case HairLength.Long:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + longhairsuffix,
|
||||
UnitaryCost = SelectedProfile.LongBrushingPrice
|
||||
});
|
||||
break;
|
||||
case HairLength.HalfLong:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + halflonghairsuffix,
|
||||
UnitaryCost = SelectedProfile.HalfBrushingPrice
|
||||
});
|
||||
break;
|
||||
default:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + shorthairsuffix,
|
||||
UnitaryCost = SelectedProfile.ShortBrushingPrice
|
||||
});
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case HairCutGenders.Man:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + shorthairsuffix,
|
||||
UnitaryCost = SelectedProfile.ManBrushPrice
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HairDressings.Coiffage:
|
||||
// est offert
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = "Coiffage (offert)",
|
||||
UnitaryCost = 0m
|
||||
});
|
||||
break;
|
||||
case HairDressings.Folding:
|
||||
{
|
||||
string name = "Mise en plis";
|
||||
|
||||
switch (Prestation.Length)
|
||||
{
|
||||
case HairLength.Long:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + longhairsuffix,
|
||||
UnitaryCost = SelectedProfile.LongFoldingPrice
|
||||
});
|
||||
break;
|
||||
case HairLength.HalfLong:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + halflonghairsuffix,
|
||||
UnitaryCost = SelectedProfile.HalfFoldingPrice
|
||||
});
|
||||
break;
|
||||
default:
|
||||
bill.Add(new CommandLine
|
||||
{
|
||||
Name = name + shorthairsuffix,
|
||||
UnitaryCost = SelectedProfile.ShortFoldingPrice
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// les soins
|
||||
if (Prestation.Cares) {
|
||||
bill.Add(new CommandLine { Name = "Soins",
|
||||
UnitaryCost = SelectedProfile.CarePrice });
|
||||
|
||||
}
|
||||
return bill;
|
||||
}
|
||||
|
||||
[ForeignKeyAttribute("PerformerId")]
|
||||
public virtual BrusherProfile SelectedProfile { get; set; }
|
||||
public decimal Addition() => GetBillItems().Aggregate<IBillItem, decimal>(0m, (t, l) => t + l.Count * l.UnitaryCost);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using System.ComponentModel.DataAnnotations;
|
|||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Yavsc.Models.Billing;
|
||||
using Yavsc.Models.Relationship;
|
||||
using YavscLib.Billing;
|
||||
|
||||
namespace Yavsc.Models.Haircut
|
||||
{
|
||||
|
|
@ -44,5 +45,10 @@ namespace Yavsc.Models.Haircut
|
|||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public override List<IBillItem> GetBillItems()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,15 +7,18 @@ namespace Yavsc.Models.Payment {
|
|||
|
||||
public class PaypalPayment : IBaseTrackedEntity
|
||||
{
|
||||
[Required,Key]
|
||||
public string PaypalPaymentId { get; set; }
|
||||
|
||||
[Required]
|
||||
public string ExecutorId { get; set; }
|
||||
public string ExecutorId { get; set; }
|
||||
[ForeignKey("ExecutorId")]
|
||||
public virtual ApplicationUser Executor { get; set; }
|
||||
[Key,Required]
|
||||
string PaypalPayerId { get; set; }
|
||||
|
||||
[Required]
|
||||
string PaypalPaymentId { get; set; }
|
||||
string orderReference { get; set; }
|
||||
public string PaypalPayerId { get; set; }
|
||||
|
||||
public string OrderReference { get; set; }
|
||||
[Display(Name="Date de création")]
|
||||
public DateTime DateCreated
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,8 +4,11 @@ using System.ComponentModel.DataAnnotations.Schema;
|
|||
|
||||
namespace Yavsc.Models.Workflow
|
||||
{
|
||||
using Yavsc.Models.Billing;
|
||||
using Yavsc.Models.Relationship;
|
||||
using System.Collections.Generic;
|
||||
using Yavsc.Models.Billing;
|
||||
using Yavsc.Models.Relationship;
|
||||
using YavscLib.Billing;
|
||||
|
||||
/// <summary>
|
||||
/// Query, for a date, with a given perfomer, at this given place.
|
||||
/// </summary>
|
||||
|
|
@ -57,7 +60,9 @@ namespace Yavsc.Models.Workflow
|
|||
ActivityCode = activityCode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override List<IBillItem> GetBillItems()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue