OverLord Shell
<?php session_start();
require_once("db/conn.php");
require_once('tcpdf/tcpdf.php');
$editq="SELECT * FROM otms_mst_contactpayment WHERE conpaysrno=".$_GET['id'];
$editr=$connection_jc->query($editq);
if($editr->num_rows!=1)header("location:404.php");
$editrow=$editr->fetch_assoc();
$editr->free();
$selr=$connection_jc->query("SELECT fname,lname,memexpdate FROM otms_mst_contact WHERE con_sr_no=".$editrow['con_sr_no']);
$selrow=$selr->fetch_assoc();
$selr->free();
//$status=$editrow['active'];
class MYPDF extends TCPDF {
public function header(){
//checking for cancelled receipt
/*if($GLOBALS['status']=='n'){
$this->setJPEGQuality(90);
$this->Image(K_PATH_IMAGES.'../img/watermark.png', 0, 0, 210, 0, '', '', 'M', false, 300, 'C', false, false, 0, false, false, false);
}*/
}
public function Footer() {
$this->SetY(-20);
$this->SetFont(PDF_FONT_NAME_MAIN, '', 8);
$this->SetTextColor(200,200,200);
$this->Cell(0, 10, 'Powered by MACCIA (www.Maccia.org.in)', 0, false, 'C');
}
}
// create a PDF object
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->SetProtection(array('copy'), '', null, 0, null);
// set document (meta) information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Maccia.org.in.');
$pdf->SetTitle('Receipt - '.$editrow['recno']);
$pdf->SetSubject('Receipt - '.$editrow['recno']);
$pdf->SetKeywords('');
$pdf->SetMargins(5, 6, 5, true);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set default font subsetting mode
$pdf->setFontSubsetting(true);
$pdf->SetFont('helvetica', '', 11, '', true);
// add a page
$pdf->AddPage('L','A5');
function number_to_word($number){
$no=floor($number);
$point=round($number-$no,2)*100;
$hundred=null;
$digits_1=strlen($no);
$i=0;
$str=array();
$words=array('0'=>'','1'=>'one','2'=>'two','3'=>'three','4'=>'four','5'=>'five','6'=>'six','7'=>'seven','8'=>'eight','9'=>'nine','10'=>'ten','11'=>'eleven','12'=>'twelve','13'=>'thirteen','14'=>'fourteen','15'=>'fifteen','16'=>'sixteen','17'=>'seventeen','18'=>'eighteen','19'=>'nineteen','20'=>'twenty','30'=>'thirty','40'=>'forty','50'=>'fifty','60'=>'sixty','70'=>'seventy','80'=>'eighty','90'=>'ninety');
$digits=array('','hundred','thousand','lakh');
while($i<$digits_1){
$divider=($i==2) ? 10 : 100;
$number=floor($no%$divider);
$no=floor($no/$divider);
$i+=($divider==10) ? 1 : 2;
if($number){
$plural=(($counter=count($str)) && $number>9) ? 's' : null;
$hundred=($counter==1 && $str[0]) ? '' : null;
$str[]=($number<21) ? $words[$number]." ".$digits[$counter].$plural." ".$hundred : $words[floor($number/10)*10]." ".$words[$number%10]." ".$digits[$counter].$plural." ".$hundred;
}
else $str[]=null;
}
$str=array_reverse($str);
$result=implode('',$str);
//if decimal exists, adding it to result
$result.=($point) ? "and ".$words[$point-($point%10)]." ".$words[$point%10].' Paise' : "";
return "Rupees ".$result;
}
$content='
<table cellspacing="0" cellpadding="5" border="1" width="100%" style="border-collapse:collapse">
<tr>
<td align="center" colspan="3">
<img src="img/logo.jpg" height="40" alt="">
</td>
</tr>
<tr>
<td>Receipt No: <strong>'.$editrow['recno'].'</strong></td>
<td align="center"><h3 style="font-size:20px"><strong>CASH RECIPT</strong></h3></td>
<td align="right" colspan="3">Date: <strong>'.date('d-M-Y',strtotime($editrow['recdate'])).'</strong></td>
</tr>
<tr>
<td colspan="3">Recived With Thanks From : <strong>'.$selrow['fname'].' '.$selrow['lname'].'</strong></td>
</tr>
<tr>
<td colspan="3">The Sum Of <strong>'.ucwords(number_to_word($editrow['amount'])).' only</strong></td>
</tr>
<tr>
<td colspan="3"><p>By <strong>';
if(is_null($editrow['chqno'])){$content.='Cash';}
else{$content.=' Cheque No: '.$editrow['chqno'].', dated '.date('d-M-Y',strtotime($editrow['chqdate'])).', from bank '.$editrow['bankname'];}
$content.='</strong></p></td>
</tr>
<tr>
<td colspan="3">
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td colspan="3"><h2>Rs.'.$editrow['amount'].'</h2></td>
</tr>
<tr>
<td> </td>
<td align="center"><br><br><br>Accountant Sign</td>
<td align="center"><br><br><br>Authorised Signatory</td>
</tr>
</table>
</td>
</tr>
</table>';
$connection_jc->close();
// Print text using writeHTMLCell()
$pdf->writeHTMLCell(0,0,'','',$content,0,1,false,true,'',false);
//Close and output PDF document
$pdf->Output('Receipt-'.$editrow['recno'].'-'.date('dmY').'.pdf', 'I');//use this to view pdf in current file
?>
xRyukZ - Copyright 2k19