15-04-17, 02:27 AM
هذا كود بحث بين تاريخين شغال 100%
Dim query As String = "Select * From [Salary] Where [date1] Between @date1 And @date2"
Dim commandSelect As New SqlCommand(query, con)
commandSelect.Parameters.AddWithValue("@date1", DateTimfirst.Value.Date)
commandSelect.Parameters.AddWithValue("@date2", DateTimeend.Value.Date)
dr = commandSelect.ExecuteReader
While dr.Read()
If (dr(1) = TextBoxco.Text) And (TextBoxtypsal.Text = "Hour Works") Then
total_adver = total_adver + dr(5)
total_bonus = total_bonus + dr(6)
payhour = payhour + dr(7)
total_sal_weeek = payhour + total_bonus - total_adver
End If
If (dr(1) = TextBoxco.Text) And (TextBoxtypsal.Text = "Ended Works") Then
total_adver = total_adver + dr(5)
total_bonus = total_bonus + dr(6)
oayquntite = oayquntite + dr(8)
total_sal_weeek = oayquntite + total_bonus - total_adver
End If
If (dr(1) = TextBoxco.Text) And (TextBoxtypsal.Text = "Week's Statec") Then
total_adver = total_adver + dr(5)
total_bonus = total_bonus + dr(6)
total_sal_weeek = week + total_bonus - total_adver
End If
End While
Labeltotbonus.Text = total_bonus
Labeltotadver.Text = total_adver
Labeltotsal.Text = total_sal_weeek
con.Close()
Dim query As String = "Select * From [Salary] Where [date1] Between @date1 And @date2"
Dim commandSelect As New SqlCommand(query, con)
commandSelect.Parameters.AddWithValue("@date1", DateTimfirst.Value.Date)
commandSelect.Parameters.AddWithValue("@date2", DateTimeend.Value.Date)
dr = commandSelect.ExecuteReader
While dr.Read()
If (dr(1) = TextBoxco.Text) And (TextBoxtypsal.Text = "Hour Works") Then
total_adver = total_adver + dr(5)
total_bonus = total_bonus + dr(6)
payhour = payhour + dr(7)
total_sal_weeek = payhour + total_bonus - total_adver
End If
If (dr(1) = TextBoxco.Text) And (TextBoxtypsal.Text = "Ended Works") Then
total_adver = total_adver + dr(5)
total_bonus = total_bonus + dr(6)
oayquntite = oayquntite + dr(8)
total_sal_weeek = oayquntite + total_bonus - total_adver
End If
If (dr(1) = TextBoxco.Text) And (TextBoxtypsal.Text = "Week's Statec") Then
total_adver = total_adver + dr(5)
total_bonus = total_bonus + dr(6)
total_sal_weeek = week + total_bonus - total_adver
End If
End While
Labeltotbonus.Text = total_bonus
Labeltotadver.Text = total_adver
Labeltotsal.Text = total_sal_weeek
con.Close()
