bazar.Accrual.Accrual C# (CSharp) Method

Accrual() public method

public Accrual ( ) : System
return System
        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);
        }