<?php 
include_once('dashboard_tapal.php');
require_once('convert_marathi.php');
$id=$_GET['id'];
######################################### Fill Stamp Details To Dispatched Letters ############################  
?>
<html> 
<head>  
<style type="text/css">
.box123{
display: none;
border: 0px solid #000;
}
</style>
<script type="text/javascript" src="js/adduser.js"></script> 
<script type="text/javascript" src="http://code.jquery.com/jquery.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        $('input[type="radio"]').click(function(){
            if($(this).attr("value")=="current"){
                $(".box123").hide();
                $(".current").show();
            }
            if($(this).attr("value")=="new"){
                $(".box123").hide();
                $(".new").show();
            }
        });
    });
</script>
<script type="text/javascript">
	/*function doCalc1() 	
	{
	
		var ticket1 = parseInt(document.getElementById('tic1').value)*1;
		var ticket2 = parseInt(document.getElementById('tic2').value)*2;
		var ticket5 = parseInt(document.getElementById('tic5').value)*5;
		var total = ticket1 + ticket2 + ticket5 ;
		document.getElementById('total').value= total;
			if(document.getElementById('total').value < 0 )
			{
				alert(" Number of Ticket Can not Be Negative");
			}
	}	*/
	
	function doCalc() 	
	{
		var total=0;
		<?php 
		$q=mysql_query("SELECT stamp_nm,value,stock from stamp_master");
		while($r=mysql_fetch_array($q))
		{
		?>	
			var x='<?php echo $r['value']; ?>';
			var y=document.getElementById(x).value;
			var ab=parseInt(y)*x;
			var total=total+ab;
			document.getElementById('total').value= total;
			if(document.getElementById('total').value < 0 )
			{
				alert(" Number of Ticket Can not Be Negative");
			}
			
			var stk='<?php echo $r['stock']; ?>';
			if(y>stk)
			{
				alert("Insufficient stock available!!!!!!!!");
				document.getElementById(x).value="";
				document.getElementById(x).focus();
			}
			
		<?php
		}
		?>
	}	
</script>
</head>
<body>
    <div class="rightpanel" style="right-margin:auto;">
        <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">
					<?php
						echo "<form class='stdform' action='./connection/allocate_stamp_form_db.php?num=".$id."' method='post' name='allocate_stamp'>";
						$qry1=("SELECT * from dispatched_transaction,incoming_letters_transaction WHERE dispatched_transaction.dispatched_id='$id' AND dispatched_transaction.ltr_id=incoming_letters_transaction.ltr_id");
						
						$rs1=mysql_query($qry1) or die("fddgfd".mysql_error());
						$count=mysql_num_rows($rs1);
						$rw1=mysql_fetch_array($rs1);
						$recdt=strtotime($rw1['receive_dt']);
						$recdte=date('d-m-Y', $recdt);
						$refdt=strtotime($rw1['ref_dt']);
						$refdte=date('d-m-Y', $refdt);
					?>
					<table>
					<tr>
						<td>जावक क्रमांक : </td>
						<td><input type="text" name="ltrinwardno" class="input-small" value="<?php echo $rw1['outword_no']; ?>" readonly />
                        </td>
					</tr>
					<tr>
                       <td> <label>संदर्भ क्रमांक : </label></td>
                        <td><input type="text" name="deskappdt" class="input-small" value="<?php echo $rw1['ref_no']; ?>" readonly />
                        </td>
					</tr>
					<tr>
                       <td> <label>संदर्भ दिनांक : </label></td>
                      <td>  <input type="text" name="deskappdt" class="input-small" value="<?php echo $refdte; ?>" readonly />
                        </td>
					</tr>			
					<tr>
                        <td><label>संदर्भ प्राप्त दिनांक : </label></td>
                        <td><input type="text" name="dptinwardno" class="input-medium" value="<?php echo $recdte; ?>" readonly /></td>
					</tr>
					<tr>
					<td colspan="2">
						<table>
							<tr>
								<td><label style="width:120px;">तिकीटाची माहिती  :</label>&nbsp;&nbsp;&nbsp;</td>
								<?php 
								$q=mysql_query("SELECT stamp_nm from stamp_master");
								while($r=mysql_fetch_array($q))
								{
									echo "<td><label style='width:90px;' style='text-align:center'>".$r['stamp_nm']."</label></td>";
								}
								?>
								<td> <label style="text-align:center">एकूण</label></td>
								</tr>
                            <tr>
								<td><label></label></td>
								<?php 
								$q=mysql_query("SELECT stamp_nm,value from stamp_master");
								while($r=mysql_fetch_array($q))
								{
									echo "<td><label style='width:90px;'><input type='text' name='".$r['value']."' id='".$r['value']."' class='input-small' onKeyup='doCalc();' value='0' size='4'/></label></td> ";
								}
								?>
								<td><label><input type="text" id="total" name="total" class="input-small"/>&nbsp;&nbsp;&nbsp;</label></td>
							</tr>
						</table>
					</td> 					
					</tr>
					<tr>
                        <td><label>रिमार्क : </label> </td>
						<td><input type="text" name="remark" class="input-small unicode"lang="mr" placeholder="Remark"/></td>
					</tr>
					</table>
					<p class="stdformbutton">
						<center> 
                            <input type="submit" class="btn btn-primary" name="update" value="जतन करा " onclick="return validateStampDetails()">
                            <input type="reset" class="btn" value="रद्द करा">
						</center>
                    </p>
					</form>
				<div>  
			</div>	
        </div><!--widgetcontent-->
    </div><!--widget-->           
            <?php
            include_once('footer.php');?>
   </div><!--maincontentinner-->
</div><!--maincontent-->
</div><!--rightpanel-->   
</div><!--mainwrapper-->
</body>
</html>
