Пример #1
0
 function update_component()
 {
     $comp = GetAllSelect('payroll_component', 'id')->result();
     foreach ($comp as $c) {
         $data = array('session_id' => $this->new_session, 'payroll_component_id' => $c->id);
         $filter = array('session_id' => 'where/' . $this->new_session, 'payroll_component_id' => 'where/' . $c->id);
         $num_rows = GetAllSelect('payroll_component_session', 'id', $filter)->num_rows();
         if ($num_rows > 0) {
             $this->db->where('session_id', $this->new_session)->where('payroll_component_id', $c->id)->update('payroll_component_session', $data);
         } else {
             $this->db->insert('payroll_component_session', $data);
         }
         $filter2 = array('session_id' => 'where/' . $this->old_session, 'payroll_component_id' => 'where/' . $c->id);
         $comp_sess_before = getValue('id', 'payroll_component_session', $filter2);
         print_ag($comp_sess_before);
         $comp_value = getAll('payroll_component_value', array('payroll_component_session_id' => 'where/' . $comp_sess_before))->row();
         print_ag($comp_value);
         $comp_sess_new = getValue('id', 'payroll_component_session', $filter);
         $num_rows_new = GetAllSelect('payroll_component_value', 'id', array('payroll_component_session_id' => 'where/' . $comp_sess_new))->num_rows();
         if (!empty($comp_value)) {
             $data2 = array('payroll_component_session_id' => $comp_sess_new, 'from' => $comp_value->from, 'to' => $comp_value->to, 'formula' => $comp_value->formula, 'is_condition' => $comp_value->is_condition, 'min' => $comp_value->min, 'max' => $comp_value->max, 'created_by' => sessId(), 'created_on' => dateNow());
             if ($num_rows_new > 0) {
                 $this->db->where('payroll_component_session_id', $comp_sess_new)->update('payroll_component_value', $data2);
             } else {
                 $this->db->insert('payroll_component_value', $data2);
             }
         }
         print_ag($this->db->last_query());
     }
 }
Пример #2
0
 function add()
 {
     $no = $this->input->post('no');
     permissionUser();
     $list = array('barang_id' => $this->input->post('barang_id'), 'deskripsi' => $this->input->post('deskripsi'), 'catatan_barang' => $this->input->post('catatan_barang'), 'jumlah' => $this->input->post('jumlah'), 'satuan' => $this->input->post('satuan'), 'sisa_stok' => $this->input->post('sisa_stok'));
     $data = array('no' => $no, 'kontak_id' => $this->input->post('kontak_id'), 'tgl' => date('Y-m-d', strtotime($this->input->post('tgl'))), 'catatan' => $this->input->post('catatan'), 'project' => $this->input->post('project'), 'status_id' => 1, 'created_by' => sessId(), 'created_on' => dateNow());
     $num_rows = GetAllSelect($this->table_name, 'no', array('no' => 'where/' . $no))->num_rows();
     if ($num_rows > 0) {
         $this->db->where('no', $no)->update($this->table_name, $data);
         $insert_id = getValue('id', $this->table_name, array('no' => 'where/' . $no));
     } else {
         $this->db->insert($this->table_name, $data);
         $insert_id = $this->db->insert_id();
     }
     $this->db->where($this->file_name . '_id', $insert_id)->delete($this->table_name . '_list');
     for ($i = 0; $i < sizeof($list['barang_id']); $i++) {
         $data2 = array($this->file_name . '_id' => $insert_id, 'barang_id' => $list['barang_id'][$i], 'deskripsi' => $list['deskripsi'][$i], 'catatan' => $list['catatan_barang'][$i], 'qty' => str_replace(',', '', $list['jumlah'][$i]), 'satuan_id' => $list['satuan'][$i], 'sisa_stok' => $list['sisa_stok'][$i]);
         $num_rows_list = getAll($this->table_name . '_list', array('barang_id' => 'where/' . $list['barang_id'][$i], $this->file_name . '_id' => 'where/' . $insert_id))->num_rows();
         if ($num_rows_list > 0) {
             $this->db->where('barang_id', $list['barang_id'][$i])->where($this->file_name . '_id', $insert_id)->update($this->table_name . '_list', $data2);
         } else {
             $this->db->insert($this->table_name . '_list', $data2);
         }
     }
     $produksi_ref = array('ref_id' => $insert_id, 'ref_type' => 'wo', 'status' => 1, 'created_by' => sessId(), 'created_on' => dateNow());
     $this->db->insert('produksi_ref', $produksi_ref);
     $this->send_notification($insert_id);
     redirect($this->file_name, 'refresh');
 }
Пример #3
0
 function load_msg_header()
 {
     //CHAT
     $data['users'] = getAll('users', array('username' => 'order/asc'), array('!=id' => sessId()));
     $data['unread_all'] = GetAllSelect('chat', 'is_read', array('is_read' => 'where/0', 'receiver_id' => 'where/' . sessId()))->num_rows();
     $data['messages'] = getAll('chat', array('receiver_id' => 'where/' . sessId(), 'limit' => 'limit/3', 'id' => 'order/desc'))->result();
     $this->load->view('chat/header', $data);
 }
Пример #4
0
 function index()
 {
     $this->data['title'] = $this->title;
     $this->data['main_title'] = $this->title;
     permissionUser();
     $this->data['coa'] = GetAllSelect('sv_setup_coa', 'id,name')->result();
     $this->data['options_po'] = options_row('main', 'get_po', 'id', 'no', '-- Pilih No. Invoice --');
     $this->_render_page($this->module . '/' . $this->file_name . '/index', $this->data);
 }
Пример #5
0
 function input()
 {
     $this->data['title'] = $this->title . ' - Input';
     $this->data['main_title'] = $this->main_title;
     $this->data['file_name'] = $this->file_name;
     $this->data['module'] = $this->module;
     permissionUser();
     $num_rows = getAll($this->table_name)->num_rows();
     $last_id = $num_rows > 0 ? $this->db->select('id')->order_by('id', 'asc')->get($this->table_name)->last_row()->id : 0;
     $this->data['last_id'] = $num_rows > 0 ? $last_id + 1 : 1;
     $this->data['barang'] = getAll('barang')->result_array();
     $this->data['satuan'] = getAll('satuan')->result_array();
     $this->data['kurensi'] = getAll('kurensi')->result();
     $this->data['metode'] = getAll('metode_pembayaran')->result();
     $this->data['gudang'] = getAll('gudang')->result();
     $this->data['options_kontak'] = options_row('main', 'get_kontak', 'id', 'title', '-- Pilih kontak --');
     $this->data['po'] = GetAllSelect('purchase_order', array('id', 'po'), array('is_invoiced' => 'where/0', 'id' => 'order/desc'))->result();
     $this->_render_page($this->module . '/' . $this->file_name . '/input', $this->data);
 }
Пример #6
0
 function update_master_component_value($component_id)
 {
     $today = date('Y-m-d');
     $master_id = GetAllSelect('payroll_master_component', 'payroll_component_id, payroll_master_id', array('payroll_component_id' => 'where/' . $component_id))->result();
     $emp_id = getValue('employee_id', 'payroll_master', array('id' => 'where/' . $master_id));
     $filter = array('payroll_component_id' => 'where/' . $component_id, 'session_id' => 'where/' . $this->session_id);
     $component_session_id = getValue('id', 'payroll_component_session', $filter);
     //lastq();
     $com_val = $this->db->select('*')->where('payroll_component_session_id', $component_session_id)->get('payroll_component_value')->result();
     $formula = '';
     if (!empty($com_val)) {
         //print_ag($com_val);
         foreach ($com_val as $c) {
             $from = date('Y-m-d', strtotime($c->from));
             $to = date('Y-m-d', strtotime($c->to));
             //print_ag("$today lebih besar dari $from , $today kurang dari $to");
             //print_mz($from);
             //if($today > $from && $today < $to)die('s');
             if ($today >= $from && $today <= $to) {
                 $formula = $c->formula;
                 //echo $formula;
                 $is_condition = $c->is_condition;
                 $min = $c->min;
                 $max = $c->max;
             }
         }
     }
     $tx = explode(' ', $formula);
     $r = '';
     foreach ($master_id as $value) {
         if ($formula != null && $component_id != 60) {
             if (!in_array('IF', $tx)) {
                 for ($i = 0; $i < sizeof($tx); $i++) {
                     //print_mz($tx);
                     if (preg_match("/[a-z]/i", $tx[$i])) {
                         $session_id = '2015';
                         $g = getValue('id', 'payroll_component', array('code' => 'where/' . $tx[$i]));
                         $detail = $this->payroll->get_employee_detail($emp_id);
                         $det = $detail->row();
                         $employee_job_id = getValue('job_id', 'hris_employee_job', array('employee_id' => 'where/' . $emp_id));
                         $job_value_id = getValue('job_value_id', 'hris_jobs', array('job_id' => 'where/' . $employee_job_id));
                         $filter = array('session_id' => 'where/' . $session_id, 'job_value_id' => 'where/' . $job_value_id, 'job_class_id' => 'where/' . $det->job_class_id);
                         $job_value_matrix = GetAll('payroll_job_value_matrix', $filter);
                         //lastq();
                         $job_value_matrix_num = GetAll('payroll_job_value_matrix', $filter)->num_rows();
                         //lastq();
                         if ($tx[$i] == 'JVM') {
                             $g = $jvm = $job_value_matrix_num > 0 ? $job_value_matrix->row()->value : 0;
                             //print_r('jvm='.$g.'-');
                         } elseif ($tx[$i] == 'VAR') {
                             $cm_param = GetAll('payroll_compensation_mix', array('session_id' => 'where/' . $session_id, 'job_class_id' => 'where/' . $det->job_class_id));
                             $cm_param_num = GetAll('payroll_compensation_mix', array('session_id' => 'where/' . $session_id, 'job_class_id' => 'where/' . $det->job_class_id))->num_rows();
                             //lastq();
                             $row = $cm_param->row();
                             $g = $var = $cm_param_num > 0 ? $row->var / 100 : 0 / 100;
                             //print_mz('var='.$var.'-');
                         } elseif ($tx[$i] == 'CONV') {
                             $g = getValue('value', 'payroll_exchange_rate', array('session_id' => 'where/' . $session_id));
                         } else {
                             $g = getValue('value', 'payroll_master_component', array('payroll_master_id' => 'where/' . $value->payroll_master_id, 'payroll_component_id' => 'where/' . $g));
                             //print_r($g.'-');
                         }
                         //print_r($value->component.'='.$g.'<br/>');
                         $tx[$i] = $g;
                     }
                     if (strpos($tx[$i], '%') !== false) {
                         $tx[$i] = substr_replace($tx[$i], '/100', -1);
                     } else {
                         false;
                     }
                     $r .= $tx[$i];
                 }
             } else {
                 $com = explode(PHP_EOL, $formula);
                 //print_ag($com);
                 for ($j = 0; $j < sizeof($com); $j++) {
                     $ntx = '';
                     $bwgs = getValue('value', 'payroll_master_component', array('payroll_master_id' => 'where/' . $value->payroll_master_id, 'payroll_component_id' => 'where/60'));
                     $hous = getValue('value', 'payroll_master_component', array('payroll_master_id' => 'where/' . $value->payroll_master_id, 'payroll_component_id' => 'where/66'));
                     //print_mz($xj[$i]);
                     $bwgshous = $bwgs + $hous;
                     //print_mz($bwgshous);
                     $xj = explode(' ', $com[$j]);
                     //print_ag($xj);
                     $n = '';
                     for ($i = 7; $i < sizeof($xj); $i++) {
                         if (preg_match("/[a-z]/i", $xj[$i])) {
                             //echo $j.'-'.$xj[$i].'<br/>';
                             switch ($xj[$i]) {
                                 case 'TK0':
                                     $xj[$i] = getValue('value', 'payroll_ptkp', array('title' => 'where/' . 'TK0'));
                                     break;
                                 case 'K0':
                                     $xj[$i] = getValue('value', 'payroll_ptkp', array('title' => 'where/' . 'K0'));
                                     break;
                                 case 'K1':
                                     $xj[$i] = getValue('value', 'payroll_ptkp', array('title' => 'where/' . 'K1'));
                                     //print_mz($xj[$i]);
                                     break;
                                 case 'K2':
                                     $xj[$i] = getValue('value', 'payroll_ptkp', array('title' => 'where/' . 'K2'));
                                     break;
                                 case 'K3':
                                     $xj[$i] = getValue('value', 'payroll_ptkp', array('title' => 'where/' . 'K3'));
                                     break;
                                 case 'UMK':
                                     //$xj[$i]=getValue('value', 'UMK', array('session'=>'where/'.$session_id));
                                     $xj[$i] = 3000000;
                                     break;
                                 default:
                                     //print_ag($xj[$i]);
                                     $code = getValue('id', 'payroll_component', array('code' => 'where/' . $xj[$i]));
                                     $xj[$i] = getValue('value', 'payroll_master_component', array('payroll_master_id' => 'where/' . $value->payroll_master_id, 'payroll_component_id' => 'where/' . $code));
                                     //print_ag($xj[$i]);
                                     break;
                             }
                             //print_ag('awa'.$j.'-'.$xj[$i]);
                         }
                         //print_ag($value->component);
                         //print_ag($xj[$i]);
                         if ($xj[$i] == '%') {
                             $xj[$i] = '/100';
                             //print_ag('ke_replace '.$xj[$i]);
                         }
                         $ntx .= $xj[$i];
                     }
                     //print_ag($value->code);
                     //print_ag($xj);
                     if ($xj[6] == '>') {
                         $f = current(explode(";", $ntx));
                         //print_mz($ntx);
                         $f = $this->evalmath($f);
                         $f = @eval("return " . $f . ";");
                         //print_mz($f);
                         $l = substr($ntx, strpos($ntx, ";") + 1);
                         //print_ag($j.'-'.$l);
                         $l = $this->evalmath($l);
                         $l = @eval("return " . $l . ";");
                         //print_ag('>'.$bwgshous.$xj[6].$f.'='.$r);
                         //print_mz($bwgshous.' > '.$f);
                         if ($bwgshous > $f) {
                             $r = $l;
                         }
                     } elseif ($xj[6] == '<') {
                         $f = current(explode(";", $ntx));
                         //print_mz($ntx);
                         $f = $this->evalmath($f);
                         $f = @eval("return " . $f . ";");
                         //print_mz($f);
                         $l = substr($ntx, strpos($ntx, ";") + 1);
                         //print_ag($j.'-'.$l);
                         $l = $this->evalmath($l);
                         $l = @eval("return " . $l . ";");
                         //print_ag('>'.$bwgshous.$xj[6].$f.'='.$r);
                         //print_mz($bwgshous.' > '.$f);
                         if ($bwgshous < $f) {
                             $r = $l;
                         }
                     } elseif ($xj[6] == '<=') {
                         $f = current(explode(";", $ntx));
                         //print_mz($ntx);
                         $f = $this->evalmath($f);
                         $f = @eval("return " . $f . ";");
                         //print_mz($f);
                         $l = substr($ntx, strpos($ntx, ";") + 1);
                         //print_ag($j.'-'.$l);
                         $l = $this->evalmath($l);
                         $l = @eval("return " . $l . ";");
                         //print_ag('>'.$bwgshous.$xj[6].$f.'='.$r);
                         //print_mz($bwgshous.' > '.$f);
                         if ($bwgshous <= $f) {
                             $r = $l;
                         }
                     } elseif ($xj[6] == '>=') {
                         $f = current(explode(";", $ntx));
                         //print_mz($ntx);
                         $f = $this->evalmath($f);
                         $f = @eval("return " . $f . ";");
                         //print_mz($f);
                         $l = substr($ntx, strpos($ntx, ";") + 1);
                         //print_ag($j.'-'.$l);
                         $l = $this->evalmath($l);
                         $l = @eval("return " . $l . ";");
                         //print_ag('>'.$bwgshous.$xj[6].$f.'='.$r);
                         //print_mz($bwgshous.' > '.$f);
                         if ($bwgshous >= $f) {
                             $r = $l;
                         }
                     }
                     //print_ag($bwgshous.$xj[6].$f.'='.$r);
                 }
                 //print_ag($bwgshous.$xj[6].$f.$r);
                 //print_ag($bwgshous.$xj[6].$f.$r);
                 //print_mz($com);
                 //print_ag($ntx);
                 //print_ag($f);
             }
             $f = $this->evalmath($r);
             $tz = @eval("return " . $f . ";");
             //print_ag($tz);
             //$is_condition = getValue('is_condition', 'payroll_component_value', array('payroll_component_id'=>'where/'.$value->component_id));
             //$is_condition = 0;
             if ($is_condition == 1) {
                 //$min = 1000;
                 //$max = 70000000;
                 //$min = getValue('min', 'payroll_component_value', array('payroll_component_id'=>'where/'.$value->component_id));
                 //$max = getValue('max', 'payroll_component_value', array('payroll_component_id'=>'where/'.$value->component_id));
                 if ($tz > $max) {
                     $tz = $max;
                 } elseif ($tz < $min) {
                     $tz = $min;
                 } else {
                     $tz = $tz;
                 }
             }
             $this->db->where('payroll_master_id', $value->payroll_master_id)->where('payroll_component_id', $component_id)->update('payroll_master_component', array('value' => $tz));
             //echo '<pre>';print_r($this->db->last_query());echo "</pre><br/>";
         }
     }
 }
Пример #7
0
 function insert_all_po_status()
 {
     $q = GetAllSelect('purchase_order', 'id')->result();
     foreach ($q as $k) {
         $this->insert_po_status($k->id);
         print_r($this->db->last_query());
     }
 }
Пример #8
0
 function cek_stok($id)
 {
     $num_rows = GetAllSelect('stok', 'barang_id', array('barang_id' => 'where/' . $id))->num_rows();
     $data = array('barang_id' => $id, 'created_by' => sessId(), 'created_on' => dateNow());
     if ($num_rows < 1) {
         $this->db->insert('stok', $data);
     }
     return true;
 }
Пример #9
0
 function cek_master_component_monthly($session_id = 2015)
 {
     $master = GetAllSelect('payroll_master', 'id')->result();
     foreach ($master as $m) {
         $master_id = $m->id;
         //$filter =  array('id'=>'where/'.$m->id, 'session_id'=>'where/'.sessNow());
         $filter = array('id' => 'where/' . $m->id);
         $group_id = getValue('payroll_group_id', 'payroll_master', $filter);
         //print_mz($group_id);
         $group_id = getValue('id', 'payroll_group', array('job_class_id' => 'where/' . $group_id));
         //lastq()
         $cek_group_component = GetAllSelect('payroll_group_component', 'payroll_component_id', array('payroll_group_id' => 'where/' . $group_id));
         //print_mz($cek_group_component->result());
         foreach ($cek_group_component->result() as $r) {
             $component_num_rows = GetAllSelect('payroll_master_component', 'payroll_component_id', array('payroll_master_id' => 'where/' . $master_id, 'payroll_component_id' => 'where/' . $r->payroll_component_id))->num_rows();
             //print_r("num_rows-".$component_num_rows);
             if ($component_num_rows < 1) {
                 $data = array('payroll_master_id' => $master_id, 'payroll_component_id' => $r->payroll_component_id, 'value' => 0);
                 $this->db->insert('payroll_master_component', $data);
             }
         }
     }
 }
Пример #10
0
 function get_status($id)
 {
     $pr_in_po = GetAllSelect('purchase_order_list', 'request_id', array('request_id' => 'where/' . $id))->num_rows();
     //lastq();print_mz($pr_in_po);
     $num_in_pr = $this->db->select_sum('jumlah')->where('request_id', $id)->get('purchase_request_list')->row()->jumlah;
     $num_in_po = $this->db->select_sum('jumlah')->where('request_id', $id)->get('purchase_order_list')->row()->jumlah;
     if ($num_in_po >= $num_in_pr) {
         return "Close";
     } elseif ($num_in_po < $num_in_pr && $pr_in_po > 0) {
         return "Parsial";
     } elseif ($pr_in_po < 1) {
         return "Open";
     } else {
         "-";
     }
 }
Пример #11
0
 /**
  * Load view
  *
  * @access  public
  * @param   string  $view
  * @param   mixed   $data
  * @param   boolean $return
  * @return  void
  */
 public function load_view($view, $data = array(), $return = FALSE)
 {
     // Not include master view on ajax request
     if ($this->_ci->input->is_ajax_request()) {
         $this->_ci->load->view($view, $data);
         return;
     }
     // Title
     if (empty($this->title)) {
         $title = $this->brand_name;
     } else {
         $title = $this->title . $this->title_separator . $this->brand_name;
     }
     // Description
     $description = $this->description;
     // Metadata
     $metadata = array();
     foreach ($this->metadata as $name => $content) {
         if (strpos($name, 'og:') === 0) {
             $metadata[] = '<meta property="' . $name . '" content="' . $content . '">';
         } else {
             $metadata[] = '<meta name="' . $name . '" content="' . $content . '">';
         }
     }
     $metadata = implode('', $metadata);
     // Javascript
     $js = array();
     foreach ($this->js as $js_file) {
         $js[] = '<script src="' . assets_url($js_file) . '"></script>';
     }
     $js = implode('', $js);
     // additionalscript
     $script = array();
     foreach ($this->script as $script_file) {
         $script[] = $script_file;
     }
     $script = implode('', $script);
     // CSS
     $css = array();
     foreach ($this->css as $css_file) {
         $css[] = '<link rel="stylesheet" href="' . assets_url($css_file) . '">';
     }
     $css = implode('', $css);
     //HEADER
     $photo = getValue('photo', 'users', array('id' => 'where/' . sessId()));
     $data['photo_profile'] = !empty($photo) ? base_url('uploads/' . sessId() . '/80x80/' . $photo) : assets_url('assets/images/no-image.png');
     $data['sess_name'] = getValue('username', 'users', array('id' => 'where/' . sessId()));
     $data['notification'] = GetAll('notifikasi', array('is_read' => 'where/0', 'receiver_id' => 'where/' . sessId(), 'limit' => 'limit/3', 'id' => 'order/desc'));
     $data['notifications'] = GetAll('notifikasi', array('is_read' => 'where/0', 'receiver_id' => 'where/' . sessId(), 'id' => 'order/desc'));
     $data['notification_num'] = GetAll('notifikasi', array('is_read' => 'where/0', 'receiver_id' => 'where/' . sessId()))->num_rows();
     //CHAT
     //$data['users'] = getAll('users', array('username'=>'order/asc'), array('!=id'=>sessId()));
     $data['users'] = getAll('users', array('username' => 'order/asc'));
     $data['unread_all'] = GetAllSelect('chat', 'is_read', array('is_read' => 'where/0', 'receiver_id' => 'where/' . sessId()))->num_rows();
     $data['messages'] = getAll('chat', array('receiver_id' => 'where/' . sessId(), 'limit' => 'limit/3', 'id' => 'order/desc'))->result();
     $header = $this->_ci->load->view('header', $data, TRUE);
     $chat_bar = $this->_ci->load->view('chat', $data, TRUE);
     $footer = $this->_ci->load->view('footer', array(), TRUE);
     $sidebar = $this->_ci->load->view('sidebar', array(), TRUE);
     $main_content = $this->_ci->load->view($view, $data, TRUE);
     $body = $this->_ci->load->view('layout/' . $this->layout, array('header' => $header, 'chat_bar' => $chat_bar, 'footer' => $footer, 'sidebar' => $sidebar, 'main_content' => $main_content), TRUE);
     return $this->_ci->load->view('base_view', array('title' => $title, 'description' => $description, 'metadata' => $metadata, 'js' => $js, 'css' => $css, 'additionalscript' => $script, 'body' => $body, 'ga_id' => $this->ga_id), $return);
 }
Пример #12
0
 function add_so()
 {
     permissionUser();
     //$this->data['so'] = GetAllSelect('sales_order', array('id','so'), array('id'=>'order/desc'))->result();
     $this->data['so'] = GetAllSelect('stok_pengeluaran', array('id', 'created_on'), array('id' => 'order/desc'))->result();
     $this->load->view($this->module . '/' . $this->file_name . '/no_so', $this->data);
 }
Пример #13
0
    //$photo_chat = (!empty($u->photo)) ? base_url('uploads/'.$u->id.'/80x80/'.$u->photo): assets_url('assets/images/no-image.png');
    ?>
                    <img alt="<?php 
    echo $u->username;
    ?>
" height="25px" width="25px" src="<?php 
    echo $photo_chat;
    ?>
" class="media-object">
                    <div class="media-body">
                      <h4 class="media-heading"><?php 
    echo $u->username;
    ?>
</h4>
                      <?php 
    $unread_single = GetAllSelect('chat', 'is_read', array('is_read' => 'where/0', 'receiver_id' => 'where/' . sessId(), 'sender_id' => 'where/' . $u->id))->num_rows();
    ?>
                      <?php 
    echo $unread_single != 0 ? '<span class="badge" id="msgs-badge">' . $unread_single . '</span>' : '';
    ?>
                    </div>
                  </a>
                </li>
              <?php 
}
?>
              </ul>
            </div>
          </div>
          <div class="user-chat">
            
Пример #14
0
 function get_status($id)
 {
     $po_in_stok = GetAllSelect('stok_pengeluaran_list', 'order_id', array('order_id' => 'where/' . $id))->num_rows();
     $num_in_po = $this->db->select_sum('jumlah')->where('order_id', $id)->get('sales_order_list')->row()->jumlah;
     $num_in_stok = $this->db->select_sum('jumlah')->where('order_id', $id)->get('stok_pengeluaran_list')->row()->jumlah;
     if ($num_in_stok >= $num_in_po) {
         return "Close";
     } elseif ($num_in_stok < $num_in_po && $po_in_stok > 0) {
         return "Parsial";
     } elseif ($po_in_stok < 1) {
         return "Open";
     } else {
         "-";
     }
 }
Пример #15
0
 function get_umk($sess_id)
 {
     /*
     $filter = array('session_id'=>'where/'.$sess_id                        );
     $v = getAll('payroll_umk', $filter);
     
     if ($v->num_rows() > 0) {
         $v = $v->row();
         echo json_encode(array('value'=>$v->value, 'id'=>$v->id));
     } else {
         echo json_encode(array('value'=> 0, 'id'=> 0));
     }
     */
     //print_mz($v);
     $this->data['sess_id'] = $sess_id;
     //$this->data['umk_value'] = $this->payroll->get_umk($sess_id);print_mz($this->data['umk_value']->result());
     $this->data['city'] = GetAllSelect('payroll_umk_city', 'id, title');
     //print_mz($this->data['city']->result());
     $this->load->view('config_tax/umk', $this->data);
 }
Пример #16
0
 function overtime($user = "******", $tgl = "0000-00-00", $dep = "0", $status = "0")
 {
     //Set Global
     permission();
     $data['filename'] = 'overtime';
     $data['title'] = 'Overtime';
     $data['path_file'] = $this->filename;
     //if($user == 0 && $tgl == "0000-00-00" && !$this->uri->segment(5)) $tgl = date("Y-m-d");
     $data['tgl'] = $tgl;
     $exp = explode("~", $tgl);
     if ($exp[0] != "0000-00-00") {
         $data['start_date'] = $exp[0];
         if (!isset($exp[1])) {
             $data['end_date'] = $exp[0];
         } else {
             if (!$exp[1]) {
                 $data['end_date'] = $exp[0];
             } else {
                 $data['end_date'] = $exp[1];
             }
         }
         if ($exp[1]) {
             $data['period'] = GetMonth(substr($exp[1], 5, 2)) . " " . substr($exp[1], 0, 4);
         } else {
             $data['period'] = "";
         }
     } else {
         $dt = "Dec 2015";
         //date("M Y");
         $period = GetPeriod($dt);
         $data['start_date'] = substr($period, 0, 10);
         $data['end_date'] = substr($period, 11, 10);
         $data['period'] = $dt;
     }
     $path_paging = base_url() . $this->filename . "/main/" . $user . "/" . $tgl . "/" . $dep . "/" . $status;
     $uri_segment = 7;
     $pg = $this->uri->segment($uri_segment);
     $per_page = 15;
     //End Global
     $filter_where_in = array();
     $exp = explode("-", $exp[0]);
     if (!isset($exp[0])) {
         $exp[0] = "";
     }
     if (!isset($exp[1])) {
         $exp[1] = "";
     }
     if (!isset($exp[2])) {
         $exp[2] = "";
     }
     //if($exp[2] > 0) $filter = array("tahun"=> "order/asc", "bulan"=> "order/asc", "tanggal"=> "order/asc");
     //else $filter = array("id_employee"=> "order/asc", "tahun"=> "order/asc", "bulan"=> "order/asc", "tanggal"=> "order/asc");
     //Grup Admin
     $id_grup = $this->session->userdata("webmaster_grup");
     if ($status) {
         /*if($status == "alpa2")
           {
               $kemarin = date("Y-m-d", mktime(0, 0, 0, $exp[1], $exp[2]-1, $exp[0]));
               $exp_alpa = explode("-", $kemarin);
               $filter["alpa"] = "where/1";
           }
           else */
         if ($status == "jh") {
             $filter['terlambat !='] = "where/1";
         }
         $filter[$status] = "where/1";
     }
     $kondisi = "";
     if ($status == "alpa2") {
         $tgl_alpa = array($exp[2], $exp_alpa[2]);
         $filter_where_in['tanggal'] = $tgl_alpa;
         $bln_alpa = array($exp[1], $exp_alpa[1]);
         $filter_where_in['bulan'] = $bln_alpa;
         $thn_alpa = array($exp[0], $exp_alpa[0]);
         $filter_where_in['tahun'] = $thn_alpa;
     } else {
         if ($data['start_date'] == $data['end_date']) {
             if ($exp[0] > 0) {
                 $filter['tahun'] = "where/" . $exp[0];
                 $data['title'] = $this->title . " ( " . $exp[0] . " )";
                 if ($exp[1] > 0) {
                     $filter['bulan'] = "where/" . $exp[1];
                     $data['title'] = $this->title . " ( " . GetMonth(intval($exp[1])) . " " . $exp[0] . " )";
                     if ($exp[2] > 0) {
                         $filter['tanggal'] = "where/" . $exp[2];
                         $data['title'] = $this->title . " ( " . $exp[2] . " " . GetMonth(intval($exp[1])) . " " . $exp[0] . " )";
                     }
                 }
             } else {
                 if ($exp[1] > 0) {
                     $exp[0] = date("Y");
                     $filter['tahun'] = "where/" . $exp[0];
                     $filter['bulan'] = "where/" . $exp[1];
                     $data['title'] = $this->title . " ( " . GetMonth(intval($exp[1])) . " " . $exp[0] . " )";
                     if ($exp[2] > 0) {
                         $filter['tanggal'] = "where/" . $exp[2];
                         $data['title'] = $this->title . " ( " . $exp[2] . " " . GetMonth(intval($exp[1])) . " " . $exp[0] . " )";
                     }
                 } else {
                     if ($exp[2] > 0) {
                         $exp[0] = date("Y");
                         $exp[1] = date("m");
                         $filter['tahun'] = "where/" . $exp[0];
                         $filter['bulan'] = "where/" . $exp[1];
                         $filter['tanggal'] = "where/" . $exp[2];
                         $data['title'] = $this->title . " ( " . $exp[2] . " " . GetMonth(intval($exp[1])) . " " . $exp[0] . " )";
                     }
                 }
             }
         }
     }
     if ($dep) {
         /*$ex = explode("-",$dep);
           $dep=array();
           foreach($ex as $r)
           {
               $dep[] = $r;
           }
           $filter_where_in['id_department'] = $dep;*/
         $filter['id_department'] = "where/" . $dep;
     }
     //else $dep=array();
     if ($user) {
         $temp_user = $user;
         $ex = explode("-", $user);
         $user = array();
         foreach ($ex as $r) {
             $user[] = $r;
         }
         $filter_where_in['id_employee'] = $user;
         $user = $temp_user;
         if ($data['start_date']) {
             $filter['date_full >='] = "where/" . $data['start_date'];
             $filter['date_full <='] = "where/" . $data['end_date'];
         }
     }
     //else $user=array();
     $data['spic'] = $user;
     $data['sdep'] = $dep;
     /*$data['stgl'] = $exp[2];
       $data['sbln'] = $exp[1];
       $data['sthn'] = $exp[0];*/
     $filter['person_nm'] = "order/asc";
     $filter['lembur'] = "where/1";
     //if(count($user) > 0 || $exp[2] > 0)
     if ($exp[2] > 0 && $data['start_date'] == $data['end_date'] || $user) {
         $data['flag_tgl'] = 1;
         $data['grid'] = array("Nama Karyawan", "Tanggal", "OT. Incidental", "Kelebihan Jam Kerja", "Tunjangan Hari Kerja", "Alasan Lembur", "Scan Masuk", "Scan Pulang", "Keterangan");
         $data['list'] = array("id_employee", "tgl", "ot_incidental", "ot_allow_shift", "ot_cont_allow", "alasan_lembur", "scan_masuk", "scan_pulang", "keterangan");
         if ($status == "alpa2") {
             $sql = "select * from kg_view_kehadiran_mcci where tanggal='" . $exp[2] . "' AND bulan='" . $exp[1] . "' AND tahun='" . $exp[0] . "' AND alpa='1'\n                AND id_employee in (select id_employee from kg_view_kehadiran where tanggal='" . $exp_alpa[2] . "' AND bulan='" . $exp_alpa[1] . "' AND tahun='" . $exp_alpa[0] . "' AND alpa='1')";
             $data['query_all'] = $this->db->query($sql);
             if (!$pg) {
                 $pg = 0;
             }
             $data['query_list'] = $this->db->query($sql . " LIMIT {$pg}, {$per_page}");
         } else {
             $data['query_all'] = GetAll("kg_view_kehadiran", $filter, $filter_where_in);
             $filter['limit'] = $pg . "/" . $per_page;
             $data['query_list'] = GetAll("kg_view_kehadiran", $filter, $filter_where_in);
             //lastq();
         }
     } else {
         /*$temp = $filter['id_employee'];
           unset($filter['id_employee']);
           $filter['id_employee'] = $temp;
           $temp = $filter['tanggal'];
           unset($filter['tanggal']);
           $filter['tanggal'] = $temp;
           $temp = $filter['bulan'];
           unset($filter['bulan']);
           $filter['bulan'] = $temp;
           $temp = $filter['tahun'];
           unset($filter['tahun']);
           if($temp == "order/asc") $temp = "where/".date("Y");
           $filter['tahun'] = $temp;*/
         if ($data['start_date']) {
             $filter['date_full >='] = "where/" . $data['start_date'];
             $filter['date_full <='] = "where/" . $data['end_date'];
         }
         $data['flag_tgl'] = 0;
         $data['grid'] = array("Name", "Hour SUM");
         $data['list'] = array("person_nm", "acc_ot_incidental");
         /*if($exp[1] > 0) $filter['group'] = array("employee.id","bulan","tahun");
           elseif($exp[0] > 0) $filter['group'] = array("employee.id","tahun");
           else */
         //$filter['group'] = array("employee.id","tahun");
         $filter['person_nm'] = "group";
         //else $filter['group'] = array("employee.id");
         /*$select = "employee.id as a_id,employee.name, kg_kehadirandetil.id, SUM(kg_kehadirandetil.jhk) as jhk, SUM(kg_kehadirandetil.sakit) as sakit,
           SUM(kg_kehadirandetil.cuti) as cuti,SUM(kg_kehadirandetil.ijin) as ijin,,SUM(kg_kehadirandetil.alpa) as alpa,SUM(kg_kehadirandetil.off) as off,
           SUM(kg_kehadirandetil.potong_gaji) as potong_gaji, SUM(kg_kehadirandetil.pc) as pc,SUM(kg_kehadirandetil.jh) as jh";
           $data['query_all'] = GetJoin("employee","kehadirandetil","kehadirandetil.id_employee=employee.id ".$kondisi, "left", $select, $filter, $filter_where_in);*/
         $select = "id, person_nm, id_employee as a_id, SUM(jhk) as jhk, SUM(ot_incidental) as ot_incidental,SUM(acc_ot_incidental) as acc_ot_incidental,\n            SUM(ot_allow_shift) as ot_allow_shift,SUM(ot_cont_allow) as ot_cont_allow";
         $data['query_all'] = GetAllSelect("kg_view_kehadiran_mcci", $select, $filter);
         //lastq();
         $filter['limit'] = $pg . "/" . $per_page;
         //$data['query_list'] = GetJoin("employee","kehadirandetil","kehadirandetil.id_employee=employee.id ".$kondisi, "left", $select, $filter, $filter_where_in);
         $data['query_list'] = GetAllSelect("kg_view_kehadiran_mcci", $select, $filter);
         unset($filter['person_nm']);
         unset($filter['limit']);
         $query_detail = GetAllSelect("kg_view_kehadiran_mcci", "*", $filter);
         foreach ($query_detail->result_array() as $r) {
             $data['query_detail'][$r['id_employee']][] = $r;
         }
         //print_mz($data['query_detail']);
         //die($this->db->last_query());
     }
     if (!$this->uri->segment(3) && !$this->uri->segment(4) && !$this->uri->segment(5)) {
         $data['dis_tgl'] = "display:none;";
     } else {
         $data['dis_tgl'] = "display:''";
     }
     //Page
     $pagination = Page($data['query_all']->num_rows(), $per_page, $pg, $path_paging, $uri_segment);
     if (!$pagination) {
         $pagination = "<strong>1</strong>";
     }
     $data['pagination'] = $pagination;
     //End Page
     $this->load->view('overtime', $data);
 }
Пример #17
0
 function insert_po_status($id)
 {
     $po_in_stok = GetAllSelect('purchase_return', 'ref_id', array('ref_id' => 'where/' . $id))->num_rows();
     $num_in_po = $this->db->select_sum('jumlah')->where('order_id', $id)->get('purchase_order_list')->row()->jumlah;
     $retur_id = getValue('id', 'purchase_return', array('ref_id' => 'where/' . $id));
     $num_in_stok = $this->db->select_sum('diretur')->where('retur_id', $retur_id)->get('purchase_return_list')->row()->diretur;
     if ($num_in_stok >= $num_in_po) {
         $this->db->where('id', $id)->update('purchase_order', array('status_id' => 4));
     } elseif ($num_in_stok < $num_in_po && $po_in_stok > 0) {
         $this->db->where('id', $id)->update('purchase_order', array('status_id' => 5));
     }
 }
Пример #18
0
 function insert_status($produksi_id, $ref_id, $produksi_ref, $ref, $field)
 {
     $num = GetAllSelect('produksi_list', 'produksi_id', array('produksi_id' => 'where/' . $produksi_id))->num_rows();
     $num_in_ref = $this->db->select_sum('qty')->where($field, $produksi_ref)->get($ref)->row()->qty;
     $produksi_id_list = GetAllSelect('produksi', 'id', array('ref_id' => 'where/' . $ref_id))->result_array();
     //print_mz($produksi_id);
     $produksi_id = array();
     foreach ($produksi_id_list as $key => $value) {
         $produksi_id[] = $value['id'];
     }
     $num_in_list = $this->db->select_sum('jumlah')->where_in('produksi_id', $produksi_id)->get('produksi_list')->row()->jumlah;
     //lastq();
     //print_mz($num_in_ref.'-'.$num_in_list);
     if ($num_in_list >= $num_in_ref) {
         $this->db->where('ref_id', $ref_id)->update('produksi', array('status_id' => 2));
         $this->db->where('id', $ref_id)->update('produksi_ref', array('status' => 2));
     } elseif ($num_in_list <= $num_in_ref && $num > 0) {
         $this->db->where('id', $ref_id)->update('produksi', array('status_id' => 3));
         $this->db->where('id', $ref_id)->update('produksi_ref', array('status' => 3));
     } elseif ($num < 1) {
         $this->db->where('ref_id', $ref_id)->update('produksi', array('status_id' => 1));
         $this->db->where('id', $ref_id)->update('produksi_ref', array('status' => 1));
     } else {
         return true;
     }
 }