System::Void dtpMondayIn_ValueChanged(System::Object * sender, System::EventArgs * e)
{
// Make sure the time in doesn't occur AFTER the time out
if( this->dtpMondayIn->Value > this->dtpMondayOut->Value )
this->dtpMondayIn->Value = this->dtpMondayOut->Value;
// Calculate the time difference between both ends of the shift
System::TimeSpan diff = this->dtpMondayOut->Value.Subtract(this->dtpMondayIn->Value);
int nbrHours;
double nbrMinutes;
String *strTotalTime = 0;
// Calculate the number of minutes in the elapsed time
int minutes = diff.Minutes + (diff.Hours * 60);
// Calculate the number of hours in the elapsed time
nbrHours = minutes / 60;
// Convert the time difference to a decimal value
nbrMinutes = (minutes - (nbrHours * 60)) * 5 / 3;
// Format the number to display appropriately
strTotalTime = String::Concat(nbrHours.ToString(), S".", nbrMinutes.ToString());
// Display the result in the corresponding text mox
this->txtMonday->Text = strTotalTime;
CalculateWeeklyHours();
}
private: System::Void dtpMondayOut_ValueChanged(System::Object * sender, System::EventArgs * e)
{
if( this->dtpMondayOut->Value < this->dtpMondayIn->Value )
this->dtpMondayOut->Value = this->dtpMondayIn->Value;
System::TimeSpan diff = this->dtpMondayOut->Value.Subtract(this->dtpMondayIn->Value);
int nbrHours;
double nbrMinutes;
String *strTotalTime = 0;
int minutes = diff.Minutes + (diff.Hours * 60);
nbrHours = minutes / 60;
nbrMinutes = (minutes - (nbrHours * 60)) * 5 / 3;
strTotalTime = String::Concat(nbrHours.ToString(), S".", nbrMinutes.ToString());
this->txtMonday->Text = strTotalTime;
CalculateWeeklyHours();
}
private: System::Void dtpTuesdayIn_ValueChanged(System::Object * sender, System::EventArgs * e)
{
if( this->dtpTuesdayIn->Value > this->dtpTuesdayOut->Value )
this->dtpTuesdayIn->Value = this->dtpTuesdayOut->Value;
System::TimeSpan diff = this->dtpTuesdayOut->Value.Subtract(this->dtpTuesdayIn->Value);
int nbrHours;
double nbrMinutes;
String *strTotalTime = 0;
int minutes = diff.Minutes + (diff.Hours * 60);
nbrHours = minutes / 60;
nbrMinutes = (minutes - (nbrHours * 60)) * 5 / 3;
strTotalTime = String::Concat(nbrHours.ToString(), S".", nbrMinutes.ToString());
this->txtTuesday->Text = strTotalTime;
CalculateWeeklyHours();
}
private: System::Void dtpTuesdayOut_ValueChanged(System::Object * sender, System::EventArgs * e)
{
if( this->dtpTuesdayOut->Value < this->dtpTuesdayIn->Value )
this->dtpTuesdayOut->Value = this->dtpTuesdayIn->Value;
System::TimeSpan diff = this->dtpTuesdayOut->Value.Subtract(this->dtpTuesdayIn->Value);
int nbrHours;
double nbrMinutes;
String *strTotalTime = 0;
int minutes = diff.Minutes + (diff.Hours * 60);
nbrHours = minutes / 60;
nbrMinutes = (minutes - (nbrHours * 60)) * 5 / 3;
strTotalTime = String::Concat(nbrHours.ToString(), S".", nbrMinutes.ToString());
this->txtTuesday->Text = strTotalTime;
CalculateWeeklyHours();
}
private: System::Void dtpWednesdayIn_ValueChanged(System::Object * sender, System::EventArgs * e)
{
if( this->dtpWednesdayIn->Value > this->dtpWednesdayOut->Value )
this->dtpWednesdayIn->Value = this->dtpWednesdayOut->Value;
System::TimeSpan diff = this->dtpWednesdayOut->Value.Subtract(this->dtpWednesdayIn->Value);
int nbrHours;
double nbrMinutes;
String *strTotalTime = 0;
int minutes = diff.Minutes + (diff.Hours * 60);
nbrHours = minutes / 60;
nbrMinutes = (minutes - (nbrHours * 60)) * 5 / 3;
strTotalTime = String::Concat(nbrHours.ToString(), S".", nbrMinutes.ToString());
this->txtWednesday->Text = strTotalTime;
CalculateWeeklyHours();
}
private: System::Void dtpWednesdayOut_ValueChanged(System::Object * sender, System::EventArgs * e)
{
if( this->dtpWednesdayOut->Value < this->dtpWednesdayIn->Value )
this->dtpWednesdayOut->Value = this->dtpWednesdayIn->Value;
System::TimeSpan diff = this->dtpWednesdayOut->Value.Subtract(this->dtpWednesdayIn->Value);
int nbrHours;
double nbrMinutes;
String *strTotalTime = 0;
int minutes = diff.Minutes + (diff.Hours * 60);
nbrHours = minutes / 60;
nbrMinutes = (minutes - (nbrHours * 60)) * 5 / 3;
strTotalTime = String::Concat(nbrHours.ToString(), S".", nbrMinutes.ToString());
this->txtWednesday->Text = strTotalTime;
CalculateWeeklyHours();
}
private: System::Void dtpThursdayIn_ValueChanged(System::Object * sender, System::EventArgs * e)
{
if( this->dtpThursdayIn->Value > this->dtpThursdayOut->Value )
this->dtpThursdayIn->Value = this->dtpThursdayOut->Value;
System::TimeSpan diff = this->dtpThursdayOut->Value.Subtract(this->dtpThursdayIn->Value);
int nbrHours;
double nbrMinutes;
String *strTotalTime = 0;
int minutes = diff.Minutes + (diff.Hours * 60);
nbrHours = minutes / 60;
nbrMinutes = (minutes - (nbrHours * 60)) * 5 / 3;
strTotalTime = String::Concat(nbrHours.ToString(), S".", nbrMinutes.ToString());
this->txtThursday->Text = strTotalTime;
CalculateWeeklyHours();
}
private: System::Void dtpThursdayOut_ValueChanged(System::Object * sender, System::EventArgs * e)
{
if( this->dtpThursdayOut->Value < this->dtpThursdayIn->Value )
this->dtpThursdayOut->Value = this->dtpThursdayIn->Value;
System::TimeSpan diff = this->dtpThursdayOut->Value.Subtract(this->dtpThursdayIn->Value);
int nbrHours;
double nbrMinutes;
String *strTotalTime = 0;
int minutes = diff.Minutes + (diff.Hours * 60);
nbrHours = minutes / 60;
nbrMinutes = (minutes - (nbrHours * 60)) * 5 / 3;
strTotalTime = String::Concat(nbrHours.ToString(), S".", nbrMinutes.ToString());
this->txtThursday->Text = strTotalTime;
CalculateWeeklyHours();
}
private: System::Void dtpFridayIn_ValueChanged(System::Object * sender, System::EventArgs * e)
{
if( this->dtpFridayIn->Value > this->dtpFridayOut->Value )
this->dtpFridayIn->Value = this->dtpFridayOut->Value;
System::TimeSpan diff = this->dtpFridayOut->Value.Subtract(this->dtpFridayIn->Value);
int nbrHours;
double nbrMinutes;
String *strTotalTime = 0;
int minutes = diff.Minutes + (diff.Hours * 60);
nbrHours = minutes / 60;
nbrMinutes = (minutes - (nbrHours * 60)) * 5 / 3;
strTotalTime = String::Concat(nbrHours.ToString(), S".", nbrMinutes.ToString());
this->txtFriday->Text = strTotalTime;
CalculateWeeklyHours();
}
private: System::Void dtpFridayOut_ValueChanged(System::Object * sender, System::EventArgs * e)
{
if( this->dtpFridayOut->Value < this->dtpFridayIn->Value )
this->dtpFridayOut->Value = this->dtpFridayIn->Value;
System::TimeSpan diff = this->dtpFridayOut->Value.Subtract(this->dtpFridayIn->Value);
int nbrHours;
double nbrMinutes;
String *strTotalTime = 0;
int minutes = diff.Minutes + (diff.Hours * 60);
nbrHours = minutes / 60;
nbrMinutes = (minutes - (nbrHours * 60)) * 5 / 3;
strTotalTime = String::Concat(nbrHours.ToString(), S".", nbrMinutes.ToString());
this->txtFriday->Text = strTotalTime;
CalculateWeeklyHours();
}
private: System::Void dtpSaturdayIn_ValueChanged(System::Object * sender, System::EventArgs * e)
{
if( this->dtpSaturdayIn->Value > this->dtpSaturdayOut->Value )
this->dtpSaturdayIn->Value = this->dtpSaturdayOut->Value;
System::TimeSpan diff = this->dtpSaturdayOut->Value.Subtract(this->dtpSaturdayIn->Value);
int nbrHours;
double nbrMinutes;
String *strTotalTime = 0;
int minutes = diff.Minutes + (diff.Hours * 60);
nbrHours = minutes / 60;
nbrMinutes = (minutes - (nbrHours * 60)) * 5 / 3;
strTotalTime = String::Concat(nbrHours.ToString(), S".", nbrMinutes.ToString());
this->txtSaturday->Text = strTotalTime;
CalculateWeeklyHours();
}
private: System::Void dtpSaturdayOut_ValueChanged(System::Object * sender, System::EventArgs * e)
{
if( this->dtpSaturdayOut->Value < this->dtpSaturdayIn->Value )
this->dtpSaturdayOut->Value = this->dtpSaturdayIn->Value;
System::TimeSpan diff = this->dtpSaturdayOut->Value.Subtract(this->dtpSaturdayIn->Value);
int nbrHours;
double nbrMinutes;
String *strTotalTime = 0;
int minutes = diff.Minutes + (diff.Hours * 60);
nbrHours = minutes / 60;
nbrMinutes = (minutes - (nbrHours * 60)) * 5 / 3;
strTotalTime = String::Concat(nbrHours.ToString(), S".", nbrMinutes.ToString());
this->txtSaturday->Text = strTotalTime;
CalculateWeeklyHours();
}
private: System::Void dtpSundayIn_ValueChanged(System::Object * sender, System::EventArgs * e)
{
if( this->dtpSundayIn->Value > this->dtpSundayOut->Value )
this->dtpSundayIn->Value = this->dtpSundayOut->Value;
System::TimeSpan diff = this->dtpSundayOut->Value.Subtract(this->dtpSundayIn->Value);
int nbrHours;
double nbrMinutes;
String *strTotalTime = 0;
int minutes = diff.Minutes + (diff.Hours * 60);
nbrHours = minutes / 60;
nbrMinutes = (minutes - (nbrHours * 60)) * 5 / 3;
strTotalTime = String::Concat(nbrHours.ToString(), S".", nbrMinutes.ToString());
this->txtSunday->Text = strTotalTime;
CalculateWeeklyHours();
}
private: System::Void dtpSundayOut_ValueChanged(System::Object * sender, System::EventArgs * e)
{
if( this->dtpSundayOut->Value < this->dtpSundayIn->Value )
this->dtpSundayOut->Value = this->dtpSundayIn->Value;
System::TimeSpan diff = this->dtpSundayOut->Value.Subtract(this->dtpSundayIn->Value);
int nbrHours;
double nbrMinutes;
String *strTotalTime = 0;
int minutes = diff.Minutes + (diff.Hours * 60);
nbrHours = minutes / 60;
nbrMinutes = (minutes - (nbrHours * 60)) * 5 / 3;
strTotalTime = String::Concat(nbrHours.ToString(), S".", nbrMinutes.ToString());
this->txtSunday->Text = strTotalTime;
CalculateWeeklyHours();
}
|