| | | 1 | | using System; |
| | | 2 | | using System.ComponentModel.DataAnnotations; |
| | | 3 | | using System.ComponentModel.DataAnnotations.Schema; |
| | | 4 | | using System.Linq; |
| | | 5 | | using WinSolutions.Sveta.Server.Data.DataModel.Extensions; |
| | | 6 | | |
| | | 7 | | namespace WinSolutions.Sveta.Server.Data.DataModel.Entities |
| | | 8 | | { |
| | | 9 | | public class MovementItem : ExternalRecord, ITrackableRecord |
| | | 10 | | { |
| | 0 | 11 | | public long? MovementId { get; set; } |
| | | 12 | | |
| | 0 | 13 | | public Movement Movement { get; set; } |
| | | 14 | | |
| | | 15 | | /// <summary> |
| | | 16 | | /// Ключ товара |
| | | 17 | | /// </summary> |
| | 0 | 18 | | public long GoodId { get; set; } |
| | | 19 | | /// <summary> |
| | | 20 | | /// Товар |
| | | 21 | | /// </summary> |
| | | 22 | | [Required] |
| | 2126 | 23 | | public Good Good { get; set; } |
| | | 24 | | |
| | | 25 | | |
| | | 26 | | /// <summary> |
| | | 27 | | /// Цена |
| | | 28 | | /// </summary> |
| | | 29 | | [Required] |
| | | 30 | | [Column(TypeName = "decimal(18,2)")] |
| | 814 | 31 | | public decimal Price { get; set; } |
| | | 32 | | |
| | | 33 | | |
| | | 34 | | /// <summary> |
| | | 35 | | /// Количество |
| | | 36 | | /// </summary> |
| | | 37 | | [Required] |
| | | 38 | | [Column(TypeName = "decimal(18,2)")] |
| | 889 | 39 | | public decimal Quantity { get; set; } |
| | | 40 | | |
| | | 41 | | /// <summary> |
| | | 42 | | /// Комментарий к позиции в документе |
| | | 43 | | /// </summary> |
| | 20 | 44 | | public string Comment { get; set; } |
| | | 45 | | |
| | | 46 | | public decimal GetRatioForCalculation(long senderId) => |
| | 0 | 47 | | this.Good.Category.DepartmentCategoryRatios.ActualRatioForCalculations(senderId); |
| | | 48 | | |
| | | 49 | | /// <summary> |
| | | 50 | | /// Расчитывает стоимость позиции |
| | | 51 | | /// </summary> |
| | | 52 | | /// <param name="contractRatio">Кооэффициент контракта для расчетов</param> |
| | | 53 | | /// <param name="clusterRatio">Кооэффициент кластера для расчетов</param> |
| | | 54 | | /// <param name="senderId">Идентификатор отправителя</param> |
| | | 55 | | public void CalculatePrice(Cluster cluster, decimal contractRatio) |
| | 145 | 56 | | { |
| | 145 | 57 | | Price = Good.CurrentPrice(cluster, contractRatio); |
| | 145 | 58 | | } |
| | | 59 | | } |
| | | 60 | | } |