Exemplo n.º 1
0
        public IStockItem SetValuesToStockItem(string code, string name, decimal quantity, string unitOfMeasurements, decimal netPrice, int vatTaxValue, decimal grossPrice) // grossPrice autoObliczany
        {
            stockItem = container.Resolve <IStockItem>();

            stockItem.Code               = code;
            stockItem.Name               = name;
            stockItem.StockQuantity      = quantity;
            stockItem.UnitOfMeasurements = unitOfMeasurements;
            stockItem.Net_Price          = netPrice;
            stockItem.VatValue           = vatTaxValue;
            //brutto autoobliczane
            stockItem.Gross_Price      = stockItem.Gross_Price = GrossPriceProcessor.GrossPriceCalculate(stockItem.Net_Price, stockItem.VatValue);
            stockItem.TotalGross_Price = TotalPriceValueProcessor.CalculateTotalPriceValue(stockItem.StockQuantity, stockItem.Gross_Price);

            return(stockItem);
        }
        public ISaleItem SetValuesToSaleItem(string code, string name, decimal quantity, string unitOfMeasure, decimal netPrice, int vatTaxValue, decimal grossPrice) // dane z bazy i ui
        {
            if (!string.IsNullOrWhiteSpace(code) && !string.IsNullOrWhiteSpace(name) && quantity > 0)
            {
                saleItem = container.Resolve <ISaleItem>();

                saleItem.Code               = code;
                saleItem.Name               = name;
                saleItem.SaleQuantity       = quantity;
                saleItem.VatValue           = vatTaxValue;
                saleItem.UnitOfMeasurements = unitOfMeasure;
                saleItem.Net_Price          = netPrice;
                saleItem.Gross_Price        = grossPrice;

                saleItem.TotalGross_Price = TotalPriceValueProcessor.CalculateTotalPriceValue(saleItem.SaleQuantity, saleItem.Gross_Price);

                return(saleItem);
            }
            else
            {
                return(null);
            }
        }