<?php
include_once "invoice_includes.php";
////////////////////// CORE FUNCTION | MODULE FUNCTION (c) i2d Technologies //////////////////////////////////
if(!empty($_REQUEST['id'])){
$id=i2d_secured_input($_REQUEST['id']);
}
if(!empty($_REQUEST['logo'])){
$logo=i2d_secured_input($_REQUEST['logo']);
}
if(!empty($_REQUEST['ad'])){
$ad=i2d_secured_input($_REQUEST['ad']);
}
$case=1;

$id=56;
$logo=0;
$ad=0;

$file_title="i2d_hosting_invoice";
$doc_title="i2d Technologies - Client Hosting Invoice";
$ref_suffix="RP-HR-";
$ref_series="1001";
$doc_keywords="web hosting";
$doc_sub="Cloud Linux - Hosting Services";
$logo_img="logo2019.jpg";
$ad_img="ad2019.jpg";
$footer_img="footer_2019.jpg";
$line="_____________________________________________________________________________________________________";
$line_old="_________________________________________________________________________________________";
$unit="PKR";

$dated1=date("l F j, Y");



$dte = strtotime("-3 day");
$dated2= date("l F j, Y", $dte);


$person_name0="Raja Waheed Zaman";
$post_name="Corporate Sales Executive";
$hiring_starts=$dated2;
$salary1="20,000/-";
$salary_amount=$unit." ".$salary1;
$person_name=strtoupper("RAJA WAHEED ZAMAN");
$company_name=strtoupper("double dragon");
$address=strtoupper("Main road westrdge bazar road 13440 street");
$city_name="Rawalpindi";
$cnic="37405-09987692";



$salary_tax_note="*16 % General Sales Tax apllies to all purchases.";

	
////////////////////////////////////////////





$inv_header='<p>&nbsp;</p><p>&nbsp;</p>

<table width="660" border="0" align="center" cellpadding="2" cellspacing="0">
  <tr>
    <td width="290" rowspan="2" align="left">ATTN : <br />
    '. $person_name .' <br />
    '. $company_name .'<br /> 
    '. $address .',<br /> 
    '. $city_name .',.</td>
    <td width="330" align="right">&nbsp;</td>
  </tr>
  <tr>
    <td align="right"><b>Tracking / Ref: '. $ref_suffix .''. $ref_series .''. $refno .'</b><br />
Date: '. $dated1 .'</td>
  </tr>
  
</table><br /><br />




';


$para1='
<table width="660" border="0" align="center" cellpadding="2" cellspacing="0">
  <tr>
    <td height="10" align="center"><h3><em>Private &amp; Confidential</em></h3>
    <h3>LETTER OF PROBATIONARY HIRING (Employee Copy)</h3></td>
  </tr>
  <tr>
    <td height="10" align="left"><p>Dear Mr. <strong>'.$person_name0.',</strong><br />
        <br />
    We are pleased to offer you Probationary Job at <strong>i2d Technologies</strong> as a <strong>“'.$post_name.'”</strong> on or after <strong>'.$hiring_starts.'.</strong></p>
    </td>
  </tr>
</table>

';

$job_description='

<table width="660" border="0" align="left" cellpadding="4" cellspacing="0">
  <tr>
    <td bgcolor="#E6E6E6"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Job Description:</strong> </td>
  </tr>
  <tr>
    <td><ul>
      <li>Bring in <strong>new clients for .com Hosting Account subscriptions</strong>, as well as maintain good relationship with our existing hosting clients.</li>
      <li>Attain the desired sales count of <strong>10 or more .com Hosting Accounts</strong> / Month..</li>
      <li>You are to deposit with the company, any fee or amount collected for the subscriptions.</li>
      <li>You are not authorized to personally advertise / publicize any of the services or offerings without Company`s written approval.</li>
      <li>You will be required to <strong>be punctual in work hours</strong>, diligent and faithful to the <strong>Company Dicipline &amp; Attendence Policy</strong> and provide full effort to the official task assigned to you.</li>
      <li>You will be required to travel regarding business development activities.</li>
      <li>You will regularly report to Senior Management.</li>
    </ul></td>
  </tr>
</table>


';

$employment_status=
'
<table width="660" border="0" align="left" cellpadding="4" cellspacing="0">
  <tr>
    <td bgcolor="#E6E6E6"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Employment Status:</strong> </td>
  </tr>
  <tr>
    <td><ul>
      <li>You are employed to generate at least <strong>6 domain &amp; hosting account sales per month</strong> for the company,<strong> if you are continually unable in doing so</strong>, HR reserves the right to cancel your Probationary job. </li>
      <li> You will be paid monthly compensation from the company accounts as long as you are meeting the job expectations and your employment status can change at any time due to regular performance review and the Company`s discretion.</li>
    </ul></td>
  </tr>
</table>

';

$salary=
'
<table width="660" border="0" align="left" cellpadding="4" cellspacing="0">
  <tr>
    <td bgcolor="#E6E6E6"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Salary :</strong> </td>
  </tr>
  <tr>
    <td><ul>
      <li>Your Gross Salary will be <strong>'.$salary_amount.'</strong> per month as per Annexure “A”.</li>
      </ul></td>
  </tr>
</table>

';

$bonus=
'
<table width="660" border="0" align="left" cellpadding="4" cellspacing="0">
  <tr>
    <td bgcolor="#E6E6E6"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Bonus / Rewards :</strong> </td>
  </tr>
  <tr>
    <td><ul>
      <li>You will be also paid Performance Bonus as per Annexure “B”</li>
    </ul></td>
  </tr>
</table>
';


$attendance=
'
<table width="660" border="0" align="left" cellpadding="4" cellspacing="0">
  <tr>
    <td bgcolor="#E6E6E6"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Attendance , Discipline &amp; Code of Conduct:</strong></td>
  </tr>
  <tr>
    <td><ul>
      <li>You are strongly advised to maintain your office atendence and preserve the office conduct policy as well as reporting procedures as per Annexure “C”.</li>
    </ul></td>
  </tr>
</table>

';



$rec_id = $id;
$refno = $rec_id;

/*
$array_cols=array(id_col,company_name,address,owner_name,dotcom,ref,url);

$tdsettings=array(
	'table'=>i2d_table,
	'id_col'=>id_col,
	'fields_array'=>$array_cols,
	'status_vaue'=>'Active',
	'type'=>'1c',
	'where_col'=>id_col,
	'where_value'=>$rec_id,
	'ref_col'=>ref,
	'ref_value'=>"'market_entry'",
	'order'=>"ASC",
    'limit'=>1);

$printitem=db_fetch($tdsettings);

foreach ($printitem as $item)
{
$company_name=$item[company_name];
$person_name=$item[owner_name];
$address=$item[address];
$domain1=(base64_decode($item[dotcom]));
}

$person_name=strtoupper($person_name);
$company_name=strtoupper($company_name);
$address=strtoupper($address);

*/



require_once('tcpdf_include.php');


// Extend the TCPDF class to create custom Header and Footer
class MYPDF extends TCPDF {

	//Page header
	public function Header() {
if(isset($logo) && $logo!=0){		
		// Logo
		if (count($this->pages) === 1) {
		$image_file = K_PATH_IMAGES.$logo_img;
		$this->Image($image_file, 10, 10, 190, '', 'JPG', '', 'T', false, 300, '', false, false, 0, false, false, false);
		// Set font
		$this->SetFont('helvetica', 'B', 20);}
		
		
		if(isset($ad) && $ad!=0){
		if (count($this->pages) === 2) {
		$img_file = K_PATH_IMAGES.$ad_img;
        $this->Image($img_file, 0, 25, 210, 250, 'JPG', '', '', false, 300, 'C', false, false, 0);
		}
		}
		
}
		}

	// Page footer
	public function Footer() {
		if(isset($logo) && $logo!=0){
if (count($this->pages) === 1) {
	// Position at 15 mm from bottom
		$this->SetY(-15);
		
		// Set font
		$this->SetFont('helvetica', 'I', 8);
		// Page number
		$this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
		$image_file = K_PATH_IMAGES.$footer_img;
		$this->Image($image_file, 10, 250, 190, '', 'JPG', '', 'T', false, 300, '', false, false, 0, false, false, false);
		
	}

	
	}
	}
	
	
}

// create new PDF document
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('i2d Technologies');
$pdf->SetTitle($doc_title.$rec_id);
$pdf->SetSubject($doc_sub);
$pdf->SetKeywords($doc_keywords);

// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);

// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));

// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);

// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
	require_once(dirname(__FILE__).'/lang/eng.php');
	$pdf->setLanguageArray($l);
}

// set font
$pdf->SetFont('helvetica', '', 9);


// create some HTML content

$pdf->AddPage();

// create some HTML content




/// PART 2

$html = ''.$inv_header.'';

$html .='
'.$para1.''.$job_description.''.$employment_status.''.$salary.''.$bonus.''.$attendance.'


<!--table Ends-->
';





// output the HTML content
$pdf->writeHTML($html, true, 0, true, 0);
   
$pdf->AddPage();

$html2 .='
'.$para1.''.$job_description.''.$employment_status.''.$salary.''.$bonus.''.$attendance.'';


$pdf->writeHTML($html2, true, 0, true, 0);

// reset pointer to the last page
$pdf->lastPage();

$file=".$file_title."."-".$refno."-".$dated1.".pdf";

// ---------------------------------------------------------

if($case=="1"){//Close and output PDF document
ob_end_clean();
$pdf->Output($file , 'I');}

if($case=="2"){
	// force print dialog
$js = 'print(true);';

// set javascript
$pdf->IncludeJS($js);
ob_end_clean();
//Close and output PDF document
$pdf->Output($file , 'I');
	
}



//============================================================+
// END OF FILE
//============================================================+
?>