<?php



 function SaveDataLast() {
        global $objAxpDB;
        $strSQL=array();
        switch($_REQUEST[mode]) {
        case "simpan":

                  $strSQL['update tlemployee_salary_inc_plus2'][]=" UPDATE tlemployee_salary_inc_plus2,tlsalary
                                                            SET tlemployee_salary_inc_plus2.ftsalary_category_code=tlsalary.ftsalary_category_code
                                                            WHERE tlemployee_salary_inc_plus2.ftsalary_code=tlsalary.ftsalary_code
                                                                AND tlemployee_salary_inc_plus2.ftemployee_code='{$_REQUEST['ftemployee_code']}'";


                break;
         }
    return $strSQL;
 }

  function UpdateData() {
        global $objAxpDB;
        $objAxpDB->Allow_Update(true);
        $strSQL=array();
        switch($_REQUEST[mode]) {
        case "update":


                if(isset($_REQUEST['fnindexD0'])) {
                    $strSQL['a'][]="DELETE FROM tlemployee_salary_inc_plus2 WHERE ftemployee_code='".$_REQUEST['ftemployee_code']."'";
				}


               for($j=1; $j<count($_REQUEST['fnindexD0']); $j++) {
                    $strSQL['tlemployee_salary_inc_plus2'][]="INSERT INTO  tlemployee_salary_inc_plus2(
                                                ftbranch_code,fnindex,ftemployee_code,ftsalary_code,
                                                fcamount,fnsalary_period,fnpayroll_slip,ftcreated_user,
                                                fdcreated_date,ftmodified_user,fdmodified_date)
                                                SELECT
                                                '{$_SESSION['strbranch']}' AS ftbranch_code,'{$j}' AS fnindex,'{$_REQUEST['ftemployee_code']}' AS  ftemployee_code,'{$_REQUEST['ftsalary_codeD0'][$j]}' AS ftsalary_code,
                                                '".CCur($_REQUEST['fcamountD0'][$j])."' AS fcamount,'{$_REQUEST['fnsalary_periodD0'][$j]}' AS fnsalary_period,'{$_REQUEST['fnpayroll_slipD0'][$j]}' AS fnpayroll_slip,'{$_SESSION['username']}' AS ftcreated_user,
                                                now() as fdcreated_date,'{$_SESSION['username']}' AS ftmodified_user,now() as fdmodified_date  ";
                }


                  $strSQL['update tlemployee_salary_inc_plus2'][]=" UPDATE tlemployee_salary_inc_plus2,tlsalary
                                                            SET tlemployee_salary_inc_plus2.ftsalary_category_code=tlsalary.ftsalary_category_code
                                                            WHERE tlemployee_salary_inc_plus2.ftsalary_code=tlsalary.ftsalary_code
                                                                AND tlemployee_salary_inc_plus2.ftemployee_code='{$_REQUEST['ftemployee_code']}'";


                break;
        }
    return $strSQL;
   }


   function DeleteData() {
        global $objAxpDB;
         $objAxpDB->Allow_Delete(false);
        $strSQL=array();
        switch($_REQUEST[mode]) {
        case "hapus":
//                        @unlink(_APP_PATH."employee_photo/{$_REQUEST['ftemployee_code']}.jpg");
			$strSQL['DELETE tlemployee'][]="DELETE FROM tlemployee WHERE ftemployee_code='".$_REQUEST['ftemployee_code']."'";
			$strSQL['DELETE tlemployee_load'][]="DELETE FROM tlemployee_load WHERE ftemployee_code='".$_REQUEST['ftemployee_code']."'";
			$strSQL['DELETE tlemployee_salary_inc_plus2'][]="DELETE FROM tlemployee_salary_inc_plus2 WHERE ftemployee_code='".$_REQUEST['ftemployee_code']."'";
                        $strSQL['DELETE tlemployee_salary_dec'][]="DELETE FROM tlemployee_salary_dec WHERE ftemployee_code='".$_REQUEST['ftemployee_code']."'";
			$strSQL['DELETE tlemployee_notes'][]="DELETE FROM tlemployee_notes WHERE ftemployee_code='".$_REQUEST['ftemployee_code']."'";
            break;
		 }
    return $strSQL;

   }




?>
