122 lines
3.0 KiB
PHP
Executable File
122 lines
3.0 KiB
PHP
Executable File
|
|
<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> 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><?php //print_r($data);?>
|
|
<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="submit" class="btn btn-info" value="upload" onclick="save();return false;"/>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</section>
|
|
</div>
|
|
<script>
|
|
function save()
|
|
{
|
|
|
|
var x=checkYearMonthAsEmpty();
|
|
//alert(x);
|
|
if(x == 0)
|
|
{
|
|
|
|
$('form#upload').submit();
|
|
$('#userfile').val('');
|
|
$('#mon ').val('');
|
|
|
|
|
|
|
|
}else
|
|
{
|
|
alert("Please Provide All Information Correctly!");
|
|
return false;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|