This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function pesquisacheques(){ | |
$this->LancamentoConta->Cheque->recursive = 2; | |
$this->request->data = $this->request->query; | |
unset($this->request->data['submit']); | |
$arraycerta = array(); | |
$pi = false; | |
foreach($this->request->data as $key => $value){ | |
if($key == 'valor_de' || $key == 'valor_ate'){ | |
if(!$pi){ | |
if(!empty($value)){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function diff ($inicio, $fim, $tipo){ | |
if (!$fim || $fim < $inicio) { | |
return "A data final deve ser maior que a inicial."; | |
} elseif ($inicio < "1970-01-01") { | |
return "A data final deve ser maior que 01/01/1970."; | |
} else { | |
if (strlen($inicio) > 10) { | |
$time_inicio = mktime(substr($inicio,-8,2),substr($inicio,-5,2),substr($inicio,-2), substr($inicio,5,2), substr($inicio,8,2), substr($inicio,0,4)); | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
datahora = '2013-01-02 15:12:20'; | |
datahora = datahora.split(' '); | |
data = datahora[0] | |
hora = datahora[1] | |
data = data.split('-').reverse().join('/'); | |
datahora = data+' '+hora; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$log = $this->Model->getDataSource()->getLog(false, false); | |
debug($log); | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function add() { | |
if ($this->request->is('post')) { | |
$this->Tabela->create(); | |
if ($this->Tabela->save($this->request->data)) { | |
$this->Session->setFlash(__('A Tabela foi cadastrada.')); | |
$this->redirect(array('action' => 'index')); | |
} else { | |
$this->Session->setFlash(__('A Tabela não pôde ser cadastrada. Favor tentar novamente.')); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -name *.* -type f | xargs sed -i s/"extends ppController"/"extends VendasAppController"/ * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You need DECIMAL(4, 2) by the looks of things. DECIMAL(2, 2) only allows a range of -0.99 to 0.99 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php echo $this->Form->create('Veiculo'); ?> | |
<fieldset> | |
<legend><?php echo __('Novo Veículo'); ?></legend> | |
<?php | |
echo $this->Form->input('user_id', array('type' => 'hidden', 'value' => $this->Session->read('Auth.User.id'))); | |
echo $this->Form->input('group_id', array('type' => 'hidden', 'value' => $this->Session->read('choosed'))); | |
echo $this->Form->input('veiculo', array('size' => '150', 'label' => 'Veículo')); | |
echo $this->Form->input('placa'); | |
echo $this->Form->input('rntc', array('size' => '20', 'label' => 'RNTC')); | |
echo $this->Form->input('antt', array('size' => '20', 'label' => 'Código ANTT')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax({ | |
// url para o arquivo json.php | |
url : "json.php", | |
// dataType json | |
dataType : "json", | |
// função para de sucesso | |
success : function(data){ | |
// vamos gerar um html e guardar nesta variável | |
var html = ""; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getEndereco(cep,i) { | |
if(cep !== ""){ | |
$.getScript("https://www.nfservice.com.br/sistema/vendas/clientefornecedor/cep/"+cep, function(){ | |
if (resultadoCEP["resultado"]) { | |
$("#Endereco"+i+"Logradouro").val(unescape(resultadoCEP["tipo_logradouro"]) + " " + unescape(resultadoCEP["logradouro"])); | |
$("#Endereco"+i+"Bairro").val(unescape(resultadoCEP["bairro"])); | |
$("#Endereco"+i+"Cidade").val(unescape(resultadoCEP["cidade"])); | |
var arg =unescape(resultadoCEP["uf"]); | |
$("#Endereco"+i+"Uf > option").each(function(){ | |
if($(this).text()==arg) $(this).parent("select").val($(this).val()) |