yavsc/src/Yavsc.Server/Models/Billing/NominativeServiceCommand.cs

107 lines
2.7 KiB
C#
Raw Normal View History

2016-05-17 18:22:18 +02:00
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
2016-06-14 03:37:57 +02:00
namespace Yavsc.Models.Billing
2016-05-17 18:22:18 +02:00
{
2017-02-27 19:28:32 +01:00
using Newtonsoft.Json;
using Workflow;
using Yavsc.Models.Payment;
2017-05-27 16:22:58 +02:00
using Yavsc;
using Yavsc.Billing;
2018-02-25 03:33:54 +01:00
using Yavsc.Abstract.Workflow;
2018-03-26 19:27:29 +02:00
using Yavsc.Services;
2016-05-17 18:22:18 +02:00
2024-02-25 18:05:10 +00:00
public abstract class NominativeServiceCommand : IDecidableQuery, IIdentified<long>
{
2017-05-30 23:42:04 +02:00
public string GetInvoiceId() { return GetType().Name + "/" + Id; }
2017-05-05 23:37:07 +02:00
public abstract long Id { get; set; }
2018-08-01 10:55:52 +02:00
public abstract string Description { get; set; }
2017-05-16 20:58:52 +02:00
[Required()]
public bool Consent { get; set; }
2017-02-13 01:32:03 +01:00
public DateTime DateCreated
{
get; set;
}
public DateTime DateModified
{
get; set;
}
public string UserCreated
{
get; set;
}
public string UserModified
{
get; set;
}
2017-04-08 09:17:15 +02:00
[DisplayAttribute(Name="Status de la requête")]
2017-02-13 01:32:03 +01:00
public QueryStatus Status { get; set; }
2017-02-04 16:33:48 +01:00
[Required]
2016-05-17 18:22:18 +02:00
public string ClientId { get; set; }
/// <summary>
/// The client
/// </summary>
2017-04-08 09:17:15 +02:00
[ForeignKey("ClientId"),Display(Name="Client")]
2016-05-17 18:22:18 +02:00
public ApplicationUser Client { get; set; }
[Required]
public string PerformerId { get; set; }
/// <summary>
/// The performer identifier
/// </summary>
2017-04-08 09:17:15 +02:00
[ForeignKey("PerformerId"),Display(Name="Préstataire")]
2016-05-17 18:22:18 +02:00
public PerformerProfile PerformerProfile { get; set; }
public DateTime? ValidationDate {get; set;}
2017-01-20 14:19:23 +01:00
[Display(Name="Previsional")]
2016-05-17 18:22:18 +02:00
public decimal? Previsional { get; set; }
2016-06-14 03:37:57 +02:00
/// <summary>
/// The bill
/// </summary>
/// <returns></returns>
2016-05-17 18:22:18 +02:00
2017-02-27 19:28:32 +01:00
[Required]
public string ActivityCode { get; set; }
2017-04-08 09:17:15 +02:00
[ForeignKey("ActivityCode"),JsonIgnore,Display(Name="Domaine d'activité")]
2017-02-27 19:28:32 +01:00
public virtual Activity Context  { get; set ; }
2017-05-05 23:37:07 +02:00
2024-02-25 18:05:10 +00:00
public bool Decided { get; set; }
2018-02-25 03:33:54 +01:00
2017-05-12 12:15:57 +02:00
public abstract System.Collections.Generic.List<IBillItem> GetBillItems();
public bool GetIsAcquitted()
{
return Regularisation?.IsOk() ?? false;
}
public string GetFileBaseName(IBillingService billingService)
{
string type = GetType().Name;
string ack = GetIsAcquitted() ? "-ack" : null;
var bcode = billingService.BillingMap[type];
return $"facture-{bcode}-{Id}{ack}";
}
2018-02-25 03:33:54 +01:00
2023-03-26 21:48:25 +01:00
[ForeignKey("Regularisation")]
2025-07-15 15:42:30 +01:00
public string? PaymentId { get; set; }
2023-03-26 21:48:25 +01:00
[Display(Name = "Acquittement de la facture")]
2017-05-24 23:36:49 +02:00
public virtual PayPalPayment Regularisation { get; set; }
2024-02-25 18:05:10 +00:00
public bool Accepted { get; set; }
2017-05-05 23:37:07 +02:00
}
2017-04-08 00:32:23 +02:00
}