#!/perl64/bin
use LWP::Simple;
use DBI;
use Env;
$BTable = "PropMLS";
$db_user = "agentrobin_01_";
$db_pass = "J0shKr1s";
$dsn_name = 'dbi:mysql:dreamhome_01_:dobrooks.ipowermysql.com:3306';
$name = "";
$city="DANVILLE, CA";
$t1 = "TROOP";
$t2 = "815";
$t3 = "Meridian";
$t4 = "Mt. Diablo Silverado";
printheader();
get_today();
process_RETS_updates();
printending();
exit();
sub get_today() {
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
$TMSTR = $year+1900 . "+" . $mon . "+" . $mday;
$oyear = $year+1900;
$amon = $mon+1;
if (length($amon) == 1 ) { $amon = "0" . $amon; }
if (length($mday) == 1 ) { $mday = "0" . $mday; }
$oneyearago = $year+1899;
$yearagodate = $oneyearago . $amon . "01";
$hour = $hour-3;
$todaysdate = $year+1900 . "-" . $amon . "-" . $mday . ":" . $hour . ":" . $min . ":" . $sec ;
if ($hour > 12) { $dhour =$hour-12; } else { $dhour = $hour; }
if (length($min) == 1) { $dmin = "0" . $min; } else { $dmin = $min; }
if ($hour > 11) {$c_date = "$dhour:$dmin PM $amon/$mday/$oyear"; } else { $c_date = "$dhour:$dmin AM $amon/$mday/$oyear"; }
# print "Setting the current date: $todaysdate<br><br>\n";
}
sub process_RETS_updates() {
$file="Summer_camp_MB.csv";
# print "Processing $file ..... $todaysdate<BR><br>\n";
# print "<hr>";
# process_file($file);
print_info($file);
# print "<hr>";
# print "**** PROCESS COMPLETED<br>";
}
sub process_file() {
$iFile = @_[0];
$listingfile = "$iFile";
$offset = 0;
$hpos = "500";
$vpos1 = "30";
$vpos2 = "45";
$vpos3 = "60";
$vpos4 = "80";
$vpos5 = "95";
$vpos6 = "105";
$vpos7 = "120";
open(UPDATES, $listingfile) || die("Could not open file! $listingfile");
@Lines = <UPDATES>;
$ncount=@Lines;
# print "<TABLE>\n";
$count = 0;
for ($x=0;$x<=$ncount-1;$x++) {
if ($x<20) { goto SKIPIT; }
@vals1 = split(/,/,$Lines[$x]);
for ($c=0; $c<=2; $c++) {
if ($count == 0) {
print "<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>";
$count++;
print "<DIV style='position: relative; top: 0px; left: 460px; height: 300px; width: 210px; border-style: solid; border-width: 0px;' >\n";
} else {
print "<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><IMG SRC='http://www.agentrobin.com/blank33.png'><IMG SRC='http://www.agentrobin.com/blank33.png'>";
print "<DIV style='position: relative; top: 6px; left: 460px; height: 300px; width: 210px; border-style: solid; border-width: 0px;' >\n";
}
# print "<DIV style='position: relative; top: 10px; left: 460px; height: 300px; width: 210px; border-style: solid; border-width: 0px;' >\n";
print "<DIV style='position: absolute; top: 25px; left: 70px;'><SPAN style='font-family: Segoe UI; font-weight: 900; font-size: 10pt; color: black;'>$vals1[2] $vals1[1]</SPAN></DIV>\n";
print "<DIV style='position: absolute; top: 45px; left: 70px;'><SPAN style='font-family: Segoe UI; font-weight: 900; font-size: 10pt; color: black;'></SPAN></DIV>\n";
print "<DIV style='position: absolute; top: 65px; left: 70px;'><SPAN style='font-family: Segoe UI; font-weight: 900; font-size: 10pt; color: black;'>Danville, CA</SPAN></DIV>\n";
print "<DIV style='position: absolute; top: 97px; left: 8px;'><SPAN style='font-family: Segoe UI; font-weight: 900; font-size: 10pt; color: black;'>X</SPAN></DIV>\n";
print "<DIV style='position: absolute; top: 114px; left: 30px;'><SPAN style='font-family: Segoe UI; font-weight: 900; font-size: 10pt; color: black;'>Troop</SPAN></DIV>\n";
print "<DIV style='position: absolute; top: 114px; left: 180px;'><SPAN style='font-family: Segoe UI; font-weight: 900; font-size: 10pt; color: black;'>815</SPAN></DIV>\n";
print "<DIV style='position: absolute; top: 140px; left: 70px;'><SPAN style='font-family: Segoe UI; font-weight: 900; font-size: 10pt; color: black;'>Meredian</SPAN></DIV>\n";
print "<DIV style='position: absolute; top: 160px; left: 70px;'><SPAN style='font-family: Segoe UI; font-weight: 900; font-size: 10pt; color: black;'>Mt. Diablo Silverado</SPAN></DIV>\n";
print "<DIV style='position: absolute; top: 235px; left: 10px;'><SPAN style='font-family: Segoe UI; font-weight: 900; font-size: 9pt; color: black;'>July 17, 2013</SPAN></DIV>\n";
# print "<TR><TD>$vals1[0]</TD><TD>$vals1[1]</TD><TD>$vals1[2]</TD><TD>$vals1[3]</TD><TD>$vals1[4]</TD><TD>$vals1[5]</TD><TD>$vals1[6]</TD><TD>$vals1[7]</TD><TD>$vals1[8]</TD><TD>ART</TD><\<tr>\n";
print "</DIV>\n";
print "<DIV style=\"page-break-before: always\"></DIV><br>\n";
}
SKIPIT:
if ($x==20) { goto OUTSIDE;}
}
OUTSIDE:
close(UPDATES);
}
sub print_info() {
$iFile = @_[0];
$listingfile = "$iFile";
$offset = 0;
$hpos = "500";
$vpos1 = "30";
$vpos2 = "45";
$vpos3 = "60";
$vpos4 = "80";
$vpos5 = "95";
$vpos6 = "105";
$vpos7 = "120";
open(UPDATES, $listingfile) || die("Could not open file! $listingfile");
@Lines = <UPDATES>;
$ncount=@Lines;
# print "<TABLE>\n";
$count = 0;
for ($x=0;$x<=$ncount-1;$x++) {
if ($x<28) { goto SKIPIT1; }
@vals1 = split(/,/,$Lines[$x]);
for ($c=0; $c<=5; $c++) {
if ($count == 0) {
print "<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>";
$count++;
print "<DIV style='position: relative;'>";
print "<DIV style='position: absolute; top: -3px; left: 0px; height: 300px; width: 210px; border-style: solid; border-width: 0px;' >\n";
print " <DIV style='position: absolute; top: 28px; left: 20px;'><SPAN style='font-family: Segoe UI; font-weight: 900; font-size: 10pt; color: black;'>$vals1[$c+3]</SPAN></DIV>\n";
print "</DIV>\n";
print "<DIV style='position: absolute; top: -3px; left: 230px; height: 300px; width: 210px; border-style: solid; border-width: 0px;' >\n";
print " <DIV style='position: absolute; top: 25px; left: 40px;'><SPAN style='font-family: Segoe UI; font-weight: 900; font-size: 10pt; color: black;'>$vals1[2] $vals1[1]</SPAN></DIV>\n";
if ($c == 5) {
print " <DIV style='position: absolute; top: 83px; left: 0px;'><SPAN style='font-family: Segoe UI; font-weight: 900; font-size: 14pt; color: black;'>Art</SPAN></DIV>\n";
} else {
print " <DIV style='position: absolute; top: 83px; left: 0px;'><SPAN style='font-family: Segoe UI; font-weight: 900; font-size: 14pt; color: black;'>$vals1[$c+3]</SPAN></DIV>\n";
}
print "</DIV>\n";
print "<DIV style='position: absolute; top: -3px; left: 460px; height: 300px; width: 210px; border-style: solid; border-width: 0px;' >\n";
print " <DIV style='position: absolute; top: 25px; left: 70px;'><SPAN style='font-family: Segoe UI; font-weight: 900; font-size: 10pt; color: black;'>$vals1[2] $vals1[1]</SPAN></DIV>\n";
print " <DIV style='position: absolute; top: 60px; left: 8px;'><SPAN style='font-family: Segoe UI; font-weight: 900; font-size: 10pt; color: black;'>X</SPAN></DIV>\n";
print " <DIV style='position: absolute; top: 80px; left: 120px;'><SPAN style='font-family: Segoe UI; font-weight: 900; font-size: 10pt; color: black;'>815</SPAN></DIV>\n";
if ($c == 5) {
print " <DIV style='position: absolute; top: 126px; left: 8px;'><SPAN style='font-family: Segoe UI; font-weight: 900; font-size: 14pt; color: black;'>Art</SPAN></DIV>\n";
} else {
print " <DIV style='position: absolute; top: 126px; left: 8px;'><SPAN style='font-family: Segoe UI; font-weight: 900; font-size: 14pt; color: black;'>$vals1[$c+3]</SPAN></DIV>\n";
}
print "</DIV>\n";
print "</DIV>\n";
} else {
print "<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>";
print "<DIV style='position: relative;'>";
print "<DIV style='position: absolute; top: -15px; left: 0px; height: 300px; width: 210px; border-style: solid; border-width: 0px;' >\n";
print " <DIV style='position: absolute; top: 28px; left: 20px;'><SPAN style='font-family: Segoe UI; font-weight: 900; font-size: 10pt; color: black;'>$vals1[$c+3]</SPAN></DIV>\n";
print "</DIV>\n";
print "<DIV style='position: absolute; top: -15px; left: 230px; height: 300px; width: 210px; border-style: solid; border-width: 0px;' >\n";
print " <DIV style='position: absolute; top: 25px; left: 40px;'><SPAN style='font-family: Segoe UI; font-weight: 900; font-size: 10pt; color: black;'>$vals1[2] $vals1[1]</SPAN></DIV>\n";
if ($c == 5) {
print " <DIV style='position: absolute; top: 83px; left: 0px;'><SPAN style='font-family: Segoe UI; font-weight: 900; font-size: 14pt; color: black;'>Art</SPAN></DIV>\n";
} else {
print " <DIV style='position: absolute; top: 83px; left: 0px;'><SPAN style='font-family: Segoe UI; font-weight: 900; font-size: 14pt; color: black;'>$vals1[$c+3]</SPAN></DIV>\n";
}
print "</DIV>\n";
print "<DIV style='position: absolute; top: -15px; left: 460px; height: 300px; width: 210px; border-style: solid; border-width: 0px;' >\n";
print " <DIV style='position: absolute; top: 25px; left: 70px;'><SPAN style='font-family: Segoe UI; font-weight: 900; font-size: 10pt; color: black;'>$vals1[2] $vals1[1]</SPAN></DIV>\n";
print " <DIV style='position: absolute; top: 60px; left: 8px;'><SPAN style='font-family: Segoe UI; font-weight: 900; font-size: 10pt; color: black;'>X</SPAN></DIV>\n";
print " <DIV style='position: absolute; top: 80px; left: 120px;'><SPAN style='font-family: Segoe UI; font-weight: 900; font-size: 10pt; color: black;'>815</SPAN></DIV>\n";
if ($c == 5) {
print " <DIV style='position: absolute; top: 126px; left: 8px;'><SPAN style='font-family: Segoe UI; font-weight: 900; font-size: 14pt; color: black;'>Art</SPAN></DIV>\n";
} else {
print " <DIV style='position: absolute; top: 126px; left: 8px;'><SPAN style='font-family: Segoe UI; font-weight: 900; font-size: 14pt; color: black;'>$vals1[$c+3]</SPAN></DIV>\n";
}
print "</DIV>\n";
print "</DIV>\n";
}
print "<DIV style=\"page-break-before: always\"></DIV><br>\n";
}
SKIPIT1:
if ($x==47) { goto OUTSIDE;}
}
OUTSIDE:
close(UPDATES);
}
########################## WEB STUFFF ############################
sub printheader() {
$description = "AgentRobin Online Active Listing Updates";
$title1 = "AgentRobin Online Active Listing Updates";
# print "<!DOCTYPE html '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>";
print "Content-type: text/html\n\n";
print "<HTML xmlns='http://www.w3.org/1999/xhtml'>\n";
print "<HEAD>\n";
print "<TITLE>$title11</title>\n";
# print "<link type='text/css' href='$baseurl/Default_files/AgentRobin_CSS.CSS' rel='stylesheet'>\n";
print "<meta name=\"description\" content=\"$title1\">\n";
print "<meta name=\"keywords\" content=\"\">\n";
####
print "</head>\n";
print "<body>\n";
}
################### GENERIC PAGE SETUP ENDING ###################
sub printending {
print "</body>\n";
print "</html>\n";
}