コード例 #1
0
        public ItemPriceCalculationViewModel()
        {
            var costsPerYear = BookingCostCenterMappings.GetAllByYear(DateTime.Now.Year);

            MaterialOverHeadCostsCostCenters   = new ItemPriceCalculationItemHelper(costsPerYear);
            ProductOverheadsCostCenters        = new ItemPriceCalculationItemHelper(costsPerYear);
            AdministrativeOverheadsCostCenters = new ItemPriceCalculationItemHelper(costsPerYear);
            SalesOverHeadsCostCenters          = new ItemPriceCalculationItemHelper(costsPerYear);
            SetCommands();
            SubscribeEvents();
            StandardItemPriceCalculation = new StandardItemPriceCalculation();
            StandardItemPriceCalculation.ValueChanged += ItemPriceCalculationInputItem_ValueChanged;
        }
コード例 #2
0
        private void LoadData()
        {
            var itemPriceCalculationItem = ItemPriceCalculationItems.GetByRefProductId(Product.ProductId);

            if (itemPriceCalculationItem == null)
            {
                StandardItemPriceCalculation = new StandardItemPriceCalculation();
                return;
            }

            StandardItemPriceCalculation.AgentCommission  = itemPriceCalculationItem.AgentCommission;
            StandardItemPriceCalculation.CustomerCashback = itemPriceCalculationItem.CustomerCashback;
            StandardItemPriceCalculation.CustomerDiscount = itemPriceCalculationItem.CustomerDiscount;
            StandardItemPriceCalculation.ProfitSurcharge  = itemPriceCalculationItem.ProfitSurcharge;
            StandardItemPriceCalculation.Tax               = itemPriceCalculationItem.Tax;
            StandardItemPriceCalculation.HourlyWage        = itemPriceCalculationItem.HourlyWage;
            StandardItemPriceCalculation.ProductionTime    = itemPriceCalculationItem.ProductionTime;
            StandardItemPriceCalculation.ItemAmountPerAnno = itemPriceCalculationItem.ItemAmountPerAnno;

            foreach (var item in itemPriceCalculationItem.ItemPriceCalculationItemCostCenters)
            {
                switch (item.ItemPriceCalculationItemCostCenterType)
                {
                case ItemPriceCalculationItemCostCenterType.MaterialOverheadCosts:
                    MaterialOverHeadCostsCostCenters.CostCenterFlatStructures.SingleOrDefault(x => x.CostCenter?.CostCenterId == item.RefCostCenterId).IsActive = true;
                    break;

                case ItemPriceCalculationItemCostCenterType.ProductOverheadCosts:
                    ProductOverheadsCostCenters.CostCenterFlatStructures.SingleOrDefault(x => x.CostCenter?.CostCenterId == item.RefCostCenterId).IsActive = true;
                    break;

                case ItemPriceCalculationItemCostCenterType.AdministrativeOverheadCosts:
                    AdministrativeOverheadsCostCenters.CostCenterFlatStructures.SingleOrDefault(x => x.CostCenter?.CostCenterId == item.RefCostCenterId).IsActive = true;
                    break;

                case ItemPriceCalculationItemCostCenterType.SalesOverheadCosts:
                    SalesOverHeadsCostCenters.CostCenterFlatStructures.SingleOrDefault(x => x.CostCenter?.CostCenterId == item.RefCostCenterId).IsActive = true;
                    break;

                default:
                    break;
                }
            }
        }