adding pdf and phone number

This commit is contained in:
kicap1992
2021-05-22 22:12:14 +08:00
parent 3064eb858c
commit 028dfc9bc5
487 changed files with 10765 additions and 46 deletions

View File

@ -1,9 +1,9 @@
<?php
// header('Access-Control-Allow-Origin: *');
// header('Access-Control-Allow-Methods: GET, POST, DELETE, PUT');
// header('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization');
// header('Access-Control-Allow-Credentials: true');
// header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, DELETE, PUT');
header('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization');
header('Access-Control-Allow-Credentials: true');
header('Content-Type: application/json');
defined('BASEPATH') or exit('No direct script access allowed');
@ -58,8 +58,9 @@ class Api_server extends RestController
if(count($cek_data) > 0){
$this->response(['message' => 'NIK <i>'.$data['nik_karyawan'].'</i> telah terdaftar dalam sistem sebelumnya'], 400);
}else{
$this->model->qrcode_karyawan($data['nik_karyawan']);
$this->model->insert('tb_karyawan',$data);
$this->model->insert('tb_login',['username' => $data['nik_karyawan'],'password' => md5($data['nik_karyawan'])]);
// $this->model->insert('tb_login',['username' => $data['nik_karyawan'],'password' => md5($data['nik_karyawan']),'nik_karyawan' => $data['nik_karyawan']]);
$this->response(['message' => 'ok'], 200);
}
@ -175,6 +176,19 @@ class Api_server extends RestController
if (count($cek_data) > 0) {
$cek_absensi = $this->model->tampil_data_where('tb_absensi',['bulan' => date('m'),'tahun' => date('Y')])->result();
if(count($cek_absensi) > 0){
$array_libur = ($cek_data[0]->detail != null) ? json_decode($cek_data[0]->detail,true) : null;
$libur = false;
$ket_libur = null;
if ($array_libur != null){
foreach ($array_libur as $key => $value) {
if ($value['tanggal'] == date('Y-m-d')) {
$libur = true;
$ket_libur = $value['ket'];
break;
}
}
}
$array_absensi = json_decode($cek_absensi[0]->detail,true);
$tanggal_ada = false;
$nik_ada = false;
@ -199,7 +213,11 @@ class Api_server extends RestController
}
if ($jam_keluar == true){
if ($libur == true) {
$this->response(['message' => $cek_data[0]->nama.' libur karena '. $ket_libur], 401);
}
elseif ($jam_keluar == true){
$this->response(['message' => $cek_data[0]->nama.' telah diabsensi masuk kerja dan pulang kerja pada hari ini'], 401);
}
elseif ($nik_ada == true) {
@ -302,5 +320,20 @@ class Api_server extends RestController
$this->response($cek_data, 200);
}
function notifikasi_post(){
$no_telpon = $this->post('no_telpon');
$cek_data = $this->model->tampil_data_keseluruhan('tb_notifikasi')->result();
if (count($cek_data) == 0) {
$this->model->insert('tb_notifikasi',['no_telpon' => $no_telpon]);
}else{
$this->model->custom_query('UPDATE tb_notifikasi set no_telpon = '.$no_telpon);
}
$this->response(['message' => $no_telpon], 200);
}
}

View File

@ -41,7 +41,7 @@ class Home extends CI_Controller {
$row[] = $no;
$row[] = $field->nik_karyawan;
$row[] = $field->nama;
$row[] = '<center><button type="button" onclick="detail_karyawan('.$field->nik_karyawan.','."'".$field->nama."'".')" class="btn btn-primary btn-circle btn-sm waves-effect waves-light"><i class="ico fa fa-edit"></i></button></center>';
$row[] = '<center><button type="button" onclick="detail_karyawan('.$field->nik_karyawan.','."'".$field->nama."'".')" class="btn btn-primary btn-circle btn-sm waves-effect waves-light"><i class="ico fa fa-edit"></i></button> <button type="button" onclick="qrcode_karyawan('.$field->nik_karyawan.')" class="btn btn-info btn-circle btn-sm waves-effect waves-light"><i class="ico fa fa-qrcode"></i></button></center>';
$data[] = $row;
}
@ -274,6 +274,18 @@ class Home extends CI_Controller {
}
function notifikasi(){
$cek_data = $this->model->tampil_data_keseluruhan('tb_notifikasi')->result();
if (count($cek_data) > 0) {
$main['no_telpon'] = $cek_data[0]->no_telpon;
}else{
$main['no_telpon'] = '';
}
$main['header'] = 'Halaman No Notifikasi';
$this->load->view('home/menu/notifikasi', $main);
}
function cetak($tahun = null, $bulan = null){
if (is_numeric($bulan) && is_numeric($tahun)) {
@ -413,6 +425,61 @@ class Home extends CI_Controller {
redirect('/home/laporan');
}
}
function print_id_karyawan($nik_karyawan = null)
{
// print_r($this->uri->segment(3));
if ($nik_karyawan != null) {
$cek_data = $this->model->tampil_data_where('tb_karyawan',array('nik_karyawan' => $nik_karyawan))->result();
if (count($cek_data) > 0) {
$this->model->qrcode_karyawan($nik_karyawan);
$pdf = new TCPDF('P','mm',array(80,60));
$pdf->setPrintHeader(false);
$pdf->AddPage();
// $pdf->Image(base_url('images/karyawan/'.$nik_karyawan.'.png'),5,7,30);
$html = '
<style>
.ini {
border-bottom: 1px dotted black;
}
.ada {
border-left: 1px solid black;border-bottom: 1px solid black;border-right: 1px solid black;border-top: 1px solid black;
}
.tiada {
border-left: 1px solid black;border-right: 1px solid black;border-top: 1px solid black;
}
.tiada1 {
border-left: 1px solid black;border-right: 1px solid black;
}
</style>
<table width="100%" style="font-size: 10px;">
<tr>
<td width="15%"></td>
<td width="70%" align="center"><img src="'.base_url().'images/karyawan/'.$nik_karyawan.'.png" ></td>
<td width="15%"></td>
</tr>
<tr>
<td width="15%"></td>
<td width="70%" align="center">'.$cek_data[0]->nama.'</td>
<td width="15%"></td>
</tr>
</table>
';
$pdf->writeHTML($html, true, false, true, false, '');
$pdf->output();
}else{
redirect('/home');
}
}
}
function logout()
{