<?php
	include("../utilities/UtilitiesManagers.php");
	include("../utilities/UtilitiesReporting.php");
	include("../utilities/UtilitiesClients.php");
	include("../utilities/UtilitiesEncryption.php");
	include("../utilities/UtilitiesSystem.php");
	include("../utilities/UtilitiesPDF.php");
	include("../include/session.php");
	global $database;


	date_default_timezone_set('America/New_York');
	$recID = $passedClientID;

	//$notesAndHistory 		= mysql_real_escape_string($_POST["notesAndHistory"]);

	
		$clientsData = $clients->getClientData($recID);
		
		$name = mysql_real_escape_string($_POST["name"]);
		$clientStatus = mysql_real_escape_string($_POST["canAssist"]);
		$ssn = mysql_real_escape_string($_POST["ssn"]);
		//$ssn = $encryption->decrypt($ssn);
		
		$aliasMaidenName = mysql_real_escape_string($_POST["aliasMaidenName"]);
		$SpouseOtherName = mysql_real_escape_string($_POST["SpouseOtherName"]);
		$Phone = mysql_real_escape_string($_POST["Phone"]);
		$WorkPhone = mysql_real_escape_string($_POST["WorkPhone"]);
		$Email = mysql_real_escape_string($_POST["Email"]);
		$DLNumber = mysql_real_escape_string($_POST["DLNumber"]);
		$PhoneComments = mysql_real_escape_string($_POST["PhoneComments"]);
		$Employer = mysql_real_escape_string($_POST["Employer"]);
		$Ethnicity = mysql_real_escape_string($_POST["Ethnicity"]);
		$Birthday = mysql_real_escape_string($_POST["Birthday"]);
		$PrimaryAddress = mysql_real_escape_string($_POST["PrimaryAddress"]);
		$OtherAddr1 = mysql_real_escape_string($_POST["OtherAddr1"]);
		$OtherAddr2 = mysql_real_escape_string($_POST["OtherAddr2"]);
		$OtherAddr3 = mysql_real_escape_string($_POST["OtherAddr3"]);
		$OtherAddr4 = mysql_real_escape_string($_POST["OtherAddr4"]);
		$City = mysql_real_escape_string($_POST["City"]);
		$State = mysql_real_escape_string($_POST["State"]);
		$Zip = mysql_real_escape_string($_POST["Zip"]);
		$Children = mysql_real_escape_string($_POST["Children"]);
		$TotalDollarAsisst = mysql_real_escape_string($_POST["TotalDollarAsisst"]);
		$ChecksIssued = mysql_real_escape_string($_POST["ChecksIssued"]);
		$LastResults = mysql_real_escape_string($_POST["LastResults"]);
		$FoodStamps = mysql_real_escape_string($_POST["FoodStamps"]);
		$DatesFoodGiven = mysql_real_escape_string($_POST["DatesFoodGiven"]);
		$NumberTimesFoodGiven = mysql_real_escape_string($_POST["NumberTimesFoodGiven"]);
		$ChildcareScholarship = mysql_real_escape_string($_POST["ChildcareScholarship"]);
		$MKScholarship = mysql_real_escape_string($_POST["MKScholarship"]);
		$OtherDorcasPrograms = mysql_real_escape_string($_POST["OtherDorcasPrograms"]);
		$EducationPrograms = mysql_real_escape_string($_POST["EducationPrograms"]);
		$ExternalPrograms = mysql_real_escape_string($_POST["ExternalPrograms"]);
		$ReferredTo = mysql_real_escape_string($_POST["ReferredTo"]); 
		$TakeHomePay = mysql_real_escape_string($_POST["TakeHomePay"]);     
		$SpoouseOtherPay = mysql_real_escape_string($_POST["SpoouseOtherPay"]);     
		$AFDC = mysql_real_escape_string($_POST["AFDC"]);
		$ChildSupport = mysql_real_escape_string($_POST["ChildSupport"]);  
		$SocialSecurityIncome = mysql_real_escape_string($_POST["SocialSecurityIncome"]);    
		$WIC = mysql_real_escape_string($_POST["WIC"]);
		$SSIDIS = mysql_real_escape_string($_POST["SSIDIS"]);  
		$WorkFirst = mysql_real_escape_string($_POST["WorkFirst"]);  
		$FoodStampsInc = mysql_real_escape_string($_POST["FoodStampsInc"]);
		$TotalIncome = mysql_real_escape_string($_POST["TotalIncome"]);  
		$CreditCardPayments = mysql_real_escape_string($_POST["CreditCardPayments"]); 
		$RentMortgage = mysql_real_escape_string($_POST["RentMortgage"]); 
		$RMType = mysql_real_escape_string($_POST["RMType"]);    
		$Water = mysql_real_escape_string($_POST["Water"]);    
		$CableTV = mysql_real_escape_string($_POST["CableTV"]);   
		$DayCare = mysql_real_escape_string($_POST["DayCare"]);  
		$Electric = mysql_real_escape_string($_POST["Electric"]);   
		$PowerCompAcctNum  = mysql_real_escape_string($_POST["PowerCompAcctNum"]);  
		$CostOfHeat = mysql_real_escape_string($_POST["CostOfHeat"]);    
		$TypeOfHeat 			= mysql_real_escape_string($_POST["TypeOfHeat"]);  
		$OtherFixedExpenses 	= mysql_real_escape_string($_POST["OtherFixedExpenses"]); 
		$PhoneBill 				= mysql_real_escape_string($_POST["PhoneBill"]); 
		$TotalFixedExpenses 	= mysql_real_escape_string($_POST["TotalFixedExpenses"]);         
		$Food 					= mysql_real_escape_string($_POST["Food"]);   
		$MedicalInsurance 		= mysql_real_escape_string($_POST["MedicalInsurance"]);      
		$NumberOfCars 			= mysql_real_escape_string($_POST["NumberOfCars"]);     
		$MakeModel1 			= mysql_real_escape_string($_POST["MakeModel1"]);     
		$CarPayment1 			= mysql_real_escape_string($_POST["CarPayment1"]);     
		$MakeModel2 			= mysql_real_escape_string($_POST["MakeModel2"]);    
		$CarPayment2 			= mysql_real_escape_string($_POST["CarPayment2"]); 
		$CarInsurancePayments 	= mysql_real_escape_string($_POST["CarInsurancePayments"]); 
		$TotalOtherExpenses 	= mysql_real_escape_string($_POST["TotalOtherExpenses"]); 
		$Deficit 				= mysql_real_escape_string($_POST["Deficit"]); 
		$username 				= mysql_real_escape_string($_POST["username"]); 
		$clientID 				= mysql_real_escape_string($_POST["clientID"]); 
		
		$PDFFileName = "clientPDFs/" . $clientID . ".pdf";
		
		switch($clientStatus)
		{
			case 1:
				$clientStatusTxt = "Can Provide Assistance";
				break;
			case 2:
				$clientStatusTxt = "No Longer Provide Assistance";
				break;
			case 3:
				$clientStatusTxt = "Caution";
				break;
		}
		
		$pdf->AddPage();
		$pdf->SetFont('Arial', 'B', 12);
		$pdf->SetY(70);
		$pdf->Cell(0, 20, "  ", 'T', 0, 'C');

		$pdf->SetX(0);
		$pdf->Sety(70);
		$pdf->SetFont('Arial', 'B', 10);
		$pdf->SetFillColor(206, 207, 208);
		$pdf->Cell(200, 15, "Client Information", 1, 2, 'C', true);
		$pdf->SetFont('Arial', '', 12);
		$pdf->Cell(200, 10, " ", 0, 2);

		$pdf->SetX(75);
		$pdf->SetFont('Arial', 'B', 10);
		$pdf->Cell(32, 15, "SSN#:");
		$pdf->SetFont('Arial', '', 8);
		$pdf->Cell(50, 15, $ssn);

		$pdf->SetX(350);
		$pdf->SetFont('Arial', 'B', 10);
		$pdf->Cell(48, 15, "Address:");
		$pdf->SetFont('Arial', '', 8);
		$pdf->Cell(50, 15, $PrimaryAddress, 0, 2);

		$pdf->SetX(75);
		$pdf->SetFont('Arial', 'B', 10);
		$pdf->Cell(65, 15, "Client Name:");
		$pdf->SetFont('Arial', '', 8);
		$pdf->Cell(50, 15, $name);

		$pdf->SetX(350);
		$pdf->SetFont('Arial', 'B', 10);
		$pdf->Cell(77, 15, "Other Address:");
		$pdf->SetFont('Arial', '', 8);
		$pdf->Cell(50, 15, $OtherAddr1, 0, 2);

		$pdf->SetX(75);
		$pdf->SetFont('Arial', 'B', 10);
		$pdf->Cell(98, 15, "Alias/Maiden Name:");
		$pdf->SetFont('Arial', '', 8);
		$pdf->Cell(50, 15, $aliasMaidenName);

		$pdf->SetX(350);
		$pdf->SetFont('Arial', 'B', 10);
		$pdf->Cell(77, 15, "Other Address:");
		$pdf->SetFont('Arial', '', 8);
		$pdf->Cell(50, 15, $OtherAddr2, 0, 2);

		$pdf->SetX(75);
		$pdf->SetFont('Arial', 'B', 10);
		$pdf->Cell(36, 15, "Phone:");
		$pdf->SetFont('Arial', '', 8);
		$pdf->Cell(50, 15, $Phone);

		$pdf->SetX(350);
		$pdf->SetFont('Arial', 'B', 10);
		$pdf->Cell(26, 15, "City:");
		$pdf->SetFont('Arial', '', 8);
		$pdf->Cell(50, 15, $City, 0, 2);

		$pdf->SetX(75);
		$pdf->SetFont('Arial', 'B', 10);
		$pdf->Cell(65, 15, "Work Phone:");
		$pdf->SetFont('Arial', '', 8);
		$pdf->Cell(50, 15, $WorkPhone);

		$pdf->SetX(350);
		$pdf->SetFont('Arial', 'B', 10);
		$pdf->Cell(52, 15, "Employer:");
		$pdf->SetFont('Arial', '', 8);
		$pdf->Cell(50, 15, $Employer, 0, 2);

		$pdf->SetX(75);
		$pdf->SetFont('Arial', 'B', 10);
		$pdf->Cell(43, 15, "Spouse:");
		$pdf->SetFont('Arial', '', 8);
		$pdf->Cell(50, 15, $SpouseOtherName, 0, 1);

		$pdf->SetX(75);
		$pdf->SetFont('Arial', 'B', 10);
		$pdf->Cell(46, 15, "Children:");
		$pdf->SetFont('Arial', '', 8);
		$pdf->Cell(50, 15, $Children, 0, 2);
		$pdf->Cell(200, 15, " ", 0, 1);

		$pdf->SetX(40);
		$pdf->Cell(0, 20, "  ", 'T', 0, 'C');
		$pdf->SetX(0);
		$pdf->Sety(215);
		$pdf->SetFont('Arial', 'B', 10);
		$pdf->SetFillColor(206, 207, 208);
		$pdf->Cell(200, 15, "Financial Information", 1, 2, 'C', true);
		$pdf->SetFont('Arial', '', 12);
		$pdf->Cell(200, 10, " ", 0, 2);

		$pdf->SetX(75);
		$pdf->SetFont('Arial', 'B', 10);
		$pdf->Cell(125, 15, "Total Household Income:");
		$pdf->SetFont('Arial', '', 8);
		$pdf->Cell(50, 15, $TotalIncome);

		$pdf->SetX(350);
		$pdf->SetFont('Arial', 'B', 10);
		$pdf->Cell(133, 15, "Total Household Expenses:");
		$pdf->SetFont('Arial', '', 8);
		$pdf->Cell(50, 15, $TotalOtherExpenses, 0, 2);

		$pdf->SetX(75);
		$pdf->SetFont('Arial', 'B', 10);
		$pdf->Cell(92, 15, "Special Programs:");
		$pdf->SetFont('Arial', '', 8);
		$pdf->Cell(50, 15, $clientsData['special_programs'], 0, 2);

		$pdf->SetX(75);
		$pdf->SetFont('Arial', 'B', 10);
		$pdf->Cell(197, 15, "Subsidized Housing/External Programs:");
		$pdf->SetFont('Arial', '', 8);
		$pdf->Cell(50, 15, $clientsData['housing_subsidies'], 0, 2);
		$pdf->Cell(200, 15, " ", 0, 1);

		$pdf->SetX(40);
		$pdf->Cell(0, 20, "  ", 'T', 0, 'C');
		$pdf->SetX(0);
		$pdf->Sety(300);
		$pdf->SetFont('Arial', 'B', 10);
		$pdf->SetFillColor(206, 207, 208);
		$pdf->Cell(200, 15, "Food Information", 1, 2, 'C', true);
		$pdf->SetFont('Arial', '', 12);
		$pdf->Cell(200, 10, " ", 0, 2);

		$pdf->SetX(75);
		$pdf->SetFont('Arial', 'B', 10);
		$pdf->Cell(93, 15, "Dates Food Given:");
		$pdf->SetFont('Arial', '', 8);
		$pdf->Cell(50, 15, $DatesFoodGiven);

		$pdf->SetX(350);
		$pdf->SetFont('Arial', 'B', 10);
		$pdf->Cell(70, 15, "Food Stamps:");
		$pdf->SetFont('Arial', '', 8);
		$pdf->Cell(50, 15, $FoodStamps, 0, 2);
		$pdf->Cell(200, 15, " ", 0, 1);

		$pdf->SetX(40);
		$pdf->Cell(0, 20, "  ", 'T', 0, 'C');
		$pdf->SetX(0);
		$pdf->Sety(355);
		$pdf->SetFont('Arial', 'B', 10);
		$pdf->SetFillColor(206, 207, 208);
		$pdf->Cell(200, 15, "Client Status", 1, 2, 'C', true);
		$pdf->SetFont('Arial', '', 12);
		$pdf->Cell(200, 10, " ", 0, 2);

		$pdf->SetX(75);
		$pdf->SetFont('Arial', 'B', 10);
		$pdf->Cell(41, 15, "Status:");
		$pdf->SetFont('Arial', '', 8);
		$pdf->Cell(50, 15, $clientStatusTxt, 0, 2);

		$pdf->SetX(75);
		$pdf->SetFont('Arial', 'B', 10);
		$pdf->Cell(73, 15, "Total $ Assist:");
		$pdf->SetFont('Arial', '', 8);
		$pdf->Cell(50, 15, $TotalDollarAsisst);

		/*$pdf->SetX(350);
		$pdf->SetFont('Arial', 'B', 10);
		$pdf->Cell(69, 15, "Last Results:");
		$pdf->SetFont('Arial', '', 8);
		$pdf->Cell(50, 15, $LastResults, 0, 2);
		$pdf->Cell(200, 15, " ", 0, 1);
		*/
		/*$pdf->SetX(40);
		$pdf->Cell(0, 20, "  ", 'T', 0, 'C');
		$pdf->SetX(0);
		$pdf->Sety(425);
		$pdf->SetFont('Arial', 'B', 10);
		$pdf->SetFillColor(206, 207, 208);
		$pdf->Cell(200, 15, "Notes and History", 1, 2, 'C', true);
		$pdf->SetFont('Arial', '', 8);
		$pdf->Cell(200, 10, " ", 0, 2);

		$pdf->SetX(40);
		$pdf->SetFont('Arial', '', 8);
		$pdf->Write(15, $_POST['notes_history']);
		*/
		$pdf->Ln(100);
		$pdf->Ln(50);

		$pdf->SetFont('Arial', 'U', 12);
		$pdf->SetTextColor(1, 162, 232);

		$pdf->Output($PDFFileName, 'F');
	
		echo $PDFFileName;
	
?>