private string GetAllCashSummaryInfo(CashDocumentsFilter filter)
        {
            if (filter == null)
            {
                return("");
            }

            decimal totalCash        = 0;
            var     allCashString    = "";
            var     distinctBalances = _cashRepository
                                       .CurrentCashForGivenSubdivisions(_uow, filter.SelectedSubdivisions.Select(x => x.Id).ToArray()).ToList();

            var inTransferring = _cashRepository.GetCashInTransferring(_uow);

            if (filter.SelectedSubdivisions.Count() > 1)
            {
                distinctBalances = distinctBalances.OrderBy(x => _sortedSubdivisionsIds.IndexOf(x.Id)).ToList();
            }

            foreach (var node in distinctBalances)
            {
                totalCash     += node.Balance;
                allCashString += $"\r\n{node.Name}: {CurrencyWorks.GetShortCurrencyString(node.Balance)}";
            }

            var total                     = $"Денег в кассе: {CurrencyWorks.GetShortCurrencyString(totalCash)}. ";
            var separatedCash             = filter.SelectedSubdivisions.Any() ? $"\r\n\tИз них: {allCashString}" : "";
            var cashInTransferringMessage = $"\n\nВ сейфе инкассатора: {CurrencyWorks.GetShortCurrencyString(inTransferring)}";

            return(total + separatedCash + cashInTransferringMessage);
        }
Esempio n. 2
0
        void Calculate()
        {
            if (accountableslipfilter1.RestrictAccountable != null)
            {
                labelCurrentDebt.LabelProp = String.Format("Текущий долг: {0}",
                                                           CurrencyWorks.GetShortCurrencyString(
                                                               _accountableDebtsRepository.EmployeeDebt(UoW, accountableslipfilter1.RestrictAccountable))
                                                           );
            }
            else
            {
                labelCurrentDebt.LabelProp = String.Empty;
            }

            decimal Recived = 0, Closed = 0;

            foreach (var node in representationSlips.RepresentationModel.ItemsList.Cast <ViewModel.AccountableSlipsVMNode> ())
            {
                Recived += node.Append;
                Closed  += node.Removed;
            }
            labelRecived.LabelProp = String.Format("Получено: {0}",
                                                   CurrencyWorks.GetShortCurrencyString(Recived));
            labelClosed.LabelProp = String.Format("Закрыто: {0}",
                                                  CurrencyWorks.GetShortCurrencyString(Closed));
        }
Esempio n. 3
0
        private void ConfigureTreeItems()
        {
            var colorWhite    = new Gdk.Color(0xff, 0xff, 0xff);
            var colorLightRed = new Gdk.Color(0xff, 0x66, 0x66);

            treeItems.ColumnsConfig = ColumnsConfigFactory.Create <OrderWithoutShipmentForAdvancePaymentItem>()
                                      .AddColumn("Номенклатура")
                                      .HeaderAlignment(0.5f)
                                      .AddTextRenderer(node => node.NomenclatureString)
                                      .AddColumn("Кол-во")
                                      .SetTag("Count")
                                      .HeaderAlignment(0.5f)
                                      .AddNumericRenderer(node => node.Count)
                                      .Adjustment(new Adjustment(0, 0, 1000000, 1, 100, 0)).Editing().WidthChars(10)
                                      .AddSetter((c, node) => c.Digits = node.Nomenclature.Unit == null ? 0 : (uint)node.Nomenclature.Unit.Digits)
                                      .AddColumn("Аренда")
                                      .HeaderAlignment(0.5f)
                                      .AddTextRenderer(node => node.IsRentCategory ? node.RentString : string.Empty)
                                      .AddColumn("Цена")
                                      .HeaderAlignment(0.5f)
                                      .AddNumericRenderer(node => node.Price).Digits(2).WidthChars(10)
                                      .Adjustment(new Adjustment(0, 0, 1000000, 1, 100, 0)).Editing(true)
                                      .AddSetter((c, node) => c.Editable = node.CanEditPrice)
                                      .AddTextRenderer(node => CurrencyWorks.CurrencyShortName, false)
                                      .AddColumn("В т.ч. НДС")
                                      .HeaderAlignment(0.5f)
                                      .AddTextRenderer(x => CurrencyWorks.GetShortCurrencyString(x.IncludeNDS ?? 0))
                                      .AddColumn("Сумма")
                                      .HeaderAlignment(0.5f)
                                      .AddTextRenderer(node => CurrencyWorks.GetShortCurrencyString(node.Sum))
                                      .AddColumn("Скидка")
                                      .HeaderAlignment(0.5f)
                                      .AddNumericRenderer(node => node.ManualChangingDiscount).Editing()
                                      .AddSetter(
                (c, n) => c.Adjustment = n.IsDiscountInMoney
                                                                        ? new Adjustment(0, 0, (double)(n.Price * n.Count), 1, 100, 1)
                                                                        : new Adjustment(0, 0, 100, 1, 100, 1)
                )
                                      .Digits(2)
                                      .WidthChars(10)
                                      .AddTextRenderer(n => n.IsDiscountInMoney ? CurrencyWorks.CurrencyShortName : "%", false)
                                      .AddColumn("Скидка \nв рублях?")
                                      .AddToggleRenderer(x => x.IsDiscountInMoney).Editing()
                                      .AddColumn("Основание скидки")
                                      .HeaderAlignment(0.5f)
                                      .AddComboRenderer(node => node.DiscountReason)
                                      .SetDisplayFunc(x => x.Name)
                                      .FillItems(ViewModel.OrderRepository.GetDiscountReasons(ViewModel.UoW))
                                      .AddSetter((c, n) => c.Editable = n.Discount > 0)
                                      .AddSetter(
                (c, n) => c.BackgroundGdk = n.Discount > 0 && n.DiscountReason == null
                                                ? colorLightRed
                                                : colorWhite
                )
                                      .RowCells()
                                      .XAlign(0.5f)
                                      .Finish();
            treeItems.ItemsDataSource    = ViewModel.Entity.ObservableOrderWithoutDeliveryForAdvancePaymentItems;
            treeItems.Selection.Changed += TreeItems_Selection_Changed;
        }
Esempio n. 4
0
        private void ConfigureTreeView()
        {
            ytreeviewSums.CreateFluentColumnsConfig <CashRequestSumItem>()
            .AddColumn("Сумма")
            .HeaderAlignment(0.5f)
            .AddNumericRenderer(n => CurrencyWorks.GetShortCurrencyString(n.Sum))
            .XAlign(0.5f)
            .AddColumn("Дата")
            .HeaderAlignment(0.5f)
            .AddTextRenderer(n => n.Date.ToShortDateString())
            .XAlign(0.5f)
            .AddColumn("Подотчетное лицо")
            .HeaderAlignment(0.5f)
            .AddTextRenderer(n => n.AccountableEmployee != null ? PersonHelper.PersonNameWithInitials(
                                 n.AccountableEmployee.LastName, n.AccountableEmployee.Name, n.AccountableEmployee.Patronymic) : "")
            .XAlign(0.5f)
            .AddColumn("Комментарий")
            .HeaderAlignment(0.5f)
            .AddTextRenderer(n => n.Comment)
            .XAlign(0.5f)
            .AddColumn("Выдано")
            .HeaderAlignment(0.5f)
            .AddToggleRenderer(n => n.ObservableExpenses != null && n.ObservableExpenses.Any()).Editing(false)
            .RowCells().AddSetter <CellRenderer>((c, n) => c.Sensitive = ViewModel.CanExecuteGive(n))
            .Finish();

            ytreeviewSums.ItemsDataSource    = ViewModel.Entity.ObservableSums;
            ytreeviewSums.Selection.Changed += OnyTreeViewSumsSelectionChanged;
            ytreeviewSums.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();

            ViewModel.UpdateNodes += ytreeviewSums.YTreeModel.EmitModelChanged;
        }
        void CalculateTotal()
        {
            decimal total = 0;

            foreach (var item in documentUoW.Root.Items)
            {
                total += item.Sum;
            }

            labelSum.LabelProp = String.Format("Итого: {0}", CurrencyWorks.GetShortCurrencyString(total));
        }
        void ConfigureDlg()
        {
            var csvFilter = new FileFilter();

            csvFilter.AddPattern("*.csv");
            csvFilter.Name = "Comma Separated Values File (*.csv)";

            var txtFilter = new FileFilter();

            txtFilter.AddPattern("*.txt");
            txtFilter.Name = "Текстовый файл (*.txt)";

            var allFilter = new FileFilter();

            allFilter.AddPattern("*");
            allFilter.Name = "Все файлы";

            fChooser.AddFilter(csvFilter);
            fChooser.AddFilter(txtFilter);
            fChooser.AddFilter(allFilter);

            treeDocuments.ColumnsConfig = ColumnsConfigFactory.Create <PaymentByCardOnline>()
                                          .AddColumn("Загрузить")
                                          .AddToggleRenderer(x => x.Selected).Editing()
                                          .AddSetter((c, n) => (c as CellRendererToggle).Activatable = n.Selectable)
                                          .AddColumn("Дата и\nвремя")
                                          .AddTextRenderer(x => $"{x.DateAndTime:M}\n{x.DateAndTime:t}")
                                          .AddColumn("Номер и\nсумма оплаты")
                                          .AddTextRenderer(
                x => $"{x.PaymentNr.ToString()}\n{CurrencyWorks.GetShortCurrencyString(x.PaymentRUR)}"
                )
                                          .AddColumn("Контакты")
                                          .AddTextRenderer(x => $"{x.Phone}\n{x.Email}")
                                          .AddColumn("Магазин")
                                          .AddTextRenderer(x => x.Shop)
                                          .AddColumn("Статус оплаты")
                                          .AddTextRenderer(x => x.PaymentStatus.GetEnumTitle())
                                          .AddColumn("")
                                          .RowCells()
                                          .AddSetter <CellRenderer>((c, n) => c.CellBackground = n.Color)
                                          .Finish();

            ConfigureButtonReadFile();

            SetControlsAccessibility();
        }
Esempio n. 7
0
        private void UpdateResidue()
        {
            int bottleDebt;

            if (Entity.DeliveryPoint == null)
            {
                bottleDebt = Repository.Operations.BottlesRepository.GetBottlesAtCounterparty(UoW, Entity.Customer, Entity.Date);
            }
            else
            {
                bottleDebt = Repository.Operations.BottlesRepository.GetBottlesAtDeliveryPoint(UoW, Entity.DeliveryPoint, Entity.Date);
            }
            labelCurrentBootle.LabelProp = RusNumber.FormatCase(bottleDebt, "{0} бутыль", "{0} бутыли", "{0} бутылей");

            decimal bottleDeposit;

            if (Entity.DeliveryPoint == null)
            {
                bottleDeposit = Repository.Operations.DepositRepository.GetDepositsAtCounterparty(UoW, Entity.Customer, DepositType.Bottles, Entity.Date);
            }
            else
            {
                bottleDeposit = Repository.Operations.DepositRepository.GetDepositsAtDeliveryPoint(UoW, Entity.DeliveryPoint, DepositType.Bottles, Entity.Date);
            }
            labelCurrentBottleDeposit.LabelProp = CurrencyWorks.GetShortCurrencyString(bottleDeposit);

            decimal equipmentDeposit;

            if (Entity.DeliveryPoint == null)
            {
                equipmentDeposit = Repository.Operations.DepositRepository.GetDepositsAtCounterparty(UoW, Entity.Customer, DepositType.Equipment, Entity.Date);
            }
            else
            {
                equipmentDeposit = Repository.Operations.DepositRepository.GetDepositsAtDeliveryPoint(UoW, Entity.DeliveryPoint, DepositType.Equipment, Entity.Date);
            }
            labelCurrentEquipmentDeposit.LabelProp = CurrencyWorks.GetShortCurrencyString(equipmentDeposit);

            decimal debt = Repository.Operations.MoneyRepository.GetCounterpartyDebt(UoW, Entity.Customer, Entity.Date);

            labelCurrentMoneyDebt.LabelProp = CurrencyWorks.GetShortCurrencyString(debt);
        }
Esempio n. 8
0
        private string GetAllCashSummaryInfo(CashDocumentsFilter filter)
        {
            if (filter == null)
            {
                return("");
            }

            decimal totalCash        = 0;
            var     allCashString    = "";
            var     distinctBalances = _cashRepository
                                       .CurrentCashForGivenSubdivisions(_uow, filter.SelectedSubdivisions.Select(x => x.Id).ToArray());

            foreach (var node in distinctBalances)
            {
                totalCash     += node.Balance;
                allCashString += $"\r\n{node.Name}: {CurrencyWorks.GetShortCurrencyString(node.Balance)}";
            }

            var total         = $"Денег в кассе: {CurrencyWorks.GetShortCurrencyString(totalCash)}. ";
            var separatedCash = filter.SelectedSubdivisions.Any() ? $"\r\n\tИз них: {allCashString}" : "";

            return(total + separatedCash);
        }
Esempio n. 9
0
        static void CreateBaseConfig()
        {
            logger.Info("Настройка параметров базы...");
            //Увеличиваем таймоут
            QSMain.ConnectionString += ";ConnectionTimeout=120";

            var db_config = FluentNHibernate.Cfg.Db.MySQLConfiguration.Standard
                            .Dialect <MySQL57SpatialExtendedDialect>()
                            .ConnectionString(QSMain.ConnectionString)
                            .AdoNetBatchSize(100)
                            .Driver <LoggedMySqlClientDriver>();

            // Настройка ORM
            OrmConfig.ConfigureOrm(
                db_config,
                new System.Reflection.Assembly[] {
                System.Reflection.Assembly.GetAssembly(typeof(QS.Project.HibernateMapping.UserBaseMap)),
                System.Reflection.Assembly.GetAssembly(typeof(HibernateMapping.OrganizationMap)),
                System.Reflection.Assembly.GetAssembly(typeof(Bank)),
                System.Reflection.Assembly.GetAssembly(typeof(HistoryMain)),
            },
                (cnf) => {
                cnf.DataBaseIntegration(
                    dbi => {
                    dbi.BatchSize = 100;
                    dbi.Batcher <MySqlClientBatchingBatcherFactory>();
                }
                    );
            }
                );
            #region Dialogs mapping

            OrmMain.ClassMappingList = new List <IOrmObjectMapping> {
                //Простые справочники
                OrmObjectMapping <CullingCategory> .Create().DefaultTableView().SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <Nationality> .Create().DefaultTableView().SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <Citizenship> .Create().DefaultTableView().SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <Manufacturer> .Create().DefaultTableView().SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <EquipmentColors> .Create().DefaultTableView().SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <User> .Create().DefaultTableView().SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <UserSettings> .Create().Dialog <UserSettingsView>(),
                OrmObjectMapping <FuelType> .Create().Dialog <FuelTypeDlg>().DefaultTableView().SearchColumn("Название", x => x.Name).SearchColumn("Стоимость", x => x.Cost.ToString()).End(),
                OrmObjectMapping <MovementWagon> .Create().Dialog <MovementWagonViewModel>().DefaultTableView().SearchColumn("Название", x => x.Name).End(),
                //Остальные справочники
                OrmObjectMapping <CarProxyDocument> .Create().Dialog <CarProxyDlg>(),
                OrmObjectMapping <M2ProxyDocument> .Create().Dialog <M2ProxyDlg>(),
                OrmObjectMapping <ProductGroup> .Create().Dialog <ProductGroupDlg>(),
                OrmObjectMapping <CommentTemplate> .Create().Dialog <CommentTemplateDlg>().DefaultTableView().SearchColumn("Шаблон комментария", x => x.Comment).End(),
                OrmObjectMapping <FineTemplate> .Create().Dialog <FineTemplateDlg>().DefaultTableView().SearchColumn("Шаблон комментария", x => x.Reason).End(),
                OrmObjectMapping <PremiumTemplate> .Create().Dialog <PremiumTemplateDlg>().DefaultTableView().SearchColumn("Шаблон комментария", x => x.Reason).End(),
                OrmObjectMapping <MeasurementUnits> .Create().Dialog <MeasurementUnitsDlg>().DefaultTableView().SearchColumn("ОКЕИ", x => x.OKEI).SearchColumn("Название", x => x.Name).Column("Точность", x => x.Digits.ToString()).End(),
                OrmObjectMapping <Contact> .Create().Dialog <ContactDlg>()
                .DefaultTableView().SearchColumn("Фамилия", x => x.Surname).SearchColumn("Имя", x => x.Name).SearchColumn("Отчество", x => x.Patronymic).End(),
                OrmObjectMapping <Order> .Create().Dialog <OrderDlg>().PopupMenu(OrderPopupMenu.GetPopupMenu),
                OrmObjectMapping <UndeliveredOrder> .Create().Dialog <UndeliveredOrderDlg>(),
                OrmObjectMapping <Organization> .Create().Dialog <OrganizationDlg>().DefaultTableView().Column("Код", x => x.Id.ToString()).SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <DeliverySchedule> .Create().Dialog <DeliveryScheduleDlg>().DefaultTableView().SearchColumn("Название", x => x.Name).SearchColumn("Время доставки", x => x.DeliveryTime).End(),
                OrmObjectMapping <ProductSpecification> .Create().Dialog <ProductSpecificationDlg>().DefaultTableView().SearchColumn("Код", x => x.Id.ToString()).SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <EquipmentType> .Create().Dialog <EquipmentTypeDlg>().DefaultTableView().Column("Название", equipmentType => equipmentType.Name).End(),
                //Связанное с клиентом
                OrmObjectMapping <Proxy> .Create().Dialog <ProxyDlg>()
                .DefaultTableView().SearchColumn("Номер", x => x.Number).SearchColumn("С", x => x.StartDate.ToShortDateString()).SearchColumn("По", x => x.ExpirationDate.ToShortDateString()).End(),
                OrmObjectMapping <DeliveryPoint> .Create().Dialog <DeliveryPointDlg>().DefaultTableView().SearchColumn("ID", x => x.Id.ToString()).Column("Адрес", x => x.Title).End(),
                OrmObjectMapping <PaidRentPackage> .Create().Dialog <PaidRentPackageDlg>()
                .DefaultTableView().SearchColumn("Название", x => x.Name).Column("Тип оборудования", x => x.EquipmentType.Name).SearchColumn("Цена в сутки", x => CurrencyWorks.GetShortCurrencyString(x.PriceDaily)).SearchColumn("Цена в месяц", x => CurrencyWorks.GetShortCurrencyString(x.PriceMonthly)).End(),
                OrmObjectMapping <FreeRentPackage> .Create().Dialog <FreeRentPackageDlg>().DefaultTableView().SearchColumn("Название", x => x.Name).Column("Тип оборудования", x => x.EquipmentType.Name).OrderAsc(x => x.Name).End(),
                OrmObjectMapping <Counterparty> .Create().Dialog <CounterpartyDlg>().DefaultTableView().SearchColumn("Название", x => x.FullName).End(),
                OrmObjectMapping <Tag> .Create().Dialog <TagDlg>().DefaultTableView().SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <CounterpartyContract> .Create().Dialog <CounterpartyContractDlg>(),
                OrmObjectMapping <DocTemplate> .Create().Dialog <DocTemplateDlg>().DefaultTableView().SearchColumn("Название", x => x.Name).Column("Тип", x => x.TemplateType.GetEnumTitle()).End(),
                OrmObjectMapping <TransferOperationDocument> .Create().Dialog <TransferOperationDocumentDlg>(),
                //Справочники с фильтрами
                OrmObjectMapping <Equipment> .Create().Dialog <EquipmentDlg>().JournalFilter <EquipmentFilter>()
                .DefaultTableView().Column("Код", x => x.Id.ToString()).SearchColumn("Номенклатура", x => x.NomenclatureName).Column("Тип", x => x.Nomenclature.Type.Name).SearchColumn("Серийный номер", x => x.Serial).Column("Дата последней обработки", x => x.LastServiceDate.ToShortDateString()).End(),
                //Логисткика
                OrmObjectMapping <RouteList> .Create().Dialog <RouteListCreateDlg>()
                .DefaultTableView().SearchColumn("Номер", x => x.Id.ToString()).Column("Дата", x => x.Date.ToShortDateString()).Column("Статус", x => x.Status.GetEnumTitle()).SearchColumn("Водитель", x => String.Format("{0} - {1}", x.Driver.FullName, x.Car.Title)).End(),
                OrmObjectMapping <RouteColumn> .Create().DefaultTableView().Column("Код", x => x.Id.ToString()).SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <DeliveryShift> .Create().Dialog <DeliveryShiftDlg>().DefaultTableView().SearchColumn("Название", x => x.Name).SearchColumn("Диапазон времени", x => x.DeliveryTime).End(),
                OrmObjectMapping <DeliveryDaySchedule> .Create().Dialog <DeliveryDayScheduleDlg>().DefaultTableView().SearchColumn("Название", x => x.Name).End(),
                //Сервис
                OrmObjectMapping <ServiceClaim> .Create().Dialog <ServiceClaimDlg>().DefaultTableView().Column("Номер", x => x.Id.ToString()).Column("Тип", x => x.ServiceClaimType.GetEnumTitle()).Column("Оборудование", x => x.Equipment.Title).Column("Подмена", x => x.ReplacementEquipment != null ? "Да" : "Нет").Column("Точка доставки", x => x.DeliveryPoint.Title).End(),
                //Касса
                OrmObjectMapping <Income> .Create().Dialog <CashIncomeDlg> (),
                OrmObjectMapping <ExpenseCategory> .Create().Dialog <ExpenseCategoryViewModel>().DefaultTableView().Column("Код", x => x.Id.ToString()).SearchColumn("Название", e => e.Name).Column("Тип документа", e => e.ExpenseDocumentType.GetEnumTitle()).TreeConfig(new RecursiveTreeConfig <ExpenseCategory>(x => x.Parent, x => x.Childs)).End(),
                OrmObjectMapping <Expense> .Create().Dialog <CashExpenseDlg> (),
                OrmObjectMapping <AdvanceReport> .Create().Dialog <AdvanceReportDlg> (),
                OrmObjectMapping <Fine> .Create().Dialog <FineDlg> (),
                OrmObjectMapping <Premium> .Create().Dialog <PremiumDlg> (),
                OrmObjectMapping <IncomeCashTransferDocument> .Create().Dialog <IncomeCashTransferDlg>(),
                OrmObjectMapping <CommonCashTransferDocument> .Create().Dialog <CommonCashTransferDlg>(),
                //Банкинг
                OrmObjectMapping <AccountIncome> .Create(),
                OrmObjectMapping <AccountExpense> .Create(),
                //Склад
                OrmObjectMapping <Warehouse> .Create().Dialog <WarehouseDlg>().DefaultTableView().Column("Название", w => w.Name).Column("В архиве", w => w.IsArchive ? "Да":"").End(),
                OrmObjectMapping <RegradingOfGoodsTemplate> .Create().Dialog <RegradingOfGoodsTemplateDlg>().DefaultTableView().Column("Название", w => w.Name).End()
            };

            #region Складские документы
            OrmMain.AddObjectDescription <IncomingWater>().Dialog <IncomingWaterDlg>();
            OrmMain.AddObjectDescription <WriteoffDocument>().Dialog <WriteoffDocumentDlg>();
            OrmMain.AddObjectDescription <InventoryDocument>().Dialog <InventoryDocumentDlg>();
            OrmMain.AddObjectDescription <ShiftChangeWarehouseDocument>().Dialog <ShiftChangeWarehouseDocumentDlg>();
            OrmMain.AddObjectDescription <RegradingOfGoodsDocument>().Dialog <RegradingOfGoodsDocumentDlg>();
            OrmMain.AddObjectDescription <SelfDeliveryDocument>().Dialog <SelfDeliveryDocumentDlg>();
            OrmMain.AddObjectDescription <CarLoadDocument>().Dialog <CarLoadDocumentDlg>();
            OrmMain.AddObjectDescription <CarUnloadDocument>().Dialog <CarUnloadDocumentDlg>();
            #endregion

            #region Goods
            OrmMain.AddObjectDescription <Nomenclature>().Dialog <NomenclatureDlg>().JournalFilter <NomenclatureFilter>().
            DefaultTableView()
            .SearchColumn("Код", x => x.Id.ToString())
            .SearchColumn("Название", x => x.Name)
            .Column("Тип", x => x.CategoryString)
            .SearchColumn("Номер в ИМ", x => x.OnlineStoreExternalId)
            .End();
            OrmMain.AddObjectDescription <Folder1c>().Dialog <Folder1cDlg>()
            .DefaultTableView()
            .SearchColumn("Код 1С", x => x.Code1c)
            .SearchColumn("Название", x => x.Name)
            .TreeConfig(new RecursiveTreeConfig <Folder1c>(x => x.Parent, x => x.Childs)).End();
            #endregion

            #region Простые справочники
            OrmMain.AddObjectDescription <DiscountReason>()
            .DefaultTableView()
            .SearchColumn("Название", x => x.Name)
            .End();
            OrmMain.AddObjectDescription <GeographicGroup>()
            .Dialog <GeographicGroupDlg>()
            .DefaultTableView()
            .SearchColumn("Название", x => x.Name)
            .Column("Код", x => x.Id.ToString())
            .End();
            OrmMain.AddObjectDescription <TariffZone>()
            .DefaultTableView()
            .SearchColumn("Номер", x => x.Id.ToString())
            .SearchColumn("Название", x => x.Name)
            .End();
            OrmMain.AddObjectDescription <NonReturnReason>()
            .DefaultTableView()
            .SearchColumn("Код", x => x.Id.ToString())
            .SearchColumn("Название", x => x.Name)
            .End();
            OrmMain.AddObjectDescription <PaymentFrom>()
            .DefaultTableView()
            .SearchColumn("Код", x => x.Id.ToString())
            .SearchColumn("Название", x => x.Name)
            .End();
            OrmMain.AddObjectDescription <Post>()
            .DefaultTableView()
            .SearchColumn("Код", x => x.Id.ToString())
            .SearchColumn("Название", x => x.Name)
            .End();

            #endregion

            #region неПростые справочники
            OrmMain.AddObjectDescription <Subdivision>().Dialog <SubdivisionDlg>().DefaultTableView().SearchColumn("Название", x => x.Name).Column("Руководитель", x => x.Chief == null ? "" : x.Chief.ShortName).SearchColumn("Номер", x => x.Id.ToString()).TreeConfig(new RecursiveTreeConfig <Subdivision>(x => x.ParentSubdivision, x => x.ChildSubdivisions)).End();
            OrmMain.AddObjectDescription <TypeOfEntity>()
            .Dialog <TypeOfEntityDlg>()
            .DefaultTableView()
            .SearchColumn("Тип документа", x => TypeOfEntityRepository.GetEntityNameByString(x.Type))
            .SearchColumn("Название документа", x => x.CustomName)
            .SearchColumn("Код", x => x.Id.ToString())
            .Column("Активно", x => !x.IsActive ? "нет" : String.Empty)
            .SearchColumn("Имя класса", x => x.Type)
            .OrderAsc(x => x.CustomName)
            .End();
            OrmMain.AddObjectDescription <Employee>().Dialog <EmployeeDlg>().DefaultTableView()
            .Column("Код", x => x.Id.ToString())
            .SearchColumn("Ф.И.О.", x => x.FullName)
            .Column("Категория", x => x.Category.GetEnumTitle())
            .OrderAsc(x => x.LastName).OrderAsc(x => x.Name).OrderAsc(x => x.Patronymic)
            .End();
            OrmMain.AddObjectDescription <Trainee>().Dialog <TraineeDlg>().DefaultTableView()
            .Column("Код", x => x.Id.ToString())
            .SearchColumn("Ф.И.О.", x => x.FullName)
            .OrderAsc(x => x.LastName).OrderAsc(x => x.Name).OrderAsc(x => x.Patronymic)
            .End();
            OrmMain.AddObjectDescription <DeliveryPriceRule>().Dialog <DeliveryPriceRuleDlg>().DefaultTableView()
            .Column("< 19л б.", x => x.Water19LCount.ToString())
            .Column("< 6л б.", x => x.Water6LCount)
            .Column("< 1,5л б.", x => x.Water1500mlCount)
            .Column("< 0,6л б.", x => x.Water600mlCount)
            .Column("Минимальная сумма заказа", x => x.OrderMinSumEShopGoods.ToString())
            .SearchColumn("Описание правила", x => x.Title)
            .End();
            OrmMain.AddObjectDescription <Car>().Dialog <CarsDlg>().DefaultTableView()
            .SearchColumn("Код", x => x.Id.ToString())
            .SearchColumn("Модель а/м", x => x.Model)
            .SearchColumn("Гос. номер", x => x.RegistrationNumber)
            .SearchColumn("Водитель", x => x.Driver != null ? x.Driver.FullName : string.Empty)
            .End();
            OrmMain.AddObjectDescription <Certificate>().Dialog <CertificateDlg>().DefaultTableView()
            .SearchColumn("Имя", x => x.Name)
            .Column("Тип", x => x.TypeOfCertificate.GetEnumTitle())
            .SearchColumn("Номер", x => x.Id.ToString())
            .SearchColumn("Начало срока", x => x.StartDate.HasValue ? x.StartDate.Value.ToString("dd.MM.yyyy") : "Ошибка!")
            .SearchColumn("Окончание срока", x => x.ExpirationDate.HasValue ? x.ExpirationDate.Value.ToString("dd.MM.yyyy") : "Бессрочно")
            .Column("Архивный?", x => x.IsArchive ? "Да" : string.Empty)
            .OrderAsc(x => x.IsArchive)
            .OrderAsc(x => x.Id)
            .End();
            OrmMain.AddObjectDescription <StoredImageResource>().Dialog <ImageLoaderDlg>().DefaultTableView()
            .SearchColumn("Номер", x => x.Id.ToString())
            .SearchColumn("Название", x => x.Name)
            .End();
            OrmMain.AddObjectDescription <DeliveryPointCategory>().Dialog <DeliveryPointCategoryDlg>().DefaultTableView()
            .SearchColumn("Код", x => x.Id.ToString())
            .SearchColumn("Название", x => x.Name)
            .Column("В архиве?", x => x.IsArchive ? "Да" : "Нет")
            .OrderAsc(x => x.Name)
            .End();
            OrmMain.AddObjectDescription <CounterpartyActivityKind>().Dialog <CounterpartyActivityKindDlg>().DefaultTableView()
            .SearchColumn("Код", x => x.Id.ToString())
            .SearchColumn("Название", x => x.Name)
            .End();

            #endregion

            OrmMain.ClassMappingList.AddRange(QSBanks.QSBanksMain.GetModuleMaping());

            #endregion

            HistoryMain.Enable();
            TemplatePrinter.InitPrinter();
            ImagePrinter.InitPrinter();

            //Настройка ParentReference
            ParentReferenceConfig.AddActions(new ParentReferenceActions <Organization, Account> {
                AddNewChild = (o, a) => o.AddAccount(a)
            });
            ParentReferenceConfig.AddActions(new ParentReferenceActions <Counterparty, Account> {
                AddNewChild = (c, a) => c.AddAccount(a)
            });
            ParentReferenceConfig.AddActions(new ParentReferenceActions <Employee, Account> {
                AddNewChild = (c, a) => c.AddAccount(a)
            });
            ParentReferenceConfig.AddActions(new ParentReferenceActions <Trainee, Account> {
                AddNewChild = (c, a) => c.AddAccount(a)
            });
        }
Esempio n. 10
0
        static void CreateBaseConfig()
        {
            logger.Info("Настройка параметров базы...");
            //Увеличиваем таймоут
            QSMain.ConnectionString += ";ConnectionTimeout=120";

            var db_config = FluentNHibernate.Cfg.Db.MySQLConfiguration.Standard
                            .Dialect <NHibernate.Spatial.Dialect.MySQL57SpatialDialect>()
                            .ConnectionString(QSMain.ConnectionString)
                            .AdoNetBatchSize(100)
                            .ShowSql()
                            .FormatSql();

            // Настройка ORM
            OrmConfig.ConfigureOrm(db_config, new System.Reflection.Assembly[] {
                System.Reflection.Assembly.GetAssembly(typeof(QS.Project.HibernateMapping.UserBaseMap)),
                System.Reflection.Assembly.GetAssembly(typeof(Vodovoz.HibernateMapping.OrganizationMap)),
                System.Reflection.Assembly.GetAssembly(typeof(QSBanks.QSBanksMain)),
                System.Reflection.Assembly.GetAssembly(typeof(QSContacts.QSContactsMain)),
                System.Reflection.Assembly.GetAssembly(typeof(QS.HistoryLog.HistoryMain)),
            },
                                   (cnf) => cnf.DataBaseIntegration(
                                       dbi => { dbi.BatchSize = 100; dbi.Batcher <MySqlClientBatchingBatcherFactory>(); }
                                       ));
            #region Dialogs mapping

            OrmMain.ClassMappingList = new List <IOrmObjectMapping> {
                //Простые справочники
                OrmObjectMapping <CullingCategory> .Create().DefaultTableView().SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <Nationality> .Create().DefaultTableView().SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <Manufacturer> .Create().DefaultTableView().SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <EquipmentColors> .Create().DefaultTableView().SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <User> .Create().DefaultTableView().SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <UserSettings> .Create().Dialog <UserSettingsDlg>(),
                OrmObjectMapping <FuelType> .Create().Dialog <FuelTypeDlg>().DefaultTableView().SearchColumn("Название", x => x.Name).SearchColumn("Стоимость", x => x.Cost.ToString()).End(),
                OrmObjectMapping <MovementWagon> .Create().DefaultTableView().SearchColumn("Название", x => x.Name).End(),
                //Остальные справочники
                //OrmObjectMapping<CarProxyDocument>.Create().Dialog<ProxyDocumentDlg>().DefaultTableView().SearchColumn("Водитель", x => x.Driver != null ? x.Driver.Title : "").End(),
                OrmObjectMapping <CarProxyDocument> .Create().Dialog <CarProxyDlg>(),
                OrmObjectMapping <M2ProxyDocument> .Create().Dialog <M2ProxyDlg>(),
                OrmObjectMapping <CommentTemplate> .Create().Dialog <CommentTemplateDlg>().DefaultTableView().SearchColumn("Шаблон комментария", x => x.Comment).End(),
                OrmObjectMapping <FineTemplate> .Create().Dialog <FineTemplateDlg>().DefaultTableView().SearchColumn("Шаблон комментария", x => x.Reason).End(),
                OrmObjectMapping <PremiumTemplate> .Create().Dialog <PremiumTemplateDlg>().DefaultTableView().SearchColumn("Шаблон комментария", x => x.Reason).End(),
                OrmObjectMapping <MeasurementUnits> .Create().Dialog <MeasurementUnitsDlg>().DefaultTableView().SearchColumn("ОКЕИ", x => x.OKEI).SearchColumn("Название", x => x.Name).Column("Точность", x => x.Digits.ToString()).End(),
                OrmObjectMapping <Contact> .Create().Dialog <ContactDlg>()
                .DefaultTableView().SearchColumn("Фамилия", x => x.Surname).SearchColumn("Имя", x => x.Name).SearchColumn("Отчество", x => x.Patronymic).End(),
                OrmObjectMapping <Car> .Create().Dialog <CarsDlg>()
                .DefaultTableView().SearchColumn("Модель а/м", x => x.Model).SearchColumn("Гос. номер", x => x.RegistrationNumber).SearchColumn("Водитель", x => x.Driver != null ? x.Driver.FullName : String.Empty).End(),
                OrmObjectMapping <Order> .Create().Dialog <OrderDlg>().PopupMenu(OrderPopupMenu.GetPopupMenu),
                OrmObjectMapping <UndeliveredOrder> .Create().Dialog <UndeliveredOrderDlg>(),
                OrmObjectMapping <Organization> .Create().Dialog <OrganizationDlg>().DefaultTableView().Column("Код", x => x.Id.ToString()).SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <DeliverySchedule> .Create().Dialog <DeliveryScheduleDlg>().DefaultTableView().SearchColumn("Название", x => x.Name).SearchColumn("Время доставки", x => x.DeliveryTime).End(),
                OrmObjectMapping <ProductSpecification> .Create().Dialog <ProductSpecificationDlg>().DefaultTableView().SearchColumn("Код", x => x.Id.ToString()).SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <EquipmentType> .Create().Dialog <EquipmentTypeDlg>().DefaultTableView().Column("Название", equipmentType => equipmentType.Name).End(),
                //Связанное с клиентом
                OrmObjectMapping <Proxy> .Create().Dialog <ProxyDlg>()
                .DefaultTableView().SearchColumn("Номер", x => x.Number).SearchColumn("С", x => x.StartDate.ToShortDateString()).SearchColumn("По", x => x.ExpirationDate.ToShortDateString()).End(),
                OrmObjectMapping <DeliveryPoint> .Create().Dialog <DeliveryPointDlg>().DefaultTableView().SearchColumn("ID", x => x.Id.ToString()).Column("Адрес", x => x.Title).End(),
                OrmObjectMapping <PaidRentPackage> .Create().Dialog <PaidRentPackageDlg>()
                .DefaultTableView().SearchColumn("Название", x => x.Name).Column("Тип оборудования", x => x.EquipmentType.Name).SearchColumn("Цена в сутки", x => CurrencyWorks.GetShortCurrencyString(x.PriceDaily)).SearchColumn("Цена в месяц", x => CurrencyWorks.GetShortCurrencyString(x.PriceMonthly)).End(),
                OrmObjectMapping <FreeRentPackage> .Create().Dialog <FreeRentPackageDlg>().DefaultTableView().SearchColumn("Название", x => x.Name).Column("Тип оборудования", x => x.EquipmentType.Name).OrderAsc(x => x.Name).End(),
                OrmObjectMapping <FreeRentAgreement> .Create().Dialog <FreeRentAgreementDlg>(),
                OrmObjectMapping <DailyRentAgreement> .Create().Dialog <DailyRentAgreementDlg>(),
                OrmObjectMapping <NonfreeRentAgreement> .Create().Dialog <NonFreeRentAgreementDlg>(),
                OrmObjectMapping <SalesEquipmentAgreement> .Create().Dialog <EquipSalesAgreementDlg>(),
                OrmObjectMapping <WaterSalesAgreement> .Create().Dialog <WaterAgreementDlg>(),
                OrmObjectMapping <RepairAgreement> .Create().Dialog <RepairAgreementDlg>(),
                OrmObjectMapping <Counterparty> .Create().Dialog <CounterpartyDlg>().DefaultTableView().SearchColumn("Название", x => x.FullName).End(),
                OrmObjectMapping <Tag> .Create().Dialog <TagDlg>().DefaultTableView().SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <ClientCameFrom> .Create().Dialog <ClientCameFromDlg>().DefaultTableView().SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <CounterpartyContract> .Create().Dialog <CounterpartyContractDlg>(),
                OrmObjectMapping <DocTemplate> .Create().Dialog <DocTemplateDlg>().DefaultTableView().SearchColumn("Название", x => x.Name).Column("Тип", x => x.TemplateType.GetEnumTitle()).End(),
                OrmObjectMapping <Residue> .Create().Dialog <ResidueDlg>(),
                OrmObjectMapping <TransferOperationDocument> .Create().Dialog <TransferOperationDocumentDlg>(),
                //Справочники с фильтрами
                OrmObjectMapping <Equipment> .Create().Dialog <EquipmentDlg>().JournalFilter <EquipmentFilter>()
                .DefaultTableView().Column("Код", x => x.Id.ToString()).SearchColumn("Номенклатура", x => x.NomenclatureName).Column("Тип", x => x.Nomenclature.Type.Name).SearchColumn("Серийный номер", x => x.Serial).Column("Дата последней обработки", x => x.LastServiceDate.ToShortDateString()).End(),
                //Логисткика
                OrmObjectMapping <RouteList> .Create().Dialog <RouteListCreateDlg>()
                .DefaultTableView().SearchColumn("Номер", x => x.Id.ToString()).Column("Дата", x => x.Date.ToShortDateString()).Column("Статус", x => x.Status.GetEnumTitle()).SearchColumn("Водитель", x => String.Format("{0} - {1}", x.Driver.FullName, x.Car.Title)).End(),
                OrmObjectMapping <RouteColumn> .Create().DefaultTableView().Column("Код", x => x.Id.ToString()).SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <DeliveryShift> .Create().Dialog <DeliveryShiftDlg>().DefaultTableView().SearchColumn("Название", x => x.Name).SearchColumn("Диапазон времени", x => x.DeliveryTime).End(),
                OrmObjectMapping <DeliveryDaySchedule> .Create().Dialog <DeliveryDayScheduleDlg>().DefaultTableView().SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <LogisticsArea> .Create().Dialog <LogisticsAreaDlg>().DefaultTableView().SearchColumn("Название", x => x.Name).Column("Город", x => x.IsCity ? "Да" : "Нет").End(),
                //Сервис
                OrmObjectMapping <ServiceClaim> .Create().Dialog <ServiceClaimDlg>().DefaultTableView().Column("Номер", x => x.Id.ToString()).Column("Тип", x => x.ServiceClaimType.GetEnumTitle()).Column("Оборудование", x => x.Equipment.Title).Column("Подмена", x => x.ReplacementEquipment != null ? "Да" : "Нет").Column("Точка доставки", x => x.DeliveryPoint.Title).End(),
                //Касса
                OrmObjectMapping <IncomeCategory> .Create().EditPermision("money_manage_cash").DefaultTableView().Column("Код", x => x.Id.ToString()).Column("Название", e => e.Name).End(),
                OrmObjectMapping <ExpenseCategory> .Create().Dialog <CashExpenseCategoryDlg>().EditPermision("money_manage_cash").DefaultTableView().Column("Код", x => x.Id.ToString()).SearchColumn("Название", e => e.Name).TreeConfig(new RecursiveTreeConfig <ExpenseCategory>(x => x.Parent, x => x.Childs)).End(),
                OrmObjectMapping <Income> .Create().Dialog <CashIncomeDlg> (),
                OrmObjectMapping <Expense> .Create().Dialog <CashExpenseDlg> (),
                OrmObjectMapping <AdvanceReport> .Create().Dialog <AdvanceReportDlg> (),
                OrmObjectMapping <Fine> .Create().Dialog <FineDlg> (),
                OrmObjectMapping <Premium> .Create().Dialog <PremiumDlg> (),
                //Банкинг
                OrmObjectMapping <AccountIncome> .Create(),
                OrmObjectMapping <AccountExpense> .Create(),
                //Склад
                OrmObjectMapping <Warehouse> .Create().Dialog <WarehouseDlg>().DefaultTableView().Column("Название", w => w.Name).Column("В архиве", w => w.IsArchive ? "Да":"").End(),
                OrmObjectMapping <RegradingOfGoodsTemplate> .Create().Dialog <RegradingOfGoodsTemplateDlg>().DefaultTableView().Column("Название", w => w.Name).End()
            };

            #region Складские документы
            OrmMain.AddObjectDescription <IncomingInvoice>().Dialog <IncomingInvoiceDlg>();
            OrmMain.AddObjectDescription <IncomingWater>().Dialog <IncomingWaterDlg>();
            OrmMain.AddObjectDescription <MovementDocument>().Dialog <MovementDocumentDlg>();
            OrmMain.AddObjectDescription <WriteoffDocument>().Dialog <WriteoffDocumentDlg>();
            OrmMain.AddObjectDescription <InventoryDocument>().Dialog <InventoryDocumentDlg>();
            OrmMain.AddObjectDescription <ShiftChangeWarehouseDocument>().Dialog <ShiftChangeWarehouseDocumentDlg>();
            OrmMain.AddObjectDescription <RegradingOfGoodsDocument>().Dialog <RegradingOfGoodsDocumentDlg>();
            OrmMain.AddObjectDescription <SelfDeliveryDocument>().Dialog <SelfDeliveryDocumentDlg>();
            OrmMain.AddObjectDescription <CarLoadDocument>().Dialog <CarLoadDocumentDlg>();
            OrmMain.AddObjectDescription <CarUnloadDocument>().Dialog <CarUnloadDocumentDlg>();
            #endregion

            #region Goods
            OrmMain.AddObjectDescription <Nomenclature>().Dialog <NomenclatureDlg>().JournalFilter <NomenclatureFilter>().DefaultTableView().SearchColumn("Код", x => x.Id.ToString()).SearchColumn("Название", x => x.Name).Column("Тип", x => x.CategoryString).End();
            OrmMain.AddObjectDescription <Folder1c>().Dialog <Folder1cDlg>().DefaultTableView().SearchColumn("Код 1С", x => x.Code1c).SearchColumn("Название", x => x.Name).TreeConfig(new RecursiveTreeConfig <Folder1c>(x => x.Parent, x => x.Childs)).End();
            OrmMain.AddObjectDescription <ProductGroup>().Dialog <ProductGroupDlg>().EditPermision("can_edit_online_store").DefaultTableView().SearchColumn("Код", x => x.Id.ToString()).SearchColumn("Название", x => x.Name).TreeConfig(new RecursiveTreeConfig <ProductGroup>(x => x.Parent, x => x.Childs)).End();
            #endregion

            OrmMain.AddObjectDescription <DiscountReason>().DefaultTableView().SearchColumn("Название", x => x.Name).End();

            # region Простые справочники
Esempio n. 11
0
        void CalculateTotal()
        {
            decimal sum = FineUoW.Root.Items.Sum(x => x.Money);

            labelTotal.LabelProp = String.Format("Итого по сотрудникам: {0}", CurrencyWorks.GetShortCurrencyString(sum));
        }
        public ShiftChangeWarehouseDocumentItemsView()
        {
            this.Build();

            ytreeviewItems.ColumnsConfig = ColumnsConfigFactory.Create <ShiftChangeWarehouseDocumentItem>()
                                           .AddColumn("Номенклатура").AddTextRenderer(x => x.Nomenclature.Name)
                                           .AddColumn("Кол-во в учёте").AddTextRenderer(x => x.Nomenclature.Unit != null ? x.Nomenclature.Unit.MakeAmountShortStr(x.AmountInDB) : x.AmountInDB.ToString())
                                           .AddColumn("Кол-во по факту").AddNumericRenderer(x => x.AmountInFact).Editing()
                                           .Adjustment(new Gtk.Adjustment(0, 0, 10000000, 1, 10, 10))
                                           .AddSetter((w, x) => w.Digits = (x.Nomenclature.Unit != null ? (uint)x.Nomenclature.Unit.Digits : 1))
                                           .AddColumn("Разница").AddTextRenderer(x => x.Difference != 0 && x.Nomenclature.Unit != null ? x.Nomenclature.Unit.MakeAmountShortStr(x.Difference) : String.Empty)
                                           .AddSetter((w, x) => w.Foreground = x.Difference < 0 ? "red" : "blue")
                                           .AddColumn("Сумма ущерба").AddTextRenderer(x => CurrencyWorks.GetShortCurrencyString(x.SumOfDamage))
                                           .AddColumn("Что произошло").AddTextRenderer(x => x.Comment).Editable()
                                           .Finish();
        }
Esempio n. 13
0
        public InventoryDocumentItemsView()
        {
            this.Build();

            ytreeviewItems.ColumnsConfig = ColumnsConfigFactory.Create <InventoryDocumentItem>()
                                           .AddColumn("Номенклатура").AddTextRenderer(x => GetNomenclatureName(x.Nomenclature), useMarkup: true)
                                           .AddColumn("Кол-во в учёте").AddTextRenderer(x => x.Nomenclature.Unit != null ? x.Nomenclature.Unit.MakeAmountShortStr(x.AmountInDB) : x.AmountInDB.ToString())
                                           .AddColumn("Кол-во по факту").AddNumericRenderer(x => x.AmountInFact).Editing()
                                           .Adjustment(new Gtk.Adjustment(0, 0, 10000000, 1, 10, 10))
                                           .AddSetter((w, x) => w.Digits = (x.Nomenclature.Unit != null ? (uint)x.Nomenclature.Unit.Digits : 1))
                                           .AddColumn("Разница").AddTextRenderer(x => x.Difference != 0 && x.Nomenclature.Unit != null ? x.Nomenclature.Unit.MakeAmountShortStr(x.Difference) : String.Empty)
                                           .AddSetter((w, x) => w.Foreground = x.Difference < 0 ? "red" : "blue")
                                           .AddColumn("Сумма ущерба").AddTextRenderer(x => CurrencyWorks.GetShortCurrencyString(x.SumOfDamage))
                                           .AddColumn("Штраф").AddTextRenderer(x => x.Fine != null ? x.Fine.Description : String.Empty)
                                           .AddColumn("Что произошло").AddTextRenderer(x => x.Comment).Editable()
                                           .RowCells()
                                           .AddSetter <CellRenderer>((cell, node) => {
                Color color = new Color(255, 255, 255);
                if (nomenclaturesWithDiscrepancies.Any(x => x.Id == node.Nomenclature.Id))
                {
                    color = new Color(255, 125, 125);
                }
                cell.CellBackgroundGdk = color;
            })
                                           .Finish();

            ytreeviewItems.Selection.Changed += YtreeviewItems_Selection_Changed;
        }
Esempio n. 14
0
        public RegradingOfGoodsDocumentItemsView()
        {
            this.Build();
            var colorWhite    = new Gdk.Color(0xff, 0xff, 0xff);
            var colorLightRed = new Gdk.Color(0xff, 0x66, 0x66);

            List <CullingCategory> types;

            using (IUnitOfWork uow = UnitOfWorkFactory.CreateWithoutRoot()) {
                types = uow.GetAll <CullingCategory>().OrderBy(c => c.Name).ToList();
            }

            ytreeviewItems.ColumnsConfig = ColumnsConfigFactory.Create <RegradingOfGoodsDocumentItem>()
                                           .AddColumn("Старая номенклатура").AddTextRenderer(x => x.NomenclatureOld.Name)
                                           .AddColumn("Кол-во на складе").AddTextRenderer(x => x.NomenclatureOld.Unit.MakeAmountShortStr(x.AmountInStock))
                                           .AddColumn("Новая номенклатура").AddTextRenderer(x => x.NomenclatureNew.Name)
                                           .AddColumn("Кол-во пересортицы").AddNumericRenderer(x => x.Amount).Editing()
                                           .AddSetter(
                (w, x) => w.Adjustment = new Gtk.Adjustment(
                    0,
                    0,
                    GetMaxValueForAdjustmentSetting(x),
                    1,
                    10,
                    10
                    )
                )
                                           .AddSetter((w, x) => w.Digits = (uint)x.NomenclatureNew.Unit.Digits)
                                           .AddSetter(
                (w, x) => x.Amount = x.Amount > (decimal)GetMaxValueForAdjustmentSetting(x)
                                        ? (decimal)GetMaxValueForAdjustmentSetting(x)
                                        : x.Amount
                )
                                           .AddColumn("Сумма ущерба").AddTextRenderer(x => CurrencyWorks.GetShortCurrencyString(x.SumOfDamage))
                                           .AddColumn("Штраф").AddTextRenderer(x => x.Fine != null ? x.Fine.Description : String.Empty)
                                           .AddColumn("Тип брака")
                                           .AddComboRenderer(x => x.TypeOfDefect)
                                           .SetDisplayFunc(x => x.Name)
                                           .FillItems(types)
                                           .AddSetter(
                (c, n) =>
            {
                if (!n.NomenclatureNew.IsDefectiveBottle)
                {
                    n.TypeOfDefect = null;
                }
                c.Editable      = n.NomenclatureNew.IsDefectiveBottle;
                c.BackgroundGdk = n.NomenclatureNew.IsDefectiveBottle && n.TypeOfDefect == null
                                                                ? colorLightRed
                                                                : colorWhite;
            }
                )
                                           .AddColumn("Источник\nбрака")
                                           .AddEnumRenderer(x => x.Source, true, new Enum[] { DefectSource.None })
                                           .AddSetter(
                (c, n) =>
            {
                if (!n.NomenclatureNew.IsDefectiveBottle)
                {
                    n.Source = DefectSource.None;
                }
                c.Editable      = n.NomenclatureNew.IsDefectiveBottle;
                c.BackgroundGdk = n.NomenclatureNew.IsDefectiveBottle && n.Source == DefectSource.None
                                                                ? colorLightRed
                                                                : colorWhite;
            }
                )
                                           .AddColumn("Что произошло").AddTextRenderer(x => x.Comment).Editable()
                                           .Finish();
            ytreeviewItems.Selection.Changed += YtreeviewItems_Selection_Changed;
        }
        public void CreateApplicationConfig()
        {
            logger.Debug("Конфигурация маппингов диалогов, HistoryTrace, принтеров и ParentReference...");

            #region Dialogs mapping

            OrmMain.ClassMappingList = new List <IOrmObjectMapping> {
                //Простые справочники
                OrmObjectMapping <CullingCategory> .Create().DefaultTableView().SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <Nationality> .Create().DefaultTableView().SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <Citizenship> .Create().DefaultTableView().SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <Manufacturer> .Create().DefaultTableView().SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <EquipmentColors> .Create().DefaultTableView().SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <User> .Create().DefaultTableView().SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <UserSettings> .Create().Dialog <UserSettingsView>(),
                OrmObjectMapping <FuelType> .Create().Dialog <FuelTypeViewModel>().DefaultTableView()
                .SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <MovementWagon> .Create().Dialog <MovementWagonViewModel>().DefaultTableView()
                .SearchColumn("Название", x => x.Name).End(),
                //Остальные справочники
                OrmObjectMapping <CarProxyDocument> .Create().Dialog <CarProxyDlg>(),
                OrmObjectMapping <M2ProxyDocument> .Create().Dialog <M2ProxyDlg>(),
                OrmObjectMapping <ProductGroup> .Create().Dialog <ProductGroupDlg>(),
                OrmObjectMapping <CommentTemplate> .Create().Dialog <CommentTemplateDlg>().DefaultTableView()
                .SearchColumn("Шаблон комментария", x => x.Comment).End(),
                OrmObjectMapping <FineTemplate> .Create().Dialog <FineTemplateDlg>().DefaultTableView()
                .SearchColumn("Шаблон комментария", x => x.Reason).End(),
                OrmObjectMapping <MeasurementUnits> .Create().Dialog <MeasurementUnitsDlg>().DefaultTableView()
                .SearchColumn("ОКЕИ", x => x.OKEI).SearchColumn("Название", x => x.Name).Column("Точность", x => x.Digits.ToString())
                .End(),
                OrmObjectMapping <Contact> .Create().Dialog <ContactDlg>()
                .DefaultTableView().SearchColumn("Фамилия", x => x.Surname).SearchColumn("Имя", x => x.Name)
                .SearchColumn("Отчество", x => x.Patronymic).End(),
                OrmObjectMapping <Order> .Create().Dialog <OrderDlg>().PopupMenu(OrderPopupMenu.GetPopupMenu),
                OrmObjectMapping <UndeliveredOrder> .Create().Dialog <UndeliveredOrderDlg>(),
                OrmObjectMapping <Organization> .Create().Dialog <OrganizationDlg>().DefaultTableView().Column("Код", x => x.Id.ToString())
                .SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <DeliverySchedule> .Create().Dialog <DeliveryScheduleDlg>().DefaultTableView()
                .SearchColumn("Название", x => x.Name)
                .SearchColumn("Время доставки", x => x.DeliveryTime)
                .Column("Архивный?", x => x.IsArchive ? "Да" : string.Empty)
                .OrderAsc(x => x.IsArchive).OrderAsc(x => x.From).OrderAsc(x => x.To)
                .End(),
                OrmObjectMapping <ProductSpecification> .Create().Dialog <ProductSpecificationDlg>().DefaultTableView()
                .SearchColumn("Код", x => x.Id.ToString()).SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <EquipmentKind> .Create().Dialog <EquipmentKindDlg>().DefaultTableView()
                .Column("Название", equipmentKind => equipmentKind.Name).End(),
                //Связанное с клиентом
                OrmObjectMapping <Proxy> .Create().Dialog <ProxyDlg>()
                .DefaultTableView().SearchColumn("Номер", x => x.Number).SearchColumn("С", x => x.StartDate.ToShortDateString())
                .SearchColumn("По", x => x.ExpirationDate.ToShortDateString()).End(),
                OrmObjectMapping <PaidRentPackage> .Create().Dialog <PaidRentPackageDlg>()
                .DefaultTableView().SearchColumn("Название", x => x.Name).Column("Вид оборудования", x => x.EquipmentKind.Name)
                .SearchColumn("Цена в сутки", x => CurrencyWorks.GetShortCurrencyString(x.PriceDaily))
                .SearchColumn("Цена в месяц", x => CurrencyWorks.GetShortCurrencyString(x.PriceMonthly)).End(),
                OrmObjectMapping <FreeRentPackage> .Create().Dialog <FreeRentPackageDlg>().DefaultTableView()
                .SearchColumn("Название", x => x.Name).Column("Вид оборудования", x => x.EquipmentKind.Name).OrderAsc(x => x.Name)
                .End(),
                OrmObjectMapping <Counterparty> .Create().Dialog <CounterpartyDlg>().DefaultTableView()
                .SearchColumn("Название", x => x.FullName).End(),
                OrmObjectMapping <Tag> .Create().Dialog <TagDlg>().DefaultTableView().SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <CounterpartyContract> .Create().Dialog <CounterpartyContractDlg>(),
                OrmObjectMapping <DocTemplate> .Create().Dialog <DocTemplateDlg>().DefaultTableView().SearchColumn("Название", x => x.Name)
                .Column("Тип", x => x.TemplateType.GetEnumTitle()).End(),
                OrmObjectMapping <TransferOperationDocument> .Create().Dialog <TransferOperationDocumentDlg>(),
                //Справочники с фильтрами
                OrmObjectMapping <Equipment> .Create().Dialog <EquipmentDlg>().JournalFilter <EquipmentFilter>()
                .DefaultTableView().Column("Код", x => x.Id.ToString()).SearchColumn("Номенклатура", x => x.NomenclatureName)
                .Column("Тип", x => x.Nomenclature.Kind.Name).SearchColumn("Серийный номер", x => x.Serial)
                .Column("Дата последней обработки", x => x.LastServiceDate.ToShortDateString()).End(),
                //Логисткика
                OrmObjectMapping <RouteList> .Create().Dialog <RouteListCreateDlg>()
                .DefaultTableView().SearchColumn("Номер", x => x.Id.ToString()).Column("Дата", x => x.Date.ToShortDateString())
                .Column("Статус", x => x.Status.GetEnumTitle())
                .SearchColumn("Водитель", x => String.Format("{0} - {1}", x.Driver.FullName, x.Car.Title)).End(),
                OrmObjectMapping <RouteColumn> .Create().DefaultTableView().Column("Код", x => x.Id.ToString())
                .SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <DeliveryShift> .Create().Dialog <DeliveryShiftDlg>().DefaultTableView().SearchColumn("Название", x => x.Name)
                .SearchColumn("Диапазон времени", x => x.DeliveryTime).End(),
                OrmObjectMapping <DeliveryDaySchedule> .Create().Dialog <DeliveryDayScheduleDlg>().DefaultTableView()
                .SearchColumn("Название", x => x.Name).End(),
                //Сервис
                OrmObjectMapping <ServiceClaim> .Create().Dialog <ServiceClaimDlg>().DefaultTableView().Column("Номер", x => x.Id.ToString())
                .Column("Тип", x => x.ServiceClaimType.GetEnumTitle()).Column("Оборудование", x => x.Equipment.Title)
                .Column("Подмена", x => x.ReplacementEquipment != null ? "Да" : "Нет")
                .Column("Точка доставки", x => x.DeliveryPoint.Title).End(),
                //Касса
                OrmObjectMapping <Income> .Create().Dialog <CashIncomeDlg>(),
                OrmObjectMapping <ExpenseCategory> .Create().Dialog <ExpenseCategoryViewModel>().DefaultTableView()
                .Column("Код", x => x.Id.ToString()).SearchColumn("Название", e => e.Name)
                .Column("Тип документа", e => e.ExpenseDocumentType.GetEnumTitle())
                .TreeConfig(new RecursiveTreeConfig <ExpenseCategory>(x => x.Parent, x => x.Childs)).End(),
                OrmObjectMapping <Expense> .Create().Dialog <CashExpenseDlg>(),
                OrmObjectMapping <AdvanceReport> .Create().Dialog <AdvanceReportDlg>(),
                OrmObjectMapping <Fine> .Create().Dialog <FineDlg>(),
                OrmObjectMapping <IncomeCashTransferDocument> .Create().Dialog <IncomeCashTransferDlg>(),
                OrmObjectMapping <CommonCashTransferDocument> .Create().Dialog <CommonCashTransferDlg>(),
                //Банкинг
                OrmObjectMapping <AccountIncome> .Create(),
                OrmObjectMapping <AccountExpense> .Create(),
                //Склад
                OrmObjectMapping <Warehouse> .Create().Dialog <WarehouseDlg>().DefaultTableView().Column("Название", w => w.Name)
                .Column("В архиве", w => w.IsArchive ? "Да" : "").End(),
                OrmObjectMapping <RegradingOfGoodsTemplate> .Create().Dialog <RegradingOfGoodsTemplateDlg>().DefaultTableView()
                .Column("Название", w => w.Name).End(),
                OrmObjectMapping <CarEventType> .Create().Dialog <CarEventTypeViewModel>()
            };

            #region Складские документы

            OrmMain.AddObjectDescription <IncomingWater>().Dialog <IncomingWaterDlg>();
            OrmMain.AddObjectDescription <WriteoffDocument>().Dialog <WriteoffDocumentDlg>();
            OrmMain.AddObjectDescription <InventoryDocument>().Dialog <InventoryDocumentDlg>();
            OrmMain.AddObjectDescription <ShiftChangeWarehouseDocument>().Dialog <ShiftChangeWarehouseDocumentDlg>();
            OrmMain.AddObjectDescription <RegradingOfGoodsDocument>().Dialog <RegradingOfGoodsDocumentDlg>();
            OrmMain.AddObjectDescription <SelfDeliveryDocument>().Dialog <SelfDeliveryDocumentDlg>();
            OrmMain.AddObjectDescription <CarLoadDocument>().Dialog <CarLoadDocumentDlg>();
            OrmMain.AddObjectDescription <CarUnloadDocument>().Dialog <CarUnloadDocumentDlg>();

            #endregion

            #region Goods

            OrmMain.AddObjectDescription <Nomenclature>().Dialog <NomenclatureDlg>().JournalFilter <NomenclatureFilter>().DefaultTableView()
            .SearchColumn("Код", x => x.Id.ToString())
            .SearchColumn("Название", x => x.Name)
            .Column("Тип", x => x.CategoryString)
            .SearchColumn("Номер в ИМ", x => x.OnlineStoreExternalId)
            .End();
            OrmMain.AddObjectDescription <Folder1c>().Dialog <Folder1cDlg>()
            .DefaultTableView()
            .SearchColumn("Код 1С", x => x.Code1c)
            .SearchColumn("Название", x => x.Name)
            .TreeConfig(new RecursiveTreeConfig <Folder1c>(x => x.Parent, x => x.Childs)).End();

            #endregion

            #region Простые справочники

            OrmMain.AddObjectDescription <GeographicGroup>()
            .Dialog <GeographicGroupDlg>()
            .DefaultTableView()
            .SearchColumn("Название", x => x.Name)
            .Column("Код", x => x.Id.ToString())
            .End();
            OrmMain.AddObjectDescription <NonReturnReason>()
            .DefaultTableView()
            .SearchColumn("Код", x => x.Id.ToString())
            .SearchColumn("Название", x => x.Name)
            .End();
            OrmMain.AddObjectDescription <PaymentFrom>()
            .DefaultTableView()
            .SearchColumn("Код", x => x.Id.ToString())
            .SearchColumn("Название", x => x.Name)
            .End();
            OrmMain.AddObjectDescription <Post>()
            .DefaultTableView()
            .SearchColumn("Код", x => x.Id.ToString())
            .SearchColumn("Название", x => x.Name)
            .End();
            OrmMain.AddObjectDescription <SalesChannel>()
            .DefaultTableView()
            .SearchColumn("Код", x => x.Id.ToString())
            .SearchColumn("Название", x => x.Name)
            .End();

            #endregion

            #region неПростые справочники

            OrmMain.AddObjectDescription <Subdivision>().Dialog <SubdivisionDlg>().DefaultTableView().SearchColumn("Название", x => x.Name)
            .Column("Руководитель", x => x.Chief == null ? "" : x.Chief.ShortName).SearchColumn("Номер", x => x.Id.ToString())
            .TreeConfig(new RecursiveTreeConfig <Subdivision>(x => x.ParentSubdivision, x => x.ChildSubdivisions)).End();
            OrmMain.AddObjectDescription <TypeOfEntity>()
            .Dialog <TypeOfEntityDlg>()
            .DefaultTableView()
            .SearchColumn("Тип документа", x => TypeOfEntityRepository.GetEntityNameByString(x.Type))
            .SearchColumn("Название документа", x => x.CustomName)
            .SearchColumn("Код", x => x.Id.ToString())
            .Column("Активно", x => !x.IsActive ? "нет" : String.Empty)
            .SearchColumn("Имя класса", x => x.Type)
            .OrderAsc(x => x.CustomName)
            .End();
            OrmMain.AddObjectDescription <Trainee>().Dialog <TraineeDlg>().DefaultTableView()
            .Column("Код", x => x.Id.ToString())
            .SearchColumn("Ф.И.О.", x => x.FullName)
            .OrderAsc(x => x.LastName).OrderAsc(x => x.Name).OrderAsc(x => x.Patronymic)
            .End();
            OrmMain.AddObjectDescription <DeliveryPriceRule>().Dialog <DeliveryPriceRuleDlg>().DefaultTableView()
            .Column("< 19л б.", x => x.Water19LCount.ToString())
            .Column("< 6л б.", x => x.Water6LCount)
            .Column("< 1,5л б.", x => x.Water1500mlCount)
            .Column("< 0,6л б.", x => x.Water600mlCount)
            .Column("< 0,5л б.", x => x.Water500mlCount)
            .Column("Минимальная сумма заказа", x => x.OrderMinSumEShopGoods.ToString())
            .SearchColumn("Описание правила", x => x.Title)
            .End();
            OrmMain.AddObjectDescription <Certificate>().Dialog <CertificateDlg>().DefaultTableView()
            .SearchColumn("Имя", x => x.Name)
            .Column("Тип", x => x.TypeOfCertificate.GetEnumTitle())
            .SearchColumn("Номер", x => x.Id.ToString())
            .SearchColumn("Начало срока", x => x.StartDate.HasValue ? x.StartDate.Value.ToString("dd.MM.yyyy") : "Ошибка!")
            .SearchColumn("Окончание срока",
                          x => x.ExpirationDate.HasValue ? x.ExpirationDate.Value.ToString("dd.MM.yyyy") : "Бессрочно")
            .Column("Архивный?", x => x.IsArchive ? "Да" : string.Empty)
            .OrderAsc(x => x.IsArchive)
            .OrderAsc(x => x.Id)
            .End();
            OrmMain.AddObjectDescription <StoredResource>().Dialog <ImageLoaderDlg>().DefaultTableView()
            .SearchColumn("Номер", x => x.Id.ToString())
            .SearchColumn("Название", x => x.Name)
            .End();
            OrmMain.AddObjectDescription <DeliveryPointCategory>().Dialog <DeliveryPointCategoryDlg>().DefaultTableView()
            .SearchColumn("Код", x => x.Id.ToString())
            .SearchColumn("Название", x => x.Name)
            .Column("В архиве?", x => x.IsArchive ? "Да" : "Нет")
            .OrderAsc(x => x.Name)
            .End();
            OrmMain.AddObjectDescription <CounterpartyActivityKind>().Dialog <CounterpartyActivityKindDlg>().DefaultTableView()
            .SearchColumn("Код", x => x.Id.ToString())
            .SearchColumn("Название", x => x.Name)
            .End();

            #endregion

            OrmMain.ClassMappingList.AddRange(QSBanks.QSBanksMain.GetModuleMaping());

            #endregion

            HistoryMain.Enable();
            TemplatePrinter.InitPrinter();
            ImagePrinter.InitPrinter();

            logger.Debug("OK");
        }
Esempio n. 16
0
        public void Refresh()
        {
            DeliveryPoint = (InfoProvider as IDeliveryPointInfoProvider)?.DeliveryPoint;
            if (DeliveryPoint == null)
            {
                buttonSaveComment.Sensitive = false;
                return;
            }
            buttonSaveComment.Sensitive = true;
            labelAddress.Text           = DeliveryPoint.CompiledAddress;

            foreach (var child in PhonesTable.Children)
            {
                PhonesTable.Remove(child);
                child.Destroy();
            }

            uint rowsCount = Convert.ToUInt32(DeliveryPoint.Phones.Count) + 1;

            PhonesTable.Resize(rowsCount, 2);
            for (uint row = 0; row < rowsCount - 1; row++)
            {
                Label label = new Label();
                label.Selectable = true;
                label.Markup     = $"{DeliveryPoint.Phones[Convert.ToInt32(row)].LongText}";

                HandsetView handsetView = new HandsetView(DeliveryPoint.Phones[Convert.ToInt32(row)].DigitsNumber);

                PhonesTable.Attach(label, 0, 1, row, row + 1);
                PhonesTable.Attach(handsetView, 1, 2, row, row + 1);
            }

            Label labelAddPhone = new Label()
            {
                LabelProp = "Щёлкните чтоб\n добавить телефон-->"
            };

            PhonesTable.Attach(labelAddPhone, 0, 1, rowsCount - 1, rowsCount);

            Image addIcon = new Image();

            addIcon.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-add", IconSize.Menu);
            Button btn = new Button();

            btn.Image    = addIcon;
            btn.Clicked += OnBtnAddPhoneClicked;
            PhonesTable.Attach(btn, 1, 2, rowsCount - 1, rowsCount);
            PhonesTable.ShowAll();

            var bottlesAtDeliveryPoint  = BottlesRepository.GetBottlesAtDeliveryPoint(InfoProvider.UoW, DeliveryPoint);
            var bottlesAvgDeliveryPoint = DeliveryPointRepository.GetAvgBottlesOrdered(InfoProvider.UoW, DeliveryPoint, 5);

            lblBottlesQty.LabelProp = $"{bottlesAtDeliveryPoint} шт. (сред. зак.: {bottlesAvgDeliveryPoint:G3})";
            var bottlesAtCounterparty = BottlesRepository.GetBottlesAtCounterparty(InfoProvider.UoW, DeliveryPoint.Counterparty);

            debtByClientLabel.LabelProp = $"{bottlesAtCounterparty} шт.";
            var depositsAtDeliveryPoint = DepositRepository.GetDepositsAtDeliveryPoint(InfoProvider.UoW, DeliveryPoint, null);

            labelDeposits.LabelProp     = CurrencyWorks.GetShortCurrencyString(depositsAtDeliveryPoint);
            textviewComment.Buffer.Text = DeliveryPoint.Comment;

            var currentOrders = OrderRepository.GetLatestOrdersForDeliveryPoint(InfoProvider.UoW, DeliveryPoint, 5);

            ytreeLastOrders.SetItemsSource <Order>(currentOrders);
            vboxLastOrders.Visible = currentOrders.Any();

            table2.ShowAll();
        }
Esempio n. 17
0
        private void SetLabelsAcordingToNewOrder()
        {
            lblTransferDate.Text = undelivery.NewOrder == null ?
                                   "Заказ не\nсоздан" :
                                   undelivery.NewOrder.Title + " на сумму " + String.Format(CurrencyWorks.GetShortCurrencyString(undelivery.NewOrder.TotalSum));
            btnNewOrder.Label = undelivery.NewOrder == null ? "Создать новый заказ" : "Открыть заказ";

            SetVisibilities();
        }
Esempio n. 18
0
        private void ConfigureView()
        {
            #region Bindings
            ylabelSum.Binding.AddBinding(ViewModel, vm => vm.TotalSum, w => w.LabelProp).InitializeFromSource();

            ybtnAdd.Clicked      += (sender, args) => ViewModel.AddItemCommand.Execute();
            buttonDelete.Clicked += (sender, e) => ViewModel.DeleteItemCommand.Execute(GetSelectedItem());
            ViewModel.DeleteItemCommand.CanExecuteChanged += (sender, e) => buttonDelete.Sensitive = ViewModel.DeleteItemCommand.CanExecute(GetSelectedItem());

            ybtnAddFromOrders.Clicked += (sender, e) => ViewModel.FillFromOrdersCommand.Execute();
            ViewModel.FillFromOrdersCommand.CanExecuteChanged += (sender, e) => ybtnAddFromOrders.Sensitive = ViewModel.FillFromOrdersCommand.CanExecute();
            ybtnAddFromOrders.Sensitive = ViewModel.FillFromOrdersCommand.CanExecute();

            treeItemsList.Selection.Changed += (sender, args) => { buttonDelete.Sensitive = treeItemsList.Selection.CountSelectedRows() > 0; };

            labelTimeStamp.Binding.AddBinding(ViewModel.Entity, e => e.DateString, w => w.LabelProp).InitializeFromSource();
            entryInvoiceNumber.Binding.AddBinding(ViewModel.Entity, e => e.InvoiceNumber, w => w.Text).InitializeFromSource();
            entryWaybillNumber.Binding.AddBinding(ViewModel.Entity, e => e.WaybillNumber, w => w.Text).InitializeFromSource();

            lstWarehouse.SetRenderTextFunc <Domain.Store.Warehouse>(w => w.Name);
            lstWarehouse.Binding.AddBinding(ViewModel, vm => vm.Warehouses, w => w.ItemsList).InitializeFromSource();
            lstWarehouse.Binding.AddBinding(ViewModel.Entity, e => e.Warehouse, w => w.SelectedItem).InitializeFromSource();

            entityVMEntryClient.SetEntityAutocompleteSelectorFactory(
                new DefaultEntityAutocompleteSelectorFactory <Counterparty, CounterpartyJournalViewModel, CounterpartyJournalFilterViewModel>(QS.Project.Services.ServicesConfig.CommonServices)
                );
            entityVMEntryClient.Binding.AddBinding(ViewModel.Entity, s => s.Contractor, w => w.Subject).InitializeFromSource();
            entityVMEntryClient.CanEditReference = true;

            ytextviewComment.Binding.AddBinding(ViewModel.Entity, e => e.Comment, w => w.Buffer.Text).InitializeFromSource();

            btnPrint.Clicked += (sender, e) => ViewModel.PrintCommand.Execute();

            buttonSave.Clicked += (sender, e) => { ViewModel.SaveAndClose(); };
            buttonSave.Binding.AddBinding(ViewModel, vm => vm.CanCreateOrUpdate, w => w.Sensitive);

            buttonCancel.Clicked += (sender, e) => ViewModel.Close(false, QS.Navigation.CloseSource.Cancel);

            #endregion

            #region Таблица
            treeItemsList.ColumnsConfig = FluentColumnsConfig <IncomingInvoiceItem> .Create()
                                          .AddColumn("№ п/п")
                                          .AddTextRenderer(i => (i.Document.Items.IndexOf(i) + 1).ToString())
                                          .AddColumn("Наименование").AddTextRenderer(i => i.Name)
                                          .AddColumn("С/Н оборудования").AddTextRenderer(i => i.EquipmentString)
                                          .AddColumn("% НДС").AddEnumRenderer(i => i.VAT).Editing()
                                          .AddColumn("Количество")
                                          .AddNumericRenderer(i => i.Amount).Editing().WidthChars(10)
                                          .AddSetter((c, i) => c.Digits   = (i.Nomenclature.Unit == null ? 1 :(uint)i.Nomenclature.Unit.Digits))
                                          .AddSetter((c, i) => c.Editable = i.CanEditAmount)
                                          .Adjustment(new Adjustment(0, 0, 1000000, 1, 100, 0))
                                          .AddTextRenderer(i => i.Nomenclature.Unit == null ? String.Empty: i.Nomenclature.Unit.Name, false)
                                          .AddColumn("Цена закупки").AddNumericRenderer(i => i.PrimeCost).Digits(2).Editing()
                                          .Adjustment(new Adjustment(0, 0, 1000000, 1, 100, 0))
                                          .AddTextRenderer(i => CurrencyWorks.CurrencyShortName, false)
                                          .AddColumn("Сумма").AddTextRenderer(i => CurrencyWorks.GetShortCurrencyString(i.Sum))
                                          .Finish();

            treeItemsList.ItemsDataSource = ViewModel.Entity.ObservableItems;
            #endregion
        }
Esempio n. 19
0
        private void ConfigureDlg()
        {
            ylabelSubdivisions.Binding.AddBinding(ViewModel, vm => vm.SubdivisionsInWork, w => w.LabelProp).InitializeFromSource();
            ylabelCreatedBy.Binding.AddBinding(ViewModel, e => e.CreatedByAndDate, w => w.LabelProp).InitializeFromSource();
            ylabelChangedBy.Binding.AddBinding(ViewModel, e => e.ChangedByAndDate, w => w.LabelProp).InitializeFromSource();

            yentryName.Binding.AddBinding(ViewModel.Entity, e => e.ComplainantName, w => w.Text).InitializeFromSource();
            yentryName.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();
            yentryName.Binding.AddBinding(ViewModel, vm => vm.IsClientComplaint, w => w.Visible).InitializeFromSource();
            labelName.Binding.AddBinding(ViewModel, vm => vm.IsClientComplaint, w => w.Visible).InitializeFromSource();

            yenumcomboStatus.ItemsEnum = typeof(ComplaintStatuses);
            if (!ViewModel.CanClose)
            {
                yenumcomboStatus.AddEnumToHideList(new object[] { ComplaintStatuses.Closed });
            }

            yenumcomboStatus.Binding.AddSource(ViewModel)
            .AddBinding(vm => vm.Status, w => w.SelectedItem)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();

            yenumcomboStatus.EnumItemSelected += (sender, args) => ViewModel.CloseComplaint((ComplaintStatuses)args.SelectedItem);

            ydatepickerPlannedCompletionDate.Binding.AddBinding(ViewModel.Entity, e => e.PlannedCompletionDate, w => w.Date).InitializeFromSource();
            ydatepickerPlannedCompletionDate.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();

            entryCounterparty.Changed += EntryCounterparty_Changed;
            entryCounterparty.SetEntityAutocompleteSelectorFactory(ViewModel.CounterpartySelectorFactory);
            entryCounterparty.Binding.AddBinding(ViewModel.Entity, e => e.Counterparty, w => w.Subject).InitializeFromSource();
            entryCounterparty.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();
            entryCounterparty.Binding.AddBinding(ViewModel, vm => vm.IsClientComplaint, w => w.Visible).InitializeFromSource();
            labelCounterparty.Binding.AddBinding(ViewModel, vm => vm.IsClientComplaint, w => w.Visible).InitializeFromSource();

            spLstAddress.Binding.AddBinding(ViewModel, s => s.CanSelectDeliveryPoint, w => w.Sensitive).InitializeFromSource();
            spLstAddress.Binding.AddBinding(ViewModel, s => s.IsClientComplaint, w => w.Visible).InitializeFromSource();
            lblAddress.Binding.AddBinding(ViewModel, s => s.IsClientComplaint, w => w.Visible).InitializeFromSource();

            var orderSelectorFactory = new EntityAutocompleteSelectorFactory <OrderJournalViewModel>(typeof(Order), () => {
                var filter = new OrderJournalFilterViewModel(ViewModel.CounterpartyJournalFactory, ViewModel.DeliveryPointJournalFactory);

                if (ViewModel.Entity.Counterparty != null)
                {
                    filter.RestrictCounterparty = ViewModel.Entity.Counterparty;
                }

                return(new OrderJournalViewModel(filter,
                                                 UnitOfWorkFactory.GetDefaultFactory,
                                                 ServicesConfig.CommonServices,
                                                 ViewModel.EmployeeService,
                                                 ViewModel.NomenclatureRepository,
                                                 ViewModel.UserRepository,
                                                 ViewModel.OrderSelectorFactory,
                                                 ViewModel.EmployeeJournalFactory,
                                                 ViewModel.CounterpartyJournalFactory,
                                                 ViewModel.DeliveryPointJournalFactory,
                                                 ViewModel.SubdivisionJournalFactory,
                                                 ViewModel.GtkDialogsOpener,
                                                 ViewModel.UndeliveredOrdersJournalOpener,
                                                 ViewModel.NomenclatureSelector,
                                                 ViewModel.UndeliveredOrdersRepository,
                                                 ViewModel.SubdivisionRepository,
                                                 ViewModel.FileDialogService));
            });

            entryOrder.SetEntityAutocompleteSelectorFactory(orderSelectorFactory);
            entryOrder.Binding.AddBinding(ViewModel.Entity, e => e.Order, w => w.Subject).InitializeFromSource();
            entryOrder.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();
            entryOrder.Binding.AddBinding(ViewModel, vm => vm.IsClientComplaint, w => w.Visible).InitializeFromSource();
            entryOrder.ChangedByUser += (sender, e) => ViewModel.ChangeDeliveryPointCommand.Execute();
            labelOrder.Binding.AddBinding(ViewModel, vm => vm.IsClientComplaint, w => w.Visible).InitializeFromSource();

            yentryPhone.Binding.AddBinding(ViewModel.Entity, e => e.Phone, w => w.Text).InitializeFromSource();
            yhboxPhone.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();
            yhboxPhone.Binding.AddBinding(ViewModel, vm => vm.IsClientComplaint, w => w.Visible).InitializeFromSource();
            labelNamePhone.Binding.AddBinding(ViewModel, vm => vm.IsClientComplaint, w => w.Visible).InitializeFromSource();

            arrangementTextView.Binding
            .AddBinding(ViewModel.Entity, e => e.Arrangement, w => w.Buffer.Text)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();

            cmbComplaintKind.SetRenderTextFunc <ComplaintKind>(k => k.GetFullName);
            cmbComplaintKind.Binding
            .AddBinding(ViewModel, vm => vm.ComplaintKindSource, w => w.ItemsList)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .AddBinding(ViewModel.Entity, e => e.ComplaintKind, w => w.SelectedItem)
            .InitializeFromSource();

            yspeccomboboxComplaintObject.ShowSpecialStateAll = true;
            yspeccomboboxComplaintObject.Binding.AddSource(ViewModel)
            .AddBinding(vm => vm.ComplaintObjectSource, w => w.ItemsList)
            .AddBinding(vm => vm.ComplaintObject, w => w.SelectedItem)
            .AddBinding(vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();

            comboboxComplaintSource.SetRenderTextFunc <ComplaintSource>(x => x.Name);
            comboboxComplaintSource.Binding.AddBinding(ViewModel, vm => vm.ComplaintSources, w => w.ItemsList).InitializeFromSource();
            comboboxComplaintSource.Binding.AddBinding(ViewModel.Entity, e => e.ComplaintSource, w => w.SelectedItem).InitializeFromSource();
            comboboxComplaintSource.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();
            comboboxComplaintSource.Binding.AddBinding(ViewModel, vm => vm.IsClientComplaint, w => w.Visible).InitializeFromSource();
            labelSource.Binding.AddBinding(ViewModel, vm => vm.IsClientComplaint, w => w.Visible).InitializeFromSource();

            cmbComplaintResultOfCounterparty.SetRenderTextFunc <ComplaintResultOfCounterparty>(x => x.Name);
            cmbComplaintResultOfCounterparty.Binding.AddBinding(ViewModel, vm => vm.ComplaintResultsOfCounterparty, w => w.ItemsList).InitializeFromSource();
            cmbComplaintResultOfCounterparty.Binding.AddBinding(ViewModel.Entity, e => e.ComplaintResultOfCounterparty, w => w.SelectedItem).InitializeFromSource();
            cmbComplaintResultOfCounterparty.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();

            cmbComplaintResultOfEmployees.SetRenderTextFunc <ComplaintResultOfEmployees>(x => x.Name);
            cmbComplaintResultOfEmployees.Binding.AddBinding(ViewModel, vm => vm.ComplaintResultsOfEmployees, w => w.ItemsList).InitializeFromSource();
            cmbComplaintResultOfEmployees.Binding.AddBinding(ViewModel.Entity, e => e.ComplaintResultOfEmployees, w => w.SelectedItem).InitializeFromSource();
            cmbComplaintResultOfEmployees.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();

            ytextviewResultText.Binding.AddBinding(ViewModel.Entity, e => e.ResultText, w => w.Buffer.Text).InitializeFromSource();
            ytextviewResultText.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();

            complaintfilesview.ViewModel = ViewModel.FilesViewModel;

            ytextviewComplaintText.Binding.AddBinding(ViewModel.Entity, e => e.ComplaintText, w => w.Buffer.Text).InitializeFromSource();
            ytextviewComplaintText.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();

            comboType.ItemsEnum = typeof(ComplaintType);
            comboType.Binding
            .AddBinding(ViewModel.Entity, e => e.ComplaintType, w => w.SelectedItem)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();

            guiltyitemsview.ViewModel = ViewModel.GuiltyItemsViewModel;

            guiltyitemsview.Visible   = ViewModel.CanAddGuilty;
            labelNameGuilties.Visible = ViewModel.CanAddGuilty;

            vboxDicussions.Add(new ComplaintDiscussionsView(ViewModel.DiscussionsViewModel));
            vboxDicussions.ShowAll();

            ytreeviewFines.ColumnsConfig = FluentColumnsConfig <FineItem> .Create()
                                           .AddColumn("№").AddTextRenderer(x => x.Fine.Id.ToString())
                                           .AddColumn("Сотрудник").AddTextRenderer(x => x.Employee.ShortName)
                                           .AddColumn("Сумма штрафа").AddTextRenderer(x => CurrencyWorks.GetShortCurrencyString(x.Money))
                                           .Finish();

            ytreeviewFines.Binding.AddBinding(ViewModel, vm => vm.FineItems, w => w.ItemsDataSource).InitializeFromSource();

            buttonAddFine.Clicked += (sender, e) => { ViewModel.AddFineCommand.Execute(this.Tab); };
            buttonAddFine.Binding.AddBinding(ViewModel, vm => vm.CanAddFine, w => w.Sensitive).InitializeFromSource();

            buttonAttachFine.Clicked += (sender, e) => { ViewModel.AttachFineCommand.Execute(); };
            buttonAttachFine.Binding.AddBinding(ViewModel, vm => vm.CanAttachFine, w => w.Sensitive).InitializeFromSource();

            buttonSave.Clicked += (sender, e) => { ViewModel.SaveAndClose(); };
            buttonSave.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();

            buttonCancel.Clicked += (sender, e) => { ViewModel.Close(ViewModel.CanEdit, QS.Navigation.CloseSource.Cancel); };

            ViewModel.FilesViewModel.ReadOnly = !ViewModel.CanEdit;

            ViewModel.Entity.PropertyChanged += (o, e) =>
            {
                if (e.PropertyName == nameof(ViewModel.Entity.Phone))
                {
                    handsetPhone.SetPhone(ViewModel.Entity.Phone);
                }
            };
        }
Esempio n. 20
0
        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();
        }