<?php


function RevisiData() {
    global $objAxpDB;
    //$objAxpDB->Allow_Revisi(false);
    $strSQL=array();
    switch($_REQUEST[mode]) {
        case "simpan_revisi":
            $ssql1="SELECT IFNULL(MAX(ftsales_invoice_no),'') AS M
                    FROM txsales_invoice_adjustment_hdr
                    WHERE ftsales_invoice_no LIKE '{$_REQUEST['ftsales_invoice_no']}-%'";
            $no=RetRstField($ssql1);
            if($no!="") 
            {
                $no1=explode("-",$no);
                $no=(int)$no1[1]+1;
                $str1="-{$no}";
            }
            else 
            {
                $str1="-1";
            }
            $ftsi_no_new="{$_REQUEST['ftsales_invoice_no']}{$str1}";

            $strSQL["Revisi"][]="UPDATE txsales_invoice_adjustment_hdr
                                    SET fnstatus=3,ftsales_invoice_no='{$ftsi_no_new}',
                                        ftmodified_user='{$_SESSION['username']}',fdmodified_date=now()
                                    WHERE ftsales_invoice_no='{$_REQUEST['ftsales_invoice_no']}'";
            $strSQL["Revisi"][]="UPDATE txsales_invoice_adjustment_det
                                    SET ftsales_invoice_no='{$ftsi_no_new}',
                                        ftmodified_user='{$_SESSION['username']}',fdmodified_date=now()
                                    where ftsales_invoice_no='{$_REQUEST['ftsales_invoice_no']}'";
            
              
            // Call Function Revisi General Ledger
            if(function_exists("RevisiGL")) {
                $m = RevisiGL($ftsi_no_new);
                if ($m != '') { $strSQL=array_merge_recursive($strSQL,$m); }
            }
            
            break;

    }

    return $strSQL;
}        
