

    <?php

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

                $ssql="DELETE FROM txreject_production_det WHERE fnqty=0 AND ftreject_production_department_no='{$_REQUEST['ftreject_production_department_no']}' ";
                $strSQL['txreject_production_det Index'][]= $ssql;

                $ssql=" update txreject_production_det a,
                                (select c.fnid,(select ifnull(count(d.fnid),0)+1
                                                from txreject_production_det d
                                                where d.fnid < c.fnid and d.ftreject_production_department_no='{$_REQUEST['ftreject_production_department_no']}') as m
                                        from  txreject_production_det c
                                        where c.ftreject_production_department_no='{$_REQUEST['ftreject_production_department_no']}'
                                        ) b
                                set a.fnindex=b.m
                                where a.ftreject_production_department_no='{$_REQUEST['ftreject_production_department_no']}' and a.fnid=b.fnid";

                 $strSQL['txreject_production_det Index'][]= $ssql;

    }
    return $strSQL;
   }



?>