السلام عليكم
هذا الكود يقوم بحساب عدد المعاملات اللتي بقي على انتهائها 5 ايام
حيث اني وضعت التاريخ هجري ثلاث اقسام يوم - شهر - سنة
هل هو صحيح؟ وهل هناك احسن منه؟
Dim ig As Integer = 0
Dim Sql As String = "SELECT * FROM TREATMENT where IS_END='" & 0 & "'"
Dim conn As OleDbConnection
conn = getConnection()
conn.Open()
Dim cmd As New OleDbCommand(Sql, conn)
Dim sdr As OleDbDataReader
sdr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
While sdr.Read
If (sdr("end_year") - hijYear) = 0 Then
If (sdr("end_month") - hijMonth) = 0 Then
If (sdr("end_day") - hijDay) <= 5 Then
ig = ig + 1
End If
End If
End If
If (sdr("end_year") - hijYear) = 0 Then
If (sdr("end_month") - hijMonth) = 1 Then
If (sdr("end_day") - hijDay) <= -25 Then
ig = ig + 1
End If
End If
End If
If (sdr("end_year") - hijYear) = 1 Then
If (sdr("end_month") - hijMonth) = -11 Then
If (sdr("end_day") - hijDay) <= -25 Then
ig = ig + 1
End If
End If
End If
End While
Me.Label2.Text += ig.ToString + " معاملات"
sdr.Close()

