<?php ############################################# Code For Letter Entry #####################################################
	include_once('dashboard_tapal.php');
	require_once('convert_marathi.php');
	$username = $_SESSION['User_Name'];
   ?>
<html>   
<head>
<script type="text/javascript" src="js/adduser.js"></script> 

<!-- <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.maskedinput/1.4.1/jquery.maskedinput.js" ></script> -->

<script type="text/javascript">
	$(function(){
	$('#dt').mask("99-99-9999");
	})
	
	
	function disp_sp(val)
	{
		if(val=='shaskiy')
		{
			document.getElementById('ltrtypec_chzn').style.display="block";
		}
		else if(val=='sthanik')
		{
			document.getElementById('ltrtypec_chzn').style.display="none";
		}
	}
	
	function call_me()
	{
		// alert("hhhhhhhhhhh");
		document.getElementById('ltrtypec_chzn').style.display="none";
	}
	
	
</script>
</head>
<body onload="call_me()">
<div class="rightpanel">
    <ul class="breadcrumbs">
        <li><a href="dashboard_tapal.php"><i class="iconfa-home"></i></a> <span class="separator"></span></li>
        <li><a href="dashboard_tapal.php">Forms</a> <span class="separator"></span></li>
        <li>आवक बारनिशी</li>   
    </ul>
	<div class="pageheader">
        <div class="pageicon"><span class="iconfa-pencil"></span></div>
        <div class="pagetitle">
            <h5>Forms</h5>
            <h1>आवक बारनिशी</h1>
        </div>
    </div><!--pageheader-->   
        <div class="maincontent">
            <div class="maincontentinner">
				<div class="widget">
					<h4 class="widgettitle">आवक बारनिशी</h4>
					<div class="widgetcontent">
						<form enctype="multipart/form-data" class="stdform" action="./connection/letterentrynew.php?username=<?php echo $username;?>" method="post" name="avakbarnishi">
							<?php
							################################# Generating Inward Number #########################################
							 $year = date('y');
							//$r = mysql_query("SELECT MAX(ltr_inword_no)AS id FROM incoming_letters_transaction WHERE ltr_inword_no  like '$year%'");
				$r = mysql_query("SELECT ltr_inword_no FROM incoming_letters_transaction WHERE ltr_inword_no  like '$year%'");
							while($row1 = mysql_fetch_array($r))
							{
							 $Auto_increment =$row1['ltr_inword_no'];
							}
							//$Auto_increment =$row1['id']; //got auto inc in d form of 15-0049
							// echo "AAA: ".$Auto_increment;
							$start='0000001';
							if ($Auto_increment != '')
							{
								list($a,$b) = Explode("-",$Auto_increment); // specifies to break d string at '-'
								if ($a==$year)
								{
								//  echo "<br>".$b;
									$c= str_pad($b + 1, 6, 0, STR_PAD_LEFT);
								
									$n = $year ."-". $c;
									//echo "<br>".$n;
								}
								else
								{
									$c= str_pad($b + 1, 6, 0, STR_PAD_LEFT);
									$n =  $year."-". $c;
								}
							}
							else
							{
								$n =$year."-". $start;
							}
							################################# End OF Generating Inward Number ######################################
							?>
							<table width="100%">
								<tr>
									<td><label>आवक क्रमांक : </label></td>
									<td> <input type="text" name="ltrinwardno" class="input-small" value="<?php echo $n;?>" placeholder="" readonly  lang="mr"/></td>	
									
									<td style=""><label style=""> संदर्भाचा प्रकार :</label></td>
									<td> <input type="radio" name="sp" value="sthanik" onclick="disp_sp(this.value);"> स्थानिक &nbsp;&nbsp;
										 <input type="radio" name="sp" value="shaskiy" onclick="disp_sp(this.value);"> शासकीय
									</td>
								</tr>
								<tr>
									<td><label style="">संदर्भ क्रमांक : </label></td>
									<td><input type="text" name="refno" placeholder="ref no" class="unicode" lang="mr"/></td>
									<td style=""><label style="">संदर्भ दिनांक :</label></td>
									<td> <input type="text" id="dt" name="refdate" placeholder="dd-mm-yyyy"/></td>
								</tr>
								<tr>
									<td><label style="">संदर्भ प्राप्त दिनांक : </label></td>
									<td><input  type="text" id="dt" name="recdate" placeholder="dd-mm-yyyy"/></td>
									<td><label style="width:120px;">कोणाकडून प्राप्त झाले : </label></td>
									<td> <input type="text" name="sendernm" class="unicode" placeholder="Sender name" lang="mr"></td>
								</tr>
								<tr>
									<td><label style="">थोडक्यात विषय : </label></td>
									<td><textarea cols="80" rows="2" class="unicode" lang="mr" name="sub"></textarea></td>
									<td><label> संदर्भाचा प्रकार : </label></td>
									<td>  
									<?php
									
									$query = "SELECT  * FROM sandharbh_master where sandhrbh_id!='27' "; 
							        convert_marathi();
									$result = mysql_query ($query);
									echo "<select name='ltrtypec' class='chzn-select' id='ltrtypec' style='display:none;' ><option value=>संदर्भाचा प्रकार निवडा </option>";
									while($row = mysql_fetch_array($result))
                                      {
										echo"{
												('<option id='".$row['sandhrbh_id']."' value='".$row['sandhrbh_id']."'>".$row['sandharbh_nm']."</option>')
											}";
                                      }
									echo "</select>";
									?>
									
									</td>
								</tr>
								<tr>
									<td><label  for="email">ईमेल आय डी :</label></td>
									<td><input type="text" name="email" id="email" /></div></td>
									<td style=""><label>मोबाइल नंबर : </label></td>
									<td> <input type="text" name="mobno" placeholder="Mobile Number"/></td>
								</tr>
								<tr>
									<td><label>पत्ता  : </label></td>
									<td><textarea cols="80" rows="2" class="unicode" lang="mr" name="add"></textarea> </td>
									<td><label>प्राथमिकता लावा : </label></td>
									<td><select name="priodays" id="priodays">
											<option value="0">प्राथमिकता लावा</option>
											<option value="1"> 1 day </option>
											<option value="5"> 5 days </option>
											<option value="7"> 7 days </option>
											<option value="15"> 15 days </option>
											<option value="20"> 20 days </option>
										</select>
									</td>
								</tr>
							</table>
						<div class="par">
							<label for="upload" style="">कागदपत्र जोडा : </label>
							<div class="fileupload fileupload-new" data-provides="fileupload">
								<div class="input-append">
									<div class="uneditable-input" style="margin-Left:135px;">
										<i class="iconfa-file fileupload-exists"></i>
										<span class="fileupload-preview"></span></td>
									</div>
									<span class="btn btn-file"><span class="fileupload-new">कागदपत्र निवडा </span>
									<span class="fileupload-exists">बदल करा</span>
									<input id="upload" type="file" name="uploadedimage" accept="image/jpeg,image/gif,image/png"/></span>
									<a href="#" class="btn fileupload-exists" data-dismiss="fileupload">रद्द करा </a>
								</div>
							</div>
						</div>
						<div>  				 
							<p class="stdformbutton">
								<center> <button class="btn btn-primary" onclick="return validateAvakbarnishi()">जतन करा </button>
								<button type="reset" class="btn">रद्द करा  </button> </center>
							</p>
						</div>
                    </form>
				</div><!--widgetcontent-->
            </div><!--widget-->
            <?php include_once('footer.php');?>  
       </div><!--maincontentinner-->
    </div><!--maincontent-->   
</div><!--rightpanel-->   
</div><!--mainwrapper-->
</body>
</html>
