Re-fabrication

This commit is contained in:
Paul Schneider 2018-03-26 19:27:29 +02:00
commit cb6309abdb
499 changed files with 7574 additions and 12530 deletions

View file

@ -0,0 +1,48 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
namespace Yavsc.Models.Billing
{
using Yavsc.Billing;
public class CommandLine : ICommandLine {
[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; }
[Display(Name="Nombre")]
public int Count { get; set; } = 1;
[DisplayFormat(DataFormatString="{0:C}")]
public decimal UnitaryCost { get; set; }
public long EstimateId { get; set; }
[JsonIgnore,NotMapped,ForeignKey("EstimateId")]
virtual public Estimate Estimate { get; set; }
public string Currency
{
get;
set;
} = "EUR";
[NotMapped]
public string Reference {
get {
return "CL/"+this.Id;
}
}
}
}

View file

@ -0,0 +1,10 @@
using Yavsc.Models.Market;
namespace Yavsc.Models.Billing
{
public class ServiceContract<P> where P : Service
{
}
}

View file

@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
namespace Yavsc.Models.Billing
{
using Models.Workflow;
using Newtonsoft.Json;
public partial class Estimate : IEstimate
{
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; }
public long? CommandId { get; set; }
/// <summary>
/// A command is not required to create
/// an estimate,
/// it will result in a new estimate template
/// </summary>
/// <returns></returns>
[ForeignKey("CommandId"),JsonIgnore]
public RdvQuery Query { get; set; }
public string Description { get; set; }
public string Title { get; set; }
[InverseProperty("Estimate")]
public virtual List<CommandLine> Bill { get; set; }
/// <summary>
/// List of attached graphic files
/// to this estimate, as relative pathes to
/// the command performer's root path.
/// In db, they are separated by <c>:</c>
/// </summary>
/// <returns></returns>
[NotMapped]
public List<string> AttachedGraphics { get; set; }
public string AttachedGraphicsString
{
get { return string.Join(":", AttachedGraphics); }
set { AttachedGraphics = value.Split(':').ToList(); }
}
/// <summary>
/// List of attached files
/// to this estimate, as relative pathes to
/// the command performer's root path.
/// In db, they are separated by <c>:</c>
/// </summary>
/// <returns></returns>
[NotMapped]
public List<string> AttachedFiles { get; set; }
public string AttachedFilesString
{
get { return string.Join(":", AttachedFiles); }
set { AttachedFiles = value.Split(':').ToList(); }
}
public string OwnerId { get; set; }
[ForeignKey("OwnerId"),JsonIgnore]
public virtual PerformerProfile Owner { get; set; }
[Required]
public string ClientId { get; set; }
[ForeignKey("ClientId"),JsonIgnore]
public virtual ApplicationUser Client { get; set; }
[Required]
public string CommandType
{
get; set;
}
public DateTime ProviderValidationDate { get; set; }
public DateTime ClientValidationDate { get; set; }
}
}

View file

@ -0,0 +1,20 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Yavsc.Models.Billing
{
public partial class EstimateTemplate
{
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; }
public string Description { get; set; }
public string Title { get; set; }
public List<CommandLine> Bill { get; set; }
[Required]
public string OwnerId { get; set; }
}
}

View file

@ -0,0 +1,10 @@
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Models.Billing
{
public class ExceptionSIREN {
[Key,MinLength(9)]
public string SIREN { get; set; }
}
}

View file

@ -0,0 +1,16 @@
using Yavsc.Billing;
namespace Yavsc.Models.Billing   {
public class FixedImpacter : IBillingImpacter
{
public decimal ImpactedValue { get; set; }
public FixedImpacter (decimal impact)
{
ImpactedValue = impact;
}
public decimal Impact(decimal orgValue)
{
return orgValue + ImpactedValue;
}
}
}

View file

@ -0,0 +1,107 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Yavsc.Models.Billing
{
using Newtonsoft.Json;
using Workflow;
using Yavsc.Models.Payment;
using Yavsc;
using Yavsc.Billing;
using Yavsc.Abstract.Workflow;
using Yavsc.Services;
public abstract class NominativeServiceCommand : IBaseTrackedEntity, INominativeQuery, IIdentified<long>
{
public string GetInvoiceId() { return GetType().Name + "/" + Id; }
public abstract long Id { get; set; }
public abstract string GetDescription ();
[Required()]
public bool Consent { get; set; }
public DateTime DateCreated
{
get; set;
}
public DateTime DateModified
{
get; set;
}
public string UserCreated
{
get; set;
}
public string UserModified
{
get; set;
}
[DisplayAttribute(Name="Status de la requête")]
public QueryStatus Status { get; set; }
[Required]
public string ClientId { get; set; }
/// <summary>
/// The client
/// </summary>
[ForeignKey("ClientId"),Display(Name="Client")]
public ApplicationUser Client { get; set; }
[Required]
public string PerformerId { get; set; }
/// <summary>
/// The performer identifier
/// </summary>
[ForeignKey("PerformerId"),Display(Name="Préstataire")]
public PerformerProfile PerformerProfile { get; set; }
public DateTime? ValidationDate {get; set;}
[Display(Name="Montant prévisionel de la préstation")]
public decimal? Previsional { get; set; }
/// <summary>
/// The bill
/// </summary>
/// <returns></returns>
[Required]
public string ActivityCode { get; set; }
[ForeignKey("ActivityCode"),JsonIgnore,Display(Name="Domaine d'activité")]
public virtual Activity Context  { get; set ; }
public bool Rejected { get; set; }
public DateTime RejectedAt { get; set; }
public abstract System.Collections.Generic.List<IBillItem> GetBillItems();
public bool GetIsAcquitted()
{
return Regularisation?.IsOk() ?? false;
}
public string GetFileBaseName()
{
string type = GetType().Name;
string ack = GetIsAcquitted() ? "-ack" : null;
var bcode = BillingService.BillingMap[type];
return $"facture-{bcode}-{Id}{ack}";
}
[Display(Name = "PaymentId")]
public string PaymentId { get; set; }
[ForeignKey("PaymentId"), Display(Name = "Acquittement de la facture")]
public virtual PayPalPayment Regularisation { get; set; }
}
}

View file

@ -0,0 +1,13 @@
using Yavsc.Billing;
namespace Yavsc.Models.Billing   {
public class ProportionalImpacter : IBillingImpacter
{
public decimal K { get; set; }
public decimal Impact(decimal orgValue)
{
return orgValue * K;
}
}
}

View file

@ -0,0 +1,33 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Yavsc.Billing;
namespace Yavsc.Models.Billing {
public class ReductionCode : IBillingClause
{
[Key,DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; }
public ReductionCode(string descr, decimal impact) {
Description = descr;
impacter = new FixedImpacter(impact);
}
public string Description
{
get;
set;
}
IBillingImpacter impacter;
public IBillingImpacter Impacter
{
get
{
return impacter ;
}
private set {
impacter = value;
}
}
}
}

View file

@ -0,0 +1,5 @@
class ChatBilling { 
}

View file

@ -0,0 +1,14 @@
using System;
namespace Yavsc.Models.Billing
{
public partial class histoestim
{
public long _id { get; set; }
public string applicationname { get; set; }
public DateTime datechange { get; set; }
public long estid { get; set; }
public int? status { get; set; }
public string username { get; set; }
}
}