25-07-21, 07:37 PM
السلام عليكم
ممكن حل لمشكلة التعديل داخل الداتا قرد فيو داخل فورم فاتورة بيع
حيت عند التعديل داخل الداتا قرد فيو لا تحسب العمليات الحسابية متلا
حسب الصورة المرفقة
عند تغير الكمية المباعة من 10 الي 20 لازم حساب صافي الجمهور واجمالي الشراء من خلال الاجراء SaleCalcu()
الكود
و وضعت الدالة SaleCalcu
داخل DGV EndEdit
ياريت لو في حل او هناك حطاء في كتابة الكود اخباري
ممكن حل لمشكلة التعديل داخل الداتا قرد فيو داخل فورم فاتورة بيع
حيت عند التعديل داخل الداتا قرد فيو لا تحسب العمليات الحسابية متلا
حسب الصورة المرفقة
عند تغير الكمية المباعة من 10 الي 20 لازم حساب صافي الجمهور واجمالي الشراء من خلال الاجراء SaleCalcu()
الكود
PHP كود :
Public Sub SaleCalcu()
Dim t1 As Double
If IsNothing(DGV.CurrentRow) OrElse IsNothing(DGV.CurrentRow.Cells(6).Value) Then
t1 = 0
Else
t1 = Val(DGV.CurrentRow.Cells(6).Value)
End If
Dim T2 As Double
If IsNothing(DGV.CurrentRow) OrElse IsNothing(DGV.CurrentRow.Cells(2).Value) Then
T2 = 0
Else
T2 = Val(DGV.CurrentRow.Cells(2).Value)
End If
Dim T3 As Double
If IsNothing(DGV.CurrentRow) OrElse IsNothing(DGV.CurrentRow.Cells(7).Value) Then
T3 = 0
Else
T3 = Val(DGV.CurrentRow.Cells(7).Value)
End If
Dim T4 As Double
If IsNothing(DGV.CurrentRow) OrElse IsNothing(DGV.CurrentRow.Cells(8).Value) Then
T4 = 0
Else
T4 = Val(DGV.CurrentRow.Cells(8).Value)
End If
Dim T5 As Double
If IsNothing(DGV.CurrentRow) OrElse IsNothing(DGV.CurrentRow.Cells(9).Value) Then
T5 = 0
Else
T5 = Val(DGV.CurrentRow.Cells(9).Value)
End If
Dim t6 As Double
If IsNothing(DGV.CurrentRow) OrElse IsNothing(DGV.CurrentRow.Cells(10).Value) Then
t6 = 0
Else
t6 = Val(DGV.CurrentRow.Cells(10).Value)
End If
Dim t7 As Double
If IsNothing(DGV.CurrentRow) OrElse IsNothing(DGV.CurrentRow.Cells(12).Value) Then
t7 = 0
Else
t7 = Val(DGV.CurrentRow.Cells(12).Value)
End If
'----- اجمالي الجمهور------
' total = qty*price
'7=6*2
T3 = t1 * T2
'---اجمالي الشراء-----
' totalB = total-(total*discound)
T5 = T3 - ((T3 * T4) / 100)
'------قيمة الربح---------
'Eran= = total- totalb
'12=8-11
t6 = T3 - T5
Dim totl, totlB, cout, Ern, Perc As Double
For i As Integer = 0 To DGV.Rows.Count - 1
totl = totl + Val(DGV(9, DGV.Rows(i).Index).Value)
totlB = totlB + Val(DGV(11, DGV.Rows(i).Index).Value)
Ern = totl - totlB
cout = DGV.Rows.Count
Perc = (1 - (totlB / totl)) * 100
Next
SaleTotalG.Text = totl
SaleTotalS.Text = totlB
SaleItemCount.Text = cout
SaleEran.Text = Ern
SaleEranPercent.Text = Math.Round(Perc, 2)
و وضعت الدالة SaleCalcu
داخل DGV EndEdit
PHP كود :
Private Sub DGV_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs) Handles DGV.CellEndEdit
SaleCalcu()
End Sub
ياريت لو في حل او هناك حطاء في كتابة الكود اخباري