コード例 #1
0
ファイル: PayAccrual.cs プロジェクト: QualitySolution/Bazar
        public PayAccrual()
        {
            this.Build ();

            ComboBox IncomeCombo = new ComboBox();
            ComboWorks.ComboFillReference(IncomeCombo,"income_items", ComboWorks.ListMode.OnlyItems);
            IncomeNameList = IncomeCombo.Model;
            IncomeCombo.Destroy ();

            //Создаем таблицу "Услуги"
            ServiceListStore = new Gtk.ListStore (typeof (bool),
                                                  typeof (int),
                                                  typeof (string),
                                                  typeof (int),
                                                  typeof (string),
                                                  typeof (int),
                                                  typeof (string),
                                                  typeof (decimal),
                                                  typeof(long));

            CellRendererToggle CellPay = new CellRendererToggle();
            CellPay.Activatable = true;
            CellPay.Toggled += onCellPayToggled;

            Gtk.TreeViewColumn IncomeItemsColumn = new Gtk.TreeViewColumn ();
            IncomeItemsColumn.Title = "Статья дохода";
            IncomeItemsColumn.MinWidth = 130;
            Gtk.CellRendererCombo CellIncomeItems = new CellRendererCombo();
            CellIncomeItems.TextColumn = 0;
            CellIncomeItems.Editable = true;
            CellIncomeItems.Model = IncomeNameList;
            CellIncomeItems.HasEntry = false;
            CellIncomeItems.Edited += OnIncomeItemComboEdited;
            IncomeItemsColumn.PackStart (CellIncomeItems, true);

            Gtk.TreeViewColumn SumColumn = new Gtk.TreeViewColumn ();
            SumColumn.Title = "Сумма";
            SumColumn.MinWidth = 90;
            Gtk.CellRendererText CellSum = new CellRendererText();
            CellSum.Editable = true;
            CellSum.Edited += OnSumTextEdited;
            SumColumn.PackStart (CellSum, true);

            treeviewServices.AppendColumn("Оплатить", CellPay, "active", (int)ServiceCol.pay);
            treeviewServices.AppendColumn ("Услуга", new Gtk.CellRendererText (), "text", (int)ServiceCol.service);
            treeviewServices.AppendColumn ("Касса", new Gtk.CellRendererText (), "text", (int)ServiceCol.cash);
            treeviewServices.AppendColumn (IncomeItemsColumn);
            IncomeItemsColumn.AddAttribute (CellIncomeItems, "text", (int)ServiceCol.income);
            treeviewServices.AppendColumn (SumColumn);
            SumColumn.SetCellDataFunc (CellSum, RenderSumColumn);

            treeviewServices.Model = ServiceListStore;
            treeviewServices.ShowAll();
        }
コード例 #2
0
ファイル: MeterType.cs プロジェクト: QualitySolution/Bazar
        public MeterType( bool New)
        {
            this.Build ();

            ComboBox ServiceCombo = new ComboBox();
            ComboWorks.ComboFillReference(ServiceCombo,"services", ComboWorks.ListMode.WithNo);
            ServiceNameList = ServiceCombo.Model;
            ServiceCombo.Destroy ();

            TariffListStore = new Gtk.ListStore (typeof (int), 	// 0 - tariff id
                                                  typeof (string),	// 1 - Name
                                                  typeof (int),		// 2 - Service id
                                                 typeof (string)	// 3 - Service name
                                                  );

            Gtk.CellRendererCombo CellService = new CellRendererCombo();
            CellService.TextColumn = 0;
            CellService.Editable = true;
            CellService.Model = ServiceNameList;
            CellService.HasEntry = false;
            CellService.Edited += OnServiceComboEdited;
            CellService.EditingStarted += OnServiceComboStartEdited;

            Gtk.CellRendererText CellName = new CellRendererText();
            CellName.Editable = true;
            CellName.Edited += OnCellNameEdited;

            //treeviewTariff.AppendColumn ("Код", new Gtk.CellRendererText (), "text", 0);
            treeviewTariff.AppendColumn ("Название", CellName, "text", 1);
            treeviewTariff.AppendColumn ("Услуга для оплаты", CellService, "text", 3);

            treeviewTariff.Model = TariffListStore;
            treeviewTariff.ShowAll();

            if(New)
            {
                NewItem = New;
                TariffListStore.AppendValues (-1,
                                              "Основной",
                                              -1,
                                              "нет");
            }
        }
コード例 #3
0
ファイル: Contract.cs プロジェクト: QualitySolution/Bazar
        public Contract()
        {
            this.Build ();

            ComboWorks.ComboFillReference(comboOrg, "organizations", ComboWorks.ListMode.WithNo);
            ComboWorks.ComboFillReference(comboPlaceT,"place_types", ComboWorks.ListMode.WithNo);

            ComboBox ServiceCombo = new ComboBox();
            ComboWorks.ComboFillReference(ServiceCombo,"services", ComboWorks.ListMode.OnlyItems);
            ServiceNameList = ServiceCombo.Model;
            ServiceCombo.Destroy ();

            ComboBox CashCombo = new ComboBox();
            string sqlSelect = "SELECT name, id, color FROM cash";
            ComboWorks.ComboFillUniversal(CashCombo, sqlSelect, "{0}", null, 1, ComboWorks.ListMode.OnlyItems, true);
            CashNameList = CashCombo.Model;
            CashCombo.Destroy ();

            MainClass.FillServiceListStore(out ServiceRefListStore);

            //Создаем таблицу "Услуги"
            ServiceListStore = new Gtk.ListStore (typeof(int), 	// 0 - idServiceColumn
                                                  typeof(string),	// 1 - Наименование
                                                  typeof(int),		// 2 - idКасса
                                                  typeof(string),	// 3 - Касса
                                                  typeof(string), 	// 5 - Ед. изм.
                                                  typeof(decimal), 	// 6 - Количество
                                                  typeof(decimal),	// 7 - Цена
                                                  typeof(decimal),	// 8 - Сумма
                                                  typeof(int), 	// 9 - id
                                                  typeof(bool),	// 10 - Есть ли расчет по метражу
                                                  typeof(decimal),	// 11 - Минимальный платеж.
                                                  typeof(string) 	// 12 - Цвет строки
            );

            Gtk.TreeViewColumn ServiceColumn = new Gtk.TreeViewColumn ();
            ServiceColumn.Title = "Наименование";
            ServiceColumn.MinWidth = 180;
            Gtk.CellRendererCombo CellService = new CellRendererCombo();
            CellService.TextColumn = 0;
            CellService.Editable = true;
            CellService.Model = ServiceNameList;
            CellService.HasEntry = false;
            CellService.Edited += OnServiceComboEdited;
            ServiceColumn.PackStart (CellService, true);

            Gtk.TreeViewColumn CashColumn = new Gtk.TreeViewColumn ();
            CashColumn.Title = "Касса";
            CashColumn.MinWidth = 130;
            Gtk.CellRendererCombo CellCash = new CellRendererCombo();
            CellCash.TextColumn = 0;
            CellCash.Editable = true;
            CellCash.Model = CashNameList;
            CellCash.HasEntry = false;
            CellCash.Edited += OnCashComboEdited;
            CashColumn.PackStart (CellCash, true);

            Gtk.TreeViewColumn CountColumn = new Gtk.TreeViewColumn ();
            CountColumn.Title = "Количество";
            Gtk.CellRendererText CellCount = new CellRendererText();
            CellCount.Editable = true;
            CellCount.Edited += OnServiceCountEdited;
            CountColumn.PackStart (CellCount, true);
            Gtk.CellRendererText CellUnits = new CellRendererText ();
            CountColumn.PackStart (CellUnits, false);

            Gtk.CellRendererText CellPrice = new CellRendererText();
            CellPrice.Editable = true;
            CellPrice.Edited += OnServicePriceEdited;

            Gtk.CellRendererText CellMinSum = new CellRendererText();
            CellMinSum.Editable = true;
            CellMinSum.Edited += OnServiceMinSumEdited;

            treeviewServices.AppendColumn (ServiceColumn);
            ServiceColumn.AddAttribute (CellService, "text", (int)ServiceCol.service);
            treeviewServices.AppendColumn (CashColumn);
            CashColumn.AddAttribute (CellCash,"text", (int)ServiceCol.cash);
            treeviewServices.AppendColumn (CountColumn);
            CountColumn.AddAttribute (CellUnits,"text", (int)ServiceCol.units);
            CountColumn.SetCellDataFunc (CellCount, RenderCountColumn);
            treeviewServices.AppendColumn ("Цена", CellPrice, RenderPriceColumn);
            treeviewServices.AppendColumn ("Сумма", new Gtk.CellRendererText (), RenderSumColumn);
            treeviewServices.AppendColumn ("Мин. платеж", CellMinSum, RenderMinSumColumn);

            foreach(TreeViewColumn column in treeviewServices.Columns)
            {
                foreach(CellRenderer render in column.CellRenderers)
                {
                    column.AddAttribute (render, "background", (int)ServiceCol.row_color);
                }
            }

            treeviewServices.Columns[3].MinWidth = 90;

            treeviewServices.Model = ServiceListStore;
            treeviewServices.ShowAll();

            OnTreeviewServicesCursorChanged(null, null);
        }
コード例 #4
0
        public Order()
            : base(Gtk.WindowType.Toplevel)
        {
            this.Build();
            notebook1.CurrentPage = 0;
            ComboWorks.ComboFillReference(comboExhibition, "exhibition", ComboWorks.ListMode.WithNo, true, "ordinal");
            dateArrval.Date = DateTime.Today;

            //Создаем таблицу номенклатуры
            ComboBox TempCombo = new ComboBox();
            ComboWorks.ComboFillReference(TempCombo, "materials", ComboWorks.ListMode.WithNo, true, "ordinal");
            MaterialNameList = TempCombo.Model;
            TempCombo.Destroy ();

            TempCombo = new ComboBox();
            ComboWorks.ComboFillReference(TempCombo, "facing", ComboWorks.ListMode.WithNo, true, "ordinal");
            FacingNameList = TempCombo.Model;
            TempCombo.Destroy ();

            ComponentsStore = new TreeStore(
                typeof(long), //row_id
                typeof(Nomenclature.NomType), //nomenclature_type
                typeof(int), //nomenclature_id
                typeof(string), //nomenclature
                typeof(string), //nomenclature_title
                typeof(string), //nomenclature_description
                typeof(int), //count
                typeof(int), //material_id
                typeof(string), //material
                typeof(int), //facing_id
                typeof(string), //facing
                typeof(string), //comment
                typeof(string), //price
                typeof(string), //price_total
                typeof(bool), //editable_count
                typeof(bool), //editable_price
                typeof(bool), //editable_material
                typeof(bool), //editable_facing
                typeof(bool), //editable_comment
                typeof(bool), //editable_discount
                typeof(int), //discount
                typeof(bool)); //editable_name

            BasisIter = ComponentsStore.AppendValues (
                (long)-1,
                Enum.Parse(typeof(Nomenclature.NomType), "construct"),
                1,
                null,
                "Каркас",
                null,
                1,
                -1,
                "",
                -1,
                "",
                "",
                "",
                "",
                false,
                false,
                false,
                false,
                false,
                false,
                null,
                false);

            ServiceIter = ComponentsStore.InsertNodeAfter (BasisIter);

            ComponentsStore.SetValues (
                ServiceIter,
                (long)-1,
                Enum.Parse (typeof(Nomenclature.NomType), "other"),
                1,
                null,
                "Услуги",
                "Кликните правой кнопкой мышы для добавления услуги",
                0,
                -1,
                "",
                -1,
                "",
                "",
                "",
                "",
                false,
                false,
                false,
                false,
                false,
                false,
                null,
                false);

            ColumnCount = new Gtk.TreeViewColumn ();
            ColumnCount.Title = "Кол-во";
            Gtk.CellRendererText CellCount = new CellRendererText ();
            CellCount.Editable = true;
            CellCount.Edited += OnCountEdited;
            ColumnCount.PackStart (CellCount, true);
            ColumnCount.AddAttribute(CellCount, "text", (int)ComponentCol.count);
            ColumnCount.AddAttribute(CellCount, "editable", (int)ComponentCol.editable_count);

            ColumnMaterial = new Gtk.TreeViewColumn ();
            ColumnMaterial.Title = "Отделка кубов";
            ColumnMaterial.MinWidth = 180;
            Gtk.CellRendererCombo CellMaterial = new CellRendererCombo();
            CellMaterial.TextColumn = 0;
            CellMaterial.Editable = true;
            CellMaterial.Model = MaterialNameList;
            CellMaterial.HasEntry = false;
            CellMaterial.Edited += OnMaterialComboEdited;
            ColumnMaterial.PackStart (CellMaterial, true);
            ColumnMaterial.AddAttribute(CellMaterial, "text", (int)ComponentCol.material);
            ColumnMaterial.AddAttribute(CellMaterial, "editable", (int)ComponentCol.editable_material);

            ColumnFacing = new Gtk.TreeViewColumn ();
            ColumnFacing.Title = "Отделка фасада";
            ColumnFacing.MinWidth = 180;
            Gtk.CellRendererCombo CellFacing = new CellRendererCombo();
            CellFacing.TextColumn = 0;
            CellFacing.Editable = true;
            CellFacing.Model = FacingNameList;
            CellFacing.HasEntry = false;
            CellFacing.Edited += OnFacingComboEdited;
            ColumnFacing.PackStart (CellFacing, true);
            ColumnFacing.AddAttribute(CellFacing, "text", (int)ComponentCol.facing);
            ColumnFacing.AddAttribute(CellFacing, "editable", (int)ComponentCol.editable_facing);

            ColumnPrice = new Gtk.TreeViewColumn ();
            ColumnPrice.Title = "Цена";
            ColumnPrice.Visible = false;
            Gtk.CellRendererText CellPrice = new CellRendererText ();
            CellPrice.Editable = true;
            CellPrice.Edited += OnPriceEdited;
            ColumnPrice.PackStart (CellPrice, true);
            ColumnPrice.AddAttribute(CellPrice, "text", (int)ComponentCol.price);
            ColumnPrice.AddAttribute(CellPrice, "editable", (int)ComponentCol.editable_price);

            ColumnPriceTotal = new Gtk.TreeViewColumn ();
            ColumnPriceTotal.Title = "Сумма";
            ColumnPriceTotal.Visible = false;
            Gtk.CellRendererText CellPriceTotal = new CellRendererText ();
            CellPriceTotal.Editable = false;
            ColumnPriceTotal.PackStart (CellPriceTotal, true);
            ColumnPriceTotal.AddAttribute(CellPriceTotal, "text", (int)ComponentCol.price_total);

            ColumnComment = new Gtk.TreeViewColumn ();
            ColumnComment.Title = "Комментарий";
            Gtk.CellRendererText CellComment = new Gtk.CellRendererText ();
            CellComment.WrapMode = Pango.WrapMode.WordChar;
            CellComment.WrapWidth = 500;
            CellComment.Editable = true;
            CellComment.Edited += OnCommentTextEdited;
            ColumnComment.MaxWidth = 500;
            ColumnComment.PackStart (CellComment, true);
            ColumnComment.AddAttribute(CellComment, "text", (int)ComponentCol.comment);
            ColumnComment.AddAttribute(CellComment, "editable", (int)ComponentCol.editable_comment);

            ColumnDiscount = new Gtk.TreeViewColumn ();
            ColumnDiscount.Title = "Наценка";
            Gtk.CellRendererSpin CellDiscount = new Gtk.CellRendererSpin ();
            CellDiscount.Visible = false;
            CellDiscount.Edited += OnDiscountEdited;
            CellDiscount.Adjustment = new Adjustment (0, -100, 100, 1, 10, 0);
            ColumnDiscount.PackStart (CellDiscount, true);
            ColumnDiscount.AddAttribute (CellDiscount, "text", (int)ComponentCol.discount);
            ColumnDiscount.AddAttribute (CellDiscount, "visible", (int)ComponentCol.editable_discount);
            ColumnDiscount.AddAttribute (CellDiscount, "editable", (int)ComponentCol.editable_discount);

            ColumnName = new Gtk.TreeViewColumn ();
            ColumnName.Title = "Название";
            Gtk.CellRendererText CellName = new CellRendererText ();
            CellName.Edited += OnCellNameEdited;
            ColumnName.PackStart (CellName, true);
            ColumnName.AddAttribute (CellName, "editable", (int)ComponentCol.editable_name);
            ColumnName.AddAttribute (CellName, "text", (int)ComponentCol.nomenclature_title);

            treeviewComponents.AppendColumn(ColumnName);
            treeviewComponents.AppendColumn(ColumnCount);
            treeviewComponents.AppendColumn(ColumnPrice);
            treeviewComponents.AppendColumn(ColumnDiscount);
            treeviewComponents.AppendColumn(ColumnPriceTotal);
            treeviewComponents.AppendColumn(ColumnMaterial);
            treeviewComponents.AppendColumn(ColumnFacing);
            treeviewComponents.AppendColumn(ColumnComment);
            treeviewComponents.Model = ComponentsStore;
            treeviewComponents.TooltipColumn = (int)ComponentCol.nomenclature_description;
            treeviewComponents.ShowAll();

            spinbutton1.Sensitive = false;
            spinbutton1.Value = PriceCorrection;
            checkbuttonShowPrice.Active = false;

            CurrentDrag = new DragInformation();
            //Загрузка списка кубов
            CubeList = new List<Cube>();
            CubeWidgetList = new List<CubeListItem>();
            vboxCubeList = new VBox(false, 6);
            hboxCubeList = new HBox(false, 20);
            string sql = "SELECT * FROM cubes ORDER BY ordinal";

            SqliteCommand cmd = new SqliteCommand(sql, (SqliteConnection)QSMain.ConnectionDB);
            using (SqliteDataReader rdr = cmd.ExecuteReader()) {
                while(rdr.Read()) {
                    if (rdr["image"] == DBNull.Value)
                        continue;
                    Cube TempCube = new Cube();
                    TempCube.NomenclatureId = rdr.GetInt32(rdr.GetOrdinal("id"));
                    TempCube.Name = DBWorks.GetString(rdr, "name", "");
                    TempCube.Description = DBWorks.GetString(rdr, "description", "");
                    TempCube.Height = DBWorks.GetInt(rdr, "height", 0) * 400;
                    TempCube.Widht = DBWorks.GetInt(rdr, "width", 0) * 400;
                    byte[] ImageFile = (byte[])rdr[rdr.GetOrdinal("image")];
                    TempCube.LoadSvg(ImageFile);
                    CubeList.Add(TempCube);
                    MaxCubeVSize = Math.Max(MaxCubeVSize, TempCube.CubesV);
                    MaxCubeHSize = Math.Max(MaxCubeHSize, TempCube.CubesH);

                    //Добавляем виджеты в лист
                    CubeListItem TempWidget = new CubeListItem();
                    TempCube.Widget = TempWidget;
                    TempWidget.CubeItem = TempCube;
                    TempWidget.CubePxSize = CubePxSize;
                    TempWidget.DragInfo = CurrentDrag;
                    CubeWidgetList.Add(TempWidget);
                }
                UpdateCubeList();
                scrolledCubeListV.AddWithViewport(vboxCubeList);
                scrolledCubeListH.AddWithViewport(hboxCubeList);
            }

            //Загрузка Списка типов шкафов
            TypeWidgetList = new List<CupboardListItem>();
            hboxTypeList = new HBox(false, 2);
            Stream stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream( "CupboardDesigner.icons.Yes_check.svg" );
            byte[] temparray;
            using(MemoryStream mstream = new MemoryStream()) {
                stream.CopyTo(mstream);
                temparray = mstream.ToArray();
            }
            Rsvg.Handle CheckImage = new Rsvg.Handle(temparray);
            sql = "SELECT * FROM basis ORDER BY ordinal ";
            cmd = new SqliteCommand(sql, (SqliteConnection)QSMain.ConnectionDB);
            using (SqliteDataReader rdr = cmd.ExecuteReader()) {
                Gtk.RadioButton FirstButton = null;
                while(rdr.Read()) {
                    if (rdr["image"] == DBNull.Value)
                        continue;

                    //Добавляем виджеты в лист
                    CupboardListItem TempWidget = new CupboardListItem(CheckImage);
                    TempWidget.id = rdr.GetInt32(rdr.GetOrdinal("id"));
                    TempWidget.DeltaH = rdr.GetInt32(rdr.GetOrdinal("delta_h"));
                    TempWidget.DeltaL = rdr.GetInt32(rdr.GetOrdinal("delta_l"));
                    TempWidget.ItemName = DBWorks.GetString(rdr, "name", "");
                    TempWidget.CubePxSize = CubePxSize;
                    if (FirstButton == null)
                        FirstButton = TempWidget.Button;
                    else
                        TempWidget.Button.Group = FirstButton.Group;
                    int size = DBWorks.GetInt(rdr, "image_size", 0);
                    byte[] ImageFile = new byte[size];
                    rdr.GetBytes(rdr.GetOrdinal("image"), 0, ImageFile, 0, size);
                    TempWidget.Image = new SVGHelper();
                    if (!TempWidget.Image.LoadImage(ImageFile))
                        continue;
                    TempWidget.Button.Clicked += OnBasisChanged;
                    TypeWidgetList.Add(TempWidget);
                    hboxTypeList.Add(TempWidget);
                }
                scrolledTypesH.AddWithViewport(hboxTypeList);
                hboxTypeList.ShowAll();
            }

            OrderCupboard = new Cupboard();
            OnBasisChanged(null, EventArgs.Empty);

            //Настраиваем DND
            Gtk.Drag.DestSet(drawCupboard, DestDefaults.Motion, TargetTable, Gdk.DragAction.Move);
            Gtk.Drag.SourceSet(drawCupboard, ModifierType.Button1Mask, TargetTable, Gdk.DragAction.Move);
            Gtk.Drag.DestSet(vboxCubeList, DestDefaults.Motion, TargetTable, Gdk.DragAction.Move);
            Gtk.Drag.DestSet(hboxCubeList, DestDefaults.Motion, TargetTable, Gdk.DragAction.Move);
            vboxCubeList.DragDrop += OnCubeListDragDrop;
            hboxCubeList.DragDrop += OnCubeListDragDrop;
        }
コード例 #5
0
    private void on_combo_sports_changed(object o, EventArgs args)
    {
        if (o == null)
        {
            return;
        }

        //LogB.Information("changed");
        try {
            int sportID = Convert.ToInt32(Util.FindOnArray(':', 2, 0, UtilGtk.ComboGetActive(combo_sports), sports));
            sport = SqliteSport.Select(false, sportID);

            if (Catalog.GetString(sport.Name) == Catalog.GetString(Constants.SportAny))
            {
                //if sport is undefined, level should be undefined, and unsensitive
                try {
                    combo_levels.Active = UtilGtk.ComboMakeActive(levels,
                                                                  Constants.LevelUndefinedID.ToString() + ":" +
                                                                  Catalog.GetString(Constants.LevelUndefined));
                    combo_levels.Sensitive     = false;
                    combo_speciallities.Active = UtilGtk.ComboMakeActive(speciallitiesTranslated,
                                                                         Catalog.GetString(Constants.SpeciallityUndefined));
                    label_speciallity.Hide();
                    combo_speciallities.Hide();
                }
                catch { LogB.Warning("do later"); }
            }
            else if (Catalog.GetString(sport.Name) == Catalog.GetString(Constants.SportNone))
            {
                //if sport is none, level should be sedentary and unsensitive
                try {
                    combo_levels.Active = UtilGtk.ComboMakeActive(levels,
                                                                  Constants.LevelSedentaryID.ToString() + ":" +
                                                                  Catalog.GetString(Constants.LevelSedentary));
                    combo_levels.Sensitive = false;

                    combo_speciallities.Active = UtilGtk.ComboMakeActive(speciallitiesTranslated,
                                                                         Catalog.GetString(Constants.SpeciallityUndefined));

                    label_speciallity.Hide();
                    combo_speciallities.Hide();
                }
                catch { LogB.Warning("do later"); }
            }
            else
            {
                //sport is not undefined and not none

                //if level is "sedentary", then change level to "undefined"
                if (UtilGtk.ComboGetActive(combo_levels) ==
                    Constants.LevelSedentaryID.ToString() + ":" +
                    Catalog.GetString(Constants.LevelSedentary))
                {
                    combo_levels.Active = UtilGtk.ComboMakeActive(levels,
                                                                  Constants.LevelUndefinedID.ToString() + ":" +
                                                                  Catalog.GetString(Constants.LevelUndefined));
                }

                //show level
                combo_levels.Sensitive = true;

                if (sport.HasSpeciallities)
                {
                    combo_speciallities.Destroy();
                    createComboSpeciallities(sport.UniqueID);
                    label_speciallity.Show();
                    combo_speciallities.Show();
                }
                else
                {
                    LogB.Information("hide");
                    combo_speciallities.Active = UtilGtk.ComboMakeActive(speciallitiesTranslated,
                                                                         Catalog.GetString(Constants.SpeciallityUndefined));
                    label_speciallity.Hide();
                    combo_speciallities.Hide();
                }
            }
        } catch {
            //LogB.Warning("do later");
        }

        on_entries_required_changed(new object(), new EventArgs());
        LogB.Information(sport.ToString());
    }
コード例 #6
0
        public SeparationPayment()
        {
            this.Build ();

            ComboBox IncomeCombo = new ComboBox();
            ComboWorks.ComboFillReference(IncomeCombo,"income_items", ComboWorks.ListMode.OnlyItems);
            IncomeNameList = IncomeCombo.Model;
            IncomeCombo.Destroy ();

            //Создаем таблицу "Услуги"
            ServiceListStore = new Gtk.ListStore (typeof (long), //0 payment row id
                                                  typeof (long), //1 accrual row id
                                                  typeof (string), //2 service name
                                                  typeof (int),//3 income id
                                                  typeof (string), //4 income name
                                                  typeof (decimal),// 5 accrual sum
                                                  typeof (decimal), // 6 paid sum
                                                  typeof (decimal) // 7 other paid
                                                  );

            Gtk.TreeViewColumn IncomeItemsColumn = new Gtk.TreeViewColumn ();
            IncomeItemsColumn.Title = "Статья дохода";
            IncomeItemsColumn.MinWidth = 130;
            Gtk.CellRendererCombo CellIncomeItems = new CellRendererCombo();
            CellIncomeItems.TextColumn = 0;
            CellIncomeItems.Editable = true;
            CellIncomeItems.Model = IncomeNameList;
            CellIncomeItems.HasEntry = false;
            CellIncomeItems.Edited += OnIncomeItemComboEdited;
            IncomeItemsColumn.PackStart (CellIncomeItems, true);

            Gtk.TreeViewColumn AccrualColumn = new Gtk.TreeViewColumn ();
            AccrualColumn.Title = "Начислено";
            Gtk.CellRendererText CellAccrual = new CellRendererText();
            AccrualColumn.PackStart (CellAccrual, true);

            Gtk.TreeViewColumn PaidColumn = new Gtk.TreeViewColumn ();
            PaidColumn.Title = "Оплата";
            PaidColumn.MinWidth = 90;
            Gtk.CellRendererText CellPaid = new CellRendererText();
            CellPaid.Editable = true;
            CellPaid.Edited += OnPaidTextEdited;
            PaidColumn.PackStart (CellPaid, true);

            Gtk.TreeViewColumn OtherPaidColumn = new Gtk.TreeViewColumn ();
            OtherPaidColumn.Title = "Другие платежи";
            Gtk.CellRendererText CellOtherPaid = new CellRendererText();
            OtherPaidColumn.PackStart (CellOtherPaid, true);

            //ID payment row - 0
            //ID accrual row - 1
            treeviewServices.AppendColumn ("Услуга", new Gtk.CellRendererText (), "text", 2);
            treeviewServices.AppendColumn (IncomeItemsColumn);
            IncomeItemsColumn.AddAttribute (CellIncomeItems,"text", 4);
            treeviewServices.AppendColumn (AccrualColumn);
            AccrualColumn.SetCellDataFunc (CellAccrual, RenderAccrualColumn);
            treeviewServices.AppendColumn (PaidColumn);
            PaidColumn.SetCellDataFunc (CellPaid, RenderPaidColumn);
            treeviewServices.AppendColumn (OtherPaidColumn);
            OtherPaidColumn.SetCellDataFunc (CellOtherPaid, RenderOtherPaidColumn);

            treeviewServices.Model = ServiceListStore;
            treeviewServices.ShowAll();

            buttonAdd.Sensitive = false;
            buttonDel.Sensitive = false;
        }
コード例 #7
0
ファイル: Accrual.cs プロジェクト: QualitySolution/Bazar
        public Accrual()
        {
            this.Build ();
            allPendingMeterReadings = new Dictionary<TreeIter, List<PendingMeterReading>>();
            MainClass.ComboAccrualYearsFill (comboAccuralYear);

            ComboBox ServiceCombo = new ComboBox();
            ComboWorks.ComboFillReference(ServiceCombo,"services", ComboWorks.ListMode.OnlyItems);
            ServiceNameList = ServiceCombo.Model;
            ServiceCombo.Destroy ();

            ComboBox CashCombo = new ComboBox();
            string sqlSelect = "SELECT name, id, color FROM cash";
            ComboWorks.ComboFillUniversal(CashCombo, sqlSelect, "{0}", null, 1, ComboWorks.ListMode.OnlyItems, true);
            CashNameList = CashCombo.Model;
            CashCombo.Destroy ();

            MainClass.FillServiceListStore(out ServiceRefListStore);

            //Создаем таблицу "Услуги"
            ServiceListStore = new Gtk.ListStore (typeof (int), 	//0 - service id
                                                  typeof (string),	//1 - service name
                                                  typeof (int),		//2 - cash id
                                                  typeof (string),	//3 - cash name
                                                  typeof (string),	//5 - units name
                                                  typeof (decimal),	//6 - quantity
                                                  typeof (decimal),	//7 - price
                                                  typeof (decimal),	//8 - summa
                                                  typeof (long),	//9 - row id
                                                  typeof (string),	//10 - paid text
                                                  typeof (decimal),	//11 - paid value
                                                  typeof(bool),		//12 - from area
                                                  typeof(int),		//13 - number of counters
                                                  typeof(string)	//14 - marker color
                                                  );

            Gtk.TreeViewColumn ServiceColumn = new Gtk.TreeViewColumn ();
            ServiceColumn.Title = "Наименование";
            ServiceColumn.MinWidth = 180;
            Gtk.CellRendererCombo CellService = new CellRendererCombo();
            CellService.TextColumn = 0;
            CellService.Editable = true;
            CellService.Model = ServiceNameList;
            CellService.HasEntry = false;
            CellService.Edited += OnServiceComboEdited;
            ServiceColumn.PackStart (CellService, true);

            Gtk.TreeViewColumn CashColumn = new Gtk.TreeViewColumn ();
            CashColumn.Title = "Касса";
            CashColumn.MinWidth = 130;
            Gtk.CellRendererCombo CellCash = new CellRendererCombo();
            CellCash.TextColumn = 0;
            CellCash.Editable = true;
            CellCash.Model = CashNameList;
            CellCash.HasEntry = false;
            CellCash.Edited += OnCashComboEdited;
            CashColumn.PackStart (CellCash, true);

            Gtk.TreeViewColumn CountColumn = new Gtk.TreeViewColumn ();
            CountColumn.Title = "Количество";
            Gtk.CellRendererText CellCount = new CellRendererText();
            CellCount.Editable = true;
            CellCount.Edited += OnCountTextEdited;
            CountColumn.PackStart (CellCount, true);
            Gtk.CellRendererText CellUnits = new CellRendererText ();
            CountColumn.PackStart (CellUnits, false);

            Gtk.TreeViewColumn PriceColumn = new Gtk.TreeViewColumn ();
            PriceColumn.Title = "Цена";
            PriceColumn.MinWidth = 90;
            Gtk.CellRendererText CellPrice = new CellRendererText();
            CellPrice.Editable = true;
            CellPrice.Edited += OnPriceTextEdited;
            PriceColumn.PackStart (CellPrice, true);

            Gtk.TreeViewColumn SumColumn = new Gtk.TreeViewColumn ();
            SumColumn.Title = "Сумма";
            Gtk.CellRendererText CellSum = new CellRendererText();
            SumColumn.PackStart (CellSum, true);

            treeviewServices.AppendColumn (ServiceColumn);
            ServiceColumn.AddAttribute (CellService,"text", (int)ServiceCol.service);
            treeviewServices.AppendColumn (CashColumn);
            CashColumn.AddAttribute (CellCash,"text", (int)ServiceCol.cash);
            treeviewServices.AppendColumn (CountColumn);
            CountColumn.AddAttribute (CellUnits,"text", (int)ServiceCol.units);
            treeviewServices.AppendColumn (PriceColumn);
            treeviewServices.AppendColumn (SumColumn);
            treeviewServices.AppendColumn("Оплачено", new Gtk.CellRendererText (), "text", (int)ServiceCol.paid_text);

            CountColumn.SetCellDataFunc (CellCount, RenderCountColumn);
            PriceColumn.SetCellDataFunc (CellPrice, RenderPriceColumn);
            SumColumn.SetCellDataFunc (CellSum, RenderSumColumn);

            foreach(TreeViewColumn column in treeviewServices.Columns)
            {
                foreach(CellRenderer render in column.CellRenderers)
                {
                    column.AddAttribute (render, "background", (int)ServiceCol.row_color);
                }
            }

            treeviewServices.Model = ServiceListStore;
            treeviewServices.ShowAll();

            //Создаем таблицу оплат
            IncomeListStore = new Gtk.ListStore (typeof (int), typeof (string), typeof (string), typeof (string),
                                                 typeof (string), typeof (string), typeof (decimal));

            //ID -0
            treeviewIncomes.AppendColumn("Документ", new Gtk.CellRendererText (), "text", 1);
            treeviewIncomes.AppendColumn("Дата", new Gtk.CellRendererText (), "text", 2);
            treeviewIncomes.AppendColumn("Касса", new Gtk.CellRendererText (), "text", 3);
            // пусто
            treeviewIncomes.AppendColumn("Сумма", new Gtk.CellRendererText (), "text", 5);
            //Сумма цифровое -6

            treeviewIncomes.Model = IncomeListStore;
            treeviewIncomes.ShowAll();

            OnTreeviewServicesCursorChanged(null, null);
        }