File: //home/cafsindia/refimac_cafsjobs_com/print_amc_service_old_31jul18.php
<?php
include('dbconnect.php');
//session_start();
$report=$_POST['report'];
//echo $report; die;
$amcrepfrmdate=$_POST['amcrepfrmdate'];
$amcreptodate=$_POST['amcreptodate'];
$orderdate = explode('-', $amcrepfrmdate);
$day = $orderdate[0];
$month = $orderdate[1];
$year = $orderdate[2];
//echo $month; die;
$surround_area=$_POST['surround_area'];
$number=$_REQUEST['number'];
$user=$_SESSION['clid'];
$perm=$_SESSION['cper'];
$mid=$_REQUEST['mid'];
$smid=$_REQUEST['smid'];
$pid=$_REQUEST['pid'];
$report_type=$_REQUEST['report_type'];
if($surround_area!="All")
{
$query=" and CUSTOMER_SURROUND_AREA='".$surround_area."'";
}
if($report_type!="all")
{
if($report_type=="warranty")
{
$query.=" and sales.SERVICEMODE_ID='1'";
}
else
{
$query.=" and sales.SERVICEMODE_ID!='1'";
}
}
?>
<?php
if($report=="amc")
{
$sql1="SELECT CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_MOBILE,CUSTOMER_PHONE,CUSTOMER_AREA,purchase.PURCHASE_SERIALNUMBER,MAKE_NAME,MODEL_NAME,LOCATION,CAPACITY,MATURITY_DATE,AMOUNT,SERVICE_MODE_NAME,CUSTOMER_SURROUND_AREA FROM sales inner join customer on sales.CUSTOMER_CODE=customer.CUSTOMER_CODE inner join model on model.MODEL_ID=sales.MODEL_ID inner join purchase on purchase.PURCHASE_ID=sales.PURCHASE_ID INNER JOIN make on make.MAKE_ID=sales.MAKE_ID inner join service_mode on service_mode.SERVICE_MODE_ID=sales.SERVICEMODE_ID where MATURITY_DATE
between '".date('Y-m-d',strtotime($_REQUEST['amcrepfrmdate']))."' and '".date('Y-m-d',strtotime($_REQUEST['amcreptodate']))."' $query order by CUSTOMER_NAME";
//echo $sql1; die;
}
if($report=="service")
{
$sql1="SELECT CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_MOBILE,CUSTOMER_PHONE,CUSTOMER_AREA,MAKE_NAME,MODEL_NAME,LOCATION,CAPACITY,AMOUNT,SERVICE_MODE_NAME,CUSTOMER_SURROUND_AREA,purchase.PURCHASE_SERIALNUMBER,service.COMPLETED,service.MONTH,service.YEAR,sales.SALES_ID FROM sales inner join service on service.SALES_ID=sales.SALES_ID inner join customer on sales.CUSTOMER_CODE=customer.CUSTOMER_CODE inner join purchase on purchase.PURCHASE_ID=sales.PURCHASE_ID inner join model on model.MODEL_ID=sales.MODEL_ID INNER JOIN make on make.MAKE_ID=sales.MAKE_ID inner join service_mode on service_mode.SERVICE_MODE_ID=sales.SERVICEMODE_ID where (service.COMPLETED='N' or service.COMPLETED='0') and service.MONTH like '".$month."' and service.status='0' and service.YEAR like '".$year."' $query order by CUSTOMER_NAME ";
//echo $sql1; die;
}
//echo $sql1; die;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!DOCTYPE html>
<html>
<head>
<title>ANNUAL MAINTENANCE SERVICE SCHEDULE</title>
<link rel="stylesheet" href="assets/bootstrap.min.css">
<style>
.table-bordered>thead>tr>th, .table-bordered>tbody>tr>td{
border: 1px solid #000;
padding: 8px 1px 8px 2px;
}
td {
font-weight: bold;
}
</style>
</head>
<body>
<div class="container">
<table class="table table-bordered" style="text-align: center; padding: 0;" width="800" style="width:800px !important;">
<tbody>
<tr>
<td style="text-align: center; padding:0;">
<h1 style="margin: 0;">Refimac</h1>
</td>
</tr>
<tr>
<?php
if($report=="amc")
{
?>
<td style="text-align: center; padding:0;">
<h2 style="margin: 0;">Final Service List-FromDate:<?php echo $amcrepfrmdate; ?>ToDate:<?php echo $amcreptodate;?>Area:<?php echo $surround_area;?></h2>
</td>
<?php
}
else {
?>
<td style="text-align: center; padding:0;">
<h1 style="margin: 0;">Service Due List- Month:<?php echo $month; ?> Year:<?php echo $year;?>Area:<?php echo $surround_area;?></h1>
</td>
<?php
}
?>
</tr>
</tbody>
</table>
<?php
if($report=="amc")
{
?>
<table class="table table-bordered" >
<tr>
<td ><strong>S.No</strong></td>
<td ><strong>Customer Name with Address</strong></td>
<td ><strong>Make</strong></td>
<td ><strong>TON</strong></td>
<td ><strong>Serial No</strong></td>
<td ><strong>Model</strong></td>
<td ><strong>Service Type</strong></td>
<td ><strong>Due Date</strong></td>
<td ><strong>Amount</strong></td>
<td ><strong>Location</strong></td>
</tr>
<tbody>
<?php
$qu1=mysql_query($sql1);
$i=1;
while($rd=mysql_fetch_array($qu1))
{
?>
<tr>
<td width="40" height="60"><div align="left"><?php echo $i;?></div></td>
<td ><div align="left"><strong><?php echo $rd['CUSTOMER_NAME'];?></strong></br>
<?php echo $rd['CUSTOMER_ADDRESS'];?></br><?php echo $rd['CUSTOMER_AREA'];?></br><?php echo $rd['CUSTOMER_MOBILE'];?></br><?php echo $rd['CUSTOMER_PHONE'];?></div></td>
<td width="97"><div align="left"><?php echo $rd['MAKE_NAME'];?></div></td>
<td width="96"><div align="left"><?php echo $rd['CAPACITY'];?></div></td>
<td width="73"><div align="left"><?php echo $rd['PURCHASE_SERIALNUMBER'];?></div></td>
<td width="52"><div align="left"><?php echo $rd['MODEL_NAME'];?></div></td>
<td width="96"><div align="left"><?php echo $rd['SERVICE_MODE_NAME']; ?></div></td>
<td ><div align="left"><?php echo $rd['MATURITY_DATE']; ?> </div></td>
<td width="48">
<div align="left">
<?php $i++; echo $rd['AMOUNT']; ?>
</div></td>
<td width="80"><div align="left"><?php echo $rd['LOCATION'];?></div></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php }else{ ?>
<table class="table table-bordered" >
<tr>
<td ><strong>S.No</strong></td>
<td ><strong>Customer Name with Address</strong></td>
<td ><strong>Make</strong></td>
<td ><strong>TON</strong></td>
<td ><strong>Serial No</strong></td>
<td ><strong>Model</strong></td>
<td ><strong>Location</strong></td>
<td width="49" ><strong>Service Type</strong></td>
</tr>
<tbody>
<?php
$qu1=mysql_query($sql1);
$i=1;
while($rd=mysql_fetch_array($qu1))
{
?>
<tr>
<td width="33" height="72"><div align="left"><?php echo $i;?></div></td>
<td width="63" ><div align="left"><strong><?php echo $rd['CUSTOMER_NAME'];?></strong></br>
<?php echo $rd['CUSTOMER_ADDRESS'];?></br><?php echo $rd['CUSTOMER_AREA'];?><?php echo $rd['CUSTOMER_MOBILE'];?><?php echo $rd['CUSTOMER_PHONE'];?> </div></td>
<td width="108"><div align="left"><?php echo $rd['MAKE_NAME'];?></div></td>
<td width="85"><div align="left"><?php echo $rd['CAPACITY'];?></div></td>
<td width="130"><div align="left"><?php echo $rd['PURCHASE_SERIALNUMBER'];?></div></td>
<td width="90"><div align="left"><?php echo $rd['MODEL_NAME'];?></div></td>
<td width="116"><div align="left"><?php echo $rd['LOCATION'];?></div></td>
<td>
<div align="left">
<?php $i++; echo $rd['SERVICE_MODE_NAME']; ?>
</div></td>
</tr>
<?php }?>
</tbody>
</table>
<?php } ?>
</body>
</html>
<footer></footer>
</div>
</body>
</html>