<?
include_once("includes/top.php");
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='inde.php'; </script>";
 return;
}
include_once("opendb.php");
include_once("test.php");
$jvno=$_REQUEST['jvno'];
$query=mysqli_query($db,"select date from journal2 where jvno='$jvno' and brcode='$brcode'");
$dtrw=mysqli_fetch_array($query);
$dt=$dtrw[0];
?>
<title>Kerala Khadi and Village Industries Board</title>
<link type="text/css" href="jquery/jquery-ui.min.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="cal/jquery-ui1.js"></script>
<script type="text/javascript" src="jquery/jquery-1.7.min.js"></script>
<script type="text/javascript" src="jquery/jquery-ui.min.js"></script>
<script type="text/javascript" src="jquery/jquery.jqEasyCharCounter.min.js"></script>
<script type="text/javascript">
  $(function() {
    $( "#dt" ).datepicker({ dateFormat: 'yy-mm-dd' });

  });
 
  </script>
<body background="/back_ground.jpg">
<?php //include('logo1.php'); ?>
<?php //include('top.php'); ?>
<br>

<script type="text/javascript">
 var rawTags;
   var inputField;
   var  initInputFieldValue;
   var dataList;
    var initNbVirgules;

$(function(){
$(".cr").live("keydown.autocomplete",function(){
$cr = $(this);
$row = $cr.parent().parent();
$(this).autocomplete({
		source: function(request, response ) {

		$.ajax({
			url: "searchled.php",
			dataType: "json",
			data: "key="+$cr.val(),
			success: function( data ) {
				response( $.map( data, function( item ) {


					return {
						label: '<span class="la-code">'+item.cr+' </span><span class="la-name">'+  item.cbal + '</span><span class="la-stok"> '+ item.stock +'</span><span class="la-rate"> '+item.rate +'</span>'    ,
						value: item.cr,
						name:item.cbal,
						tax:item.tax,

						stock:item.stock,
						rate:item.rate,
						reduct:item.reduct,


					}
				}));
			}
		});
	}

,
	minLength: 2,
	select: function( event, ui ) {
        $row.find('.cr').val(ui.item.cr);       
        $row.find('.cbal').val(ui.item.name);
	$row.find('.stok').val(ui.item.stock);
	$row.find('.unitprice').val(ui.item.rate);
	$row.find('.tax').val(ui.item.tax);
	$row.find('.itmvl').val(ui.item.reduct);
	$row.find('.cr_amt').focus();

	 }

	}).data("ui-autocomplete")._renderItem = function (ul, item) {
         return $("<li></li>")
             .data("item.autocomplete", item)
             .append( item.label )
             .appendTo(ul);
     };


});

});

function closingbal(str,r)
{
var i=r.parentNode.parentNode.rowIndex;
var tbl = document.getElementById('myTable2');
var id1=tbl.rows[i].cells[0].innerHTML;
 if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("clb").innerHTML=xmlhttp.responseText;
    var  clbal= document.getElementById("clbal").value;
    document.getElementById('cbal'+id1).value=clbal;
    }
  }


xmlhttp.open("GET","getclbal_crec.php?led="+str+"&& id="+id1,true);
xmlhttp.send();
}
function showHint()
{
document.getElementById("popScroll2").innerHTML="<img src='images/loader.GIF' />";

if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("popScroll2").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","cshrec/view_cshrec1.php", true);
xmlhttp.send();
}



function viewinv()
{
 var str=document.getElementById('jvno').value;
document.getElementById("popScroll2").innerHTML="<img src='images/loader.GIF' />";


if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("popScroll2").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","cshrec/view_cshrec.php?jvno="+str,true);
xmlhttp.send();
}

</script>


<style>
.la-code {
    display: inline-block;
    width: 200px;
}

#mask {
	display: none;
	background:url(images/bgimg1.gif) repeat;
	//background: #000; 
	position: fixed; left: 0; top: 0; 
	z-index: 10;
	width: 100%; height: 100%;
	opacity: 0.8;
	z-index: 999;
}

.login-popup{
		display:none;
	background:white;
	padding: 10px; 	
	border: 2px solid #ddd;
	float: left;
	font-size: 1.2em;
	position: fixed;
	top: 4%; left: 45%;
	z-index: 99999;
	box-shadow: 0px 0px 20px #999;
	-moz-box-shadow: 0px 0px 20px #999; /* Firefox */
    -webkit-box-shadow: 0px 0px 20px #999; /* Safari, Chrome */
	border-radius:3px 3px 3px 3px;
    -moz-border-radius: 3px; /* Firefox */
    -webkit-border-radius: 3px; /* Safari, Chrome */
}


img.btn_close {
	float: right; 
	margin: -28px -28px 0 0;
}

fieldset { 
	border:none; 
}

form.signin .textbox label { 
	display:block; 
	padding-bottom:7px; 
}

form.signin .textbox span { 
	display:block;
}

form.signin p, form.signin span { 
	color:white; 
	font-size:11px; 
	line-height:18px;
} 

form.signin .textbox input { 
	background:#666666; 
	border-bottom:1px solid #333;
	border-left:1px solid #000;
	border-right:1px solid #333;
	border-top:1px solid #000;
	color:white; 
	border-radius: 3px 3px 3px 3px;
	-moz-border-radius: 3px;
    -webkit-border-radius: 3px;
	font:13px Arial, Helvetica, sans-serif;
	padding:6px 6px 4px;
	width:200px;
}

form.signin input:-moz-placeholder { color:white; text-shadow:0 0 2px #000; }
form.signin input::-webkit-input-placeholder { color:hwite; text-shadow:0 0 2px #000;  }

.submit button { 
	background: -moz-linear-gradient(center top, #f3f3f3, #dddddd);
	background: -webkit-gradient(linear, left top, left bottom, from(#f3f3f3), to(#dddddd));
	background:  -o-linear-gradient(top, #f3f3f3, #dddddd);
    filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#f3f3f3', EndColorStr='#dddddd');
	border-color:#000; 
	border-width:1px;
	border-radius:4px 4px 4px 4px;
	-moz-border-radius: 4px;
    -webkit-border-radius: 4px;
	color:#333;
	cursor:pointer;
	display:inline-block;
	padding:6px 6px 4px;
	margin-top:10px;
	font:12px; 
	width:100px;
}

.button:hover { background:#ddd; }


.del{
      border: none;
     background: url("images/delete.png") no-repeat scroll 0 0 transparent;
}
</style>


<script>

$(document).ready(function() {
	$('a.login-window').click(function() {
		
		// Getting the variable's value from a link 
		var loginBox = $(this).attr('href');

		//Fade in the Popup and add close button
		$(loginBox).fadeIn(300);
		
		//Set the center alignment padding + border
		var popMargTop = ($(loginBox).height() + 24) / 2; 
		var popMargLeft = ($(loginBox).width() + 24) / 2; 
		
		$(loginBox).css({ 
			'margin-top' : -popMargTop,
			'margin-left' : -popMargLeft
		});
		
		// Add the mask to body
		$('body').append('<div id="mask"></div>');
		$('#mask').fadeIn(300);
		
		return false;
	});
	
	// When clicking on the button close or the mask layer the popup closed
	$('a.close, #mask').live('click', function() { 
	  $('#mask , .login-popup').fadeOut(300 , function() {
		$('#mask').remove();  
	}); 
	return false;
	});
});


 $(document).ready(function(){
  $("#svbttn").click(function(){

$("#msgbox").html('<small>Loading...</small>');
      

    	// var name= $(this).attr('name');

    	 //$('#type_name').val(name);
   
  	 var values1 = $("#jforms").serialize();
         //alert(values1);
 	// $(".typeselecter").attr("disabled", true);
 	 // $("#td1").html('');

  	  $.ajax({
   	   url: "updcshrec.php",
    	  type: "POST",
   	  data:   values1,
     	  success: function(msg){          

           	 if(parseInt(msg)!=0)    

          	  {

                $('#msgbox').html(msg);
               // $("#load").html(''); 
                //$(".typeselecter").attr("disabled", false);  
		}
           

      	},
      error:function(){
          alert("failure");
          $("#msgbox").html('there is error while submit');
      }   
   	 }); 

	 }); 
	 }); 

</script>

<script type="text/javascript">

function handleEnter (field, event) {
               
		var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
		if (keyCode == 13) {
			var i;
			for (i = 0; i < field.form.elements.length; i++)
				if (field == field.form.elements[i])
					break;
			i = (i + 1) % field.form.elements.length;
			field.form.elements[i].focus();
			return false;
		} 
		else
		return true;
	}      



function counttot(r,val)
{
var i=r.parentNode.parentNode.rowIndex;
var str1=0;
 var tbl = document.getElementById('myTable');
   var id1=tbl.rows[i].cells[0].innerHTML;

if(isNaN(val))
  {
  alert('Enter Digit');
 document.getElementById("dr_amt"+id1).value=0;
  
  }
else
 {

  
var n=document.getElementById('myTable').rows.length-1;
var m;
for(m=1;m<=n;m++)	
    {
     var tbl1 = document.getElementById('myTable');
     var id2=tbl1.rows[m].cells[0].innerHTML;
    var itemval = document.getElementById("dr_amt"+id2).value;
    
        str1=parseFloat(str1)+parseFloat(itemval); 
         //alert (id2);
     }
    
  document.getElementById("dbtot").value= str1.toFixed(2);
}
}
function countcrtot(r,val)
{
var i=r.parentNode.parentNode.rowIndex;
var str1=0;

   var tbl = document.getElementById('myTable2');
   var id1=tbl.rows[i].cells[0].innerHTML;

if(isNaN(val))
  {
  alert('Enter Digit');
 document.getElementById("cr_amt"+id1).value=0;
  
  }
else
 {
var n=document.getElementById('myTable2').rows.length-1;
var m;
for(m=0;m<=n;m++)	
    {
     var tbl1 = document.getElementById('myTable2');
     var id2=tbl1.rows[m].cells[0].innerHTML;
    var itemval = document.getElementById("cr_amt"+id2).value;
    
         str1=parseFloat(str1)+parseFloat(itemval); 
        
     }
  document.getElementById("crtot").value= str1.toFixed(2);
  document.getElementById("dbtot").value= str1.toFixed(2);
}
}
</script>



<script type="text/javascript">

var tq=0,tq2=0;
var cur=1;
var cnt=1;
var vv;
var drs=[];
var crs=[];
var type=[];
var dr=[];
var dr_amt=[];
var dr_narr=[];
var dragain=[];
var dragval=[];



//************************************
function calcdr()
{
var tq=0;
for(i=1;i<cur;i++)
{
 var ele='dr'+i; //alert(ele);
 if(document.getElementById(ele).value>0)
  {
   amount=document.getElementById(ele).value;
   tq+=parseFloat(amount);
  }
 }
document.f1.tdamt.value=tq.toFixed(2);
}






function valid()
{
 calccr();
 calcdr();
var d1=parseFoloat(document.f1.d.value);
 var m1=parseFoloat(document.f1.m.value);
 var y1=parseFoloat(document.f1.y.value);

 if(d1<=0||m1<=0||y1<=0)
 {
  alert('Invalid Date');
  return false;
 }
 if(document.f1.tdamt.value==document.f1.tcamt.value)
   return true;
 else
   {alert('Dr, Cr Amount mis-match'); return false;}
}





</script>



<style>
.cont
	{
	background-color:#3b5998;

	//background:url(images/bg-inner.jpg) #e9e0c3 repeat-x;
  	width: 100%;position: absolute ;
	height:99%;
    	/* Optional - just for DIV)*/
    	//border: solid 1px #000000;
	-moz-box-shadow: 0px 5px 5px #888;
	-webkit-box-shadow: 0px 5px 5px #888;
	box-shadow: 0px 5px 10px #888;
    }
.tble1 input {
background-color:transparent;
border: 0px solid;
height:20px;
//width:160px;
color:black;
}
.tble1
{
border-collapse:collapse;
border:1px solid silver;

}	
.tble1 td
{
//border-collapse:collapse;
border:1px solid silver;

}
</style>





<style >
.toggleFilterLink					{ 	text-decoration:underline;font-family:arial; font-size:12px; color:#1869B8; cursor:pointer; }

		

		

		.divWithCustomizationLinkTable  { width:100%;margin:0px; margin-top:10px; padding:0px;background-color:#FFFADC;border-top:2px solid #FCF5CD; border-bottom:2px solid #FCF5CD;padding:5px;padding-left:12px; }		

		.divWithCustomizationLinkIMG	{ margin:0px;padding:0px;}

		.topRowTax_class				{ }

		.invoiceDataHeadRow 			{ height:33px;}

		.invoiceDataDelete				{ padding-left:4px; border-left:1px solid #eaedee;border-bottom:1px solid #eaedee;width:14px;height:14px; cursor:pointer; vertical-align:top; padding-top:7px;}

		.invoiceDataItem 				{ border-bottom:1px solid #eaedee; vertical-align:top;padding-left:4px; }

		.inputInvoiceDataItem			{ outline:none;border:0px solid white; padding:5px; padding-top:5px;padding-left:1px; width:86px; font-weight:normal; font-family:verdana;font-size:13px;color:#3c3c3c;}

		.invoiceDataDescription 		{ border-bottom:1px solid #eaedee;border-left:1px solid #eaedee;vertical-align:top; }

		.inputInvoiceDataDescription 	{ outline:none; overflow:hidden;border:0px solid white; padding:5px; width:304px; font-weight:normal; font-family:verdana;font-size:13px;color:#3c3c3c; }

		html.en .inputInvoiceDataDescription_wTAX2 	{ outline:none; overflow:hidden;border:0px solid white; padding:5px; width:219px; font-weight:normal; font-family:verdana;font-size:13px;color:#3c3c3c; }
        html.fr .inputInvoiceDataDescription_wTAX2 	{ outline:none; overflow:hidden;border:0px solid white; padding:5px; width:211px; font-weight:normal; font-family:verdana;font-size:13px;color:#3c3c3c; }

		.inputInvoiceDataPriceOrQty 	{ outline:none;border:0px solid white;text-align:right;width:100px; padding:5px; font-family:verdana;font-size:13px; color:silver;}



		.invoiceDataPriceOrQty			{ vertical-align:top;text-align:right;border-bottom:1px solid #eaedee;border-left:1px solid #eaedee;}

		html.en .inputInvoiceDataPriceOrQty_wTAX 	{ width:72px;outline:none;border:0px solid white;text-align:right; padding:5px; font-family:verdana;font-size:13px; color:silver;}
        html.fr .inputInvoiceDataPriceOrQty_wTAX 	{ width:68px;outline:none;border:0px solid white;text-align:right; padding:5px; font-family:verdana;font-size:13px; color:silver;}



		.invoiceDataTax_hidden			{ display:none;vertical-align:top;text-align:right;border-bottom:1px solid #eaedee;border-left:1px solid #eaedee;}

		.invoiceDataTax_visible			{ vertical-align:top;text-align:right;border-bottom:1px solid #eaedee;border-left:1px solid #eaedee;}

		.invoiceDataTax_percentage		{ border:0px solid red; float:right;padding-right:5px;padding-top:6px;width:15px;color:silver;font-family:verdana;font-size:12px;font-weight:normal;}

		.inputInvoiceDataTax		 	{ width:45px;outline:none;border:0px solid white;text-align:right; padding:5px; font-family:verdana;font-size:13px; color:silver;}

		

		.invoiceDataAmount				{ background-color:#eaedee;background-image:url(images/grey.png);background-repeat:repeat-x repeat-y;vertical-align:top;text-align:right;padding-right:4px;border-right:1px solid #eaedee;border-bottom:1px solid #eaedee;border-left:1px solid #eaedee;}

		.inputInvoiceDataAmount_wTAX 		{ width:72px; background-image:url(images/grey.png);background-repeat:repeat-x repeat-y;background-color:#eaedee;border:0px solid white;text-align:right; padding:5px; font-weight:normal; font-family:verdana;font-size:13px;color:#3c3c3c;}

		.inputInvoiceDataAmount 		{ background-image:url(images/grey.png);background-repeat:repeat-x repeat-y;background-color:#eaedee;border:0px solid white;text-align:right; width:100px; padding:5px; font-weight:normal; font-family:verdana;font-size:13px;color:#3c3c3c;}

		.toggleCustomizationLink		{ text-decoration:underline;font-family:arial; font-size:14px; color:#1869B8; cursor:pointer; }

		.divWithCustomization			{ width:100%;position:relative;background-color:white; border:1px solid #D1D1D1; margin:0px;margin-top:5px; margin-bottom:25px;padding-bottom:20px;}		

		.customization_itemsRow			{ height:18px;}

		.customization_itemsCellDelete  { width:17px;padding-left:0px; padding-top:0px;border-bottom:0px solid #d1d1d1;}

		.customization_itemsCellText	{ width:160px;border-bottom:0px solid #d1d1d1}

		.invoiceForm_fromNameTD			{ border-top:1px solid #ABADB3;border-left:1px solid #ABADB3; border-bottom:1px solid #E3E9EF;border-right:1px solid #DBDFE6;}

		.invoiceForm_fromNameTD:hover	{ border-top:1px solid #3D7BAD;border-left:1px solid #B5CFE7; border-bottom:1px solid #B7D9ED;border-right:1px solid #A4C9E3;}

		.invoiceForm_fromNameTD_onFocus	{ border:1px solid #54A0E7; background-color:#FFFADC;}

		.invoiceForm_logoBrowse 		{ 

		 font-size: 45px;

		 position: absolute;

		 right: -3px;

		 top: -3px;

		 opacity: 0;

		 filter: 

		 alpha(opacity=0);

		 -ms-filter: "alpha(opacity=0)";

		 -khtml-opacity: 0;

		 -moz-opacity: 0; 

		 }
		
.darkClass
{
    background-color: white;
    filter:alpha(opacity=50); /* IE */
    opacity: 0.5; /* Safari, Opera */
    -moz-opacity:0.50; /* FireFox */
    z-index: 20;
    height: 1000px;
    width: 100%;
    background-repeat:no-repeat;
    background-position:center;
    position:absolute;
    top: 400px;
    left: 0px;
}		
		
		

		.invoiceForm_uploadArea 		{position:relative; margin-top:-14px; margin-right:0px;float:right; text-align:right; width:300px; align:right; height:125px; border:1px dashed #d1d1d1;background-color:#FFFADC;}

		.invoiceForm_uploadAreaNoBg		{position:relative; margin-top:-14px; margin-right:0px;float:right; text-align:right; width:300px; align:right; height:125px; border:1px dashed #d1d1d1;}

		.invoiceForm_uploadArea_done	{position:relative; margin-top:-16px; margin-right:0px;float:right; text-align:right; width:300px; align:right; }

		.invoiceForm_uploadArea_hidden	{display:none; }

		.invoiceForm_uploadField		{float:right;margin-right:0px; margin-bottom:0px; margin-top:3px; position: relative;width: 73px;height: 22px;overflow: hidden;}

		.invoiceForm_uploadField_hidden	{display:none;}





		@media screen and (-webkit-min-device-pixel-ratio:0) {

    	/* Webkit-specific CSS here */

		.invoiceDataTax_percentage { border:0px solid red; float:right;padding-right:5px;padding-top:8px;width:15px;color:silver;font-family:verdana;font-size:12px;font-weight:normal;}		

		}

		 .saveButton { height:36px;width:139px;background-image:url(images/graph_button.png);background-repeat:no-repeat;border:0px;font-family:verdana;font-size:12px;color:#616161;padding-bottom:5px;font-weight:bold;}
		 .saveButton:hover { height:36px;width:139px;background-image:url(images/graph_button.png);background-repeat:no-repeat;border:0px;font-family:verdana;font-size:12px;color:black;padding-bottom:5px;font-weight:bold;cursor:pointer;}




		</style>

		

   	 

 	   

  	   	<!--[if lte IE 7]>

   	   	<style>

       	.send_button				{ margin-top:3px;}	  

		.inputInvoiceDataItem		{ outline:none;border:0px solid white; padding:5px; margin-top:5px;padding-left:1px; width:80px; margin-right:6px; font-weight:normal; font-family:verdana;font-size:13px;color:#3c3c3c;}

		.divWithCustomizationLinkTable   { width:100%;margin:0px; margin-top:10px; padding:0px;background-color:#FFFADC;border-top:2px solid #FCF5CD; border-bottom:2px solid #FCF5CD;padding:3px;padding-left:10px; }		

		.divWithCustomizationLinkIMG	{ margin:0px;padding:0px;padding-top:4px;}		    

	   	</style>

	   	<![endif]-->

 	   
				



   <style>

        table.my-account-menu a.my-account-menu-item {

            font-family:verdana;
            color:#1869B8;
            text-decoration:none;
            font-size:13px;
            margin-left:5px;
            padding:2px 5px 4px 5px;
        }

        table.my-account-menu a.my-account-menu-item.menu-selected{
            background: #54A0E7;
            color: #fff;


        }

        table.aynax-main-menu {
            width:100%;
            background-image:url(images/menu_background5.png);
            background-repeat:repeat-x;

        }

        table.aynax-main-menu ul.inner-table{
            width:800px;
            margin: 0 auto !important;
            list-style-type: none;

        }

        table.aynax-main-menu li.inner-table-td {
            position: relative;
            padding:0px;
            text-align:center;
            display:inline;
            height: 34px;
            float: left;
            margin: 0;
        }

        table.aynax-main-menu li.inner-table-td a{

            position: relative;
            top: 4px;
            text-decoration:none;
            color:#3c3c3c;
            font-size:13px;
            font-family:verdana;
            font-weight:normal;
            margin-right: 20px;
        }

        table.aynax-main-menu.ie li.inner-table-td a{

            position: relative;
            top: 4px;
            text-decoration:none;
            color:#3c3c3c;
            font-size:13px;
            font-family:verdana;
            font-weight:normal;
            margin-right: 15px;
        }


        table.aynax-main-menu li.inner-table-td div{

            height:26px;
            padding-left: 20px;
        }

        table.aynax-main-menu.ie li.inner-table-td div{

            height:26px;
            padding-left: 20px;
        }

        table.aynax-main-menu.ie li.inner-table-td.menu-selected div{

            height:26px;
            padding-left: 19px;
        }



        table.aynax-main-menu.ie li.inner-table-td.menu-selected a{
            color:#fff;
        }

        table.aynax-main-menu li.inner-table-td.menu-selected a{

            color:#fff;
        }


        table.aynax-main-menu .menu-selected {
            background: url("images/menu-main-bg.png") no-repeat scroll center top transparent;

        }



        .left-light-gray-border{
            position:relative;
            border-left:solid 1px #ccc;
            top: 0px;
        }

        .right-light-gray-border{
            position:relative;
            border-right:solid 1px #ccc;
            top: 0px;
        }

        .right-light-none-border{
            position:relative;
            border-right:solid 1px transparent;
            top: 0px;
        }

        .left-light-none-border{
            position:relative;
            border-left:solid 1px transparent;
            top: 0px;
        }

   </style>



<body style="text-align: center; height:100%;width:100%;margin: 0 auto !important;">
            <input id="cid" name="cid" value="6059949" type="hidden">
       
        	<table id="main_table_wrapper" style="top: 0px; width: 800px; margin: 0px auto ! important; text-align: left;" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td>
		<table style="width:100%; margin:0px;padding:0px;margin:0 auto;margin-bottom:5px;" border="0" cellpadding="0" cellspacing="0"><tbody><tr>
		<td style="text-align:left;padding-top:15px;">
		<h1 style="font-size:20px;font-weight:bold;font-family:verdana;color:#FFFFFD;margin:0px; padding:0px;">


     <?
  $r=mysqli_query($db,"select * from journal2 where jvno='$jvno' and type='Dr' and brcode='$brcode'") or die(mysqli_error($db));
   $r1=mysqli_fetch_row($r);
    $typ=$r1[8];    
    $no=$r1[11] ;
       if( $typ=='CR')
          {
            print "Cash Receipt Number:". $no;
          }

       if( $typ=='CP' )
          {
            print "Cash Payment Number:". $no;
          }
       if($typ=='BP')
          {
            print "Bank Payment Number:". $no;
          }
       if( $typ=='BR')
          {
            print "Bank Receipt Number:". $no;
          }

       if($typ=='JV')
          {
            print "Journal Number:". $jvno;
          }
?>
	
		</h1>
		</td>
		</tr>
		</tbody></table>
		
        <table style="width:100%;margin:0px;padding:0px;padding-bottom:10px;" cellpadding="0" cellspacing="0">
        <tbody><tr>
        <td colspan="100" style="text-align:left;" width="100%">

        <!-- TB 3 -->

        <table style="padding:0px; margin:0px;text-align:left;" cellpadding="0" cellspacing="0" width="100%">

        <tbody><tr>      
        

            


        <td style="width:200px; padding-top:0px;margin:0px;text-align:left;">&nbsp;

        </td>



            
            <td style="padding-top:0px;margin:0px;text-align:right;">

              <!--  <form method="post" action="" >-->

                      <a href="#login-box" class="login-window" style="text-decoration:none;"> <input  style="height:32px;width:110px;" value="Save" type="button" id='svbttn'></a>


             <!--   </form>-->

            </td>

                
        </tr>
  
        </tbody></table> <!-- TB 3 -->

        </td>

        </tr>



        </tbody></table>





    <form name="invoice_form"  id="jforms"  >      

            <input name="status" id="status" value="" type="hidden">
        
    <table id="invoiceFormWrapper" style="width:100%;margin:0px;padding:0px;margin-top:0px;border:0px solid black;" border="0" cellpadding="0" cellspacing="0">




    <tbody><tr>


<td width="100%" style="text-align:left;border-left:1px solid silver;border-top:1px solid silver;border-right:2px solid silver;border-bottom:2px solid silver;padding-left:20px;padding-right:20px; padding-top:15px; padding-bottom:15px;" colspan="100" bgcolor="white">
    <!-- TB 3 -->

  <table width="100%" cellspacing="0" cellpadding="0" border="0" style="padding:0px; :0px;text-align:left;" >
<tbody>






    <tr>

    <td>

    <!-- TB 4 -->

    <table border="0" cellpadding="0" cellspacing="0"><tbody>

    <tr>

        <td style="vertical-align:bottom;">



            <!-- TB 5 -->

            <table style="width:100%; height:100%; vertical-align:bottom;border:1px solid white;" border="0" cellpadding="0" cellspacing="0"> 
                <tbody><tr><td style="width:155px;"></td><td></td><td></td></tr>



                <tr><td colspan="3">

                                                            <div id="invoiceHeadlineWhenLogo" style="display:none; float:right; vertical-align:top;margin-top:5px;margin-bottom:20px;text-align:right;letter-spacing:3px;font-size:22px;color:#3c3c3c;font-weight:normal;font-family:arial;">
                        <br>
                        <input id="invoice_heading_copy" onchange="document.getElementById('invoice_heading').value=this.value" style="text-align:right; padding-top:3px; padding-bottom:3px; padding-right:8px; width:200px; font-weight:normal; letter-spacing:3px; font-family:arial;font-size:22px;color:#3c3c3c;" class="invoiceForm_fromNameTD" onfocus="this.className='invoiceForm_fromNameTD_onFocus';" onblur="this.className='invoiceForm_fromNameTD';" value="INVOICE" type="text">
                    </div>


                </td>
                </tr>              
               

    <tr>                             


                <!-- TB 5 -->

            </tbody></table>

        </td>

    </tr>





    <!-- TB 4 -->

    </tbody></table>



    </td>

    </tr>



    <tr><td colspan="100" style="width:100%;vertical-align:top;padding-top:35px;">



        <!-- TB 4 -->

    <!-- TB 4 -->

 <font > Journal No: <?print $jvno?></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Date  <input type=text name='dt' id="dt" readonly value='<? echo $dt; ?>'>
<br>
<!--<form name=f1 action='updjour.php' method='post' onSubmit="return valid()">-->


<input type=hidden name='jvno' value='<?print $jvno?>'>


<br><br>
Debit 
<br>&nbsp;
<table id="myTable" border="1" class=report>
<?
$req=mysqli_query($db,"select * from ledger where brcode='$brcode' and grp!='Cash in hand' order by led");
$i=0;
while($rowq=mysqli_fetch_row($req))
{
 print "\n<script>drs[$i]='$rowq[0]' </script>";
 $i++;
}

$re2=mysqli_query($db,"select * from journal2 where jvno='$jvno' and type='Dr' and brcode='$brcode'") or die(mysqli_error($db));
print "<script> cur=".mysqli_num_rows($re2)."; </script>";
 
 print "<th>Sl  <th>Particulars <th> Amount <th>Narr<th> Cl.Bal ";
$j=1;
$dbamttot=0;
while($row=mysqli_fetch_array($re2))
{
  print "<tr><td>".$j."</td>";
    
 print "<td><input type=text name='dr[]' id='dr$j'  value='$row[partic]' readonly autocomplete='off' list='htmlListTags'  ></td>";

 print "</td><td><input type=text name='dr_amt[]' id='dr_amt$j' value='$row[dramt]' readonly onKeyPress='return handleEnter(this, event)' size=12></td>";
 print "<td><input type=text name='dr_narr[]' id='dr_narr$j' value='$row[narr]' size=35 onKeyPress='return handleEnter(this, event)'></td>";
  print " <td><input type=text name='dbal[]' id='dbal$k' value='' class='dbal' readonly size=35 onKeydown='return handleEnter(this, event)'></td>";

$dbamttot+=$row[dramt];
$j++;
print "<script>cur++;</script>";
print "<script>cnt++;</script>";
}
print "</tr></table>";
?>
<hr>
Credit 
<!--<input type='button' onclick='delRow2(this)' value=' - '>-->
<!--<input type='button' onclick='calccr()' value=' CALCULATE CREDIT SUM  '>-->
<br>&nbsp;
<table id="myTable2" border="1" class=report>
<?
$re2=mysqli_query($db,"select * from journal2 where jvno='$jvno' and type='Cr' and brcode='$brcode'") or die(mysqli_error($db));
$k=1;
$cramttot=0;
while($row=mysqli_fetch_array($re2))
{
$re=mysqli_query($db,"select * from ledger where led='$row[partic]' and grp ='Sundry Debtors' and brcode='$brcode'") or die("ERR6:".mysqli_error($db));
$ledrow=mysqli_fetch_array($re);
$balres=mysqli_query($db,"select sum(dramt),sum(cramt) from journal2 where brcode='$brcode' and partic='$row[partic]'");
 $balrow=mysqli_fetch_row($balres);
 if($ledrow[drcr]=='Dr')
 {
 $bal=($balrow[0]+$ledrow[2])-$balrow[1];
 }
 else
 {
 $bal=$balrow[1]+$ledrow[2]-$balrow[0];
 }
 print "<tr><td>".$k."</td>";
 print "<td><input type='text' name='cr[]' id='cr$k' class='cr' value='$row[partic]'  autocomplete='off' list='htmlListTags' ></td>";

 print "\n<td><input type=text name='cr_amt[]' id='cr_amt$k' value='$row[cramt]' class='cr_amt' size=12 onchange='countcrtot(this,this.value)' onKeydown='return handleEnter(this, event)'></td>";
 print " <td><input type=text name='cr_narr[]' id='cr_narr$k' value='$row[narr]' class='cr_narr' size=35 onKeydown='return handleEnter(this, event)'></td>";
print " <td><input type=text name='cbal[]' id='cbal$k' value='$bal' class='cbal' readonly size=35 onKeydown='return handleEnter(this, event)'></td>";

 
$cramttot+=$row[cramt];
$k++;
print "<script>cur2++;</script>";
print "<script>cnt2++;</script>";
}
print "</tr></table>";
?>
<datalist id="htmlListTags"></datalist>

<input type='hidden' name='savecount' id='savecount' value='0'>
</form>


<div id="login-box" class="login-popup">
        <a href="#" class="close"><img src="images/close_pop.png" class="btn_close" title="Close Window" alt="Close" /></a>
          <div id='msgbox'></div>
		</div>



    <tr>

        <td style="padding-top:10px;margin:0px;text-align:left;">

          
        </td>

    </tr>



    <tr><td>&nbsp;</td></tr>

    <tr><td>&nbsp;</td></tr>



    <tr>

    <td>

    <!-- TB 4 -->

    <table border="0" cellpadding="0" cellspacing="0" width="100%">



    <tbody>





 <tr>

                <td style="width:15px; border-top:2px solid #eaedee;">
  <?
  $rs=mysqli_query($db,"select * from journal2 where jvno='$jvno' and type='Dr' and brcode='$brcode'") or die(mysqli_error($db));
   $rs1=mysqli_fetch_row($rs);
    $typ=$rs1[8];    
    $no=$rs1[11] ;
       if( $typ=='CR')
          {
            print "<a href='cshrec.php' style='text-decoration:none;'><img src='images/back.png'/></a>";
          }

       if( $typ=='CP' )
          {
            print "<a href='cshpay.php' style='text-decoration:none;'><img src='images/back.png'/></a>";
          }
       if($typ=='BP')
          {
            print "<a href='brec.php' style='text-decoration:none;'><img src='images/back.png'/></a>";
          }
       if( $typ=='BR')
          {
            print "<a href='bpay.php' style='text-decoration:none;'><img src='images/back.png'/></a>";
          }

       if($typ=='JV')
          {
            print "<a href='jour.php' style='text-decoration:none;'><img src='images/back.png'/></a>";
          }
?>
	</td>
        <td style="width:15px; border-top:2px solid #eaedee;" colspan="5"></td>
                <td colspan="4" align="right" style="border-top:2px solid #eaedee;font-family:verdana; font-size:13px; color:#3c3c3c; font-weight:bold;padding-top:7px;" colspan="3" align="right">

                    Total Debit Amount
                </td>

                <td style="padding-top:7px; text-align:right;padding-right:4px;border-right:1px solid white;border-top:2px solid #eaedee;border-left:1px solid white;">

                    <input onclick="alert('The total is calculated automatically as soon as you have entered something into amount field.')" style="border:0px solid white;text-align:right; width:100px; padding-right:5px; font-weight:normal; font-family:verdana;font-size:13px;color:#3c3c3c;" readonly="readonly"  name='tdamt' id='dbtot' type="text" value='<? echo $dbamttot; ?>'>

                </td>

            </tr>
            
            
            <tr>
                <td style="width:15px; border-top:2px solid #eaedee;"></td>
             <td style="width:15px; border-top:2px solid #eaedee;" colspan="5"></td>
           

                <td style="border-top:2px solid #eaedee;font-family:verdana; font-size:13px; color:#3c3c3c; font-weight:bold;padding-top:7px;" align="right" colspan="4">

                    Total Credit Amount
                </td>

                <td style="padding-top:7px; text-align:right;padding-right:4px;border-right:1px solid white;border-top:2px solid #eaedee;border-left:1px solid white;">

                    <input style="border:0px solid white;text-align:right; width:100px; padding-right:5px; font-weight:normal; font-family:verdana;font-size:13px;color:#3c3c3c;" readonly="readonly"  name='tcamt' id='crtot' type="text" value='<? echo $cramttot; ?>'>

                </td>

            </tr>

            <!-- TB 5 -->

        </tbody></table>


    </tbody></table>

    </td>


    </tr>



    <!-- TB 3 -->

    </tbody></table>

    </td>



    </tr>

    <!-- TB 2 -->

    </tbody></table>

  </form>

    <br><br><br><br>
						
		
		
		<!-- end main table wrapper -->
		</td></tr></tbody></table>
		
</body></html>
<script type="text/javascript">

$(document).bind('keydown', 'Alt+n',function (e){
      
    if(e.which==78 && e.altKey){
	 //alert (e.which);
        shortkey_tblopen();
        return false;
    } 
    if(e.which==83 && e.ctrlKey) {
e.preventDefault()
 $( "#svbttn" ).click();
        return false;
} 
   if(e.which==82 && e.altKey){
	 
         window.location.reload(true);
        return false;
    } 
      
    
});
</script>


