<?php


function SaveData() {
    global $objAxpDB;
    $strSQL=array();
    switch($_REQUEST[mode]) {
        case "simpan":

            break;
    }
    return $strSQL;

}

function UpdateData() {
        global $objAxpDB;

        $strSQL=array();
        switch($_REQUEST[mode]) {
        case "update":
           $strSQL['Delete tlmachine_det'][]="DELETE FROM tlmachine_det WHERE ftmachine_code='{$_REQUEST['ftmachine_code']}'";
           for($j=1; $j<count($_REQUEST['fnindexD0']); $j++) {
             $strSQL['Insert tlmachine_det'][]="
                      INSERT INTO tlmachine_det (
                      ftbranch_code, fnindex,
                      ftmachine_code, ftitem_code,
                      ftcreated_user, fdcreated_date,
                      ftmodified_user, fdmodified_date
                      ) SELECT
                      '{$_SESSION['strbranch']}' AS ftbranch_code, '{$j}' AS fnindex,
                      '{$_REQUEST['ftmachine_code']}' AS ftmachine_code, '{$_REQUEST['ftitem_codeD0'][$j]}' AS ftitem_code,
                      '{$_SESSION['username']}' AS ftcreated_user, now() AS fdcreated_date,
                      '{$_SESSION['username']}' AS ftmodified_user, now() AS fdmodified_date
                      ";
           }
          break;
    }

    return $strSQL;
   }

  function DeleteData() {
        global $objAxpDB;

        $strSQL=array();
        switch($_REQUEST[mode]) {
        case "hapus":
          $strSQL['Delete tlmachine_det'][]="DELETE FROM tlmachine_det WHERE ftmachine_code='{$_REQUEST['ftmachine_code']}'";
                       break;
		 }
    return $strSQL;

   }
