<?php

class AppLaporanDir extends Database {

   protected $mSqlFile= 'module/laporan_dir/business/laporan_dir.sql.php';
   
   function __construct($connectionNumber=0) {
      parent::__construct($connectionNumber);
   }
   
	function GetDataUserByUsername($name)
   {
      if (isset($this->mUserByUserName[$name])) return $this->mUserByUserName[$name];
      $result = $this->Open($this->mSqlQueries['get_data_user_by_user_name'], array($name));  
      $this->mUserByUserName[$name] = $result[0];
      
		return $result[0];
   }
	
   	# multiunit
	function GetComboGedung(){
            $User = $this->GetDataUserByUsername($_SESSION['username']);
            $kodeSistem = $User['unitkerjaKodeSistem'];
            $array = array($kodeSistem,$kodeSistem.'.%',$kodeSistem,$kodeSistem.'.%',$kodeSistem,$kodeSistem.'.%');
            return $this->Open($this->mSqlQueries['get_combo_gedung'],$array);
	}
	
	# multiunit
	function GetComboPic($id){
            $user = $this->GetDataUserByUsername($_SESSION['username']);
            return $this->Open($this->mSqlQueries['get_combo_pic'],array($id,$user['unitkerjaKodeSistem'],$user['unitkerjaKodeSistem'].".%"));
	}
	
	# multiunit
	function getDataDir($gudangId, $unitId){
		$User = $this->GetDataUserByUsername($_SESSION['username']);
		$kodeSistem = $User['unitkerjaKodeSistem']; 
		$result = $this->Open($this->mSqlQueries['get_list_dir'],array($gudangId,$gudangId,$unitId,$unitId,$kodeSistem,$kodeSistem.'.%'));
		
		return $result;
	}
}
?>
