<?php
class Pacotes
{
	public  $qry;
	private	$sql;
	private $id_empresa;

	public function __construct()
	{
		ob_start();
		session_start();
		$this->id_empresa = $_SESSION["fild_id_empresa"];
	}

	private function execulta()
	{
		$mysqlCom = new MysqlConnect();
		$this->qry = mysqli_query($mysqlCom->connect(), $this->sql);
	}


	public function selectPacote($id = 0)
	{
		$this->sql = "select id_pacotes, nome, valor, data, obs from pacotes";
		if ($id != 0) {
			$this->sql .= " where id_pacotes = $id and ";
		} else {
			$this->sql .= ' where ';
		}
		$this->sql .= "id_empresa = $this->id_empresa limit 1";



		$this->execulta();
	}

	public function insertPacote($nome, $valor, $obs)
	{
		$data = $data_cadastro = date('Y/m/d');
		$this->sql = "INSERT INTO pacotes
						(id_empresa, nome, valor, data, obs) 
						VALUES ($this->id_empresa, '$nome', '$valor', '$data', '$obs')";
		$this->execulta();
		return mysqli_insert_id();
	}
}
