OverLord Shell
<?php session_start();
//if(!isset($_SESSION['id']) || !isset($_SESSION['user'])){session_destroy();header("location:login.php");}
//if(!in_array($_SESSION['role'],array('su','op'))){header("location:404.php");}
require_once("db/conn.php");
include "dompdf/autoload.inc.php";
use Dompdf\Dompdf;
use Dompdf\Options;
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 con_sr_no,email,salutation,fname,lname,memexpdate,memshiptype,memcode,col5,active FROM otms_mst_contact WHERE con_sr_no=".$editrow['con_sr_no']);
$selrow=$selr->fetch_assoc();
$selr->free();
// no to word function
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;
}
// print receipt start
if(!isset($_GET['send'])){
//$status=$editrow['active'];
$header='
<table cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse:collapse">
<tr>
<td align="left" valign="bottom" width="18%"><img src="img/logo.jpg" height="40" alt=""></td>
<td align="center" width="82%">
<span style="font-size:1.3em">Maharashtra Chamber of Commerce, Industry & Agriculture</span><br>
<span style="font-size:0.65em;line-height:1.4">
Oricon House, 6th Floor, Maharashtra Chamber of Commerce Lane, Kala Ghoda, Fort, Mumbai - 400 001.<br>
Ph: (022) 67395800 (30 Lines) 2285 5859/5860 Fax: (022) 22855861 Email: maccia@maccia.org.in Web: www.maccia.org.in
</span>
</td>
</tr>
</table>';
class MYPDF extends TCPDF {
public function header(){
$this->MultiCell(200, 0, $GLOBALS['header'], 0, 'C', 0,0,'7','7', true, 0, true, true, 0);
//$this->Line(5, 24, 205, 24);
}
public function Footer() {
$this->SetY(-20);
$this->SetFont(PDF_FONT_NAME_MAIN, '', 8);
$this->SetTextColor(200,200,200);
//$this->Cell(0, 10, 'Powered by Ultraliant Infotech Pvt Ltd (www.ultraliant.com)', 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('Ultraliant Infotech Pvt Ltd.');
$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');
$content='
<table cellspacing="0" cellpadding="5" border="1" width="100%" style="border-collapse:collapse">
<tr>
<td align="center" colspan="3" height="55">
<!--<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>RECEIPT</strong></h3></td>
<td align="right" colspan="3">Date: <strong>'.date('d-M-Y',strtotime($editrow['recdate'])).'</strong></td>
</tr>
<tr>
<td colspan="3">Received From : <strong>'.$selrow['salutation'].' '.$selrow['fname'].' '.$selrow['lname'].'</strong></td>
</tr>
<tr>
<td colspan="3">Amount Of Rs.'.$editrow['amount'].' <strong>('.ucwords(number_to_word($editrow['amount'])).' only)</strong></td>
</tr>
<tr>
<td colspan="3"><p>By <strong>';
if($editrow['paymode']==1){$content.='Cash';}
else if($editrow['paymode']==2){$content.=' Cheque/DD No : '.$editrow['chqno'].', date : '.date('d-M-Y',strtotime($editrow['chqdate'])).', Drawn : '.$editrow['bankname'];}
else if($editrow['paymode']==3){$content.=' NEFT : '.$editrow['chqno'].', date : '.date('d-M-Y',strtotime($editrow['chqdate'])).', Drawn : '.$editrow['bankname'];}
$content.='</strong> </p></td>
</tr>';
if($selrow['memshiptype']=='LIFE' || $selrow['memshiptype']=='PATRON'){
$lyear='LIFE TIME';
}else
{
$lyear=$editrow['newexpdate'];
}
$content.='<tr>
<td colspan="3"><p>For <strong>'.$editrow['mperiod'].'</strong> Fees for the period <strong><u>'.$editrow['oldexpdate'].'</u></strong> TO <strong><u>'.$lyear.'</u></strong></p></td>
</tr>
<tr>
<td colspan="3">Against <strong>'.strtoupper($selrow['memshiptype']).' </strong> Memebership No : <strong><u>';if($selrow['active']=='y'){ $content.=$selrow['memcode'];} $content.='</u></strong> </td>
</tr>
<tr>
<td colspan="3">
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td> </td>
<td align="center"><br><br><br></td>
<td align="center"> <img style="width:auto; height:50px;" src="sagar.jpg" alt="Sagar MACCIA" title="Sagar MACCIA" class="img-responsive"/><br>Authorised Signatory</td>
</tr>
</table>
</td>
</tr>
</table>';
$content.='<span style="font-size:9px"><center>This is a computer generated receipt</center></span>';
$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
}else // receipt print close
{ // start receipt send
$options = new Options();
$options->set('defaultFont', 'Helvetica Neue','Helvetica','Arial','sans-serif');
$html='<html>';
$html.='
<table cellspacing="0" cellpadding="5" border="1" width="100%" style="border-collapse:collapse">
<tr>
<td align="center" width="100%" colspan="3">
<table width="100%">
<tr>
<td width="18%">
<img src="img/logo.jpg" height="40" alt=""></td>
<td width="82%"><span style="font-size:1.3em">Maharashtra Chamber of Commerce, Industry & Agriculture</span><br>
<span style="font-size:0.65em;line-height:1.4">
Oricon House, 6th Floor, Maharashtra Chamber of Commerce Lane, Kala Ghoda, Fort, Mumbai - 400 001.<br>
Ph: (022) 67395800 (30 Lines) 2285 5859/5860 Fax: (022) 22855861 Email: maccia@maccia.org.in Web: www.maccia.org.in
</span></td>
</tr>
</table>
</td>
</tr>
</tr>
<tr>
<td width="20%" style="vertical-align:top">Receipt No: <strong>'.$editrow['recno'].'</strong></td>
<td width="60%" align="center" style="vertical-align:top"><span style="font-size:20px"><strong>RECEIPT</strong></span></td>
<td width="20%" align="right" style="vertical-align:top">Date: <strong>'.date('d-M-Y',strtotime($editrow['recdate'])).'</strong></td>
</tr>
<tr>
<td colspan="3">Received From : <strong>'.$selrow['salutation'].' '.$selrow['fname'].' '.$selrow['lname'].'</strong></td>
</tr>
<tr>
<td colspan="3">Amount Of Rs.'.$editrow['amount'].' <strong>('.ucwords(number_to_word($editrow['amount'])).' only)</strong></td>
</tr>
<tr>
<td colspan="3">By <strong>';
if($editrow['paymode']==1){$html.='Cash';}
else if($editrow['paymode']==2){$html.=' Cheque/DD No : '.$editrow['chqno'].', date : '.date('d-M-Y',strtotime($editrow['chqdate'])).', Drawn : '.$editrow['bankname'];}
else if($editrow['paymode']==3){$html.=' NEFT : '.$editrow['chqno'].', date : '.date('d-M-Y',strtotime($editrow['chqdate'])).', Drawn : '.$editrow['bankname'];}
$html.='</strong></td>
</tr>';
if($selrow['memshiptype']=='LIFE' || $selrow['memshiptype']=='PATRON'){
$lyear='LIFE TIME';
}else
{
$lyear=$editrow['newexpdate'];
}
$html.='<tr>
<td colspan="3">For <strong>'.$editrow['mperiod'].'</strong> Fees for the period <strong><u>'.$editrow['oldexpdate'].'</u></strong> TO <strong><u>'.$lyear.'</u></strong></td>
</tr>
<tr>
<td colspan="3">Against <strong>'.strtoupper($selrow['memshiptype']).' </strong> Memebership No : <strong><u>';if($selrow['active']=='y'){ $html.=$selrow['memcode'];} $html.='</u></strong> </td>
</tr>
<tr>
<td colspan="3">
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td align="center" width="50%"><br><br><br></td>
<td align="right" width="40%"> <img style="width:auto; height:50px;" src="sagar.jpg" alt="Sagar MACCIA" title="Sagar MACCIA" class="img-responsive"/><br>Authorised Signatory</td>
<td width="10%"> </td>
</tr>
</table>
</td>
</tr>
</table>';
$html.='<span style="font-size:9px"><center>This is a computer generated receipt</center></span>';
$dompdf = new DOMPDF($options);
$dompdf->load_html($html);
$dompdf->setPaper('A5', 'landscape');
$dompdf->render();
$output = $dompdf->output();
if(!empty($selrow['email'])){
file_put_contents('attachments/receiptsend.pdf', $output);
$to=$selrow['email'].",prerana@maccia.org.in,sagar@maccia.org.in,nitin@maccia.org.in";//$selrow['email'].",sagar@maccia.org.in,prerana@maccia.org.in,
$name="MACCIA";
$from = "membership2@maccia.org.in";
$fromName = "MACCIA";
//email subject
$subject = "MACCIA RECEIPT";
//attachment file path
$file="attachments/receiptsend.pdf";
$coverq="SELECT * FROM otms_mst_cover where coversrno=5";
$coverr=$connection_jc->query($coverq);
$coverrow=$coverr->fetch_assoc();
$coverr->free();
//email Cover letter format
$htmlContent = 'Dear '.$selrow['salutation'].' '.$selrow['fname'].' '.$selrow['lname']."<br/><br/>";
$htmlContent .= $coverrow['description'];
//header for sender info
$headers = "From: $fromName"." <".$from.">";
//boundary
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
//headers for attachment
$headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\"";
//multipart boundary
$message = "--{$mime_boundary}\n" . "Content-Type: text/html; charset=\"UTF-8\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" . $htmlContent . "\n\n";
//preparing attachment
if(!empty($file) > 0){
if(is_file($file)){
$message .= "--{$mime_boundary}\n";
$fp = @fopen($file,"rb");
$data = @fread($fp,filesize($file));
@fclose($fp);
$data = chunk_split(base64_encode($data));
// $data =$sa;
$message .= "Content-Type: application/octet-stream; name=\"".basename($file)."\"\n" .
"Content-Description: ".basename($files[$i])."\n" .
"Content-Disposition: attachment;\n" . " filename=\"".basename($file)."\"; size=".filesize($file).";\n" .
"Content-Transfer-Encoding: base64\n\n" . $data . "\n\n";
}
}
$message .= "--{$mime_boundary}--";
$returnpath = "-f" . $from;
//echo $subject."---".$message."------".$returnpath."<br/>";
@mail($to, $subject, $message, $headers, $returnpath);?>
<?php }?>
<div id="page-wrapper">
<div class="row">
<div class="col-lg-12">
<h4 class="page-header">Send Receipt To <?php echo " Email Send to ".$to."---"." (Prerana Madam and ".$selrow['salutation'].' '.$selrow['fname'].' '.$selrow['lname'].")";?></h4>
<script>
var timer = setTimeout(function() {
window.location='contactpayment.php?id=<?php echo $selrow['con_sr_no'];?>';
}, 5000);
</script>
</div>
</div>
</div>
<?php
} // close receipt send
?>
xRyukZ - Copyright 2k19