تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
تعديل على أكواد العمليات بالفورم Frm_Edite
#5
الشكر لله والفضل لله

أضف هذا الكود في بداية الأجراء (Show_data())
كود :
  DataGridView1.Rows.Clear()
ليصبح هكذا

كود :
 Sub Show_data()
       DataGridView1.Rows.Clear()

       DT.Clear()
       Dim Adp As New OleDbDataAdapter("SELECT Id , SerialCode , ComboBox1 , PriceUnite , SumChecked , SubTotal , Charges , Discount , FullTotal , StateChecked1 , StateChecked2 , StateChecked3 from Table1 Where SerialCode = '" & HOME.TextCode.Text & "'", Conne)
       Adp.Fill(DT)
       If DT.Rows.Count = 0 Then
           MessageBox.Show("عفواً  ..  لم يتم العثور على طلبية تحت هذا الرقم", " تأكيد", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1)
           Exit Sub
       Else
           TextId.Text = Convert.ToInt32(DT.Rows(0).Item("Id"))
           TextCode.Text = Convert.ToString(DT.Rows(0).Item("SerialCode"))
           ComboBox1.Text = Convert.ToString(DT.Rows(0).Item("ComboBox1"))
           TextPriceUnite.Text = Convert.ToDecimal(DT.Rows(0).Item("PriceUnite"))
           TextSumChecked.Text = Convert.ToInt32(DT.Rows(0).Item("SumChecked").ToString)
           TextSubTotal.Text = Convert.ToDecimal(DT.Rows(0).Item("SubTotal").ToString)
           TextCharges.Text = Convert.ToDecimal(DT.Rows(0).Item("Charges").ToString)
           TextDiscount.Text = Convert.ToDecimal(DT.Rows(0).Item("Discount").ToString)
           TextFullTotal.Text = Convert.ToDecimal(DT.Rows(0).Item("FullTotal").ToString)
           CheckBox1.Checked = Convert.ToBoolean(DT.Rows(0).Item("StateChecked1").ToString)
           CheckBox2.Checked = Convert.ToBoolean(DT.Rows(0).Item("StateChecked2").ToString)
           CheckBox3.Checked = Convert.ToBoolean(DT.Rows(0).Item("StateChecked3").ToString)

           '========== تفاصيل الفاتورة ===========



           Dim DA = New OleDbDataAdapter("select ProductID , ProductBarcode , ProductName , ProductPrice from Table2 where SerialCode = '" & HOME.TextCode.Text & "'", Conne)
           Dim DS As New DataSet
           DS = New DataSet
           DA.Fill(DS)
           DT = DS.Tables(0)
           For I = 0 To DT.Rows.Count - 1

               DataGridView1.Rows.Add()
               DataGridView1.Rows(I).Cells("ProductID").Value = DT.Rows(I).Item("ProductID")
               DataGridView1.Rows(I).Cells("ProductBarcode").Value = DT.Rows(I).Item("ProductBarcode")
               DataGridView1.Rows(I).Cells("ProductName").Value = DT.Rows(I).Item("ProductName")
               DataGridView1.Rows(I).Cells("ProductPrice").Value = DT.Rows(I).Item("ProductPrice")
           Next
     

           Dim SUMDATAGRIDVIEW As Decimal = 0.0
           For i As Integer = 0 To DataGridView1.Rows.Count - 1
               SUMDATAGRIDVIEW = SUMDATAGRIDVIEW + DataGridView1.Rows(i).Cells("ProductPrice").Value
           Next
           TextSumDatagrid.Text = SUMDATAGRIDVIEW

       End If



   End Sub
لا إله إلا الله وحده لا شريك له له الملك وله الحمد وهو على كل شئ قدير
سبحان الله وبحمده سبحان الله العظيم
سبحان الله والحمد لله ولا إله إلا الله والله أكبر ولا حول ولا قوة إلا بالله العلى العظيم
رب أغفر لي 

الرد }}}
تم الشكر بواسطة: العيدروس


الردود في هذا الموضوع
RE: تعديل على أكواد العمليات بالفورم Frm_Edite - بواسطة princelovelorn - 11-12-24, 03:43 PM


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


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