<?php
include('../headertop.php');
include('../db.php');
//include('../datepicker.php');

$disp = '';
$pagetitle = 'Print Expense Receipt';
date_default_timezone_set('Asia/Kolkata');

if(empty($_REQUEST['id']))
{
echo 'Select an expense transaction first to print its receipt';
exit;
}

$project = 1;
$id = $_REQUEST['id'];



$q = "select * from expenses where id='$id'";
$res = mysqli_query($dbcon,$q) or die(mysqli_error($dbcon));
if(mysqli_num_rows($res)<1)
{
$disp .= 'No such expense transaction found. Please re-check and try again!';
include('../template.php');
exit;
}

$row = mysqli_fetch_array($res);
$datedisp = date("d-m-Y", strtotime($row['date']));

$q2 = "select * from work_type where id='".$row['work_type']."'";
$res2 = mysqli_query($dbcon,$q2) or die(mysqli_error($dbcon));
$row2 = mysqli_fetch_array($res2);


echo '<div style="width:80%;margin:auto;padding-top:30px;border:1px solid black;"><h1>Payment Voucher</h1><hr><b>Sno:</b> '.$row['id'].'<hr>';


echo '<span style="font-weight:bold;font-size:1.6em">Amount: '.$row['amount'].'</span> &nbsp;&nbsp; <span style="margin-left:50%"><b>Date:</b> '. $datedisp.'</span><br><hr><h2>Details of Payment</h2><hr><b>Payment Method:</b>&nbsp;&nbsp;'.UCFirst($row['payment_method']).'&nbsp;&nbsp;'.$row['payment_details'].'<hr><b>Paid For:</b> &nbsp;&nbsp; '.UCFirst($row2['work_type']).'<hr><b>Paid To:</b> &nbsp;&nbsp; '.UCFirst($row['name']).'<hr><b>Purpose:</b> &nbsp;&nbsp; '.UCFirst($row['particulars']).'<hr><br><br><bR><span style="margin-left:65%;font-weight:bold;">Signature</span></div>';


