<?php
  session_start();
$username = $_SESSION['User_Name'];
$flag=$_REQUEST['flag'];
if($flag=='')
{
include_once('dashboard_desk.php');
 require_once('convert_marathi.php');
################################## Displaying Approved Letters InData Table To Perform Action #################################

?>
<!DOCTYPE html>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Tapal Admin System</title>
<?php convert_marathi();	//display data in marathi
	$qry1 =("SELECT * FROM desk_transaction, incoming_letters_transaction, tapal_to_dpt_transaction 
	WHERE (desk_transaction.ltr_approval='Approve') 
	AND (desk_transaction.ltr_category='') 
	AND (desk_transaction.ltr_status!='closed')
	AND (desk_transaction.dpt_ltr_id=tapal_to_dpt_transaction.dpt_ltr_id) 
	AND (tapal_to_dpt_transaction.ltr_id=incoming_letters_transaction.ltr_id) 
	AND desk_transaction.desk_id_from=(SELECT desk_id FROM login WHERE login_id='$username') 
	order by incoming_letters_transaction.ltr_inword_no DESC");	
	$rs1=mysql_query($qry1);
	while($row1=mysql_fetch_array($rs1))
		{?>
			<script type="text/javascript">
				$(document).ready(function(){
					var ltr="<?php echo $row1['desk_ltr_id'];?>";
					$('#slist'+ltr).fadeOut('fast');
					$('#rbox2'+ltr).change(function(){
						if(this.checked)
						{
							$('#slist'+ltr).fadeIn('slow');
						}
						else
						{
							$('#slist'+ltr).fadeIn('slow');
						}
					});
					$('#rbox1'+ltr).change(function(){
						if(this.checked)
						{
							$('#slist'+ltr).fadeOut('slow');
						}
						else
						{
							$('#slist'+ltr).fadeIn('slow');
						}
					});
				})
			</script>
<?php 	} ?>  
</head>
<body>
	<div class="rightpanel">
		<ul class="breadcrumbs">
            <li><a href="dashboard_desk.php"><i class="iconfa-home"></i></a> <span class="separator"></span></li>
            <li><a href="dashboard_desk.php">Tables</a> <span class="separator"></span></li>
            <li>संदर्भ लावा </li>
        </ul>
        <div class="pageheader">
            <div class="pageicon"><span class="iconfa-table"></span></div>
            <div class="pagetitle">
                <h5>Tables</h5>
                <h1>संदर्भ लावा  </h1>
            </div>
        </div><!--pageheader-->
        <div class="maincontent">
            <div class="maincontentinner">
				<h4 class="widgettitle">संदर्भ लावा </h4>  
					
					
					<?php

		################################ Code To Assign reference Type As New Or Current ##############################
					require_once('convert_marathi.php');
					
					convert_marathi();
					$qry1 =("SELECT * FROM desk_transaction, incoming_letters_transaction, tapal_to_dpt_transaction WHERE (desk_transaction.ltr_approval='Approve') AND (desk_transaction.ltr_category='')
					AND (desk_transaction.ltr_status!='closed')
					AND (desk_transaction.dpt_ltr_id=tapal_to_dpt_transaction.dpt_ltr_id) AND (tapal_to_dpt_transaction.ltr_id=incoming_letters_transaction.ltr_id) AND desk_transaction.desk_id_from=(SELECT desk_id FROM login WHERE login_id='$username') order by incoming_letters_transaction.ltr_inword_no DESC LIMIT 100");	
					$rs1=mysql_query($qry1);
					
					while($row1=mysql_fetch_array($rs1))
					{	
						$no=$row1['desk_ltr_id'];
						
						$desk_ltr_inword_no=$row1['desk_ltr_inword_no'];
						
						$receive_dt=strtotime($row1['receive_dt']);
						$priority_days=$row1['priority_days'];
						$ltr_type=$row1['ltr_type'];
						$subject=$row1['subject'];
						
						$ltr_qry=mysql_query("SELECT sandharbh_nm from  sandharbh_master where sandhrbh_id='$ltr_type' ");
						$rss=mysql_fetch_array($ltr_qry);
						
						$sandarbh_nm=$rss['sandharbh_nm'];
						$final_dt =  strtotime("+".$priority_days." days",$receive_dt);
						$final_dt =  date('d-m-Y',$final_dt);
						
						if(isset($_POST['category' . $row1['desk_ltr_id']])) 
						{	
							$ltrcate = $_POST['category' . $row1['desk_ltr_id']];
							$assign_no=$_POST['assign_no'. $row1['desk_ltr_id']];
							
							$send_to=$_POST['nm'. $row1['desk_ltr_id']];
							$mobno=$_POST['mob'. $row1['desk_ltr_id']];
							
							
							
							if($ltrcate=='current')
							{
								if($assign_no!='')
								{
									convert_marathi();
									$qry13=("UPDATE desk_transaction set ltr_category='$ltrcate', assign_no='$assign_no', send_to='$send_to', mobno='$mobno' WHERE desk_ltr_id='$no'");
									$result=mysql_query($qry13) or die("dfdf".mysql_error());
									
									
									/*$sms_api_result = sendSMS($mobno,$desk_ltr_inword_no,$sandarbh_nm,$final_dt,$subject,1);
	
									//echo $mob1.",".$ename.",".$yid.",".$kholi_no.",".$place;
									//echo $sms_api_result[0]."----";
									//echo "<script type='text/javascript'>alert('".$sms_api_result[0]."')</script>";
									
									if ($sms_api_result[0] == 'Message+Sent+Successfully ') 
									{
										//echo "Sent Successful !";
										//echo "300";
									}
									else 
									{
										//print_r($sms_api_result);
										//echo "200";
									}*/
									
									
								}
								else
								{
									echo "<script type='text/javascript'>alert('कृपया संदर्भ क्रमांक निवडा !')</script>";
									echo '<script language="JavaScript"> window.location.href ="performaction.php" </script>';
								}
								
							}
							else  if($ltrcate=='new')
						   {
							   convert_marathi();
								$qry13=("UPDATE desk_transaction set ltr_category='$ltrcate', send_to='$send_to', mobno='$mobno' WHERE desk_ltr_id='$no'");
								$result=mysql_query($qry13) or die("dfdf".mysql_error());
								
								/*$sms_api_result = sendSMS($mobno,$desk_ltr_inword_no,$sandarbh_nm,$final_dt,$subject,1);
	
								//echo $mob1.",".$ename.",".$yid.",".$kholi_no.",".$place;
								//echo $sms_api_result[0]."----";
								//echo "<script type='text/javascript'>alert('".$sms_api_result[0]."')</script>";
								
								if ($sms_api_result[0] == 'Message+Sent+Successfully ') 
								{
									//echo "Sent Successful !";
									//echo "300";
								}
								else 
								{
									//print_r($sms_api_result);
									//echo "200";
								}*/
						   }
						   
						   
						   if($result)
							{ 
								echo "<script type='text/javascript'>alert('Updated Successfully!')</script>";
								echo '<script language="JavaScript"> window.location.href ="performaction.php" </script>';
							}
							else
							{   
								echo "<script type='text/javascript'>alert('Problem to Update!')</script>";
								echo '<script language="JavaScript"> window.location.href ="performaction.php" </script>';
							}
							
						}
					}
					
					
					?>
					
					
					
					
					
					
					
					
				<form class="stdform" action="performaction.php" method="post" name="performaction">
                <table id="dyntable" class="table table-bordered">
                    <thead>
                        <tr>
                            <th class="head0 center">डेस्क <br>आवक क्र.</th>
							<th class="head1 center">डेस्कची <br>प्राप्त_दिनांक</th>
                            <th class="head0 center">डेस्कची <br>स्वीकृत_दिनांक </th>
							<th class="head1 center">संदर्भ क्र./ <br>संदर्भ_दिनांक</th>
							<th class="head0 center">पोलीस अधिक्षक <br> कार्यालय<br>आवक क्र./<br>आवक_दिनांक</th>
                            <th class="head1 center">विभाग आ क्र. /<br> आवक_दिनांक</th>               
							<th class="head0 center">कोणाकडून प्राप्त झाले<br>थोडक्यात विषय</th> 
							<th class="head1 center">संदर्भ लावा </th>
							<th class="head1 center"> कोणास दिले  </th>
                        </tr>
					</thead>
					<tbody>	
						<?php	
						
						convert_marathi();
						$qry8=("SELECT * FROM desk_transaction, incoming_letters_transaction, tapal_to_dpt_transaction WHERE (desk_transaction.ltr_approval='Approve') AND (desk_transaction.ltr_category='')
						AND (desk_transaction.ltr_status!='closed')
						AND (desk_transaction.dpt_ltr_id=tapal_to_dpt_transaction.dpt_ltr_id) AND (tapal_to_dpt_transaction.ltr_id=incoming_letters_transaction.ltr_id) AND desk_transaction.desk_id_from=(SELECT desk_id FROM login WHERE login_id='$username') order by incoming_letters_transaction.ltr_inword_no DESC LIMIT 100");
			
						$rs8=mysql_query($qry8) or die("".mysql_error());
						$cn=mysql_num_rows($rs8);
						//echo $cn;
						while($rws=mysql_fetch_array($rs8))
						{	
							
							$ltr_id= $rws['ltr_id'];
							
							
							$refdt= strtotime($rws['ref_dt']);
							$refdte = date('d-m-Y', $refdt);

							$deskrecdt= strtotime($rws['desk_ltr_rec_dt']);
							$deskrecdte = date('d-m-Y', $deskrecdt);
							 
							$deskappdt= strtotime($rws['desk_apprv_dt']);
							$deskappdte = date('d-m-Y', $deskappdt);
							 
							$dptrecdt= strtotime($rws['dpt_ltr_rec_dt']);
							$dptrecdte = date('d-m-Y', $dptrecdt);
							 
							$recdt=strtotime($rws['receive_dt']);
							$recdte=date('d-m-Y', $recdt);
							
							?>
							<tr class="gradeX">
								<?php 
								$vr=$rws['desk_ltr_id'];
								echo "<td class='center'>".$rws['desk_ltr_inword_no']." </td>
								<td class='center' >".$deskrecdte." </td>
								<td class='center' >".$deskappdte ." </td>
								<td class='center' >".$rws['ref_no']."<br>".$refdte."</td>
								<td class='center' >".$rws['ltr_inword_no']."<br>".$recdte."</td>
								<td class='center' >".$rws['dpt_inword_no']."<br>".$dptrecdte."</td>
								<td>नाव :".$rws['sender_name']."<br>विषय :".$rws['subject']."</td>
								<td style='width:100px;'>
								<label><input type='radio' name='category". $rws['desk_ltr_id']."' value='new' id='rbox1". $rws['desk_ltr_id']."' checked  >नवीन संदर्भ</label><label><input type='radio' name='category".$rws['desk_ltr_id']."' value='current' id='rbox2". $rws['desk_ltr_id']."'>चालू संदर्भ</label>
								
								<br>
								
								<div id='slist". $rws['desk_ltr_id']."'>								
								<select name='assign_no". $rws['desk_ltr_id']."' id='doc_type' style='width:120px;'>
									<option value=>संदर्भ क्र. निवडा </option>";
										$sql12 = "SELECT * FROM incoming_letters_transaction i, tapal_to_dpt_transaction t, desk_transaction d
										WHERE i.ltr_id <> '$row11[ltr_id]' 
										AND d.ltr_category='new' 
										AND t.dpt_ltr_id=d.dpt_ltr_id 
										AND i.ltr_id=t.ltr_id  
										AND t.desk_id=(select desk_id from login where login_id='$username')";
										
										$rslt12 = mysql_query($sql12);
										while($row12 = mysql_fetch_array($rslt12))
										echo"	{
												('<option id='".$row12['ltr_id']."' value='".$row12['ltr_inword_no']."'>".$row12['ltr_inword_no'].'&nbsp;&nbsp;&nbsp;'.$row12['subject'].'&nbsp;&nbsp;&nbsp;'.$row12['sender_name']."</option>')
												}";
										?>
								</select>
								</div>
								</td>
								
								<td> <input type="text" name="<?php echo 'nm'.$rws['desk_ltr_id']; ?>" placeholder=" कोणास दिले " style="width:80%;" lang="mr" class="unicode">
									<br> <input type="text" name="<?php echo 'mob'.$rws['desk_ltr_id']; ?>" placeholder="मोबाईल नं. " style="width:80%;">
								</td>
								
							</tr>
				<?php 	}?>
                    </tbody> 
                </table>
				<p class="stdformbutton">
					<center> <button class="btn btn-primary">बदल करा </button>
					<button type="reset" class="btn">रद्द करा </button>
					</center>
				</p>
				</form>
              <br /><br />
                
			<!--##################### Displaying Approved Letters InData Table To Perform Action ########-->
                <?php include_once('footer.php'); ?>
            </div><!--maincontentinner-->
        </div><!--maincontent-->
    </div><!--rightpanel-->
</div><!--mainwrapper-->
</body>
</html>
<?php
} //end of if(flag=='')



else if($flag=='n')
{
include_once('new_dashboard_department.php');
 require_once('convert_marathi.php');
################################## Displaying Approved Letters InData Table To Perform Action #################################
?>
<!DOCTYPE html>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Tapal Admin System</title>
<?php convert_marathi();	//display data in marathi
	$qry1 =("SELECT * FROM incoming_letters_transaction i, tapal_to_dpt_transaction t WHERE 
	t.status = 'approve'
	AND t.ltr_category = ''
	AND t.ltr_id = i.ltr_id
	AND t.dept_id_from = (
		SELECT dept_id
		FROM login
		WHERE login_id = '$username' 
	)
	ORDER BY i.ltr_inword_no DESC");	
	$rs1=mysql_query($qry1);
	while($row1=mysql_fetch_array($rs1))
		{?>
			<script type="text/javascript">
				$(document).ready(function(){
					var ltr="<?php echo $row1['dpt_ltr_id']; ?>";
					$('#slist'+ltr).fadeOut('fast');
					$('#rbox2'+ltr).change(function(){
						if(this.checked)
						{
							$('#slist'+ltr).fadeIn('slow');
						}
						else
						{
							$('#slist'+ltr).fadeIn('slow');
						}
					});
					$('#rbox1'+ltr).change(function(){
						if(this.checked)
						{
							$('#slist'+ltr).fadeOut('slow');
						}
						else
						{
							$('#slist'+ltr).fadeIn('slow');
						}
					});
				})
			</script>
<?php 	} ?>  
</head>
<body>
	<div class="rightpanel">
		<ul class="breadcrumbs">
            <li><a href="new_dashboard_department.php"><i class="iconfa-home"></i></a> <span class="separator"></span></li>
            <li><a href="new_dashboard_department.php">Tables</a> <span class="separator"></span></li>
            <li>संदर्भ लावा </li>
        </ul>
        <div class="pageheader">
            <div class="pageicon"><span class="iconfa-table"></span></div>
            <div class="pagetitle">
                <h5>Tables</h5>
                <h1>संदर्भ लावा  </h1>
            </div>
        </div><!--pageheader-->
        <div class="maincontent">
            <div class="maincontentinner">
				<h4 class="widgettitle">संदर्भ लावा </h4>  
					<?php
					
					####################### Code To Assign reference Type As New Or Current #########################
					
					require_once('convert_marathi.php');
					$qry1 =("SELECT * FROM incoming_letters_transaction i, tapal_to_dpt_transaction t WHERE 
							t.status = 'approve'
							AND t.ltr_category = ''
							AND t.ltr_id = i.ltr_id
							AND t.dept_id_from = (
								SELECT dept_id
								FROM login
								WHERE login_id = '$username' 
							)
							ORDER BY i.ltr_inword_no DESC");	
					
					$rs1=mysql_query($qry1);
					while($row1=mysql_fetch_array($rs1))
					{	
				
						$no=$row1['dpt_ltr_id'];
						$dpt_inword_no=$row1['dpt_inword_no'];
						
						$receive_dt=strtotime($row1['receive_dt']);
						$priority_days=$row1['priority_days'];
						$ltr_type=$row1['ltr_type'];
						$subject=$row1['subject'];
						
						$ltr_qry=mysql_query("SELECT sandharbh_nm from  sandharbh_master where sandhrbh_id='$ltr_type' ");
						$rss=mysql_fetch_array($ltr_qry);
						
						$sandarbh_nm=$rss['sandharbh_nm'];
						$final_dt =  strtotime("+".$priority_days." days",$receive_dt);
						$final_dt =  date('d-m-Y',$final_dt);
						
						
						if(isset($_POST['category' . $row1['dpt_ltr_id']])) 
						{	
							$ltrcate = $_POST['category' . $row1['dpt_ltr_id']];
							$assign_no=$_POST['assign_no'. $row1['dpt_ltr_id']];
							
							$send_to=$_POST['nm'. $row1['dpt_ltr_id']];
							$mobno=$_POST['mob'. $row1['dpt_ltr_id']];
							
							if($ltrcate=='current')
							{
								if($assign_no!='')
								{
									$qry13=("UPDATE tapal_to_dpt_transaction set ltr_category='$ltrcate', assign_no='$assign_no', send_to='$send_to', mobno='$mobno'  WHERE dpt_ltr_id='$no'");
									$result=mysql_query($qry13) or die("dfdf".mysql_error());
									
									/*$sms_api_result = sendSMS($mobno,$dpt_inword_no,$sandarbh_nm,$final_dt,$subject,2);
	
									//echo $mob1.",".$ename.",".$yid.",".$kholi_no.",".$place;
									//echo $sms_api_result[0]."----";
									//echo "<script type='text/javascript'>alert('".$sms_api_result[0]."')</script>";
									
									if ($sms_api_result[0] == 'Message+Sent+Successfully ') 
									{
										//echo "Sent Successful !";
										//echo "300";
									}
									else 
									{
										//print_r($sms_api_result);
										//echo "200";
									}*/
								}
								else
								{
									echo "<script type='text/javascript'>alert('कृपया संदर्भ क्रमांक निवडा !')</script>";
									echo '<script language="JavaScript"> window.location.href ="performaction.php?flag=n" </script>';
								}
								
							}
							else  if($ltrcate=='new')
						   {
								$qry13=("UPDATE tapal_to_dpt_transaction set ltr_category='$ltrcate', send_to='$send_to', mobno='$mobno' WHERE dpt_ltr_id='$no'");
								$result=mysql_query($qry13) or die("ffff".mysql_error());
								
								/*$sms_api_result = sendSMS($mobno,$dpt_inword_no,$sandarbh_nm,$final_dt,$subject,2);
	
								//echo $mob1.",".$ename.",".$yid.",".$kholi_no.",".$place;
								//echo $sms_api_result[0]."----";
								//echo "<script type='text/javascript'>alert('".$sms_api_result[0]."')</script>";
								
								if ($sms_api_result[0] == 'Message+Sent+Successfully ') 
								{
									//echo "Sent Successful !";
									//echo "300";
								}
								else 
								{
									//print_r($sms_api_result);
									//echo "200";
								}*/
						   }
						   if($result)
							{ 
								echo "<script type='text/javascript'>alert('Updated Successfully!')</script>";
								echo '<script language="JavaScript"> window.location.href ="performaction.php?flag=n" </script>';
							}
							else
							{   
								echo "<script type='text/javascript'>alert('Problem to Update!')</script>";
								echo '<script language="JavaScript"> window.location.href ="performaction.php?flag=n" </script>';
							}
						}
					}
					?>
				<form class="stdform" action="performaction.php?flag=n" method="post" name="performaction">
                <table id="dyntable" class="table table-bordered">
                    <thead>
                        <tr>
                           <!-- <th class="head0 center">डेस्क <br>आवक क्र.</th>
							<th class="head1 center">डेस्कची <br>प्राप्त_दिनांक</th>
                            <th class="head0 center">डेस्कची <br>स्वीकृत_दिनांक </th>-->
							<th class="head1 center"> संदर्भ क्र. / <br> संदर्भ_दिनांक </th>
							<th class="head0 center"> पोलीस अधिक्षक <br> कार्यालय<br> आवक क्र. / <br> आवक_दिनांक </th>
                            <th class="head1 center"> विभाग आ क्र. / <br> आवक_दिनांक</th>               
							<th class="head0 center"> कोणाकडून प्राप्त झाले <br> थोडक्यात विषय </th> 
							<th class="head1 center"> संदर्भ लावा </th>
							<th class="head0 center"> कोणास दिले </th>
                        </tr>
					</thead>
					<tbody>	
						<?php	
						
						convert_marathi();
						$qry8=("SELECT * FROM incoming_letters_transaction i, tapal_to_dpt_transaction t WHERE 
								t.status = 'approve'
								AND t.ltr_category = ''
								AND t.ltr_id = i.ltr_id
								AND t.dept_id_from = (
									SELECT dept_id
									FROM login
									WHERE login_id = '$username' 
								)
								ORDER BY i.ltr_inword_no DESC");
					
						$rs8=mysql_query($qry8) or die("".mysql_error());
						$cn=mysql_num_rows($rs8);
						//echo $cn;
						while($rws=mysql_fetch_array($rs8))
						{	
							/***************************************************************
										fetching dates in dd-mm-yyyy format
										
							****************************************************************/
							$refdt= strtotime($rws['ref_dt']);
							$refdte = date('d-m-Y', $refdt);

							/*$deskrecdt= strtotime($rws['desk_ltr_rec_dt']);
							$deskrecdte = date('d-m-Y', $deskrecdt);
							 
							$deskappdt= strtotime($rws['desk_apprv_dt']);
							$deskappdte = date('d-m-Y', $deskappdt);*/
							 
							$dptrecdt= strtotime($rws['dpt_ltr_rec_dt']);
							$dptrecdte = date('d-m-Y', $dptrecdt);
							 
							$recdt=strtotime($rws['receive_dt']);
							$recdte=date('d-m-Y', $recdt);
							
							?>
							<tr class="gradeX">
								<?php 
								/*$vr=$rws['desk_ltr_id'];
								echo "<td class='center'>".$rws['desk_ltr_inword_no']." </td>
								<td class='center' >".$deskrecdte." </td>
								<td class='center' >".$deskappdte ." </td>";*/
								echo "
								<td class='center' >".$rws['ref_no']."<br>".$refdte."</td>
								<td class='center' >".$rws['ltr_inword_no']."<br>".$recdte."</td>
								<td class='center' >".$rws['dpt_inword_no']."<br>".$dptrecdte."</td>
								<td>नाव :".$rws['sender_name']."<br>विषय :".$rws['subject']."</td>
								<td style='width:100px;'>
								<label><input type='radio' name='category". $rws['dpt_ltr_id']."' value='new' id='rbox1". $rws['dpt_ltr_id']."' >नवीन संदर्भ</label><label><input type='radio' name='category".$rws['dpt_ltr_id']."' value='current' id='rbox2". $rws['dpt_ltr_id']."'>चालू संदर्भ</label>
								<br>
								<div id='slist". $rws['dpt_ltr_id']."'>								
								<select name='assign_no". $rws['dpt_ltr_id']."' id='doc_type' style='width:100px;'>
									<option value=>संदर्भ क्र. निवडा </option>";
										$rslt12 = mysql_query("SELECT *
													FROM incoming_letters_transaction i, tapal_to_dpt_transaction t
													WHERE i.ltr_id <> '$row11[ltr_id]'
													AND t.ltr_category = 'new'
													AND i.ltr_id = t.ltr_id
													AND t.dept_id_from = (
													SELECT dept_id
													FROM login
													WHERE login_id = '$username') ");
										while($row12 = mysql_fetch_array($rslt12))
										echo"	{
												('<option id='".$row12['ltr_id']."' value='".$row12['ltr_inword_no']."'>".$row12['ltr_inword_no'].'&nbsp;&nbsp;&nbsp;'.$row12['subject'].'&nbsp;&nbsp;&nbsp;'.$row12['sender_name']."</option>')
												}";
										?>
								</select>
								</div>
								</td>
								
								<td> <input type="text" name="<?php echo 'nm'.$rws['dpt_ltr_id']; ?>" lang="mr" class="unicode" placeholder=" कोणास दिले " style="width:80%;">
									<br> <input type="text" name="<?php echo 'mob'.$rws['dpt_ltr_id']; ?>" placeholder="मोबाईल नं. " style="width:80%;">
								</td>
							</tr>
				<?php 	}?>
                    </tbody> 
                </table>
				<p class="stdformbutton">
					<center> <button class="btn btn-primary">बदल करा </button>
					<button type="reset" class="btn">रद्द करा </button>
					</center>
				</p>
				</form>
              <br /><br />
                
			<!--##################### Displaying Approved Letters InData Table To Perform Action ########-->
                <?php include_once('footer.php'); ?>
            </div><!--maincontentinner-->
        </div><!--maincontent-->
    </div><!--rightpanel-->
</div><!--mainwrapper-->
</body>
</html>
<?php
}// end of else if($flag=='n')
?>


<?php
function sendSMS($mobno,$no,$sandarbh_nm,$final_dt,$subject,$type) 
{
	$ch = curl_init();

	//$mobno="9657437444";
	
	if($type==1)
	{
		$msg = "http://104.155.195.12/API/WebSMS/Http/v1.0a/index.php?username=opolice&password=opolice&sender=OSMBAD&to=$mobno&message=डेस्क आवक क्र. :".$no." , संदर्भ प्रकार : ".$sandarbh_nm." , विषय : ".$subject." , कार्यवाहीची अंतिम दिनांक : ".$final_dt." &msgtype=unicode";	
	}
	else if($type==2)
	{
		$msg = "http://104.155.195.12/API/WebSMS/Http/v1.0a/index.php?username=opolice&password=opolice&sender=OSMBAD&to=$mobno&message=विभाग आवक क्र. :".$no." , संदर्भ प्रकार : ".$sandarbh_nm." , विषय : ".$subject." , कार्यवाहीची अंतिम दिनांक : ".$final_dt." &msgtype=unicode";	
	}
	
	
	$msg = str_replace(" ","+",$msg);
	
	//curl_setopt($ch, CURLOPT_URL, $request);
	curl_setopt($ch, CURLOPT_URL,$msg);
	
	curl_setopt($ch, CURLOPT_HEADER, 0);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	$response = curl_exec($ch);
	curl_close($ch);
	return split(',',$response);
}
?>