Exemplo n.º 1
0
 private bool itemIsFiltered(ShortItemEntry item, bool withFirstMatching)
 {
     return((withFirstMatching || (string.IsNullOrEmpty(_filterString) || item.Description.ToLower().Contains(_filterString.ToLower()) || item.commentAs.ToLower().Contains(_filterString.ToLower()))) &&
            (string.IsNullOrEmpty(_selectedBrand) || item.ManufacturerCode == _selectedBrand) &&
            (string.IsNullOrEmpty(_selectedManufacture) ||
             VehicleModels.Any(i => i.ItemNo_ == item.No_ && i.ManufacturerCode == _selectedManufacture)) &&
            (string.IsNullOrEmpty(_selectedModelNo) ||
             VehicleModels.Any(i => i.ItemNo_ == item.No_ && i.ModelNo_ == _selectedModelNo)) &&
            //(string.IsNullOrEmpty(_selectedCabType) ||
            // VehicleModels.Any(i => i.ItemNo_ == item.No_ && i.CabType == _selectedCabType)) &&
            (!_selectedYearFrom.HasValue ||
             VehicleModels.Any(i => i.ItemNo_ == item.No_ && i.ManufacturingStartDate.Year == _selectedYearFrom.Value)) &&
            (string.IsNullOrEmpty(_selectedOeNumber) || (item.OeNumbers != null && item.OeNumbers.Any(i => i.ToUpper() == _selectedOeNumber.ToUpper()))) &&
            (_selectedVehicleGroup == null || (item.VehicleGroups != null && item.VehicleGroups.Any(i => i.ToUpper() == _selectedVehicleGroup.No.ToUpper()))) &&
            (!_selectedYearTo.HasValue ||
             VehicleModels.Any(i => i.ItemNo_ == item.No_ && (i.ManufacturingEndDate.HasValue && i.ManufacturingEndDate.Value.Year == _selectedYearTo.Value))) &&
            //(string.IsNullOrEmpty(_selectedEngline) ||
            // VehicleModels.Any(i => i.ItemNo_ == item.No_ && i.Engine == _selectedEngline)) &&
            (!WithBalance || (WithBalance && item.Quantity > 0)));
 }
Exemplo n.º 2
0
        private ISalesLine CreateSalesLine(ShortItemEntry item, int ind)
        {
            var price = ParentModel.Order.CurrentCustomer == null ? null : DaoController.Current.GetsalesPrice(item.No_, item.BaseUnitOfMeasure, ParentModel.Order.Sell_toCustomerNo, ParentModel.Order.CurrentCustomer.CustomerPriceGroup);

            if (price == null)
            {
                price = item.UnitPrice;
            }
            if (item.OrderType == OrderTypes.CQ)
            {
                price = item.UnitPriceCQ;
            }
            if (ParentModel.Order.OrderBaseType == OrderBaseTypes.Current)
            {
                return(new SalesLine
                {
                    DocumentNo_ = ParentModel.Order.No_,
                    DocumentType = 1,
                    LineNo_ = ind,
                    Type = 2,
                    No_ = item.No_,
                    Description = item.DescriptionForSalesLine,
                    Quantity = item.SelectedQuantity,
                    UnitPrice = price,
                    Sell_toCustomerNo = ParentModel.Order.Sell_toCustomerNo,
                    LocationCode = App.Current.PosSetting.Settings_Location,
                    AmountIncludingVAT =
                        (item.OrderType == OrderTypes.Ok || item.OrderType == OrderTypes.CQ)
                            ? Math.Round(item.SelectedQuantity.Value * price.Value, 2,
                                         MidpointRounding.AwayFromZero)
                            : 0,
                    UnitOfMeasureCode = item.BaseUnitOfMeasure,
                    OrderType = (int)item.OrderType.Value,
                    LineDiscountAmount = 0,
                    LineDiscountPercent = 0,
                    LargeDescription = item.Description
                });
            }
            else
            {
                return(new ReleasedSalesLine
                {
                    DocumentNo_ = ParentModel.Order.No_,
                    DocumentType = 1,
                    LineNo_ = ind,
                    Type = 2,
                    No_ = item.No_,
                    Description = item.DescriptionForSalesLine,
                    Quantity = item.SelectedQuantity,
                    UnitPrice = item.OrderType == OrderTypes.CQ ? item.UnitPriceCQ : price,
                    Sell_toCustomerNo = ParentModel.Order.Sell_toCustomerNo,
                    LocationCode = App.Current.PosSetting.Settings_Location,
                    AmountIncludingVAT =
                        (item.OrderType == OrderTypes.Ok || item.OrderType == OrderTypes.CQ)
                            ? Math.Round(item.SelectedQuantity.Value * price.Value, 2,
                                         MidpointRounding.AwayFromZero)
                            : 0,
                    UnitOfMeasureCode = item.BaseUnitOfMeasure,
                    OrderType = (int)item.OrderType.Value,
                    LineDiscountAmount = 0,
                    LineDiscountPercent = 0,
                    LargeDescription = item.Description
                });
            }
        }