02-02-14, 10:33 AM
كود :
[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]
