load->view('template/head');
$appName = $this->session->userdata('appName');
$this->load->view('template/topbar');
$this->load->view('template/sidebar');
// _global function
$this->db->select('Display_Rows,decFormat');
$resGlobal = $this->db->get('tglobalsetting')->result();
foreach($resGlobal as $row) :
$Display_Rows = $row->Display_Rows;
$decFormat = $row->decFormat;
endforeach;
$decFormat = 2;
$FlagUSER = $this->session->userdata['FlagUSER'];
$DefEmp_ID = $this->session->userdata['Emp_ID'];
$TBL_NAME = '';
return false;
if(isset($_POST['submitSync']))
{
$TBL_NAME = $_POST['TBL_NAME'];
//if($TBL_NAME == 'DPHD' || $TBL_NAME == 'ALL')
//{
// DP_HD
// CEK NEW STATUS
$IMP_N = "SELECT KOLOM0, KOLOM1, KOLOM2, KOLOM21, KOLOM22, KOLOM3, KOLOM4, KOLOM5, KOLOM6, KOLOM7
FROM tbl_import";
$ResIMP_N = $this->db->query($IMP_N)->result();
$theRow = 0;
foreach($ResIMP_N as $rowIMP_N) :
$theRow = $theRow + 1;
$KOLOM1 = $rowIMP_N->KOLOM1; // EMP_ID
$KOLOM7 = $rowIMP_N->KOLOM7; // ID NO
$IMP_CN = "tbl_employee WHERE Emp_ID = '$KOLOM1'";
$ResIMP_CN = $this->db->count_all($IMP_CN);
if($ResIMP_CN > 0)
{
$UPD_IMP_N = "UPDATE tbl_employee SET EmpNoIdentity = '$KOLOM7' WHERE Emp_ID = '$KOLOM1'";
$this->db->query($UPD_IMP_N);
echo "$theRow = update
";
}
else
{
echo "$theRow = input
";
$KOLOM2 = $rowIMP_N->KOLOM2; // NAMA AWAL
$KOLOM21 = $rowIMP_N->KOLOM21; // NAMA TENGAH
$KOLOM22 = $rowIMP_N->KOLOM22; // NAMA AKHIR
if($KOLOM21 == '' && $KOLOM22 == '')
$KOLOM23= ""; // NAMA AKHIR
elseif($KOLOM21 != '' && $KOLOM22 == '')
$KOLOM23= "$KOLOM21"; // NAMA AKHIR
elseif($KOLOM21 != '' && $KOLOM22 != '')
$KOLOM23= "$KOLOM21 $KOLOM22"; // NAMA AKHIR
$KOLOM3 = $rowIMP_N->KOLOM3; // PROYEK
$KOLOM4 = $rowIMP_N->KOLOM4; // DIVISI
$KOLOM5 = $rowIMP_N->KOLOM5; // TMP. LAHIR
$KOLOM6 = $rowIMP_N->KOLOM6; // TGL. LAHIR
// INSERT NEW
$INS_IMP_N = "INSERT INTO tbl_employee
(Emp_ID, EmpNoIdentity, Position_ID, First_Name, Last_Name, gender, Birth_Place, Email, Religion, Emp_DeptCode, log_username, log_passHint, log_password, FlagUSER, Employee_status, Emp_Location, writeEMP, editEMP, readEMP, new_stat)
VALUES ('$KOLOM1', '$KOLOM7', 3, '$KOLOM2', '$KOLOM23', 'male', '$KOLOM5', 'mail.sample@nusakonstruksi.com', 'Islam', 6, '$KOLOM1', 'GENUSR', 'c33367701511b4f6020ec61ded352059', 'APPUSR', 1, 1, 0, 0, 1, 1)";
$this->db->query($INS_IMP_N);
// INSERT EMP PROJ
$INS_IMP_O = "INSERT INTO tbl_employee_proj (Emp_ID, proj_Code) VALUES ('$KOLOM1', 'KTR')";
$this->db->query($INS_IMP_O);
// INSERT OTHER
$INS_IMP_O = "INSERT INTO others (NK, U, P) VALUES ('$KOLOM1', '$KOLOM1', '654321')";
$this->db->query($INS_IMP_O);
// INSERT MENU
$INS_IMP_O = "INSERT INTO tusermenu (isChkDetail, emp_id, menu_code) VALUES (261, '$KOLOM1', 'MN268')";
$this->db->query($INS_IMP_O);
}
endforeach;
//}
}
?>