المشاركات : 38
المواضيع 9
الإنتساب : Jan 2014
السمعة :
0
الشكر: 18
تم شكره 61 مرات في 18 مشاركات
السلام عليكم ورحمة الله
عندى قاعدة بيانات آكسس لمرتبات موظفين أريد تحديث كل السجلات بزيادة المرتبات حسب المعطيات التالية
1 - المرتب الأساسى زيادة بقيمة التكست بوكس
2 - غلاء المعيشة الزيادة حسب الدرجات الوظيفية كلأتى:
الدرجة التاسعة 40% من المرتب الأساسى , الدرجة الثامنه 35% من المرتب الأساسى , الدرجة السابعة 30% من المرتب الأساسى... وهكذا
3 - علاوة فنية بنسبة 30% من المرتب الأساسى
4 - بدل سكن بنسبة 40% من المرتب الأساسى
وهكذا..
أستخدم فيجوال بيسك دوت نت 2010
وجزاكم الله خيراً
المشاركات : 7,391
المواضيع 803
الإنتساب : Sep 2013
السمعة :
846
الشكر: 13249
تم شكره 18795 مرات في 4414 مشاركات
إقتباس :1 - المرتب الأساسى زيادة بقيمة التكست بوكس
كود :
"update tb set rateb +=" & val(rateb.text)
والباقي للباقين
المشاركات : 38
المواضيع 9
الإنتساب : Jan 2014
السمعة :
0
الشكر: 18
تم شكره 61 مرات في 18 مشاركات
جزاك الله أخى سعود وجعلها فى ميزان حسناتك ما قصرت فكرتك ح تفيدنى كثير
المشاركات : 38
المواضيع 9
الإنتساب : Jan 2014
السمعة :
0
الشكر: 18
تم شكره 61 مرات في 18 مشاركات
كود :
[align=right][align=left][align=left]عملت هذا الكود بالفيجوال بيسك 6 وهو يعمل بصورة ممتازة بس لم أستطع تحويره للدوت نت وهذا ربما يساعد الأخوة فى فهم المطلوب بالضبط
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx form basic increase
'íÍÊæì ÇáÝæÑã Úáì ÊßÓÊ æÇÍÏ ÈÅÓã txtincrease(1)
'æÒÑ æÇÍÏ ÈÅÓã cmdsavbsc
Private Sub cmdsavbsc_Click()
On Error Resume Next
If txtincrease(1).Text = "" Or txtincrease(1).Text = "0" Then
MsgBox "You can't Update with Nul value", vbCritical, "Error"
Exit Sub
txtincrease(1).SetFocus
End If
Cont = InputBox("Are you sure you want to increase the Basic? (Y/N)")
If (UCase(Cont) = "Y") Then
Raz = MsgBox("You can't be able to undo this step", vbYesNo + vbCritical, "Caution")
If Raz = vbYes Then
Dim rgh, stot, Nbsc As Double
With rs
.MoveFirst
Do While Not .EOF
.Find "DISCNO = " + Trim(!DISCNO)
!old_basic = !BASIC
'Nbsc = Format$((CSng(!BASIC) * CSng(txtincrease(1) / 100) + CSng(!BASIC)), "0")
Nbsc = Round(rs.Fields("BASIC") * (txtincrease(1) / 100) + (rs.Fields("BASIC")))
'.....................................................Cola
If rs.Fields("degree") = "1" Then
Select Case rs.Fields("degree")
Case 4
rs.Fields("life") = Round(Nbsc * 0.17)
Case 5
rs.Fields("life") = Round(Nbsc * 0.2)
Case 6
rs.Fields("life") = Round(Nbsc * 0.23)
Case 7
rs.Fields("life") = Round(Nbsc * 0.26)
Case 8
rs.Fields("life") = Round(Nbsc * 0.29)
Case 9
rs.Fields("life") = Round(Nbsc * 0.32)
Case 10
rs.Fields("life") = Round(Nbsc * 0.35)
Case 11
rs.Fields("life") = Round(Nbsc * 0.38)
Case 12
rs.Fields("life") = Round(Nbsc * 0.41)
End Select
End If
If rs.Fields("degree") = "2" Then
Select Case rs.Fields("degree")
Case 1
rs.Fields("life") = Round((Nbsc * 0.5))
Case 2
rs.Fields("life") = Round((Nbsc * 0.47))
Case 3
rs.Fields("life") = Round((Nbsc * 0.44))
Case 4
rs.Fields("life") = Round((Nbsc * 0.41))
Case 5
rs.Fields("life") = Round((Nbsc * 0.38))
Case 6
rs.Fields("life") = Round((Nbsc * 0.35))
Case 7
rs.Fields("life") = Round((Nbsc * 0.32))
Case 8
rs.Fields("life") = Round((Nbsc * 0.29))
Case 9
rs.Fields("life") = Round((Nbsc * 0.27))
Case 10
rs.Fields("life") = Round((Nbsc * 0.25))
Case 11
rs.Fields("life") = Round((Nbsc * 0.25))
End Select
End If
'.....................................................Representation
If Trim(!clasif) = "Officer" Then
If Trim(!degree) >= "9" Then
!reprs = "20"
ElseIf Trim(!degree) = "8" Then
!reprs = "25"
ElseIf Trim(!degree) = "7" Then
!reprs = "30"
ElseIf Trim(!degree) = "7A" Then
!reprs = "35"
ElseIf Trim(!degree) = "6" Then
!reprs = "40"
ElseIf Trim(!degree) = "5" Then
!reprs = "45"
ElseIf Trim(!degree) = "4" Then
!reprs = "50"
ElseIf Trim(!degree) = "10" Then
!reprs = "20"
ElseIf Trim(!degree) = "11" Then
!reprs = "20"
Else
!reprs = "0"
End If
'..........................................................
ElseIf Trim(!clasif) = "Technical" Then
If Trim(!degree) = "3" Or Trim(!degree) = "2" Then
!reprs = "100"
ElseIf Trim(!degree) = "7" Then
!reprs = "50"
ElseIf Trim(!degree) = "6" Then
!reprs = "60"
ElseIf Trim(!degree) = "5" Then
!reprs = "80"
ElseIf Trim(!degree) = "4" Then
!reprs = "90"
ElseIf CSng(!degree) > "7" Then
!reprs = "40"
Else
!reprs = "0"
End If
Else
!reprs = "0"
End If
!stove = "5"
!emp_fire = "50"
'....................................................................Basic
!BASIC = Nbsc
'....................................................................Unified Alw.
' !mohda = Format$(CSng(Nbsc * 0.25), "0")
!mohda = Round(0.25 * Nbsc)
'....................................................................Rent
If !rentee = True Then
!rent = Round(0.4 * Nbsc)
!flt_enc = "0.00"
Else
!rent = "0.00"
!flt_enc = "100"
End If
'....................................................................shift
If !emp_has_shift = True Then
!shft = Round(0.4 * Nbsc)
Else
!shft = "0.00"
End If
'....................................................................exp
!Exp = Round(0.2 * Nbsc)
'....................................................................All gross
rgh = Format$(CSng(Nbsc * 0.4), "0")
!all_gross = Format$(CSng(Nbsc) + CSng(!life) + CSng(!Exp) + CSng(!reprs) + CSng(!shft) + CSng(!emp_fire) + CSng(rgh) + CSng(!mohda) + CSng(!stove) + CSng(!Other_Alw), "0")
'....................................................................bounus
!bounus = (Format$(CSng(Nbsc) + CSng(!life) + CSng(!Exp) + CSng(!reprs) + CSng(!shft) + CSng(!emp_fire) + CSng(rgh) + CSng(!mohda) + CSng(!stove) + CSng(!Other_Alw), "0")) * 2
'....................................................................TOTAL
!emp_gross = Format$(CSng(Nbsc) + CSng(!life) + CSng(!Exp) + CSng(!reprs) + CSng(!rent) + CSng(!shft) + CSng(!emp_fire) + CSng(!flt_enc) + CSng(!mohda) + CSng(!stove) + CSng(!Other_Alw), "0")
'....................................................................SSF TOTAL
stot = Format$(CSng(Nbsc) + CSng(!life) + CSng(!Exp) + CSng(!reprs) + CSng(!shft) + CSng(!emp_fire) + CSng(rgh) + CSng(!mohda) + CSng(!stove) + CSng(!Other_Alw) - CSng(!SSFminus), "0")
'....................................................................SSF
!SSF = Format$(CSng(stot) * 0.08, "0.00")
!comssf = Format$(CSng(stot) * 0.17, "0.00")
'....................................................................LPF
If !LPF = True Then
!LPFval = Format$(CSng(Nbsc) * (CSng(!LPFperc) / 100), "0.00") 'CSng(LPFtxt.Text)
Else
!LPFval = "0.00"
End If
'....................................................................Teckits
If Trim(!all_gross) <> "" Then
If Trim(!MARRIED) = "1" Then
!ticket_V = Format$(CSng(!all_gross) * 3.5, "0")
ElseIf Trim(!MARRIED) = "2" And Trim(!nochild) = "0" Then
!ticket_V = Format$(CSng(!all_gross) * 4.5, "0")
ElseIf Trim(!MARRIED) = "2" And Trim(!nochild) = "1" Or Trim(!nochild) = "2" Or Trim(!nochild) = "3" Then
!ticket_V = Format$(CSng(!all_gross) * 5.75, "0")
Else
!ticket_V = Format$(CSng(!all_gross) * 7.75, "0")
End If
End If
'....................................................................Letter
!increase = CSng(Nbsc) - CSng(!old_basic)
!d_date = txtdate
'....................................................................End
.UpdateBatch adAffectCurrent
.MoveNext
Loop
MsgBox "updated Successfully ", vbMsgBox + vbInformation, "Modify"
End With
End If
End If
cmdsavbsc.Enabled = False
hsab
End Sub
[/align][/align][/align]
المشاركات : 38
المواضيع 9
الإنتساب : Jan 2014
السمعة :
0
الشكر: 18
تم شكره 61 مرات في 18 مشاركات
الحمد لله الذى بنعمته تتم الصالحات
لقد تم الحل ولله الحمد أولاً وأخيراً ومن ثم الشكر لأخى المهندس eng_ashraf (من منتديات الفريق العربي للبرمجة) الذى أوحى بفكرة الحل فجزاءه الله خير الجزاء وكذلك الشكر أجزله للأخ الفاضل سعود الذى حاول المساعدة وأدلى بفكرته . لذلك أضع الكود الذى توصلت إليه بحمد الله وتوفيقه لكى يستفيد من الفكرة الجميع وأرجو من الجميع شاكراً لو أى حد عنده ملاحظة أو إضافة أو تصويب لخطأ ما أن لا يبخل به علينا وجزاكم الله خيرا
كود :
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'On Error Resume Next
If TextBox28.Text = "" Or TextBox28.Text = "0" Then
MsgBox("You can't Update with Nul value", vbCritical, "Error")
Exit Sub
TextBox28.Select()
End If
Dim bsc As Double = Val(TextBox28.Text / 100)
If conn.State = ConnectionState.Closed Then
conn.Open()
End If
Dim oleDBC As New OleDbCommand
Dim oleDBDR As OleDbDataReader
Dim c As Integer
c = 0
With oleDBC
.Connection = conn
.CommandText = "select * from EMP where DEPT<>'" & Trim("Management") & "'and c_cont= False"
End With
oleDBDR = oleDBC.ExecuteReader
If oleDBDR.HasRows Then
While oleDBDR.Read
DataSet1.Tables("EMP").Rows(c).BeginEdit()
DataSet1.Tables("EMP").Rows(c).Item("BASIC") = Math.Round((Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * bsc) + DataSet1.Tables("EMP").Rows(c).Item("BASIC")), 0)
If (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "12") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "1") Then
DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.41), 0)
ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "11") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "1") Then
DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.38), 0)
ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "10") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "1") Then
DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.35), 0)
ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "9") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "1") Then
DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.32), 0)
ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "8") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "1") Then
DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.29), 0)
ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "7") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "1") Then
DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.26), 0)
ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "6") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "1") Then
DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.23), 0)
ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "5") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "1") Then
DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.2), 0)
ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "4") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "1") Then
DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.17), 0)
ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "3") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "1") Then
DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.16), 0)
ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "3") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "2") Then
DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.44), 0)
ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "4") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "2") Then
DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.41), 0)
ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "5") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "2") Then
DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.38), 0)
ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "6") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "2") Then
DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.35), 0)
ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "7") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "22") Then
DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.32), 0)
ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "8") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "2") Then
DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.29), 0)
ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "9") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "2") Then
DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.27), 0)
ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "10") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "22") Then
DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.25), 0)
ElseIf (DataSet1.Tables("EMP").Rows(c).Item("DEGREE") = "11") And (DataSet1.Tables("EMP").Rows(c).Item("Staff") = "2") Then
DataSet1.Tables("EMP").Rows(c).Item("life") = Math.Round(Val(DataSet1.Tables("EMP").Rows(c).Item("BASIC") * 0.25), 0)
End If
DataSet1.Tables("EMP").Rows(c).EndEdit()
Validate()
DataAdapter.Update(DataSet1.Tables("EMP"))
DataSet1.AcceptChanges()
c = c + 1
End While
End If
conn.Close()
MessageBox.Show("updated Successfully", "Modify", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub[/align]
[align=left]
|