示例#1
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;
        }
示例#2
0
        /// <summary>
        /// Method for loading existing orders.
        /// </summary>
        /// <param name="id">Identifier - order id in database</param>
        /// <param name="copy">If set to <c>true</c> copy.</param>
        public void Fill(int id, bool copy)
        {
            FillInProgress = true;
            NewItem = copy;
            if(!copy)
                ItemId = id;
            MainClass.StatusMessage(String.Format ("Запрос заказа №{0}...", id));
            string sql = "SELECT orders.* FROM orders WHERE orders.id = @id";
            try {
                SqliteCommand cmd = new SqliteCommand(sql, (SqliteConnection) QSMain.ConnectionDB);
                cmd.Parameters.AddWithValue("@id", id);

                CupboardListItem basis;

                using(SqliteDataReader rdr = cmd.ExecuteReader()) {
                    rdr.Read();
                    if(!copy) {
                        this.Title = String.Format("Заказ №{0}", rdr["id"].ToString());
                        dateArrval.Date = DBWorks.GetDateTime(rdr, "arrval", new DateTime());
                    }
                    checkEstimation.Active = DBWorks.GetBoolean(rdr, "estimation", true);
                    entryContract.Text = rdr["contract"].ToString();
                    entryCustomer.Text = rdr["customer"].ToString();
                    entryPhone1.Text = rdr["phone1"].ToString();
                    entryPhone2.Text = rdr["phone2"].ToString();
                    textAddress.Buffer.Text = rdr["address"].ToString();
                    dateDeadlineS.Date = DBWorks.GetDateTime(rdr, "deadline_s", new DateTime());
                    dateDeadlineE.Date = DBWorks.GetDateTime(rdr, "deadline_e", new DateTime());
                    int basis_id = rdr.GetInt32(rdr.GetOrdinal("basis_id"));
                    basis = TypeWidgetList.Find(w => w.id == basis_id);
                    ComboWorks.SetActiveItem(comboExhibition, DBWorks.GetInt(rdr, "exhibition_id", -1));
                    textviewComments.Buffer.Text = rdr["comment"].ToString();
                    OrderCupboard = Cupboard.Load(rdr["cupboard"].ToString(), CubeList);
                    comboCubeH.Active = OrderCupboard.CubesH - 1;
                    comboCubeV.Active = OrderCupboard.CubesV - 1;
                    checkCuttingBase.Active = DBWorks.GetBoolean(rdr, "cutting_base", false);
                    CalculateCubePxSize(drawCupboard.Allocation);
                    PriceCorrection = DBWorks.GetInt(rdr, "price_correction", 0);
                    TotalPrice = DBWorks.GetDecimal(rdr, "total_price", 0);
                    spinbutton1.Value = PriceCorrection;
                    if (PriceCorrection != 0)
                        checkbuttonDiscount.Active = true;
                    labelTotalCount.LabelProp = String.Format("Итого {0} руб.", TotalPrice);
                    ComponentsStore.Remove(ref BasisIter);
                    BasisIter = ComponentsStore.InsertNodeBefore(ServiceIter);
                    ComponentsStore.SetValues (
                        BasisIter,
                        (long)-1,
                        Enum.Parse(typeof(Nomenclature.NomType), "construct"),
                        basis.id,
                        null,
                        "Каркас",
                        null,
                        1,
                        -1,
                        "",
                        -1,
                        "",
                        "",
                        "",
                        "",
                        false,
                        false,
                        false,
                        false,
                        false,
                        false,
                        0,
                        false
                    );
                }
                //Loading services.
                sql = "select * from order_services where order_id = @order_id";
                cmd = new SqliteCommand(sql, (SqliteConnection)QSMain.ConnectionDB);
                cmd.Parameters.AddWithValue("@order_id", id);
                using (SqliteDataReader rdr = cmd.ExecuteReader()) {
                    while(rdr.Read()) {
                        Decimal price = DBWorks.GetDecimal(rdr, "price", 0);
                        ComponentsStore.AppendValues (
                            ServiceIter,
                            copy ? -1 : DBWorks.GetLong(rdr, "id", -1),
                            Enum.Parse (typeof(Nomenclature.NomType), "other"),
                            -1,
                            "",
                            DBWorks.GetString(rdr, "name", ""), //Service name
                            "",
                            1,
                            -1,
                            "",
                            -1,
                            "",
                            DBWorks.GetString(rdr, "comment", ""),
                            price.ToString(),
                            (Math.Round(price + price / 100 * DBWorks.GetInt(rdr, "discount", 0), 0)).ToString(),
                            false,
                            true,
                            false,
                            false,
                            true,
                            true,
                            DBWorks.GetInt(rdr, "discount", 0),
                            true
                        );
                    }
                }
                CalculateServiceCount();
                //Loading basis and it's contents.

                sql = "SELECT * FROM (" +
                    "SELECT order_basis_details.id as id, order_basis_details.nomenclature_id as nomenclature_id, order_basis_details.count as count, " +
                    "order_basis_details.price as price, order_basis_details.comment as comment, order_basis_details.discount as discount, " +
                    "order_basis_details.facing_id as facing_id, facing.name as facing, order_basis_details.material_id as material_id, " +
                    "materials.name as material, nomenclature.type, nomenclature.name, nomenclature.description, nomenclature.price_type " +
                    "FROM order_basis_details " +
                    "LEFT JOIN nomenclature ON order_basis_details.nomenclature_id = nomenclature.id " +
                    "LEFT JOIN facing ON order_basis_details.facing_id = facing.id " +
                    "LEFT JOIN materials ON order_basis_details.material_id = materials.id " +
                    "WHERE order_basis_details.order_id = @order_id " +
                    "UNION " +
                    "SELECT NULL as id, nomenclature.id AS nomenclature_id, 0 AS count, nomenclature.price AS price, " +
                    "NULL AS comment, 0 AS discount, -1 AS facing_id, NULL AS facing, -1 as material_id, NULL AS material, " +
                    "nomenclature.type AS type, nomenclature.name AS name, nomenclature.description AS description, nomenclature.price_type " +
                    "FROM nomenclature " +
                    "LEFT JOIN basis_items ON nomenclature.id = basis_items.item_id " +
                    "WHERE basis_items.basis_id = @basis_id) group by name";
                cmd = new SqliteCommand(sql, (SqliteConnection)QSMain.ConnectionDB);
                cmd.Parameters.AddWithValue("@order_id", id);
                cmd.Parameters.AddWithValue("@basis_id", basis.id);
                using (SqliteDataReader rdr = cmd.ExecuteReader()) {
                    while(rdr.Read()) {
                        int count = DBWorks.GetInt(rdr, "count", 0);
                        decimal price = DBWorks.GetDecimal(rdr, "price", 0);
                        if (count < 1)
                            if (rdr["price_type"].ToString() == "width")
                                price *= OrderCupboard.CubesH;
                            else if (rdr["price_type"].ToString() == "height")
                                price *= OrderCupboard.CubesV;
                        ComponentsStore.AppendValues(
                            BasisIter,
                            copy ? -1 : DBWorks.GetLong(rdr, "id", -1),
                            Enum.Parse(typeof(Nomenclature.NomType), rdr["type"].ToString()),
                            DBWorks.GetInt(rdr, "nomenclature_id", -1),
                            DBWorks.GetString(rdr, "name", ""),
                            ReplaceArticle(DBWorks.GetString(rdr, "name", "")),
                            DBWorks.GetString(rdr, "description", ""),
                            count,
                            DBWorks.GetInt(rdr, "material_id", -1),
                            DBWorks.GetString(rdr, "material", ""),
                            DBWorks.GetInt(rdr, "facing_id", -1),
                            DBWorks.GetString(rdr, "facing", ""),
                            DBWorks.GetString(rdr, "comment", ""),
                            price.ToString(),
                            "",
                            true,
                            true,
                            true,
                            true,
                            true,
                            true,
                            DBWorks.GetInt(rdr, "discount", 0),
                            false
                        );
                    }
                }
                //Loading cubes.
                sql = "SELECT order_details.id as id, order_details.cube_id as cube_id, order_details.count as count, order_details.facing_id as facing_id, " +
                    "facing.name as facing, order_details.material_id as material_id, materials.name as material, order_details.comment as comment, " +
                    "order_details.price as price, cubes.name, cubes.width as width, cubes.height as height " +
                    "FROM order_details " +
                    "LEFT JOIN cubes ON order_details.cube_id = cubes.id " +
                    "LEFT JOIN facing ON facing.id = order_details.facing_id " +
                    "LEFT JOIN materials ON materials.id = order_details.material_id " +
                    "WHERE order_id = @order_id;";
                cmd = new SqliteCommand(sql, (SqliteConnection)QSMain.ConnectionDB);
                cmd.Parameters.AddWithValue("@order_id", id);
                using (SqliteDataReader rdr = cmd.ExecuteReader()) {
                    while (rdr.Read()) {
                        TreeIter CubeIter = ComponentsStore.InsertNodeBefore(ServiceIter);
                            ComponentsStore.SetValues (
                            CubeIter,
                            copy ? -1 : DBWorks.GetLong(rdr, "id", -1),
                            Enum.Parse (typeof(Nomenclature.NomType), "cube"),
                            DBWorks.GetInt(rdr, "cube_id", -1),
                            null,
                            DBWorks.GetString(rdr, "name", ""),
                            null,
                            DBWorks.GetInt(rdr, "count", 1),
                            DBWorks.GetInt(rdr, "material_id", -1),
                            DBWorks.GetString(rdr, "material", ""),
                            DBWorks.GetInt(rdr, "facing_id", -1),
                            DBWorks.GetString(rdr, "facing", ""),
                            DBWorks.GetString(rdr, "comment", ""),
                            "",
                            "",
                            false,
                            false,
                            true,
                            true,
                            true,
                            false,
                            0,
                            false
                        );
                        string contents_sql = "SELECT * FROM (" +
                            "SELECT order_cubes_details.id, order_cubes_details.nomenclature_id, order_cubes_details.count as count, " +
                            "order_cubes_details.price as price, order_cubes_details.comment as comment, order_cubes_details.discount as discount, " +
                            "nomenclature.type AS type, nomenclature.name AS name, nomenclature.description AS description, nomenclature.price_type as price_type " +
                            "FROM order_cubes_details " +
                            "LEFT JOIN nomenclature ON order_cubes_details.nomenclature_id = nomenclature.id " +
                            "WHERE order_cubes_details.order_id = @order_id AND order_cubes_details.cube_id = @cube_id " +
                            "UNION " +
                            "SELECT NULL AS id, nomenclature.id AS nomenclature_id, 0 AS count, nomenclature.price AS price, NULL AS comment, 0 AS discount, " +
                            "nomenclature.type AS type, nomenclature.name AS name, nomenclature.description AS description, nomenclature.price_type as price_type " +
                            "FROM nomenclature " +
                            "LEFT JOIN cubes_items ON nomenclature.id = cubes_items.item_id " +
                            "WHERE cubes_items.cubes_id = @cube_id" +
                            ") group by name;";
                        SqliteCommand contents_cmd = new SqliteCommand (contents_sql, (SqliteConnection)QSMain.ConnectionDB);
                        contents_cmd.Parameters.AddWithValue ("@cube_id", DBWorks.GetInt(rdr, "cube_id", -1));
                        contents_cmd.Parameters.AddWithValue ("@order_id", id);
                        int width = DBWorks.GetInt(rdr, "width", 1);
                        int height = DBWorks.GetInt(rdr, "height", 1);
                        using (SqliteDataReader contents_rdr = contents_cmd.ExecuteReader ()) {
                            while (contents_rdr.Read ()) {
                                Decimal NomenclaturePrice = DBWorks.GetDecimal (contents_rdr, "price", 0);
                                if (DBWorks.GetDecimal (contents_rdr, "count", 1) < 1)
                                    if (contents_rdr["price_type"].ToString() == "width")
                                        NomenclaturePrice *= width;
                                    else if (contents_rdr["price_type"].ToString() == "height")
                                        NomenclaturePrice *= height;
                                ComponentsStore.AppendValues (
                                    CubeIter,
                                    copy ? -1 : DBWorks.GetLong(contents_rdr, "id", -1),
                                    Enum.Parse (typeof(Nomenclature.NomType), contents_rdr ["type"].ToString ()),
                                    DBWorks.GetInt (contents_rdr, "nomenclature_id", -1),
                                    DBWorks.GetString (contents_rdr, "name", "нет"),
                                    ReplaceArticle (DBWorks.GetString (contents_rdr, "name", "нет")),
                                    DBWorks.GetString (contents_rdr, "description", ""),
                                    DBWorks.GetInt (contents_rdr, "count", 1),
                                    -1,
                                    "",
                                    -1,
                                    "",
                                    DBWorks.GetString(contents_rdr, "comment", ""),
                                    NomenclaturePrice.ToString(),
                                    "",
                                    true,
                                    true,
                                    false,
                                    false,
                                    true,
                                    true,
                                    DBWorks.GetInt(contents_rdr, "discount", 0),
                                    false
                                );
                            }
                        }
                    }
                }
                CalculateTotalPrice();
                basis.Button.Click();
                FillInProgress = false;
                MainClass.StatusMessage("Ok");
            }
            catch (Exception ex) {
                QSMain.ErrorMessageWithLog(this, "Ошибка получения информации о заказе!", logger, ex);
            }
            TestCanSave();
        }