تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
مساعدة فى datagridview
#15
(01-04-19, 08:06 PM)بدري كتب : ضع كود الاضافه لفحصه

PHP كود :
 If FrSerch2.ShowDialog vbOK Then
            SellDataGridView
.CurrentRow.Cells(0).Value FrSerch2.DataGridView1.CurrentRow.Cells(0).Value
            SellDataGridView
.CurrentRow.Cells(1).Value FrSerch2.DataGridView1.CurrentRow.Cells(1).Value
            SellDataGridView
.CurrentRow.Cells(2).Value FrSerch2.DataGridView1.CurrentRow.Cells(4).Value
            SellDataGridView
.CurrentRow.Cells(3).Value 1
            SellDataGridView
.CurrentRow.Cells(4).Value FrSerch2.DataGridView1.CurrentRow.Cells(3).Value
            SellDataGridView
.CurrentRow.Cells(6).Value FrSerch2.DataGridView1.CurrentRow.Cells(9).Value
        End 
If 
ودا كود الاضافة فى شاشة البيع 
PHP كود :
Try
 
           If ConnectionState.Open Then con.Close()
 
           If ConnectionState.Closed Then con.Open()
 
           If e.ColumnIndex 3 Then
                SellDataGridView
.CurrentCell SellDataGridView(0SellDataGridView.CurrentCell.RowIndex)
 
               SendKeys.Send("{down}")
 
           End If
 
           'بداية جلب البيانات الموجودة في المتجر بشرط رقم الصنف
            Dim dp As New OleDbDataAdapter(sqlstr, con)
            dp.SelectCommand.Parameters.AddWithValue("@code", SellDataGridView.Rows(e.RowIndex).Cells(0).Value)
            Dim dt As New DataTable
            dp.Fill(dt)
            If dt.Rows.Count = 0 Then   '
رقم الصنف غير موجود في الجدول
                
'نمنع اضافة سطر جديد في القريد
                SellDataGridView.AllowUserToAddRows = False
                MsgBox("هذا الصنف غير معرف في كارت الصنف", MsgBoxStyle.MsgBoxRight + MsgBoxStyle.Critical, "خطأ ")
                SellDataGridView.AllowUserToAddRows = False
                SellDataGridView.CurrentCell = SellDataGridView.Rows(e.RowIndex).Cells(0)
                SellDataGridView.Rows(e.RowIndex).Cells(0).Value = ""          '
نفرغ الخلية الأولى من رقم الصنف الغير موجود
                SellDataGridView
.Rows(e.RowIndex).Cells(0).Selected True     'نضع المؤشر في الخلية الأولى لإستقبال رقم الصنف
                Exit Sub      '
نخرج من تكملة الكود
            End 
If
 
           'نهاية جلب البيانات الموجودة في المتجر بشرط رقم الصنف
            '
هنا نعمل دوران على الداتاقريدفيو للتحقق في حالة وجود باركود الصنف
            For i 
0 To SellDataGridView.Rows.Count 2
                
'هنا إذا رقم الصنف موجود في الداتاقريدفيو نتأكد إذا الكمية المراد بيعها اكبر من الكمية الموجودة في المتجر نظهر رسالة والخروج من تكملة الكود
                If SellDataGridView.Rows(i).Cells(0).Value = SellDataGridView.CurrentCell.Value And SellDataGridView.Rows(i).Cells(1).Value <> "" Then
                    '
هنا رقم الصنف موجود في الداتاقريدفيو ولكن الكمية المراد بيعها اقل من الكمية الموجوده في المتجر
                    
'نزيد 1 في خلية الكمية
                    SellDataGridView.Rows(i).Cells(3).Value = SellDataGridView.Rows(i).Cells(3).Value + 1
                    '
وضع قيمة المجموع في القريد بضرب السعر في الكمية الجديدة
                    SellDataGridView
.Rows(i).Cells(5).Value = (SellDataGridView.Rows(i).Cells(4).Value SellDataGridView.Rows(i).Cells(3).Value)
 
                   SellDataGridView.Update()
 
                   SellDataGridView.Refresh()
 
                   'نمنع اضافة سطر جديد في القريد
                    SellDataGridView.AllowUserToAddRows = False
                    SellDataGridView_RowEnter(sender, e)
                    '
بعد اضافة 1 للكمية السابقة في القريد نفرغ القيمة المدخلة
                    SellDataGridView
.Rows(e.RowIndex).Cells(0).Value ""
 
                   SellDataGridView_CellEnter(sendere)
 
                   'يبقى المؤشر في مكانه بعد اضافة 1 للكمية السابقة
                    SellDataGridView.Rows(e.RowIndex).Cells(0).Selected = True
                    TXT_TOTAL.Text = (From row In SellDataGridView.Rows Select CDbl(row.Cells(5).Value)).Sum()
                    Exit Sub

                End If
            Next      '
نهاية الدوران والتأكد من رقم الصنف موجود في الداتاقريدفيو
            
'هنا رقم الصنف غير موجود في الداتاقريدفيو لذلك سوف نقوم بإضافته
            SellDataGridView.Rows(e.RowIndex).Cells(0).Value = dt.Rows(0)(1).ToString
            SellDataGridView.Rows(e.RowIndex).Cells(1).Value = dt.Rows(0)(2).ToString
            SellDataGridView.Rows(e.RowIndex).Cells(2).Value = dt.Rows(0)(5).ToString
            SellDataGridView.Rows(e.RowIndex).Cells(4).Value = dt.Rows(0)(16).ToString
            SellDataGridView.Rows(e.RowIndex).Cells(6).Value = dt.Rows(0)(12).ToString
            SellDataGridView.Rows(e.RowIndex).Cells(7).Value = dt.Rows(0)(6).ToString
            ' 
SellDataGridView.Rows(e.RowIndex).Cells(9).Value dt.Rows(0)(8).ToString
            
'نضع 1 في خلية الكمية  
            SellDataGridView.Rows(e.RowIndex).Cells(3).Value = 1
            '
وضع قيمة المجموع في القريد بضرب السعر في الكمية
            SellDataGridView
.Rows(SellDataGridView.CurrentRow.Index).Cells(5).Value = (SellDataGridView.Rows(SellDataGridView.CurrentRow.Index).Cells(3).Value SellDataGridView.Rows(SellDataGridView.CurrentRow.Index).Cells(4).Value)
 
           'نسمح اضافة سطر جديد في القريد
            SellDataGridView.AllowUserToAddRows = True
            '
نضع المؤشر في خلية الباركود في السطر الجديد
            SellDataGridView
.CurrentCell SellDataGridView.Rows(e.RowIndex 1).Cells(0)
 
           'ترتيب الداتاقريدفيو بناء على رقم الصنف
            SellDataGridView.Sort(SellDataGridView.Columns(0), System.ComponentModel.ListSortDirection.Ascending)
            TXT_TOTAL.Text = (From row In SellDataGridView.Rows Select CDbl(row.Cells(5).Value)).Sum()
            SelMdataTextBox.Text = Val(TXT_TOTAL.Text) + Val(TXT_TAX)
            QTY1.Text = (From row In SellDataGridView.Rows Select CDbl(row.Cells(3).Value)).Sum()
            CALC()
            SellDataGridView.Update()
            SellDataGridView.Refresh()
        Catch ex As Exception

        End Try 
الرد }}}
تم الشكر بواسطة: elgokr


الردود في هذا الموضوع
مساعدة فى datagridview - بواسطة atef_020 - 30-03-19, 10:11 PM
RE: مساعدة فى datagridview - بواسطة atef_020 - 31-03-19, 11:27 PM
RE: مساعدة فى datagridview - بواسطة بدري - 31-03-19, 11:31 PM
RE: مساعدة فى datagridview - بواسطة atef_020 - 01-04-19, 05:07 PM
RE: مساعدة فى datagridview - بواسطة بدري - 01-04-19, 05:31 PM
RE: مساعدة فى datagridview - بواسطة atef_020 - 01-04-19, 06:59 PM
RE: مساعدة فى datagridview - بواسطة mmali127 - 01-04-19, 05:47 PM
RE: مساعدة فى datagridview - بواسطة بدري - 01-04-19, 07:12 PM
RE: مساعدة فى datagridview - بواسطة atef_020 - 01-04-19, 07:21 PM
RE: مساعدة فى datagridview - بواسطة بدري - 01-04-19, 07:28 PM
RE: مساعدة فى datagridview - بواسطة atef_020 - 01-04-19, 07:45 PM
RE: مساعدة فى datagridview - بواسطة بدري - 01-04-19, 07:50 PM
RE: مساعدة فى datagridview - بواسطة atef_020 - 01-04-19, 08:00 PM
RE: مساعدة فى datagridview - بواسطة بدري - 01-04-19, 08:06 PM
RE: مساعدة فى datagridview - بواسطة atef_020 - 01-04-19, 08:31 PM
RE: مساعدة فى datagridview - بواسطة بدري - 01-04-19, 08:59 PM
RE: مساعدة فى datagridview - بواسطة atef_020 - 01-04-19, 09:45 PM
RE: مساعدة فى datagridview - بواسطة elgokr - 02-04-19, 01:52 AM


التنقل السريع :


يقوم بقرائة الموضوع: