|
Server IP : 2a02:4780:11:1359:0:1d43:a566:2 / Your IP : 216.73.216.20 Web Server : LiteSpeed System : Linux in-mum-web1259.main-hosting.eu 4.18.0-553.37.1.lve.el8.x86_64 #1 SMP Mon Feb 10 22:45:17 UTC 2025 x86_64 User : u490972518 ( 490972518) PHP Version : 5.6.40 Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail MySQL : ON | cURL : ON | WGET : ON | Perl : OFF | Python : OFF Directory (0755) : /home/u490972518/domains/ppschool.org.in/public_html/sale/code/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
include("../php-includes/connect.php");
$flag=$_REQUEST['flag'];
switch($flag)
{
case 1:
$owner_name=$_POST['owner_name'];
$gender=$_POST['gender'];
//echo $sponser_name;
$mobile=$_POST['mobile'];
$center_name=$_POST['center_name'];
$address=$_POST['address'];
$username=$_POST['user_name'];
$password=$_POST['password'];
$center_code=$_POST['center_code'];
//echo $side;
$date=date("Y-m-d");
date_default_timezone_set("asia/kolkata");
$time=date("h:i:sa");
$datetime=$date." ".$time;
////////////////////for code left right
$sel="select * from center_add where username='$username' order by id desc";
$res=mysqli_query($conn,$sel);
$row=mysqli_fetch_array($res,MYSQLI_BOTH);
$sel2="select * from center_add where center_code='$center_code' order by id desc";
$res2=mysqli_query($conn,$sel2);
$row2=mysqli_fetch_array($res2,MYSQLI_BOTH);
if(!$row)
{
if(!$row2)
{
$ins="INSERT INTO `center_add` (`owner_name`, `center_name`, `address`, `mobile`, `gender`, `username`, `password`, `date`,`time`,`status`,`center_code`) VALUES ('$owner_name', '$center_name', '$address', '$mobile', '$gender', '$username', '$password', '$date', '$time', '', '$center_code');";
if(mysqli_query($conn,$ins))
{
echo 'add Successfully';
}
else
{
echo 'not add';
}
}
else
{
echo 'Center Code Already Exist Please Another Center Code';
}
}
else
{
echo 'Username Already Exist Please Another Username';
}
break;
case 100:
$supplier_name=$_POST['supplier_name'];
$address=$_POST['address'];
$mobile=$_POST['mobile'];
$id=$_POST['id'];
//echo $side;
$date=date("Y-m-d");
date_default_timezone_set("asia/kolkata");
$time=date("h:i:sa");
$datetime=$date." ".$time;
////////////////////for code left right
if($id=='')
{
$ins="INSERT INTO `supplier` (`supplier_name`,`address`,`mobile`,`status`) VALUES ('$supplier_name','$address','$mobile','')";
if(mysqli_query($conn,$ins))
{
echo 'add Successfully';
}
else
{
echo 'not add';
}
}
else
{
$up="update supplier set supplier_name='$supplier_name',address='$address',mobile='$mobile' where id='$id'";
if(mysqli_query($conn,$up))
{
echo 'Update Successfully';
}
}
break;
case 101:
$sel="select * from supplier where status='' order by id desc";
$res=mysqli_query($conn,$sel);
?>
<script>
$(document).ready(function() {
$('#example').DataTable( {
fixedHeader: true,
dom: 'Bfrtip',
lengthMenu: [
[ 10, 25, 50, -1 ],
[ '10 rows', '25 rows', '50 rows', 'Show all' ]
],
buttons: [
'pageLength','print',
{ extend: 'pdfHtml5', footer: true,
orientation: 'protland',
pageSize: 'LEGAL'
}
]
} );
} );
</script>
<div class="table-responsive">
<table id="example" class="display nowrap" cellspacing="0" width="100%" border="1px">
<thead>
<tr>
<th>Sr No.</th><th>Supplier Name</th><th>Supplier Address</th><th>Mobile</th><th>Action</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Sr No.</th><th>Supplier Name</th><th>Supplier Address</th><th>Mobile</th><th>Action</th>
</tr>
</tfoot>
<tbody>
<?php
$s=1;
while($row=mysqli_fetch_array($res,MYSQLI_BOTH))
{
?>
<tr>
<td><?php echo $s++;?></td><td><?php echo $row['supplier_name'];?></td><td><?php echo $row['address'];?></td><td><?php echo $row['mobile'];?></td><td><a href="supplier_update.php?flag=<?php echo $row['id']?>" ><span class="glyphicon glyphicon-pencil"></span></a> <a href="javascript:;" onclick="deleterow(<?php echo $row['id'];?>)"><span class="glyphicon glyphicon-trash"></span></a></td>
<?php
}
?>
</tr>
</tbody>
</table>
</div>
<?php
break;
case 102:
$id=$_POST['rowid'];
$del="update supplier set status='Delete' where id='$id'";
if(mysqli_query($conn,$del))
{
echo"deleted Successfully";
}
else
{
echo"Not Deleted";
}
break;
case 103:
$supplier_id=$_POST['supplier_id'];
$product_name=$_POST['product_name'];
$class=$_POST['class'];
$price=$_POST['price'];
$area=$_POST['area'];
$qty=$_POST['qty'];
$date_ad=$_POST['date_add'];
$invoice=$_POST['invoice'];
$id=$_POST['id'];
$product_code=$_POST['product_code'];
$session=$_POST['session'];
//echo $side;
$date=date("Y-m-d");
date_default_timezone_set("asia/kolkata");
$time=date("h:i:sa");
$datetime=$date." ".$time;
////////////////////for code left right
if($id=='')
{
$ins="INSERT INTO `product` (`supplier_id`,`product_name`,`area`,`date_ad`,`date`,status,class,product_code,session,price,invoice) VALUES ('$supplier_id','$product_name','$area','$date_ad','$date','','$class','$product_code','$session','$price','$invoice')";
if(mysqli_query($conn,$ins))
{
$sel1="select * from product where product_code='$product_code' order by id desc";
$res1=mysqli_query($conn,$sel1);
$row1=mysqli_fetch_array($res1,MYSQLI_BOTH);
$product_id=$row1['id'];
$ins="INSERT INTO `product_add` (`supplier_id`,`product_name`,`area`,`qty`,`date_ad`,`date`,status,class,product_code,product_id,session,price,invoice) VALUES ('$supplier_id','$product_name','$area','$qty','$date_ad','$date','','$class','$product_code','$product_id','$session','$price','$invoice')";
if(mysqli_query($conn,$ins))
{
echo 'add Successfully';
}
}
else
{
echo 'not add';
}
}
else
{
$up="update product set supplier_id='$supplier_id',product_name='$product_name',area='$area',class='$class',price='$price',invoice='$invoice' where id='$id'";
if(mysqli_query($conn,$up))
{
$up="update product_add set supplier_id='$supplier_id',product_name='$product_name',area='$area',class='$class',price='$price',invoice='$invoice' where product_id='$id'";
mysqli_query($conn,$up);
echo 'Update Successfully';
}
}
break;
case 104:
$sel1="select * from session order by id desc";
$res1=mysqli_query($conn,$sel1);
$row1=mysqli_fetch_array($res1,MYSQLI_BOTH);
$session=$_POST['session'];
$sel="select * from product where status='' and session='$session' order by id desc";
$res=mysqli_query($conn,$sel);
?>
<script>
$(document).ready(function() {
$('#example').DataTable( {
fixedHeader: true,
dom: 'Bfrtip',
lengthMenu: [
[ 10, 25, 50, -1 ],
[ '10 rows', '25 rows', '50 rows', 'Show all' ]
],
buttons: [
'pageLength','print','excel',
{ extend: 'pdfHtml5', footer: true,
orientation: 'protland',
pageSize: 'LEGAL'
}
]
} );
} );
</script>
<div class="table-responsive">
<table id="example" class="display nowrap" cellspacing="0" width="100%" border="1px">
<thead>
<tr>
<th>Sr No.</th><th>Supplier Name</th><th>Product Name</th><th>Class</th><th>Area</th><th>Price</th><th>Total Qty Add</th><th>Total Qty Sale</th><th>Total Qty Return</th><th>Qty Left</th><th>Action</th>
</tr>
</thead>
<tbody>
<?php
$s=1;
$t_p=0;
$t_r=0;
$t_sale=0;
while($row=mysqli_fetch_array($res,MYSQLI_BOTH))
{
$supplier_id=$row['supplier_id'];
$sel1="select * from supplier where id='$supplier_id' and status='' order by id desc";
$res1=mysqli_query($conn,$sel1);
$row1=mysqli_fetch_array($res1,MYSQLI_BOTH);
$prduct_id=$row['id'];
$sel11="select * from sale where product_id='$prduct_id' and status='' and session='$session' and scholar!='' order by id desc";
$res11=mysqli_query($conn,$sel11);
$sale=0;
while($row11=mysqli_fetch_array($res11,MYSQLI_BOTH))
{
$sale=$row11['sale_qty']+$sale;
}
$t_sale=$sale+$t_sale;
$sel111="select * from product_add where product_id='$prduct_id' and session='$session' and status='' order by id desc";
$res111=mysqli_query($conn,$sel111);
$tot_p=0;
while($row111=mysqli_fetch_array($res111,MYSQLI_BOTH))
{
$tot_p=$row111['qty']+$tot_p;
}
$t_p=$tot_p+$t_p;
$sel1112="select * from product_return where product_id='$prduct_id' and session='$session' and status='' order by id desc";
$res1112=mysqli_query($conn,$sel1112);
$tot_r=0;
while($row1112=mysqli_fetch_array($res1112,MYSQLI_BOTH))
{
$tot_r=$row1112['qty']+$tot_r;
}
$t_r=$tot_r+$t_r;
?>
<tr>
<td><?php echo $s++;?></td><td><?php echo $row1['supplier_name'];?></td><td><?php echo $row['product_name'];?></td><td><?php echo $row['class'];?></td><td><?php echo $row['area'];?></td><td><?php echo $row['price'];?></td><td><?php echo $tot_p;?></td><td><?php echo $sale;?></td><td><?php echo $tot_r;?></td><td><?php echo $tot_p-$sale-$tot_r;?></td><td><a href="book_update.php?flag=<?php echo $row['id']?>" ><span class="glyphicon glyphicon-pencil"></span></a> <a href="javascript:;" onclick="editrow(<?php echo $row['id'];?>)"><span class="glyphicon glyphicon-plus"></span></a> <a href="show_product_add.php?flag=<?php echo $row['id']?>" >Show Add</a></td>
<?php
}
?>
</tr>
<tfoot>
<tr>
<th>Sr No.</th><th>Supplier Name</th><th>Product Name</th><th>Class</th><th>Area</th><th>Price</th><th><?php echo $t_p;?></th><th><?php echo $t_sale;?></th><th><?php echo $t_r;?></th><th><?php echo $t_p-$t_sale-$t_r;?></th><th>Action</th>
</tr>
</tfoot>
</tbody>
</table>
</div>
<?php
break;
case 105:
$id=$_REQUEST['id'];
$sel1="select * from product_add where id='$id' and status='' order by id desc";
$res1=mysqli_query($conn,$sel1);
$row1=mysqli_fetch_array($res1,MYSQLI_BOTH);
?>
<form id='myform' autocomplete="on">
<div class="col-lg-12">
</div>
<div class="col-lg-12">
<div class="form-group">
<label>Product Name</label>
<input type="hidden" name="id" value='<?php echo $id?>' required>
<input type="text" name="product_name" value="<?php echo $row1['product_name']?>" data-validation="required" class="form-control" required>
</div>
</div>
<div class="col-lg-12">
<div class="form-group">
<label>Class</label>
<input type="text" readonly value="<?php echo $row1['class']?>" data-validation="required" class="form-control" required>
</div>
</div>
<div class="col-lg-12">
<div class="form-group">
<label>Qty</label>
<input type="number" name="qty" value="<?php echo $row1['qty']?>" data-validation="required" class="form-control" required>
</div>
</div>
<div class="col-lg-12">
<div class="form-group">
<label>Date Add</label>
<input type="date" name="date_add" value="<?php echo $row1['date_ad']?>" data-validation="required" class="form-control" required>
</div>
</div>
<div class="col-lg-6">
<br/>
<div class="form-group">
<button id='btn' class='btn btn-primary'>Update</button>
</div>
</form>
<?php
break;
case 106:
$id=$_POST['id'];
$qty=$_POST['qty'];
$date_ad=$_POST['date_add'];
$date=date("Y-m-d");
date_default_timezone_set("asia/kolkata");
$time=date("h:i:sa");
$datetime=$date." ".$time;
////////////////////for code left right
$up="update product_add set qty='$qty',date_ad='$date_ad' where id='$id'";
if(mysqli_query($conn,$up))
{
echo 'Update Successfully';
}
break;
case 107:
$id=$_POST['rowid'];
$del="update product_add set status='Delete' where id='$id'";
if(mysqli_query($conn,$del))
{
echo"deleted Successfully";
}
else
{
echo"Not Deleted";
}
break;
case 108:
$id=$_REQUEST['id'];
$sel1="select * from product where id='$id' and status='' order by id desc";
$res1=mysqli_query($conn,$sel1);
$row1=mysqli_fetch_array($res1,MYSQLI_BOTH);
$sel11="select * from session_sale order by id desc";
$res11=mysqli_query($conn,$sel11);
$row11=mysqli_fetch_array($res11,MYSQLI_BOTH);
?>
<form onsubmit="return updaterow(this)">
<div class="col-lg-12">
</div>
<div class="col-lg-12">
<div class="form-group">
<label>Session</label>
<input type="text" name="session" value="<?php echo $row11['session']?>" data-validation="required" class="form-control" readonly required>
</div>
</div>
<div class="col-lg-12">
<div class="form-group">
<label>Product Name</label>
<input type="hidden" name="id" value='<?php echo $id?>' required>
<input type="hidden" name="supplier_id" value="<?php echo $row1['supplier_id']?>" required>
<input type="hidden" name="supplier_id" value="<?php echo $row1['supplier_id']?>" required>
<input type="hidden" name="product_code" value="<?php echo $row1['product_code']?>" required>
<input type="hidden" name="area" value="<?php echo $row1['area']?>" required>
<input type="hidden" name="price" value="<?php echo $row1['price']?>" required>
<input type="text" readonly name="product_name" value="<?php echo $row1['product_name']?>" data-validation="required" class="form-control" required>
</div>
</div>
<div class="col-lg-12">
<div class="form-group">
<label>Class</label>
<input type="text" readonly name='class' value="<?php echo $row1['class']?>" data-validation="required" class="form-control" required>
</div>
</div>
<div class="col-lg-12">
<div class="form-group">
<label>Invoice</label>
<input type="text" name='invoice' data-validation="required" class="form-control" required>
</div>
</div>
<div class="col-lg-12">
<div class="form-group">
<label>Qty</label>
<input type="number" name="qty" data-validation="required" class="form-control" required>
</div>
</div>
<div class="col-lg-12">
<div class="form-group">
<label>Date Add</label>
<input type="date" name="date_add" value='<?php echo date('Y-m-d')?>' data-validation="required" class="form-control" required>
</div>
</div>
<div class="col-lg-6">
<br/>
<div class="form-group">
<button id='btn' class='btn btn-primary'>Add</button>
</div>
</form>
<?php
break;
case 109:
$supplier_id=$_POST['supplier_id'];
$product_name=$_POST['product_name'];
$class=$_POST['class'];
$area=$_POST['area'];
$qty=$_POST['qty'];
$date_ad=$_POST['date_add'];
$product_id=$_POST['id'];
$product_code=$_POST['product_code'];
$session=$_POST['session'];
$price=$_POST['price'];
$invoice=$_POST['invoice'];
//echo $side;
$date=date("Y-m-d");
date_default_timezone_set("asia/kolkata");
$time=date("h:i:sa");
$datetime=$date." ".$time;
////////////////////for code left right
$ins="INSERT INTO `product_add` (`supplier_id`,`product_name`,`area`,`qty`,`date_ad`,`date`,status,class,product_code,product_id,session,price,invoice) VALUES ('$supplier_id','$product_name','$area','$qty','$date_ad','$date','','$class','$product_code','$product_id','$session','$price','$invoice')";
if(mysqli_query($conn,$ins))
{
echo 'add Successfully';
}
else
{
echo 'not add';
}
break;
case 110:
$session=$_POST['session'];
$class=$_POST['class'];
$invoice=$_POST['invoice'];
$sel="select * from product where status='' and session='$session' and class='$class' order by id desc";
$res=mysqli_query($conn,$sel);
$date=date("Y-m-d");
date_default_timezone_set("asia/kolkata");
$time=date("h:i:sa");
?>
<script>
$(document).ready(function() {
$('#example').DataTable( {
fixedHeader: true,
dom: 'Bfrtip',
lengthMenu: [
[ 10, 25, 50, -1 ],
[ '10 rows', '25 rows', '50 rows', 'Show all' ]
],
buttons: [
'pageLength','print',
{ extend: 'pdfHtml5', footer: true,
orientation: 'protland',
pageSize: 'LEGAL'
}
]
} );
} );
</script>
<div class="table-responsive">
<table id="example" class="display nowrap" cellspacing="0" width="100%" border="1px">
<thead>
<tr>
<th>Sr No.</th><th>Product Name</th><th>Class</th><th>Area</th><th>Price</th><th> Qty Add</th><th>Action</th>
</tr>
</thead>
<tbody>
<?php
$s=1;
$t_p=0;
$t_sale=0;
while($row=mysqli_fetch_array($res,MYSQLI_BOTH))
{
$t_sale=$row['price']+$t_sale;
$sale_amount=$row['price'];
$product_id=$row['id'];
$ins="INSERT INTO `sale` (`product_id`,`sale_qty`,`sale_amount`,`scholar`,`date`,`time`,status,session,invoice) VALUES ('$product_id','1','$sale_amount','','$date','$time','','$session','$invoice')";
if(mysqli_query($conn,$ins))
{
echo 'add Successfully';
}
else
{
echo 'not add';
}
?>
<tr>
<td><?php echo $s++;?></td><td><?php echo $row['product_name'];?></td><td><?php echo $row['class'];?></td><td><?php echo $row['area'];?></td><td><?php echo $row['price'];?></td><td>1</td><td><a href="javascript:;" onclick="deleterow('<?php echo $row['id'];?>','<?php echo $invoice;?>')"><span class="glyphicon glyphicon-trash"></span></a></td>
<?php
}
?>
</tr>
<tfoot>
<tr>
<th>Sr No.</th><th>Product Name</th><th>Class</th><th>Area</th><th><?php echo $t_sale ;?></th><th><?php echo $t_p++;?></th><th>Action</th>
</tr>
</tfoot>
</tbody>
</table>
</div>
<?php
break;
case 111:
$id=$_POST['rowid'];
$del="delete from sale where id='$id'";
if(mysqli_query($conn,$del))
{
echo 'Delete';
}
else
{
echo"Not Deleted";
}
break;
case 112:
$invoice=$_POST['invoice'];
$sel="select * from sale where status='' and invoice='$invoice' order by id desc";
$res=mysqli_query($conn,$sel);
$date=date("Y-m-d");
date_default_timezone_set("asia/kolkata");
$time=date("h:i:sa");
?>
<script>
$(document).ready(function() {
$('#example').DataTable( {
fixedHeader: true,
dom: 'Bfrtip',
lengthMenu: [
[ 10, 25, 50, -1 ],
[ '10 rows', '25 rows', '50 rows', 'Show all' ]
],
buttons: [
'pageLength','print',
{ extend: 'pdfHtml5', footer: true,
orientation: 'protland',
pageSize: 'LEGAL'
}
]
} );
} );
</script>
<div class="table-responsive">
<table id="example" class="display nowrap" cellspacing="0" width="100%" border="1px">
<thead>
<tr>
<th>Sr No.</th><th>Product Name</th><th>Class</th><th>Area</th><th>Price</th><th> Qty Add</th><th>Action</th>
</tr>
</thead>
<tbody>
<?php
$s=1;
$t_p=0;
$t_sale=0;
while($row=mysqli_fetch_array($res,MYSQLI_BOTH))
{
$product_id=$row['product_id'];
$sel11="select * from product where id='$product_id' and status='' order by id desc";
$res11=mysqli_query($conn,$sel11);
$row11=mysqli_fetch_array($res11,MYSQLI_BOTH);
$t_sale=$row['sale_qty']+$t_sale;
$t_p=$row11['price']*$row['sale_qty']+$t_p;
?>
<tr>
<td><?php echo $s++;?></td><td><?php echo $row11['product_name'];?></td><td><?php echo $row11['class'];?></td><td><?php echo $row11['area'];?></td><td><?php echo $row11['price']*$row['sale_qty'];?></td><td><?php echo $row['sale_qty']?></td><td><a href="javascript:;" onclick="deleterow(<?php echo $row['id'];?>)"><span class="glyphicon glyphicon-trash"></span></a></td>
<?php
}
?>
</tr>
<tfoot>
<tr>
<th>Sr No.</th><th>Product Name</th><th>Class</th><th>Area</th><th><?php echo $t_p++ ;?></th><th><?php echo $t_sale;?></th><th>Action</th>
</tr>
</tfoot>
</tbody>
</table>
</div>
<?php
break;
case 113:
$from=$_POST['from'];
$end=$_POST['end'];
// $session=$_POST['session'];
$sel="select * from paid where date between '$from' and '$end' and status='' order by id asc";
$res=mysqli_query($conn,$sel);
?>
<script>
$(document).ready(function() {
$('#example').DataTable( {
fixedHeader: true,
dom: 'Bfrtip',
lengthMenu: [
[ 10, 25, 50, -1 ],
[ '10 rows', '25 rows', '50 rows', 'Show all' ]
],
buttons: [
'pageLength','print',
{ extend: 'pdfHtml5', footer: true,
orientation: 'protland',
pageSize: 'LEGAL'
}
]
} );
} );
</script>
<div class="table-responsive">
<table id="example" class="display nowrap" cellspacing="0" width="100%" border="1px">
<thead>
<tr>
<th>Sr No.</th><th>Invoice No.</th><th>Scholar No </th><th>Name </th><th>Class </th><th>Sale Amount </th><th>Pre Dues </th><th>Concession </th><th>Paid </th><th>New Dues </th><th>Date </th><th>Action</th>
</tr>
</thead>
<tbody>
<?php
$s=1;
$tot_sale=0;
$tot_paid=0;
$tot_remain=0;
$tot_con=0;
$sch='';
while($row=mysqli_fetch_array($res,MYSQLI_BOTH))
{
$sch=$row['sch'];
$tot_sale=$row['sale']+$tot_sale;
$tot_paid=$row['paid']+$tot_paid;
$tot_con=$row['concession']+$tot_con;
$tot_remain=$row['remain']+$tot_remain;
$session=$row['session'];
$sel1="select * from registration where application='$sch' and session='$session' ";
$res1=mysqli_query($conn,$sel1);
$row1=mysqli_fetch_array($res1,MYSQLI_BOTH);
?>
<tr>
<td><?php echo $s++;?></td><td><?php echo $row['id'];?></td><td><?php echo $row['sch'];?></td><td><?php echo $row1['name'];?></td><td><?php echo $row1['subject'];?></td><td><?php echo $row['sale'];?></td><td><?php echo $row['pre_dues'];?></td><td><?php echo $row['concession'];?></td><td><?php echo $row['paid'];?></td><td><?php echo $row['remain'];?></td><td><?php echo date("m-d-Y", strtotime($row['date']));?></td><td><a href="print_sale.php?sch=<?php echo $row['sch']?>&&session=<?php echo $row['session']?>" ><span class="glyphicon glyphicon-print"></span></a> <a href="sale_update.php?invoice=<?php echo $row['invoice']?>&&session=<?php echo $row['session']?>" ><span class="glyphicon glyphicon-pencil"></span></a> <a href="del_stock.php?invoice=<?php echo $row['invoice']?>" ><span class="glyphicon glyphicon-trash"></span></a></td>
<?php
}
?>
</tr>
</tbody>
<tfoot>
<tr>
<th>Sr No.</th><th>Invoice No.</th><th>Scholar No </th><th>Name </th><th>Class </th><th><?php echo $tot_sale?> </th><th>Pre Dues </th><th><?php echo $tot_con?> </th><th><?php echo $tot_paid?> </th><th><?php echo $tot_remain?> </th><th>Date </th><th>Action</th>
</tr>
</tfoot>
</table>
</div>
<?php
break;
case 1133:
$from=$_POST['from'];
$end=$_POST['end'];
$supplier=$_POST['supplier'];
$session=$_POST['session'];
$sel="select * from product_add where date between '$from' and '$end' and status='' and session='$session' and supplier_id='$supplier' order by id asc";
$res=mysqli_query($conn,$sel);
?>
<script>
$(document).ready(function() {
$('#example').DataTable( {
fixedHeader: true,
dom: 'Bfrtip',
lengthMenu: [
[ 10, 25, 50, -1 ],
[ '10 rows', '25 rows', '50 rows', 'Show all' ]
],
buttons: [
'pageLength','print',
{ extend: 'pdfHtml5', footer: true,
orientation: 'protland',
pageSize: 'LEGAL'
}
]
} );
} );
</script>
<div class="table-responsive">
<table id="example" class="display nowrap" cellspacing="0" width="100%" border="1px">
<thead>
<tr>
<th>Sr No.</th><th>Invoice No. </th><th>Supplier</th><th>Product </th><th>Area </th><th>Class </th><th>Price </th><th>Qty </th><th>Total Amount </th><th>Purchage Date </th><th>Add Date </th>
</tr>
</thead>
<tbody>
<?php
$s=1;
$tot=0;
$p=0;
$tot_remain=0;
$tot_con=0;
$sch='';
$to=0;
while($row=mysqli_fetch_array($res,MYSQLI_BOTH))
{
$p_id=$row['product_id'];
$s_id=$row['supplier_id'];
$price=$row['price'];
$q=$row['qty'];
$p=$price*$q;
$to=$to+$p;
$row['invoice'];;
$session=$_POST['session'];
$sel1="select * from product where id='$p_id' and status='' and session='$session' ";
$res1=mysqli_query($conn,$sel1);
$row1=mysqli_fetch_array($res1,MYSQLI_BOTH);
$sel13="select * from supplier where id='$s_id' ";
$res13=mysqli_query($conn,$sel13);
$row13=mysqli_fetch_array($res13,MYSQLI_BOTH);
$sel1112="select * from product_return where product_id='$p_id' and session='$session' and status='' order by id desc";
$res1112=mysqli_query($conn,$sel1112);
$tot_r=0;
while($row1112=mysqli_fetch_array($res1112,MYSQLI_BOTH))
{
$tot_r=$row1112['qty']+$tot_r;
}
?>
<tr>
<td><?php echo $s++;?></td><td><?php echo $row['invoice'];?></td><td><?php echo $row13['supplier_name'];?></td><td><?php echo $row['product_name'];?></td><td><?php echo $row['area'];?></td><td><?php echo $row['class'];?></td><td><?php echo $row['price'];?></td><td><?php echo $row['qty'];?></td><td><?php echo $p;?></td><td><?php echo date("d-M-Y", strtotime($row['date_ad'])) ;?></td><td><?php echo date("d-M-Y", strtotime($row['date'])) ;?></td>
<?php
}
?>
</tr>
</tbody>
<tfoot>
<tr>
<th>Sr No.</th><th>Invoice No. </th><th>Supplier</th><th>Product </th><th>Area </th><th>Class </th><th>Price </th><th>Qty </th><th><?php echo $to?></th><th>Purchage Date </th><th>Add Date </th>
</tr>
</tfoot>
</table>
</div>
<?php
break;
case 114:
$session=$_POST['session'];
$subject_id=$_POST['subject'];
$invoice=$_POST['invoice'];
$qty=$_POST['qty'];
$sel="select * from product where status='' and session='$session' and id='$subject_id' order by id desc";
$res=mysqli_query($conn,$sel);
$date=date("Y-m-d");
date_default_timezone_set("asia/kolkata");
$time=date("h:i:sa");
$s=1;
$t_p=0;
$t_sale=0;
$row=mysqli_fetch_array($res,MYSQLI_BOTH);
$sale_amount=$row['price'];
$product_id=$row['id'];
/////
if($row)
{
$ins="INSERT INTO `sale` (`product_id`,`sale_qty`,`sale_amount`,`scholar`,`date`,`time`,status,session,invoice) VALUES ('$product_id','$qty','$sale_amount','','$date','$time','','$session','$invoice')";
if(mysqli_query($conn,$ins))
{
echo 'add Successfully';
}
else
{
echo 'not add';
}
}
?>
<tr>
</tr>
<tfoot>
<tr>
<th>Sr No.</th><th>Product Name</th><th>Class</th><th>Area</th><th><?php echo $t_sale ;?></th><th><?php echo $t_p++;?></th><th>Action</th>
</tr>
</tfoot>
</tbody>
</table>
</div>
<?php
break;
case 115:
$session=$_POST['session'];
$class=$_POST['class1'];
$sel1="select * from registration where session='$session' and subject='$class' order by id desc";
$res1=mysqli_query($conn,$sel1);
?><option value=''>--Select--</option><?php
while($row1=mysqli_fetch_array($res1,MYSQLI_BOTH))
{
?><option value='<?php echo $row1['application'] ;?>'><?php echo $row1['name'] ;?>(<?php echo $row1['application'] ;?>)</option><?php
}
break;
case 116:
$session=$_POST['session'];
$class1=$_POST['class1'];
$sch=$_POST['sch'];
$sel="select * from paid where status='' and sch='$sch' order by id desc";
$res=mysqli_query($conn,$sel);
$row=mysqli_fetch_array($res,MYSQLI_BOTH);
if($row)
{
echo $remain=$row['remain'];
}
else
{
echo $remain='0';
}
break;
case 117:
$sch=$_POST['sch'];
$session=$_POST['session'];
$class=$_POST['class'];
$invoice=$_POST['invoice'];
$sale=$_POST['amount'];
$pre_dues=$_POST['dues'];
$total_amount=$_POST['total_amount'];
$concession=$_POST['concession'];
$paid=$_POST['paid'];
$remain=$_POST['remain'];
$remark=$_POST['remark'];
//echo $side;
$date=date("Y-m-d");
date_default_timezone_set("asia/kolkata");
$time=date("h:i:sa");
$datetime=$date." ".$time;
////////////////////for code left right
$sel="select * from paid where status='' and invoice='$invoice' and session='$session' order by id desc";
$res=mysqli_query($conn,$sel);
$row=mysqli_fetch_array($res,MYSQLI_BOTH);
if($row)
{
echo 'Already Submit ';
}
else
{
$ins="INSERT INTO `paid` (`sch`,`session`,`class`,`invoice`,`sale`,`pre_dues`,total_amount,concession,paid,remain,date,time,status,remark) VALUES ('$sch','$session','$class','$invoice','$sale','$pre_dues','$total_amount','$concession','$paid','$remain','$date','$time','','$remark')";
if(mysqli_query($conn,$ins))
{
$up="update sale set scholar='$sch' where invoice='$invoice' and session='$session'";
if(mysqli_query($conn,$up))
{
echo 'Add Successfully';
//////////////
$sel="select * from sale where status='' and invoice='$invoice' and session='$session' order by id desc";
$res=mysqli_query($conn,$sel);
$qty_sale=0;
$qty_add=0;
while($row=mysqli_fetch_array($res,MYSQLI_BOTH))
{
$p_id=$row['product_id'];
$sa=$row['sale_qty'];
/////
$sel1="select * from sale where status='' and product_id='$p_id' and session='$session' order by id desc";
$res1=mysqli_query($conn,$sel1);
while($row1=mysqli_fetch_array($res1,MYSQLI_BOTH))
{
$qty_sale=$row1['sale_qty']+$qty_sale;
}
$sel1="select * from product_add where status='' and product_id='$p_id' and session='$session' order by id desc";
$res1=mysqli_query($conn,$sel1);
while($row1=mysqli_fetch_array($res1,MYSQLI_BOTH))
{
$qty_add=$row1['qty']+$qty_add;
}
///
$re=$qty_add-$qty_sale;
$g=$re-$sa;
if($g>0)
{
$j=$g;
}
else
{
$j=$sa;
}
if($qty_add<$qty_sale)
{
$ins="INSERT INTO `pending_sale` (`product_id`,`sale_qty`,`sale_amount`,`scholar`,`date`,`time`,status,session,invoice) VALUES ('$p_id','$sa','0','$sch','$date','$time','','$session','$invoice')";
if(mysqli_query($conn,$ins))
{
//echo 'add Successfully';
}
else
{
echo 'not add';
}
}
}
///////////
}
else
{
echo 'not update';
}
}
else
{
echo 'not add';
}
}
break;
case 118:
$id=$_POST['rowid'];
$sel="select * from sale where id='$id' order by id desc";
$res=mysqli_query($conn,$sel);
$row=mysqli_fetch_array($res,MYSQLI_BOTH);
$sale_qty=$row['sale_qty'];
$sale_amount=$row['sale_amount'];
$sale_p=$sale_qty*$sale_amount; ////////////////////
$invoice=$row['invoice'];
$session=$row['session'];
$scholar=$row['scholar'];
$sel1="select * from paid where invoice='$invoice' order by id desc";
$res1=mysqli_query($conn,$sel1);
$row1=mysqli_fetch_array($res1,MYSQLI_BOTH);
$paid=$row1['paid'];
$sale=$row1['sale'];
$remain=$row1['remain'];
//////////////////////
$remain_sale_p=$sale-$sale_p;
$remain_paid=$paid-$sale_p;
//////////////////
$up="update paid set sale='$remain_sale_p',paid='$remain_paid',concession='0' where invoice='$invoice'";
mysqli_query($conn,$up);
$sel11="select * from paid where sch='$scholar' and session='$session' ";
$res11=mysqli_query($conn,$sel11);
$t=0;
$c=0;
$s=0;
while($row11=mysqli_fetch_array($res11,MYSQLI_BOTH))
{
$t=$row11['paid']+$t;
$c=$row11['concession']+$c;
$s=$row11['sale']+$s;
}
$new_remain=$s-$t-$c;
if($new_remain>0)
{
$n=$new_remain;
}
else
{
$n=0;
}
$up1="update paid set remain='$n' where sch='$scholar' and session='$session' order by id desc LIMIT 1";
mysqli_query($conn,$up1);
///////////////
$del="update sale set status='Delete' where id='$id'";
if(mysqli_query($conn,$del))
{
echo 'Delete';
}
else
{
echo"Not Deleted";
}
break;
case 119:
$supplier_id=$_POST['supplier'];
$session=$_POST['session'];
$sel="select * from product where supplier_id='$supplier_id' and status='' and session='$session' order by id asc";
$res=mysqli_query($conn,$sel);
?>
<script>
$(document).ready(function() {
$('#example').DataTable( {
fixedHeader: true,
dom: 'Bfrtip',
lengthMenu: [
[ 10, 25, 50, -1 ],
[ '10 rows', '25 rows', '50 rows', 'Show all' ]
],
buttons: [
'pageLength','print',
{ extend: 'pdfHtml5', footer: true,
orientation: 'protland',
pageSize: 'LEGAL'
}
]
} );
} );
</script>
<div class="table-responsive">
<table id="example" class="display nowrap" cellspacing="0" width="100%" border="1px">
<thead>
<tr>
<th>Sr No.</th><th>Supplier</th><th>Product Name</th><th>Class/Area </th><th>Add Qty </th><th>Price </th><th>Total Add Amount </th><th>Sale Qty </th><th>Total Sale Amount </th><th>Return Qty </th><th>Remain Qty </th><th>Remain Amount </th>
</tr>
</thead>
<tbody>
<?php
$s=1;
$total_product_add=0;
$total_product_add_amount=0;
$total_product_sale=0;
$total_product_sale_amount=0;
$t_remain=0;
$re=0;
$sch='';
$t_r=0;
while($row=mysqli_fetch_array($res,MYSQLI_BOTH))
{
$supplier_id=$row['supplier_id'];
$product_id=$row['id'];
$price_p=$row['price'];
$session=$_POST['session'];
//////////////////////////supplier//////////////////
$sel1="select * from supplier where id='$supplier_id' ";
$res1=mysqli_query($conn,$sel1);
$row1=mysqli_fetch_array($res1,MYSQLI_BOTH);
///////////////////product_add////////////////////////
$sel11="select * from product_add where product_id='$product_id' and status='' and session='$session' ";
$res11=mysqli_query($conn,$sel11);
$p_add=0;
$add_p_amount=0;
$to_sale=0;
while($row11=mysqli_fetch_array($res11,MYSQLI_BOTH))
{
$p_add=$p_add+$row11['qty'];
$qty=$row11['qty'];
}
$add_p_amount=$p_add*$price_p;
///////////////////////////////sale//////////////
$sel111="select * from sale where product_id='$product_id' and status='' and session='$session' and scholar!='' ";
$res111=mysqli_query($conn,$sel111);
$p_sale=0;
while($row111=mysqli_fetch_array($res111,MYSQLI_BOTH))
{
$p_sale=$p_sale+$row111['sale_qty'];
}
$to_sale=$p_sale*$price_p;
/////////product _ add/////
$total_product_add=$p_add+$total_product_add;
//$total_product_add_amount=$total_product_add*$price_p;
/////////product _ add/////
///// total sale //////
$total_product_sale=$p_sale+$total_product_sale;
$total_product_sale_amount=$total_product_sale_amount+$to_sale;
$total_product_add_amount=$add_p_amount+$total_product_add_amount;
$sel1112="select * from product_return where product_id='$product_id' and session='$session' and status='' order by id desc";
$res1112=mysqli_query($conn,$sel1112);
$tot_r=0;
while($row1112=mysqli_fetch_array($res1112,MYSQLI_BOTH))
{
$tot_r=$row1112['qty']+$tot_r;
}
$t_r=$tot_r+$t_r;
$y=$add_p_amount-$to_sale;
$t_remain=$t_remain+$y;
$h=$u*$price_p;
$re=$re+$h;
?>
<tr>
<td><?php echo $s++;?></td><td><?php echo $row1['supplier_name'];?></td><td><?php echo $row['product_name'];?></td><td><?php echo $row['class'];?>/<?php echo $row['area'];?></td><td><?php echo $p_add;?></td><td><?php echo $row['price'];?></td><td><?php echo $add_p_amount;?></td><td><?php echo $p_sale;?></td><td><?php echo $to_sale;?></td><td><?php echo $tot_r;?></td><td><?php echo $u=$p_add-$p_sale-$tot_r;?></td><td><?php echo $u*$price_p;?></td></td>
<?php
}
?>
</tr>
</tbody>
<tfoot>
<tr>
<th>Sr No.</th><th>Supplier</th><th>Product Name</th><th>Class/Area </th><th><?php echo $total_product_add?> </th><th>Price </th><th><?php echo $total_product_add_amount?> </th><th><?php echo $total_product_sale;?></th><th><?php echo $total_product_sale_amount;?> </th><th><?php echo $t_r;?></th><th><?php echo $total_product_add-$total_product_sale-$t_r?> </th><th><?php echo $re;?> </th>
</tr>
</tfoot>
</table>
</div>
<?php
break;
case 113:
$from=$_POST['from'];
$end=$_POST['end'];
$session=$_POST['session'];
$sel="select * from paid where date between '$from' and '$end' and status='' and session='$session' order by id asc";
$res=mysqli_query($conn,$sel);
?>
<script>
$(document).ready(function() {
$('#example').DataTable( {
fixedHeader: true,
dom: 'Bfrtip',
lengthMenu: [
[ 10, 25, 50, -1 ],
[ '10 rows', '25 rows', '50 rows', 'Show all' ]
],
buttons: [
'pageLength','print',
{ extend: 'pdfHtml5', footer: true,
orientation: 'protland',
pageSize: 'LEGAL'
}
]
} );
} );
</script>
<div class="table-responsive">
<table id="example" class="display nowrap" cellspacing="0" width="100%" border="1px">
<thead>
<tr>
<th>Sr No.</th><th>Invoice No.</th><th>Scholar No </th><th>Name </th><th>Class </th><th>Sale Amount </th><th>Pre Dues </th><th>Concession </th><th>Paid </th><th>New Dues </th><th>Date </th><th>Action</th>
</tr>
</thead>
<tbody>
<?php
$s=1;
$tot_sale=0;
$tot_paid=0;
$tot_remain=0;
$tot_con=0;
$sch='';
while($row=mysqli_fetch_array($res,MYSQLI_BOTH))
{
$sch=$row['sch'];
$tot_sale=$row['sale']+$tot_sale;
$tot_paid=$row['paid']+$tot_paid;
$tot_con=$row['concession']+$tot_con;
$tot_remain=$row['remain']+$tot_remain;
$session=$_POST['session'];
$sel1="select * from registration where application='$sch' and session='$session' ";
$res1=mysqli_query($conn,$sel1);
$row1=mysqli_fetch_array($res1,MYSQLI_BOTH);
?>
<tr>
<td><?php echo $s++;?></td><td><?php echo $row['id'];?></td><td><?php echo $row['sch'];?></td><td><?php echo $row1['name'];?></td><td><?php echo $row1['subject'];?></td><td><?php echo $row['sale'];?></td><td><?php echo $row['pre_dues'];?></td><td><?php echo $row['concession'];?></td><td><?php echo $row['paid'];?></td><td><?php echo $row['remain'];?></td><td><?php echo $row['date'];?></td><td><a href="print_sale.php?sch=<?php echo $row['sch']?>&&session=<?php echo $row['session']?>" ><span class="glyphicon glyphicon-print"></span></a> <a href="sale_update.php?invoice=<?php echo $row['invoice']?>&&session=<?php echo $row['session']?>" ><span class="glyphicon glyphicon-pencil"></span></a></td>
<?php
}
?>
</tr>
</tbody>
<tfoot>
<tr>
<th>Sr No.</th><th>Invoice No.</th><th>Scholar No </th><th>Name </th><th>Class </th><th><?php echo $tot_sale?> </th><th>Pre Dues </th><th><?php echo $tot_con?> </th><th><?php echo $tot_paid?> </th><th><?php echo $tot_remain?> </th><th>Date </th><th>Action</th>
</tr>
</tfoot>
</table>
</div>
<?php
break;
case 120:
$session=$_POST['session'];
$sel="select * from registration where session='$session' ";
$res=mysqli_query($conn,$sel);
?>
<script>
$(document).ready(function() {
$('#example').DataTable( {
fixedHeader: true,
dom: 'Bfrtip',
lengthMenu: [
[ 10, 25, 50, -1 ],
[ '10 rows', '25 rows', '50 rows', 'Show all' ]
],
buttons: [
'pageLength','print',
{ extend: 'pdfHtml5', footer: true,
orientation: 'protland',
pageSize: 'LEGAL'
}
]
} );
} );
</script>
<div class="table-responsive">
<table id="example" class="display nowrap" cellspacing="0" width="100%" border="1px">
<thead>
<tr>
<th>Sr No.</th><th>Scholar No </th><th>Name </th><th>Father </th><th>Class </th><th>Dues </th><th>Action</th>
</tr>
</thead>
<tbody>
<?php
$s=1;
$tot_remain=0;
while($row=mysqli_fetch_array($res,MYSQLI_BOTH))
{
$sch=$row['application'];
$session=$_POST['session'];
$sel1="select * from paid where sch='$sch' and session='$session' order by id desc ";
$res1=mysqli_query($conn,$sel1);
$row1=mysqli_fetch_array($res1,MYSQLI_BOTH);
$tot_remain1=$row1['remain'];
$tot_remain=$row1['remain']+$tot_remain;
if($tot_remain1>0)
{
?>
<tr>
<td><?php echo $s++;?></td><td><?php echo $row['application'];?></td><td><?php echo $row['name'];?></td><td><?php echo $row['fname'];?></td><td><?php echo $row['subject'];?></td><td><?php echo $row1['remain'];?></td><td><a href="javascript:;" onclick="dues(<?php echo $row['id'];?>)"><span class="glyphicon glyphicon-bank">Paid</span></a> <a href="print_sale.php?sch=<?php echo $row['application']?>&&session=<?php echo $row['session']?>" ><span class="glyphicon glyphicon-print"></span></a></td>
<?php
}
}
?>
</tr>
</tbody>
<tfoot>
<tr>
<th>Sr No.</th><th>Scholar No </th><th>Name </th><th>Father </th><th>Class </th><th>Dues </th><th>Action</th>
</tr>
</tfoot>
</table>
</div>
<?php
break;
case 121:
$id=$_REQUEST['id'];
$sel="select * from registration where id='$id'";
$res=mysqli_query($conn,$sel);
$row=mysqli_fetch_array($res,MYSQLI_BOTH);
$app=$row['application'];
$session=$row['session'];
$sel1="select * from paid sch where sch='$app' and session='$session' and status='' order by id desc";
$res1=mysqli_query($conn,$sel1);
$row1=mysqli_fetch_array($res1,MYSQLI_BOTH);
$remain=$row1['remain'];
?>
<script>
$("#paid").keyup(function(e){
var paid=$("#paid").val();
var concession=$("#concession").val();
var dues=$("#dues").val();
var latest_dues=$("#latest_dues").val();
var remain=dues-paid-concession;
$("#latest_dues").val(remain);
});
$("#concession").keyup(function(e){
var paid=$("#paid").val();
var concession=$("#concession").val();
var dues=$("#dues").val();
var latest_dues=$("#latest_dues").val();
var remain=dues-paid-concession;
$("#latest_dues").val(remain);
});
</script>
<form class="form-horizontal" onsubmit="return data(this)">
<div class="form-group">
<label class="col-sm-6 control-label"> Student Name </label>
<div class="col-sm-6"><input type="text" class="form-control" value="<?php echo $row['name'];?>" name="name" ></div>
</div>
<div class="form-group">
<br/>
<label class="col-sm-6 control-label">Father Name</label>
<div class="col-sm-6"><input type="text" class="form-control" value="<?php echo $row['fname'];?>" name="fname" ></div>
<input type="hidden" class="form-control" value="<?php echo $row['session'];?>" name="session" >
<input type="hidden" class="form-control" value="<?php echo $row['class'];?>" name="class" >
<input type="hidden" class="form-control" value="<?php echo $app;?>" name="sch" >
<input type="hidden" class="form-control" value="<?php echo $row1['invoice'];?>" name="invoice" >
<input type="hidden" class="form-control" value="0" name="amount" >
<input type="hidden" class="form-control" value="0" name="total_amount" >
</div>
<div class="form-group">
<br/>
<label class="col-sm-6 control-label"> Pre Dues </label>
<div class="col-sm-6"><input type="text" class="form-control" value="<?php echo $row1['remain'];?>" name="dues" id='dues' readonly ></div>
</div>
<div class="form-group">
<br/>
<label class="col-sm-6 control-label">Concession </label>
<div class="col-sm-6"><input type="number" class="form-control" value="0" name="concession" id='concession' ></div>
</div>
<div class="form-group">
<br/>
<label class="col-sm-6 control-label">Paid</label>
<div class="col-sm-6"><input type="number" class="form-control" value="0" name="paid" id='paid'></div>
</div>
<div class="form-group">
<br/>
<label class="col-sm-6 control-label">Latest Dues</label>
<div class="col-sm-6"><input type="number" class="form-control" value="0" name="remain" id='latest_dues' ></div>
</div>
</div>
<center><button class="btn btn-primary" > Submit</button>
   <button class="btn btn-danger" data-dismiss="modal"> Close</button>
</center>
</form>
<?php
break;
case 122:
$sch=$_POST['sch'];
$session=$_POST['session'];
$class=$_POST['class'];
$invoice=$_POST['invoice'];
$sale=$_POST['amount'];
$pre_dues=$_POST['dues'];
$total_amount=$_POST['total_amount'];
$concession=$_POST['concession'];
$paid=$_POST['paid'];
$remain=$_POST['remain'];
//echo $side;
$date=date("Y-m-d");
date_default_timezone_set("asia/kolkata");
$time=date("h:i:sa");
$datetime=$date." ".$time;
////////////////////for code left right
$up="update paid set remain='0' where sch='$sch'";
mysqli_query($conn,$up);
$ins="INSERT INTO `paid` (`sch`,`session`,`class`,`invoice`,`sale`,`pre_dues`,total_amount,concession,paid,remain,date,time,status,remark) VALUES ('$sch','$session','$class','$invoice','$sale','$pre_dues','$total_amount','$concession','$paid','$remain','$date','$time','','')";
if(mysqli_query($conn,$ins))
{
echo 'Paid Successfully';
}
else
{
echo 'not add';
}
break;
case 123:
$id=$_REQUEST['id'];
$sel1="select * from product_add where id='$id' and status='' order by id desc";
$res1=mysqli_query($conn,$sel1);
$row1=mysqli_fetch_array($res1,MYSQLI_BOTH);
?>
<script>
$(document).ready(function(){
$("#myform").submit(function(e){
e.preventDefault();
$("#btn").prop("disabled",true);
$.ajax({
url:"code/classcode.php?flag=124",
type:"POST",
data:new FormData(this),
contentType:false,
processData:false,
success:function(res){
alert(res);
window.location.href='book_add.php';
// $("#modal").load("code/classcode.php?flag=104");
},
error:function(){
alert("error");
}
});
});
});
</script>
<form id='myform' autocomplete="on">
<div class="col-lg-12">
</div>
<div class="col-lg-12">
<div class="form-group">
<label> Product Name</label>
<input type="hidden" name="id" value='<?php echo $id?>' required>
<input type="text" readonly name="product_name" value="<?php echo $row1['product_name']?>" data-validation="required" class="form-control" readonly />
</div>
</div>
<div class="col-lg-12">
<div class="form-group">
<label>Class</label>
<input type="text" readonly value="<?php echo $row1['class']?>" data-validation="required" class="form-control" readonly required>
</div>
</div>
<div class="col-lg-12">
<div class="form-group">
<label>Qty</label>
<input type="number" name="qty" value="<?php echo $row1['qty']?>" data-validation="required" class="form-control" required>
</div>
</div>
<div class="col-lg-12">
<div class="form-group">
<label>Date Add</label>
<input type="date" name="date_add" value="<?php echo $row1['date_ad']?>" data-validation="required" class="form-control" required>
</div>
</div>
<div class="col-lg-6">
<br/>
<div class="form-group">
<button id='btn' class='btn btn-primary'>Update</button>
</div>
</form>
<?php
break;
case 124:
$id=$_POST['id'];
$qty=$_POST['qty'];
$date_ad=$_POST['date_add'];
$date=date("Y-m-d");
date_default_timezone_set("asia/kolkata");
$time=date("h:i:sa");
$datetime=$date." ".$time;
////////////////////for code left right
$up="update product_add set qty='$qty',date_ad='$date_ad' where id='$id'";
if(mysqli_query($conn,$up))
{
echo 'update';
}
else
{
echo 'no';
}
break;
case 1040:
$sel1="select * from session order by id desc";
$res1=mysqli_query($conn,$sel1);
$row1=mysqli_fetch_array($res1,MYSQLI_BOTH);
$session=$row1['session'];
$supplier_id=$_POST['supplier_id'];
$sel="select * from product where status='' and session='$session' and supplier_id='$supplier_id' order by id desc";
$res=mysqli_query($conn,$sel);
?>
<script>
$(document).ready(function() {
$('#example').DataTable( {
fixedHeader: true,
dom: 'Bfrtip',
lengthMenu: [
[ 10, 25, 50, -1 ],
[ '10 rows', '25 rows', '50 rows', 'Show all' ]
],
buttons: [
'pageLength','print','excel',
{ extend: 'pdfHtml5', footer: true,
orientation: 'protland',
pageSize: 'LEGAL'
}
]
} );
} );
</script>
<div class="table-responsive">
<table id="example" class="display nowrap" cellspacing="0" width="100%" border="1px">
<thead>
<tr>
<th>Sr No.</th><th>Supplier Name</th><th>Product Name</th><th>Class</th><th>Area</th><th>Price</th><th>Total Qty Add</th><th>Total Qty Sale</th><th>Qty Return</th><th>Qty Left</th><th>Action</th>
</tr>
</thead>
<tbody>
<?php
$s=1;
$t_p=0;
$t_r=0;
$t_sale=0;
while($row=mysqli_fetch_array($res,MYSQLI_BOTH))
{
$supplier_id=$row['supplier_id'];
$sel1="select * from supplier where id='$supplier_id' and status='' order by id desc";
$res1=mysqli_query($conn,$sel1);
$row1=mysqli_fetch_array($res1,MYSQLI_BOTH);
$prduct_id=$row['id'];
$sel11="select * from sale where product_id='$prduct_id' and session='$session' and status='' and scholar!='' order by id desc";
$res11=mysqli_query($conn,$sel11);
$sale=0;
while($row11=mysqli_fetch_array($res11,MYSQLI_BOTH))
{
$sale=$row11['sale_qty']+$sale;
}
$t_sale=$sale+$t_sale;
$sel111="select * from product_add where product_id='$prduct_id' and session='$session' and status='' order by id desc";
$res111=mysqli_query($conn,$sel111);
$tot_p=0;
while($row111=mysqli_fetch_array($res111,MYSQLI_BOTH))
{
$tot_p=$row111['qty']+$tot_p;
}
$sel1112="select * from product_return where product_id='$prduct_id' and session='$session' and status='' order by id desc";
$res1112=mysqli_query($conn,$sel1112);
$tot_r=0;
while($row1112=mysqli_fetch_array($res1112,MYSQLI_BOTH))
{
$tot_r=$row1112['qty']+$tot_r;
}
$t_p=$tot_p+$t_p;
$t_r=$tot_r+$t_r;
?>
<tr>
<td><?php echo $s++;?></td><td><?php echo $row1['supplier_name'];?></td><td><?php echo $row['product_name'];?></td><td><?php echo $row['class'];?></td><td><?php echo $row['area'];?></td><td><?php echo $row['price'];?></td><td><?php echo $tot_p;?></td><td><?php echo $sale;?></td><td><?php echo $tot_r;?></td><td><?php echo $tot_p-$sale-$tot_r;?></td><td><a href="javascript:;" onclick="editrow(<?php echo $row['id'];?>)"><span class="">Return</span></a> <a href="show_product_add.php?flag=<?php echo $row['id']?>" >Show Add</a></td>
<?php
}
?>
</tr>
<tfoot>
<tr>
<th>Sr No.</th><th>Supplier Name</th><th>Product Name</th><th>Class</th><th>Area</th><th>Price</th><th><?php echo $t_p;?></th><th><?php echo $t_sale;?></th><th><?php echo $t_r;?></th><th><?php echo $t_p-$t_sale-$t_r;?></th><th>Action</th>
</tr>
</tfoot>
</tbody>
</table>
</div>
<?php
break;
case 1080:
$id=$_REQUEST['id'];
$sel1="select * from product where id='$id' and status='' order by id desc";
$res1=mysqli_query($conn,$sel1);
$row1=mysqli_fetch_array($res1,MYSQLI_BOTH);
?>
<form onsubmit="return updaterow(this)">
<div class="col-lg-12">
</div>
<input type="hidden" name="id" value='<?php echo $id?>' required>
<input type="hidden" name="supplier_id" value="<?php echo $row1['supplier_id']?>" required>
<input type="hidden" name="supplier_id" value="<?php echo $row1['supplier_id']?>" required>
<input type="hidden" name="product_code" value="<?php echo $row1['product_code']?>" required>
<input type="hidden" name="area" value="<?php echo $row1['area']?>" required>
<input type="hidden" name="session" value="<?php echo $row1['session']?>" required>
<input type="hidden" name="price" value="<?php echo $row1['price']?>" required>
<input type="text" readonly name="product_name" value="<?php echo $row1['product_name']?>" data-validation="required" readonly class="form-control" required>
<div class="col-lg-12">
<div class="form-group">
<label>Class</label>
<input type="text" readonly name='class' value="<?php echo $row1['class']?>" data-validation="required" class="form-control" required>
</div>
</div>
<div class="col-lg-12">
<div class="form-group">
<label>Return Qty</label>
<input type="number" name="qty" data-validation="required" class="form-control" required>
</div>
</div>
<div class="col-lg-12">
<div class="form-group">
<label> Return Date</label>
<input type="date" name="date_add" value='<?php echo date('Y-m-d')?>' data-validation="required" class="form-control" required>
</div>
</div>
<div class="col-lg-6">
<br/>
<div class="form-group">
<button id='btn' class='btn btn-primary'>Return</button>
</div>
</form>
<?php
break;
case 1090:
$supplier_id=$_POST['supplier_id'];
$product_name=$_POST['product_name'];
$class=$_POST['class'];
$area=$_POST['area'];
$qty=$_POST['qty'];
$date_ad=$_POST['date_add'];
$product_id=$_POST['id'];
$product_code=$_POST['product_code'];
$session=$_POST['session'];
$price=$_POST['price'];
//echo $side;
$date=date("Y-m-d");
date_default_timezone_set("asia/kolkata");
$time=date("h:i:sa");
$datetime=$date." ".$time;
////////////////////for code left right
$ins="INSERT INTO `product_return` (`supplier_id`,`product_name`,`area`,`qty`,`date_ad`,`date`,status,class,product_code,product_id,session,price) VALUES ('$supplier_id','$product_name','$area','$qty','$date_ad','$date','','$class','$product_code','$product_id','$session','$price')";
if(mysqli_query($conn,$ins))
{
echo 'Return Successfully';
}
else
{
echo 'not Return';
}
break;
case 10400:
$sel1="select * from session order by id desc";
$res1=mysqli_query($conn,$sel1);
$row1=mysqli_fetch_array($res1,MYSQLI_BOTH);
$session=$_POST['session'];
$supplier_id=$_POST['supplier_id'];
$sel="select * from product_return where status='' and session='$session' and supplier_id='$supplier_id' order by id desc";
$res=mysqli_query($conn,$sel);
?>
<script>
$(document).ready(function() {
$('#example').DataTable( {
fixedHeader: true,
dom: 'Bfrtip',
lengthMenu: [
[ 10, 25, 50, -1 ],
[ '10 rows', '25 rows', '50 rows', 'Show all' ]
],
buttons: [
'pageLength','print','excel',
{ extend: 'pdfHtml5', footer: true,
orientation: 'protland',
pageSize: 'LEGAL'
}
]
} );
} );
</script>
<div class="table-responsive">
<table id="example" class="display nowrap" cellspacing="0" width="100%" border="1px">
<thead>
<tr>
<th>Sr No.</th><th>Supplier Name</th><th>Product Name</th><th>Class</th><th>Area</th><th>Price</th><th>Qty Return</th><th>Date Return</th><th>Action</th>
</tr>
</thead>
<tbody>
<?php
$s=1;
$t_p=0;
$t_r=0;
$t_sale=0;
while($row=mysqli_fetch_array($res,MYSQLI_BOTH))
{
$supplier_id=$row['supplier_id'];
$sel1="select * from supplier where id='$supplier_id' and status='' order by id desc";
$res1=mysqli_query($conn,$sel1);
$row1=mysqli_fetch_array($res1,MYSQLI_BOTH);
$prduct_id=$row['product_id'];
$t_r=$row['qty']+$t_r;
$sel11="select * from sale where product_id='$prduct_id' and session='$session' and status='' and scholar!='' order by id desc";
$res11=mysqli_query($conn,$sel11);
$sale=0;
while($row11=mysqli_fetch_array($res11,MYSQLI_BOTH))
{
$sale=$row11['sale_qty']+$sale;
}
$t_sale=$sale+$t_sale;
$sel111="select * from product_add where product_id='$prduct_id' and session='$session' and status='' order by id desc";
$res111=mysqli_query($conn,$sel111);
$tot_p=0;
while($row111=mysqli_fetch_array($res111,MYSQLI_BOTH))
{
$tot_p=$row111['qty']+$tot_p;
}
$sel1112="select * from product_return where product_id='$prduct_id' and session='$session' and status='' order by id desc";
$res1112=mysqli_query($conn,$sel1112);
$tot_r=0;
while($row1112=mysqli_fetch_array($res1112,MYSQLI_BOTH))
{
$tot_r=$row1112['qty']+$tot_r;
}
$t_p=$tot_p+$t_p;
// $t_r=$tot_r+$t_r;
?>
<tr>
<td><?php echo $s++;?></td><td><?php echo $row1['supplier_name'];?></td><td><?php echo $row['product_name'];?></td><td><?php echo $row['class'];?></td><td><?php echo $row['area'];?></td><td><?php echo $row['price'];?></td><td><?php echo $row['qty'];?></td><td><?php echo $row['date_ad'];?></td><td><a href="javascript:;" onclick="deleterow(<?php echo $row['id'];?>)"><span class="">Delete</span></a></td>
<?php
}
?>
</tr>
<tfoot>
<tr>
<th>Sr No.</th><th>Supplier Name</th><th>Product Name</th><th>Class</th><th>Area</th><th>Price</th><th><?php echo $t_r;?></th><th></th><th>Action</th>
</tr>
</tfoot>
</tbody>
</table>
</div>
<?php
break;
case 1050:
$id=$_POST['rowid'];
$up="update product_return set status='Delete' where id='$id'";
if(mysqli_query($conn,$up))
{
echo 'Delete Successfully';
}
break;
case 10425:
$sel1="select * from session order by id desc";
$res1=mysqli_query($conn,$sel1);
$row1=mysqli_fetch_array($res1,MYSQLI_BOTH);
$session=$row1['session'];
$sel="select * from product where status='' and session='$session' order by id desc";
$res=mysqli_query($conn,$sel);
?>
<script>
$(document).ready(function() {
$('#example').DataTable( {
fixedHeader: true,
dom: 'Bfrtip',
lengthMenu: [
[ 10, 25, 50, -1 ],
[ '10 rows', '25 rows', '50 rows', 'Show all' ]
],
buttons: [
'pageLength','print','excel',
{ extend: 'pdfHtml5', footer: true,
orientation: 'protland',
pageSize: 'LEGAL'
}
]
} );
} );
</script>
<div class="table-responsive">
<table id="example" class="display nowrap" cellspacing="0" width="100%" border="1px">
<thead>
<tr>
<th>Sr No.</th><th>Supplier Name</th><th>Product Name</th><th>Class</th><th>Area</th><th>Price</th><th>Total Qty Add</th><th>Total Qty Sale</th><th>Total Qty Return</th><th>Qty Left</th><th>Action</th>
</tr>
</thead>
<tbody>
<?php
$s=1;
$t_p=0;
$t_r=0;
$t_sale=0;
while($row=mysqli_fetch_array($res,MYSQLI_BOTH))
{
$supplier_id=$row['supplier_id'];
$sel1="select * from supplier where id='$supplier_id' and status='' order by id desc";
$res1=mysqli_query($conn,$sel1);
$row1=mysqli_fetch_array($res1,MYSQLI_BOTH);
$prduct_id=$row['id'];
$sel11="select * from sale where product_id='$prduct_id' and session='$session' and status='' and scholar!='' order by id desc";
$res11=mysqli_query($conn,$sel11);
$sale=0;
while($row11=mysqli_fetch_array($res11,MYSQLI_BOTH))
{
$sale=$row11['sale_qty']+$sale;
}
$t_sale=$sale+$t_sale;
$sel111="select * from product_add where product_id='$prduct_id' and session='$session' and status='' order by id desc";
$res111=mysqli_query($conn,$sel111);
$tot_p=0;
while($row111=mysqli_fetch_array($res111,MYSQLI_BOTH))
{
$tot_p=$row111['qty']+$tot_p;
}
$t_p=$tot_p+$t_p;
$sel1112="select * from product_return where product_id='$prduct_id' and session='$session' and status='' order by id desc";
$res1112=mysqli_query($conn,$sel1112);
$tot_r=0;
while($row1112=mysqli_fetch_array($res1112,MYSQLI_BOTH))
{
$tot_r=$row1112['qty']+$tot_r;
}
$t_r=$tot_r+$t_r;
?>
<tr>
<td><?php echo $s++;?></td><td><?php echo $row1['supplier_name'];?></td><td><?php echo $row['product_name'];?></td><td><?php echo $row['class'];?></td><td><?php echo $row['area'];?></td><td><?php echo $row['price'];?></td><td><?php echo $tot_p;?></td><td><?php echo $sale;?></td><td><?php echo $tot_r;?></td><td><?php echo $tot_p-$sale-$tot_r;?></td><td></td>
<?php
}
?>
</tr>
<tfoot>
<tr>
<th>Sr No.</th><th>Supplier Name</th><th>Product Name</th><th>Class</th><th>Area</th><th>Price</th><th><?php echo $t_p;?></th><th><?php echo $t_sale;?></th><th><?php echo $t_r;?></th><th><?php echo $t_p-$t_sale-$t_r;?></th><th>Action</th>
</tr>
</tfoot>
</tbody>
</table>
</div>
<?php
break;
case 10426:
$session=$_POST['session'];
$sel="select * from registration where session='$session' ";
$res=mysqli_query($conn,$sel);
?>
<script>
$(document).ready(function() {
$('#example').DataTable( {
fixedHeader: true,
dom: 'Bfrtip',
lengthMenu: [
[ 10, 25, 50, -1 ],
[ '10 rows', '25 rows', '50 rows', 'Show all' ]
],
buttons: [
'pageLength','print',
{ extend: 'pdfHtml5', footer: true,
orientation: 'protland',
pageSize: 'LEGAL'
}
]
} );
} );
</script>
<div class="table-responsive">
<table id="example" class="display nowrap" cellspacing="0" width="100%" border="1px">
<thead>
<tr>
<th>Sr No.</th><th>Scholar No </th><th>Name </th><th>Father </th><th>Class </th><th>Total Amount </th><th>Paid </th><th>Action</th>
</tr>
</thead>
<tbody>
<?php
$s=1;
$tot_remain=0;
while($row=mysqli_fetch_array($res,MYSQLI_BOTH))
{
$sch=$row['application'];
$session=$_POST['session'];
$sel1="select * from paid sch where sch='$sch' and session='$session' and status='' order by id desc";
$res1=mysqli_query($conn,$sel1);
$row1=mysqli_fetch_array($res1,MYSQLI_BOTH);
$remain=$row1['remain'];
?>
<tr>
<td><?php echo $s++;?></td><td><?php echo $row['application'];?></td><td><?php echo $row['name'];?></td><td><?php echo $row['fname'];?></td><td><?php echo $row['subject'];?></td><td><?php echo $row1['total_amount'];?></td><td><?php echo $row1['paid'];?></td><td><a href="javascript:;" onclick="dues(<?php echo $row['id'];?>)"><span class="glyphicon glyphicon-bank">Record</span></a></td>
<?php
}
?>
</tr>
</tbody>
<tfoot>
<tr>
<th>Sr No.</th><th>Scholar No </th><th>Name </th><th>Father </th><th>Class </th><th>Dues </th><th>Action</th>
</tr>
</tfoot>
</table>
</div>
<?php
break;
case 10427:
$id=$_REQUEST['id'];
$sel="select * from registration where id='$id'";
$res=mysqli_query($conn,$sel);
$row=mysqli_fetch_array($res,MYSQLI_BOTH);
$app=$row['application'];
$session=$row['session'];
$sel1="select * from paid sch where sch='$app' and session='$session' and status='' order by id asc";
$res1=mysqli_query($conn,$sel1);
$remain=$row1['remain'];
?>
<script>
$("#paid").keyup(function(e){
var paid=$("#paid").val();
var concession=$("#concession").val();
var dues=$("#dues").val();
var latest_dues=$("#latest_dues").val();
var remain=dues-paid-concession;
$("#latest_dues").val(remain);
});
$("#concession").keyup(function(e){
var paid=$("#paid").val();
var concession=$("#concession").val();
var dues=$("#dues").val();
var latest_dues=$("#latest_dues").val();
var remain=dues-paid-concession;
$("#latest_dues").val(remain);
});
</script>
<script>
$(document).ready(function() {
$('#example').DataTable( {
fixedHeader: true,
dom: 'Bfrtip',
lengthMenu: [
[ 10, 25, 50, -1 ],
[ '10 rows', '25 rows', '50 rows', 'Show all' ]
],
buttons: [
'pageLength','print',
{ extend: 'pdfHtml5', footer: true,
orientation: 'protland',
pageSize: 'LEGAL'
}
]
} );
} );
</script>
<div class="table-responsive" id='DivIdToPrint'>
<table id="example" class="display nowrap" cellspacing="0" width="100%" border="1px">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Slip No</th>
<th scope="col">Sch No</th>
<th scope="col">Name</th>
<th scope="col">To. Amount</th>
<th scope="col">Cons</th>
<th scope="col">Paid</th>
<th scope="col">Dues</th>
<th scope="col">Date</th>
<th scope="col">Print</th>
</tr>
</thead>
<tbody>
<?php
$s=1;
$t=0;
$p=0;
$re=0;
$c=0;
while($row1=mysqli_fetch_array($res1,MYSQLI_BOTH))
{
$t=$row1['total_amount']+$t;
$c=$row1['concession']+$c;
$p=$row1['paid']+$p;
$re=$row1['remain'];
?>
<tr>
<th scope="row"><?php echo $s;?></th>
<td><?php echo $row1['id'];?></td>
<td><?php echo $row['application'];?></td>
<td><?php echo $row['name'];?></td>
<td><?php echo $row1['total_amount'];?></td>
<td><?php echo $row1['concession'];?></td>
<td><?php echo $row1['paid'];?></td>
<td><?php echo $row1['remain'];?></td>
<td><?php echo $row1['date'];?></td>
<td> <a href="print_new.php?id=<?php echo $row1['id'];?>" target="_blank" ><span class="glyphicon glyphicon-print"></span></a></td>
</tr>
<?php
$s++;
}
?>
<th scope="row"></th>
<td></td>
<td>Total</td>
<td></td>
<td><?php echo $t;?></td>
<td><?php echo $c;?></td>
<td><?php echo $p;?></td>
<td><?php echo $re;?></td>
<td></td>
<td></td>
</tbody>
</table>
</div>
<br/>
<center><input type='button' id='btn' value='Print' onclick='printDiv();'></center>
<script>
function printDiv()
{
var divToPrint=document.getElementById('DivIdToPrint');
var newWin=window.open('','Print-Window');
newWin.document.open();
newWin.document.write('<html><body onload="window.print()">'+divToPrint.innerHTML+'</body></html>');
}
</script>
<?php
break;
case 10428:
$session=$_POST['session'];
?>
<select name='subject' class='form-control' required>
<?php
$sel="select * from product where session='$session'";
$res=mysqli_query($conn,$sel);
?><option value=''>-- select--</option><?php
while($row=mysqli_fetch_array($res,MYSQLI_BOTH))
{
$p_id=$row['id'];
$session=$row['session'];
//
$sel1="select * from sale where status='' and product_id='$p_id' and scholar!='' order by id desc";
$res1=mysqli_query($conn,$sel1);
$qty_sale=0;
while($row1=mysqli_fetch_array($res1,MYSQLI_BOTH))
{
$qty_sale=$row1['sale_qty']+$qty_sale;
}
$sel1="select * from product_add where status='' and product_id='$p_id' and session='2023-2024' order by id desc";
$res1=mysqli_query($conn,$sel1);
$qty_add=0;
while($row1=mysqli_fetch_array($res1,MYSQLI_BOTH))
{
$qty_add=$row1['qty']+$qty_add;
}
$sel1112="select * from product_return where product_id='$p_id' and status='' and session='2023-2024' order by id desc";
$res1112=mysqli_query($conn,$sel1112);
$tot_r=0;
while($row1112=mysqli_fetch_array($res1112,MYSQLI_BOTH))
{
$tot_r=$row1112['qty']+$tot_r;
}
///
$re=$qty_add-$qty_sale-$tot_r;
///
?><option value='<?php echo $row['id'];?>'style='background-color:light'><?php echo $row['product_name'];?>(<?php echo $row['area'];?>)(<?php echo $row['class'];?>)(Remain=<?php echo $re;?>)</option><?php
}
?>
</select>
<?php
break;
}
?>