<?php
     if($_REQUEST['ajax']) {
        switch($_REQUEST['code']) {
            case "transno":
              if(RetRstField("SELECT fnid FROM tlsalary WHERE ftsalary_code='{$_REQUEST['fttrans_no']}'")) {
                  ?>

                  alert('Kode Pendidikan sudah dipakai... ');
            <?php
              }
              else {
                    ?>
					if(confirm('Apakah akan di include ke masing-masing pegawai ...?')) {
						document.getElementById("hidden_flag").value='1';
					}
					else {
						document.getElementById("hidden_flag").value='0';
					}
					submitbutton('Simpan','','','','');

            <?php
              }
            break;
        }
        die("");
    }

    $objAxpDB->ViewName("Daftar Penggajian");
    $objAxpDB->ViewTable("vHRPenggajian");
    $objAxpDB->ViewSQL("select a.fnid, a.ftsalary_code, a.ftsalary_name,b.fttrans_status_name  from tlsalary a left join tstransaction_status b on a.fnsalary_type=b.fntrans_status_code and b.fntrans_group_code = 27 ");
    $objAxpDB->ViewCaption("ID, Kode, Nama, Type Penggajian");

    $objAxpDB->FormName("Pengajian");
    $objAxpDB->FormSQL("select  ftsalary_code, ftsalary_name, ftsalary_category_code, fnsalary_type, fnsalary_period,fnpayroll_slip, ffsalary_formula,fcsalary_amount,fnstatus from tlsalary");
    $objAxpDB->FormCaption("Kode Pengajian, Nama Penggajian,Category Pengajian, Type Penggajian, Periode,Di Bayar Dipengajian, Formula, Jumlah, Status");
    $objAxpDB->FormPosition("TL, TL,TL, TL,TL, TL,  TL,TL,TL");
	$objAxpDB->FormLayout(1, "<input type='hidden' id='hidden_flag' name='hidden_flag' value='0'>");

    $objAxpDB->Lookup("fnsalary_period", "select fntrans_status_code, fttrans_status_name from tstransaction_status where fntrans_group_code = 25", "fntrans_status_code", "fttrans_status_name", 1, True);
    $objAxpDB->Lookup("fnsalary_type", "select fntrans_status_code, fttrans_status_name from tstransaction_status where fntrans_group_code = 27", "fntrans_status_code", "fttrans_status_name", 1, True);
    $objAxpDB->Lookup("fnstatus", "select fntrans_status_code, fttrans_status_name from tstransaction_status where fntrans_group_code = 9", "fntrans_status_code", "fttrans_status_name", 1, True);
    $objAxpDB->Lookup("fnpayroll_slip", "select fntrans_status_code, fttrans_status_name from tstransaction_status where fntrans_group_code = 28", "fntrans_status_code", "fttrans_status_name", 1, True);
    $objAxpDB->Lookup("ftsalary_category_code", "select ftsalary_category_code, ftsalary_category_name from tlsalary_category", "ftsalary_category_code", "ftsalary_category_name", -1, True);
 
    
    $objAxpDB->SetStatus("id, fnStatus");
    if ($objAxpDB->GetStatus("id") == "")
            $objAxpDB->ButtonShow("baru, cetak_daftar, export_excel , tutup");
    elseif ($objAxpDB->GetStatus("id") == 0) {
            $objAxpDB->FormLocked("0, 0, 0");
            $objAxpDB->ButtonShow("reset, simpan, tutup");
    } elseif ($objAxpDB->GetStatus("id") != 0) {
            $objAxpDB->FormLocked("1, 0, 0");
            $objAxpDB->ButtonShow("update, hapus, tutup");
    }
    $objAxpDB->Process();
        $objAxpDB->WriteHtmlTable();


?>
