|
@@ 84-122 (lines=39) @@
|
| 81 |
|
return $data; |
| 82 |
|
} |
| 83 |
|
|
| 84 |
|
public function carregar_categorias($id = null) |
| 85 |
|
{ |
| 86 |
|
$this->loadModel('LancamentoCategoria'); |
| 87 |
|
|
| 88 |
|
$filter = $this->request->query('term'); |
| 89 |
|
|
| 90 |
|
$conditions = array('conditions' => array( |
| 91 |
|
'LancamentoCategoria.usuario_id' => $this->instancia, |
| 92 |
|
'LancamentoCategoria.ativo' => 1 |
| 93 |
|
) |
| 94 |
|
); |
| 95 |
|
|
| 96 |
|
if (!empty($filter['term'])) { |
| 97 |
|
$conditions['conditions']['LancamentoCategoria.nome LIKE '] = '%' . $filter['term'] . '%'; |
| 98 |
|
} |
| 99 |
|
|
| 100 |
|
$conditions['limit'] = $this->request->query('page_limit'); |
| 101 |
|
|
| 102 |
|
$categorias = $this->LancamentoCategoria->find('all', $conditions); |
| 103 |
|
|
| 104 |
|
$response = []; |
| 105 |
|
|
| 106 |
|
$response['results'][0]['id'] = -1; |
| 107 |
|
$response['results'][0]['text'] = 'Todos'; |
| 108 |
|
|
| 109 |
|
$response['results'][1]['id'] = 0; |
| 110 |
|
$response['results'][1]['text'] = 'Sem categoria'; |
| 111 |
|
|
| 112 |
|
$i = 1; |
| 113 |
|
foreach ($categorias as $categoria) { |
| 114 |
|
$i++; |
| 115 |
|
|
| 116 |
|
$response['results'][$i]['id'] = $categoria['LancamentoCategoria']['id']; |
| 117 |
|
$response['results'][$i]['text'] = $categoria['LancamentoCategoria']['nome']; |
| 118 |
|
} |
| 119 |
|
|
| 120 |
|
echo json_encode($response); |
| 121 |
|
exit; |
| 122 |
|
} |
| 123 |
|
|
| 124 |
|
public function carregar_fornecedores($id = null) |
| 125 |
|
{ |
|
@@ 124-162 (lines=39) @@
|
| 121 |
|
exit; |
| 122 |
|
} |
| 123 |
|
|
| 124 |
|
public function carregar_fornecedores($id = null) |
| 125 |
|
{ |
| 126 |
|
$this->loadModel('Fornecedore'); |
| 127 |
|
|
| 128 |
|
$filter = $this->request->query('term'); |
| 129 |
|
|
| 130 |
|
$conditions = array('conditions' => array( |
| 131 |
|
'Fornecedore.usuario_id' => $this->instancia, |
| 132 |
|
'Fornecedore.ativo' => 1 |
| 133 |
|
) |
| 134 |
|
); |
| 135 |
|
|
| 136 |
|
if (!empty($filter['term'])) { |
| 137 |
|
$conditions['conditions']['Fornecedore.nome LIKE '] = '%' . $filter['term'] . '%'; |
| 138 |
|
} |
| 139 |
|
|
| 140 |
|
$conditions['limit'] = $this->request->query('page_limit'); |
| 141 |
|
|
| 142 |
|
$fornecedores = $this->Fornecedore->find('all', $conditions); |
| 143 |
|
|
| 144 |
|
$response = []; |
| 145 |
|
|
| 146 |
|
$response['results'][0]['id'] = -1; |
| 147 |
|
$response['results'][0]['text'] = 'Todos'; |
| 148 |
|
|
| 149 |
|
$response['results'][1]['id'] = 0; |
| 150 |
|
$response['results'][1]['text'] = 'Sem Fornecedor'; |
| 151 |
|
|
| 152 |
|
$i = 1; |
| 153 |
|
foreach ($fornecedores as $fornecedor) { |
| 154 |
|
$i++; |
| 155 |
|
|
| 156 |
|
$response['results'][$i]['id'] = $fornecedor['Fornecedore']['id']; |
| 157 |
|
$response['results'][$i]['text'] = $fornecedor['Fornecedore']['nome']; |
| 158 |
|
} |
| 159 |
|
|
| 160 |
|
echo json_encode($response); |
| 161 |
|
exit; |
| 162 |
|
} |
| 163 |
|
|
| 164 |
|
public function listar_cadastros_ajax() |
| 165 |
|
{ |