add simak to git repo
This commit is contained in:
28
app/master/import/crud.php
Normal file
28
app/master/import/crud.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
include("koneksi.php");
|
||||
include("../../koneksi.php");
|
||||
$key=$_POST['key'];
|
||||
$thn=$_POST['thn'];
|
||||
if ($key=='cek_jumlah') {
|
||||
$hitung=mssql_query("SELECT COUNT(anggaran)
|
||||
FROM t_kegiatan
|
||||
WHERE thn='$thn' AND anggaran IS NOT NULL
|
||||
");
|
||||
while($h=mssql_fetch_array($hitung)) {$j=$h[0];}
|
||||
if ($j==0) {echo "kosong";} else {echo "ada";}
|
||||
} else
|
||||
if ($key=='import') {
|
||||
$del=pg_query("DELETE FROM sub_kegiatan WHERE thn='$thn'");
|
||||
$data=mssql_query("SELECT thn,kpa,pptk,UPPER(kegiatan),A,B,C,D,E,F,G,H,REPLACE(sub_kg,':',''),anggaran
|
||||
FROM t_kegiatan
|
||||
WHERE thn='$thn' AND anggaran IS NOT NULL ORDER BY H ASC,kegiatan ASC
|
||||
");
|
||||
while(($xx=mssql_fetch_array($data)) !== FALSE) {
|
||||
$thn=$xx[0];$kpa=$xx[1];$pptk=$xx[2];$kegiatan=$xx[3];$ra=$xx[4];$rb=$xx[5];
|
||||
$rc=$xx[6];$rd=$xx[7];$re=$xx[8];$rf=$xx[9];$rg=$xx[10];$rh=$xx[11];$sub_kegiatan=$xx[12];$anggaran=$xx[13];
|
||||
$ins=pg_query("INSERT INTO sub_kegiatan (thn,kpa,pptk,kegiatan,ra,rb,rc,rd,re,rf,rg,rh,sub_kegiatan,anggaran)
|
||||
VALUES ('$thn','$kpa','$pptk','$kegiatan','$ra','$rb','$rc','$rd','$re','$rf','$rg','$rh','$sub_kegiatan','$anggaran');
|
||||
");
|
||||
}
|
||||
}
|
||||
?>
|
||||
23
app/master/import/koneksi.php
Normal file
23
app/master/import/koneksi.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
|
||||
$myServer = "Microsoft";
|
||||
$myUser = "sa";
|
||||
$myPass = "";
|
||||
$myDB = "akuntansi";
|
||||
|
||||
|
||||
/*
|
||||
$myServer = "10.10.123.7";
|
||||
$myUser = "sa";
|
||||
$myPass = "";
|
||||
$myDB = "simpay";
|
||||
*/
|
||||
//Buat koneksi ke database
|
||||
$dbhandle = mssql_connect($myServer, $myUser, $myPass)
|
||||
or die("Tidak dapat terhubung ke SQL Server pada $myServer");
|
||||
|
||||
//Pilih database
|
||||
$selected = mssql_select_db($myDB, $dbhandle)
|
||||
or die("Couldn't open database $myDB");
|
||||
?>
|
||||
77
app/master/import/main.php
Normal file
77
app/master/import/main.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
include('koneksi.php');
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<div class="row"><div class="col-lg-3">
|
||||
<!--<div class="input-group">
|
||||
<input type="text" id="thn"class="form-control" placeholder="Tahun">
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn waves-effect waves-light btn-default" id="view"> <i class="fa fa-search"></i> </button>
|
||||
|
||||
</span>
|
||||
</div> -->
|
||||
<div class="form-group search-box" style="margin-top:-2px">
|
||||
<input type="text" iid="thn"class="form-control product-search" placeholder="Tahun">
|
||||
<button type="button" class="btn btn-search" id="view"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
<button type="button" class="btn waves-effect waves-light btn-danger" id="import"><i class="fa fa-arrow-circle-down m-r-5"></i>Import</button>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div id="tabel_import"></div>
|
||||
<script>
|
||||
$('#import').hide();
|
||||
$('#view').click(function(){
|
||||
var thn=$('#thn').val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "app/master/import/tabel.php",
|
||||
data: 'thn='+thn,
|
||||
success: function(data){
|
||||
var thn=$('#thn').val();
|
||||
var key='cek_jumlah';
|
||||
$('#tabel_import').load('app/master/import/tabel.php',{thn:thn});
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "app/master/import/crud.php",
|
||||
data: 'thn='+thn
|
||||
+'&key='+key,
|
||||
success: function(data){
|
||||
if (data=='ada') {
|
||||
$('#tabel_import').show();
|
||||
$('#import').show();
|
||||
} else {
|
||||
alert('data tidak ada..');
|
||||
$('#import').hide();
|
||||
$('#tabel_import').hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('#thn').focusin(function(){
|
||||
$('#thn').val('');
|
||||
$('#tabel_import').hide();
|
||||
$('#import').hide();
|
||||
});
|
||||
|
||||
|
||||
$('#import').click(function(){
|
||||
var thn=$('#thn').val();
|
||||
var key='import';
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "app/master/import/crud.php",
|
||||
data: 'thn='+thn
|
||||
+'&key='+key,
|
||||
success: function(data){alert(data);
|
||||
alert('import selesai..');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
58
app/master/import/tabel.php
Normal file
58
app/master/import/tabel.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
include("koneksi.php");
|
||||
$thn=$_POST['thn'];
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$("#tabel_data_import").DataTable({"stateSave": true,"paging": true,"lengthChange": true,"searching": true,"ordering": false,"info": true,"autoWidth": false});
|
||||
</script>
|
||||
|
||||
<table id="tabel_data_import" class="table table-striped table-condensed" cellpadding="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><b>Tahun</b></td>
|
||||
<td><b>KPA</b></td>
|
||||
<td><b>PPTk</b></td>
|
||||
<td><b>Kegiatan</b></td>
|
||||
<td><b>A</b></td>
|
||||
<td><b>B</b></td>
|
||||
<td><b>C</b></td>
|
||||
<td><b>D</b></td>
|
||||
<td><b>E</b></td>
|
||||
<td><b>F</b></td>
|
||||
<td><b>G</b></td>
|
||||
<td><b>H</b></td>
|
||||
<td><b>Sub Kegiatan</b></td>
|
||||
<td><b>Anggaran</b></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$data=mssql_query("SELECT thn,kpa,pptk,UPPER(kegiatan),A,B,C,D,E,F,G,H,REPLACE(sub_kg,':',''),anggaran
|
||||
FROM t_kegiatan
|
||||
WHERE thn='$thn' AND anggaran IS NOT NULL ORDER BY H ASC,kegiatan ASC
|
||||
");
|
||||
while($r=mssql_fetch_array($data)) {
|
||||
?>
|
||||
<td class="kiri"><b><?php echo $r[0]; ?></b></b></td>
|
||||
<td><b><?php echo $r[1]; ?></b></td>
|
||||
<td><b><?php echo $r[2]; ?></b></td>
|
||||
<td><b><?php echo $r[3]; ?></b></td>
|
||||
<td><b><?php echo $r[4]; ?></b></td>
|
||||
<td><b><?php echo $r[5]; ?></b></td>
|
||||
<td><b><?php echo $r[6]; ?></b></td>
|
||||
<td><b><?php echo $r[7]; ?></b></td>
|
||||
<td><b><?php echo $r[8]; ?></b></td>
|
||||
<td><b><?php echo $r[9]; ?></b></td>
|
||||
<td><b><?php echo $r[10]; ?></b></td>
|
||||
<td><b><?php echo $r[11]; ?></b></td>
|
||||
<td><b><?php echo $r[12]; ?></b></td>
|
||||
<td class="kanan" align="right"><b><?php echo number_format($r[13],0,',','.'); ?></b></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user