Beispiel #1
0
        private void WeighBtn_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (wbd_row == null || wbd_row.PosType != 0)
            {
                return;
            }

            using (var frm = new frmWeightEdit(wbd_row.MatName))
            {
                frm.PriceEdit.EditValue = wbd_row.Price;

                if (frm.ShowDialog() == DialogResult.OK)
                {
                    var wbd = _db.WaybillDet.Find(wbd_row.PosId);

                    if (wbd_row.Rsv == 0)
                    {
                        wbd.Amount  = frm.AmountEdit.Value;
                        wbd.Checked = 1;
                    }
                    _db.SaveChanges();

                    RefreshDet();
                }
            }
        }
        private void AmountEdit_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            if (e.Button.Index == 1)
            {
                using (var frm = new frmWeightEdit(MatComboBox.Text, 1))
                {
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        AmountEdit.EditValue = frm.AmountEdit.Value;

                        GetOk();
                    }
                }
            }

            if (e.Button.Index == 2)
            {
                using (var frm = new frmWeightEdit(MatComboBox.Text, 2))
                {
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        AmountEdit.EditValue = frm.AmountEdit.Value;

                        GetOk();
                    }
                }
            }
        }
Beispiel #3
0
        private void AmountEdit_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            if (e.Button.Index == 1)
            {
                var frm = new frmWeightEdit(TechProcessCB.Text, 1);

                if (frm.ShowDialog() == DialogResult.OK)
                {
                    AmountEdit.EditValue = frm.AmountEdit.Value;
                }
            }

            if (e.Button.Index == 2)
            {
                var frm = new frmWeightEdit(TechProcessCB.Text, 2);

                if (frm.ShowDialog() == DialogResult.OK)
                {
                    AmountEdit.EditValue = frm.AmountEdit.Value;
                }
            }
        }
        private void BarCodeEdit_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13 && !String.IsNullOrEmpty(BarCodeEdit.Text))
            {
                var    BarCodeSplit = BarCodeEdit.Text.Split('+');
                String kod          = BarCodeSplit[0];

                var row = WhMatGetBS.List.OfType <WhMatGet_Result>().ToList().Find(f => f.BarCode == kod);
                var pos = WhMatGetBS.IndexOf(row);
                WhMatGetBS.Position = pos;

                /*  if (row == null)
                 * {
                 *    MessageBox.Show("Товар не знайдено !");
                 *    BarCodeEdit.Text = "";
                 *    return;
                 * }*/
                if (MatListTabPage.PageVisible)
                {
                    if (row != null)
                    {
                        if (BarCodeSplit.Count() > 2)
                        {
                            var price = Convert.ToDecimal(BarCodeSplit[1] + "," + BarCodeSplit[2]);
                            var frm   = new frmWeightEdit(row.MatName);
                            frm.PriceEdit.EditValue = price;

                            if (frm.ShowDialog() == DialogResult.OK)
                            {
                                var wh_row = WhRemainGridView.GetFocusedRow() as MatRemainByWh_Result;

                                custom_mat_list.Add(new CustomMatListWH
                                {
                                    Num      = custom_mat_list.Count() + 1,
                                    MatId    = row.MatId,
                                    Name     = row.MatName,
                                    Amount   = frm.AmountEdit.Value,
                                    Price    = frm.PriceEdit.Value,
                                    WId      = wh_row != null ? wh_row.WId : DBHelper.WhList.FirstOrDefault(w => w.Def == 1).WId,
                                    PTypeId  = null,
                                    Discount = DB.SkladBase().GetDiscount(wb.KaId, row.MatId).FirstOrDefault() ?? 0.00m
                                });

                                MatListGridView.RefreshData();
                            }
                        }
                        else
                        {
                            AddItem.PerformClick();
                        }
                    }
                    else
                    {
                        if (BarCodeEdit.Text.Count() == 13)
                        {
                            var ean13 = new EAN13(BarCodeEdit.Text);

                            var row2 = WhMatGetBS.List.OfType <WhMatGet_Result>().ToList().Find(f => f.Artikul == ean13.artikul);
                            var pos2 = WhMatGetBS.IndexOf(row2);

                            WhMatGetBS.Position = pos2;

                            if (row2 != null)
                            {
                                AddMatToCustomList(ean13.amount);
                            }
                        }
                    }
                }


                BarCodeEdit.Text = "";
            }
        }