<?php
	$mode_1=$_REQUEST[mode];

	if($_REQUEST[mode]=='update') $_REQUEST[mode]="simpan";
	function SaveData() {
                global $objAxpDB;
                $strSQL=array();
                switch($_REQUEST[mode]) {
			case "simpan":
				for($j=1; $j<count($_REQUEST['ftitem_codeD0']); $j++) {
					 $m=CekDetail_bahan_baku($_REQUEST['ftitem_codeD0'][$j],'',$_REQUEST['ftwarehouse_codeD0'][$j],$_REQUEST['ftlocation_codeD0'][$j],$_REQUEST['fdexp_dateD0'][$j]);
					 $strSQL=$m;
				}
				$strSQL["DEL txstock_adjustment_hdr_bahan_baku"][]="DELETE FROM txstock_adjustment_hdr_bahan_baku WHERE ftstock_adjustment_no='{$_REQUEST['ftstock_adjustment_no']}'";
				$strSQL["DEL txstock_adjustment_hdr_bahan_baku"][]="DELETE FROM txstock_adjustment_det_bahan_baku WHERE ftstock_adjustment_no='{$_REQUEST['ftstock_adjustment_no']}'";
			break;
                }
        return $strSQL;
	}

	function FinalData() {
		global $objAxpDB;
		$strSQL=array();
		$objAxpDB->Allow_Final(true);
		switch($_REQUEST[mode]) {
			case "final":
				$strSQL["DEL txstock_adjustment_hdr_bahan_baku"][]="DELETE FROM txstock_adjustment_hdr_bahan_baku WHERE ftstock_adjustment_no='{$_REQUEST['ftstock_adjustment_no']}'";
				$strSQL["DEL txstock_adjustment_hdr_bahan_baku"][]="DELETE FROM txstock_adjustment_det_bahan_baku WHERE ftstock_adjustment_no='{$_REQUEST['ftstock_adjustment_no']}'";
			break;
		}
		return $strSQL;
	}
        
	function FinalDataLast() {
		global $objAxpDB;
		$strSQL=array();
		$objAxpDB->Allow_Final(true);
		switch($_REQUEST[mode]) {
			case "final":
				$strSQL['a'][]="update txstock_adjustment_hdr_bahan_baku set
                                  fnstatus=2 ,
                                  fdtrans_date='".CDate($_REQUEST['fdtrans_date'])."',
                                  ftnotes='".$_REQUEST['ftnotes']."'
                            where ftstock_adjustment_no='".$_REQUEST['ftstock_adjustment_no']."'";
			break;
		}
	    return $strSQL;
	}

	function UpdateData() {
		global $objAxpDB;
		$objAxpDB->Allow_Update(false);
		$strSQL=array();
		switch($_REQUEST[mode]) {
			case "update":

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

			break;
		}
		return $strSQL;
	}
?>