MOON
Server: Apache
System: Linux nserver.cafsindia.com 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: cafsindia (1002)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: /home/cafsindia/refimac_cafsjobs_com/loaddata.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 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><?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> &nbsp; &nbsp;<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>&nbsp; &nbsp; <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>

					&nbsp; &nbsp;

					<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="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>

	

	

	

        <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" id="viewmachineinfo" >

            <thead>

				<tr>

					<th>S.No.</th>

					<th>option</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='".$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> &nbsp; &nbsp;<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>&nbsp; &nbsp; <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>



<?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">



<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."'	";

			//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') {?>  <?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>&nbsp; &nbsp; <?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 "#"; ?>" 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 FROM `serviceapp_callreg` WHERE `cust_code` = '".$custcode."' and status='1' ";

			

 			//$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"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></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>		

									

					<td><a href="print_service.php?number=<?php echo $rd['complaint_no']; ?>" id"servicereport" target="_blank" title="View Service Report">View Report</a></td>

					

				</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 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">

<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>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"  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($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"></div></td>

					 <input type="hidden" name="mac_model_id" id="mac_model_id"  value="" />

					<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($SERVICE_MODE_ID==$r['SERVICE_MODE_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"  /></td>					

					<td class="center"  ><input name="mac_wrty" type="text" class="form-control" id="mac_wrty" /></td>

							

					<td class="center"  ><input name="mac_location" type="text" class="form-control" id="mac_location" /></td>

					<td class="center"  ><input name="mac_service_year" type="text" class="form-control" id="mac_service_year"  /></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 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" /></td>

					<td><input name="mac_invoice_date" type="text" class="form-control" id="mac_invoice_date" /></td>

					<td><input name="mac_compressor_sno" type="text" class="form-control" id="mac_compressor_sno" /></td>

					<td><input name="mac_purchase_billno" type="text" class="form-control" id="mac_purchase_billno" /></td>

					<td><input name="mac_purchase_billdate" type="text" class="form-control" id="mac_purchase_billdate" /></td>

					<td><input name="mac_installdate" type="text" class="form-control" id="mac_installdate" /></td>

					<td><input name="mac_maturitydate" type="text" class="form-control" id="mac_maturitydate" /></td>

					<td><input name="mac_amount" type="text" class="form-control" id="mac_amount" /></td>

					<td><input name="mac_remarks" type="text" class="form-control" id="mac_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>

                        </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='1' ";



//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="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 sales.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 sales.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		

			

			

					

			$sql1="SELECT PURCHASE_INVOICENUMBER,PURCHASE_DATE,PURCHASE_SERIALNUMBER,(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,PURCHASE_MODEL_ID FROM purchase where PURCHASE_SERIALNUMBER='".$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;

			while($rd=mysql_fetch_array($qu1))

			{			

			?>

				<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']; ?></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']?>" value="FetchData" /></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

}





}

if($pageid=="2_1_3")

{



if($type=="1")

{

$sqlcust="SELECT reg_id,cust_code,call_type FROM `serviceapp_callreg` WHERE `complaint_no` = '".$searchtext."' and status='1'";

$qucust=mysql_query($sqlcust);

$rdcust=mysql_fetch_array($qucust);

$cust_code=$rdcust['cust_code'];

$reg_id=$rdcust['reg_id'];

$call_type=$rdcust['call_type'];

?>



<!--Customer info-->

<div id="complaint_cust_info">



<div class="col-md-12">

	

       <strong> Customer Info. </strong>

		

		<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="select" 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="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>

	

	

	

        <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" id="selectsaleid"  values="<?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> &nbsp; &nbsp;<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>&nbsp; &nbsp; <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>	



<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"  />

			<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"  />

			<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"  />

			<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"  />

			<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"  />

			

		</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="amtfromdealer" type="text" class="form-control uppercase" id="amtfromdealer"  />

			<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="amtfromcustomer" type="number" class="form-control uppercase" id="amtfromcustomer"  />

			<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="select" 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="YES" <?php if($call_type=="Installation") echo "selected='selected'";?>>YES</option>

			  <option value="NO" <?php if($call_type=="Breakdown") 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_type=="") echo "selected='selected'";?>>Select</option>

			  <option value="completed" <?php if($call_type=="completed") echo "selected='selected'";?>>Completed</option>

			  <option value="pending" <?php if($call_type=="pending") echo "selected='selected'";?>>Pending</option>

			  <option value="canceled" <?php if($call_type=="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="log_status" class="form-control select2 col-md-12"  id="log_status"> 

                        <option value="">Select Pending Reason</option>

                        <option value="Customer Appointment">Customer Appointment</option>

                        <option value="Part Pending">Part Pending</option>

                        <option value="M/C Delivery Pending">M/C Delivery Pending</option>

                        <option value="Door Locked / Address Not Clear">Door Locked / Address Not Clear</option>

                        <option value="Technical Support Required">Technical Support Required</option>

                        <option value="Customer Payment Pending">Customer Payment Pending</option>                        

                      <!--  <option value="To be Re allocated">To be Re allocated</option>-->

					  <option value="No Power">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="visitdate" type="text" class="form-control uppercase" id="visitdate"  />

			<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="completiondateandtime" type="text" class="form-control uppercase" id="completiondateandtime"  />

			<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>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_type=="") echo "selected='selected'";?>>Select</option>

			  <option value="completed" <?php if($call_type=="completed") echo "selected='selected'";?>>Completed</option>

			  <option value="pending" <?php if($call_type=="pending") echo "selected='selected'";?>>Pending</option>

			  <option value="canceled" <?php if($call_type=="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="log_status" class="form-control select2 col-md-12"  id="log_status"> 

                        <option value="">Select Pending Reason</option>

                        <option value="Customer Appointment">Customer Appointment</option>

                        <option value="Part Pending">Part Pending</option>

                        <option value="M/C Delivery Pending">M/C Delivery Pending</option>

                        <option value="Door Locked / Address Not Clear">Door Locked / Address Not Clear</option>

                        <option value="Technical Support Required">Technical Support Required</option>

                        <option value="Customer Payment Pending">Customer Payment Pending</option>                        

                      <!--  <option value="To be Re allocated">To be Re allocated</option>-->

					  <option value="No Power">No Power</option>

                      </select>

			<span class="help-block">Select Pending Reason</span>

		</div>

		

		<div class="col-md-3">		

		<label>Canceled Reason<span class="f_req">*</span></label>

			<select name="log_status" class="form-control select2 col-md-12"  id="log_status"> 

                        <option value="">Select Canceled Reason</option>

                        <option value="Customer Appointment">Customer Appointment</option>

                        <option value="Part Pending">Part Pending</option>

                        <option value="M/C Delivery Pending">M/C Delivery Pending</option>

                        <option value="Door Locked / Address Not Clear">Door Locked / Address Not Clear</option>

                        <option value="Technical Support Required">Technical Support Required</option>

                        <option value="Customer Payment Pending">Customer Payment Pending</option>                        

                      <!--  <option value="To be Re allocated">To be Re allocated</option>-->

					  <option value="No Power">No Power</option>

                      </select>

			<span class="help-block">Select Pending Reason</span>

		</div>

		

		<div class="col-md-3">

		<label>Upload Service Report<span class="f_req">*</span></label>

		<input type="file" class="form-control" name="service_report" />

		</div>

	</div>

</div>



<div class="row">

		<div class="col-md-12">

		<div class="col-md-3">	

		<label>Call Status<span class="f_req">*</span></label>

		<textarea id="complaint_remarks"  class="form-control" name="complaint_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 addnewcustomer">Submit</button>

								   <button type="button" class="btn dark btn-outline" data-dismiss="modal">Close</button>

								</div>

							</div>

						</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 / Update Tax Values </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>Mac. Count</th>

				</tr>

			</thead>

			<tbody>

			<?php

			

			

			

				if($option=="Machine Wise")

				{

				

				$sql1="SELECT 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."%'  $query group by sales.customer_code,sales.SERVICEMODE_ID";

				

			   }			   

			   if($option=="Group Service")

			   {

			  $sql1="SELECT 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."%' $query group by sales.customer_code,sales.SERVICEMODE_ID";

			   }

			

			

			//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_exceptcomp.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>

					</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['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

}



}







?>