void ConfigureDlg()
        {
            TabName = "Приходный кассовый ордер самовывоза";

            Entity.TypeDocument = IncomeInvoiceDocumentType.IncomeInvoiceSelfDelivery;

            permissioncommentview.UoW             = UoW;
            permissioncommentview.Title           = "Комментарий по проверке закрытия МЛ: ";
            permissioncommentview.Comment         = Entity.CashierReviewComment;
            permissioncommentview.PermissionName  = "can_edit_cashier_review_comment";
            permissioncommentview.Comment         = Entity.CashierReviewComment;
            permissioncommentview.CommentChanged += (comment) => Entity.CashierReviewComment = comment;

            enumcomboOperation.ItemsEnum = typeof(IncomeType);
            enumcomboOperation.Binding.AddBinding(Entity, s => s.TypeOperation, w => w.SelectedItem).InitializeFromSource();
            enumcomboOperation.Sensitive = false;
            Entity.TypeOperation         = IncomeType.Payment;

            var filterCasher = new EmployeeFilterViewModel();

            filterCasher.Status = Domain.Employees.EmployeeStatus.IsWorking;
            yentryCasher.RepresentationModel = new EmployeesVM(filterCasher);
            yentryCasher.Binding.AddBinding(Entity, s => s.Casher, w => w.Subject).InitializeFromSource();
            yentryCasher.Sensitive = false;

            var filterOrders = new OrdersFilter(UoW);

            filterOrders.SetAndRefilterAtOnce(
                x => x.RestrictStatus              = OrderStatus.WaitForPayment,
                x => x.AllowPaymentTypes           = new PaymentType[] { PaymentType.cash, PaymentType.BeveragesWorld },
                x => x.RestrictSelfDelivery        = true,
                x => x.RestrictWithoutSelfDelivery = false,
                x => x.RestrictHideService         = true,
                x => x.RestrictOnlyService         = false
                );
            yentryOrder.RepresentationModel = new OrdersVM(filterOrders);
            yentryOrder.Binding.AddBinding(Entity, x => x.Order, x => x.Subject).InitializeFromSource();

            ydateDocument.Binding.AddBinding(Entity, s => s.Date, w => w.Date).InitializeFromSource();

            NotifyConfiguration.Instance.BatchSubscribeOnEntity <IncomeCategory>(
                s => comboCategory.ItemsList = CategoryRepository.SelfDeliveryIncomeCategories(UoW)
                );
            comboCategory.ItemsList = CategoryRepository.SelfDeliveryIncomeCategories(UoW);
            comboCategory.Binding.AddBinding(Entity, s => s.IncomeCategory, w => w.SelectedItem).InitializeFromSource();

            yspinMoney.Binding.AddBinding(Entity, s => s.Money, w => w.ValueAsDecimal).InitializeFromSource();

            ytextviewDescription.Binding.AddBinding(Entity, s => s.Description, w => w.Buffer.Text).InitializeFromSource();

            if (!CanEdit)
            {
                table1.Sensitive = false;
                ytextviewDescription.Editable = false;
                buttonSave.Sensitive          = false;
                accessfilteredsubdivisionselectorwidget.Sensitive = false;
            }

            UpdateSubdivision();
        }
Beispiel #2
0
        void ConfigureDlg()
        {
            if (Entity.EmployeeDocument == null && Entity.Employee != null)
            {
                GetDocument();
            }

            ylabelNumber.Binding.AddBinding(Entity, x => x.Title, x => x.LabelProp).InitializeFromSource();
            var filterOrders = new OrdersFilter(UoW);

            yEForOrder.RepresentationModel = new OrdersVM(filterOrders);
            yEForOrder.Binding.AddBinding(Entity, x => x.Order, x => x.Subject).InitializeFromSource();
            yEForOrder.Changed += (sender, e) => {
                FillForOrder();
            };
            yEForOrder.CanEditReference = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_delete");

            yentryOrganization.SubjectType = typeof(Organization);
            yentryOrganization.Binding.AddBinding(Entity, x => x.Organization, x => x.Subject).InitializeFromSource();
            yentryOrganization.Changed += (sender, e) => {
                UpdateStates();
            };

            FillForOrder();

            yDPDatesRange.Binding.AddBinding(Entity, x => x.Date, x => x.StartDate).InitializeFromSource();
            yDPDatesRange.Binding.AddBinding(Entity, x => x.ExpirationDate, x => x.EndDate).InitializeFromSource();

            yEEmployee.RepresentationModel = new EmployeesVM();
            yEEmployee.Binding.AddBinding(Entity, x => x.Employee, x => x.Subject).InitializeFromSource();

            var filterSupplier = new CounterpartyFilter(UoW);

            yESupplier.RepresentationModel = new CounterpartyVM(filterSupplier);
            yESupplier.Binding.AddBinding(Entity, x => x.Supplier, x => x.Subject).InitializeFromSource();

            yETicketNr.Binding.AddBinding(Entity, x => x.TicketNumber, w => w.Text).InitializeFromSource();

            yDTicketDate.Binding.AddBinding(Entity, x => x.TicketDate, x => x.DateOrNull).InitializeFromSource();

            RefreshParserRootObject();

            templatewidget.CanRevertCommon = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_set_common_additionalagreement");
            templatewidget.Binding.AddBinding(Entity, e => e.DocumentTemplate, w => w.Template).InitializeFromSource();
            templatewidget.Binding.AddBinding(Entity, e => e.ChangedTemplateFile, w => w.ChangedDoc).InitializeFromSource();

            templatewidget.BeforeOpen += Templatewidget_BeforeOpen;

            yTWEquipment.ColumnsConfig = ColumnsConfigFactory.Create <OrderEquipment>()
                                         .AddColumn("Наименование").SetDataProperty(node => node.FullNameString)
                                         .AddColumn("Направление").SetDataProperty(node => node.DirectionString)
                                         .AddColumn("Кол-во").AddNumericRenderer(node => node.Count).WidthChars(10)
                                         .Adjustment(new Adjustment(0, 0, 1000000, 1, 100, 0))
                                         .AddColumn("")
                                         .Finish();

            UpdateStates();
        }
        public IActionResult Index(OrdersFilter OrdersFilter)
        {
            var viewModel = new OrdersViewModel
            {
                Orders       = context.Appointments.Include(x => x.Payments).Where(x => x.OrderPlaced != null && !x.IsDeleted).OrderByDescending(x => x.FinalisedDate).ToList(),
                OrdersFilter = OrdersFilter
            };

            return(View(viewModel));
        }
Beispiel #4
0
 public OrdersWindow(ConnectionSettings connectionSettings, bool fromOtherView = false)
 {
     _connectionSettings = Guard.GetNotNull(connectionSettings, "connectionSettings");
     InitializeComponent();
     Filter      = new OrdersFilter(connectionSettings);
     DataContext = Filter;
     CountPages();
     InitTable();
     SetFiltersToNull();
     this.fromOtherView = fromOtherView;
 }
        void ConfigureDlg()
        {
            TabName = "Расходный кассовый ордер самовывоза";

            Entity.TypeDocument = ExpenseInvoiceDocumentType.ExpenseInvoiceSelfDelivery;

            enumcomboOperation.ItemsEnum = typeof(ExpenseType);
            enumcomboOperation.Binding.AddBinding(Entity, s => s.TypeOperation, w => w.SelectedItem).InitializeFromSource();
            enumcomboOperation.Sensitive = false;
            Entity.TypeOperation         = ExpenseType.ExpenseSelfDelivery;

            var filterOrders = new OrdersFilter(UoW);

            filterOrders.SetAndRefilterAtOnce(
                x => x.RestrictStatus              = OrderStatus.WaitForPayment,
                x => x.AllowPaymentTypes           = new PaymentType[] { PaymentType.cash, PaymentType.BeveragesWorld },
                x => x.RestrictSelfDelivery        = true,
                x => x.RestrictWithoutSelfDelivery = false,
                x => x.RestrictHideService         = true,
                x => x.RestrictOnlyService         = false
                );
            yentryOrder.RepresentationModel = new OrdersVM(filterOrders);
            yentryOrder.Binding.AddBinding(Entity, x => x.Order, x => x.Subject).InitializeFromSource();

            var filterCasher = new EmployeeFilterViewModel();

            filterCasher.Status = Domain.Employees.EmployeeStatus.IsWorking;
            yentryCasher.RepresentationModel = new EmployeesVM(filterCasher);
            yentryCasher.Binding.AddBinding(Entity, s => s.Casher, w => w.Subject).InitializeFromSource();
            yentryCasher.Sensitive = false;

            ydateDocument.Binding.AddBinding(Entity, s => s.Date, w => w.Date).InitializeFromSource();

            NotifyConfiguration.Instance.BatchSubscribeOnEntity <ExpenseCategory>(
                s => comboExpense.ItemsList = CategoryRepository.ExpenseSelfDeliveryCategories(UoW)
                );
            comboExpense.ItemsList = CategoryRepository.ExpenseSelfDeliveryCategories(UoW);
            comboExpense.Binding.AddBinding(Entity, s => s.ExpenseCategory, w => w.SelectedItem).InitializeFromSource();

            yspinMoney.Binding.AddBinding(Entity, s => s.Money, w => w.ValueAsDecimal).InitializeFromSource();

            ytextviewDescription.Binding.AddBinding(Entity, s => s.Description, w => w.Buffer.Text).InitializeFromSource();

            UpdateSubdivision();

            if (!CanEdit)
            {
                table1.Sensitive = false;
                accessfilteredsubdivisionselectorwidget.Sensitive = false;
                buttonSave.Sensitive          = false;
                ytextviewDescription.Editable = false;
            }
        }
Beispiel #6
0
        public List <OrderModel> SearchOrderModels(OrdersFilter ordersFilter, User user)
        {
            using (UnitOfWork unitOfWork = _unitOfWorkFactory.Create())
            {
                IEnumerable <Order> orders = unitOfWork.Orders.GetAllWithProducts()
                                             .ByPriceFrom(ordersFilter.PriceFrom)
                                             .ByPriceTo(ordersFilter.PriceTo)
                                             .Where(u => u.UserId == user.Id);

                return(Mapper.Map <List <OrderModel> >(orders));
            }
        }
        public List <ProductOrderModel> SearchProductOrderModels(OrdersFilter ordersFilter)
        {
            using (UnitOfWork unitOfWork = _unitOfWorkFactory.Create())
            {
                IEnumerable <Order> orders = unitOfWork.Orders.GetAllWithProducts()
                                             .ByClientName(ordersFilter.ClientName)
                                             .ByPriceFrom(ordersFilter.PriceFrom)
                                             .ByPriceTo(ordersFilter.PriceTo);

                return(Mapper.Map <List <ProductOrderModel> >(orders));
            }
        }
        public IActionResult Index(OrdersFilter ordersFilter)
        {
            try
            {
                List <ProductOrderModel> orders = _orderService
                                                  .SearchProductOrderModels(ordersFilter);
                ordersFilter.Orders = orders;

                return(View(ordersFilter));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }
        public async Task <IActionResult> Index(OrdersFilter ordersFilter)
        {
            try
            {
                User user = await _userManager.GetUserAsync(User);

                List <OrderModel> orders = _orderService
                                           .SearchOrderModels(ordersFilter, user);
                ordersFilter.Orders = orders;

                return(View(ordersFilter));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }
        protected void OnBtnChooseOrderClicked(object sender, EventArgs e)
        {
            var filter = new OrdersFilter(UnitOfWorkFactory.CreateWithoutRoot());

            filter.SetAndRefilterAtOnce(
                x => x.RestrictCounterparty = oldOrder.Client,
                x => x.HideStatuses         = new Enum[] { OrderStatus.WaitForPayment }
                );
            Buttons buttons = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_delete") ? Buttons.All : (Buttons.Add | Buttons.Edit);
            PermissionControlledRepresentationJournal dlg = new PermissionControlledRepresentationJournal(new OrdersVM(filter), buttons)
            {
                Mode = JournalSelectMode.Single
            };

            MyTab.TabParent.AddTab(dlg, MyTab, false);

            dlg.ObjectSelected += (s, ea) => {
                var selectedId = ea.GetSelectedIds().FirstOrDefault();
                if (selectedId == 0)
                {
                    return;
                }
                if (oldOrder.Id == selectedId)
                {
                    MessageDialogHelper.RunErrorDialog("Перенесённый заказ не может совпадать с недовезённым!");
                    OnBtnChooseOrderClicked(sender, ea);
                    return;
                }
                newOrder        = undelivery.NewOrder = UoW.GetById <Order>(selectedId);
                newOrder.Author = this.oldOrder.Author;
                SetLabelsAcordingToNewOrder();
                undelivery.NewDeliverySchedule = newOrder.DeliverySchedule;
                if ((oldOrder.PaymentType == Domain.Client.PaymentType.ByCard) &&
                    (oldOrder.OrderTotalSum == newOrder.OrderTotalSum) &&
                    MessageDialogHelper.RunQuestionDialog("Перенести на выбранный заказ Оплату по Карте?"))
                {
                    newOrder.PaymentType       = oldOrder.PaymentType;
                    newOrder.OnlineOrder       = oldOrder.OnlineOrder;
                    newOrder.PaymentByCardFrom = oldOrder.PaymentByCardFrom;
                }
            };
        }
Beispiel #11
0
        public ActionResult OrdersTable()
        {
            SelectList clients = new SelectList(ctx.Clients.ToList(), "Id", "Name");

            this.ViewBag.Clients = clients;
            if (filter == null || filter.useClient == false)
            {
                filter           = new OrdersFilter();
                filter.client    = 1;
                filter.useClient = false;
                ViewBag.filter   = filter;
                return(View(ctx.Orders.ToList()));
            }
            else
            {
                ViewBag.filter = filter;
                List <Orders> list = (from q in ctx.Orders where q.Id_client == filter.client select q).ToList();
                return(View(list));
            }
        }
Beispiel #12
0
 public ActionResult Filter(OrdersFilter model)
 {
     filter.client    = model.client;
     filter.useClient = model.useClient;
     return(RedirectToAction("OrdersTable"));
 }
        public void ConfigureDlg(IUnitOfWork uow, UndeliveredOrder undelivery)
        {
            this.Sensitive = false;
            yEForUndeliveredOrder.Changed += OnUndeliveredOrderChanged;

            CanChangeProblemSource = commonServices.PermissionService.ValidateUserPresetPermission("can_change_undelivery_problem_source", commonServices.UserService.CurrentUserId);
            this.undelivery        = undelivery;
            UoW      = uow;
            oldOrder = undelivery.OldOrder;
            newOrder = undelivery.NewOrder;
            if (undelivery.Id > 0 && undelivery.InProcessAtDepartment != null)
            {
                InitialProcDepartmentName = undelivery.InProcessAtDepartment.Name;
            }
            if (undelivery.Id > 0)
            {
                foreach (GuiltyInUndelivery g in undelivery.ObservableGuilty)
                {
                    initialGuiltyList.Add(
                        new GuiltyInUndelivery {
                        Id = g.Id,
                        UndeliveredOrder = g.UndeliveredOrder,
                        GuiltySide       = g.GuiltySide,
                        GuiltyDepartment = g.GuiltyDepartment
                    }
                        );
                }
            }
            var filterOrders = new OrdersFilter(UoW);
            List <OrderStatus> hiddenStatusesList = new List <OrderStatus>();
            var grantedStatusesArray = OrderRepository.GetStatusesForOrderCancelation();

            foreach (OrderStatus status in Enum.GetValues(typeof(OrderStatus)))
            {
                if (!grantedStatusesArray.Contains(status))
                {
                    hiddenStatusesList.Add(status);
                }
            }
            filterOrders.SetAndRefilterAtOnce(x => x.HideStatuses = hiddenStatusesList.Cast <Enum>().ToArray());
            yEForUndeliveredOrder.Changed += (sender, e) => {
                oldOrder       = undelivery.OldOrder;
                lblInfo.Markup = undelivery.GetOldOrderInfo();
                if (undelivery.Id <= 0)
                {
                    undelivery.OldOrderStatus = oldOrder.OrderStatus;
                }
                routeListDoesNotExist = oldOrder != null && (undelivery.OldOrderStatus == OrderStatus.NewOrder ||
                                                             undelivery.OldOrderStatus == OrderStatus.Accepted ||
                                                             undelivery.OldOrderStatus == OrderStatus.WaitForPayment);

                guiltyInUndeliveryView.ConfigureWidget(UoW, undelivery, !routeListDoesNotExist);
                SetSensitivities();
                SetVisibilities();
                GetFines();
                RemoveItemsFromEnums();
            };
            yEForUndeliveredOrder.RepresentationModel = new OrdersVM(filterOrders);
            yEForUndeliveredOrder.Binding.AddBinding(undelivery, x => x.OldOrder, x => x.Subject).InitializeFromSource();
            yEForUndeliveredOrder.CanEditReference = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_delete");

            yDateDriverCallTime.Binding.AddBinding(undelivery, t => t.DriverCallTime, w => w.DateOrNull).InitializeFromSource();
            if (undelivery.Id <= 0)
            {
                yDateDriverCallTime.DateOrNull = DateTime.Now;
            }

            yEnumCMBDriverCallPlace.ItemsEnum = typeof(DriverCallType);
            yEnumCMBDriverCallPlace.Binding.AddBinding(undelivery, p => p.DriverCallType, w => w.SelectedItem).InitializeFromSource();

            yDateDispatcherCallTime.Binding.AddBinding(undelivery, t => t.DispatcherCallTime, w => w.DateOrNull).InitializeFromSource();
            if (undelivery.Id <= 0)
            {
                yDateDispatcherCallTime.DateOrNull = DateTime.Now;
            }

            referenceNewDeliverySchedule.ItemsQuery = DeliveryScheduleRepository.AllQuery();
            referenceNewDeliverySchedule.SetObjectDisplayFunc <DeliverySchedule>(e => e.Name);
            referenceNewDeliverySchedule.Binding.AddBinding(undelivery, s => s.NewDeliverySchedule, w => w.Subject).InitializeFromSource();
            referenceNewDeliverySchedule.Sensitive = false;

            SetLabelsAcordingToNewOrder();

            yEnumCMBStatus.ItemsEnum         = typeof(UndeliveryStatus);
            yEnumCMBStatus.SelectedItem      = undelivery.UndeliveryStatus;
            yEnumCMBStatus.EnumItemSelected += (s, e) => {
                SetSensitivities();
                undelivery.SetUndeliveryStatus((UndeliveryStatus)e.SelectedItem);
            };

            yentInProcessAtDepartment.SubjectType = typeof(Subdivision);
            yentInProcessAtDepartment.Binding.AddBinding(undelivery, d => d.InProcessAtDepartment, w => w.Subject).InitializeFromSource();
            yentInProcessAtDepartment.ChangedByUser += (s, e) => {
                undelivery.AddCommentToTheField(
                    UoW,
                    CommentedFields.Reason,
                    String.Format(
                        "сменил(а) \"в работе у отдела\" \nс \"{0}\" на \"{1}\"",
                        InitialProcDepartmentName,
                        undelivery.InProcessAtDepartment.Name
                        )
                    );
            };

            if (undelivery.Id <= 0)
            {
                yentInProcessAtDepartment.Subject = SubdivisionsRepository.GetQCDepartment(UoW);
            }

            refRegisteredBy.RepresentationModel = new EmployeesVM(UoW);
            refRegisteredBy.Binding.AddBinding(undelivery, s => s.EmployeeRegistrator, w => w.Subject).InitializeFromSource();

            yEnumCMBDriverCallPlace.EnumItemSelected += CMBSelectedItemChanged;

            txtReason.Binding.AddBinding(undelivery, u => u.Reason, w => w.Buffer.Text).InitializeFromSource();

            lblInfo.Markup = undelivery.GetOldOrderInfo();

            yenumcomboboxTransferType.ItemsEnum = typeof(TransferType);
            yenumcomboboxTransferType.Binding.AddBinding(undelivery, u => u.OrderTransferType, w => w.SelectedItemOrNull).InitializeFromSource();

            comboProblemSource.SetRenderTextFunc <UndeliveryProblemSource>(k => k.GetFullName);
            comboProblemSource.Binding.AddBinding(undelivery, u => u.ProblemSourceItems, w => w.ItemsList).InitializeFromSource();
            comboProblemSource.Binding.AddBinding(undelivery, u => u.ProblemSource, w => w.SelectedItem).InitializeFromSource();
            comboProblemSource.Sensitive = CanChangeProblemSource;

            yTreeFines.ColumnsConfig = ColumnsConfigFactory.Create <FineItem>()
                                       .AddColumn("Номер").AddTextRenderer(node => node.Fine.Id.ToString())
                                       .AddColumn("Сотудники").AddTextRenderer(node => node.Employee.ShortName)
                                       .AddColumn("Сумма штрафа").AddTextRenderer(node => CurrencyWorks.GetShortCurrencyString(node.Money))
                                       .Finish();

            yenumcomboboxTransferType.Visible = undelivery?.NewOrder != null;

            undelivery.PropertyChanged += (sender, e) => {
                if (e.PropertyName != "NewOrder")
                {
                    return;
                }

                if (undelivery.NewOrder == null)
                {
                    yenumcomboboxTransferType.Visible = false;
                    undelivery.OrderTransferType      = null;
                    return;
                }

                yenumcomboboxTransferType.Visible = true;
            };

            GetFines();
            SetVisibilities();
            SetSensitivities();
        }