| | | 1 | | namespace WinSolutions.Sveta.Server.Data.DataModel.Extensions |
| | | 2 | | { |
| | | 3 | | using Clave.Expressionify; |
| | | 4 | | using System; |
| | | 5 | | using System.Collections.Generic; |
| | | 6 | | using System.Linq; |
| | | 7 | | using System.Text; |
| | | 8 | | using WinSolutions.Sveta.Server.Data.DataModel.Entities; |
| | | 9 | | |
| | | 10 | | public static class GoodExtensions_Expressionify |
| | | 11 | | { |
| | | 12 | | public static System.Linq.Expressions.Expression<System.Func<Good, Cluster, decimal, decimal>> CurrentPrice |
| | | 13 | | { |
| | 0 | 14 | | get; |
| | | 15 | | } |
| | | 16 | | |
| | 0 | 17 | | = (Good good, Cluster cluster, decimal contractRatio) => Math.Ceiling(// текущую цену товара |
| | 0 | 18 | | (good.Prices.Actual(cluster.WarehouseId).PriceNew > 0 ? good.Prices.Actual(cluster.WarehouseId).PriceNew : good. |
| | 0 | 19 | | * contractRatio // умножаем на коэффициент склада для категории |
| | 0 | 20 | | * (good.Category.DepartmentCategoryRatios.ActualRatioForCalculations(cluster.WarehouseId)) // умножаем на коэффи |
| | 0 | 21 | | * cluster.TradeRatio / 100); |
| | | 22 | | public static System.Linq.Expressions.Expression<System.Func<Good, Cluster, decimal, decimal>> OldPrice |
| | | 23 | | { |
| | 0 | 24 | | get; |
| | | 25 | | } |
| | | 26 | | |
| | 0 | 27 | | = (Good good, Cluster cluster, decimal contractRatio) => Math.Ceiling(// текущую цену товара |
| | 0 | 28 | | good.Prices.Actual(cluster.WarehouseId).PriceOld.GetValueOrDefault(0) // умножаем на коэффициент контракта |
| | 0 | 29 | | * contractRatio // умножаем на коэффициент склада для категории |
| | 0 | 30 | | * (good.Category.DepartmentCategoryRatios.ActualRatioForCalculations(cluster.WarehouseId)) // умножаем на коэффи |
| | 0 | 31 | | * cluster.TradeRatio / 100); |
| | | 32 | | public static System.Linq.Expressions.Expression<System.Func<Good, long, string>> GetActualVendorCode |
| | | 33 | | { |
| | 0 | 34 | | get; |
| | | 35 | | } |
| | | 36 | | |
| | 0 | 37 | | = (Good good, long departmentId) => good.DepartmentGoodSettings.GetActualVendorCodeByDep(departmentId) ?? good.U |
| | | 38 | | public static System.Linq.Expressions.Expression<System.Func<Good, string>> GetActualBarCode |
| | | 39 | | { |
| | 0 | 40 | | get; |
| | | 41 | | } |
| | | 42 | | |
| | 0 | 43 | | = (Good good) => good.GoodBarcodes.FirstOrDefault(g => g.IsPrimary) != null ? good.GoodBarcodes.FirstOrDefault(s |
| | | 44 | | } |
| | | 45 | | } |