File: //home/cafsindia/refimac_cafsjobs_com/mas_sales.php
<div id="contentwrapper">
<div class="main_content">
<?php
$up=$_REQUEST['up'];
$id=$_REQUEST['id'];
if($up==1)
{
$sql="select * from model where MODEL_ID=".$id."";
$qu=mysql_query($sql);
$r=mysql_fetch_array($qu);
$MODEL_CODE=$r['MODEL_CODE'];
$MODEL_NAME=$r['MODEL_NAME'];
$MAKE_ID=$r['MAKE_ID'];
}
?>
<div class="page-head">
<div class="container">
<!-- BEGIN PAGE TITLE -->
<div class="page-title">
<h1>Sales Serial No Upload <small>Manage your sales Info.</small></h1>
</div>
</div>
</div>
<div class="page-content">
<div class="container">
<div class="row-fluid">
<div class="span12">
<?php
$total_rec=$_REQUEST['total'];
$rej_rec=$_REQUEST['rej'];
$regno=$_REQUEST['regno'];
/*if($nav=="1")
echo "<div class='msg success'>
<span>Given File Uploaded and $total_rec Data Uploaded!</span>
</div>";
elseif($nav=="2")
echo "<div class='msg failure'>
<span>sorry, given file not Uploaded, please try again !</span>
</div>";*/
if($nav=="3")
echo "<div class='msg success'>
<span> $total_rec records imported to DB! , $rej_rec records already available in DB!,$regno invoice numbers are not updated!</span>
<space>".$_SESSION['items']."
</div>";
?>
</div>
</div>
<?php
$up=$_REQUEST['up'];
$id=$_REQUEST['id'];
if($up==1)
{
$sql="select * from etaapp_pages where page_id=".$id." and status='Y'";
$qu=mysql_query($sql);
while($r=mysql_fetch_array($qu))
{
$menu=$r['menu_name'];
$menu1="NIL";
$submenu=$r['submenu_name'];
$submenu1="NIL";
$page_name=$r['page_name'];
$ava_trans=$r['ava_trans'];
$refer=$r['refer_name'];
$ap_id=$r['ap_id'];
$remarks=$r['remarks'];
$trans=explode("|",$ava_trans);
}
}
?>
<div class="page-content-inner">
<form action="add_details.php?mid=<?php echo $mid;?>&smid=<?php echo $smid;?>&pid=<?php echo $pid;?>&opt=1" method="post" enctype="multipart/form-data" name="form1">
<div class="portlet light">
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
Upload Excel File <span class="f_req">*</span> : <input name="uploadfile" class="form-control" type="file" id="uploadfile" />
</div>
<div class="col-md-6">
<label>Read this Instructions and upload the file - <a href="javascript:void(0)" onclick="open_win('help.php?pid=upload')">Click Here</a></label> </div>
</div>
</div>
</div>
<div class="form-actions">
<div class="row">
<div class="col-md-offset-3 col-md-9">
<button type="submit" class="btn green">Submit</button>
<button type="button" class="btn grey-salsa btn-outline cancel">Cancel</button>
</div>
</div>
</div>
</div>
</form>
<?php
if($_REQUEST['con']!=""&&$_REQUEST['total']>0)
{
?>
<form id="form2" name="form2" method="post" action="add_details.php?mid=<?php echo $mid;?>&smid=<?php echo $smid;?>&pid=<?php echo $pid;?>&opt=2">
<?php
$pdate=date("Y-m-d");
$sqld="select * from etaapp_tproductsno where update_by='".$user."' order by s_id";
$qud=mysql_query($sqld);
$nd=mysql_num_rows($qud);
//echo $nd;
?>
<h3 class="heading">Uploaded Serial Nos</h3>
<?php
$i=0;
$dup_rec=0;
$new_rec=0;
while($rd=mysql_fetch_array($qud))
{
$sqlp="select serial_no from etaapp_productsno where serial_no='".$rd['serial_no']."' and model_no='".$rd['model_no']."' and description='".$rd['description']."' and status='Y'";
$qup=mysql_query($sqlp);
$np=mysql_num_rows($qup);
if($np>=1){ $dup_rec++;}
$i=$i+1;
}
$new_rec=$total_rec-$dup_rec;
echo "<div class='msg success'>
<span>Uploaded New Record Count: $new_rec !</span>
not uploaded:".$_SESSION['sales']."
</div>";
echo "<div class='msg failure'>
<span>Duplicate Record Count: $dup_rec !</span>
</div>";
?>
<!--Table View and import conformation-->
<!--
<table class="table table-striped table-bordered" id="">
<thead>
<tr>
<th> Serial No</th>
<th> Model No </th>
<th> Description </th>
<th> GRN No </th>
<th> Invoice No </th>
<th> Conform </th>
</tr>
</thead>
<tbody>
<?php
$i=1;
while($rd=mysql_fetch_array($qud))
{
$sqlp="select * from etaapp_productsno where serial_no='".$rd['serial_no']."' and model_no='".$rd['model_no']."' and description='".$rd['description']."' and status='Y'";
$qup=mysql_query($sqlp);
$np=mysql_num_rows($qup);
?>
<tr>
<td><?php echo $rd['serial_no'];?></td>
<td><?php echo $rd['model_no'];?></td>
<td><?php echo $rd['description'];?></td>
<td><?php echo $rd['grn_no'];?></td>
<td><?php echo $rd['invoice_no'];?></td>
<td><span class="body_text_black">
<?php if($np==0){?>
<input type="checkbox" id="conform[]" name="conform[]" checked="checked" value="<?php echo $rd['s_id'];?>"/>
<?php }else echo "NA";?>
</span></td>
</tr>
<?php
$i=$i+1;
}
?>
</tbody>
</table>-->
<div class="form-actions">
<button class="btn"> Import Data to DB </button>
</div>
</form>
<?php }?>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function()
{
if ( $.fn.dataTable.isDataTable( '#sample' ) ) {
table = $('#sample').DataTable();
}
else {
table = $('#sample').DataTable( {
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print','pageLength'
], lengthMenu: [
[ 10, 25, 50, -1 ],
[ '10 rows', '25 rows', '50 rows', 'Show all' ]
]
} );
}
$('.cancel').click(function()
{
location.reload();
});
});
// Wait for the DOM to be ready
$(function() {
// Initialize form validation on the registration form.
// It has the name attribute "registration"
$("form[name='form1']").validate({
// Specify validation rules
rules: {
// The key name on the left side is the name attribute
// of an input field. Validation rules are defined
// on the right side
EMP_NAME: "required",
EMP_MOBILE: "required",
EMP_DOJ: {
required: true,
// Specify that email should be validated
// by the built-in "email" rule
//email: true
}
},
// Specify validation error messages
messages: {
EMP_NAME: "Please enter employee name",
EMP_MOBILE: "Please enter employee mobile",
page_name: "Please select doj"
},
// Make sure the form is submitted to the destination defined
// in the "action" attribute of the form when valid
submitHandler: function(form) {
form.submit();
}
});
});
</script>