示例#1
0
        public RouteListItemWageCalculationDetails GetWageCalculationDetailsForRouteListItem(IRouteListItemWageCalculationSource source)
        {
            RouteListItemWageCalculationDetails addressWageDetails = new RouteListItemWageCalculationDetails()
            {
                RouteListItemWageCalculationName = wageParameterItem.Title,
                WageCalculationEmployeeCategory  = source.EmployeeCategory
            };

            return(addressWageDetails);
        }
        public RouteListItemWageCalculationDetails GetWageCalculationDetailsForRouteListItem(IRouteListItemWageCalculationSource source)
        {
            RouteListItemWageCalculationDetails addressWageDetails = new RouteListItemWageCalculationDetails()
            {
                RouteListItemWageCalculationName = "Способ расчёта ЗП по умолчанию",
                WageCalculationEmployeeCategory  = source.EmployeeCategory
            };

            return(addressWageDetails);
        }
        public RouteListItemWageCalculationDetails GetWageCalculationDetailsForRouteListItem(IRouteListItemWageCalculationSource source)
        {
            RouteListItemWageCalculationDetails addressWageDetails = new RouteListItemWageCalculationDetails()
            {
                RouteListItemWageCalculationName = "Расчёт ЗП для старых МЛ",
                WageCalculationEmployeeCategory  = src.EmployeeCategory
            };

            addressWageDetails.WageCalculationDetailsList.Add(
                new WageCalculationDetailsItem()
            {
                Name  = $"Текущая ЗП за адрес",
                Count = 1,
                Price = source.CurrentWage
            });

            return(addressWageDetails);
        }
        public RouteListItemWageCalculationDetails GetWageCalculationDetailsForRouteListItem(IRouteListItemWageCalculationSource src)
        {
            RouteListItemWageCalculationDetails addressWageDetails = new RouteListItemWageCalculationDetails()
            {
                RouteListItemWageCalculationName = wageParameterItem.Title,
                WageCalculationEmployeeCategory  = src.EmployeeCategory
            };

            switch (wageParameterItem.PercentWageType)
            {
            case PercentWageTypes.RouteList:
                var itemsSum    = src.OrderItemsSource.Sum(i => (i.ActualCount ?? i.InitialCount) * i.Price - i.DiscountMoney);
                var depositsSum = src.OrderDepositItemsSource.Sum(d => (d.ActualCount ?? d.InitialCount) * d.Deposit);
                addressWageDetails.WageCalculationDetailsList.Add(
                    new WageCalculationDetailsItem()
                {
                    Name  = PercentWageTypes.RouteList.GetEnumTitle(),
                    Count = 1,
                    Price = (itemsSum - depositsSum) * wageParameterItem.RouteListPercent / 100
                });
                break;

            case PercentWageTypes.Service:
                var wageForService = src.OrderItemsSource
                                     .Where(i => i.IsMasterNomenclature && i.ActualCount.HasValue)
                                     .Sum(i => i.ActualCount.Value * i.Price * i.PercentForMaster / 100);
                addressWageDetails.WageCalculationDetailsList.Add(
                    new WageCalculationDetailsItem()
                {
                    Name  = PercentWageTypes.Service.GetEnumTitle(),
                    Count = 1,
                    Price = wageForService
                });
                break;
            }

            return(addressWageDetails);
        }
        public RouteListItemWageCalculationDetails GetWageCalculationDetailsForRouteListItem(IRouteListItemWageCalculationSource src)
        {
            var levelRate          = GetCurrentWageDistrictLevelRate(src);
            var addressWageDetails = new RouteListItemWageCalculationDetails
            {
                RouteListItemWageCalculationName = $"{WageParameterItemTypes.RatesLevel.GetEnumTitle()}, {levelRate.WageDistrictLevelRates.Name} №{levelRate.WageDistrictLevelRates.Id}. ",
                WageCalculationEmployeeCategory  = src.EmployeeCategory
            };

            if (!src.IsValidForWageCalculation || !Car.GetCarTypesOfUseForRatesLevelWageCalculation().Contains(src.CarTypeOfUse))
            {
                return(addressWageDetails);
            }

            IList <WageRate> wageRates = GetCurrentWageDistrictLevelRate(src).WageRates;

            if (!src.HasFirstOrderForDeliveryPoint)
            {
                addressWageDetails.WageCalculationDetailsList.Add(
                    new WageCalculationDetailsItem()
                {
                    Name = $"Не первый заказ на точку доставки",
                });
            }
            else
            {
                var rateAddress = wageRates.FirstOrDefault(r =>
                                                           r.WageRateType == (src.IsDriverForeignDistrict ? WageRateTypes.ForeignAddress : WageRateTypes.Address));
                if (rateAddress != null)
                {
                    addressWageDetails.WageCalculationDetailsList.Add(
                        new WageCalculationDetailsItem()
                    {
                        Name  = $"{rateAddress.WageRateType.GetEnumTitle()}",
                        Count = 1,
                        Price = GetRateValue(src, rateAddress)
                    });
                }
            }

            bool addressWithBigOrder = HasBigOrder(src);
            var  rateFullBottle19L   = wageRates
                                       .FirstOrDefault(r => r.WageRateType == (addressWithBigOrder ? WageRateTypes.Bottle19LInBigOrder : WageRateTypes.Bottle19L));
            var priceFullBottle19L = GetRateValue(src, rateFullBottle19L);

            if (priceFullBottle19L * src.FullBottle19LCount > 0)
            {
                addressWageDetails.WageCalculationDetailsList.Add(
                    new WageCalculationDetailsItem()
                {
                    Name  = rateFullBottle19L.WageRateType.GetEnumTitle(),
                    Count = src.FullBottle19LCount,
                    Price = priceFullBottle19L
                });
            }
            else
            {
                if (src.NeedTakeOrDeliverEquipment)
                {
                    addressWageDetails.WageCalculationDetailsList.Add(
                        new WageCalculationDetailsItem()
                    {
                        Name  = WageRateTypes.Equipment.GetEnumTitle(),
                        Count = 1,
                        Price = GetRateValue(src, wageRates.FirstOrDefault(r => r.WageRateType == WageRateTypes.Equipment))
                    });
                }
            }

            addressWageDetails.WageCalculationDetailsList.Add(
                new WageCalculationDetailsItem()
            {
                Name  = addressWithBigOrder ? WageRateTypes.EmptyBottle19LInBigOrder.GetEnumTitle() : WageRateTypes.EmptyBottle19L.GetEnumTitle(),
                Count = src.EmptyBottle19LCount,
                Price = GetRateValue(src,
                                     wageRates
                                     .FirstOrDefault(r => r.WageRateType == (addressWithBigOrder ? WageRateTypes.EmptyBottle19LInBigOrder : WageRateTypes.EmptyBottle19L))
                                     )
            });

            addressWageDetails.WageCalculationDetailsList.Add(
                new WageCalculationDetailsItem()
            {
                Name  = WageRateTypes.PackOfBottles600ml.GetEnumTitle(),
                Count = src.Bottle600mlCount,
                Price = GetRateValue(src, wageRates.FirstOrDefault(r => r.WageRateType == WageRateTypes.PackOfBottles600ml)) / 36
            });

            addressWageDetails.WageCalculationDetailsList.Add(
                new WageCalculationDetailsItem()
            {
                Name  = WageRateTypes.Bottle6L.GetEnumTitle(),
                Count = src.Bottle6LCount,
                Price = GetRateValue(src, wageRates.FirstOrDefault(r => r.WageRateType == WageRateTypes.Bottle6L))
            });

            addressWageDetails.WageCalculationDetailsList.Add(
                new WageCalculationDetailsItem()
            {
                Name  = WageRateTypes.Bottle1500ml.GetEnumTitle(),
                Count = src.Bottle1500mlCount,
                Price = GetRateValue(src, wageRates.FirstOrDefault(r => r.WageRateType == WageRateTypes.Bottle1500ml))
            });

            addressWageDetails.WageCalculationDetailsList.Add(
                new WageCalculationDetailsItem()
            {
                Name  = WageRateTypes.Bottle500ml.GetEnumTitle(),
                Count = src.Bottle500mlCount,
                Price = GetRateValue(src, wageRates.FirstOrDefault(r => r.WageRateType == WageRateTypes.Bottle500ml))
            });

            if (src.IsFastDelivery)
            {
                addressWageDetails.WageCalculationDetailsList.Add(
                    new WageCalculationDetailsItem()
                {
                    Name  = WageRateTypes.FastDelivery.GetEnumTitle(),
                    Count = 1,
                    Price = GetRateValue(src, wageRates.FirstOrDefault(r => r.WageRateType == WageRateTypes.FastDelivery))
                });
            }

            return(addressWageDetails);
        }
示例#6
0
        public RouteListItemWageCalculationDetails GetWageCalculationDetailsForRouteListItem(IRouteListItemWageCalculationSource src)
        {
            RouteListItemWageCalculationDetails addressWageDetails = new RouteListItemWageCalculationDetails()
            {
                RouteListItemWageCalculationName = wageParameterItem.Title,
                WageCalculationEmployeeCategory  = source.EmployeeCategory
            };

            if (!src.IsDelivered)
            {
                addressWageDetails.WageCalculationDetailsList.Add(
                    new WageCalculationDetailsItem()
                {
                    Name = $"Заказ не доставлен",
                });
                return(addressWageDetails);
            }

            if (source.IsTruck)
            {
                addressWageDetails.WageCalculationDetailsList.Add(
                    new WageCalculationDetailsItem()
                {
                    Name = $"ТС является фурой",
                });
                return(addressWageDetails);
            }

            if (!src.HasFirstOrderForDeliveryPoint)
            {
                addressWageDetails.WageCalculationDetailsList.Add(
                    new WageCalculationDetailsItem()
                {
                    Name = $"Не первый заказ на точку доставки",
                });
            }
            else
            {
                var rateAddress = GetActualRate(src.IsDriverForeignDistrict ? WageRateTypes.ForeignAddress : WageRateTypes.Address);
                if (rateAddress != null)
                {
                    addressWageDetails.WageCalculationDetailsList.Add(
                        new WageCalculationDetailsItem()
                    {
                        Name  = $"{rateAddress.WageRateType.GetEnumTitle()}",
                        Count = 1,
                        Price = GetRateValue(src, rateAddress)
                    });
                }
            }

            bool addressWithBigOrder = HasBigOrder(src);
            var  rateFullBottle19L   = GetActualRate(addressWithBigOrder ? WageRateTypes.Bottle19LInBigOrder : WageRateTypes.Bottle19L);
            var  priceFullBottle19L  = GetRateValue(src, rateFullBottle19L);

            if (priceFullBottle19L * src.FullBottle19LCount > 0)
            {
                addressWageDetails.WageCalculationDetailsList.Add(
                    new WageCalculationDetailsItem()
                {
                    Name  = rateFullBottle19L.WageRateType.GetEnumTitle(),
                    Count = src.FullBottle19LCount,
                    Price = priceFullBottle19L
                });
            }
            else
            {
                if (src.NeedTakeOrDeliverEquipment)
                {
                    addressWageDetails.WageCalculationDetailsList.Add(
                        new WageCalculationDetailsItem()
                    {
                        Name  = WageRateTypes.Equipment.GetEnumTitle(),
                        Count = 1,
                        Price = GetRateValue(src, GetActualRate(WageRateTypes.Equipment)
                                             )
                    });
                }
            }

            addressWageDetails.WageCalculationDetailsList.Add(
                new WageCalculationDetailsItem()
            {
                Name  = addressWithBigOrder ? WageRateTypes.EmptyBottle19LInBigOrder.GetEnumTitle() : WageRateTypes.EmptyBottle19L.GetEnumTitle(),
                Count = src.EmptyBottle19LCount,
                Price = GetRateValue(src, GetActualRate(addressWithBigOrder ? WageRateTypes.EmptyBottle19LInBigOrder : WageRateTypes.EmptyBottle19L)
                                     )
            });

            addressWageDetails.WageCalculationDetailsList.Add(
                new WageCalculationDetailsItem()
            {
                Name  = WageRateTypes.PackOfBottles600ml.GetEnumTitle(),
                Count = src.Bottle600mlCount,
                Price = GetRateValue(src, GetActualRate(WageRateTypes.PackOfBottles600ml)) / 36
            });

            addressWageDetails.WageCalculationDetailsList.Add(
                new WageCalculationDetailsItem()
            {
                Name  = WageRateTypes.Bottle6L.GetEnumTitle(),
                Count = src.Bottle6LCount,
                Price = GetRateValue(src, GetActualRate(WageRateTypes.Bottle6L)
                                     )
            });

            return(addressWageDetails);
        }