Index of /home/htscrtms/newcrm.htshah.com/hslider
<?php
include('lib/db_connect.php');
include('lib/auth.php');
date_default_timezone_set("Asia/Kolkata");;
$date=date('d-m-Y');
$schema_insert = "<table class='table' border='1' width='100%'>
<thead>
<tr>
<th>Sr.</th>
<th>HTSHAH Job</th>
<th>Client</th>
<th>Shipping bill no</th>
<th>Supplier</th>
<th>PKGs</th>
<th>Shipping Co. & Cont. No.</th>
<th>Empty D.o.</th>
<th>Factory Stuffing</th>
<th>Cut off to cont. no</th>
<th>Carting</th>
<th>Exam</th>
<th>Stuffing</th>
<th>Sailing</th>
<th>Handover of S/Bill</th>
<th>Shipping Bill Rels</th>
<th>Acd/eu decl</th>
<th>Remarks</th>
</tr>
</thead>
<tbody>";
$count=0;
$selc="select * from `tabl_client` where id='".$_REQUEST['client_id']."'";
$qryc=mysqli_query($con,$selc) or die(mysqli_error($con));
$rowc=mysqli_fetch_array($qryc);
$sel="select * from `tabl_exportentry` where DELFLAG='Y' && client_id='".$_REQUEST['client_id']."' order by id desc";
$qry=mysqli_query($con,$sel) or die(mysqli_error($con));
while($row=mysqli_fetch_array($qry))
{ $count++;
$schema_insert .= "<tr>
<td>".$count."</td>
<td>".$row['htshah_no']."</td>
<td>".$rowc['userName']."</td>
<td>".$row['thoka_no']."</td>
<td>".$row['supplier']."</td>
<td>".$row['pkgs']."</td>
<td>".$row['vessel']."</td>
<td>".$row['empty_doc_recd_dt']."</td>
<td>".$row['factory_stuffing_datetime']."</td>
<td>".$row['cutoff_cont_no']."</td>
<td>".$row['carting']."</td>
<td>".$row['exam']."</td>
<td>".$row['stuffing']."</td>
<td>".$row['sailing']."</td>
<td>".$row['handover_of_sb']."</td>
<td>".$row['shipping_bill_release_dt']."</td>
<td>".$row['acdDeclFiled_dt']."</td>
<td>".$row['remark']."</td>
</tr>";
}
$schema_insert .= "</tbody></table>";
file_put_contents('exportdeletedreport.xls', $schema_insert);
?>
<?php
$to = $rowc['email'];
$from = "cse@htshah.com";
$subject = "Export Report as of ".$date;
$separator = md5(date('r', time()));
// carriage return type (we use a PHP end of line constant)
$eol = PHP_EOL;
// attachment name
$filename = "exportdeletedreport.xls";
//$pdfdoc is PDF generated by FPDF
$attachment = chunk_split(base64_encode(file_get_contents('exportdeletedreport.xls')));
// main header
$headers = "From: ".$from.$eol;
$headers .= "MIME-Version: 1.0".$eol;
$headers .= "Content-Type: multipart/mixed; boundary=\"".$separator."\"";
// no more headers after this, we start the body! //
$body = "--".$separator.$eol;
$header .= "Content-type:text/plain; charset=iso-8859-1".$eol;
$body .= "Content-Transfer-Encoding: 7bit".$eol.$eol;
$body .= "This is a MIME encoded message.".$eol;
// message
$body .= "--".$separator.$eol;
$body .= "Content-Type: text/html; charset=\"iso-8859-1\"".$eol;
$body .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
$body .= $message.$eol;
// attachment
$body .= "--".$separator.$eol;
$body .= "Content-Type: application/octet-stream; name=\"".$filename."\"".$eol;
$body .= "Content-Transfer-Encoding: base64".$eol;
$body .= "Content-Disposition: attachment; filename=\"".$filename."\"".$eol.$eol;
$body .= $attachment.$eol;
$body .= "--".$separator."--";
if (@mail($to, $subject, $body, $headers)) {
// echo "mail send ... OK";
echo "<script>alert('Mail sent sucessfully');window.location.href='exportDeletedReport.php';</script>";
} else {
echo "mail send ... ERROR";
}
?>