<?php

CLASS macfd extends RasioProject
{
	protected $set;
	protected $enableCk = true;

	public function __construct($config)
	{
		$this->getConfig($config);
		$this->validation();
		$this->set();
	}

	protected function set()
	{
		$this->set->em 			= $this->em;
		$this->set->modul 		= 'Master Account';
		$this->set->dBaseH 		= 'accf';
		$this->set->dBaseD 		= false;
		$this->set->dBasePk 	= array('kdac');
		$this->set->where 		= array("(detil = 'T')");
		$this->set->dSort 		= 'asc';
		$this->set->grid 		= $this->setGrid();
		return $this->set;
	}
	
	protected function setGrid()
	{
		$kode = new Kode;
		$res->page 	= 50;
		$res->sortA = $kode->getPk($this->set->dBasePk);
		$res->sortT = 'asc';
		
		$res->attr[]	= array("label" => 'Induk', 'attr' => 'a.induk', "sort" => 'true', "width" => 70, 'align' => 'left', 'focus' => 'true');
		$res->attr[]	= array("label" => 'Kode', 'attr' => 'a.kdac', "sort" => 'true', "width" => 70, 'align' => 'left');
		$res->attr[]	= array("label" => 'Nama', 'attr' => 'a.nmac', "sort" => 'true', "width" => 200, 'align' => 'left');
		$res->attr[]	= array("label" => 'Detail', 'attr' => 'a.detil', "sort" => 'true', "width" => 50, 'align' => 'left');
		$res->attr[]	= array("label" => 'Group', 'attr' => 'a.grup', "sort" => 'true', "width" => 50, 'align' => 'left');
		
		return $res;
	}
	
	public function data()
	{
		$basic = new Basic;
		$this->data = $basic->data($_GET, $this->set);
		$this->view = "default/displayData";
		$this->layout = "view";
	}
	
	public function Find()
	{
		$basic = new Basic;
		$this->data = $basic->find($_GET, $this->set);
		$this->view = "default/displayForm";
		$this->layout = "view";
	}
	
	public function load()
	{
		$basic = new Basic;
		$this->data = $basic->load($_GET, $this->set);
		$this->layout = "null";
	}
	
	public function account()
	{
		$data = $this->em->getFind("acc", "nmac", array("kdac = '".$_GET['idRef']."'"));
		
		$res->target = $_GET['target'];
		$res->nama 	= $data->nmac;
		echo json_encode($res);
		$this->layout = "null";
	}
	
	public function popUp()
	{
		$basic = new Basic;
		$this->data = $basic->data($_GET, $this->set);
		$this->view = "default/displayDataPopUp";
		$this->layout = "view";
	}
}