Пример #1
0
        private void hlEdit_Click(object sender, RoutedEventArgs e)
        {
            var hl = sender as Hyperlink;
            _lineItemModal = new POSLineItemModal();
            Guid ParentProductid = Guid.Parse(hl.Tag.ToString());
            var lineItemList = _vm.LineItems.Where(n => n.ProductId == ParentProductid);
            //var lineItem = lineItemList.First(p => p.ProductId == ParentProductid);

            EditPOSSaleLineItem lineItem = hl.DataContext as EditPOSSaleLineItem;

            _lineItemModal.cmbProducts.IsEnabled = false;
            _lineItemModal.cmdAddProduct.Visibility = Visibility.Collapsed;
            _lineItemModal.Closed += new EventHandler(lineItemModal_Closed);

            var vmLineItem = _lineItemModal.DataContext as POSLineItemViewModel;
            if (lineItem.IsReceivedReturnable)
            {
                vmLineItem.ProductTypeToLoad = POSLineItemViewModel.ProducTypeToLoad.Returnables;
                _lineItemModal.lblAvailable.Content = _messageResolver.GetText("sl.pos.addlineitem.modal.pendingQty");/*"Pending Qty";*/
                vmLineItem.ReceiveReturnables = true;
            }
            else
            {
                _lineItemModal.lblAvailable.Content = _messageResolver.GetText("sl.pos.addlineitem.modal.availableInv");//"Available Inventory";
                vmLineItem.ProductTypeToLoad = POSLineItemViewModel.ProducTypeToLoad.AllProducts;
                vmLineItem.ReceiveReturnables = false;
            }
            vmLineItem.Salesman = _vm.SelectedSalesman;
            vmLineItem.SelectedOutletId = _vm.SelectedOutlet.Id;
            vmLineItem.LineItemType = LineItemType.Bulk;
            vmLineItem.ModalCrumbs = _messageResolver.GetText("sl.pos.editlineitem.modal.title")/*"Edit Product of Order"*/+ " " + _vm.OrderId;
            vmLineItem.RunClear();

            if (lineItem.TotalPrice < 0)
                _vm.ReceiveReturnable = true;
            else _vm.ReceiveReturnable = false;

            vmLineItem.LoadForEdit(lineItem.ProductId,
                lineItem.UnitPrice,
                lineItem.LineItemVatValue,
                lineItem.TotalPrice,
                lineItem.VatAmount,
                lineItem.SequenceNo,
                //lineItemList.Min(m => m.Qty)//cn
                lineItem.Qty
                );
            vmLineItem.IsNew = false;
            _lineItemModal.ShowDialog();
        }
Пример #2
0
        private void btnReceiveReturnables_Click(object sender, RoutedEventArgs e)
        {
            if (_vm.IsValid())
            {
                _vm.ReceiveReturnable = true;
                _lineItemModal = new POSLineItemModal();
                POSLineItemViewModel vmItem = _lineItemModal.DataContext as POSLineItemViewModel;
                vmItem.ReturnableIn = _vm.GetReturnableIn();
                if (vmItem.ReturnableIn.Count == 0)
                {
                    MessageBox.Show(
                        /*"There are no returnables to receive either because returnables for all line items have been received or there are no line items with returnables."*/
                        _messageResolver.GetText("sl.pos.receivereturnables.messagebox.noreturnables")
                        , _messageResolver.GetText("sl.pos.messagebox.caption")/*"Distributr: Point of Sale"*/
                        , MessageBoxButton.OK);
                    return;
                }
                _lineItemModal.Closed += new EventHandler(lineItemModal_Closed);
                _lineItemModal.cmdAddProduct.Visibility = Visibility.Visible;
               

                if (vmItem == null) return;
                vmItem.LineItems.Clear();
                vmItem.IsNew = true;
                vmItem.ReceiveReturnables = true;
                _lineItemModal.lblAvailable.Content = _messageResolver.GetText("sl.pos.addlineitem.modal.pendingQty");/*"Pending Qty";*/
                vmItem.Salesman = _vm.SelectedSalesman;
                vmItem.SelectedOutletId = _vm.SelectedOutlet.Id;
                vmItem.ProductTypeToLoad = POSLineItemViewModel.ProducTypeToLoad.Returnables;

                vmItem.ClearAndSetupCommand.Execute(null);
                _lineItemModal.ShowDialog();
            }
        }
Пример #3
0
 private void btnAddLineItem_Click(object sender, RoutedEventArgs e)
 {
     if (!_vm.IsValid())
     {
         return;
     }
     _lineItemModal = new POSLineItemModal();
     _lineItemModal.Closed += new EventHandler(lineItemModal_Closed);
     _lineItemModal.cmbProducts.IsEnabled = true;
     _lineItemModal.rbUnits.IsChecked = true;
     _lineItemModal.cmdAddProduct.Visibility = Visibility.Visible;
     _lineItemModal.lblAvailable.Content = _messageResolver.GetText("sl.pos.addlineitem.modal.availableInv");
         /*"Available Inventory";*/
     var vmItem = _lineItemModal.DataContext as POSLineItemViewModel;
     _vm.CreateNewOrder();
     _vm.ReceiveReturnable = false;
     vmItem.ReceiveReturnables = false;
     vmItem.LineItemType = LineItemType.Unit;
     vmItem.LineItems.Clear();
     vmItem.AddedLineItems = new List<OrderLineItemProductLookupItem>();
     vmItem.ModalCrumbs =
         _messageResolver.GetText("sl.pos.addlineitem.modal.title") /*"Add Product(s) To Order"*/+ " " +
         _vm.OrderId;
     if (_vm.LineItems.Count > 0)
     {
         vmItem.AddedLineItems = _vm.LineItems.Select(n => new OrderLineItemProductLookupItem
                                                               {
                                                                   ProductId = n.ProductId,
                                                                   LineItemQty = n.Qty
                                                               }).ToList();
     }
     vmItem.ProductTypeToLoad = POSLineItemViewModel.ProducTypeToLoad.NonReturnables;
     vmItem.IsNew = true;
     vmItem.IsAdd = true;
     vmItem.Salesman = _vm.SelectedSalesman;
     vmItem.SelectedOutletId = _vm.SelectedOutlet.Id;
     vmItem.ClearAndSetupCommand.Execute(null);
     _lineItemModal.ShowDialog();
 }