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

                      alert('Kode Ekspedisi sudah dipakai... ');
                <?php
                  }
                  else {
                        ?>


                      submitbutton('Simpan','','','','');

                <?php
                  }

                break;

            }
            die("");
        }

        Getsecurity(35);
      
        $objAxpDB->ViewSQL("SELECT a.fnid, a.ftexpedition_code, a.ftexpedition_name, b.fttrans_status_name FROM tlexpedition a
                                INNER JOIN tstransaction_status b ON a.fnstatus = b.fntrans_status_code WHERE b.fntrans_group_code = 9 ");
        $objAxpDB->ViewCaption("ID, Kode Ekspedisi, Nama Ekspedisi, Status");

        $objAxpDB->FormName("Ekspedisi");
        $objAxpDB->FormSQL("SELECT  ftexpedition_code, ftexpedition_name, fnstatus FROM tlexpedition");

        $objAxpDB->FormCaption(" Kode Ekspedisi, Nama Ekspedisi, Status");
        $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->FormPosition("TL,TL,TL");
        $objAxpDB->SetStatus("id");
        if ($objAxpDB->GetStatus("id") == "") {
                $objAxpDB->ButtonShow("baru,cetak_daftar, export_excel ,tutup");

        }
        elseif ($objAxpDB->GetStatus("id") == 0) {
                $objAxpDB->ButtonShow("reset, simpan, tutup");

        }
        elseif ($objAxpDB->GetStatus("id") != 0) {
                $objAxpDB->ButtonShow("update, hapus, tutup");
                $objAxpDB->FormLocked("1, 0, 0");
        }
        $objAxpDB->Process();
        $objAxpDB->WriteHtmlTable();

?>
