<?php

switch($_REQUEST[mode]) {
    case "batal":
        $ssql="select a.ftap_no,b.ftpurchase_inv_no
                from txap_hdr a,
                        txap_det b
                where a.ftap_no=b.ftap_no and
                         a.fnstatus<>9
                  and b.ftpurchase_inv_no='{$_REQUEST['ftpurchase_invoice_no']}'";

        $rs=mysql_query($ssql);
        $str="No. Transaksi Penerimaan Hutang ini harus dibatal kan dahulu :";
        while($r=mysql_fetch_assoc($rs)) {
            $str.=$r['ftap_no'];
        }

         if(RetRstField($ssql)) {
               echo "<script>
                    alert('$str');
                    window.history.back();
                </script>";
                die("");
         }

          break;

}


function SaveDataAfter() {

    global $objAxpDB;
    $strSQL=array();
    switch($_REQUEST[mode]) {
    case "simpan":
        // sementara update status supplier. harus benerin form pilih lokal atau impor
        $strSQL['Update status po type'][]=
                        "UPDATE txpurchase_invoice_hdr
                        SET fnpo_type = 0
                        WHERE ftpurchase_invoice_no= '{$_REQUEST['ftpurchase_invoice_no']}' ";

        break;
    }

    return $strSQL;
}    

function CancelData() {

    global $objAxpDB;
    $strSQL=array();
    switch($_REQUEST[mode]) {
    case "batal":
        break;
    }

    return $strSQL;
}    