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->SetFont('Arial', '', 10); var_dump($row);die; // $EMP_NBR = ! empty( $SectionAData['EMP_FULL_NAME'] ) ? $SectionAData['EMP_FULL_NAME'] : ''; // $this->Cell($this->actualWidth * 0.28, 3.8, 'EMP_FULL_NAME:',0); // $this->Cell(40, 3.2, $EMP_NBR,'B'); $width_cell=array(20,50,40,40,40); $this->SetFont('Arial','B',16); $this->SetFillColor(193,229,252); // Background color of header // Header starts /// $this->Cell($width_cell[0],10,'ID',1,0,,true); // First header column $this->Cell($width_cell[1],10,'NAME',1,0,,true); // Second header column $this->Cell($width_cell[2],10,'CLASS',1,0,,true); // Third header column $this->Cell($width_cell[3],10,'MARK',1,0,,true); // Fourth header column $this->Cell($width_cell[4],10,'SEX',1,1,,true); // Third header column //// header ends /////// $this->SetFont('Arial','',14); $this->SetFillColor(235,236,236); // Background color of header $fill=false; // to give alternate background fill color to rows /// each record is one row /// foreach ($row as $row1) { $this->Cell($width_cell[0],10,$row1['EMP_NBR'],1,0,,$fill); $this->Cell($width_cell[1],10,$row1['EMP_FULL_NAME'],1,0,,$fill); $this->Cell($width_cell[2],10,$row1['DEPARTMENT'],1,0,,$fill); $this->Cell($width_cell[3],10,$row1['COST_CENTER'],1,0,,$fill); $this->Cell($width_cell[4],10,$row1['LOCATION_NAME'],1,1,,$fill); $fill = !$fill; // to give alternate background fill color to rows } // $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);*/ } function SectionAData($conn ) { $sql = " SELECT EMP_NBR, EMP_FULL_NAME, DEPARTMENT , COST_CENTER, LOCATION_NAME, DESIGNATION, DATE_OF_JOINING, GENDER , EMP_PAN_NBR, EMP_SSN_NBR , EMP_GRADE , COMPANY_NAME , OFFICE_ADDRESS, EMAIL_ID, SKYPE_ID, PHONE_NBR, EMPLOYMENT_TYPE , CONFIRMATION_DATE , LAST_APPRAISAL_DATE , APPRAISALTYPE, RESIGNATION_DATE , TERMINATION_DATE , TERMINATION , CNTCT_NM RESIDENTIAL_ADDRESS , EDUCATION_NAME , USER_NM , DOB , BLOOD_GRP , ACCOUNT_NO , BANK_NAME , IFSC_CODE , OA_BRAND_NM from emp_mst_vw "; // if( $date ) { // $query .= " // AND ( (DATE_OF_JOINING >= '{$date}' // AND TERMINATION_DATE <= '{$date}') // OR (DATE_OF_JOINING >= '{$date}' // AND TERMINATION_DATE IS NULL) )"; // } else { // $query .= "AND TERMINATION_DATE IS NULL"; // } 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();