142 lines
3.5 KiB
PHP
Executable File
142 lines
3.5 KiB
PHP
Executable File
<?php
|
|
if(isset($Success)){
|
|
|
|
echo $Success;
|
|
}
|
|
|
|
if(isset($Fail)){
|
|
|
|
echo $Fail;
|
|
}
|
|
|
|
?>
|
|
<script>
|
|
function readURL(input) {
|
|
$('#FileName').val(input.files[0].name);
|
|
}
|
|
|
|
|
|
</script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap-datepicker.js"></script>
|
|
|
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap-datepicker.css" rel="stylesheet">
|
|
<script>
|
|
function checkYearMonthAsEmpty()
|
|
{
|
|
var i=0;
|
|
if($("#mon").val() == "") {
|
|
i++;
|
|
// alert("No Month Selected!");
|
|
|
|
}
|
|
if($("#yr").val() == "") {
|
|
i++;
|
|
//alert("No Year Selected!");
|
|
}
|
|
|
|
if($("#FileName").val() == "") {
|
|
i++;
|
|
//alert("No File Uploaded!");
|
|
}
|
|
// alert(i);
|
|
return i;
|
|
|
|
|
|
|
|
}
|
|
</script>
|
|
<div class="content-wrapper">
|
|
<!-- Content Header (Page header) -->
|
|
<section class="content-header">
|
|
<h1>
|
|
<center>Siddharth Industries - Monthly Pay Inputs Upload</center>
|
|
|
|
</h1>
|
|
</section>
|
|
<section class="content">
|
|
<div class="row">
|
|
<div class="col-md-8 col-md-offset-2" style="border:2px dotted;padding:2%;">
|
|
|
|
|
|
<form id="upload" method="post" action="<?php echo base_url() ?>FileUpload2"; role="form" enctype="multipart/form-data"> <div class="col-md-5 col-md-offset-2">
|
|
<span for="FileName">File Name</span>
|
|
<input type="text" class="form-control required" id="FileName" name="FileName" readonly>
|
|
</div>
|
|
<div class="box-header">
|
|
<input type="file" accept=".xlsx" onchange="readURL(this);" id="userfile" name="userfile"/>
|
|
|
|
|
|
<label for="photo">Select Excel File to upload<br/>(only .xls)</label>
|
|
</div>
|
|
<div class="col-md-2 col-md-offset-2">
|
|
<span for="Month">Month</span>
|
|
<input class="date-own form-control" style="width: 100px;" type="text" id="mon" name="mon">
|
|
|
|
<script type="text/javascript">
|
|
$('.date-own').datepicker({
|
|
minViewMode: 1,
|
|
format: 'mm'
|
|
});
|
|
</script>
|
|
</div>
|
|
|
|
<div class="col-md-2 col-md-offset-0">
|
|
<span for="Year">Year</span>
|
|
<input style="width: 100px;" type="text" id="year" name="yr" readonly />
|
|
<script type="text/javascript">
|
|
var today= new Date();
|
|
var year=today.getFullYear();
|
|
|
|
document.getElementById("year").value = year; // $('.date-own').datepicker({
|
|
// //minViewMode: 2,
|
|
// format: 'yyyy'
|
|
// <?php echo base_url() ?>FileUpload2
|
|
// });
|
|
</script>
|
|
</div>
|
|
<br/>
|
|
<div class="col-md-1 col-md-offset-1">
|
|
<input type="button" class="btn btn-info" value="upload" onclick="save();"/>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</section>
|
|
</div>
|
|
<script>
|
|
function save()
|
|
{
|
|
|
|
var x=checkYearMonthAsEmpty();
|
|
//alert(x);
|
|
if(x == 0)
|
|
{
|
|
//alert($('#userfile').val());
|
|
//$_FILES['userfile']['name']=
|
|
// $.ajax({
|
|
// data:$('#upload').serialize(),
|
|
// type:"POST",
|
|
// //enctype: 'multipart/form-data',
|
|
// url:"<?php echo base_url();?>payslip/uploadExcel2",
|
|
// success:function(result){
|
|
// $('#content').loader('hide');
|
|
// alert("File Uploaded Sucessfully!");
|
|
// alert(result);
|
|
// window.location="purchaseorderListing";
|
|
// //alert("redirect");
|
|
$('form#upload').submit();
|
|
//window.location="ExcelUpload2";
|
|
// }
|
|
//});
|
|
|
|
}else
|
|
{
|
|
alert("Please Provide All Information Correctly!");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
</script>
|
|
|