
#
# Weekly report
#

#
# days in each month
#

$days[1]  = 31;
$days[2]  = 28;
$days[3]  = 31;
$days[4]  = 30;
$days[5]  = 31;
$days[6]  = 30;
$days[7]  = 31;
$days[8]  = 31;
$days[9]  = 30;
$days[10] = 31;
$days[11] = 30;
$days[12] = 31;

#
# Get date for today 
#

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year += 1900;
$mon  += 1;
$today = "$mon/$mday/$year";

#
# Get date for last week
#

$mday -= 7;
if ($mday <= 0) {
  $mon--;
  if ($mon == 0) {
    $mon = 12;
    $year--;
  }
  if ((($year%4)==0)&&($mon==2)) {
    $days[2] = 29;
  }
  $mday += $days[$mon];
}
$lastWeek = "$mon/$mday/$year";

$searchStartDate = $lastWeek;
$searchEndDate   = $today;

system("$ENV{SERVER_HOME}/bin/report $lastWeek $today");
