File: //home/cafsindia/refimac_cafsjobs_com/ajax/loaddata_13aug2017.php
<?php
include_once('../dbconnect.php');
$pageid=$_REQUEST['pageid'];
$type=$_REQUEST['type'];
$searchby=$_REQUEST['searchby'];
$searchtext=$_REQUEST['searchtext'];
if($pageid=="2_1_1")
{
// Customerview
if($type=="1")
{
?>
<div class="col-md-12">
<h4 class="heading">View / Search / Update Pages </h4>
<table class="table table-striped table-bordered table-hover dt-responsive" style="width:100% !important" id="sample" >
<thead>
<tr>
<th>S.No. </th>
<th>option</th>
<th>Name</th>
<th>Address </th>
<th>Area</th>
<th>Surround Area/City</th>
<th>Phone</th>
<th>Mobile</th>
<th>Contact Person</th>
<th>Pincode</th>
</tr>
</thead>
<tbody>
<?php
// use serial no to get customer code
if($searchby=="SERIALNO")
{
$sqls="SELECT GROUP_CONCAT(distinct(CUSTOMER_code)) as custcode FROM sales inner join purchase on sales.PURCHASE_ID=purchase.PURCHASE_ID where PURCHASE_SERIALNUMBER like '%".$searchtext."%' ORDER BY sales.SALES_ID";
//echo $sqls; die;
$qus=mysql_query($sqls);
$fetch=mysql_fetch_array($qus);
$customer_code=str_replace(',',"','",$fetch['custcode']);
$sql1="select CUSTOMER_code,CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA,CUSTOMER_CITY,CUSTOMER_PINCODE,CUSTOMER_PHONE,CUSTOMER_MOBILE,CUSTOMER_CONTACT_PERSON from customer where CUSTOMER_code in ('".$customer_code."')";
//echo $sql1; die;
}
elseif($searchby=="cust")
{
$sql1="select CUSTOMER_code,CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA,CUSTOMER_CITY,CUSTOMER_PINCODE,CUSTOMER_PHONE,CUSTOMER_MOBILE,CUSTOMER_CONTACT_PERSON from customer where CUSTOMER_code in ('".$searchtext."')";
}
else
{
$sql1="select CUSTOMER_code, CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA,CUSTOMER_CITY,CUSTOMER_PINCODE,CUSTOMER_PHONE,CUSTOMER_MOBILE,CUSTOMER_CONTACT_PERSON from customer where ".$searchby." like '%".$searchtext."%'";
}
//echo $sql1; die;
//$sql1="select CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA from customer limit 1,10";
$qu1=mysql_query($sql1);
$i=1;
while($rd=mysql_fetch_array($qu1))
{
?>
<tr>
<td><?php echo $i;?></td>
<td><a id"viewmachine" alt="<?php echo $rd['CUSTOMER_code'];?>" onclick="viewmachine('<?php echo $rd['CUSTOMER_code'];?>')" title="View Machine"><span class="icon-pencil" style="cursor: pointer;" ></a> <a id"booknew" alt="<?php echo $rd['CUSTOMER_code'];?>" onclick="bookcomplaint('<?php echo $rd['CUSTOMER_code'];?>')"><span class="icon-plus" style="cursor: pointer;" title="Book New Complaint"></a> <a id"viewcomplaints" alt="<?php echo $rd['CUSTOMER_code'];?>" onclick="viewcomplaints('<?php echo $rd['CUSTOMER_code'];?>')"><span class="icon-call-in" style="cursor: pointer;" id"viewcomplaints" alt="<?php echo $rd['CUSTOMER_code'];?>" title="View Complaint History"></a>
<a id"updatecustomer" alt="<?php echo $rd['CUSTOMER_code'];?>" onclick="updatecustomer('<?php echo $rd['CUSTOMER_code'];?>')" title="Update Customer"><span class="icon-clock" style="cursor: pointer;" ></a>
</td>
<td ><?php echo $rd['CUSTOMER_NAME'];?></td>
<td ><?php echo $rd['CUSTOMER_ADDRESS'];?></td>
<td ><?php echo $rd['CUSTOMER_AREA'];?></td>
<td class="center" ><?php echo $rd['CUSTOMER_SURROUND_AREA'].'-'. $rd['CUSTOMER_CITY']; ?></td>
<!--<td class="center" ><?php echo $rd['CUSTOMER_CITY']; ?></td> -->
<td class="center" ><?php echo $rd['CUSTOMER_PHONE']; ?></td>
<td class="center" ><?php echo $rd['CUSTOMER_MOBILE']; ?></td>
<td class="center"><?php echo $rd['CUSTOMER_CONTACT_PERSON']; ?></td>
<td class="center"><?php echo $rd['CUSTOMER_PINCODE']; ?></td>
</tr>
<?php $i++; }?>
</tbody>
</table>
</div>
<?php
}
//addcomplaint
elseif($type=="2")
{
$custcode=$_REQUEST['custcode'];
$serviceno=$_REQUEST['serviceno'];
$salesid=$_REQUEST['salesid'];
$sql_cust="select CUSTOMER_CODE,CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA,CUSTOMER_CITY,CUSTOMER_PINCODE,CUSTOMER_PHONE,CUSTOMER_MOBILE,CUSTOMER_CONTACT_PERSON from customer where CUSTOMER_CODE='".$custcode."'";
//echo $sql_cust; die;
$qu=mysql_query($sql_cust);
$fvc=mysql_fetch_array($qu);
$CUSTOMER_CODE=$custcode;
$CUSTOMER_NAME=$fvc['CUSTOMER_NAME'];
$CUSTOMER_ADDRESS=$fvc['CUSTOMER_ADDRESS'];
$CUSTOMER_AREA=$fvc['CUSTOMER_AREA'];
$CUSTOMER_SURROUND_AREA=$fvc['CUSTOMER_SURROUND_AREA'];
$CUSTOMER_CITY=$fvc['CUSTOMER_CITY'];
$CUSTOMER_PINCODE=$fvc['CUSTOMER_PINCODE'];
$CUSTOMER_PHONE=$fvc['CUSTOMER_PHONE'];
$CUSTOMER_MOBILE=$fvc['CUSTOMER_MOBILE'];
$CUSTOMER_CONTACT_PERSON=$fvc['CUSTOMER_CONTACT_PERSON'];
// sales info
if($salesid!="")
{
$sql_sales="select from sales where SALES_ID='".$salesid."' and CUSTOMER_CODE='".$custcode."'";
//echo $sql_cust; die;
$qusales=mysql_query($sql_sales);
$fvs=mysql_fetch_array($qusales);
$make_id=$fvs['MAKE_ID'];
$salesid=$salesid;
}
?>
<div class="portlet light">
<form id="comp_form" method="post">
<!-- Customer info start-->
<div class="customerinfo">
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label><strong>Customer Info</strong></label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label>Customer Name <span class="f_req">*</span></label>
<input name="CUSTOMER_NAME" type="text" class="form-control" id="CUSTOMER_NAME" value="<?php echo $CUSTOMER_NAME; ?>" />
<input name="CUSTOMER_CODE" type="hidden" class="form-control" id="CUSTOMER_CODE" value="<?php echo $CUSTOMER_CODE; ?>" />
<span class="help-block">Enter customer name </span>
</div>
<div class="col-md-3">
<label>Customer Address <span class="f_req">*</span></label>
<!--<input name="CUSTOMER_ADDRESS" type="text" class="form-control" id="CUSTOMER_ADDRESS" value="<?php echo $CUSTOMER_ADDRESS; ?>" />-->
<textarea name="CUSTOMER_ADDRESS" class="form-control uppercase" id="CUSTOMER_ADDRESS" ><?php echo $CUSTOMER_ADDRESS; ?></textarea>
<span class="help-block">Enter customer Address </span>
</div>
<div class="col-md-3">
<label>Customer Area <span class="f_req">*</span></label>
<input name="CUSTOMER_AREA" type="text" id="CUSTOMER_AREA" class="form-control" value="<?php echo $CUSTOMER_AREA; ?>" />
<!--class="form-control date-picker" data-date-format="dd-mm-yyyy"-->
</div>
<div class="col-md-3">
<label>Surround Area <span class="f_req">*</span></label>
<select name="CUSTOMER_SURROUND_AREA" class="form-control select2 col-md-12" id="cust_area" style="max-height:400px;" >
<option value="">Select</option>
<?php
$sql="select area_name from area where area_update=1";
$qu=mysql_query($sql);
while($r=mysql_fetch_array($qu))
{
?>
<option <?php if($CUSTOMER_SURROUND_AREA==$r['area_name']) echo "selected='selected'";?> value="<?php echo $r['area_name'];?>"><?php echo $r['area_name'];?></option>
<?php }?>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label>City<span class="f_req">*</span></label>
<input name="CUSTOMER_CITY" type="text" class="form-control" id="CUSTOMER_CITY" value="<?php echo $CUSTOMER_CITY; ?>" />
<span class="help-block">Enter city </span>
</div>
<div class="col-md-3">
<label>Customer Pincode <span class="f_req">*</span></label>
<input name="CUSTOMER_PINCODE" type="text" class="form-control" id="CUSTOMER_PINCODE" value="<?php echo $CUSTOMER_PINCODE; ?>" />
</div>
<div class="col-md-3">
<label>Phone <span class="f_req">*</span></label>
<input name="CUSTOMER_PHONE" type="text" class="form-control" id="CUSTOMER_PHONE" value="<?php echo $CUSTOMER_PHONE; ?>" />
</div>
<div class="col-md-3">
<label>Mobile<span class="f_req">*</span></label>
<input name="CUSTOMER_MOBILE" type="text" class="form-control" id="CUSTOMER_MOBILE" value="<?php echo $CUSTOMER_MOBILE; ?>" />
<!--class="form-control date-picker" data-date-format="dd-mm-yyyy"-->
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label>Contact Person<span class="f_req">*</span></label>
<input name="CUSTOMER_CONTACT_PERSON" type="text" class="form-control" id="CUSTOMER_CONTACT_PERSON" value="<?php echo $CUSTOMER_CONTACT_PERSON; ?>" />
</div>
</div>
</div>
</div>
<div class="complaintinfo">
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label><strong>Complaint Info</strong></label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label>Call Type <span class="f_req">*</span></label>
<select name="call_type" class="form-control select2 col-md-12" id="call_type" style="max-height:400px;" >
<option value="">Select</option>
<option value="Installation">Installation</option>
<option value="Re-Installation">Re-Installation</option>
<option value="Breakdown">Breakdown</option>
<option value="AMC">AMC</option>
<option value="PMS">PMS</option>
</select>
<span class="help-block">Select call type</span>
</div>
<div class="col-md-3">
<label>Brand <span class="f_req">*</span></label>
<select name="brand_name" class="form-control select2 col-md-12" id="brand_name" style="max-height:400px;" >
<option value="">Select</option>
<?php
$sql="select make_name,make_id from make";
$qu=mysql_query($sql);
while($r=mysql_fetch_array($qu))
{
?>
<option <?php if($make_id==$r['make_id']) echo "selected='selected'";?> value="<?php echo $r['make_id'];?>"><?php echo $r['make_name'];?></option>
<?php }?>
</select>
<span class="help-block">Select brand name</span>
</div>
<div class="col-md-3">
<label>Product <span class="f_req">*</span></label>
<select name="cust_product" class="form-control select2" id="cust_product" style="max-height:400px;" >
<option value="">Select</option>
<?php
$sql="select product_id,product_name from serviceapp_product where status=1";
$qu=mysql_query($sql);
while($r=mysql_fetch_array($qu))
{
?>
<option <?php if($product_id==$r['product_id']) echo "selected='selected'";?> value="<?php echo $r['product_id'];?>"><?php echo $r['product_name'];?></option>
<?php }?>
</select>
<!--class="form-control date-picker" data-date-format="dd-mm-yyyy"-->
</div>
<div class="col-md-3">
<label>Fault Reported <span class="f_req">*</span></label>
<input name="fault_report" type="text" class="form-control " id="fault_report" />
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label>Machine Location<span class="f_req">*</span></label>
<input name="location" type="text" class="form-control" id="location" />
<span class="help-block">Enter Machine Location </span>
</div>
<div class="col-md-3">
<label>Service Requested Date <span class="f_req">*</span></label>
<div class="input-group input-medium date date-picker" data-date-format="dd-mm-yyyy" data-date-start-date="+0d">
<input name="service_req_datetime" type="text" class="form-control" id="service_req_datetime" data-date-format="dd-mm-yyyy" />
</div>
<span class="help-block">Enter Service Requested Date </span>
</div>
<div class="col-md-3">
<label>Technecian <span class="f_req">*</span></label>
<select name="tech_name" class="form-control select2" id="tech_name" style="max-height:400px;" >
<option value="">Select</option>
<?php
$sql="select EMP_ID,EMP_NAME from employee where EMP_UPDATE=1";
$qu=mysql_query($sql);
while($r=mysql_fetch_array($qu))
{
?>
<option <?php if($EMP_ID==$r['EMP_ID']) echo "selected='selected'";?> value="<?php echo $r['EMP_ID'];?>"><?php echo $r['EMP_NAME'];?></option>
<?php }?>
</select>
</div>
<div class="col-md-3">
<label>Remarks<span class="f_req">*</span></label>
<textarea name="comp_remarks" class="form-control" id="comp_remarks"></textarea>
</div>
</div>
</div>
</div>
<div class="form-actions">
<div class="row">
<div class="col-md-offset-3 col-md-9">
<button type="submit" class="btn green" onclick="addcomplaint()">Submit</button>
<button type="button" class="btn dark btn-outline" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</form>
</div>
<?php
}
// machineview
elseif($type=="3")
{
$custcode=$_REQUEST['custcode'];
?>
<div class="col-md-12">
<div id="serviceinfo" style="display:none;height:300px; overflow:scroll;"></div>
<div id="addnewmachine" style="display:none;height:350px; overflow:scroll;"></div>
<div id="servicecompletion" style="display:none;height:300px; overflow:scroll;"></div>
<h4 class="heading">View / Search Machine </h4> <button id="addnewmachine" class="btn red" onclick="addnewmachine('','<?php echo $custcode;?>')">Add New Machine</button>
<table class="table table-striped table-bordered table-hover dt-responsive" style="width:100% !important;overflow: scroll;" id="viewmachineinfo" >
<thead>
<tr>
<th>S.No.</th>
<th>option</th>
<th>Mac.Status</th>
<th>Name</th>
<th>Make</th>
<th>Model No.</th>
<th>Serial No.</th>
<th>Servicemode</th>
<th>Installation Date</th>
<th>Maturity date</th>
<th>Amount</th>
<th>Capacity</th>
<th>Compressor No</th>
<th>Invoice date</th>
<th>Remarks</th>
<th>Sales Customer/Dealer Name</th>
</tr>
</thead>
<tbody>
<?php
$sql1="SELECT *,(SELECT MAKE_NAME FROM `make` where MAKE_ID=sales.MAKE_ID) as MAKE_NAME ,(SELECT MODEL_NAME FROM `model` where MODEL_ID=sales.MODEL_ID) as model_name ,(select SERVICE_MODE_NAME FROM service_mode where service_mode.SERVICE_MODE_ID=sales.SERVICEMODE_ID) as SERVICEMODENAME ,(select PURCHASE_SERIALNUMBER FROM purchase where purchase.PURCHASE_ID=sales.PURCHASE_ID order by SALES_ID limit 0,1) as SERIALNO,(select client_name FROM purchase where purchase.PURCHASE_ID=sales.PURCHASE_ID order by SALES_ID limit 0,1) as client_name from sales inner join customer on sales.CUSTOMER_CODE=customer.CUSTOMER_CODE where customer.CUSTOMER_CODE='".$custcode."'";
//echo "SELECT *,(SELECT MAKE_NAME FROM `make` where MAKE_ID=sales.MAKE_ID) as MAKE_NAME ,(SELECT MODEL_NAME FROM `model` where MODEL_ID=sales.MODEL_ID) as model_name ,(select SERVICE_MODE_NAME FROM service_mode where service_mode.SERVICE_MODE_ID=sales.SERVICEMODE_ID) as SERVICEMODENAME ,(select PURCHASE_SERIALNUMBER FROM purchase where purchase.PURCHASE_ID=sales.PURCHASE_ID order by SALES_ID limit 0,1) as SERIALNO,(select client_name FROM purchase where purchase.PURCHASE_ID=sales.PURCHASE_ID order by SALES_ID limit 0,1) as client_name from sales inner join customer on sales.CUSTOMER_CODE=customer.CUSTOMER_CODE where customer.CUSTOMER_CODE='".$custcode."'";
//echo $sql1; die;
//$sql1="select CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA from customer limit 1,10";
$qu1=mysql_query($sql1);
$i=1;
while($rd=mysql_fetch_array($qu1))
{
?>
<tr>
<td><?php echo $i;?></td>
<td><a id"viewserviceinfo" alt="<?php echo $rd['SALES_ID'];?>" onclick="viewserviceinfo('<?php echo $rd['SALES_ID'];?>','<?php echo $rd['CUSTOMER_CODE'];?>')" title="View Service Info"><span class="icon-pencil" style="cursor: pointer;" ></a> <a id"booknew" alt="<?php echo $rd['CUSTOMER_CODE'];?>" onclick="bookcomplaintwithservice('<?php echo $rd['CUSTOMER_CODE'];?>','<?php echo $rd['SALES_ID']; ?>','<?php echo "0";?>')"><span class="icon-plus" style="cursor: pointer;" title="Book New Complaint"></a> <!--<a><span class="icon-call-in" style="cursor: pointer;" id"viewmachine" alt="<?php echo $rd['CUSTOMER_CODE'];?>" title="View Complaint History"></a> --><a id"updatemachine" alt="<?php echo $rd['SALES_ID'];?>" onclick="addnewmachine('<?php echo $rd['SALES_ID'];?>','<?php echo $rd['CUSTOMER_CODE'];?>')" title="View/ modify Mac. Info"><span class="icon-pencil" style="cursor: pointer;" ></a> <a id"deletemac" alt="<?php echo $rd['CUSTOMER_CODE'];?>" onclick="deletemachine('<?php echo $rd['SALES_ID'];?>','<?php echo $rd['CUSTOMER_CODE'];?>')"><span class="icon-trash" style="cursor: pointer;" title="Inactive Machine"></a> </td>
<td ><?php if($rd['status']=="0") echo "Active"; else echo "In-Active";?></td>
<td ><?php echo $rd['CUSTOMER_NAME'];?></td>
<td ><?php echo $rd['MAKE_NAME'];?></td>
<td ><?php echo $rd['model_name'];?></td>
<td ><?php echo $rd['SERIALNO'];?></td>
<td class="center" ><?php echo $rd['SERVICEMODENAME']; ?></td>
<td ><?php echo $rd['INSTALLATION_DATE'];?></td>
<td class="center" ><?php echo $rd['MATURITY_DATE']; ?></td>
<td class="center" ><?php echo $rd['AMOUNT']; ?></td>
<td class="center"><?php echo $rd['CAPACITY']; ?></td>
<td ><?php echo $rd['COMPRESSORNO'];?></td>
<td class="center" ><?php echo $rd['INVOICE_DATE']; ?></td>
<td class="center" ><?php echo $rd['REMARKS']; ?></td>
<td class="center" ><?php echo $rd['client_name']; ?></td>
</tr>
<?php $i++; }?>
</tbody>
</table>
</div>
<?php
}
//service informtion
elseif($type=="4")
{
$salesid=$_REQUEST['salesid'];
$custcode=$_REQUEST['custcode'];
?>
<button class="btn red" id="hideservice" onclick="hideservice()">Hide Service (-)</button></br>
<div class="col-md-12">
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label>Service Date</label>
<input name="mac_addservicedate" type="text" class="form-control" id="mac_addservicedate" value="" data-date-format="dd-mm-yyyy"/>
</div>
<div class="col-md-3">
</br>
<input class="btn red" id="hidaddnewservice" onclick="hidaddnewservice(<?php echo $salesid; ?>)" value="Add New Service" >
</div>
</div>
</div>
</br>
<table class="table table-striped table-bordered table-hover dt-responsive" style="width:100% !important" id="viewserviceinfo" >
<thead>
<tr>
<th>S.No.</th>
<th>option</th>
<th>Serial No.</th>
<th>Employee Name</th>
<th>Slip No.</th>
<th>Date</th>
<th>Month</th>
<th>Year</th>
<th>Service No</th>
<th>Service Status</th>
<th>Service Report</th>
</tr>
</thead>
<tbody>
<?php
$sql1="SELECT *,(select EMP_NAME from employee where employee.EMP_ID=service.EMPLOYEE_ID) as EMP_NAME FROM `service` WHERE `SALES_ID` = '".$salesid."' and status=0";
//echo $sql1; die;
//$sql1="select CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA from customer limit 1,10";
$qu1=mysql_query($sql1);
$i=1;
while($rd=mysql_fetch_array($qu1))
{
?>
<tr>
<td><?php echo $i;?></td>
<td><?php if($rd['COMPLETED']=='Y' && $_SESSION['cper']=='admin') { ?> <a id"booknew" alt="<?php echo $rd['CUSTOMER_CODE'];?>" onclick="bookcomplaintwithservice('<?php echo $custcode; ?>','<?php echo $salesid;?>','<?php echo $rd['LIST_INDEX'] ?>')"><span class="icon-plus" style="cursor: pointer;" title="Book New Complaint"></a> <?php } else { ?><a id"booknew" alt="<?php echo $rd['CUSTOMER_CODE'];?>" onclick="bookcomplaintwithservice('<?php echo $custcode; ?>','<?php echo $salesid;?>','<?php echo $rd['LIST_INDEX'] ?>')"><span class="icon-plus" style="cursor: pointer;" title="Book New Complaint"></a> <?php }?>
<?php if($rd['COMPLETED']=='Y' && $_SESSION['cper']=='admin') {?> <a id"updateservicecomplete" alt="<?php echo $rd['CUSTOMER_CODE'];?>" onclick="updateservicecomplete('<?php echo $custcode; ?>','<?php echo $salesid;?>','<?php echo $rd['LIST_INDEX'] ?>','<?php echo $rd['MONTH'] ?>','<?php echo $rd['YEAR'] ?>')"><span class="icon-pencil" style="cursor: pointer;" title="Update Service Completion"></a> <?php } else { ?><a id"updateservicecomplete" alt="<?php echo $rd['CUSTOMER_CODE'];?>" onclick="updateservicecomplete('<?php echo $custcode; ?>','<?php echo $salesid;?>','<?php echo $rd['LIST_INDEX'] ?>','<?php echo $rd['MONTH'] ?>','<?php echo $rd['YEAR'] ?>')"><span class="icon-pencil" style="cursor: pointer;" title="Update Service Completion"></a><?php }?>
<?php if($per=='') { ?>
<a id"deleteservice" alt="<?php echo $rd['CUSTOMER_CODE'];?>" onclick="deletewithservice('<?php echo $custcode; ?>','<?php echo $salesid;?>','<?php echo $rd['MONTH'] ?>','<?php echo $rd['YEAR'] ?>','<?php echo $rd['servicedate'] ?>')"><span class="icon-trash" style="cursor: pointer;" title="Delete a Service"></a>
<?php }?>
</td>
<td ><?php echo $rd['SERIALNO'];?></td>
<td ><?php echo $rd['EMP_NAME'];?></td>
<td ><?php echo $rd['SLIPNO'];?></td>
<td class="center" ><?php echo $rd['DATE']; ?></td>
<td class="center" ><?php echo $rd['MONTH']; ?></td>
<td class="center" ><?php echo $rd['YEAR']; ?></td>
<td class="center"><?php echo $rd['LIST_INDEX']; ?></td>
<td class="center"><?php if($rd['COMPLETED']=='Y') echo "completed"; else echo "Upcoming/Pending"; ?></td>
<td><a href="<?php echo $rd['servicefileupload']; ?>" id"servicereport" target="_blank" title="View Service Report">View Report</a></td>
</tr>
<?php $i++; }?>
</tbody>
</table>
</div>
<?php
}
// complaint information
elseif($type=="5")
{
$custcode=$_REQUEST['custcode'];
?>
<div class="col-md-12">
<table class="table table-striped table-bordered table-hover dt-responsive" style="width:80% !important" id="viewtablecomplaintinfo" >
<thead>
<tr>
<th>S.No.</th>
<th>option</th>
<th>Complaint No</th>
<th>Complaint Date & Time</th>
<th>Customer Name</th>
<th>Phone No.</th>
<th>Mobile No.</th>
<th>Call Type</th>
<th>Brand Name</th>
<th>Product</th>
<th>Service Requested Date & Time</th>
<th>Fault Report</th>
<th>Tech. Name</th>
<th>View Service</th>
</tr>
</thead>
<tbody>
<?php
$sql1="SELECT reg_id,cust_code,CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA,CUSTOMER_CITY,CUSTOMER_PINCODE,CUSTOMER_PHONE,CUSTOMER_MOBILE,CUSTOMER_CONTACT_PERSON,complaint_no,complaint_date,complaint_time,call_type,(select MAKE_NAME from make where MAKE_ID=serviceapp_callreg.brand_name) as brand_name,(select product_name from serviceapp_product where product_id=serviceapp_callreg.product) as product ,fault_report,location,service_req_datetime,(select EMP_NAME from employee where EMP_ID=serviceapp_callreg.tech_name) as tech_name,remarks,status FROM `serviceapp_callreg` WHERE `cust_code` = '".$custcode."' and status!='5' ";
//$sql1="select CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA from customer limit 1,10";
$qu1=mysql_query($sql1);
$i=1;
while($rd=mysql_fetch_array($qu1))
{
?>
<tr>
<td><?php echo $i;?></td>
<td>
<?php if($rd['status']!=2){ ?>
<a id"addcomplaint" alt="<?php echo $rd['CUSTOMER_code'];?>" onclick="editcomplaint('<?php echo $rd['complaint_no'];?>')" title="Update Comlaint Information"><span class="icon-pencil" style="cursor: pointer;" ></a> <?php } ?></td>
<td ><?php echo $rd['complaint_no'];?></td>
<td ><?php echo $rd['complaint_date'].' '.$rd['complaint_time'];?></td>
<td ><?php echo $rd['CUSTOMER_NAME'];?></td>
<td class="center" ><?php echo $rd['CUSTOMER_PHONE']; ?></td>
<td class="center" ><?php echo $rd['CUSTOMER_MOBILE']; ?></td>
<td class="center"><?php echo $rd['call_type']; ?></td>
<td class="center"><?php echo $rd['brand_name']; ?></td>
<td class="center"><?php echo $rd['product']; ?></td>
<td class="center"><?php echo $rd['service_req_datetime']; ?></td>
<td class="center"><?php echo $rd['fault_report']; ?></td>
<td class="center"><?php echo $rd['tech_name']; ?></td>
<?php if($rd['call_type']=="Installation"){?>
<td><a href="print_call_installation.php?number=<?php echo $rd['complaint_no']; ?>" id"servicereport" target="_blank" title="View Service Report">View Report</a></td>
<?php } else { ?>
<td><a href="print_call.php?number=<?php echo $rd['complaint_no']; ?>" id"servicereport" target="_blank" title="View Service Report">View Report</a></td>
<?php } ?>
</tr>
<?php $i++; }?>
</tbody>
</table>
</div>
<?php
}
// Add New Machine
elseif($type=="6")
{
$custcode=$_REQUEST['custcode'];
$serviceno=$_REQUEST['serviceno'];
$salesid=$_REQUEST['salesid'];
$sql_cust="select CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA,CUSTOMER_CITY,CUSTOMER_PINCODE,CUSTOMER_PHONE,CUSTOMER_MOBILE,CUSTOMER_CONTACT_PERSON from customer where CUSTOMER_CODE='".$custcode."'";
//echo $sql_cust; die;
$qu=mysql_query($sql_cust);
$fvc=mysql_fetch_array($qu);
$CUSTOMER_CODE=$custcode;
$CUSTOMER_NAME=$fvc['CUSTOMER_NAME'];
$CUSTOMER_ADDRESS=$fvc['CUSTOMER_ADDRESS'];
$CUSTOMER_AREA=$fvc['CUSTOMER_AREA'];
$CUSTOMER_SURROUND_AREA=$fvc['CUSTOMER_SURROUND_AREA'];
$CUSTOMER_CITY=$fvc['CUSTOMER_CITY'];
$CUSTOMER_PINCODE=$fvc['CUSTOMER_PINCODE'];
$CUSTOMER_PHONE=$fvc['CUSTOMER_PHONE'];
$CUSTOMER_MOBILE=$fvc['CUSTOMER_MOBILE'];
$CUSTOMER_CONTACT_PERSON=$fvc['CUSTOMER_CONTACT_PERSON'];
// sales info
if($salesid!="")
{
$sql_sales="select *,(select PURCHASE_SERIALNUMBER from purchase where PURCHASE_ID=sales.PURCHASE_ID) as PURCHASE_SERIALNUMBER ,(select PURCHASE_DATE from purchase where PURCHASE_ID=sales.PURCHASE_ID) as PURCHASE_DATE ,(select PURCHASE_INVOICENUMBER from purchase where PURCHASE_ID=sales.PURCHASE_ID) as PURCHASE_INVOICENUMBER,(select MODEL_NAME from model where MODEL_ID=sales.MODEL_ID) as MODEL_NAME from sales where SALES_ID='".$salesid."' and CUSTOMER_CODE='".$custcode."'";
//echo $sql_sales; die;
$qusales=mysql_query($sql_sales);
$fvs=mysql_fetch_array($qusales);
$make_id=$fvs['MAKE_ID'];
$salesid=$salesid;
}
?>
<div class="portlet light">
<input class="btn red" id="hideaddnew" onclick="hideaddnewmac()" value="Hide Add New Machine (-)" >
</br>
<form id="add_mac_form" method="post">
<!-- Customer info start-->
<div class="customerinfo">
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label><strong>Machine Details</strong></label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
</div>
<table class="table table-striped table-bordered table-hover dt-responsive" style="width:100% !important" id="sample" >
<thead>
<tr>
<th>Serial No.</th>
<th>Make</th>
<th>Model</th>
<th>Service Mode</th>
<th>Capacity</th>
<th>wrty</th>
<th>Comp wrty</th>
<th>Location</th>
<th>Service Per Year</th>
</tr>
</thead>
<tbody>
<?php
// use serial no to get customer code
/*if($searchby=="SERIALNO")
{
$sqls="SELECT GROUP_CONCAT(distinct(CUSTOMER_code)) as custcode FROM sales inner join service on service.SALES_ID=sales.SALES_ID where SERIALNO like '%".$searchtext."%' ORDER BY sales.SALES_ID";
//echo $sqls; die;
$qus=mysql_query($sqls);
$fetch=mysql_fetch_array($qus);
$customer_code=str_replace(',',"','",$fetch['custcode']);
$sql1="select CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA,CUSTOMER_CITY,CUSTOMER_PINCODE,CUSTOMER_PHONE,CUSTOMER_MOBILE,CUSTOMER_CONTACT_PERSON from customer where CUSTOMER_code in ('".$customer_code."')";
//echo $sql1; die;
}
else
{
$sql1="select CUSTOMER_code, CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA,CUSTOMER_CITY,CUSTOMER_PINCODE,CUSTOMER_PHONE,CUSTOMER_MOBILE,CUSTOMER_CONTACT_PERSON from customer where ".$searchby." like '%".$searchtext."%'";
}
//echo $sql1; die;
//$sql1="select CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA from customer limit 1,10";
$qu1=mysql_query($sql1);
$i=1;
while($rd=mysql_fetch_array($qu1))
{*/
?>
<tr>
<td><input name="mac_serialno" type="text" class="form-control" id="mac_serialno" value="<?php echo $fvs['PURCHASE_SERIALNUMBER'];?>" onKeyPress="getmachine(event)"/></td>
<td><select name="mac_brand_name" class="form-control select2 col-md-12" id="mac_brand_name" onchange="getmodel()">
<option value="">Select</option>
<?php
$sql="select make_name,make_id from make";
$qu=mysql_query($sql);
while($r=mysql_fetch_array($qu))
{
?>
<option <?php if($fvs['MAKE_ID']==$r['make_id']) echo "selected='selected'";?> value="<?php echo $r['make_id'];?>"><?php echo $r['make_name'];?></option>
<?php }?>
</select>
</td>
<td ><div id="mac_model_val"><?php echo $fvs['MODEL_NAME']; ?></div></td>
<input type="hidden" name="mac_model_id" id="mac_model_id" value="<?php echo $fvs['MODEL_ID'];?>" />
<input type="hidden" name="PURCHASE_ID" id="PURCHASE_ID" value="<?php echo $fvs['PURCHASE_ID'];?>" />
<input type="hidden" name="sales_ID" id="sales_ID" value="<?php echo $salesid; ?>" />
<input type="hidden" name="custcode" id="custcode" value="<?php echo $_REQUEST['custcode']; ?>" />
<td ><select name="mac_service_mode" class="form-control select2 col-md-12" id="mac_service_mode" >
<option value="">Select</option>
<?php
$sql="select SERVICE_MODE_ID,SERVICE_MODE_NAME from service_mode";
$qu=mysql_query($sql);
while($r=mysql_fetch_array($qu))
{
?>
<option <?php if($r['SERVICE_MODE_ID']==$fvs['SERVICEMODE_ID']) echo "selected='selected'";?> value="<?php echo $r['SERVICE_MODE_ID'];?>"><?php echo $r['SERVICE_MODE_NAME'];?></option>
<?php }?>
</select></td>
<td ><input name="mac_capacity" type="text" class="form-control" id="mac_capacity" value="<?php echo $fvs['CAPACITY']; ?>" /></td>
<td class="center" >
<select name="mac_wrty" class="form-control select2 col-md-12" id="mac_wrty" >
<option <?php if($fvs['mac_wryt']=="1" || $fvs['mac_wryt']=="") echo "selected='selected'";?> value="1">1 Year</option>
<option <?php if($fvs['mac_wryt']=="2") echo "selected='selected'";?> value="2">2 Years</option>
<option <?php if($fvs['mac_wryt']=="3") echo "selected='selected'";?>value="3">3 Years</option>
<option <?php if($fvs['mac_wryt']=="4") echo "selected='selected'";?> value="4">4 Years</option>
<option <?php if($fvs['mac_wryt']=="5") echo "selected='selected'";?> value="5">5 Years</option>
<option <?php if($fvs['mac_wryt']=="6") echo "selected='selected'";?> value="6">6 Years</option>
<option <?php if($fvs['mac_wryt']=="7") echo "selected='selected'";?> value="7">7 Years</option>
<option <?php if($fvs['mac_wryt']=="8") echo "selected='selected'";?> value="8">8 Years</option>
<option <?php if($fvs['mac_wryt']=="9") echo "selected='selected'";?> value="9">9 Years</option>
<option <?php if($fvs['mac_wryt']=="10") echo "selected='selected'";?> value="10">10 Years</option>
<option <?php if($fvs['mac_wryt']=="11") echo "selected='selected'";?> value="11">11 Years</option>
<option <?php if($fvs['mac_wryt']=="12") echo "selected='selected'";?> value="12">12 Years</option>
</select>
<!--<input name="mac_wrty" type="text" class="form-control" id="mac_wrty" value="<?php if($fvs['mac_wryt']!="") echo $fvs['mac_wryt']; else echo '1'; ?>" />--></td>
<td class="center" ><input name="comp_wrty" type="text" class="form-control" id="comp_wrty" value="<?php echo $fvs['comp_wrty']; ?>" /></td>
<td class="center" ><input name="mac_location" type="text" class="form-control" id="mac_location" value="<?php echo $fvs['LOCATION']; ?>"/></td>
<td class="center" ><input name="mac_service_year" type="text" class="form-control" id="mac_service_year" value="<?php echo $fvs['NO_OF_SERVICES']; ?>" /></td>
</tr>
<?php /*$i++; }*/?>
</tbody>
</table>
<div id="purchseandsalesinfo">
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label><strong>Sales Details</strong></label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
</div>
<table class="table table-striped table-bordered table-hover dt-responsive" style="width:100% !important" id="sample" >
<thead>
<tr>
<th>Invoice Number</th>
<th>Invoice Date</th>
<th>Compressor No.</th>
<th>Purchase Bill No. </th>
<th>Purchase Bill Date</th>
<th>Installation/AMC Date</th>
<th>Maturity Date</th>
<th>Amount</th>
<th>Remarks</th>
</tr>
</thead>
<tbody>
<?php
// use serial no to get customer code
/* if($searchby=="SERIALNO")
{
$sqls="SELECT GROUP_CONCAT(distinct(CUSTOMER_code)) as custcode FROM sales inner join service on service.SALES_ID=sales.SALES_ID where SERIALNO like '%".$searchtext."%' ORDER BY sales.SALES_ID";
//echo $sqls; die;
$qus=mysql_query($sqls);
$fetch=mysql_fetch_array($qus);
$customer_code=str_replace(',',"','",$fetch['custcode']);
$sql1="select CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA,CUSTOMER_CITY,CUSTOMER_PINCODE,CUSTOMER_PHONE,CUSTOMER_MOBILE,CUSTOMER_CONTACT_PERSON from customer where CUSTOMER_code in ('".$customer_code."')";
//echo $sql1; die;
}
else
{
$sql1="select CUSTOMER_code, CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA,CUSTOMER_CITY,CUSTOMER_PINCODE,CUSTOMER_PHONE,CUSTOMER_MOBILE,CUSTOMER_CONTACT_PERSON from customer where ".$searchby." like '%".$searchtext."%'";
}
//echo $sql1; die;
//$sql1="select CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA from customer limit 1,10";
$qu1=mysql_query($sql1);
$i=1;
while($rd=mysql_fetch_array($qu1))
{*/
?>
<tr>
<td><input name="mac_invoice_no" type="text" class="form-control" id="mac_invoice_no" value="<?php echo $fvs['INVOICE_NO']; ?>"/></td>
<td><input name="mac_invoice_date" type="text" class="form-control" id="mac_invoice_date" data-date-format="dd-mm-yyyy" value="<?php if($fvs['INVOICE_DATE']!="") echo date("d-m-Y", strtotime($fvs['INVOICE_DATE'])); else {echo "";} ?>"/></td>
<td><input name="mac_compressor_sno" type="text" class="form-control" id="mac_compressor_sno" value="<?php echo $fvs['COMPRESSORNO']; ?>"/></td>
<td><input name="mac_purchase_billno" type="text" class="form-control" id="mac_purchase_billno" value="<?php echo $fvs['PURCHASE_INVOICENUMBER']; ?>" /></td>
<td><input name="mac_purchase_billdate" type="text" class="form-control" id="mac_purchase_billdate" data-date-format="dd-mm-yyyy" value="<?php if($fvs['PURCHASE_DATE']!="") { echo date("d-m-Y", strtotime($fvs['PURCHASE_DATE']));} else {echo "";} ?>"/></td>
<td><input name="mac_installdate" type="text" class="form-control" id="mac_installdate" data-date-format="dd-mm-yyyy" onchange="calcuatewrty()" onblur="calcuatewrty()" value="<?php if($fvs['INSTALLATION_DATE']!="") {echo date("d-m-Y", strtotime($fvs['INSTALLATION_DATE']));} else { echo ""; } ?>" /></td>
<td><input name="mac_maturitydate" type="text" class="form-control" id="mac_maturitydate" value="<?php if(strtotime($fvs['MATURITY_DATE'])!=""){ echo date("d-m-Y", strtotime($fvs['MATURITY_DATE'])); } else { echo "";}?>"/></td>
<td><input name="mac_amount" type="text" class="form-control" id="mac_amount" value="<?php echo $fvs['AMOUNT']; ?>"/></td>
<td><input name="mac_remarks" type="text" class="form-control" id="mac_remarks" value="<?php echo $fvs['REMARKS']; ?>"/></td>
</tr>
<?php/* $i++; }*/?>
</tbody>
</table>
</div>
</div>
<div class="form-actions">
<div class="row">
<div class="col-md-offset-3 col-md-9">
<button type="submit" class="btn green" onclick="savemachineinfo()">Submit</button>
</div>
<div class="col-md-offset-3 col-md-9">
<span id="machineadd_success"></span>
</div>
</div>
</div>
</form>
</div>
<?php
}
// get model using brandname
elseif($type=="7")
{
$macbrandname=$_REQUEST['macbrandname'];
?>
<select name="mac_model" class="form-control select2 col-md-12" id="mac_model" >
<option value="">Select</option>
<?php
$sql="select MODEL_ID,MODEL_NAME from model where MAKE_ID='".$macbrandname."'";
$qu=mysql_query($sql);
while($r=mysql_fetch_array($qu))
{
?>
<option <?php if($MODEL_ID==$r['MODEL_ID']) echo "selected='selected'";?> value="<?php echo $r['MODEL_ID'];?>"><?php echo $r['MODEL_NAME'];?></option>
<?php }?>
</select>
<?php
}
// Update complaint information
elseif($type=="8")
{
$complaintno=$_REQUEST['complaintno'];
$sql1="SELECT reg_id,cust_code,CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA,CUSTOMER_CITY,CUSTOMER_PINCODE,CUSTOMER_PHONE,CUSTOMER_MOBILE,CUSTOMER_CONTACT_PERSON,complaint_no,complaint_date,complaint_time,call_type,brand_name,product,fault_report,location,service_req_datetime,tech_name,remarks FROM `serviceapp_callreg` WHERE complaint_no = '".$complaintno."' and status!='2' ";
//echo $sql1;
//$sql1="select CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA from customer limit 1,10";
$qu1=mysql_query($sql1);
$i=1;
$rd=mysql_fetch_array($qu1);
?>
<div class="portlet light">
<form id="cust_form_update" method="post">
<!-- Customer info start-->
<div class="customerinfo">
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label><strong>Customer Info</strong></label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label>Customer Name <span class="f_req">*</span></label>
<input name="CUSTOMER_NAME" type="text" class="form-control" id="CUSTOMER_NAME" value="<?php echo $rd['CUSTOMER_NAME']; ?>" />
<input name="complaint_no" type="hidden" class="form-control" id="complaint_no" value="<?php echo $rd['complaint_no']; ?>" />
<input name="CUSTOMER_CODE" type="hidden" class="form-control" id="CUSTOMER_CODE" value="<?php echo $rd['CUSTOMER_CODE']; ?>" />
<span class="help-block">Enter customer name </span>
</div>
<div class="col-md-3">
<label>Customer Address <span class="f_req">*</span></label>
<input name="CUSTOMER_ADDRESS" type="text" class="form-control" id="CUSTOMER_ADDRESS" value="<?php echo $rd['CUSTOMER_ADDRESS']; ?>" />
<span class="help-block">Enter customer Address </span>
</div>
<div class="col-md-3">
<label>Customer Area <span class="f_req">*</span></label>
<input name="CUSTOMER_AREA" type="text" id="CUSTOMER_AREA" class="form-control" value="<?php echo $rd['CUSTOMER_AREA']; ?>" />
<!--class="form-control date-picker" data-date-format="dd-mm-yyyy"-->
</div>
<div class="col-md-3">
<label>Surround Area <span class="f_req">*</span></label>
<select name="CUSTOMER_SURROUND_AREA" class="form-control select2 col-md-12" id="cust_area" style="max-height:400px;" >
<option value="">Select</option>
<?php
$sql="select area_name from area where area_update=1";
$qu=mysql_query($sql);
while($r=mysql_fetch_array($qu))
{
?>
<option <?php if($rd['CUSTOMER_SURROUND_AREA']==$r['area_name']) echo "selected='selected'";?> value="<?php echo $r['area_name'];?>"><?php echo $r['area_name'];?></option>
<?php }?>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label>City<span class="f_req">*</span></label>
<input name="CUSTOMER_CITY" type="text" class="form-control" id="CUSTOMER_CITY" value="<?php echo $rd['CUSTOMER_NAME']; ?>" />
<span class="help-block">Enter city </span>
</div>
<div class="col-md-3">
<label>Customer Pincode <span class="f_req">*</span></label>
<input name="CUSTOMER_PINCODE" type="text" class="form-control" id="CUSTOMER_PINCODE" value="<?php echo $rd['CUSTOMER_NAME']; ?>" />
</div>
<div class="col-md-3">
<label>Phone <span class="f_req">*</span></label>
<input name="CUSTOMER_PHONE" type="text" class="form-control" id="CUSTOMER_PHONE" value="<?php echo $rd['CUSTOMER_PHONE']; ?>" />
</div>
<div class="col-md-3">
<label>Mobile<span class="f_req">*</span></label>
<input name="CUSTOMER_MOBILE" type="text" class="form-control" id="CUSTOMER_MOBILE" value="<?php echo $rd['CUSTOMER_MOBILE']; ?>" />
<!--class="form-control date-picker" data-date-format="dd-mm-yyyy"-->
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label>Contact Person<span class="f_req">*</span></label>
<input name="CUSTOMER_CONTACT_PERSON" type="text" class="form-control" id="CUSTOMER_CONTACT_PERSON" value="<?php echo $rd['CUSTOMER_CONTACT_PERSON']; ?>" />
</div>
</div>
</div>
</div>
<div class="complaintinfo">
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label><strong>Complaint Info</strong></label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label>Call Type <span class="f_req">*</span></label>
<select name="call_type" class="form-control select2 col-md-12" id="call_type" style="max-height:400px;" >
<option value="">Select</option>
<option value="Installation" <?php if($rd['call_type']=="Installation") echo "selected='selected'";?>>Installation</option>
<option value="Re-Installation" <?php if($rd['call_type']=="Re-Installation") echo "selected='selected'";?>>Re-Installation</option>
<option value="Breakdown" <?php if($rd['call_type']=="Breakdown") echo "selected='selected'";?>>Breakdown</option>
<option value="AMC" <?php if($rd['call_type']=="AMC") echo "selected='selected'";?>>AMC</option>
<option value="PMS" <?php if($rd['call_type']=="PMS") echo "selected='selected'";?>>PMS</option>
</select>
<span class="help-block">Select call type</span>
</div>
<div class="col-md-3">
<label>Brand <span class="f_req">*</span></label>
<select name="brand_name" class="form-control select2 col-md-12" id="brand_name" style="max-height:400px;" >
<option value="">Select</option>
<?php
$sql="select make_name,make_id from make";
$qu=mysql_query($sql);
while($r=mysql_fetch_array($qu))
{
?>
<option <?php if($rd['brand_name']==$r['make_id']) echo "selected='selected'";?> value="<?php echo $r['make_id'];?>"><?php echo $r['make_name'];?></option>
<?php }?>
</select>
<span class="help-block">Select brand name</span>
</div>
<div class="col-md-3">
<label>Product <span class="f_req">*</span></label>
<select name="cust_product" class="form-control select2" id="cust_product" style="max-height:400px;" >
<option value="">Select</option>
<?php
$sql="select product_id,product_name from serviceapp_product where status=1";
$qu=mysql_query($sql);
while($r=mysql_fetch_array($qu))
{
?>
<option <?php if($rd['cust_product']==$r['product_id']) echo "selected='selected'";?> value="<?php echo $rd['product_id'];?>"><?php echo $r['product_name'];?></option>
<?php }?>
</select>
<!--class="form-control date-picker" data-date-format="dd-mm-yyyy"-->
</div>
<div class="col-md-3">
<label>Fault Reported <span class="f_req">*</span></label>
<input name="fault_report" type="text" class="form-control " id="fault_report" value="<?php echo $rd['fault_report'];?>" />
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label>Machine Location<span class="f_req">*</span></label>
<input name="location" type="text" class="form-control" id="location" value="<?php echo $rd['location'];?>" />
<span class="help-block">Enter Machine Location </span>
</div>
<div class="col-md-3">
<label>Service Requested Date <span class="f_req">*</span></label>
<div class="input-group input-medium date date-picker" data-date-format="dd-mm-yyyy" data-date-start-date="+0d">
<input name="service_req_datetime" type="text" class="form-control" id="service_req_datetime" data-date-format="dd-mm-yyyy" value="<?php echo $rd['service_req_datetime'];?>" />
</div>
<span class="help-block">Enter Service Requested Date </span>
</div>
<div class="col-md-3">
<label>Technecian <span class="f_req">*</span></label>
<select name="tech_name" class="form-control select2" id="tech_name" style="max-height:400px;" >
<option value="">Select</option>
<?php
$sql="select EMP_ID,EMP_NAME from employee where EMP_UPDATE=1";
$qu=mysql_query($sql);
while($r=mysql_fetch_array($qu))
{
?>
<option <?php if($rd['tech_name']==$r['EMP_ID']) echo "selected='selected'";?> value="<?php echo $r['EMP_ID'];?>"><?php echo $r['EMP_NAME'];?></option>
<?php }?>
</select>
</div>
<div class="col-md-3">
<label>Remarks<span class="f_req">*</span></label>
<textarea name="comp_remarks" class="form-control" id="comp_remarks" > <?php echo $rd['remarks'];?> </textarea>
</div>
</div>
</div>
</div>
<div class="form-actions">
<div class="row">
<div class="col-md-offset-3 col-md-9">
<button type="submit" class="btn green" onclick="updatecomplaint()">Submit</button>
<button type="button" class="btn dark btn-outline" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</form>
</div>
<?php
}
// Add New Machine
elseif($type=="9")
{
$custcode=$_REQUEST['custcode'];
//$serviceno=$_REQUEST['serviceno'];
//$salesid=$_REQUEST['salesid'];
$sql_cust="select CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA,CUSTOMER_CITY,CUSTOMER_PINCODE,CUSTOMER_PHONE,CUSTOMER_MOBILE,CUSTOMER_CONTACT_PERSON from customer where CUSTOMER_CODE='".$custcode."'";
//echo $sql_cust; die;
$qu=mysql_query($sql_cust);
$fvc=mysql_fetch_array($qu);
$CUSTOMER_CODE=$custcode;
$CUSTOMER_NAME=$fvc['CUSTOMER_NAME'];
$CUSTOMER_ADDRESS=$fvc['CUSTOMER_ADDRESS'];
$CUSTOMER_AREA=$fvc['CUSTOMER_AREA'];
$area_name=$fvc['CUSTOMER_SURROUND_AREA'];
$CUSTOMER_CITY=$fvc['CUSTOMER_CITY'];
$CUSTOMER_PINCODE=$fvc['CUSTOMER_PINCODE'];
$CUSTOMER_PHONE=$fvc['CUSTOMER_PHONE'];
$CUSTOMER_MOBILE=$fvc['CUSTOMER_MOBILE'];
$CUSTOMER_CONTACT_PERSON=$fvc['CUSTOMER_CONTACT_PERSON'];
?>
<div class="modal-body"><div class="portlet light">
<form id="cust_form_update" method="post">
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label>Customer Name <span class="f_req">*</span></label>
<input name="CUSTOMER_NAME" type="text" class="form-control uppercase" id="CUSTOMER_NAME" value="<?php echo $CUSTOMER_NAME;?>" />
<input name="CUSTOMER_CODE" type="hidden" class="form-control uppercase" id="CUSTOMER_CODE" value="<?php echo $CUSTOMER_CODE; ?>" />
<span class="help-block">Enter customer name </span>
</div>
<div class="col-md-3">
<label>Customer Address <span class="f_req">*</span></label>
<input name="CUSTOMER_ADDRESS" type="text" class="form-control uppercase" id="CUSTOMER_ADDRESS" value="<?php echo $CUSTOMER_ADDRESS; ?>" />
<span class="help-block">Enter customer Address </span>
</div>
<div class="col-md-3">
<label>Customer Area <span class="f_req">*</span></label>
<input name="CUSTOMER_AREA" type="text" id="CUSTOMER_AREA" class="form-control uppercase" value="<?php echo $CUSTOMER_AREA; ?>" />
<!--class="form-control date-picker" data-date-format="dd-mm-yyyy"-->
</div>
<div class="col-md-3">
<label>Surround Area <span class="f_req">*</span></label>
<select name="CUSTOMER_SURROUND_AREA" class="form-control select2 uppercase" id="CUSTOMER_SURROUND_AREA" style="max-height:400px;" >
<option value="">Select</option>
<?php
$sql="select area_name from area where area_update=1";
$qu=mysql_query($sql);
while($r=mysql_fetch_array($qu))
{
?>
<option <?php if($area_name==$r['area_name']) echo "selected='selected'";?> value="<?php echo $r['area_name'];?>"><?php echo $r['area_name'];?></option>
<?php }?>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label>City<span class="f_req">*</span></label>
<input name="CUSTOMER_CITY" type="text" class="form-control uppercase" id="CUSTOMER_CITY" value="<?php echo $CUSTOMER_CITY; ?>" />
<span class="help-block">Enter city </span>
</div>
<div class="col-md-3">
<label>Customer Pincode <span class="f_req">*</span></label>
<input name="CUSTOMER_PINCODE" type="text" class="form-control uppercase" id="CUSTOMER_PINCODE" value="<?php echo $CUSTOMER_PINCODE; ?>" />
</div>
<div class="col-md-3">
<label>Phone <span class="f_req">*</span></label>
<input name="CUSTOMER_PHONE" type="text" class="form-control uppercase" id="CUSTOMER_PHONE" value="<?php echo $CUSTOMER_PHONE; ?>" />
</div>
<div class="col-md-3">
<label>Mobile<span class="f_req">*</span></label>
<input name="CUSTOMER_MOBILE" type="text" class="form-control uppercase" id="CUSTOMER_MOBILE" value="<?php echo $CUSTOMER_MOBILE; ?>" />
<!--class="form-control date-picker" data-date-format="dd-mm-yyyy"-->
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label>Contact Person<span class="f_req">*</span></label>
<input name="CUSTOMER_CONTACT_PERSON" type="text" class="form-control uppercase" id="CUSTOMER_CONTACT_PERSON" value="<?php echo $CUSTOMER_CONTACT_PERSON; ?>" />
<input type="checkbox" id="samename" name="samename" class="samename" /> Same the customer name
</div>
</div>
</div>
</br>
</br>
<div class="form-actions">
<div class="row">
<div class="col-md-offset-3 col-md-9">
<button type="submit" class="btn green" onclick="addupdatecustomer()">Submit</button>
<button type="button" class="btn dark btn-outline" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</form>
</div> </div>
<?php
}
// service search result
elseif($type=="10")
{
$month=$_REQUEST['month'];
$option=$_REQUEST['filter'];
$surround_area=$_REQUEST['surround_area'];
//$custcode=$_REQUEST['todate'];
$mymavl=explode('-',$month);
if($surround_area!="" && $surround_area!="All")
$query="and CUSTOMER_SURROUND_AREA='".$surround_area."'";
?>
<div class="col-md-12">
<table class="table table-striped table-bordered table-hover dt-responsive" style="width:100% !important" id="viewservicedetails" >
<thead>
<tr>
<th>S.No.</th>
<th>option</th>
<th>Name</th>
<th>Address </th>
<th>Area</th>
<th>Surround Area/City</th>
<th>Phone</th>
<th>Mobile</th>
<th>Contact Person</th>
<?php if($option=="Group Service"){?> <th>Mac. Count</th> <?php }?>
<th>Service Status</th>
<!--<th>Contact Person</th>-->
</tr>
</thead>
<tbody>
<?php
if($option=="Machine Wise")
{
$sql1="SELECT customer.CUSTOMER_NAME,customer.CUSTOMER_ADDRESS,customer.CUSTOMER_AREA,customer.CUSTOMER_SURROUND_AREA,customer.CUSTOMER_CITY,customer.CUSTOMER_PINCODE,customer.CUSTOMER_PHONE,customer.CUSTOMER_MOBILE,customer.CUSTOMER_CONTACT_PERSON,service.SERIALNO,sales.SALES_ID as sales_all_id,(select SERVICE_MODE_NAME FROM service_mode where service_mode.SERVICE_MODE_ID=sales.SERVICEMODE_ID) as SERVICEMODENAME ,(select PURCHASE_SERIALNUMBER FROM purchase where purchase.PURCHASE_ID=sales.PURCHASE_ID order by sales.SALES_ID limit 0,1) as SERIALNO,service.COMPLETED,service.LIST_INDEX FROM `service` inner join sales on sales.SALES_ID=service.SALES_ID inner join customer on customer.CUSTOMER_CODE=sales.CUSTOMER_CODE where month='".$mymavl[0]."' and year='".$mymavl[1]."' $query order by customer.CUSTOMER_NAME";
}
if($option=="Group Service")
{
$sql1="SELECT customer.CUSTOMER_NAME,customer.CUSTOMER_ADDRESS,customer.CUSTOMER_AREA,customer.CUSTOMER_SURROUND_AREA,customer.CUSTOMER_CITY,customer.CUSTOMER_PINCODE,customer.CUSTOMER_PHONE,customer.CUSTOMER_MOBILE,customer.CUSTOMER_CONTACT_PERSON,service.SERIALNO,sales.SALES_ID,(select SERVICE_MODE_NAME FROM service_mode where service_mode.SERVICE_MODE_ID=sales.SERVICEMODE_ID) as SERVICEMODENAME ,(select PURCHASE_SERIALNUMBER FROM purchase where purchase.PURCHASE_ID=sales.PURCHASE_ID order by sales.SALES_ID limit 0,1) as SERIALNO,GROUP_CONCAT(distinct(sales.SALES_ID)) as sales_all_id,count(distinct(sales.SALES_ID)) as mac_count,service.COMPLETED,service.LIST_INDEX FROM `service` inner join sales on sales.SALES_ID=service.SALES_ID inner join customer on customer.CUSTOMER_CODE=sales.CUSTOMER_CODE where month='".$mymavl[0]."' and year='".$mymavl[1]."' $query group by sales.CUSTOMER_CODE order by customer.CUSTOMER_NAME";
}
//echo $sql1; die;
//$sql1="select CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA from customer limit 1,10";
$qu1=mysql_query($sql1);
$i=1;
while($rd=mysql_fetch_array($qu1))
{
?>
<tr>
<td><?php echo $i;?></td>
<td><a href="print_call_service.php?number=<?php echo $rd['sales_all_id']; ?>" id"servicereport" target="_blank" title="View Service Report">View Report</a></td>
<td ><?php echo $rd['CUSTOMER_NAME'];?></td>
<td ><?php echo $rd['CUSTOMER_ADDRESS'];?></td>
<td ><?php echo $rd['CUSTOMER_AREA'];?></td>
<td class="center" ><?php echo $rd['CUSTOMER_SURROUND_AREA'].'-'. $rd['CUSTOMER_CITY']; ?></td>
<!--<td class="center" ><?php echo $rd['CUSTOMER_CITY']; ?></td> -->
<td class="center" ><?php echo $rd['CUSTOMER_PHONE']; ?></td>
<td class="center" ><?php echo $rd['CUSTOMER_MOBILE']; ?></td>
<td class="center"><?php echo $rd['CUSTOMER_CONTACT_PERSON']; ?></td>
<?php if($option=="Group Service") {?> <td class="center"><?php echo $rd['mac_count']; ?></td><?php }?>
<td class="center"><?php if($rd['COMPLETED']=='Y') echo "completed"; else echo "Upcoming/Pending"; ?></td>
</tr>
<?php $i++; $result.= $rd['sales_all_id']. '^';}
?>
</tbody>
</table>
<form id="sampleid" method="post" target="_blank" action="print_call_service.php?number=1">
<input type="hidden" value="<?php echo $result; ?>" name="hiddennvalue" id="hiddennvalue" />
<input type="submit" id="printsubmit" class="btn green" value="Print All">
</form>
</div>
<?php
}
//show machine info
elseif($type=="11")
{
$serialno=$_REQUEST['serialno'];
?>
<div class="col-md-12">
<table class="table table-striped table-bordered table-hover dt-responsive" style="width:100% !important" id="viewserialdetails" >
<thead>
<tr>
<th>Make</th>
<th>Model</th>
<th>Purchase Date </th>
<th>Purchase Bill No.</th>
<th>Invoice No</th>
<th>Invoice Date</th>
<th>Customer/Dealer Name</th>
<th>Bind Data</th>
</tr>
</thead>
<tbody>
<?php
$remove[] = "`";
$sql1="SELECT PURCHASE_INVOICENUMBER,PURCHASE_DATE,PURCHASE_SERIALNUMBER,PURCHASE_ID,(SELECT MODEL_NAME FROM `model` where MODEL_ID=purchase.PURCHASE_MODEL_ID) as MODEL_NAME,(SELECT MAKE_NAME FROM `make` where MAKE_ID=(SELECT MAKE_ID FROM `model` where MODEL_ID=purchase.PURCHASE_MODEL_ID)) as MAKE_NAME,(SELECT MAKE_ID FROM `model` where MODEL_ID=purchase.PURCHASE_MODEL_ID) as MAKE_ID ,sales_invoiceno,sales_date,client_name,PURCHASE_MODEL_ID,PURCHASE_DISPLAY FROM purchase where PURCHASE_SERIALNUMBER='".str_replace( $remove, "", trim($serialno))."'";
//echo $sql1; die;
//$sql1="select CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA from customer limit 1,10";
$qu1=mysql_query($sql1);
$i=1;
$row=mysql_num_rows($qu1);
$rd=mysql_fetch_array($qu1);
if($rd['PURCHASE_DISPLAY'] == 0 && $rd['PURCHASE_DISPLAY'] != '')
{
?>
<tr>
<td><?php echo $rd['MAKE_NAME'];?></td>
<td ><?php echo $rd['MODEL_NAME'];?></td>
<td ><?php echo date('d-m-Y',strtotime($rd['PURCHASE_DATE']));?></td>
<td ><?php echo $rd['PURCHASE_INVOICENUMBER'];?></td>
<td class="center" ><?php echo $rd['sales_invoiceno']; ?></td>
<td class="center" ><?php echo str_replace('/','-',$rd['sales_date']); ?></td>
<td class="center" ><?php echo $rd['client_name']; ?></td>
<td class="center" ><input type="button" class="btn red fetchmachineinfoval" onclick="fetchmachineinfo()" alt="<?php echo $serialno.'^'.$rd['MAKE_NAME'].'^'.$rd['MODEL_NAME'].'^'.date('d-m-Y',strtotime($rd['PURCHASE_DATE'])).'^'.$rd['PURCHASE_INVOICENUMBER'].'^'.$rd['sales_invoiceno'].'^'.str_replace('/','-',$rd['sales_date']).'^'.$rd['MAKE_ID'].'^'.$rd['PURCHASE_ID'].'^'.$rd['PURCHASE_MODEL_ID']?>" value="FetchData" /></td>
</tr>
<?php
}
else
{
$sql1="SELECT CUSTOMER_CODE FROM sales WHERE PURCHASE_ID='".$rd['PURCHASE_ID']."'";
//echo $sql1; die;
//$sql1="select CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA from customer limit 1,10";
$qu1=mysql_query($sql1);
$rd_cust=mysql_fetch_array($qu1);
?>
<tr>
<?php if($rd_cust['CUSTOMER_CODE']!="")
{?>
<td colspan="8"><?php echo "<strong>Machine Allready sold by Customer Code-----</strong>".$rd_cust['CUSTOMER_CODE']; ?></td>
<?php } else { ?>
<td colspan="8"><?php echo "<strong>Please eneter the valid serial no. or if machine is sold by someone please use the refimac serial no.</strong>"; ?></td>
<?php } ?>
</tr>
<?php }?>
</tbody>
</table>
</div>
<?php
}
elseif($type=="12")
{
$StaringDate=$_REQUEST["mac_installdate"];
$mac_wrty=$_REQUEST["mac_wrty"];
$addyear=" + ".$mac_wrty."year";
$newEndingDate = date("d-m-Y", strtotime(date("Y-m-d", strtotime($StaringDate)) . $addyear));
echo $newEndingDate;
}
elseif($type=="13")
{
$custcode=$_REQUEST['custcode'];
$salesid=$_REQUEST['salesid'];
$month=$_REQUEST['month'];
$date=$_REQUEST['date'];
?>
<button class="btn red" id="hidemaccompletion" onclick="hidemaccompletion()">Hide Service Completion (-)</button></br>
<div class="col-md-12">
<form id="frmservicecompletion" method="post" enctype="multipart/form-data">
<table class="table table-striped table-bordered table-hover dt-responsive" style="width:100% !important" id="viewmachinecompletion" >
<thead>
<tr>
<th>SERIAL NO.</th>
<th>EMPLOYEE NAME</th>
<th>SLIP NO.</th>
<th>DATE of Completion</th>
<th>COMMENTS</th>
<th>Upload Service Report</th>
</tr>
</thead>
<tbody>
<?php
$sql="select purchase.PURCHASE_SERIALNUMBER,service.EMPLOYEE_ID,service.SLIPNO,service.COMMENTS,service.servicefileupload,service.servicedate,service.DATE from service inner join sales on service.SALES_ID = sales.SALES_ID inner join purchase on purchase.PURCHASE_ID=sales.PURCHASE_ID where sales.SALES_ID='".$salesid."' and service.YEAR='".$date."' and service.MONTH='".$month."'";
// echo $sql;
$qu=mysql_query($sql);
$r=mysql_fetch_array($qu);
?>
<tr>
<td>
<input name="mac_serial_no" type="text" class="form-control" id="mac_serial_no" value="<?php echo $r['PURCHASE_SERIALNUMBER']; ?>"/>
<input type="hidden" id="txtservicecust" name="txtservicecust" value="<?php echo $custcode;?>" id="txtservicecust" />
<input type="hidden" id="txtservicesalesid" name="txtservicesalesid" value="<?php echo $salesid;?>" id="txtservicesalesid" />
<input type="hidden" id="txtservicemonth"name="txtservicemonth" value="<?php echo $month;?>" id="txtservicemonth" />
<input type="hidden" id="txtservicedate" name="txtservicedate" value="<?php echo $date;?>" id="txtservicedate" />
<input type="hidden" value="<?php echo $date;?>" id="servicefilepath" name="servicefilepath" />
</td>
<td>
<select name="tech_name" class="form-control select2" id="tech_name" style="max-height:400px;" >
<option value="">Select</option>
<?php
$sql="select EMP_ID,EMP_NAME from employee where EMP_UPDATE=1";
$qu=mysql_query($sql);
while($r1=mysql_fetch_array($qu))
{
?>
<option <?php if($r['EMPLOYEE_ID']==$r1['EMP_ID']) echo "selected='selected'";?> value="<?php echo $r1['EMP_ID'];?>"><?php echo $r1['EMP_NAME'];?></option>
<?php }?>
</select>
</td>
<td ><input name="slip_no" type="text" class="form-control" id="slip_no" value="<?php echo $r['SLIPNO']; ?>"/></td>
<td class="center" ><input name="dateofcompletion" type="text" class="form-control" id="dateofcompletion" data-date-format="dd-mm-yyyy" value="<?php echo date("d-m-Y", strtotime($r['DATE'])); ?>"/></td>
<td class="center" ><input name="COMMENTS" type="text" class="form-control" id="COMMENTS" value="<?php echo $r['COMMENTS']; ?>"/></td>
<td class="center" ><input type="file" id="file" name="file" onchange="uploadservice()" />
<a href="<?php echo $r['servicefileupload']; ?>" target="_blank" >Previous Uploaded File</a>
<span id="servicereport" style="display:none">Please wait......!</span>
</td>
</tr>
</tbody>
</table>
<div class="form-actions">
<div class="row">
<div class="col-md-offset-3 col-md-9">
<?php /*?><?php if( $r['COMPLETED']=="Y" && $_SESSION['cper']=="admin") {?><?php */?>
<button type="submit" class="btn green" onclick="updatemachinecompletion()">Submit</button>
<?php /*?> <?php } else if( $r['COMPLETED']!="Y") {?>
<button type="submit" class="btn green" onclick="updatemachinecompletion()">Submit</button>
<?php }?>
<?php */?>
</div>
<div class="col-md-offset-3 col-md-9">
<span id="machineadd_success"></span>
</div>
</div>
</div>
</form>
</div>
<?php
}
}
if($pageid=="2_1_3")
{
if($type=="1")
{
$sqlcust="SELECT reg_id,cust_code,call_type FROM `serviceapp_callreg` WHERE `complaint_no` = '".$searchtext."'";
$qucust=mysql_query($sqlcust);
$rdcust=mysql_fetch_array($qucust);
$cust_code=$rdcust['cust_code'];
$reg_id=$rdcust['reg_id'];
$call_type1=$rdcust['call_type'];
$sqlcomp="select comp_id,call_type,mac_id,acc_frm_dealer,acc_frm_cust,acc_frm_refimac,acc_frm_techtaken,acc_frm_grandtotal,spar_coper_pipe,spare_stand,spare_gas,call_status,pending_reason,visit_date_time,completion_date_time,service_report_upload,invoice_upload,complaint_remarks from serviceapp_callcomp where reg_id='".$reg_id."'";
$qucomp=mysql_query($sqlcomp);
$rdcomp=mysql_fetch_array($qucomp);
$comp_id=$rdcomp['comp_id'];
$call_type=$rdcomp['call_type'];
$mac_id=$rdcomp['mac_id'];
$acc_frm_dealer=$rdcomp['acc_frm_dealer'];
$acc_frm_cust=$rdcomp['acc_frm_cust'];
$acc_frm_refimac=$rdcomp['acc_frm_refimac'];
$acc_frm_techtaken=$rdcomp['acc_frm_techtaken'];
$acc_frm_grandtotal=$rdcomp['acc_frm_grandtotal'];
$spar_coper_pipe=$rdcomp['spar_coper_pipe'];
$spare_stand=$rdcomp['spare_stand'];
$spare_gas=$rdcomp['spare_gas'];
$call_status=$rdcomp['call_status'];
$pending_reason=$rdcomp['pending_reason'];
$visit_date_time=$rdcomp['visit_date_time'];
$completion_date_time=$rdcomp['completion_date_time'];
$service_report_upload=$rdcomp['service_report_upload'];
$invoice_upload=$rdcomp['invoice_upload'];
$complaint_remarks=$rdcomp['complaint_remarks'];
if($call_type=="")
{
$call_type=$call_type1;
}
?>
<!--Customer info-->
<div id="complaint_cust_info">
<strong> Customer Info. </strong>
<div class="col-md-12">
<input type="hidden" id="custcode" name="custcode" value="<?php echo $cust_code;?>" />
<input type="hidden" id="reg_id" name="reg_id" value="<?php echo $reg_id;?>" />
<input type="hidden" id="comp_id" name="comp_id" value="<?php echo $comp_id;?>" />
<input type="hidden" id="hid_mac_id" name="hid_mac_id" value="<?php echo $mac_id;?>" />
<table class="table table-striped table-bordered table-hover dt-responsive" style="width:100% !important" id="sample" >
<thead>
<tr>
<th>S.No. </th>
<th>option</th>
<th>Name</th>
<th>Address </th>
<th>Area</th>
<th>Surround Area/City</th>
<th>Phone</th>
<th>Mobile</th>
<th>Contact Person</th>
<th>Pincode</th>
</tr>
</thead>
<tbody>
<?php
$sql1="select CUSTOMER_code, CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA,CUSTOMER_CITY,CUSTOMER_PINCODE,CUSTOMER_PHONE,CUSTOMER_MOBILE,CUSTOMER_CONTACT_PERSON from customer WHERE `CUSTOMER_code` = '".$cust_code."'";
//echo $sql1; die;
//$sql1="select CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA from customer limit 1,10";
$qu1=mysql_query($sql1);
$i=1;
while($rd=mysql_fetch_array($qu1))
{
?>
<tr>
<td><?php echo $i;?>
</td>
<td>
<a id"updatecustomer" alt="<?php echo $rd['cust_code'];?>" onclick="updatecustomer('<?php echo $rd['CUSTOMER_code'];?>')" title="Update Customer"><span class="icon-clock" style="cursor: pointer;" ></a>
</td>
<td ><?php echo $rd['CUSTOMER_NAME'];?></td>
<td ><?php echo $rd['CUSTOMER_ADDRESS'];?></td>
<td ><?php echo $rd['CUSTOMER_AREA'];?></td>
<td class="center" ><?php echo $rd['CUSTOMER_SURROUND_AREA'].'-'. $rd['CUSTOMER_CITY']; ?></td>
<!--<td class="center" ><?php echo $rd['CUSTOMER_CITY']; ?></td> -->
<td class="center" ><?php echo $rd['CUSTOMER_PHONE']; ?></td>
<td class="center" ><?php echo $rd['CUSTOMER_MOBILE']; ?></td>
<td class="center"><?php echo $rd['CUSTOMER_CONTACT_PERSON']; ?></td>
<td class="center"><?php echo $rd['CUSTOMER_PINCODE']; ?></td>
</tr>
<?php $i++; }?>
</tbody>
</table>
</div>
</div>
<!--Complaint info-->
<div id="complaintinfo">
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label>Call Type <span class="f_req">*</span></label>
<select name="call_type" class="form-control select2 col-md-12" id="call_type" style="max-height:400px;" >
<option value="" <?php if($call_type=="") echo "selected='selected'";?>>Select</option>
<option value="Installation" <?php if($call_type=="Installation") echo "selected='selected'";?>>Installation</option>
<option value="Re-Installation" <?php if($rd['call_type']=="Re-Installation") echo "selected='selected'";?>>Re-Installation</option>
<option value="Breakdown" <?php if($call_type=="Breakdown") echo "selected='selected'";?>>Breakdown</option>
<option value="AMC" <?php if($call_type=="AMC") echo "selected='selected'";?>>AMC</option>
<option value="PMS" <?php if($call_type=="PMS") echo "selected='selected'";?>>PMS</option>
</select>
<span class="help-block">Select call type</span>
</div>
</div>
</div>
</div>
<div id="complaint_machineinfo">
<div class="col-md-12">
<div id="serviceinfo" style="display:none;height:300px; overflow:scroll;"></div>
<div id="addnewmachine" style="display:none;height:400px;"></div>
<div id="servicecomplete" style="display:none;height:300px; overflow:scroll;"></div>
<strong>Machine Info. </strong>
<input type="button" id="search" class="btn blue" value="Add New Machine" id="addnewmachine" class="btn red" onclick="addnewmachine('','<?php echo $cust_code;?>')">
</br>
</br>
<table class="table table-striped table-bordered table-hover dt-responsive" style="width:100% !important" id="viewmachineinfo" >
<thead>
<tr>
<th>Select</th>
<th>Name</th>
<th>Serial No.</th>
<th>Compressor No</th>
<th>Installation Date</th>
<th>Maturity date</th>
<th>Invoice date</th>
<th>Servicemode</th>
<th>Capacity</th>
</tr>
</thead>
<tbody>
<?php
$sql1="SELECT *,(select SERVICE_MODE_NAME FROM service_mode where service_mode.SERVICE_MODE_ID=sales.SERVICEMODE_ID) as SERVICEMODENAME ,(select PURCHASE_SERIALNUMBER FROM purchase where purchase.PURCHASE_ID=sales.PURCHASE_ID order by SALES_ID limit 0,1) as SERIALNO from sales inner join customer on sales.CUSTOMER_CODE=customer.CUSTOMER_CODE where customer.CUSTOMER_CODE='".$cust_code."'";
//echo $sql1;
//$sql1="select CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA from customer limit 1,10";
$qu1=mysql_query($sql1);
$i=1;
while($rd=mysql_fetch_array($qu1))
{
?>
<tr>
<td><input type="radio" name="selectsaleid" id="selectsaleid" <?php if($mac_id==$rd['SALES_ID']) echo "checked='checked'" ?> value="<?php echo $rd['SALES_ID'];?>"/> </td>
<!--<td><a id"viewserviceinfo" alt="<?php echo $rd['SALES_ID'];?>" onclick="viewserviceinfo('<?php echo $rd['SALES_ID'];?>','<?php echo $rd['CUSTOMER_CODE'];?>')" title="View Service Info"><span class="icon-pencil" style="cursor: pointer;" ></a> <a id"booknew" alt="<?php echo $rd['CUSTOMER_CODE'];?>" onclick="bookcomplaintwithservice('<?php echo $rd['CUSTOMER_CODE'];?>','<?php echo $rd['SALES_ID']; ?>','<?php echo "0";?>')"><span class="icon-plus" style="cursor: pointer;" title="Book New Complaint"></a> <a><span class="icon-call-in" style="cursor: pointer;" id"viewmachine" alt="<?php echo $rd['CUSTOMER_CODE'];?>" title="View Complaint History"></a></td>-->
<td ><?php echo $rd['CUSTOMER_NAME'];?></td>
<td ><?php echo $rd['SERIALNO'];?></td>
<td ><?php echo $rd['COMPRESSORNO'];?></td>
<td ><?php echo $rd['INSTALLATION_DATE'];?></td>
<td class="center" ><?php echo $rd['MATURITY_DATE']; ?></td>
<td class="center" data-date-format="dd-mm-yyyy" ><?php echo $rd['INVOICE_DATE']; ?></td>
<td class="center" ><?php echo $rd['SERVICEMODENAME']; ?></td>
<td class="center"><?php echo $rd['CAPACITY']; ?></td>
</tr>
<?php $i++; }?>
</tbody>
</table>
</div>
</div>
<div id="complaint_amount_info">
<strong>Amount Info</strong>
<div class="row">
<div class="col-md-12">
<div class="col-md-2">
<label>Recived from dealer <span class="f_req">*</span></label>
<input name="amtfromdealer" type="number" class="form-control uppercase" id="amtfromdealer" value="<?php echo $acc_frm_dealer;?>" />
<span class="help-block">Enter Amount recived from dealer</span>
</div>
<div class="col-md-2">
<label>Recived from customer <span class="f_req">*</span></label>
<input name="amtfromcustomer" type="number" class="form-control uppercase" id="amtfromcustomer" value="<?php echo $acc_frm_cust;?>" />
<span class="help-block">Enter Amount Recived from customer</span>
</div>
<div class="col-md-2">
<label>Recived from Refimac <span class="f_req">*</span></label>
<input name="amtfromrefmimac" type="number" class="form-control uppercase" id="amtfromrefmimac" value="<?php echo $acc_frm_refimac;?>"/>
<span class="help-block">Enter Amount Recived from Refimac</span>
</div>
<div class="col-md-2">
<label>Technician Taken <span class="f_req">*</span></label>
<input name="amttakentech" type="number" class="form-control uppercase" id="amttakentech" value="<?php echo $acc_frm_techtaken;?>"/>
<span class="help-block">Enter Technician Taken Amount</span>
</div>
<div class="col-md-2">
<label>Grand Total <span class="f_req">*</span></label>
<input name="grandtotal" type="number" class="form-control uppercase" id="grandtotal" value="<?php echo $acc_frm_grandtotal;?>" />
</div>
</div>
</div>
</div>
<div id="complaint_spare_info">
<strong>Spare Info</strong>
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label>Coper pipe (meeter) <span class="f_req">*</span></label>
<input name="spar_coper_pipe" type="text" class="form-control uppercase" id="spar_coper_pipe" value="<?php echo $spar_coper_pipe;?>" />
<span class="help-block">Enter Coper pipe (meeter)</span>
</div>
<div class="col-md-3">
<label>Stand (qty) <span class="f_req">*</span></label>
<input name="spare_stand" type="number" class="form-control uppercase" id="spare_stand" value="<?php echo $spare_stand;?>" />
<span class="help-block">Enter Amount Recived from customer</span>
</div>
<div class="col-md-3">
<label>GAS<span class="f_req"></span></label>
<select name="spare_gas" class="form-control select2 col-md-12" id="spare_gas" style="max-height:400px;" >
<option value="" <?php if($spare_gas=="") echo "selected='selected'";?>>Select</option>
<option value="YES" <?php if($spare_gas=="YES") echo "selected='selected'";?>>YES</option>
<option value="NO" <?php if($spare_gas=="NO") echo "selected='selected'";?>>NO</option>
</select>
<span class="help-block">Select GAS Status</span>
</div>
</div>
</div>
</div>
<div id="complaint_call_closure_info">
<strong>Call Closure Info.</strong>
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label>Call Status<span class="f_req">*</span></label>
<select name="call_status" class="form-control select2 col-md-12" id="call_status" style="max-height:400px;" >
<option value="" <?php if($call_status=="") echo "selected='selected'";?>>Select</option>
<option value="completed" <?php if($call_status=="completed") echo "selected='selected'";?>>Completed</option>
<option value="pending" <?php if($call_status=="pending") echo "selected='selected'";?>>Pending</option>
<option value="canceled" <?php if($call_status=="canceled") echo "selected='selected'";?>>Canceled</option>
</select>
<span class="help-block">Select Call Status</span>
</div>
<div class="col-md-3">
<label>Pending Reason<span class="f_req">*</span></label>
<select name="pending_reason" class="form-control select2 col-md-12" id="pending_reason">
<option value="" <?php if($pending_reason=="") echo "selected='selected'";?>>Select Pending Reason</option>
<option value="Customer Appointment" <?php if($pending_reason=="Customer Appointment") echo "selected='selected'";?>>Customer Appointment</option>
<option value="Part Pending" <?php if($pending_reason=="Part Pending") echo "selected='selected'";?>>Part Pending</option>
<option value="M/C Delivery Pending" <?php if($pending_reason=="M/C Delivery Pending") echo "selected='selected'";?>>M/C Delivery Pending</option>
<option value="Door Locked / Address Not Clear" <?php if($pending_reason=="Door Locked / Address Not Clear") echo "selected='selected'";?>>Door Locked / Address Not Clear</option>
<option value="Technical Support Required" <?php if($pending_reason=="Technical Support Required") echo "selected='selected'";?>>Technical Support Required</option>
<option value="Customer Payment Pending" <?php if($pending_reason=="Customer Payment Pending") echo "selected='selected'";?>>Customer Payment Pending</option>
<!-- <option value="To be Re allocated">To be Re allocated</option>-->
<option value="No Power" <?php if($pending_reason=="No Power") echo "selected='selected'";?>>No Power</option>
</select>
<span class="help-block">Select Pending Reason</span>
</div>
<div class="col-md-3">
<label>Visit Date & Time<span class="f_req"></span></label>
<input name="visit_date_time" type="text" class="form-control uppercase" id="visit_date_time" data-date-format="dd-mm-yyyy" onclick="$('#visit_date_time').datepicker('show');" value="<?php echo $visit_date_time;?>"/>
<span class="help-block">Select Visit Date</span>
</div>
<div class="col-md-3">
<label>Completion Date and Time<span class="f_req"></span></label>
<input name="completion_date_time" type="text" class="form-control uppercase" id="completion_date_time" data-date-format="dd-mm-yyyy" onclick="$('#completion_date_time').datepicker('show');" value="<?php echo $completion_date_time;?>" />
<span class="help-block">Select Completion Date and Time</span>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label>Service Report Upload<span class="f_req">*</span></label>
<input type="file" name="service_upload" id="service_upload" onchange="uploadservice()" />
<?php if($service_report_upload!="") {?>
<a href="<?php echo $service_report_upload;?>" target="_blank">VIEW SERVICE REPORT</a>
<?php } ?>
<input type="hidden" name="hid_service_upload" id="hid_service_upload" value="<?php echo $service_report_upload;?>"/>
</div>
<div class="col-md-3">
<label>Invoice Upload<span class="f_req">*</span></label>
<input type="file" name="dealer_upload" id="dealer_upload" onchange="uploaddealer()" />
<?php if($invoice_upload!="") {?>
<a href="<?php echo $invoice_upload;?>" target="_blank">VIEW INVOICE REPORT</a>
<?php } ?>
<input type="hidden" name="hid_dealer_upload" id="hid_dealer_upload" value="<?php echo $invoice_upload;?>" />
</div>
<div class="col-md-3">
<label>Remarks<span class="f_req">*</span></label>
<textarea id="complaint_remarks" class="form-control" name="complaint_remarks"> <?php echo $complaint_remarks;?></textarea>
</div>
</div>
</div>
</div>
</br>
</br>
</br>
<div class="form-actions">
<div class="row">
<div class="col-md-offset-3 col-md-9">
<input type="button" id="updatecallcompletion" class="btn green updatecallcompletion" onclick="savecallcomp()" value="Submit">
<input type="button" id="updatecallcancel" class="btn green updatecallcancel" value="Cancel">
</div>
</div>
</div>
</div>
<?php
}
if($type=="3")
{
?>
<div class="col-md-12">
<h4 class="heading">Customer Info.</h4>
<table class="table table-striped table-bordered table-hover dt-responsive" style="width:100% !important" id="sample" >
<thead>
<tr>
<th>option</th>
<th>Name</th>
<th>Address </th>
<th>Area</th>
<th>Surround Area/City</th>
<th>Phone</th>
<th>Mobile</th>
<th>Contact Person</th>
<th>Pincode</th>
</tr>
</thead>
<tbody>
<?php
// use serial no to get customer code
if($searchby=="SERIALNO")
{
$sqls="SELECT GROUP_CONCAT(distinct(CUSTOMER_code)) as custcode FROM sales inner join service on service.SALES_ID=sales.SALES_ID where SERIALNO like '%".$searchtext."%' ORDER BY sales.SALES_ID";
//echo $sqls; die;
$qus=mysql_query($sqls);
$fetch=mysql_fetch_array($qus);
$customer_code=str_replace(',',"','",$fetch['custcode']);
$sql1="select CUSTOMER_code,CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA,CUSTOMER_CITY,CUSTOMER_PINCODE,CUSTOMER_PHONE,CUSTOMER_MOBILE,CUSTOMER_CONTACT_PERSON from customer where CUSTOMER_code in ('".$customer_code."')";
//echo $sql1; die;
}
elseif($searchby=="cust")
{
$sql1="select CUSTOMER_code,CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA,CUSTOMER_CITY,CUSTOMER_PINCODE,CUSTOMER_PHONE,CUSTOMER_MOBILE,CUSTOMER_CONTACT_PERSON from customer where CUSTOMER_code in ('".$searchtext."')";
}
else
{
$sql1="select CUSTOMER_code, CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA,CUSTOMER_CITY,CUSTOMER_PINCODE,CUSTOMER_PHONE,CUSTOMER_MOBILE,CUSTOMER_CONTACT_PERSON from customer where ".$searchby." like '%".$searchtext."%'";
}
//echo $sql1; die;
//$sql1="select CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA from customer limit 1,10";
$qu1=mysql_query($sql1);
$i=1;
while($rd=mysql_fetch_array($qu1))
{
?>
<tr>
<td>
<a id"updatecustomer" alt="<?php echo $rd['CUSTOMER_code'];?>" onclick="updatecustomer('<?php echo $rd['CUSTOMER_code'];?>')" title="Update Customer"><span class="icon-clock" style="cursor: pointer;" ></a>
</td>
<td ><?php echo $rd['CUSTOMER_NAME'];?></td>
<td ><?php echo $rd['CUSTOMER_ADDRESS'];?></td>
<td ><?php echo $rd['CUSTOMER_AREA'];?></td>
<td class="center" ><?php echo $rd['CUSTOMER_SURROUND_AREA'].'-'. $rd['CUSTOMER_CITY']; ?></td>
<!--<td class="center" ><?php echo $rd['CUSTOMER_CITY']; ?></td> -->
<td class="center" ><?php echo $rd['CUSTOMER_PHONE']; ?></td>
<td class="center" ><?php echo $rd['CUSTOMER_MOBILE']; ?></td>
<td class="center"><?php echo $rd['CUSTOMER_CONTACT_PERSON']; ?></td>
<td class="center"><?php echo $rd['CUSTOMER_PINCODE']; ?></td>
</tr>
<?php $i++; }?>
</tbody>
</table>
</div>
<?php
}
elseif($type=="4")
{
$cust_code=$_REQUEST['custcode'];
?>
<div id="complaint_machineinfo">
<div class="col-md-12">
<div id="serviceinfo" style="display:none;height:300px; overflow:scroll;"></div>
<div id="addnewmachine" style="display:none;height:400px;"></div>
<div id="servicecomplete" style="display:none;height:300px; overflow:scroll;"></div>
<strong>Machine Info. </strong>
<input type="button" id="search" class="btn blue" value="Add New Machine" id="addnewmachine" class="btn red" onclick="addnewmachine('','<?php echo $cust_code;?>')">
<input type="button" id="search" class="btn blue" value="Add New Machine" id="addnewmachine" class="btn red" onclick="addnewmachine('','<?php echo $cust_code;?>')">
</br>
</br>
<table class="table table-striped table-bordered table-hover dt-responsive" style="width:100% !important" id="viewmachineinfo" >
<thead>
<tr>
<th>Select</th>
<th>Name</th>
<th>Serial No.</th>
<th>Compressor No</th>
<th>Installation Date</th>
<th>Maturity date</th>
<th>Invoice date</th>
<th>Servicemode</th>
<th>Capacity</th>
</tr>
</thead>
<tbody>
<?php
$sql1="SELECT *,(select SERVICE_MODE_NAME FROM service_mode where service_mode.SERVICE_MODE_ID=sales.SERVICEMODE_ID) as SERVICEMODENAME ,(select PURCHASE_SERIALNUMBER FROM purchase where purchase.PURCHASE_ID=sales.PURCHASE_ID order by SALES_ID limit 0,1) as SERIALNO from sales inner join customer on sales.CUSTOMER_CODE=customer.CUSTOMER_CODE where customer.CUSTOMER_CODE='".$cust_code."'";
// echo $sql1; die;
//$sql1="select CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_AREA,CUSTOMER_SURROUND_AREA from customer limit 1,10";
$qu1=mysql_query($sql1);
$i=1;
while($rd=mysql_fetch_array($qu1))
{
?>
<tr>
<td><input type="radio" id="selectsaleid" value="<?php echo $rd['SALES_ID'];?>"/> </td>
<!--<td><a id"viewserviceinfo" alt="<?php echo $rd['SALES_ID'];?>" onclick="viewserviceinfo('<?php echo $rd['SALES_ID'];?>','<?php echo $rd['CUSTOMER_CODE'];?>')" title="View Service Info"><span class="icon-pencil" style="cursor: pointer;" ></a> <a id"booknew" alt="<?php echo $rd['CUSTOMER_CODE'];?>" onclick="bookcomplaintwithservice('<?php echo $rd['CUSTOMER_CODE'];?>','<?php echo $rd['SALES_ID']; ?>','<?php echo "0";?>')"><span class="icon-plus" style="cursor: pointer;" title="Book New Complaint"></a> <a><span class="icon-call-in" style="cursor: pointer;" id"viewmachine" alt="<?php echo $rd['CUSTOMER_CODE'];?>" title="View Complaint History"></a></td>-->
<td ><?php echo $rd['CUSTOMER_NAME'];?></td>
<td ><?php echo $rd['SERIALNO'];?></td>
<td ><?php echo $rd['COMPRESSORNO'];?></td>
<td ><?php echo $rd['INSTALLATION_DATE'];?></td>
<td class="center" ><?php echo $rd['MATURITY_DATE']; ?></td>
<td class="center" ><?php echo $rd['INVOICE_DATE']; ?></td>
<td class="center" ><?php echo $rd['SERVICEMODENAME']; ?></td>
<td class="center"><?php echo $rd['CAPACITY']; ?></td>
</tr>
<?php $i++; }?>
</tbody>
</table>
</div>
</div>
<?php
}
}
if($pageid=="2_3_1")
{
if($type=="1")
{
$month=$_REQUEST['month'];
$option=$_REQUEST['filter'];
$surround_area=$_REQUEST['surround_area'];
//$custcode=$_REQUEST['todate'];
$mymavl=explode('-',$month);
if($surround_area!="" && $surround_area!="All")
$query="and CUSTOMER_SURROUND_AREA='".$surround_area."'";
?>
<div class="row portlet light">
<div class="col-md-12">
<h3 class="heading">View / Search Service Machine </h3>
<table class="table table-striped table-bordered table-hover dt-responsive" id="viewservicedetails">
<thead>
<tr>
<th>S.No.</th>
<th>option</th>
<th>Name</th>
<th>Address</th>
<th>Surround Area</th>
<th>Customer Contact Person</th>
<th>Customer Mobile</th>
<th>Phone No.</th>
<th>Status</th>
<th>Mac. Count</th>
</tr>
</thead>
<tbody>
<?php
if($option=="Machine Wise")
{
$sql1="SELECT(select amc_status FROM serviceapp_amclog where amc_ids=sales.SALES_ID order by amc_log_id desc LIMIT 1) as amclogstatus, sales.customer_code,SERVICEMODE_ID,GROUP_CONCAT(distinct(sales.SALES_ID)) as sales_all_id,count(distinct(sales.SALES_ID)) as mac_count,customer.CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_SURROUND_AREA,CUSTOMER_CONTACT_PERSON,CUSTOMER_MOBILE,CUSTOMER_PHONE FROM `sales` inner join service on sales.sales_id=service.sales_id inner join customer on customer.customer_code=sales.customer_code where maturity_date like '%".$month."%' and sales.status=0 $query group by sales.customer_code,sales.SERVICEMODE_ID order by customer.CUSTOMER_NAME";
}
else
{
$sql1="SELECT(SELECT amc_status FROM serviceapp_amclog where amc_ids=sales.SALES_ID order by `amc_log_id` DESC LIMIT 1)as amclogstatus,sales.customer_code,SERVICEMODE_ID,GROUP_CONCAT(distinct(sales.SALES_ID)) as sales_all_id,count(distinct(sales.SALES_ID)) as mac_count,customer.CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_SURROUND_AREA,CUSTOMER_CONTACT_PERSON,CUSTOMER_MOBILE,CUSTOMER_PHONE FROM `sales` inner join service on sales.sales_id=service.sales_id inner join customer on customer.customer_code=sales.customer_code where maturity_date like '%".$month."%' and sales.status=0 $query group by sales.customer_code,sales.SERVICEMODE_ID order by customer.CUSTOMER_NAME";
}
// echo $sql1; die;
$qu1=mysql_query($sql1);
$i=1;
while($rd=mysql_fetch_array($qu1))
{
?>
<tr>
<td><?php echo $i;?></td>
<td class="center"><a href="print_labour.php?id=<?php echo $rd['sales_all_id']; ?>" target="_blank" class="sepV_a" title="Print Labour Report"><i class="fa fa-print"></i></a>
<a href="print_comp.php?id=<?php echo $rd['sales_all_id']; ?>" class="sepV_a" target="_blank" title="Print Compressor Report"><i class="fa fa-print"></i></a>
<a href="print_comp.php?id=<?php echo $rd['sales_all_id']; ?>" class="sepV_a" target="_blank" title="Print Except-Compressor Report"><i class="fa fa-print"></i></a>
<a id"insertamc" alt="<?php echo $rd['sales_all_id'];?>" onclick="insertamc('<?php echo $rd['sales_all_id'];?>')" title="Update Amc"><span class="icon-plus" style="cursor: pointer;" ></a>
</td>
<td><?php echo $rd['CUSTOMER_NAME'];?></td>
<td><?php echo $rd['CUSTOMER_ADDRESS'];?></td>
<td><?php echo $rd['CUSTOMER_SURROUND_AREA'];?></td>
<td><?php echo $rd['CUSTOMER_CONTACT_PERSON'];?></td>
<td><?php echo $rd['CUSTOMER_MOBILE'];?></td>
<td><?php echo $rd['CUSTOMER_PHONE'];?></td>
<td><?php echo $rd['amclogstatus'];?></td>
<td><?php echo $rd['mac_count'];?></td>
</tr>
<?php $i++; $result.= $rd['sales_all_id']. '^'; }?>
</tbody>
</table>
</div>
</div>
<form id="sampleid" name="sampleid" method="post" target="_blank" action="print_all.php?number=1">
<input type="hidden" value="<?php echo $result; ?>" name="hiddennvalue" id="hiddennvalue" />
<input type="submit" id="printsubmit" class="btn green" value="Print All">
</form>
<?php
}
if($type=="2")
{
$sales_all_id=$_REQUEST['sales_all_id'];
$fromdate=$_REQUEST['fromdate'];
?>
<div class="row">
<div class="col-md-12">
<form id="amcinsert_form" method="post">
<div class="col-md-3">
<label> Date :</label>
<input name="amc_date" type="text" class="form-control col-md-4 date-picker" value="<?php echo $fromdate;?>" id="amc_date" readonly/>
<input name="amc_ids" type="hidden" class="form-control col-md-4 date-picker" value="<?php echo $sales_all_id; ?>" id="amc_ids" />
</div>
<div class="col-md-3">
<label>AMC Status<span class="f_req">*</span></label>
<select name="amc_status" class="form-control select2 uppercase" id="amc_status" style="max-height:400px;" >
<option value="selected">Select</option>
<option value="accepted">Accepted</option>
<option value="rejected">Rejected</option>
<option value="hold">Hold</option>
<option value="onprogress">On Progress</option>
</select>
</div>
<div class="col-md-3">
<label>AMC_comments<span class="f_req">*</span></label>
<input name="amc_comments" type="textarea" class="form-control col-md-4 date-picker" value="" id="amc_comments" />
</div>
<div class="col-md-3">
<label> </label>
</br>
<span id="btnamcinsertbtn">
<input type="button" id="amc_insert" onclick="amcinsert()" class="btn green" value="Submit" ></span>
</div>
</form>
</div>
</div>
<div class="row portlet light" id="amcview">
<div class="col-md-12">
<h3 class="heading">View / Search Service Machine </h3>
<table class="table table-striped table-bordered table-hover dt-responsive" id="updateamc">
<thead>
<tr>
<th>S.No.</th>
<th>AMC ids</th>
<th>Contact Date</th>
<th>AMC Status</th>
<th>AMC Comments</th>
</tr>
</thead>
<tbody>
<?php
//echo $sql; die;
$sql1="SELECT amc_ids,amc_date,amc_status,amc_comments FROM serviceapp_amclog where amc_ids like '%".$sales_all_id."%' and amc_date like '%".$fromdate."%' order by amc_log_id DESC ";
//echo $sql1; die;
$qu1=mysql_query($sql1);
$i=1;
while($rd=mysql_fetch_array($qu1))
{
?>
<tr>
<td><?php echo $i;?></td>
<td><?php echo $rd['amc_ids'];?></td>
<td><?php echo $rd['amc_date'];?></td>
<td><?php echo $rd['amc_status'];?></td>
<td><?php echo $rd['amc_comments'];?></td>
</tr>
<?php $i++; }?>
</tbody>
</table>
</div>
</div>
<form id="sampleid" name="sampleid" method="post" target="_blank" action="print_all.php?number=1">
<input type="hidden" value="<?php echo $result; ?>" name="hiddennvalue" id="hiddennvalue" />
<input type="submit" id="printsubmit" class="btn green" value="Print All">
</form>
<?php
}
}
else if($pageid=="7_1_9")
{
if($type=="1")
{
?>
<div class="col-md-12">
<h4 class="heading">View / Search / Update Pages </h4>
<table class="table table-striped table-bordered table-hover dt-responsive" style="width:100% !important" id="sample">
<thead>
<tr>
<th>SERIAL NO</th>
<th>MAKE</th>
<th>PURCHASE INVOICE NUMBER</th>
<th>PURCHASE DATE</th>
<th>PURCHASE SERIALNO</th>
<th>PURCHASE MODEL NAME</th>
<th>sales invoiceno</th>
<th>sales date</th>
<th>client name</th>
</tr>
</thead>
<tbody>
<?php
// fetch purchase and sale data
$sql1="SELECT PURCHASE_ID,PURCHASE_INVOICENUMBER,PURCHASE_DATE,PURCHASE_SERIALNUMBER,(select model_name from model where MODEL_ID=purchase.PURCHASE_MODEL_ID) as model_name,sales_invoiceno,sales_date,client_name from purchase where ".$searchby." like '%".$searchtext."%' and (status='Y' or status IS NULL)" ;
//echo $sql1;
$qu1=mysql_query($sql1);
$i=1;
while( $rd=mysql_fetch_array($qu1))
{
?>
<tr>
<td><?php echo $i;?></td>
<td><a><span class="icon-pencil" style="cursor: pointer;" id="purchasesalestd" alt="<?php echo $rd['PURCHASE_ID'];?>" onclick="purchasesales('<?php echo $rd['PURCHASE_ID']; ?>')" title="Purchase/Sales Update"></a></td>
<td ><?php echo $rd['PURCHASE_INVOICENUMBER'];?></td>
<td ><?php echo date('d-m-Y',(strtotime($rd['PURCHASE_DATE'])));?></td>
<td class="center" ><?php echo $rd['PURCHASE_SERIALNUMBER'].'-'. $rd['CUSTOMER_CITY']; ?></td>
<!--<td class="center" ><?php echo $rd['PURCHASE_MODEL_ID']; ?></td> -->
<td class="center" ><?php echo $rd['model_name']; ?></td>
<td class="center" ><?php echo $rd['sales_invoiceno']; ?></td>
<td class="center" ><?php
if(($rd['sales_date'])=='')
{
echo "";
}
else
{
echo date('d-m-Y',(strtotime($rd['sales_date']))); }?></td>
<td class="center" ><?php echo $rd['client_name']; ?></td>
</tr>
<?php $i++; } ?>
</tbody>
</table>
</div>
<?php
}
elseif($type=="2")
{
$PURCHASE_ID=$_REQUEST['PURCHASE_ID'];
//$serviceno=$_REQUEST['serviceno'];
//$salesid=$_REQUEST['salesid'];
$sql_cust="select PURCHASE_ID,PURCHASE_INVOICENUMBER,PURCHASE_DATE,PURCHASE_SERIALNUMBER,PURCHASE_MODEL_ID,sales_invoiceno,sales_date,client_name from purchase where PURCHASE_ID='".$PURCHASE_ID."'";
//echo $sql_cust; die;
$qu=mysql_query($sql_cust);
$fvc=mysql_fetch_array($qu);
?>
<div class="modal-body"><div class="portlet light">
<form id="purchasesales_form_update" method="post">
<label><h5 style="font-weight:bold;">Purchase Info. </h5></label>
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label>Purchase Invoice Number <span class="f_req">*</span></label>
<input name="PURCHASE_INVOICENUMBER" type="text" class="form-control uppercase" id="PURCHASE_INVOICENUMBER" value="<?php echo $fvc['PURCHASE_INVOICENUMBER'];?>" />
<input name="PURCHASE_ID" type="hidden" class="form-control uppercase" id="PURCHASE_ID" value="<?php echo $PURCHASE_ID; ?>" />
</div>
<div class="col-md-3">
<label>Purchase Date<span class="f_req">*</span></label>
<input name="PURCHASE_DATE" type="text" class="form-control" data-date-format="dd-mm-yyyy" id="PURCHASE_DATE" value="<?php echo $fvc['PURCHASE_DATE'];?>" onclick="$('#PURCHASE_DATE').datepicker();$('#PURCHASE_DATE').datepicker('show');">
</div>
<div class="col-md-3">
<label>Purchase Serial Number<span class="f_req">*</span></label>
<input name="PURCHASE_SERIALNUMBER" type="text" id="PURCHASE_SERIALNUMBER" class="form-control uppercase" value="<?php echo $fvc['PURCHASE_SERIALNUMBER']; ?>" />
<!--class="form-control date-picker" data-date-format="dd-mm-yyyy"-->
</div>
<!--class="form-control date-picker" data-date-format="dd-mm-yyyy"-->
<div class="col-md-3">
<label>Purchase Model Name<span class="f_req">*</span></label>
<select name="PURCHASE_MODEL_ID" class="form-control select2 col-md-12" id="PURCHASE_MODEL_ID" style="max-height:400px;" >
<option value="">Select</option>
<?php
$sql="select MODEL_ID,MODEL_NAME,(select MAKE_NAME from make where MAKE_ID=model.MAKE_ID) as MAKE_NAME from model where status='1'";
$qu=mysql_query($sql);
while($r=mysql_fetch_array($qu))
{
?>
<option <?php if($fvc['PURCHASE_MODEL_ID']==$r['MODEL_ID']) echo "selected='selected'";?> value="<?php echo $r['MODEL_ID'];?>"><?php echo $r['MAKE_NAME']."----".$r['MODEL_NAME'];?></option>
<?php }?>
</select>
</div>
</div>
</div></br></br>
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<label>sales_invoiceno<span class="f_req">*</span></label>
<input name="sales_invoiceno" type="text" class="form-control uppercase" id="sales_invoiceno" value="<?php echo $fvc['sales_invoiceno']; ?>" />
</div>
<div class="col-md-3">
<label>sales date<span class="f_req">*</span></label>
<input name="sales_date" type="text" class="form-control" data-date-format="dd-mm-yyyy" id="sales_date" value="<?php echo $fvc['sales_date']; ?>" onclick="$('#sales_date').datepicker();$('#sales_date').datepicker('show');" />
</div>
<div class="col-md-3">
<label>Client Name<span class="f_req">*</span></label>
<input name="client_name" type="text" class="form-control uppercase" id="client_name" value="<?php echo $fvc['client_name']; ?> "/>
</div>
</div>
</div>
<div class="form-actions">
<div class="row">
</br></br>
<div class="col-md-offset-3 col-md-9">
<button type="submit" class="btn green" onclick="addupdatepurchase()"><?php if($PURCHASE_ID==0) echo "Submit"; else echo "Update"; ?></button>
<button type="button" class="btn dark btn-outline" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</form>
</div> </div>
<?php
}
}
else if($pageid=="1_1_0")
{
if($type=="1")
{
//echo "SELECT (select EMP_NAME from employee where EMP_ID=serviceapp_callreg.tech_name)as tech_name,count(*) as countnew FROM `serviceapp_callreg` inner join serviceapp_callcomp on serviceapp_callreg.reg_id=serviceapp_callcomp.reg_id where serviceapp_callreg.complaint_date between '".date('Y-m-d',strtotime($_REQUEST['callclosurfrmdate']))."' and '".date('Y-m-d',strtotime($_REQUEST['callclosurtodate']))."' and status='2' group by tech_name";
//echo "SELECT (select EMP_NAME from employee where EMP_ID=serviceapp_callreg.tech_name)as tech_name,count(*) as countnew FROM `serviceapp_callreg` inner join serviceapp_callcomp on serviceapp_callreg.reg_id=serviceapp_callcomp.reg_id where serviceapp_callreg.complaint_date between '".date('Y-m-d',strtotime($_REQUEST['callclosurfrmdate']))."' and '".date('Y-m-d',strtotime($_REQUEST['callclosurtodate']))."' and status='2' group by tech_name"; die;
$result = mysql_query("SELECT (select EMP_NAME from employee where EMP_ID=serviceapp_callreg.tech_name)as tech_name,count(*) as countnew FROM `serviceapp_callreg` inner join serviceapp_callcomp on serviceapp_callreg.reg_id=serviceapp_callcomp.reg_id where serviceapp_callreg.complaint_date between '".date('Y-m-d',strtotime($_REQUEST['callclosurfrmdate']))."' and '".date('Y-m-d',strtotime($_REQUEST['callclosurtodate']))."' and serviceapp_callreg.status='2' group by tech_name");
#$result = mysql_query("SELECT name, val FROM web_marketing");
//$rows = array();
$rows['type'] = 'pie';
$rows['name'] = 'callclosure';
//$rows['innerSize'] = '50%';
while ($r = mysql_fetch_array($result)) {
$rows['data'][] = array('Techname: '.$r['tech_name'].'-'.$r['countnew'].'"', $r['countnew']);
}
$rslt = array();
array_push($rslt,$rows);
print json_encode($rslt, JSON_NUMERIC_CHECK);
?>
<?php
}
elseif($type=="2")
{
// echo "SELECT (select EMP_NAME from employee where EMP_ID=serviceapp_callreg.tech_name)as tech_name,count(*) as countnew FROM `serviceapp_callreg` where serviceapp_callreg.complaint_date between '".date('Y-m-d',strtotime($_REQUEST['penclosurfrmdate']))."' and '".date('Y-m-d',strtotime($_REQUEST['penclosurtodate']))."' and status='1' or status='3' group by tech_name"; die;
//echo "SELECT (select EMP_NAME from employee where EMP_ID=serviceapp_callreg.tech_name)as tech_name,count(*) as countnew FROM `serviceapp_callreg` where serviceapp_callreg.complaint_date between '".date('Y-m-d',strtotime($_REQUEST['penclosurfrmdate']))."' and '".date('Y-m-d',strtotime($_REQUEST['penclosurtodate']))."' group by tech_name";
//echo "SELECT (select EMP_NAME from employee where EMP_ID=serviceapp_callreg.tech_name)as tech_name,count(*) as countnew FROM `serviceapp_callreg` inner join serviceapp_callcomp on serviceapp_callreg.reg_id=serviceapp_callcomp.reg_id where serviceapp_callcomp.completion_date_time between '".$_REQUEST['callclosurfrmdate']."' and '".$_REQUEST['callclosurtodate']."' group by tech_name"; die;
$result = mysql_query("SELECT (select EMP_NAME from employee where EMP_ID=serviceapp_callreg.tech_name)as tech_name,count(*) as countnew FROM `serviceapp_callreg` where serviceapp_callreg.complaint_date between '".date('Y-m-d',strtotime($_REQUEST['penclosurfrmdate']))."' and '".date('Y-m-d',strtotime($_REQUEST['penclosurtodate']))."' and status IN ('1','3') group by tech_name");
#$result = mysql_query("SELECT name, val FROM web_marketing");
//$rows = array();
$rows['type'] = 'pie';
$rows['name'] = 'callpending';
//$rows['innerSize'] = '50%';
while ($r = mysql_fetch_array($result)) {
$rows['data'][] = array('Techname: '.$r['tech_name'].'-'.$r['countnew'].'"', $r['countnew']);
}
$rslt = array();
array_push($rslt,$rows);
print json_encode($rslt, JSON_NUMERIC_CHECK);
?>
<?php
}
elseif($type=="3")
{
//echo "SELECT (select EMP_NAME from employee where EMP_ID=serviceapp_callreg.tech_name)as tech_name,count(*) as countnew FROM `serviceapp_callreg` where serviceapp_callreg.complaint_date between '".date('Y-m-d',strtotime($_REQUEST['callcancelfrmdate']))."' and '".date('Y-m-d',strtotime($_REQUEST['callcanceltodate']))."' and status='4' group by tech_name";die;
//echo "SELECT (select EMP_NAME from employee where EMP_ID=serviceapp_callreg.tech_name)as tech_name,count(*) as countnew FROM `serviceapp_callreg` inner join serviceapp_callcomp on serviceapp_callreg.reg_id=serviceapp_callcomp.reg_id where serviceapp_callcomp.completion_date_time between '".$_REQUEST['callclosurfrmdate']."' and '".$_REQUEST['callclosurtodate']."' group by tech_name"; die;
$result = mysql_query("SELECT (select EMP_NAME from employee where EMP_ID=serviceapp_callreg.tech_name)as tech_name,count(*) as countnew FROM `serviceapp_callreg` where serviceapp_callreg.complaint_date between '".date('Y-m-d',strtotime($_REQUEST['callcancelfrmdate']))."' and '".date('Y-m-d',strtotime($_REQUEST['callcanceltodate']))."' and status='4' group by tech_name");
#$result = mysql_query("SELECT name, val FROM web_marketing");
//$rows = array();
$rows['type'] = 'pie';
$rows['name'] = 'callcancel';
//$rows['innerSize'] = '50%';
while ($r = mysql_fetch_array($result)) {
$rows['data'][] = array('Techname: '.$r['tech_name'].'-'.$r['countnew'].'"', $r['countnew']);
}
$rslt = array();
array_push($rslt,$rows);
print json_encode($rslt, JSON_NUMERIC_CHECK);
?>
<?php
}
elseif($type=="4")
{
//echo $_REQUEST['monthcallclosurfrmdate'];
//echo "SELECT (select EMP_NAME from employee where EMP_ID=serviceapp_callreg.tech_name)as tech_name,count(*) as countnew,MONTH(complaint_date) AS Month, YEAR(complaint_date) as YEAR FROM `serviceapp_callreg` inner join serviceapp_callcomp on serviceapp_callreg.reg_id=serviceapp_callcomp.reg_id where EXTRACT(YEAR FROM serviceapp_callreg.complaint_date)='".date('Y',strtotime($_REQUEST['monthcallclosurfrmdate']))."' and serviceapp_callreg.status='2' group by month,YEAR";die;
//echo "SELECT (select EMP_NAME from employee where EMP_ID=serviceapp_callreg.tech_name)as tech_name,count(*) as countnew,MONTH(complaint_date) AS Month, YEAR(complaint_date) as YEAR FROM `serviceapp_callreg` inner join serviceapp_callcomp on serviceapp_callreg.reg_id=serviceapp_callcomp.reg_id where EXTRACT(YEAR FROM serviceapp_callreg.complaint_date)='".date('Y',strtotime($_REQUEST['monthcallclosurfrmdate']))."' and serviceapp_callreg.status='2' group by month,YEAR"; die;
$result = mysql_query("SELECT (select EMP_NAME from employee where EMP_ID=serviceapp_callreg.tech_name)as tech_name,count(*) as countnew,MONTH(complaint_date) AS Month, YEAR(complaint_date) as YEAR FROM `serviceapp_callreg` inner join serviceapp_callcomp on serviceapp_callreg.reg_id=serviceapp_callcomp.reg_id where EXTRACT(YEAR FROM serviceapp_callreg.complaint_date)='".$_REQUEST['monthcallclosurfrmdate']."' and serviceapp_callreg.status='2' group by month,YEAR");
#$result = mysql_query("SELECT name, val FROM web_marketing");
//$rows = array();
$bln = array();
$bln['name'] = 'Bulan';
$rows['name'] = 'Tech Name';
while ($r = mysql_fetch_array($result)) {
$bln['data'][] = $r['Month'];
$rows['data'][] = $r['countnew'];
}
$rslt = array();
array_push($rslt, $bln);
array_push($rslt, $rows);
print json_encode($rslt, JSON_NUMERIC_CHECK);
?>
<?php
}
}
else if($pageid=="1_1_4")
{
// No use
if($type=="1")
{
//echo "SELECT count(*) as total from serviceapp_amclog where amc_date between '".date('Y-m-d',strtotime($_REQUEST['callclosurfrmdate']))."' and '".date('Y-m-d',strtotime($_REQUEST['callclosurtodate']))."'";
//echo "SELECT (select EMP_NAME from employee where EMP_ID=serviceapp_callreg.tech_name)as tech_name,count(*) as countnew FROM `serviceapp_callreg` inner join serviceapp_callcomp on serviceapp_callreg.reg_id=serviceapp_callcomp.reg_id where serviceapp_callreg.complaint_date between '".date('Y-m-d',strtotime($_REQUEST['callclosurfrmdate']))."' and '".date('Y-m-d',strtotime($_REQUEST['callclosurtodate']))."' and status='2' group by tech_name"; die;
$result ="SELECT count(*) as total from serviceapp_amclog where amc_date between '".date('Y-m-d',strtotime($_REQUEST['callclosurfrmdate']))."' and '".date('Y-m-d',strtotime($_REQUEST['callclosurtodate']))."'";
#$result = mysql_query("SELECT name, val FROM web_marketing");
//$rows = array();
$quamc=mysql_query($result);
$quamc_f=mysql_fetch_assoc($quamc);
$amc_count=$quamc_f['total'];
?>
<span class="widget-thumb-body-stat" id="amccalls" data-counter="counterup" data-value="<?php echo $amc_count; ?>">0</span>
<?php
}
// No use end
elseif($type=="2")
{
//echo "SELECT count(*) as total,amc_status from serviceapp_amclog where amc_date between '".date('Y-m-d',strtotime($_REQUEST['amccallfrmdate']))."' and '".date('Y-m-d',strtotime($_REQUEST['amccalltodate']))."' group by amc_status";die;
$result=mysql_query("SELECT count(*) as total,amc_status from serviceapp_amclog where amc_date between '".date('Y-m-d',strtotime($_REQUEST['amccallfrmdate']))."' and '".date('Y-m-d',strtotime($_REQUEST['amccalltodate']))."' group by amc_status ");
$rslt = array();
while ($r = mysql_fetch_array($result)) {
//$rows = split(",", $r);
$rows['data'][] = array($r['amc_status'].'-'.$r['total']);
}
$rslt = array();
array_push($rslt,$rows);
print json_encode($rslt, JSON_NUMERIC_CHECK);
?>
<?php
}
}
?>