#!/usr/bin/perl

require "config.idx";

print "Content-type: text/html\n\n";

$long = $ENV{'QUERY_STRING'};

if ($long) {
	@pairs=split(/&/,$long);
	foreach $item(@pairs) {
		($name,$content)=split (/=/,$item,2);
		$content=~tr/+/ /;
		$content=~ s/%(..)/pack("c",hex($1))/ge;
		if ($INPUT{$name}) { $INPUT{$name} = $INPUT{$name}.",".$content; }
		else { $INPUT{$name} = $content; }
	}
}
else {
	read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
	@pairs = split(/&/, $buffer);
	foreach $pair (@pairs) {
		($name, $value) = split(/=/, $pair);
		$value =~ tr/+/ /;
		$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
		if ($INPUT{$name}) { $INPUT{$name} = $INPUT{$name}.",".$value; }
		else { $INPUT{$name} = $value; }
	}
}

if ($INPUT{action} eq "create_prospect") { &create_prospect; }
elsif ($INPUT{action} eq "create_prospect_verify") { &create_prospect_verify; }
elsif ($INPUT{action} eq "create_prospect_do") { &create_prospect_do; }
elsif ($INPUT{action} eq "overview_prospect_notes_show") { &overview_prospect_notes_show; }
elsif ($INPUT{action} eq "overview_documents_prospect") { &overview_documents_prospect; }
elsif ($INPUT{action} eq "overview_prospects_smallaz") { &overview_prospects_smallaz; }
elsif ($INPUT{action} eq "overview_prospect") { &overview_prospect; }
elsif ($INPUT{action} eq "overview_prospect_delete") { &overview_prospect_delete; }
elsif ($INPUT{action} eq "overview_prospect_edit") { &overview_prospect_edit; }
elsif ($INPUT{action} eq "overview_prospect_doedit") { &overview_prospect_doedit; }
elsif ($INPUT{action} eq "overview_prospect_convert") { &overview_prospect_convert; }
elsif ($INPUT{action} eq "overview_prospect_copy") { &overview_prospect_copy; }
elsif ($INPUT{action} eq "overview_prospect_copyprospect") { &overview_prospect_copyprospect; }
elsif ($INPUT{action} eq "myemailer") { &myemailer; }
elsif ($INPUT{action} eq "myemailer_send") { &myemailer_send; }
elsif ($INPUT{action} eq "upload_document") { &upload_document; }
elsif ($INPUT{action} eq "document_progress") { &document_progress; }
elsif ($INPUT{action} eq "overview_prospects_linked") { &overview_prospects_linked; }
else { &main; }

sub overview_prospects_linked {

use DBI;
my $dsn = "DBI:mysql:database=$d_name;host=localhost";
my $dbh = DBI->connect($dsn, $d_username, $d_pass, {RaiseError => 1}) || die $DBI::errstr;

if ($INPUT{do} eq "add") {
	@variables = ($INPUT{transid},$INPUT{prospectid});
	$sql_query = "INSERT INTO trans_boardtranstoprospect values (?,?)";
	my $zzaasth = $dbh->do($sql_query, undef, @variables);
}

print qq~
<html>
<head>
<title></title>
<link rel="stylesheet" TYPE="text/css" href="includes/style.css">
</head>
<body bgcolor="white">
<b>Currently linked to the following listing(s)</b><br><br>
~;

my $asth = $dbh->prepare("select transid,prospectid from trans_boardtranstoprospect where prospectid = '$INPUT{prospectid}'");
$asth->execute;
	while (($transid,$prospectid) = $asth->fetchrow_array()) {
		
		my $aasth = $dbh->prepare("select id,mlsnumber,addressnumber,addressdirection,addressstreet,city from trans_board where id = '$transid' GROUP BY mlsnumber ORDER BY addressstreet asc");
		$aasth->execute;
		while (($id,$mlsnumber,$addressnumber,$addressdirection,$addressstreet,$city) = $aasth->fetchrow_array()) {	
			print qq~
				<b>MLS \#$mlsnumber</b><br>
				<b>$addressnumber $addressdirection $addressstreet, $city<hr color="navy" width="100%">
			~;
		$found = "yes";
		}
	}

unless ($found eq "yes") {
print qq~
<font color="red" face="Tahoma"><b>Prospect not linked to listings yet!</b></font><br>
~;
}
print qq~
</body>
</html>
~;

}

sub document_progress {

}

sub overview_prospect_convert {

if ($INPUT{do} eq "yes") {


use DBI;
my $dsn = "DBI:mysql:database=$d_name;host=localhost";
my $dbh = DBI->connect($dsn, $d_username, $d_pass, {RaiseError => 1}) || die $DBI::errstr;

my $basth = $dbh->prepare("select id,agent,type,firstname,lastname,address,spouse,city,state,zip,phone1type,phone1number,phone2type,phone2number,phone3type,phone3number,faxnumber,email,emailtwo,contacttype,initial_contactdate,last_contactdate,next_contactdate,source,notes from trans_boardprospect WHERE id = '$INPUT{prospectid}'");
$basth->execute;
while (($id,$agent,$type,$firstname,$lastname,$address,$spouse,$city,$state,$zip,$phone1type,$phone1number,$phone2type,$phone2number,$phone3type,$phone3number,$faxnumber,$email,$emailtwo,$contacttype,$initial_contactdate,$last_contactdate,$next_contactdate,$source,$notes) = $basth->fetchrow_array()) {

	@variables = ($agent,$type,$firstname,$lastname,$address,$spouse,$city,$state,$zip,$phone1type,$phone1number,$phone2type,$phone2number,$phone3type,$phone3number,$faxnumber,$email,$emailtwo,$contacttype,$initial_contactdate,$last_contactdate,$next_contactdate,$source,$notes);
	$sql_query = "INSERT INTO trans_boardcontact values ('',?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
	my $aasth = $dbh->do($sql_query, undef, @variables);

		my $zaasth = $dbh->prepare("select id from trans_boardcontact WHERE agent = '$INPUT{agent}' ORDER BY id DESC LIMIT 0,1");
		$zaasth->execute;
		while (($newcontactid) = $zaasth->fetchrow_array()) {

		my $getnasth = $dbh->prepare("select noteid,prospectid,datetime,addedby,note from trans_boardprospectnotes WHERE prospectid = '$INPUT{prospectid}'");
		$getnasth->execute;
		while (($noteid,$prospectid,$datetime,$addedby,$note) = $getnasth->fetchrow_array()) {

			@newnvariables = ($newcontactid,$datetime,$addedby,$note);
			$newnsql_query = "INSERT INTO trans_boardcontactnotes values ('',?,?,?,?)";
			my $newnasth = $dbh->do($newnsql_query, undef, @newnvariables);

		}

		my $getdasth = $dbh->prepare("select did from documents WHERE matchcat = 'p' AND matchid = '$INPUT{prospectid}'");
		$getdasth->execute;
		while (($did) = $getdasth->fetchrow_array()) {		

			@newdvariables = ($newcontactid);
			$newdsql_query = "UPDATE documents set matchcat = 'c', matchid = ? WHERE did = '$did'";
			my $newdasth = $dbh->do($newdsql_query, undef, @newdvariables);				

		}
		$getcontactid = $newcontactid;
		}


@delprospectvariables = ($INPUT{prospectid});
$delprospectsql_query = "DELETE FROM trans_boardprospect WHERE id = ?";
my $delprospectasth = $dbh->do($delprospectsql_query, undef, @delprospectvariables);

@delprospectnotesvariables = ($INPUT{prospectid});
$delprospectnotessql_query = "DELETE FROM trans_boardprospectnotes WHERE prospectid = ?";
my $delprospectnotesasth = $dbh->do($delprospectnotessql_query, undef, @delprospectnotesvariables);

@delprospectapvariables = ($INPUT{prospectid});
$delprospectapsql_query = "DELETE from trans_boardtask_triggers where idlink = ? and task_type = 'Prospect'";
my $delprospectapasth = $dbh->do($delprospectapsql_query, undef, @delprospectapvariables);



}

print qq~
<html>
<head>
<title>Converting Prospect To Contact</title>
<meta http-equiv="Refresh" content="1; URL=http://connect.eaglesold.com/contacts.idx?action=overview_contact&agent=$INPUT{agent}&contactid=$getcontactid">
</head>
<body bgcolor="white">
<br><br><br><br>
<center><font size="3" face="Arial" color="Red">Please wait, Processing Conversion</font><br><br>
<font color="red">
Converting Data<br>
Converting Notes Information<br>
Converting Documents<br>
Deleting Prospect Data<br>
Deleting Prospect Notes<br>
Cleaning Up Prospect Documents<br>
</font>
<br><br>
<center><font size="3" face="Arial" color="Red">Please wait, Processing</font><br>You will be redirected to when finished.  If not <a href="http://connect.eaglesold.com/contacts.idx?agent=$INPUT{agent}">Click Here</a>.</center>
</body>
</html>
~;
}
else {

print qq~
<html>
<head>
<title>Convert Prospect To Contact -- Eagle Real Estate, Inc. -  Connect.EagleSold.com</title>
~;

&header;

print qq~
<td valign="top" width="581">
<img src="images/trans_sys/my_prospects.gif" height="33" width="581" alt="My Prospects"><br><br>
<font size="4" color="red">Really Convert Prospect $INPUT{name} to Contact?</font><br>
are you sure you want to convert?<br><br>
<a href="prospects.idx?action=overview_prospect_convert&agent=$INPUT{agent}&prospectid=$INPUT{prospectid}&do=yes">Yes</a> or <a href="prospect.idx?agent=$INPUT{agent}">No [ Cancel ]</a><br><br>
If you select yes the following information will be converted to a contact:<br><br>
<font color="red">
Converting Data<br>
Converting Notes Information<br>
Converting Documents<br>
Deleting Prospect Data<br>
Deleting Prospect Notes<br>
Cleaning Up Prospect Documents<br>
Remove Any Active Action Plans<br>
</font>
</td>
~;

&footer;

}

}

sub overview_prospect_copy {

if ($INPUT{do} eq "yes") {


use DBI;
my $dsn = "DBI:mysql:database=$d_name;host=localhost";
my $dbh = DBI->connect($dsn, $d_username, $d_pass, {RaiseError => 1}) || die $DBI::errstr;

my $basth = $dbh->prepare("select id,agent,type,firstname,lastname,address,spouse,city,state,zip,phone1type,phone1number,phone2type,phone2number,phone3type,phone3number,faxnumber,email,emailtwo,contacttype,initial_contactdate,last_contactdate,next_contactdate,source,notes from trans_boardprospect WHERE id = '$INPUT{prospectid}'");
$basth->execute;
while (($id,$agent,$type,$firstname,$lastname,$address,$spouse,$city,$state,$zip,$phone1type,$phone1number,$phone2type,$phone2number,$phone3type,$phone3number,$faxnumber,$email,$emailtwo,$contacttype,$initial_contactdate,$last_contactdate,$next_contactdate,$source,$notes) = $basth->fetchrow_array()) {

	@variables = ($agent,$type,$firstname,$lastname,$address,$spouse,$city,$state,$zip,$phone1type,$phone1number,$phone2type,$phone2number,$phone3type,$phone3number,$faxnumber,$email,$emailtwo,$contacttype,$initial_contactdate,$last_contactdate,$next_contactdate,$source,$notes);
	$sql_query = "INSERT INTO trans_boardcontact values ('',?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
	my $aasth = $dbh->do($sql_query, undef, @variables);

		my $zaasth = $dbh->prepare("select id from trans_boardcontact WHERE agent = '$INPUT{agent}' ORDER BY id DESC LIMIT 0,1");
		$zaasth->execute;
		while (($newcontactid) = $zaasth->fetchrow_array()) {

		my $getnasth = $dbh->prepare("select noteid,prospectid,datetime,addedby,note from trans_boardprospectnotes WHERE prospectid = '$INPUT{prospectid}'");
		$getnasth->execute;
		while (($noteid,$prospectid,$datetime,$addedby,$note) = $getnasth->fetchrow_array()) {

			@newnvariables = ($newcontactid,$datetime,$addedby,$note);
			$newnsql_query = "INSERT INTO trans_boardcontactnotes values ('',?,?,?,?)";
			my $newnasth = $dbh->do($newnsql_query, undef, @newnvariables);

		}

		my $getdasth = $dbh->prepare("select did from documents WHERE matchcat = 'p' AND matchid = '$INPUT{prospectid}'");
		$getdasth->execute;
		while (($did) = $getdasth->fetchrow_array()) {		

			@newdvariables = ($newcontactid);
			$newdsql_query = "UPDATE documents set matchcat = 'c', matchid = ? WHERE did = '$did'";
			my $newdasth = $dbh->do($newdsql_query, undef, @newdvariables);				

		}
		$getcontactid = $newcontactid;
		}

}

print qq~
<html>
<head>
<title>Copy Prospect To Contact</title>
<meta http-equiv="Refresh" content="1; URL=http://connect.eaglesold.com/contacts.idx?action=overview_contact&agent=$INPUT{agent}&contactid=$getcontactid">
</head>
<body bgcolor="white">
<br><br><br><br>
<center><font size="3" face="Arial" color="Red">Please wait, Processing Conversion</font><br><br>
<font color="red">
Copying Data<br>
Copying Notes Information<br>
Converting Documents<br>
</font>
<br><br>
<center><font size="3" face="Arial" color="Red">Please wait, Processing</font><br>You will be redirected to when finished.  If not <a href="http://connect.eaglesold.com/contacts.idx?agent=$INPUT{agent}">Click Here</a>.</center>
</body>
</html>
~;
}
else {

print qq~
<html>
<head>
<title>Copy Prospect To Contact -- Eagle Real Estate, Inc. - Connect.EagleSold.com</title>
~;

&header;

print qq~
<td valign="top" width="581">
<img src="images/trans_sys/my_prospects.gif" height="33" width="581" alt="My Prospects"><br><br>
<font size="4" color="red">Really Copy Prospect $INPUT{name} to Contact?</font><br>
are you sure you want to convert?<br><br>
<a href="prospects.idx?action=overview_prospect_copy&agent=$INPUT{agent}&prospectid=$INPUT{prospectid}&do=yes">Yes</a> or <a href="prospect.idx?agent=$INPUT{agent}">No [ Cancel ]</a><br><br>
If you select yes the following information will be converted to a contact:<br><br>
<font color="red">
Copying Data<br>
Copying Notes Information<br>
Converting Documents<br>
</font>
</td>
~;

&footer;

}

}

sub overview_prospect_copyprospect {

if ($INPUT{do} eq "yes") {


use DBI;
my $dsn = "DBI:mysql:database=$d_name;host=localhost";
my $dbh = DBI->connect($dsn, $d_username, $d_pass, {RaiseError => 1}) || die $DBI::errstr;

my $basth = $dbh->prepare("select id,agent,type,firstname,lastname,address,spouse,city,state,zip,phone1type,phone1number,phone2type,phone2number,phone3type,phone3number,faxnumber,email,emailtwo,contacttype,initial_contactdate,last_contactdate,next_contactdate,source,notes from trans_boardprospect WHERE id = '$INPUT{prospectid}'");
$basth->execute;
while (($id,$agent,$type,$firstname,$lastname,$address,$spouse,$city,$state,$zip,$phone1type,$phone1number,$phone2type,$phone2number,$phone3type,$phone3number,$faxnumber,$email,$emailtwo,$contacttype,$initial_contactdate,$last_contactdate,$next_contactdate,$source,$notes) = $basth->fetchrow_array()) {

	@variables = ($agent,'trans_sys',$firstname,$lastname,$address,$spouse,$city,$state,$zip,$phone1type,$phone1number,$phone2type,$phone2number,$phone3type,$phone3number,$faxnumber,$email,$emailtwo,$contacttype,$initial_contactdate,$last_contactdate,$next_contactdate,$source,$notes);
	$sql_query = "INSERT INTO trans_boardprospect values ('',?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
	my $aasth = $dbh->do($sql_query, undef, @variables);

		my $zaasth = $dbh->prepare("select id from trans_boardprospect WHERE agent = '$INPUT{agent}' ORDER BY id DESC LIMIT 0,1");
		$zaasth->execute;
		while (($newprospectid) = $zaasth->fetchrow_array()) {

		my $getnasth = $dbh->prepare("select noteid,prospectid,datetime,addedby,note from trans_boardprospectnotes WHERE prospectid = '$INPUT{prospectid}'");
		$getnasth->execute;
		while (($noteid,$prospectid,$datetime,$addedby,$note) = $getnasth->fetchrow_array()) {

			@newnvariables = ($newprospectid,$datetime,$addedby,$note);
			$newnsql_query = "INSERT INTO trans_boardprospectnotes values ('',?,?,?,?)";
			my $newnasth = $dbh->do($newnsql_query, undef, @newnvariables);

		}

		my $getdasth = $dbh->prepare("select did from documents WHERE matchcat = 'p' AND matchid = '$INPUT{prospectid}'");
		$getdasth->execute;
		while (($did) = $getdasth->fetchrow_array()) {		

			@newdvariables = ($newprospectid);
			$newdsql_query = "UPDATE documents set matchcat = 'p', matchid = ? WHERE did = '$did'";
			my $newdasth = $dbh->do($newdsql_query, undef, @newdvariables);				

		}
		$getprospectid = $newprospectid;
		}

}

print qq~
<html>
<head>
<title>Copy Prospect As New Prospect</title>
<meta http-equiv="Refresh" content="1; URL=http://connect.eaglesold.com/prospects.idx?action=overview_prospect&agent=$INPUT{agent}&prospectid=$getprospectid">
</head>
<body bgcolor="white">
<br><br><br><br>
<center><font size="3" face="Arial" color="Red">Please wait, Processing Conversion</font><br><br>
<font color="red">
Copying Data<br>
Copying Notes Information<br>
Converting Documents<br>
</font>
<br><br>
<center><font size="3" face="Arial" color="Red">Please wait, Processing</font><br>You will be redirected to when finished.  If not <a href="http://connect.eaglesold.com/prospects.idx?action=overview_prospect&agent=$INPUT{agent}&prospectid=$getprospectid">Click Here</a>.</center>
</body>
</html>
~;
}
else {

print qq~
<html>
<head>
<title>Copy Prospect As New Prospect -- Eagle Real Estate, Inc. - Connect.EagleSold.com</title>
~;

&header;

print qq~
<td valign="top" width="581">
<img src="images/trans_sys/my_prospects.gif" height="33" width="581" alt="My Prospects"><br><br>
<font size="4" color="red">Really Copy Prospect $INPUT{name} to Contact?</font><br>
are you sure you want to convert?<br><br>
<a href="prospects.idx?action=overview_prospect_copyprospect&agent=$INPUT{agent}&prospectid=$INPUT{prospectid}&do=yes">Yes</a> or <a href="prospect.idx?agent=$INPUT{agent}">No [ Cancel ]</a><br><br>
If you select yes the following information will be converted to a contact:<br><br>
<font color="red">
Copying Data<br>
Copying Notes Information<br>
Converting Documents<br>
</font>
</td>
~;

&footer;

}

}

sub create_prospect {

	use DBI;
	my $dsn = "DBI:mysql:database=$d_name;host=localhost";
	my $dbh = DBI->connect($dsn, $d_username, $d_pass, {RaiseError => 1}) || die $DBI::errstr;
	my $dateaasth = $dbh->prepare("select DATE_FORMAT(DATE_ADD(now(), INTERVAL 0 DAY), '%Y-%m-%d')");
	$dateaasth->execute;
	while (($newbackdate) = $dateaasth->fetchrow_array()) {
	$findsdate = "$newbackdate";
	}


print qq~
<html>
<head>
<title>Create New prospect -- Eagle Real Estate, Inc. - Connect.EagleSold.com</title>
~;

&header;


print qq~

<script language="JavaScript" type="text/javascript">
windowOnLoad();
</script>
<script language="JavaScript">
	function cancel()
	{
		
	}
</script>
<script language="JavaScript" event="onkeypress" form="document">
	OnEnter();
	if( window.event.keyCode == 27 )
	{
		cancel();
	}
</script>

<td valign="top" width="581">
<script language="JavaScript" src="calendar1.js"></script>
<img src="images/headers/transaction_manager.gif" height="33" width="581" alt="My Transaction Manager"><br><br>
<img src="images/trans_sys/my_prospects.gif" alt="Create New prospect"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>fill out the form below to create a new prospect</b><br><br>
<form method="post" name="ccontact" action="prospects.idx">
<input type="hidden" name="action" value="create_prospect_verify">
<input type="hidden" name="agent" value="$INPUT{agent}">
<input type="hidden" name="type" value="trans_sys">

	<table border="0" width="500" cellpadding="3" cellspacing="1">	
	<tr>
	<td valign="top" width="40%"><b>Prospect Information</b></td>
	<td valign="top" width="60%"><b>Firstname</b><br>
	<input type="text" name="firstname" class="form"><br>
	<b>Spouse Name</b><br>
	<input type="text" name="spouse" class="form"><br>
	<b>Lastname</b><br>
	<input type="text" name="lastname" class="form"><br>
</td>
	</tr>
	<tr bgcolor="#CCCCFF">
	<td valign="top"><b>Current Address</b></td>
	<td valign="top">
		<b>Address</b><br>
		<input type="text" name="address" size="40" class="form"><br>
		<b>City</b><br>
		<input type="text" name="city" size="12" class="form"><br>
		<b>State</b><br>
		<select name="state" class="form"><option value="Alabama">Alabama</option>
<option value="Alaska">Alaska</option>
<option value="Arizona">Arizona</option>
<option value="Arkansas">Arkansas</option>
<option value="California">California</option>
<option value="Colorado">Colorado</option> 
<option value="Connecticut">Connecticut</option>
<option value="Delaware">Delaware</option>
<option value="District of Columbia">District of Columbia</option>
<option value="Florida">Florida</option>
<option value="Georgia">Georgia</option>
<option value="Hawaii">Hawaii</option>
<option value="Idaho">Idaho</option>
<option value="Illinois">Illinois</option>
<option value="Indiana" selected>Indiana</option>
<option value="Iowa">Iowa</option>
<option value="Kansas">Kansas</option>
<option value="Kentucky">Kentucky</option>
<option value="Louisiana">Louisiana</option>
<option value="Maine">Maine</option>
<option value="Maryland">Maryland</option>
<option value="Massachusetts">Massachusetts</option>
<option value="Michigan">Michigan</option>
<option value="Minnesota">Minnesota</option>
<option value="Mississippi">Mississippi</option>
<option value="Missouri">Missouri</option>
<option value="Montana">Montana</option>
<option value="Nebraska">Nebraska</option>
<option value="Nevada">Nevada</option>
<option value="New Hampshire">New Hampshire</option>
<option value="New Jersey">New Jersey</option>
<option value="New Mexico">New Mexico</option>
<option value="New York">New York</option>
<option value="North Carolina">North Carolina</option>
<option value="North Dakota">North Dakota</option>
<option value="Ohio">Ohio</option>
<option value="Oklahoma">Oklahoma</option>
<option value="Oregon">Oregon</option>
<option value="Pennsylvania">Pennsylvania</option>
<option value="Rhode Island">Rhode Island</option>
<option value="South Carolina">South Carolina</option>
<option value="South Dakota">South Dakota</option>
<option value="Tennessee">Tennessee</option>
<option value="Texas">Texas</option>
<option value="Utah">Utah</option>
<option value="Vermont">Vermont</option>
<option value="Virgin Islands">Virgin Islands</option>
<option value="Virginia">Virginia</option>
<option value="Washington">Washington</option>
<option value="West Virginia">West Virginia</option>
<option value="Wisconsin">Wisconsin</option>
<option value="Wyoming">Wyoming</option></select><br>
<b>Zip</b><br><input type="text" name="zip" size="5" class="form">
	</td>
	</tr>
	<tr>
	<td bgcolor="white"><b>Phone 1 Type</b><br>
	</td>
	<td bgcolor="white">
		<select name="phone1type" class="form">
		<option value="">-- No Number --</option>
		<option value="Home">Home</option>
		<option value="Work">Work</option>
		<option value="Home Office">Home Office</option>
		<option value="Mobile">Mobile</option>
		<option value="Voicemail">Voicemail</option>
		<option value="Pager">Pager</option>
		</select> 
		<input type="text" name="phone1number" class="form">
	</td>
	</tr>
	<tr>
	<td bgcolor="white"><b>Phone 2 Type</b><br>
	</td>
	<td bgcolor="white">
		<select name="phone2type" class="form">
		<option value="">-- No Number --</option>
		<option value="Home">Home</option>
		<option value="Work">Work</option>
		<option value="Home Office">Home Office</option>
		<option value="Mobile">Mobile</option>
		<option value="Voicemail">Voicemail</option>
		<option value="Pager">Pager</option>
		</select> 
		<input type="text" name="phone2number" class="form">
	</td>
	</tr>
	<tr>
	<td bgcolor="white"><b>Phone 3 Type</b><br>
	</td>
	<td bgcolor="white">
		<select name="phone3type" class="form">
		<option value="">-- No Number --</option>
		<option value="Home">Home</option>
		<option value="Work">Work</option>
		<option value="Home Office">Home Office</option>
		<option value="Mobile">Mobile</option>
		<option value="Voicemail">Voicemail</option>
		<option value="Pager">Pager</option>
		</select> 
		<input type="text" name="phone3number" class="form">
	</td>
	</tr>
	<tr>
	<td valign="top"><b>Fax Number</b></td>
	<td valign="top">
		<input type="text" name="faxnumber" size="15" class="form"><br>
	</td>
	</tr>
	<tr>
	<td valign="top"><b>E-Mail Address</b></td>
	<td valign="top">
				<input type="Text" name="email" size="30" class="form"><br>
	</td>
	</tr>
	<tr>
	<td valign="top"><b>E-Mail Address 2</b></td>
	<td valign="top">
		<input type="Text" name="emailtwo" size="30" class="form"><br>
	</td>
	</tr>
	<tr bgcolor="#CCCCFF">
	<td valign="top"><b>Check all Contact Types that apply</b></td>
	<td valign="top">
		<table border="0" cellpadding="1" cellspacing="0" width="100%">
		<tr>
		<td valign="top" width="50%">
			<b>Include In:</b><br>
			<label for="contacttype_sphereofinfluence"><input id="contacttype_sphereofinfluence" type="checkbox" name="contacttype" value="sphereofinfluence"> <b><u>Sphere of Influence</u></b></label><br>
			<br>
			<b>Common Categories</b><br>
			<label for="contacttype_familymember"><input id="contacttype_familymember" type="checkbox" name="contacttype" value="familymember"> <b><u>Family Member</u></b></label><br>
			<label for="contacttype_friend"><input id="contacttype_friend" type="checkbox" name="contacttype" value="friend"> <b><u>Friend</u></b></label><br>
			<br>
			<b>Buyer Categories</b><br>
			<label for="contacttype_buyeractive"><input id="contacttype_buyeractive" type="checkbox" name="contacttype" value="buyeractive"> <b><u>Buyer - Active</u></b></label><br>
			<label for="contacttype_buyerpast"><input id="contacttype_buyerpast" type="checkbox" name="contacttype" value="buyerpast"> <b><u>Buyer - Past</u></b></label><br>
			<label for="contacttype_buyerprospective"><input id="contacttype_buyerprospective" type="checkbox" name="contacttype" value="buyerprospective"> <b><u>Buyer - Prospective</u></b></label><br>
			<label for="contacttype_buyercreditwork"><input id="contacttype_buyercreditwork" type="checkbox" name="contacttype" value="buyercreditwork"> <b><u>Buyer - Credit Work</u></b></label><br>
			<br>
			<b>Seller Categories</b><br>
			<label for="contacttype_selleractive"><input id="contacttype_selleractive" type="checkbox" name="contacttype" value="selleractive"> <b><u>Seller - Active</u></b></label><br>
			<label for="contacttype_sellerprospective"><input id="contacttype_sellerprospective" type="checkbox" name="contacttype" value="sellerprospective"> <b><u>Seller - Prospective</u></b></label><br>
			<label for="contacttype_sellerpast"><input id="contacttype_sellerpast" type="checkbox" name="contacttype" value="sellerpast"> <b><u>Seller - Past SOLD</u></b></label><br>
			<label for="contacttype_sellerpastns"><input id="contacttype_sellerpastns" type="checkbox" name="contacttype" value="sellerpastns"> <b><u>Seller - Past NOT SOLD</u></b></label><br>
		</td>
		<td valign="top" width="50%">
			<b>Info Line Call</b><br>
			<label for="contacttype_infoline_ideal"><input id="contacttype_infoline_ideal" type="checkbox" name="contacttype" value="infoline_ideal"> <b><u>InfoLine - IDEAL</u></b></label><br>
			<label for="contacttype_infoline_buyer"><input id="contacttype_infoline_buyer" type="checkbox" name="contacttype" value="infoline_buyer"> <b><u>InfoLine - Buyer</u></b></label><br>
			<label for="contacttype_infoline_seller"><input id="contacttype_infoline_seller" type="checkbox" name="contacttype" value="infoline_seller"> <b><u>InfoLine - Seller</u></b></label><br>
			<label for="contacttype_infoline_property"><input id="contacttype_infoline_property" type="checkbox" name="contacttype" value="infoline_property"> <b><u>InfoLine - Property For Sale</u></b></label><br>
			<br>
			<b>Recieve Mailings</b><br>
			<label for="contacttype_newsletter"><input id="contacttype_newsletter" type="checkbox" name="contacttype" value="newsletter"> <b><u>Newsletter</u></b></label><br>
			<br>
			<b>Professional Category</b><br>
			<label for="contacttype_appraiser"><input id="contacttype_appraiser" type="checkbox" name="contacttype" value="appraiser"> <b><u>Appraiser</u></b></label><br>
			<label for="contacttype_inspector"><input id="contacttype_inspector" type="checkbox" name="contacttype" value="inspector"> <b><u>Inspector</u></b></label><br>
			<label for="contacttype_insuranceagent"><input id="contacttype_insuranceagent" type="checkbox" name="contacttype" value="insuranceagent"> <b><u>Insurance Agent</u></b></label><br>
			<label for="contacttype_lender"><input id="contacttype_lender" type="checkbox" name="contacttype" value="lender"> <b><u>Lender</u></b></label><br>
			<label for="contacttype_attorney"><input id="contacttype_attorney" type="checkbox" name="contacttype" value="attorney"> <b><u>Attorney</u></b></label><br>
			<label for="contacttype_titleagent"><input id="contacttype_titleagent" type="checkbox" name="contacttype" value="titleagent"> <b><u>Title Agent</u></b></label><br>
 		</td>
		</tr>
		</table>
	</td>
	</tr>
	<tr>
	<td valign="top"><b>Initial Contact Date</b><br></td>
	<td valign="top">
		<input type="text" size="10" name="initial_contactdate" value="$findsdate" class="form">&nbsp;<a href="javascript:cal1.popup();"><img src="images/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date"></a><br>
	</td>
	</tr>
	<tr bgcolor="#CCCCFF">
	<td valign="top"><b>Last Contact Date</b></td>
	<td valign="top">
		<input type="text" size="10" name="last_contactdate" class="form">&nbsp;<a href="javascript:cal2.popup();"><img src="images/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date"></a><br><br>
	</td>
	</tr>
	<tr>
	<td valign="top"><b>Next Contact Date</b><br><br>
	<td valign="top">
		<input type="text" size="10" name="next_contactdate" class="form">&nbsp;<a href="javascript:cal3.popup();"><img src="images/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date"></a><br>
	</td>
	</tr>
			<script language="JavaScript">
			<!-- //
				var cal1 = new calendar1(document.forms['ccontact'].elements['initial_contactdate']);
				cal1.year_scroll = true;
				cal1.time_comp = false;

				var cal2 = new calendar1(document.forms['ccontact'].elements['last_contactdate']);
				cal2.year_scroll = true;
				cal2.time_comp = false;

				var cal3 = new calendar1(document.forms['ccontact'].elements['next_contactdate']);
				cal3.year_scroll = true;
				cal3.time_comp = false;

			//-->
			</script>
	<tr bgcolor="#CCCCFF">
	<td valign="top"><b>Referral Source</b></td>
	<td valign="top">
		<select name="source" class="form">
		<option value="Not Selected">-- Select Lead Source --</option>
		<option value="Yard Sign Call">Yard Sign Call</option>
		<option value="The Star Press">The Star Press</option>
		<option value="Quincy Place Billboard">Quincy Place Billboard</option>
		<option value="Homes and Lifestyles">Homes and Lifestyles</option>
		<option value="Homes Guide - HC">Homes Guide - HC</option>
		<option value="MuncieMLS Website">MuncieMLS Website</option>
		<option value="Cold Calling">Cold Calling</option>
		<option value="Prospecting">Prospecting</option>
		<option value="Past Client">Past Client</option>
		<option value="Referal">Referal</option>
		<option value="Family">Family</option>
		<option value="Friend">Friend</option>
		</select>
		<br>
	</td>
	</tr>
	<tr>
	<td valign="top"><b>Contact Notes</b><br>You may keep track of notes about this contact in this area for later viewing</td>
	<td valign="top">
		<textarea rows="6" name="notes" cols="50" class="form"></textarea>
	</td>
	</tr>
	<tr>
	<td colspan="2"><center><input type="submit" value="Submit / Next Page" class="form" name="btnOK" value="Save"></center></td>
	</tr>
	</table>
</form>
</td>
~;

&footer;

}

sub create_prospect_verify {

#####id,agent,firstname,lastname,phone1type,phone1number,phone2type,phone2number,phone3type,phone3number,faxnumber,email,emailtwo,

use DBI;
my $dsn = "DBI:mysql:database=$d_name;host=localhost";
my $dbh = DBI->connect($dsn, $d_username, $d_pass, {RaiseError => 1}) || die $DBI::errstr;

$fcontacttype = "$INPUT{contacttype}";
$fcontacttype =~ s/\,/<br>/gi;

print qq~
<html>
<head>
<title>Verify New prospect -- Eagle Real Estate, Inc. - Connect.EagleSold.com</title>
~;

&header;


print qq~

<td valign="top" width="581">
<img src="images/headers/transaction_manager.gif" height="33" width="581" alt="My Transaction Manager"><br><br>
<img src="images/trans_sys/my_prospects.gif" alt="Create New prospect"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>verify new prospect information</b><br><br>
<form method="post" name="transactions" action="prospects.idx">
<input type="hidden" name="action" value="create_prospect_do">
<input type="hidden" name="agent" value="$INPUT{agent}">
<input type="hidden" name="prospect_type" value="$INPUT{prospect_type}">
~;
if ($INPUT{transid} eq "no") {
print qq~
~;
}
else {
print qq~
<input type="hidden" name="transid" value="$INPUT{transid}">
~;
}
print qq~
<input type="hidden" name="firstname" value="$INPUT{firstname}">
<input type="hidden" name="lastname" value="$INPUT{lastname}">
<input type="hidden" name="type" value="$INPUT{type}">
<input type="hidden" name="address" value="$INPUT{address}">
<input type="hidden" name="spouse" value="$INPUT{spouse}">
<input type="hidden" name="city" value="$INPUT{city}">
<input type="hidden" name="state" value="$INPUT{state}">
<input type="hidden" name="zip" value="$INPUT{zip}">
<input type="hidden" name="phone1type" value="$INPUT{phone1type}">
<input type="hidden" name="phone1number" value="$INPUT{phone1number}">
<input type="hidden" name="phone2type" value="$INPUT{phone2type}">
<input type="hidden" name="phone2number" value="$INPUT{phone2number}">
<input type="hidden" name="phone3type" value="$INPUT{phone3type}">
<input type="hidden" name="phone3number" value="$INPUT{phone3number}">
<input type="hidden" name="faxnumber" value="$INPUT{faxnumber}">
<input type="hidden" name="email" value="$INPUT{email}">
<input type="hidden" name="emailtwo" value="$INPUT{emailtwo}">
<input type="hidden" name="contacttype" value="$INPUT{contacttype}">
<input type="hidden" name="initial_contactdate" value="$INPUT{initial_contactdate}">
<input type="hidden" name="last_contactdate" value="$INPUT{last_contactdate}">
<input type="hidden" name="next_contactdate" value="$INPUT{next_contactdate}">
<input type="hidden" name="source" value="$INPUT{source}">
<input type="hidden" name="notes" value="$INPUT{notes}">

	<table border="0" width="500" cellpadding="3" cellspacing="1">	
	<tr>
	<td valign="top" width="50%"><b>Prospect Information</b></td>
	<td valign="top" width="50%">
	<b>Firstname</b><br>
	<font size="3">$INPUT{firstname}</font><br>
	<b>Spouse</b><br>
	<font size="3">$INPUT{spouse}</font><br>
	<b>Lastname</b><br>
	<font size="3">$INPUT{lastname}</font><br></td>
	</tr>
	<tr>
	<td valign="top" bgcolor="#CCCCFF"><b>Current Address</b></td>
	<td valign="top" bgcolor="#CCCCFF">
		<b>Address</b><br>
		<font size="3">$INPUT{address}</font><br>
		<b>City</b><br>
		<font size="3">$INPUT{city}</font><br>
		<b>State</b><br>
		<font size="3">$INPUT{state}</font><br>
		<b>Zip</b><br>
		<font size="3">$INPUT{zip}</font><br>
	</td>
	</tr>
	<tr>
	<td bgcolor="white"><b>Phone 1 Type</b><br>
	</td>
	<td bgcolor="white">
		<font size="3">$INPUT{phone1type} $INPUT{phone1number}</font>
	</td>
	</tr>
	<tr>
	<td bgcolor="white"><b>Phone 2 Type</b><br>
	</td>
	<td bgcolor="white">
		<font size="3">$INPUT{phone2type} $INPUT{phone2number}</font>
	</td>
	</tr>
	<tr>
	<td bgcolor="white"><b>Phone 3 Type</b><br>
	</td>
	<td bgcolor="white">
		<font size="3">$INPUT{phone3type} $INPUT{phone3number}</font>
	</td>
	</tr>
	<tr>
	<td valign="top"><b>Fax Number</b></td>
	<td valign="top">
		<font size="3">$INPUT{faxnumber}</font><br>
	</td>
	</tr>
	<tr>
	<td valign="top"><b>E-Mail Address</b></td>
	<td valign="top">
				<font size="3">$INPUT{email}</font><br>
	</td>
	</tr>
	<tr>
	<td valign="top"><b>E-Mail Address 2</b></td>
	<td valign="top">
		<font size="3">$INPUT{emailtwo}</font><br>
	</td>
	</tr>
	<tr bgcolor="#CCCCFF">
	<td valign="top"><b>Contact Type(s)</b></td>
	<td valign="top">
		$fcontacttype<br>
	</td>
	</tr>
	<tr>
	<td valign="top"><b>Initial Contact Date</b><br></td>
	<td valign="top">
		$INPUT{initial_contactdate}<br>
	</td>
	</tr>
	<tr bgcolor="#CCCCFF">
	<td valign="top"><b>Last Contact Date</b></td>
	<td valign="top">
		$INPUT{last_contactdate}<br>
	</td>
	</tr>
	<tr>
	<td valign="top"><b>Next Contact Date</b><br><br>
	<td valign="top">
		$INPUT{next_contactdate}<br>
	</td>
	</tr>
	<tr bgcolor="#CCCCFF">
	<td valign="top"><b>Referral Source</b></td>
	<td valign="top">
		$INPUT{source}
		<br>
	</td>
	</tr>
	<tr>
	<td valign="top" bgcolor="#CCCCFF"><b>Prospect Notes</b><br>You may keep track of notes about this contact in this area for later viewing</td>
	<td valign="top" bgcolor="#CCCCFF">
		<font size="3">$INPUT{notes}</font><br>
	</td>
	</tr>
	<tr>
	<td colspan="2"><center><input type="submit" value="Save New prospect" class="form"> <input type="button" value="Make Changes" onClick="history.back()" class="form"></center></td>
	</tr>
	</table>
</form>
</td>
~;

&footer;

}

sub create_prospect_do {

use DBI;
my $dsn = "DBI:mysql:database=$d_name;host=localhost";
my $dbh = DBI->connect($dsn, $d_username, $d_pass, {RaiseError => 1}) || die $DBI::errstr;						
@variables = ($INPUT{agent},$INPUT{type},$INPUT{firstname},$INPUT{lastname},$INPUT{address},$INPUT{spouse},$INPUT{city},$INPUT{state},$INPUT{zip},$INPUT{phone1type},$INPUT{phone1number},$INPUT{phone2type},$INPUT{phone2number},$INPUT{phone3type},$INPUT{phone3number},$INPUT{faxnumber},$INPUT{email},$INPUT{emailtwo},$INPUT{contacttype},$INPUT{initial_contactdate},$INPUT{last_contactdate},$INPUT{next_contactdate},$INPUT{source},$INPUT{notes});
$sql_query = "INSERT INTO trans_boardprospect values ('',?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
my $aasth = $dbh->do($sql_query, undef, @variables);

my $zaasth = $dbh->prepare("select id from trans_boardprospect WHERE agent = '$INPUT{agent}' ORDER BY id DESC LIMIT 0,1");
$zaasth->execute;
while (($prospectid) = $zaasth->fetchrow_array()) {

print qq~
<html>
<head>
<title>Making Changes to Datebase</title>
<meta http-equiv="Refresh" content="1; URL=http://connect.eaglesold.com/prospects.idx?action=overview_prospect&agent=$INPUT{agent}&prospectid=$prospectid">
</head>
<body bgcolor="white">
<br><br><br><br>
<center><font size="3" face="Arial" color="Red">Please wait, Processing</font><br>You will be redirected to when finished.  If not <a href="http://connect.eaglesold.com/prospects.idx?action=overview&transid=$INPUT{transid}&agent=$INPUT{agent}">Click Here</a>.</center>
</body>
</html>
~;
}

}

sub upload_document {

if ($INPUT{cat} eq "c") {
$upload_for = "contact";
}
elsif ($INPUT{cat} eq "p") {
$upload_for = "prospect";
}
else {
$upload_for = "Transaction";
}

print qq~<b>Upload New $upload_for Document</b>
<br><br>
<FORM action="upload_doc.idx" encType=multipart/form-data method=post>
<input type=hidden name=matchid value="$INPUT{id}">
<input type=hidden name=matchcat value="$INPUT{cat}">
Title: <input type=text name=name size=34><br>
File: <INPUT name=FILE1 type=file> <br>
<INPUT type=submit value=" Upload File ">
</form>
~;


}

sub overview_documents_prospect {

$show_icon{pdf} = qq~<img src="http://connect.eaglesold.com/images/documents/small-pdf-icon.gif" alt="PDF Document">~;
$show_icon{doc} = qq~<img src="http://connect.eaglesold.com/images/documents/small-word-icon.jpg" alt="Microsoft Word Document">~;
$show_icon{jpg} = qq~<img src="http://connect.eaglesold.com/images/documents/small-jpg-icon.jpg" alt="JPG Photo">~;
$show_icon{gif} = qq~<img src="http://connect.eaglesold.com/images/documents/small-jpg-icon.jpg" alt="Gif Photo">~;

use DBI;
my $dsn = "DBI:mysql:database=$d_name;host=localhost";
my $dbh = DBI->connect($dsn, $d_username, $d_pass, {RaiseError => 1}) || die $DBI::errstr;

print qq~
<html>
<head>
<title>Eagle Real Estate, Inc. - Connect.EagleSold.com</title>
<link rel="stylesheet" TYPE="text/css" href="includes/style.css">
<body bgcolor="white" leftMargin="0" topMargin="0" marginwidth="0" marginheight="0">
<table border="0" cellpadding="1" cellspacing="0" width="100%">
<tr>
<td valign="top">
<table border="0" width="100%" cellpadding="2" cellspacing="0">
~;
$trcolor = "1";
$trcolor2 = "2";
my $basth = $dbh->prepare("select did,DATE_FORMAT(dateadded, '%b %D, %Y at %h\:%i%p'),addedbyname,name,newfileext from documents where matchid = '$INPUT{prospectid}' and matchcat = 'p' ORDER BY dateadded DESC");
$basth->execute;
while (($d_did,$d_dateadded,$d_addedbyname,$d_name,$d_newfileext) = $basth->fetchrow_array()) {

	if ($trcolor eq $trcolor2) {
	$trcolor = "1";
	$setcolor = "#FFFFFF";
	}
	else {
	$setcolor = "#CCCCFF";
	$trcolor++;
	}

print qq~
<tr bgcolor="$setcolor">
<td>$show_icon{$d_newfileext}</td>
<td width="100%"><a href="http://connect.eaglesold.com/download_doc.idx?did=$d_did">$d_name</a></td>
<td><a href="http://connect.eaglesold.com/delete_doc.idx?did=$d_did&matchcat=t"><img src="images/trans_sys/icons/delete-page-red.gif" alt="Delete $d_name" border="0"></a></td>
</tr>
<tr bgcolor="$setcolor">
<td width="100%" colspan="3"><i>Added by $d_addedbyname on $d_dateadded </i><br></td>
</tr>
~;

$found = "yes";
}

unless ($found eq "yes") {
print qq~
<tr><td width="100%"><font color="red"><b>No Documents have been uploaded yet!</b></font></td></tr>
~;
}
print qq~
</table>
</td>
</tr>
</table>
</body>
</html>
~;
}

sub overview_prospect_edit {

use DBI;
my $dsn = "DBI:mysql:database=$d_name;host=localhost";
my $dbh = DBI->connect($dsn, $d_username, $d_pass, {RaiseError => 1}) || die $DBI::errstr;

my $aaasth = $dbh->prepare("select id,agent,firstname,lastname,address,spouse,city,state,zip,phone1type,phone1number,phone2type,phone2number,phone3type,phone3number,faxnumber,email,emailtwo,contacttype,initial_contactdate,last_contactdate,next_contactdate,source,notes from trans_boardprospect WHERE id = '$INPUT{prospectid}'");
$aaasth->execute;

while (($id,$agent,$firstname,$lastname,$address,$spouse,$city,$state,$zip,$phone1type,$phone1number,$phone2type,$phone2number,$phone3type,$phone3number,$faxnumber,$email,$emailtwo,$contacttype,$initial_contactdate,$last_contactdate,$next_contactdate,$source,$notes) = $aaasth->fetchrow_array()) {

if ($initial_contactdate eq "0000-00-00") {
$initial_contactdate = "";
}

if ($last_contactdate eq "0000-00-00") {
$last_contactdate = "";
}

if ($next_contactdate eq "0000-00-00") {
$next_contactdate = "";
}

if ($zip eq "0") {
$zip = "";
}

(@db_contacttypes) = split(/\,/, $contacttype);
foreach $ctype (@db_contacttypes) {
$checked_ctypes{$ctype} = "checked";
}

$getstate = "<option value=\"$state\">$state</option>";
$getstate .= "<option value=\"\">--------</option>";

$getphone1type = "<option value=\"$phone1type\">$phone1type</option>";
$getphone1type .= "<option value=\"\">--------</option>";

$getphone2type = "<option value=\"$phone2type\">$phone2type</option>";
$getphone2type .= "<option value=\"\">--------</option>";

$getphone3type = "<option value=\"$phone3type\">$phone3type</option>";
$getphone3type .= "<option value=\"\">--------</option>";

$getemailtwo = "<option value=\"$emailtwo\">$emailtwo</option>";
$getemailtwo .= "<option value=\"\">--------</option>";

$get_source = "<option value=\"$source\">$source</option>";
$get_source .= "<option value=\"\">--------</option>";

print qq~
<html>
<head>
<title>Edit prospect -- Eagle Real Estate, Inc. - Connect.EagleSold.com</title>
~;

&header;


print qq~

<td valign="top" width="581">
<script language="JavaScript" src="calendar1.js"></script>
<img src="images/headers/transaction_manager.gif" height="33" width="581" alt="My Transaction Manager"><br><br>
<img src="images/trans_sys/edit_prospect.gif" alt="Edit prospect"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Edit the information below to edit your prospect</b><br><br>
<form method="post" name="econtact" action="prospects.idx">
<input type="hidden" name="action" value="overview_prospect_doedit">
<input type="hidden" name="prospectid" value="$INPUT{prospectid}">
<input type="hidden" name="agent" value="$INPUT{agent}">

	<table border="0" width="500" cellpadding="3" cellspacing="1">	
	<tr>
	<td valign="top"><b>Prospect Information</b></td>
	<td valign="top"><b>Firstname</b><br>
	<input type="text" name="firstname" value="$firstname" class="form"><br>
	<b>Spouse Name</b><br>
	<input type="text" name="spouse" value="$spouse" class="form"><br>
	<b>Lastname</b><br>
	<input type="text" name="lastname" value="$lastname" class="form"><br>
</td>
	</tr>
	<tr bgcolor="#CCCCFF">
	<td valign="top"><b>Current Address</b></td>
	<td valign="top">
		<b>Address</b><br>
		<input type="text" name="address" value="$address" size="40" class="form"><br>
		<b>City</b><br>
		<input type="text" name="city" value="$city" size="12" class="form"><br>
		<b>State</b><br>
		<select name="state" class="form">$getstate<option value="Alabama">Alabama</option>
<option value="Alaska">Alaska</option>
<option value="Arizona">Arizona</option>
<option value="Arkansas">Arkansas</option>
<option value="California">California</option>
<option value="Colorado">Colorado</option> 
<option value="Connecticut">Connecticut</option>
<option value="Delaware">Delaware</option>
<option value="District of Columbia">District of Columbia</option>
<option value="Florida">Florida</option>
<option value="Georgia">Georgia</option>
<option value="Hawaii">Hawaii</option>
<option value="Idaho">Idaho</option>
<option value="Illinois">Illinois</option>
<option value="Indiana" selected>Indiana</option>
<option value="Iowa">Iowa</option>
<option value="Kansas">Kansas</option>
<option value="Kentucky">Kentucky</option>
<option value="Louisiana">Louisiana</option>
<option value="Maine">Maine</option>
<option value="Maryland">Maryland</option>
<option value="Massachusetts">Massachusetts</option>
<option value="Michigan">Michigan</option>
<option value="Minnesota">Minnesota</option>
<option value="Mississippi">Mississippi</option>
<option value="Missouri">Missouri</option>
<option value="Montana">Montana</option>
<option value="Nebraska">Nebraska</option>
<option value="Nevada">Nevada</option>
<option value="New Hampshire">New Hampshire</option>
<option value="New Jersey">New Jersey</option>
<option value="New Mexico">New Mexico</option>
<option value="New York">New York</option>
<option value="North Carolina">North Carolina</option>
<option value="North Dakota">North Dakota</option>
<option value="Ohio">Ohio</option>
<option value="Oklahoma">Oklahoma</option>
<option value="Oregon">Oregon</option>
<option value="Pennsylvania">Pennsylvania</option>
<option value="Rhode Island">Rhode Island</option>
<option value="South Carolina">South Carolina</option>
<option value="South Dakota">South Dakota</option>
<option value="Tennessee">Tennessee</option>
<option value="Texas">Texas</option>
<option value="Utah">Utah</option>
<option value="Vermont">Vermont</option>
<option value="Virgin Islands">Virgin Islands</option>
<option value="Virginia">Virginia</option>
<option value="Washington">Washington</option>
<option value="West Virginia">West Virginia</option>
<option value="Wisconsin">Wisconsin</option>
<option value="Wyoming">Wyoming</option></select><br>
<b>Zip</b><br><input type="text" name="zip" size="5" value="$zip" class="form">
	</td>
	</tr>
	<tr>
	<td bgcolor="white"><b>Phone 1 Type</b><br>
	</td>
	<td bgcolor="white">
		<select name="phone1type" class="form">
		$getphone1type
		<option value="">-- No Number --</option>
		<option value="Home">Home</option>
		<option value="Work">Work</option>
		<option value="Home Office">Home Office</option>
		<option value="Mobile">Mobile</option>
		<option value="Voicemail">Voicemail</option>
		<option value="Pager">Pager</option>
		</select> 
		<input type="text" name="phone1number" value="$phone1number" class="form">
	</td>
	</tr>
	<tr>
	<td bgcolor="white"><b>Phone 2 Type</b><br>
	</td>
	<td bgcolor="white">
		<select name="phone2type" class="form">
		$getphone2type
		<option value="">-- No Number --</option>
		<option value="Home">Home</option>
		<option value="Work">Work</option>
		<option value="Home Office">Home Office</option>
		<option value="Mobile">Mobile</option>
		<option value="Voicemail">Voicemail</option>
		<option value="Pager">Pager</option>
		</select> 
		<input type="text" name="phone2number" value="$phone2number" class="form">
	</td>
	</tr>
	<tr>
	<td bgcolor="white"><b>Phone 3 Type</b><br>
	</td>
	<td bgcolor="white">
		<select name="phone3type" class="form">
		$getphone3type
		<option value="">-- No Number --</option>
		<option value="Home">Home</option>
		<option value="Work">Work</option>
		<option value="Home Office">Home Office</option>
		<option value="Mobile">Mobile</option>
		<option value="Voicemail">Voicemail</option>
		<option value="Pager">Pager</option>
		</select> 
		<input type="text" name="phone3number" value="$phone3number" class="form">
	</td>
	</tr>
	<tr>
	<td valign="top"><b>Fax Number</b></td>
	<td valign="top">
		<input type="text" name="faxnumber" value="$faxnumber" size="20" class="form"><br>
	</td>
	</tr>
	<tr>
	<td valign="top"><b>E-Mail Address</b></td>
	<td valign="top">
				<input type="Text" name="email" value="$email" size="40" class="form"><br>
	</td>
	</tr>
	<tr>
	<td valign="top"><b>E-Mail Address 2</b></td>
	<td valign="top">
		<b><input type="Text" name="emailtwo" value="$emailtwo" size="40" class="form"><br>
	</td>
	</tr>
	<tr bgcolor="#CCCCFF">
	<td valign="top"><b>Check all Contact Types that apply</b></td>
	<td valign="top">
		<table border="0" cellpadding="1" cellspacing="0" width="100%">
		<tr>
		<td valign="top">
			<b>Include In:</b><br>
			<label for="contacttype_sphereofinfluence"><input id="contacttype_sphereofinfluence" type="checkbox" name="contacttype" value="sphereofinfluence" $checked_ctypes{sphereofinfluence}> <b><u>Sphere of Influence</u></b></label><br>
			<br>
			<b>Common Categories</b><br>
			<label for="contacttype_familymember"><input id="contacttype_familymember" type="checkbox" name="contacttype" value="familymember" $checked_ctypes{familymember}> <b><u>Family Member</u></b></label><br>
			<label for="contacttype_friend"><input id="contacttype_friend" type="checkbox" name="contacttype" value="friend" $checked_ctypes{friend}> <b><u>Friend</u></b></label><br>
			<br>
			<b>Buyer Categories</b><br>
			<label for="contacttype_buyeractive"><input id="contacttype_buyeractive" type="checkbox" name="contacttype" value="buyeractive" $checked_ctypes{buyeractive}> <b><u>Buyer - Active</u></b></label><br>
			<label for="contacttype_buyerpast"><input id="contacttype_buyerpast" type="checkbox" name="contacttype" value="buyerpast" $checked_ctypes{buyerpast}> <b><u>Buyer - Past</u></b></label><br>
			<label for="contacttype_buyerprospective"><input id="contacttype_buyerprospective" type="checkbox" name="contacttype" value="buyerprospective" $checked_ctypes{buyerprospective}> <b><u>Buyer - Prospective</u></b></label><br>
			<label for="contacttype_buyercreditwork"><input id="contacttype_buyercreditwork" type="checkbox" name="contacttype" value="buyercreditwork" $checked_ctypes{buyercreditwork}> <b><u>Buyer - Credit Work</u></b></label><br>
			<br>
			<b>Seller Categories</b><br>
			<label for="contacttype_selleractive"><input id="contacttype_selleractive" type="checkbox" name="contacttype" value="selleractive" $checked_ctypes{selleractive}> <b><u>Seller - Active</u></b></label><br>
			<label for="contacttype_sellerprospective"><input id="contacttype_sellerprospective" type="checkbox" name="contacttype" value="sellerprospective" $checked_ctypes{sellerprospective}> <b><u>Seller - Prospective</u></b></label><br>
			<label for="contacttype_sellerpast"><input id="contacttype_sellerpast" type="checkbox" name="contacttype" value="sellerpast" $checked_ctypes{sellerpast}> <b><u>Seller - Past SOLD</u></b></label><br>
			<label for="contacttype_sellerpastns"><input id="contacttype_sellerpastns" type="checkbox" name="contacttype" value="sellerpastns" $checked_ctypes{sellerpastns}> <b><u>Seller - Past NOT SOLD</u></b></label><br>
		</td>
		<td valign="top" width="50%">
			<b>Info Line Call</b><br>
			<label for="contacttype_infoline_ideal"><input id="contacttype_infoline_ideal" type="checkbox" name="contacttype" value="infoline_ideal" $checked_ctypes{infoline_ideal}> <b><u>InfoLine - IDEAL</u></b></label><br>
			<label for="contacttype_infoline_buyer"><input id="contacttype_infoline_buyer" type="checkbox" name="contacttype" value="infoline_buyer" $checked_ctypes{infoline_buyer}> <b><u>InfoLine - Buyer</u></b></label><br>
			<label for="contacttype_infoline_seller"><input id="contacttype_infoline_seller" type="checkbox" name="contacttype" value="infoline_seller" $checked_ctypes{infoline_seller}> <b><u>InfoLine - Seller</u></b></label><br>
			<label for="contacttype_infoline_property"><input id="contacttype_infoline_property" type="checkbox" name="contacttype" value="infoline_property" $checked_ctypes{infoline_property}> <b><u>InfoLine - Property For Sale</u></b></label><br>
			<br>
			<b>Recieve Mailings</b><br>
			<label for="contacttype_newsletter"><input id="contacttype_newsletter" type="checkbox" name="contacttype" value="newsletter" $checked_ctypes{newletter}> <b><u>Newsletter</u></b></label><br>
			<br>
			<b>Professional Category</b><br>
			<label for="contacttype_appraiser"><input id="contacttype_appraiser" type="checkbox" name="contacttype" value="appraiser" $checked_ctypes{appraiser}> <b><u>Appraiser</u></b></label><br>
			<label for="contacttype_inspector"><input id="contacttype_inspector" type="checkbox" name="contacttype" value="inspector" $checked_ctypes{inspector}> <b><u>Inspector</u></b></label><br>
			<label for="contacttype_insuranceagent"><input id="contacttype_insuranceagent" type="checkbox" name="contacttype" value="insuranceagent" $checked_ctypes{insuranceagent}> <b><u>Insurance Agent</u></b></label><br>
			<label for="contacttype_lender"><input id="contacttype_lender" type="checkbox" name="contacttype" value="lender" $checked_ctypes{lender}> <b><u>Lender</u></b></label><br>
			<label for="contacttype_attorney"><input id="contacttype_attorney" type="checkbox" name="contacttype" value="attorney" $checked_ctypes{attorney}> <b><u>Attorney</u></b></label><br>
			<label for="contacttype_titleagent"><input id="contacttype_titleagent" type="checkbox" name="contacttype" value="titleagent" $checked_ctypes{titleagent}> <b><u>Title Agent</u></b></label><br>
 		</td>
		</tr>
		</table>
	</td>
	</tr>
	<tr>
	<td valign="top"><b>Initial Contact Date</b><br></td>
	<td valign="top">
		<input type="text" size="10" name="initial_contactdate" value="$initial_contactdate" class="form">&nbsp;<a href="javascript:cal1.popup();"><img src="images/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date"></a><br>
	</td>
	</tr>
	<tr bgcolor="#CCCCFF">
	<td valign="top"><b>Last Contact Date</b></td>
	<td valign="top">
		<input type="text" size="10" name="last_contactdate" value="$last_contactdate" class="form">&nbsp;<a href="javascript:cal2.popup();"><img src="images/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date"></a><br><br>
	</td>
	</tr>
	<tr>
	<td valign="top"><b>Next Contact Date</b><br><br>
	<td valign="top">
		<input type="text" size="10" name="next_contactdate" value="$next_contactdate" class="form">&nbsp;<a href="javascript:cal3.popup();"><img src="images/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date"></a><br>
	</td>
	</tr>
			<script language="JavaScript">
			<!-- //
				var cal1 = new calendar1(document.forms['econtact'].elements['initial_contactdate']);
				cal1.year_scroll = true;
				cal1.time_comp = false;

				var cal2 = new calendar1(document.forms['econtact'].elements['last_contactdate']);
				cal2.year_scroll = true;
				cal2.time_comp = false;

				var cal3 = new calendar1(document.forms['econtact'].elements['next_contactdate']);
				cal3.year_scroll = true;
				cal3.time_comp = false;

			//-->
			</script>
	<tr bgcolor="#CCCCFF">
	<td valign="top"><b>Referral Source</b></td>
	<td valign="top">
		<select name="source" class="form">
		$get_source
		<option value="Yard Sign Call">Yard Sign Call</option>
		<option value="The Star Press">The Star Press</option>
		<option value="Quincy Place Billboard">Quincy Place Billboard</option>
		<option value="Homes and Lifestyles">Homes and Lifestyles</option>
		<option value="Homes Guide - HC">Homes Guide - HC</option>
		<option value="MuncieMLS Website">MuncieMLS Website</option>
		<option value="Cold Calling">Cold Calling</option>
		<option value="Prospecting">Prospecting</option>
		<option value="Past Client">Past Client</option>
		<option value="Referal">Referal</option>
		<option value="Family">Family</option>
		<option value="Friend">Friend</option>
		</select>
		<br>
	</td>
	</tr>

	<tr>
	<td valign="top" bgcolor="#CCCCFF"><b>Contact Notes</b><br>You may keep track of notes about this contact in this area for later viewing</td>
	<td valign="top" bgcolor="#CCCCFF">
		<textarea rows="6" name="notes" cols="50" class="form">$notes</textarea>
	</td>
	</tr>
	<tr>
	<td colspan="2"><center><input type="submit" value="Save Changes" class="form">&nbsp&nbsp;&nbsp;<a href="prospects.idx?action=overview_prospect&agent=$INPUT{agent}&prospectid=$INPUT{prospectid}">Cancel</a></center></td>
	</tr>
	</table>
</form>
</td>
~;
}

&footer;

}



sub overview_prospect_doedit {

use DBI;
my $dsn = "DBI:mysql:database=$d_name;host=localhost";
my $dbh = DBI->connect($dsn, $d_username, $d_pass, {RaiseError => 1}) || die $DBI::errstr;

@variables = ($INPUT{firstname},$INPUT{lastname},$INPUT{address},$INPUT{spouse},$INPUT{city},$INPUT{state},$INPUT{zip},$INPUT{phone1type},$INPUT{phone1number},$INPUT{phone2type},$INPUT{phone2number},$INPUT{phone3type},$INPUT{phone3number},$INPUT{faxnumber},$INPUT{email},$INPUT{emailtwo},$INPUT{contacttype},$INPUT{initial_contactdate},$INPUT{last_contactdate},$INPUT{next_contactdate},$INPUT{source},$INPUT{notes},$INPUT{prospectid});
$sql_query = "update trans_boardprospect set firstname = ?, lastname = ?, address = ?, spouse = ?, city = ?, state = ?, zip = ?, phone1type = ?, phone1number = ?, phone2type = ?, phone2number = ?, phone3type = ?, phone3number = ?, faxnumber = ?, email = ?, emailtwo = ?, contacttype = ?, initial_contactdate = ?, last_contactdate = ?, next_contactdate = ?, source = ?, notes = ? where id = ?";
my $aasth = $dbh->do($sql_query, undef, @variables);

print qq~
<html>
<head>
<title>Making Changes to Datebase</title>
<meta http-equiv="Refresh" content="2; URL=http://connect.eaglesold.com/prospects.idx?action=overview_prospect&agent=$INPUT{agent}&prospectid=$INPUT{prospectid}">
</head>
<body bgcolor="white">
<br><br><br><br>
<center><font size="3" face="Arial" color="Red">Please wait, Processing</font><br>You will be redirected to when finished.  If not <a href="http://connect.eaglesold.com/prospects.idx?action=overview_prospect&agent=$INPUT{agent}&prospectid=$INPUT{prospectid}">Click Here</a>.</center>
</body>
</html>
~;


}

sub overview_prospect_delete {

use DBI;
my $dsn = "DBI:mysql:database=$d_name;host=localhost";
my $dbh = DBI->connect($dsn, $d_username, $d_pass, {RaiseError => 1}) || die $DBI::errstr;

if ($INPUT{do} eq "yes") {


@cvariables = ($INPUT{prospectid});
$csql_query = "DELETE FROM trans_boardprospect WHERE id = ?";
my $caasth = $dbh->do($csql_query, undef, @cvariables);

@ncvariables = ($INPUT{prospectid});
$ncsql_query = "DELETE FROM trans_boardprospectnotes WHERE prospectid = ?";
my $ncaasth = $dbh->do($ncsql_query, undef, @ncvariables);

@variables = ($INPUT{prospectid});
$sql_query = "DELETE FROM trans_boardtranstoprospect WHERE prospectid = ?";
my $aasth = $dbh->do($sql_query, undef, @variables);

my $zaasth = $dbh->prepare("select did,newfileext from documents WHERE matchcat = 'p' AND matchid = '$INPUT{prospectid}'");
$zaasth->execute;
while (($pdid,$pnewfileext) = $zaasth->fetchrow_array()) {
unlink("/home/muncieml/public_html/connect/documents/$pdid.$pnewfileext");
}

@docvariables = ($INPUT{prospectid});
$docsql_query = "DELETE FROM documents WHERE matchcat = 'p' AND matchid = ?";
my $docasth = $dbh->do($docsql_query, undef, @docvariables);


print qq~
<html>
<head>
<title>Making Changes to Datebase</title>
<meta http-equiv="Refresh" content="1; URL=http://connect.eaglesold.com/prospects.idx?agent=$INPUT{agent}">
</head>
<body bgcolor="white">
<br><br><br><br>
<center><font size="3" face="Arial" color="Red">Please wait, Processing</font><br><br>
<font color="red">
Removing Prospect Information<br>
Removing Prospect Notes Information<br>
Removing Prospect Links To Listings<br>
Removing Prospect Documents<br>
Removing Prospect Documents Information<br>
</font>
<br><br>
You will be redirected to when finished.  If not <a href="http://connect.eaglesold.com/prospects.idx?agent=$INPUT{agent}">Click Here</a>.</center>
</body>
</html>
~;
}
else {

print qq~
<html>
<head>
<title>Edit Transaction -- Eagle Real Estate, Inc. -  Connect.EagleSold.com</title>
~;

&header;

print qq~
<td valign="top" width="581">
<img src="images/headers/transaction_manager.gif" height="33" width="581" alt="My Transaction Manager"><br><br>
<font size="4" color="red">Really Delete prospect $INPUT{name}?</font><br>
are you sure you want to remove?<br><br>
<a href="prospects.idx?action=overview_prospect_delete&agent=$INPUT{agent}&prospectid=$INPUT{prospectid}&do=yes">Yes</a> or <a href="prospects.idx?agent=$INPUT{agent}">No [ Cancel ]</a><br><br>
If you select yes the following information will be removed:<br><br>
<font color="red">
Remove Prospect Information<br>
Remove Prospect Notes Information<br>
Remove Prospect Links To Listings<br>
Remove Prospect Documents<br>
Remove Prospect Documents Information<br>
</font>
</td>
~;

&footer;

}





}

sub overview_prospect {

use DBI;
my $dsn = "DBI:mysql:database=$d_name;host=localhost";
my $dbh = DBI->connect($dsn, $d_username, $d_pass, {RaiseError => 1}) || die $DBI::errstr;

if ($INPUT{addnote} eq "1") {

	my $usrdasth = $dbh->prepare("select firstname,lastname from users where userid = '$Cook{userid}'");
	$usrdasth->execute;
	while (($afirstname,$alastname) = $usrdasth->fetchrow_array()) {
	$generateaddedby = "$afirstname $alastname";
	}

	@variables = ($INPUT{prospectid},$generateaddedby,$INPUT{prospect_notes});
	$sql_query = "INSERT INTO trans_boardprospectnotes values ('',?,now(),?,?)";
	my $zzaasth = $dbh->do($sql_query, undef, @variables);

	
	if ($INPUT{todo} eq "yes") {

	my $zzdasth = $dbh->prepare("select DATE_FORMAT(now(), '%Y-%m-%d')");
	$zzdasth->execute;
	while (($gnow) = $zzdasth->fetchrow_array()) {
	$good_date = $gnow;
	}
	
	$prospect_notes = "<i>Prospect note added to $INPUT{name} by $generateaddedby:</i><br>";
	$prospect_notes .= "$INPUT{prospect_notes}";
	
	@insert_vars = ($INPUT{agent},TransactionSystem,None,$good_date,$prospect_notes);
	
	$tsql_query = "insert into todo values ('',?,?,?,?,?,'$INPUT{todo_mark}')";
	$yasth = $dbh->do($tsql_query, undef, @insert_vars);
	}

}

my $basth = $dbh->prepare("select id,agent,type,firstname,lastname,address,spouse,city,state,zip,phone1type,phone1number,phone2type,phone2number,phone3type,phone3number,faxnumber,email,emailtwo,contacttype,DATE_FORMAT(initial_contactdate, '%b %D, %Y'),DATE_FORMAT(last_contactdate, '%b %D, %Y'),DATE_FORMAT(next_contactdate, '%b %D, %Y'),source,notes from trans_boardprospect WHERE id = '$INPUT{prospectid}'");
$basth->execute;


print qq~
<html>
<head>
<title>My Prospect Overview -- Eagle Real Estate, Inc.</title>
~;

&header;


print qq~
<td valign="top" width="581">
<img src="images/headers/transaction_manager.gif" height="33" width="581" alt="My Transaction Manager"><br><br>
<img src="images/trans_sys/my_prospects.gif" alt="My prospect Overview"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Navigation:</b> <a href="prospects.idx?agent=$INPUT{agent}">go back to prospects</a><br><br>
~;

#id,agent,type,firstname,lastname,phone1type,phone1number,phone2type,phone2number,phone3type,phone3number,faxnumber,email,emailtwo

while (($id,$agent,$type,$firstname,$lastname,$address,$spouse,$city,$state,$zip,$phone1type,$phone1number,$phone2type,$phone2number,$phone3type,$phone3number,$faxnumber,$email,$emailtwo,$contacttype,$initial_contactdate,$last_contactdate,$next_contactdate,$source,$notes) = $basth->fetchrow_array()) {

$contacttype =~ s/\,/ - /gi;

unless ($initial_contactdate) {
$initial_contactdate = "<font color=\"Red\">Not Entered</font>";
}

unless ($last_contactdate) {
$last_contactdate = "<font color=\"Red\">Not Entered</font>";
}

unless ($next_contactdate) {
$next_contactdate = "<font color=\"Red\">Not Entered</font>";
}

if ($spouse ne "") {
$spouse = " & $spouse ";
}
else {
$spouse = "";
}

print qq~
<table border="0" cellpadding="3" cellspacing="0" width="100%">
<tr>
<td colspan="3" valign="middle">
<img src="images/contacts_icon.gif" alt="$firstname$spouse $lastname"><font size="4" face="Arial Black">$firstname$spouse $lastname<br></font>
</td>
</tr>
<tr>
<td valign="top" width="33%">
<font face="Arial" size="2">
<b>Address</b><br>
$address<br>
$city, $state, $zip<br>
</font><br>
~;
if ($type eq "office") {
print qq~
<center>
<table border="0" cellpadding="1" cellspacing="0" width="100%" bgcolor="#ffffcc">
<tr>
<td valign="middle">
<img src="images/lock.gif" width="45" height="46" alt="Prospect is Locked"><br>
</td>
<td valign="middle">
<b>Prospect Is Locked By The Front Office</b><br>Any Changes Must be made by the Office or you may Copy below!<br>
</td>
</tr>
</table>
</center><br>
<a href="prospects.idx?action=overview_prospect_copy&agent=$INPUT{agent}&prospectid=$id&name=$firstname $lastname"><img src="images/trans_sys/button_delete.gif" alt="Copy To Contact" border="0"> Copy As New Contact</a><br><br>
<a href="prospects.idx?action=overview_prospect_copyprospect&agent=$INPUT{agent}&prospectid=$id&name=$firstname $lastname"><img src="images/trans_sys/button_delete.gif" alt="Copy To Contact" border="0"> Copy As New Prospect</a><br><br>
~;
}
else {
print qq~
<a href="prospects.idx?action=overview_prospect_edit&agent=$INPUT{agent}&prospectid=$id"><img src="images/trans_sys/button_edit.gif" alt="Edit prospect" border="0"> Edit prospect</a><br>
<a href="prospects.idx?action=overview_prospect_delete&agent=$INPUT{agent}&prospectid=$id&name=$firstname $lastname"><img src="images/trans_sys/button_delete.gif" alt="Delete prospect" border="0"> Delete prospect</a><br>
<a href="prospects.idx?action=overview_prospect_convert&agent=$INPUT{agent}&prospectid=$id&name=$firstname $lastname"><img src="images/trans_sys/button_delete.gif" alt="Convert To Contact" border="0"> Convert To Contact</a><br><br>
~;
}
print qq~
</td>
<td valign="top" width="33%">
<b><font size="2" face="Arial">Prospect Info</font></b><br>
<b>$phone1type</b> $phone1number<br>
<b>$phone2type</b> $phone2number<br>
<b>$phone3type</b> $phone3number<br>
<b>Fax</b> $faxnumber<br>
<b>E-Mail Address:</b> <a href="prospects.idx?action=myemailer&agent=$INPUT{agent}&prospectid=$id">$email</a><br>
<b>Email Address 2:</b> $emailtwo<br>
~;
unless ($email eq "") {
print qq~
<a href="prospects.idx?action=myemailer&agent=$INPUT{agent}&prospectid=$id">Send E-Mail</a><br>
~;
}
print qq~
</td>
<td valign="top" width="34%">
<b>Initial Contact Date</b><br>
<i>$initial_contactdate</i><br>
<b>Last Contact Date</b><br>
<i>$last_contactdate</i><br>
<b>Next Contact Date</b><br>
<i>$next_contactdate</i><br><br>
<b>Referal Source</b><br>
<i>$source</i><br>
</td>
</tr>
<tr>
<td>
<b>Contact Type(s)</b><br>
$contacttype<br><br>
</td>
<td colspan="2">
<b>Notes</b><br>
$notes<br><br>
</td>
</tr>
</table><br>
<br><br>
<table border="0" cellpadding="1" cellspacing="0" width="100%">
<tr>
<td valign="top" width="100%" colspan="2">
	<table border="0" cellpadding="3" cellspacing="0" width="100%">
	<tr>
		<td valign="top" bgcolor="navy" nowrap><font color="white" size="2"><b>Listing(s) Prospect Is Linked To</b></font><br></td>
		<td valign="top" bgcolor="navy" align="right"></td>
	</tr>
	</table>
</td>
</tr>
<tr>
<td valign="top" width="65%">
<center>
<b><font size="3" face="Tahoma">Find Property Below</font></b><br><br>
<b>Select Address</b><br>
<form method="get" action="prospects.idx" target="link">
<input type="hidden" name="action" value="overview_prospects_linked">
<input type="hidden" name="do" value="add">
<input type="hidden" name="prospectid" value="$INPUT{prospectid}">
<select name="transid" class="form">
~;

my $aasth = $dbh->prepare("select id,type,mlsnumber,addressnumber,addressdirection,addressstreet,city,state,zip from trans_board where status = 'Active' or status = 'Pending' GROUP BY mlsnumber ORDER BY addressstreet asc");
$aasth->execute;
while (($tid,$ttype,$tmlsnumber,$taddressnumber,$taddressdirection,$taddressstreet,$tcity,$tstate,$tzip) = $aasth->fetchrow_array()) {
print qq~
<option value="$tid">$taddressstreet - $taddressnumber $taddressdirection - $tcity -- MLS #$tmlsnumber</option>
~;\n
}

print qq~
</select>
<br><br>
<input type="submit" class="form" value="Link prospect to this listing">
</form>
</center>
<br>
</td>
<td valign="top" width="35%">
		<iframe src="prospects.idx?action=overview_prospects_linked&prospectid=$id" width="100%" height="150" noresize="noresize" scrolling ="yes" name="link" frameborder="0" marginwidth="0" marginheight="0"></iframe>
</td>
</tr>
</table>
<br><br>
~;
unless ($type eq "office") {
print qq~
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td colspan="2">
	<table border="0" cellpadding="1" cellspacing="0" width="100%">
	<tr>
	<td valign="middle" bgcolor="navy" nowrap><font color="white" size="2"><b>Action Plans</b></font><br></td>
	<td valign="middle" bgcolor="navy" align="right">
	<table border="0" cellspacing="0" cellpadding="0" bgcolor="white">
	<tr>
	<td valign="top" bgcolor="white">
		<table border="0" cellpadding="2" cellspacing="1" width="100%">
			<tr>
				<td valign="top" bgcolor="white">
					<a href="transactions.idx?action=overview_tasks&idlink=$INPUT{prospectid}&type=prospect&do=Apply" target="action_plans">Apply New Plan</a>
				</td>
				<td valign="top" bgcolor="white" align="right"><b>&nbsp;&nbsp;&nbsp;</b></td>
				<td valign="top" bgcolor="#ffcccc"><b>Due or Past Due</b></td>
				<td valign="top" bgcolor="#ccffcc"><b>Not Due</b></td>
				<td valign="top" bgcolor="#99ccff"><b>Completed</b></td>
			</tr>
		</table>
	</td>
	</tr>
	</table>
	</td>
	</tr>
	</table>
	<iframe src="transactions.idx?action=overview_tasks&idlink=$INPUT{prospectid}&type=prospect&agent=$agent" width="100%" height="110" name="action_plans" noresize="noresize" scrolling ="yes" frameborder="0" marginwidth="0" marginheight="0"></iframe>
</td>
</tr>
</table>
~;
}
print qq~
<br><br>
<table border="0" cellpadding="1" cellspacing="0" width="100%">
<tr>
<td valign="top" width="65%">
	<table border="0" cellpadding="3" cellspacing="0" width="100%">
	<tr>
		<td valign="top" bgcolor="navy" nowrap><font color="white" size="2"><b>My Prospect Notes</b></font><br></td>
		<td valign="top" bgcolor="navy" align="right">
			<table border="0" cellspacing="1" cellpadding="2" bgcolor="white">
			<tr>
				<td valign="top" bgcolor="silver">
					View Notes Below<br>
				</td>
			</tr>
			</table>
	</td>
	</tr>
	</table>
		<iframe src="prospects.idx?action=overview_prospect_notes_show&prospectid=$INPUT{prospectid}" width="100%" height="115" noresize="noresize" scrolling ="yes" frameborder="0" marginwidth="3" marginheight="3"></iframe>
</td>
<td valign="top" width="35%">
		<form method="get" action="prospects.idx">
		<input type="hidden" name="action" value="overview_prospect">
		<input type="hidden" name="prospectid" value="$INPUT{prospectid}">
		<input type="hidden" name="agent" value="$INPUT{agent}">
		<input type="hidden" name="name" value="$firstname$spouse $lastname">
		<input type="hidden" name="addnote" value="1">
		<input type="hidden" name="address" value="$addressnumber $addressdirection $addressstreet">
		<textarea cols="35" rows="8" name="prospect_notes" class="form"></textarea><br>
		<select name="todo" class="form">
		<option value="yes">ToDo</option>
		<option value="no">Hide</option></select><select name="todo_mark" class="form"><option value="y">Mark Done</option><option value="n">Not Done</option></select><input type="submit" value="Save" class="form">
		</form>
</td>
</tr>
</table>
<br><br>
		<table border="0" cellpadding="3" cellspacing="0" width="100%">
<tr>
<td colspan="2">
	<table border="0" cellpadding="3" cellspacing="0" width="581">
	<tr>
	<td valign="top" bgcolor="navy" nowrap><font color="white" size="2"><b>Document Center</b></font><br></td>
	<td valign="top" bgcolor="navy" align="right">
	<table border="0" cellspacing="1" cellpadding="2" bgcolor="white">
	<tr>
	<td valign="top" bgcolor="silver">
	View or Upload Documents<br>
	</td>
	</tr>
	</table>
	</td>
	</tr>
	</table>
	<table border="0" cellpadding="0" cellspacing="0" width="581">
	<tr>
	<td valign="top" width="361">
		<iframe src="prospects.idx?action=overview_documents_prospect&prospectid=$INPUT{prospectid}" width="361" height="90" noresize="noresize" scrolling ="yes" frameborder="0" marginwidth="0" marginheight="0" name="documents"></iframe>
	</td>
		<FORM action="upload_doc.idx" encType="multipart/form-data" method="post" target="documents" name="upload">
		<input type="hidden" name="matchid" value="$INPUT{prospectid}" class="form">
		<input type="hidden" name="matchcat" value="p" class="form">
		<input type="hidden" name="shortdesc" value="$firstname$spouse $lastname">
	<td valign="top" width="220">
<center>
<table border="0" cellpadding="4" cellspacing="0">
<tr>
<td valign="top">
		<table border="0" width="100%">
		<tr>
		<td>
		<b>Name the file:</b><br>
		<input type="text" name="name"  style="width: 130px;" class="form"><br>
		</td>
		<td align="center"><b>E-Mail</b> <input type="checkbox" name="notify"><br></td>
		</tr>
		<tr>
		<td colspan="2">
		<b>Find file by clicking browse:</b><br>
		<INPUT name="FILE1" type="file" class="form" style="width: 180px;"><br>
		<INPUT type="submit"  style="width: 180px;" value="           Upload File            " class="form">
		</td>
		</tr>
		</table>
</td>
</tr>
</table>
</center>
	</td>
		</form>
	</tr>
	</table>
</td>
</tr>
</table>
</td>
~;
}
&footer;

}


sub overview_prospects_smallaz {

use DBI;
my $dsn = "DBI:mysql:database=$d_name;host=localhost";
my $dbh = DBI->connect($dsn, $d_username, $d_pass, {RaiseError => 1}) || die $DBI::errstr;

print qq~
<html>
<head>
<title>prospects Small A-Z</title>
<link rel="stylesheet" TYPE="text/css" href="includes/style.css">
</head>
<body bgcolor="white" leftMargin="0" topMargin="0" marginwidth="0" marginheight="0">

<b>SEARCH USERS LASTNAME BY</b><br>
<center>
<a href="prospects.idx?action=overview_prospects_smallaz&transid=$INPUT{transid}&agent=$INPUT{agent}&find=A">A</a> | 
<a href="prospects.idx?action=overview_prospects_smallaz&transid=$INPUT{transid}&agent=$INPUT{agent}&find=B">B</a> | 
<a href="prospects.idx?action=overview_prospects_smallaz&transid=$INPUT{transid}&agent=$INPUT{agent}&find=C">C</a> | 
<a href="prospects.idx?action=overview_prospects_smallaz&transid=$INPUT{transid}&agent=$INPUT{agent}&find=D">D</a> | 
<a href="prospects.idx?action=overview_prospects_smallaz&transid=$INPUT{transid}&agent=$INPUT{agent}&find=E">E</a> | 
<a href="prospects.idx?action=overview_prospects_smallaz&transid=$INPUT{transid}&agent=$INPUT{agent}&find=F">F</a> | 
<a href="prospects.idx?action=overview_prospects_smallaz&transid=$INPUT{transid}&agent=$INPUT{agent}&find=G">G</a> | 
<a href="prospects.idx?action=overview_prospects_smallaz&transid=$INPUT{transid}&agent=$INPUT{agent}&find=H">H</a> | 
<a href="prospects.idx?action=overview_prospects_smallaz&transid=$INPUT{transid}&agent=$INPUT{agent}&find=I">I</a> | 
<a href="prospects.idx?action=overview_prospects_smallaz&transid=$INPUT{transid}&agent=$INPUT{agent}&find=J">J</a> | 
<a href="prospects.idx?action=overview_prospects_smallaz&transid=$INPUT{transid}&agent=$INPUT{agent}&find=K">K</a> | 
<a href="prospects.idx?action=overview_prospects_smallaz&transid=$INPUT{transid}&agent=$INPUT{agent}&find=L">L</a> | 
<a href="prospects.idx?action=overview_prospects_smallaz&transid=$INPUT{transid}&agent=$INPUT{agent}&find=M">M</a> | 
<a href="prospects.idx?action=overview_prospects_smallaz&transid=$INPUT{transid}&agent=$INPUT{agent}&find=N">N</a> | 
<a href="prospects.idx?action=overview_prospects_smallaz&transid=$INPUT{transid}&agent=$INPUT{agent}&find=O">O</a> | 
<a href="prospects.idx?action=overview_prospects_smallaz&transid=$INPUT{transid}&agent=$INPUT{agent}&find=P">P</a> | 
<a href="prospects.idx?action=overview_prospects_smallaz&transid=$INPUT{transid}&agent=$INPUT{agent}&find=Q">Q</a> | 
<a href="prospects.idx?action=overview_prospects_smallaz&transid=$INPUT{transid}&agent=$INPUT{agent}&find=R">R</a> | 
<a href="prospects.idx?action=overview_prospects_smallaz&transid=$INPUT{transid}&agent=$INPUT{agent}&find=S">S</a> | 
<a href="prospects.idx?action=overview_prospects_smallaz&transid=$INPUT{transid}&agent=$INPUT{agent}&find=T">T</a> | 
<a href="prospects.idx?action=overview_prospects_smallaz&transid=$INPUT{transid}&agent=$INPUT{agent}&find=U">U</a> | 
<a href="prospects.idx?action=overview_prospects_smallaz&transid=$INPUT{transid}&agent=$INPUT{agent}&find=V">V</a> | 
<a href="prospects.idx?action=overview_prospects_smallaz&transid=$INPUT{transid}&agent=$INPUT{agent}&find=W">W</a> | 
<a href="prospects.idx?action=overview_prospects_smallaz&transid=$INPUT{transid}&agent=$INPUT{agent}&find=X">X</a> | 
<a href="prospects.idx?action=overview_prospects_smallaz&transid=$INPUT{transid}&agent=$INPUT{agent}&find=Y">Y</a> | 
<a href="prospects.idx?action=overview_prospects_smallaz&transid=$INPUT{transid}&agent=$INPUT{agent}&find=Z">Z</a>
</center>
<br><br>
~;
my $basth = $dbh->prepare("select id,agent,type,firstname,lastname from trans_boardprospect WHERE agent = '$INPUT{agent}' AND lastname LIKE '$INPUT{find}%' ORDER by lastname ASC");
$basth->execute;

while (($id,$agent,$type,$firstname,$lastname) = $basth->fetchrow_array()) {
print qq~
$id - $agent - $type - $firstname - $lastname<br>
~;
}

print qq~
</body>
</html>
~;

}

sub overview_prospect_notes_show {

use DBI;
my $dsn = "DBI:mysql:database=$d_name;host=localhost";
my $dbh = DBI->connect($dsn, $d_username, $d_pass, {RaiseError => 1}) || die $DBI::errstr;

my $basth = $dbh->prepare("select noteid,prospectid,DATE_FORMAT(datetime, '%b %D, %Y at %h\:%i%p'),addedby,note from trans_boardprospectnotes WHERE prospectid = '$INPUT{prospectid}' ORDER by datetime DESC");
$basth->execute;

print qq~
<html>
<head>
<title>Notes</title>
<link rel="stylesheet" TYPE="text/css" href="includes/style.css">
</head>
<body bgcolor="white" leftMargin="0" topMargin="0" marginwidth="0" marginheight="0">
<table border="0" cellpadding="4" cellspacing="0" width="100%">
~;
$trcolor = "1";
$trcolor2 = "2";

while (($noteid,$prospectid,$datetime,$addedby,$note) = $basth->fetchrow_array()) {

	if ($trcolor eq $trcolor2) {
	$trcolor = "1";
	$setcolor = "#FFFFFF";
	}
	else {
	$setcolor = "#CCCCFF";
	$trcolor++;
	}
print qq~
<tr bgcolor="$setcolor">
<td valign="top">
<b>$note</b><br>
<i>Added by $addedby on $datetime</i>
</td>
</tr>
~;
$found = "yes";
}

unless ($found eq "yes") {
print qq~
<tr>
<td>
<font color="red"><b>No Notes have been added yet!  You may use the textbox to the right to save Notes.</b></font>
</td>
</tr>
~;
}
print qq~
</table>
</body>
</html>
~;
}

sub main {

use DBI;
my $dsn = "DBI:mysql:database=$d_name;host=localhost";
my $dbh = DBI->connect($dsn, $d_username, $d_pass, {RaiseError => 1}) || die $DBI::errstr;

print qq~
<html>
<head>
<title>My Eagle prospect Manager -- Eagle Real Estate, Inc. - Connect.EagleSold.com</title>
<script language="JavScript">
function submit()
{
	 document.changestatus.submit();
}
</script>
~;

&header;


print qq~
<td valign="top" width="581">
<img src="images/headers/transaction_manager.gif" height="33" width="581" alt="My Transaction Manager"><br><br>
~;

print qq~
<br>
<img src="images/trans_sys/my_prospects.gif" alt="My prospects"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>use the alphabet below to search your prospects</b><br><br>
<table border="0" cellpadding="6" cellspacing="1" bgcolor="navy" width="100%">
<tr>
<td bgcolor="#CCCCFF">
<table border="0" cellpadding="3" cellspacing="0" width="100%">
<tr>
<td><b><font size="3">Search your prospects by Lastname</font></b><br></td>
<td align="right">
<a href="prospects.idx?action=create_prospect&agent=$INPUT{agent}">Create A New prospect</a><br>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="white">
<center>
<a href="prospects.idx?agent=$INPUT{agent}&prospect=%">All</a> 
<a href="prospects.idx?agent=$INPUT{agent}&prospect=A">A</a> | 
<a href="prospects.idx?agent=$INPUT{agent}&prospect=B">B</a> | 
<a href="prospects.idx?agent=$INPUT{agent}&prospect=C">C</a> | 
<a href="prospects.idx?agent=$INPUT{agent}&prospect=D">D</a> | 
<a href="prospects.idx?agent=$INPUT{agent}&prospect=E">E</a> | 
<a href="prospects.idx?agent=$INPUT{agent}&prospect=F">F</a> | 
<a href="prospects.idx?agent=$INPUT{agent}&prospect=G">G</a> | 
<a href="prospects.idx?agent=$INPUT{agent}&prospect=H">H</a> | 
<a href="prospects.idx?agent=$INPUT{agent}&prospect=I">I</a> | 
<a href="prospects.idx?agent=$INPUT{agent}&prospect=J">J</a> | 
<a href="prospects.idx?agent=$INPUT{agent}&prospect=K">K</a> | 
<a href="prospects.idx?agent=$INPUT{agent}&prospect=L">L</a> | 
<a href="prospects.idx?agent=$INPUT{agent}&prospect=M">M</a> | 
<a href="prospects.idx?agent=$INPUT{agent}&prospect=N">N</a> | 
<a href="prospects.idx?agent=$INPUT{agent}&prospect=O">O</a> | 
<a href="prospects.idx?agent=$INPUT{agent}&prospect=P">P</a> | 
<a href="prospects.idx?agent=$INPUT{agent}&prospect=Q">Q</a> | 
<a href="prospects.idx?agent=$INPUT{agent}&prospect=R">R</a> | 
<a href="prospects.idx?agent=$INPUT{agent}&prospect=S">S</a> | 
<a href="prospects.idx?agent=$INPUT{agent}&prospect=T">T</a> | 
<a href="prospects.idx?agent=$INPUT{agent}&prospect=U">U</a> | 
<a href="prospects.idx?agent=$INPUT{agent}&prospect=V">V</a> | 
<a href="prospects.idx?agent=$INPUT{agent}&prospect=W">W</a> | 
<a href="prospects.idx?agent=$INPUT{agent}&prospect=X">X</a> | 
<a href="prospects.idx?agent=$INPUT{agent}&prospect=Y">Y</a> | 
<a href="prospects.idx?agent=$INPUT{agent}&prospect=Z">Z</a>
</center><br>
~;

if ($INPUT{prospect}) {
my $basth = $dbh->prepare("select id,agent,type,firstname,lastname,spouse from trans_boardprospect WHERE agent = '$INPUT{agent}' AND lastname LIKE '$INPUT{prospect}%' ORDER by lastname ASC");
$basth->execute;

		$trcount = "1";
		$totalperrow = "3";
		$rowcolor1 = "1";
		$rowcolor2 = "2";
		print qq~
		<table border="0" cellpadding="2" cellspacing="1" width="100%" bgcolor="gray">
		<tr bgcolor="#FFFFFF">
		~;

while (($prospectid,$agent,$type,$firstname,$lastname,$spouse) = $basth->fetchrow_array()) {

			if ($rowcolor1 eq $rowcolor2) {
			$color = "#FFFFFF";
			$rowcolor1 = "1";
			}
			else {
			$color = "#FFFF99";
			$rowcolor1++;
			}

	if ($spouse ne "") {
	$spouse = " & $spouse ";
	}
	else {
	$spouse = "";
	}
print qq~
<td>
<a href="prospects.idx?action=overview_prospect&agent=$INPUT{agent}&prospectid=$prospectid">$lastname, $firstname$spouse</a>  <a href="prospects.idx?action=overview_prospect&agent=$INPUT{agent}&prospectid=$prospectid"><img src="images/trans_sys/button_view.gif" alt="View details for $lastname, $firstname$spouse" border="0"></a> <a href="prospects.idx?action=overview_prospect_edit&agent=$INPUT{agent}&prospectid=$prospectid"><img src="images/trans_sys/button_edit.gif" alt="Edit $lastname, $firstname$spouse" border="0"></a> <a href="prospects.idx?action=overview_prospect_delete&agent=$INPUT{agent}&prospectid=$prospectid&name=$firstname $lastname"><img src="images/trans_sys/button_delete.gif" alt="Delete $lastname, $firstname$spouse" border="0"></a><br>
</td>
~;

		if ($trcount eq $totalperrow) {
		print "</tr><tr bgcolor=\"$color\">";
		$trcount = "1";
		}
		else {
		$trcount++;
		}

$ccfound = "yes";
}

		print qq~
		</tr>
		</table>
		~;

unless ($ccfound eq "yes") {
print qq~
<font color="red" size="3" face="Arial"><b>No prospects Found, Click on the first letter in the alphabet above that corresponds with your prospects lastname to try another search.  If your prospect is not listed you can create a new prospect by clicking on the link above.</b></font><br>
~;
}
}
else {
print qq~
<font color="red" size="3" face="Arial"><b>Click on the first letter in the alphabet above that corresponds with your prospects lastname to search your prospects.</b></font><br>
~;
}


print qq~
</td>
</tr>
</table>
<br>
<font size="3"><b>Recently Added Prospects within the last 2 weeks</b><hr color="red" width="100%">
<table border="0" cellpadding="2" cellspacing="1" bgcolor="red" width="100%">
<tr>
<td><u><b>Date Added</b></u></td>
<td><u><b>Prospect Name</b></u></td>
<td><u><b>Category</b></u></td>
</tr>
~;

my $casth = $dbh->prepare("select id,firstname,spouse,lastname,contacttype,DATE_FORMAT(initial_contactdate, '%M %D, %Y') from trans_boardprospect WHERE agent = '$Cook{agentid}' AND initial_contactdate BETWEEN DATE_ADD(now(), INTERVAL -14 DAY) AND now() ORDER BY initial_contactdate DESC");
$casth->execute;
while (($id,$firstname,$spouse,$lastname,$contacttype,$initial_contactdate) = $casth->fetchrow_array()) {
print qq~
<tr>
<td bgcolor="white">$initial_contactdate</td>
<td bgcolor="white"><a href="http://connect.eaglesold.com/prospects.idx?action=overview_prospect&agent=$Cook{agentid}&prospectid=$id">$firstname $spouse $lastname</a><br></td>
<td bgcolor="white">$contacttype</td>
</tr>
~;
$found = "yes";
}

unless ($found eq "yes") {
print qq~No Prospects Have Saved Next Contact Dates Yet!~;
}


print qq~
</table>
<br>
<font size="3"><b>Prospects with Next Prospect Date</b><hr color="red" width="100%">
<table border="0" cellpadding="2" cellspacing="1" bgcolor="red" width="100%">
<tr>
<td><u><b>Date Added</b></u></td>
<td><u><b>Next Follow Up Date</b></u></td>
<td><u><b>Prospect Name</b></u></td>
<td><u><b>Category</b></u></td>
</tr>
~;

my $casth = $dbh->prepare("select id,firstname,spouse,lastname,DATE_FORMAT(next_contactdate, '%M %D, %Y') from trans_boardprospect WHERE agent = '$INPUT{agent}' AND next_contactdate != '0000-00-00' ORDER BY next_contactdate ASC");
$casth->execute;
while (($id,$firstname,$spouse,$lastname,$next_contactdate) = $casth->fetchrow_array()) {
print qq~
<a href="http://connect.eaglesold.com/prospects.idx?action=overview_prospect&agent=$Cook{agentid}&prospectid=$id">$next_contactdate - $firstname $spouse $lastname</a><br>
~;
$found = "yes";
}

unless ($found eq "yes") {
print qq~No Prospects Have Saved Next Contact Dates Yet!~;
}

print qq~
</font>
</td>
</td>
~;
&footer;

}


