GetX(); $yi=$this->GetY(); $hrow=$this->FontSize; $textrows=$this->drawRows($w,$hrow,$strText,0,$align,0,0,0); $maxrows=floor($h/$this->FontSize); $rows=min($textrows,$maxrows); $dy=0; if (strtoupper($valign)=='M') $dy=($h-$rows*$this->FontSize)/2; if (strtoupper($valign)=='B') $dy=$h-$rows*$this->FontSize; $this->SetY($yi+$dy); $this->SetX($xi); $this->drawRows($w,$hrow,$strText,0,$align,false,$rows,1); if ($border) $this->Rect($xi,$yi,$w,$h); } function drawRows($w, $h, $txt, $border=0, $align='J', $fill=false, $maxline=0, $prn=0) { $cw=&$this->CurrentFont['cw']; if($w==0) $w=$this->w-$this->rMargin-$this->x; $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; $s=str_replace("\r",'',$txt); $nb=strlen($s); if($nb>0 && $s[$nb-1]=="\n") $nb--; $b=0; if($border) { if($border==1) { $border='LTRB'; $b='LRT'; $b2='LR'; } else { $b2=''; if(is_int(strpos($border,'L'))) $b2.='L'; if(is_int(strpos($border,'R'))) $b2.='R'; $b=is_int(strpos($border,'T')) ? $b2.'T' : $b2; } } $sep=-1; $i=0; $j=0; $l=0; $ns=0; $nl=1; while($i<$nb) { //Get next character $c=$s[$i]; if($c=="\n") { //Explicit line break if($this->ws>0) { $this->ws=0; if ($prn==1) $this->_out('0 Tw'); } if ($prn==1) { $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); } $i++; $sep=-1; $j=$i; $l=0; $ns=0; $nl++; if($border && $nl==2) $b=$b2; if ( $maxline && $nl > $maxline ) return substr($s,$i); continue; } if($c==' ') { $sep=$i; $ls=$l; $ns++; } $l+=$cw[$c]; if($l>$wmax) { //Automatic line break if($sep==-1) { if($i==$j) $i++; if($this->ws>0) { $this->ws=0; if ($prn==1) $this->_out('0 Tw'); } if ($prn==1) { $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); } } else { if($align=='J') { $this->ws=($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0; if ($prn==1) $this->_out(sprintf('%.3F Tw',$this->ws*$this->k)); } if ($prn==1){ $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill); } $i=$sep+1; } $sep=-1; $j=$i; $l=0; $ns=0; $nl++; if($border && $nl==2) $b=$b2; if ( $maxline && $nl > $maxline ) return substr($s,$i); } else $i++; } //Last chunk if($this->ws>0) { $this->ws=0; if ($prn==1) $this->_out('0 Tw'); } if($border && is_int(strpos($border,'B'))) $b.='B'; if ($prn==1) { $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); } $this->x=$this->lMargin; return $nl; } // Page header function Header() { //if ( $this->PageNo() !== 1 ) { //$this->Image('cor-logo.png', $this->left, 12, 0, 14); //} } // function Footer() // { // if ( $this->PageNo() !== 1 ) { // $first_part = $this->w * ( 50 / 100 ); // $second_part = $this->w * ( 3 / 100 ); // $third_part = $this->w * ( 1 / 100 ); // $fourth_part = $this->w * ( 46 / 100 ); // $this->SetTextColor(255, 255, 255); // $this->SetFont('Arial', '', 8); // $this->SetXY( $this->left, $this->h - 17 ); // $this->SetFillColor(255, 0, 0); // $this->MultiCell($first_part, 5, "Request for Consideration\nCash on Referral Limited", 0, 'L', true); // $this->SetXY( $this->left + $first_part, $this->h - 17 ); // $this->SetFillColor(255, 0, 0); // $this->MultiCell($second_part, 10, $this->PageNo() - 1, 0, 'R', true); // $this->SetXY( $this->left + $first_part + $second_part, $this->h - 17 ); // $this->SetFillColor(255, 255, 255); // $this->MultiCell($third_part, 10, "", 0, 'R', true); // $this->SetXY( $this->left + $first_part + $second_part + $third_part, $this->h - 17 ); // $this->SetFillColor(0, 0, 0); // $this->MultiCell($fourth_part - 24, 10, "STRICTLY PRIVATE AND CONFIDENTIAL", 0, 'R', true); // } // } /* function ApplicationForm() { $this->ln(25); $this->SetFont('Arial', '', 10); $this->SetTextColor(0, 0, 0); //$this->Cell($this->actualWidth, 10, 'COR Franchise Application Form', 0, 1, 'C'); $this->SetFont('Arial', 'B', 10); $this->Cell($this->actualWidth, 10, 'Dear Sir/Mam,', 0, 1, 'L'); $this->ln(); $this->SetFont('Arial', '', 10); $this->MultiCell($this->actualWidth, 5, 'Welcome to the COR community and thank you for taking the decision to become a supplier to the other businesses involved in making COR the largest business community of its type globally.', 0); $this->ln(); $this->MultiCell($this->actualWidth, 5, 'As a client of the COR community you will be assigned an account manager at the local office who will assist you in identifying your spare capacity and using the following services that are now at your disposal:-', 0); $this->ln(); $this->MultiCell($this->actualWidth, 5, 'Please help us by completing all sections carefully and thoroughly and use additional pages/appendices as necessary. This form will present information that is essential for our consideration in granting the COR franchise.', 0); $this->ln(20); $this->Cell(60, 10, 'Applicant\'s Name', 'T', 1, 'L'); $this->ln(20); $this->Cell(60, 10, 'Applicant\'s Company', 'T', 0, 'L'); $this->Cell(30); $this->Cell(60, 10, 'Date', 'T', 1, 'L'); } */ function SectionA( $SectionAData ) { $this->ln(19); $this->SetFont('Arial', '', 10); $this->SetTextColor(0, 0, 0); //$this->Cell($this->actualWidth, 10, 'COR Franchise Application Form', 0, 1, 'C'); $this->SetFont('Arial', 'B', 12); $this->Cell($this->actualWidth, 10, 'Dear Sir/Madam,', 0); $this->ln(20); $this->SetFont('Arial', '', 12); $this->MultiCell($this->actualWidth, 5, 'Welcome to the COR community and thank you for taking the decision to become a supplier to the other businesses involved in making COR the largest business community of its type globally.', 0); $this->ln(); $this->MultiCell($this->actualWidth, 5, 'As a client of the COR community you will be assigned an account manager at the local office who will assist you in identifying your spare capacity and using the following services that are now at your disposal:-', 0); $this->ln(); //for bullets $this->SetFont('Arial', 'B', 10); $this->Cell($this->actualWidth * 0.19, 5, ' Online Directory - ', 0); $this->SetFont('Arial', '', 10); $this->Cell($this->actualWidth, 5, 'search the global network for future customers and suppliers.', 0); $this->ln(); $this->SetFont('Arial', 'B', 10); $this->Cell($this->actualWidth * 0.20, 5, ' COR Marketplace - ', 0); $this->SetFont('Arial', '', 10); $this->Cell($this->actualWidth, 5, 'post any goods / services packages to this marketplace at any time.', 0); $this->ln(); $this->SetFont('Arial', 'B', 10); $this->Cell($this->actualWidth * 0.25, 5, ' Email or SMS Marketing - ', 0); $this->SetFont('Arial', '', 10); $this->Cell($this->actualWidth, 5, 'manager will send emails or SMS to the COR community as required and when relevant.', 0); $this->ln(); $this->SetFont('Arial', 'B', 10); $this->Cell($this->actualWidth * 0.37, 5, ' Trade Shows and Networking Events - ', 0); $this->SetFont('Arial', '', 10); $this->Cell($this->actualWidth, 5, 'meet other business owners in the community by attending the many events', 0); $this->ln(); $this->Cell($this->actualWidth, 5, ' around the country.', 0); $this->ln(); $this->SetFont('Arial', 'B', 10); $this->Cell($this->actualWidth * 0.33, 5, ' Build up a monthly cash income -', 0); $this->SetFont('Arial', '', 10); $this->Cell($this->actualWidth, 5, ' as a member of the COR community you are able to build up a monthly cash', 0); $this->ln(); $this->Cell($this->actualWidth, 5, ' income by introducing other businesses to the community.', 0); $this->ln(); $this->SetFont('Arial', 'B', 10); $this->Cell($this->actualWidth * 0.24, 5, ' Money back guarantee -', 0); $this->SetFont('Arial', '', 10); $this->Cell($this->actualWidth, 5, 'your new COR account comes with a 100% money back guarantee.', 0); $this->ln(10); $this->SetFont('Arial', '', 12); $this->MultiCell($this->actualWidth, 5, 'Your new COR account will be set up with an interest free line of credit enabling you to make immediate purchases from the community and improve cash flow if desired - safe in the knowledge that you will receive new business from other COR businesses to cover the purchases you have made.', 0); $this->ln(); $this->MultiCell($this->actualWidth, 5, 'Our head office administration team will process your new COR account without delay and within the next 14 days you will receive your new card and account details. In the meantime you will receive a call from your new account manager to welcome you personally and begin working on your account to add value to your business.', 0); $this->ln(); $this->SetFont('Arial', 'B', 12); $this->Cell($this->actualWidth * 0.27, 7, 'Your new account details:','B'); $this->ln(10); // $this->MultiCell($this->actualWidth, 5, 'Your new account details:', 0); // $this->ln(); $this->SetFont('Arial', '', 12); //$this->SetFont('Arial', '', 12); // $tradesPeople = ! empty( $SectionAData['TRADEPEOPLE'] ) ? $SectionAData['TRADEPEOPLE'] : ''; // $Home = ! empty( $SectionAData['HOME'] ) ? $SectionAData['HOME'] : ''; // $this->Cell($this->actualWidth * 0.35, 3.8, 'Home/Window/Carpet Cleaning:',0); // $this->Cell(40, 3.2, $Home,'B'); // $this->Cell($this->actualWidth * 0.28, 3.8, 'Tradespeople:',0); // $this->Cell(40, 3.2, $tradesPeople,'B'); // $this->ln(7); // $Holidays = ! empty( $SectionAData['HOLIDAYS'] ) ? $SectionAData['HOLIDAYS'] : ''; // $localPub = ! empty( $SectionAData['LOCAL_PUB'] ) ? $SectionAData['LOCAL_PUB'] : ''; // $this->Cell($this->actualWidth * 0.35, 3.8, 'Local Pub/Restaurants:',0); // $this->Cell(40, 3.2, $localPub,'B'); // $this->Cell($this->actualWidth * 0.28, 3.8, 'Holidays/Accommodation:',0); // $this->Cell(40, 3.2, $Holidays,'B'); // $this->ln(7); // $Dentist = ! empty( $SectionAData['DENTIST'] ) ? $SectionAData['DENTIST'] : ''; // $Opticians = ! empty( $SectionAData['OPTICIANS'] ) ? $SectionAData['OPTICIANS'] : ''; // $this->Cell($this->actualWidth * 0.35, 3.8, 'Opticians:',0); // $this->Cell(40, 3.2, $Opticians,'B'); // $this->Cell($this->actualWidth * 0.28, 3.8, 'Dentist:',0); // $this->Cell(40, 3.2, $Dentist,'B'); // $this->ln(7); // $physicalTherapists = ! empty( $SectionAData['PHYSICAL_THERAPISTS'] ) ? $SectionAData['PHYSICAL_THERAPISTS'] : ''; // $Hairdressers = ! empty( $SectionAData['HAIRDRESSERS'] ) ? $SectionAData['HAIRDRESSERS'] : ''; // $this->Cell($this->actualWidth * 0.35, 3.8, 'Hairdressers/Beauty:',0); // $this->Cell(40, 3.2, $Hairdressers,'B'); // $this->Cell($this->actualWidth * 0.28, 3.8, 'Physical Therapists:',0); // $this->Cell(40, 3.2, $physicalTherapists,'B'); // $this->ln(7); // $childCare = ! empty( $SectionAData['CHILD_CARE'] ) ? $SectionAData['CHILD_CARE'] : ''; // $dryCleaning = ! empty( $SectionAData['DRY_CLEANING'] ) ? $SectionAData['DRY_CLEANING'] : ''; // $this->Cell($this->actualWidth * 0.35, 3.8, 'Dry Cleaning:',0); // $this->Cell(40, 3.2, $dryCleaning,'B'); // $this->Cell($this->actualWidth * 0.28, 3.8, 'Credit Line:',0); // $this->Cell(40, 3.2, $childCare,'B'); // $this->ln(7); // $Landscaping = ! empty( $SectionAData['LANDSCAPING'] ) ? $SectionAData['LANDSCAPING'] : ''; // $Gardener = ! empty( $SectionAData['GARDENER'] ) ? $SectionAData['GARDENER'] : ''; // $this->Cell($this->actualWidth * 0.35, 3.8, 'Gardener:',0); // $this->Cell(40, 3.2, $Gardener,'B'); // $this->Cell($this->actualWidth * 0.28, 3.8, 'Landscaping:',0); // $this->Cell(40, 3.2, $Landscaping,'B'); // $this->ln(7); // $Surveyor = ! empty( $SectionAData['SURVEYOR'] ) ? $SectionAData['SURVEYOR'] : ''; // $Architect = ! empty( $SectionAData['ARCHITECT'] ) ? $SectionAData['ARCHITECT'] : ''; // $this->Cell($this->actualWidth * 0.35, 3.8, 'Architect:',0); // $this->Cell(40, 3.2, $Architect,'B'); // $this->Cell($this->actualWidth * 0.28, 3.8, 'Surveyor:',0); // $this->Cell(40, 3.2, $Surveyor,'B'); // $this->ln(7); // $Conveyancing = ! empty( $SectionAData['CONVEYANCING'] ) ? $SectionAData['CONVEYANCING'] : ''; // $Planning = ! empty( $SectionAData['PLANNING'] ) ? $SectionAData['PLANNING'] : ''; // $this->Cell($this->actualWidth * 0.35, 3.8, 'Planning:',0); // $this->Cell(40, 3.2, $Planning,'B'); // $this->Cell($this->actualWidth * 0.28, 3.8, 'Conveyancing:',0); // $this->Cell(40, 3.2, $Conveyancing,'B'); // $this->ln(7); // $Total = ! empty( $SectionAData['TOTAL'] ) ? $SectionAData['TOTAL'] : ''; // $hobbies = ! empty( $SectionAData['HOLIDAYS'] ) ? $SectionAData['HOLIDAYS'] : ''; // $this->Cell($this->actualWidth * 0.35, 3.2, 'What hobbies do you enjoy ?:',0); // $this->Cell(40, 3.2, $hobbies,'B'); // $this->Cell($this->actualWidth * 0.28, 3.2, 'Total:',0); // $this->Cell(40, 3.2, $Total,'B'); // $this->ln(7); // $otherPlans = ! empty( $SectionAData['OTHER_PLANS'] ) ? $SectionAData['OTHER_PLANS'] : ''; // $this->Cell($this->actualWidth * 0.5, 3.5,'What other plans or projects do you have coming up in the home over the next 3, 6 & 12 months ?:',0); // $this->ln(7); // $this->Cell($this->actualWidth * 0.5, 3.5, $otherPlans,'B'); // $this->ln(7); //$this->Cell($this->actualWidth, $contactName); //$this->Cell($this->actualWidth, $accountType); //$this->SetFont('Arial', '', 10); //$this->MultiCell($this->actualWidth ,3, 'Subscription Fee:',0); /* $tranFee = ! empty( $SectionAData['TRANSACTION_FEE'] ) ? $SectionAData['TRANSACTION_FEE'] : ''; $annualFee = ! empty( $SectionAData['ANNUAL_CARD_FEE'] ) ? $SectionAData['ANNUAL_CARD_FEE'] : ''; //$this->ln(); $this->Cell($this->actualWidth * 0.19,3.8, 'Annual Card Fee:',0); $this->Cell(38, 3.8, $annualFee,'B'); $this->Cell($this->actualWidth * 0.25, 3.8, 'Sales Transaction Fees:',0); $this->Cell(28, 3.8, $tranFee,'B'); //$this->Cell($this->actualWidth, $annualFee); $this->ln(7); $otherComm = ! empty( $SectionAData['OTHER_COMMENT'] ) ? $SectionAData['OTHER_COMMENT'] : ''; $this->Cell($this->actualWidth * 0.19, 3.8,'Other Comments:',0); $this->Cell($this->actualWidth * 0.6, 3.8, $otherComm,'B'); //$this->Cell($this->actualWidth, $tranFee); $this->ln(7); //$this->Cell($this->actualWidth ,3, 'Other Comments:',0); //$this->Cell($this->actualWidth, $otherComm); //$this->Cell($this->actualWidth ,3, 'Local Broker Details:',0); $brokerDetails = ! empty( $SectionAData['BROKER_DETAILS'] ) ? $SectionAData['BROKER_DETAILS'] : ''; $this->Cell($this->actualWidth * 0.22, 3.8,'Local Broker Details:',0); $this->Cell($this->actualWidth * 0.58, 3.8, $brokerDetails,'B'); //$this->Cell($this->actualWidth, $brokerDetails); $this->ln(7); // $this->Cell($this->actualWidth ,3, 'Purchasing Manager Details:',0); $managerDetails = ! empty( $SectionAData['MANAGER_DETAILS'] ) ? $SectionAData['MANAGER_DETAILS'] : ''; $this->Cell($this->actualWidth * 0.30, 3.9,'Purchasing Manager Details:',0); $this->Cell($this->actualWidth * 0.49, 3.9, $managerDetails,'B'); // $this->Cell($this->actualWidth, $managerDetails); $this->ln(7); $this->Cell($this->actualWidth * 0.26, 3.8,'Full terms and conditions:',0); $this->SetTextColor(0,119,204); $this->Cell($this->actualWidth * 0.52, 3.8, 'http://www.cashonreferral.com/terms-and-conditions/','B'); //$this->Cell($this->actualWidth ,3.8, 'Full terms and conditions: ','B'); $this->SetTextColor(0,0,0); $this->ln(19);*/ $this->Cell($this->actualWidth,10,' Cash On Referal, Unit 3 Churchill Court, 33 Palmerston Road, Bournemouth, Dorset BH1 4HN',0); $this->ln(); $this->Cell($this->actualWidth * 0.56, 3.8,' Tel: 08009875451 Web: ',0); $this->SetTextColor(0,119,204); $this->Cell(47, 3.8, 'www.cashonreferral.com','B'); $this->ln(4); $this->SetTextColor(0,0,0); $this->Cell($this->actualWidth * 0.5, 3.8,' Corporation Number : 08009875451',0); } function SectionAData($conn ) { $sql = " SELECT * FROM emp_manager_new_vw "; if( $result = $conn->query( $sql, MYSQLI_USE_RESULT ) ) { $row = $result->fetch_assoc(); $result->close(); } return empty( $row ) ? [] : $row; } // function UpdateGeneratedFlag( $franchise_detail_id, $filename, $conn ) // { // $sql = " // UPDATE `emp_manager_new_vw` // "; // $conn->query( $sql ); // } } // Instantiation of inherited class $pdf = new PDF(); $pdf->left = 12; $pdf->actualWidth = $pdf->w - ( $pdf->left * 2 ); $dir = "emp"; if( ! file_exists( $dir ) ) mkdir( $dir, 0755, true ); // Generate Pdf /* $pdf->AddPage(); $pdf->CoverPage(); */ /* $pdf->AddPage(); $pdf->ApplicationForm(); */ $pdf->AddPage(); $SectionAData = $pdf->SectionAData($conn ); $pdf->SectionA( $SectionAData ); // Save the pdf to server $filename = $dir . '/' . '.pdf'; //$pdf->UpdateGeneratedFlag( $franchise_detail_id, $filename, $conn ); // $pdf->Output( $filename, 'F' ); $pdf->Output(); // Free the object to assign new object unset( $pdf ); redirect();