<? 
session_start();
include("../test.php");
include("../opendb.php");
include("../includes/function.php");
include("../calstock.php");

if(strlen($user)<=0)
{
  print "<script> alert('Invalid User'); document.location='inde.php' </script>";
  return;
}
$qry=mysqli_query($db,"select * from journal2 where jvno='$jvno'  and brcode='$brcode'");

if(mysqli_num_rows($qry)<=0)
{
 print"<script>alert('invalid receipt number');document.location='print_cshrec1.php';</script>";
} 
else
{
 print "<script>window.print();</script>";
}


?>
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>World Wide Automotive Center</title>
<style>



.tble1 input {
background-color:transparent;
border: 0px solid;
height:20px;
//width:160px;
color:black;
}
.tble1 { 
border:1px solid black;
border-collapse:collapse;
}
.tble1 td{ 
border-right: 1px solid black;
}	
.tble1 th{ 
border-right: 1px solid black;
border-bottom: 1px solid black;
}
table 
{
font-size:11px;
}

</style>

            
       <br>

<?
$qry=mysqli_query($db,"select * from journal2 where jvno='$jvno' and  type='Dr' and brcode='$brcode'");
$qry1=mysqli_query($db,"select * from journal2 where jvno='$jvno' and  type='Dr' and brcode='$brcode'");
$qry2=mysqli_query($db,"select * from journal2 where jvno='$jvno' and  type='Cr' and brcode='$brcode'");
$row=mysqli_fetch_array($qry);       
$date = $row[0];
$newDate = date("d-m-Y", strtotime($date));
$sql=mysqli_query($db,"select * from journal2 where jvno='$jvno' and j_type='BR' and brcode='$brcode'");
$sql1=mysqli_fetch_array($sql);


?>                                    


<center >

<font style="font-size:8 px;font-style:bold;"><b><? print $addr1[2];?></font></b></br>
<? print $addr1[3].", ".$addr1[4];?>
<h4>Bank Receipt Number:<?print $sql1[tr_no];?> </h4></center >
<table width=100%>



</table>

<table width=100% class='tble1' >

<tr border='1'><th >Sl No <th >Dr <th>Amt<th>Narr<th>Against<th>Value</tr>

<?
$i=1;
while($row=mysqli_fetch_array($qry1))
  {
   
   print "<tr><td>".$i."</td><td>".$row[partic]."</td><td align='right'>" .$row[dramt]."</td><td align='right'>".$row[narr]."</td><td align='right'>".$row[against]."</td><td align='right'>".$row[no]."</td>";
$dramttot+=$row[dramt];
$i++;
  }
?>
</table>
<br>
<br>
<table width=100% class='tble1' >

<tr border='1'><th >Sl No <th >Cr <th>Amt<th>Narr<th>Against<th>Value</tr>
<?
$j=1;
while($row2=mysqli_fetch_array($qry2))
  {
   
   print "<tr><td>".$j."</td><td>".$row2[partic]."</td><td align='right'>" .$row2[cramt]."</td><td align='right'>".$row2[narr]."</td><td align='right'>".$row2[against]."</td><td align='right'>".$row2[no]."</td>";
$cramttot+=$row2[cramt];
$j++;
  }
?>



       <table align='right' width=20%> <tr><td>                

                  <b>Total Debit Amount</b>
              
    </td>
               

                  <td>:</td> <td> <b><? echo $dramttot;?></b>

                </td></tr>

 <tr><td>                

                  <b>Total Credit Amount</b>
              
    </td>
               

                  <td>:</td> <td> <b><? echo $cramttot;?></b>

                </td></tr></table>

    <br><br><br><br>
<script type="text/javascript" src="tabjs/jquery_004.js"></script>
    <script type="text/javascript">

        $('#default_notes_textarea, #to_address, #from_address').jqEasyCounter({
            'maxChars': 1000,
            'maxCharsWarning': 980,
            'msgFontSize': '10px',
            'msgFontColor': 'silver',
            'msgFontFamily': 'Arial',
            'msgTextAlign': 'right',
            'msgWarningColor': 'red',
            'msgAppendMethod': 'insertAfter',
            'allocateSpace': true
        });
        
        reCalculate(document.getElementById('sum_discount'),'dataTable','0.00');

        function loadReceiptLayer(obj){
            var to_id = $('#to_name').val();

            if (obj.checked){
                $('#receipts_layer').show(100, function(){
                    if (!$(this).attr('rloaded')){
                        $(this).attr('rloaded','true');
                        $('#receipts_layer').html('<img src="images/loadingsmall.gif">');

                        $.ajax({

                            url: "showExpenses.php?action=displayReceiptList&customer_id="+to_id+"&list=",
                            type: 'GET',
                            cache: false,
                            async: true,
                            dataType : 'json',
                            success:function(response){
                                if (response && response.success)
                                    $('#receipts_layer').html(response.html);
                                else
                                    $('#receipts_layer').html('Fail to load. Try Again');
                            },
                            error:function(){
                                $('#receipts_layer').html('There was an error. Try Again');
                            }
                        });




                    }
                }) ;
            }
            else{
                $('#receipts_layer').hide();
            }
        }

        $(function(){
            /*
            $('#to_name').change(function(){
                $('#receipts_layer').attr('rloaded','');
                document.getElementById('receipts_include').checked = false;
                $('#receipts_layer').hide();

            });
            */



        });
        $('#receipts_include').click(function(){


            var obj = $('#receipts_layer');
            if (document.getElementById('receipts_include').checked){


                if (obj.attr('rloaded') == 'true'){
                    obj.show();
            <b><b elssssssshbuhuuhbuhb);
     }else{
                obj.hide();
            }



        })

    </script>


    
						
		
		
		<!-- end main table wrapper -->
		</td></tr></tbody></table>
		
</body></html>


