private function popula() { $servico = new Servico(); $servico->id_servico = $_POST['id_servico']; $servico->id_departamento = $_POST['id_departamento']; $servico->status = $_POST['status']; $servico->site = $_POST['site']; //?1:0; $servico->descricao = $_POST['descricao']; $servico->servico_desc = $_POST['servico_desc']; $servico->desc_site = $_POST['desc_site']; $servico->site_menu = $_POST['site_menu']; $servico->remCampos = explode(',', $_POST['remCampos']); $n = 1; foreach ($_POST['campo_campo'] as $i => $campo) { $c = new stdClass(); $c->id_servico_campo = $_POST['id_servico_campo'][$i]; $c->id_servico = $_POST['id_servico']; $c->campo = $campo; $c->nome = $_POST['campo_nome'][$i]; $c->tipo = 'text'; $c->largura = 470; $c->site = $_POST['campo_site'][$i] ? 1 : 0; $c->obrigatorio = $_POST['campo_obrigatorio'][$i] ? 1 : 0; $c->ordenacao = $n; $servico->addCampo($c); $n++; } return $servico; }
public function servicosEspecialidades($empresa_id = null) { try { $newList = array(); $ServicoModel = new Servico(); $sql = "SELECT DISTINCT\n\t\t\t\t\t\tServico.*\n\t\t\t\t\tFROM\n\t\t\t\t\t\tagentus_database.servicos AS Servico\n\t\t\t\t\t\t\tINNER JOIN\n\t\t\t\t\t\tagentus_database.tipos_servicos AS TipoServico ON TipoServico.servicos_id = Servico.id\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tServico.empresas_id = {$empresa_id};"; $servicos = $ServicoModel->query($sql); foreach ($servicos as $servico) { $object = new Servicos($servico['id'], $servico['nome']); $object->setEspecialidades($this->lista((int) $servico['id'])); $newList[] = $object; } return $newList; } catch (Exception $ex) { throw $ex; } }
public static function dropdown($fieldname, $selected = array()) { $template = new Template(); $template->assignParam('fieldname', $fieldname); $template->assignParam('selected', $selected); $template->assignParam('objetos', Servico::listar()); return $template->render("servico/dropdown.phtml", true); }
public static function destaques() { return Servico::where('destaque', '=', 'S')->get(); }
<?php require 'Service.PHP.php'; $valor = $_GET['valor']; if (is_numeric($valor)) { $inss = Servico::getINSS($valor); $irpf = Servico::getIR($valor); $baseSalary = Servico::getBaseSalary($valor); $salary = Servico::getLiquidSalary($valor); } $result = array('salary' => $salary, 'inss' => $inss, 'irpf' => $irpf); echo json_encode($result);
public function getServicos() { $objetos = Servico::listar(" WHERE servico_id in(SELECT servico_id FROM contratoservico WHERE contratoservico.evento_id = '{$this->getEvento_id()}')"); return $objetos; }
public static function getDelete() { $id = Input::get('id'); $servico = Servico::find($id); $servico->delete(); return Redirect::to('/servico'); }
/** * API Method inserts a new Servico record and render response as JSON */ public function Create() { try { $json = json_decode(RequestUtil::GetBody()); if (!$json) { throw new Exception('The request body does not contain valid JSON'); } $servico = new Servico($this->Phreezer); // TODO: any fields that should not be inserted by the user should be commented out $servico->Id = $this->SafeGetVal($json, 'id'); $servico->Placa = $this->SafeGetVal($json, 'placa'); $servico->Servico = $this->SafeGetVal($json, 'servico'); $servico->Descricao = $this->SafeGetVal($json, 'descricao'); $servico->Valor = $this->SafeGetVal($json, 'valor'); $servico->Validate(); $errors = $servico->GetValidationErrors(); if (count($errors) > 0) { $this->RenderErrorJSON('Please check the form for errors', $errors); } else { // since the primary key is not auto-increment we must force the insert here $servico->Save(true); $this->RenderJSON($servico, $this->JSONPCallback(), true, $this->SimpleObjectParams()); } } catch (Exception $ex) { $this->RenderExceptionJSON($ex); } }
public function alterar(Servico $servico) { $servico->setUltimaModificacao(); return $this->servicoRepository->update($servico); }
<?php /* * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Gerenciamento de consultório médico/odontológico */ /* Desenvolvido por: Reinaldo Silveira */ /* * * * * * * * * * * * * * * * * * * * * * * * * * */ include_once "../header.php"; include_once "../../model/class.servicos.php"; include_once "../../controller/class.servicos.php"; $servico = new Servico(); $servicos = $servico->buscar(); $cont = count($servicos); ?> <script type="text/javascript" src="/view/js/jquery.dataTables.min.js"></script> <script type="text/javascript" src="/view/js/jquery-DT-pagination.js"></script> <script type="text/javascript"> /* Table initialisation */ $(document).ready(function() { $('#listagem').dataTable( { "bSort": false, // Disable sorting "iDisplayLength": 10, //records per page "sDom": "t<'row'<'col-md-6'i><'col-md-6'p>>", "sPaginationType": "bootstrap" }); }); </script> <style> .pagination {
public function actionGetItensPorTipoJson() { if (!empty($_POST['tipoItemId'])) { if (!empty($_POST['tipoItemId']) && $_POST['tipoItemId'] == 1) { $oProduto = new Produto(); echo CJSON::encode($oProduto->getDataJson()); } if (!empty($_POST['tipoItemId']) && $_POST['tipoItemId'] == 2) { $oServico = new Servico(); echo CJSON::encode($oServico->getDataJson()); } } }
<?php include_once "../header.php"; include_once "../../model/class.servicos.php"; include_once "../../controller/class.servicos.php"; include_once "../../model/class.tipo_tratamento.php"; include_once "../../controller/class.tipo_tratamento.php"; $servico = new Servico(); $tipotrat = new TipoTratamento(); $acao = isset($_GET["acao"]) ? $_GET["acao"] : ""; $codigo = isset($_GET["id"]) ? $_GET["id"] : 0; $tipos = $tipotrat->listarTodos(); if ($codigo > 0) { if (!$servico->buscarPorCodigo($codigo)) { echo "<script>\n alert('Registro não encontrado!');\n window.location = 'listagem.php';\n </script>"; exit; } } if ($acao == "excluir" && $codigo > 0) { if ($servico->excluir($codigo)) { echo "<script>window.location = 'listagem.php';</script>"; } else { echo "<script>\n alert('Erro ao excluir o cadastro. Verifique as dependências e tente novamente.');\n window.location = 'listagem.php';\n </script>"; } } if ($_POST) { if ($codigo == 0) { if ($servico->incluir()) { echo "<script>window.location = 'listagem.php';</script>"; } else { echo "<script>alert('Erro ao incluir!')</script>";
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Servico the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Servico::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function getIndex() { $servicos = Servico::destaques(); return View::make('home', compact('servicos')); }