<?php 
	class DataTemplate extends mysql{
		
		function get_template_all($kolom,$a,$type){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			$sql = "SELECT * FROM tbtemplatetransaksi WHERE IsAktif ='1'";
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}
		function get_template_single_by_id($kolom,$id){
			if($this->cek_result != "on"){
			$sql = "SELECT * FROM tbtemplatetransaksi WHERE NoID ='".$id."'";
			$this->result = $this->execute($sql,'order');
			$this->cek_result = "on";
			return trim($this->result[$kolom]);
			}
				else return trim($this->result[$kolom]);
		}

		function get_template_single_by_id2($kolom,$id){
			if($this->cek_result != "on"){
			$sql = "SELECT * FROM tbtemplatetransaksi WHERE NoID ='".$id."'";
			$this->result = $this->execute($sql,'order');
			$this->cek_result = "on";
			return trim($this->result[$kolom]);
			}
				else return trim($this->result[$kolom]);
		}

		function edit_template($id, $Nama, $BiayaReguler, $BiayaNonReguler, $idBendahara, $NamaBendahara, $idBendaharaNon, $NamaBendaharaNon){
			  $sql = "update tbtemplatetransaksi set NamaTRX = '".$Nama."', BiayaReguler = '".$BiayaReguler."', BiayaNonReguler = '".$BiayaNonReguler."' , idBendahara = '".$idBendahara."', NamaBendahara = '".$NamaBendahara."', idBendaharaNon = '".$idBendaharaNon."', NamaBendaharaNon = '".$NamaBendaharaNon."'  where NoID = '".$id."'";
			
			$this->query = $this-> execute($sql,''); 
		}
		function add_Template($Nama, $BiayaReguler, $BiayaNonReguler, $idBendahara, $NamaBendahra, $idBendaharaNon, $NamaBendaharaNon){
			  $sql = "INSERT INTO tbtemplatetransaksi (NamaTRX, BiayaReguler, BiayaNonReguler, isAktif, idBendahara, NamaBendahara, idBendaharaNon, NamaBendaharaNon) values ('".$Nama."','".$BiayaReguler."', '".$BiayaNonReguler."', '1', '".$idBendahara."', '".$NamaBendahra."', '".$idBendaharaNon."', '".$NamaBendaharaNon."')";
			  $this->query = $this-> execute($sql,''); 
		}
		function nonaktif_template($id){
			  $sql = "update tbtemplatetransaksi set IsAktif ='0' where NoID ='".$id."'";
			  $this->query = $this-> execute($sql,''); 
		}
		
		
	}
?>