254 lines
9.3 KiB
PHP
254 lines
9.3 KiB
PHP
<script type="text/javascript">
|
|
var userTarget = "";
|
|
var exit = false;
|
|
$('.input-daterange').datepicker({
|
|
format: "dd/mm/yyyy",
|
|
weekStart: 1,
|
|
orientation: "bottom auto",
|
|
autoclose: true,
|
|
showOnFocus: true,
|
|
maxViewMode: 'days',
|
|
keepEmptyValues: true,
|
|
templates: {
|
|
leftArrow: '<',
|
|
rightArrow: '>'
|
|
}
|
|
});
|
|
$('.input-daterange').focusin(function(e) {
|
|
userTarget = e.target.name;
|
|
});
|
|
$('.input-daterange').on('changeDate', function(e) {
|
|
if (exit) return;
|
|
if (e.target.name != userTarget) {
|
|
exit = true;
|
|
$(e.target).datepicker('clearDates');
|
|
}
|
|
exit = false;
|
|
});
|
|
</script>
|
|
<?php
|
|
$thn=date('Y');
|
|
?>
|
|
<br>
|
|
<br>
|
|
<br>
|
|
<br>
|
|
<br>
|
|
|
|
<div class="input-group my-group">
|
|
<input type="text" class="form-control" style="width:10%; display:none;border-color:#f3f3f3;text-align: center;" name="thn1" id="thn1" value="<?php echo $thn; ?>">
|
|
<select id="c1" name="c1" class="selectpicker form-control" style="width:20%;background-color:#f3f3f3;border-color:#f3f3f3;">
|
|
<option value></option>
|
|
<option value="Surat Masuk">Surat Masuk</option>
|
|
<option value="Surat Keluar">Surat Keluar</option>
|
|
<option value="Arsip">Arsip</option>
|
|
<!--<option value="pdf_sm">--</option>
|
|
<option value="pdf_sk">--</option>
|
|
<option value="pdf_arsip">--</option>-->
|
|
</select>
|
|
<div class="input-group input-daterange" style="width:70%;" name="pd1" id="pd1">
|
|
<input type="text" id="tgl_mulai1" name="start" class="form-control" style="border-radius: 0px;border-color:#f3f3f3;text-align: center; ">
|
|
<span class="input-group-addon">s/d</span>
|
|
<input type="text" id="tgl_selesai1" name="finish" class="form-control" style="border-radius: 0px;border-color:#f3f3f3;text-align: center;">
|
|
</div>
|
|
<span class="input-group-btn">
|
|
<button type="button" id="b1" name="b1" class="btn btn-danger"><i class="fa fa-search"></i></button>
|
|
<button type="button" id="b2" name="b2" class="btn btn-danger"><i class="glyphicon glyphicon-print"></i></button>
|
|
<button type="button" id="b3" name="b3" class="btn btn-success"><i class="fa fa-arrow-up m-r-5"></i>Excel</button>
|
|
</span>
|
|
</div>
|
|
<hr>
|
|
<div id="tabel_tb1"></div>
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
$('#b2').prop("disabled", true);
|
|
$('#b3').prop("disabled", true);
|
|
|
|
$('#c1').change(function(){
|
|
$('#tgl_mulai1').val('');
|
|
$('#tgl_selesai1').val('');
|
|
$('#tgl_mulai1').first().focus().selected();
|
|
});
|
|
|
|
|
|
$('#tgl_selesai1').change(function(){
|
|
var b=$('#tgl_mulai1').val();
|
|
var c=$('#tgl_selesai1').val();
|
|
$('#b1').trigger('click');
|
|
});
|
|
|
|
$('#b1').click(function(){
|
|
var t=$('#thn1').val();
|
|
var b=$('#tgl_mulai1').val();
|
|
var c=$('#tgl_selesai1').val();
|
|
var a=$('#c1').val();
|
|
if (a=='Surat Masuk') {
|
|
var key='sm';
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "app/laporan/crud.php",
|
|
data: 'tm1='+b
|
|
+'&ts1='+c
|
|
+'&thn='+t
|
|
+'&key='+key,
|
|
success: function(data){
|
|
if (data=='1') {
|
|
$('#tabel_tb1').load('app/laporan/tabel_tb1.php',{tm1:b,ts1:c});
|
|
$('#b2').prop("disabled", false);
|
|
$('#b3').prop("disabled", false);
|
|
$('#tabel_tb1').show();
|
|
} else {
|
|
alert('data tidak ada..');
|
|
$('#tabel_tb1').hide();
|
|
$('#b2').prop("disabled", true);
|
|
$('#b3').prop("disabled", true);
|
|
}
|
|
}
|
|
});
|
|
} else
|
|
if (a=='Surat Keluar') {
|
|
var key='sk';
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "app/laporan/crud.php",
|
|
data: 'tm1='+b
|
|
+'&ts1='+c
|
|
+'&thn='+t
|
|
+'&key='+key,
|
|
success: function(data){
|
|
if (data=='1') {
|
|
$('#tabel_tb1').load('app/laporan/tabel_tb2.php',{tm1:b,ts1:c});
|
|
$('#b2').prop("disabled", false);
|
|
$('#b3').prop("disabled", false);
|
|
$('#tabel_tb1').show();
|
|
} else {
|
|
alert('data tidak ada..');
|
|
$('#tabel_tb1').hide();
|
|
$('#b2').prop("disabled", true);
|
|
$('#b3').prop("disabled", true);
|
|
}
|
|
}
|
|
});
|
|
} else
|
|
if (a=='Arsip') {
|
|
var key='ar';
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "app/laporan/crud.php",
|
|
data: 'tm1='+b
|
|
+'&ts1='+c
|
|
+'&thn='+t
|
|
+'&key='+key,
|
|
success: function(data){
|
|
if (data=='1') {
|
|
$('#tabel_tb1').load('app/laporan/tabel_tb3.php',{tm1:b,ts1:c});
|
|
$('#b2').prop("disabled", false);
|
|
$('#b3').prop("disabled", false);
|
|
$('#tabel_tb1').show();
|
|
} else {
|
|
alert('data tidak ada..');
|
|
$('#tabel_tb1').hide();
|
|
$('#b2').prop("disabled", true);
|
|
$('#b3').prop("disabled", true);
|
|
}
|
|
}
|
|
});
|
|
} /*else
|
|
if (a=='pdf_sm') {
|
|
$('#b2').prop("disabled", false);
|
|
} else
|
|
if (a=='pdf_sk') {
|
|
$('#b2').prop("disabled", false);
|
|
} else
|
|
if (a=='pdf_arsip') {
|
|
$('#b2').prop("disabled", false);
|
|
}*/
|
|
|
|
});
|
|
|
|
$('#c1').focusin(function(){
|
|
$('#tabel_tb1').hide();
|
|
$('#tgl_mulai1').val('');
|
|
$('#tgl_selesai1').val('');
|
|
$('#b2').prop("disabled", true);
|
|
$('#b3').prop("disabled", true);
|
|
});
|
|
|
|
function print() {
|
|
var t=$('#thn1').val();
|
|
var b=$('#tgl_mulai1').val();
|
|
var c=$('#tgl_selesai1').val();
|
|
var a=$('#c1').val();
|
|
var w = 1000;
|
|
var h = 800;
|
|
var left = Number((screen.width/2)-(w/2));
|
|
var tops = Number((screen.height/2)-(h/2));
|
|
$.post('app/laporan/print.php', {a:a,tm1:b,ts1:c}, function (result) {
|
|
WinId = window.open('', 'newwin', 'toolbar=no, location=no, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+tops+', left='+left);
|
|
WinId.document.open();
|
|
WinId.document.write(result);
|
|
WinId.document.close();
|
|
WinId.focus();
|
|
});
|
|
}
|
|
|
|
$('#b2').click(function(){
|
|
var a2=$('#c1').val();
|
|
if (a2=='Surat Masuk') {
|
|
var w2 = 600;
|
|
var h2 = 800;
|
|
var left2 = Number((screen.width/2)-(w/2));
|
|
var tops2 = Number((screen.height/2)-(h/2));
|
|
var b2=$('#tgl_mulai1').val();
|
|
var c2=$('#tgl_selesai1').val();
|
|
window.open('app/laporan/pdf_sm.php?tm2='+b2+'&ts2='+c2,'newwin','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no,width='+w2+', height='+h2+', top='+tops2+', left='+left2);
|
|
} else
|
|
if (a2=='Surat Keluar') {
|
|
var w2 = 600;
|
|
var h2 = 800;
|
|
var left2 = Number((screen.width/2)-(w/2));
|
|
var tops2 = Number((screen.height/2)-(h/2));
|
|
var b2=$('#tgl_mulai1').val();
|
|
var c2=$('#tgl_selesai1').val();
|
|
window.open('app/laporan/pdf_sk.php?tm2='+b2+'&ts2='+c2,'newwin','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no,width='+w2+', height='+h2+', top='+tops2+', left='+left2);
|
|
} else
|
|
if (a2=='Arsip') {
|
|
var w2 = 600;
|
|
var h2 = 800;
|
|
var left2 = Number((screen.width/2)-(w/2));
|
|
var tops2 = Number((screen.height/2)-(h/2));
|
|
var b2=$('#tgl_mulai1').val();
|
|
var c2=$('#tgl_selesai1').val();
|
|
window.open('app/laporan/pdf_arsip.php?tm2='+b2+'&ts2='+c2,'newwin','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no,width='+w2+', height='+h2+', top='+tops2+', left='+left2);
|
|
} else {
|
|
print();
|
|
}
|
|
});
|
|
|
|
|
|
function excel() {
|
|
var b=$('#tgl_mulai1').val();
|
|
var c=$('#tgl_selesai1').val();
|
|
var a=$('#c1').val();
|
|
var w = 600;
|
|
var h = 300;
|
|
var left = Number((screen.width/2)-(w/2));
|
|
var tops = Number((screen.height/2)-(h/2));
|
|
window.open('app/laporan/excel.php?tm1='+b+'&ts1='+c+'&a='+a,'newwin','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+tops+', left='+left);
|
|
}
|
|
|
|
$('#b3').click(function(){
|
|
excel();
|
|
});
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|