Completed
Push — master ( b1e5fa...ef78cf )
by Reginaldo
39:00 queued 21:25
created
app/Controller/FinanceiroController.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 					array(
39 39
 						'LancamentoCategoria.ativo' => 1,
40 40
 						'LancamentoCategoria.usuario_id' => $this->instancia,
41
-						'LancamentoCategoria.id' => !empty($lancamento['LancamentoVenda']['lancamento_categoria_id']) ? $lancamento['LancamentoVenda']['lancamento_categoria_id'] : ''
41
+						'LancamentoCategoria.id' => ! empty($lancamento['LancamentoVenda']['lancamento_categoria_id']) ? $lancamento['LancamentoVenda']['lancamento_categoria_id'] : ''
42 42
 					)
43 43
 				)
44 44
 			);
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
 			)
94 94
 		);
95 95
 
96
-		if (!empty($filter['term'])) {
97
-			$conditions['conditions']['LancamentoCategoria.nome LIKE '] = '%' . $filter['term'] . '%';
96
+		if ( ! empty($filter['term'])) {
97
+			$conditions['conditions']['LancamentoCategoria.nome LIKE '] = '%'.$filter['term'].'%';
98 98
 		}
99 99
 
100 100
 		$conditions['limit'] = $this->request->query('page_limit');
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 			)
134 134
 		);
135 135
 
136
-		if (!empty($filter['term'])) {
137
-			$conditions['conditions']['Fornecedore.nome LIKE '] = '%' . $filter['term'] . '%';
136
+		if ( ! empty($filter['term'])) {
137
+			$conditions['conditions']['Fornecedore.nome LIKE '] = '%'.$filter['term'].'%';
138 138
 		}
139 139
 
140 140
 		$conditions['limit'] = $this->request->query('page_limit');
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 		$this->loadModel('LancamentoVenda');
169 169
 		$this->loadModel('LancamentoCategoria');
170 170
 
171
-		$aColumns = array( 'id', 'venda_id', 'data_vencimento', 'valor', 'lancamento_categoria_id' );
171
+		$aColumns = array('id', 'venda_id', 'data_vencimento', 'valor', 'lancamento_categoria_id');
172 172
 
173 173
 		$conditions = array(
174 174
 			'conditions' => array(
@@ -198,19 +198,19 @@  discard block
 block discarded – undo
198 198
 			)
199 199
 		);
200 200
 
201
-		if ( isset( $_GET['iSortCol_0'] ) )
201
+		if (isset($_GET['iSortCol_0']))
202 202
 		{
203
-			for ( $i=0 ; $i < intval( $_GET['iSortingCols'] ) ; $i++ )
203
+			for ($i = 0; $i < intval($_GET['iSortingCols']); $i++)
204 204
 			{
205
-				if ( $_GET[ 'bSortable_' . intval($_GET['iSortCol_' . $i]) ] == "true" )
205
+				if ($_GET['bSortable_'.intval($_GET['iSortCol_'.$i])] == "true")
206 206
 				{
207 207
 					$conditions['order'] = array(
208
-						'LancamentoVenda.' . $aColumns[intval($_GET['iSortCol_' . $i])] => $_GET['sSortDir_' . $i]);
208
+						'LancamentoVenda.'.$aColumns[intval($_GET['iSortCol_'.$i])] => $_GET['sSortDir_'.$i]);
209 209
 				}
210 210
 			}
211 211
 		}
212 212
 		
213
-		if ( isset( $_GET['sSearch'] ) && !empty( $_GET['sSearch'] ) )
213
+		if (isset($_GET['sSearch']) && ! empty($_GET['sSearch']))
214 214
 		{
215 215
 			$search = explode(':', $_GET['sSearch']);
216 216
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 		// pr($conditions);
234 234
 		$allLancamentos = $this->LancamentoVenda->find('count', $conditions);
235 235
 
236
-		if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
236
+		if (isset($_GET['iDisplayStart']) && $_GET['iDisplayLength'] != '-1')
237 237
 		{
238 238
 			$conditions['offset'] = $_GET['iDisplayStart'];
239 239
 			$conditions['limit'] = $_GET['iDisplayLength'];
@@ -248,12 +248,12 @@  discard block
 block discarded – undo
248 248
 			"aaData" => array()
249 249
 		);
250 250
 
251
-		foreach ( $lancamentos as $i => $lancamento )
251
+		foreach ($lancamentos as $i => $lancamento)
252 252
 		{
253 253
 			$row = array();
254 254
 
255 255
 			$btPaid = '';
256
-			for ( $i=0 ; $i < count($aColumns) ; $i++ )
256
+			for ($i = 0; $i < count($aColumns); $i++)
257 257
 			{
258 258
 				if ($aColumns[$i] == "lancamento_categoria_id") {
259 259
 
@@ -267,16 +267,16 @@  discard block
 block discarded – undo
267 267
 
268 268
 					$categoria_lancamento = $this->LancamentoCategoria->find('first', $conditions);
269 269
 
270
-					if (!empty($categoria_lancamento)) {
270
+					if ( ! empty($categoria_lancamento)) {
271 271
 						if ($categoria_lancamento['LancamentoCategoria']['tipo'] == "receita") {
272
-							$value = '<span class="label label-success">' . $categoria_lancamento['LancamentoCategoria']['nome'] . '</span>';
272
+							$value = '<span class="label label-success">'.$categoria_lancamento['LancamentoCategoria']['nome'].'</span>';
273 273
 
274 274
 							$btPaid = '<a class="btn btn-primary" href="javascript:alert(\'Não é uma despesa.\');"><i class="fa fa-child"></i></a>';
275 275
 						} else {
276
-							$value = '<span class="label label-danger">' . $categoria_lancamento['LancamentoCategoria']['nome'] . '</span>';
276
+							$value = '<span class="label label-danger">'.$categoria_lancamento['LancamentoCategoria']['nome'].'</span>';
277 277
 
278 278
 							if ($lancamento['LancamentoVenda']['valor_pago'] < $lancamento['LancamentoVenda']['valor']) {
279
-								$btPaid = '<a class="btn btn-success" href="/produto/imagens/' . $lancamento['LancamentoVenda']['id'] . '"><i class="fa fa-check"></i></a>';
279
+								$btPaid = '<a class="btn btn-success" href="/produto/imagens/'.$lancamento['LancamentoVenda']['id'].'"><i class="fa fa-check"></i></a>';
280 280
 							} else {
281 281
 								$btPaid = '<a class="btn btn-default" href="javascript:alert(\'Lançamento já foi pago\');"><i class="fa fa-money"></i></a>';
282 282
 							}
@@ -291,12 +291,12 @@  discard block
 block discarded – undo
291 291
 
292 292
 				if ($aColumns[$i] == "venda_id" && empty($lancamento['LancamentoVenda'][$aColumns[$i]])) {
293 293
 					$value = '<b>Não é uma venda</b>';
294
-				} elseif ($aColumns[$i] == "venda_id" && !empty($lancamento['LancamentoVenda'][$aColumns[$i]])) {
295
-					$value = '<a href="http://www.ciawn.com.br/venda/listar_cadastros?venda_id=' . $lancamento['LancamentoVenda'][$aColumns[$i]] . '">Ver Pedido</a>';
294
+				} elseif ($aColumns[$i] == "venda_id" && ! empty($lancamento['LancamentoVenda'][$aColumns[$i]])) {
295
+					$value = '<a href="http://www.ciawn.com.br/venda/listar_cadastros?venda_id='.$lancamento['LancamentoVenda'][$aColumns[$i]].'">Ver Pedido</a>';
296 296
 				}
297 297
 
298 298
 				if ($aColumns[$i] == "valor") {
299
-					$value = 'R$ ' . number_format($lancamento['LancamentoVenda'][$aColumns[$i]], 2, ',', '.');
299
+					$value = 'R$ '.number_format($lancamento['LancamentoVenda'][$aColumns[$i]], 2, ',', '.');
300 300
 				}
301 301
 
302 302
 				if ($aColumns[$i] == "data_vencimento" && $lancamento['LancamentoVenda'][$aColumns[$i]] != "") {
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 
330 330
 		$retorno = $this->LancamentoCategoria->save($data);
331 331
 		
332
-		if (!$retorno) {
332
+		if ( ! $retorno) {
333 333
 			$this->Session->setFlash('Ocorreu um erro ao salvar a categoria tente novamente');
334 334
 			return $this->redirect('/financeiro/listar_cadastros');
335 335
 		}
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 		$data['usuario_id'] = $this->instancia;
348 348
 		$data['ativo'] = 1;
349 349
 		
350
-		if (!$this->Fornecedore->save($data)) {
350
+		if ( ! $this->Fornecedore->save($data)) {
351 351
 			$this->Session->setFlash('Ocorreu um erro ao inserir o fornecedor');
352 352
 			return $this->redirect('/financeiro/listar_cadastros');
353 353
 		}
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 
367 367
 		$this->loadModel('LancamentoVenda');
368 368
 
369
-		if (!$this->LancamentoVenda->save($transacao)) {
369
+		if ( ! $this->LancamentoVenda->save($transacao)) {
370 370
 			$this->Session->setFlash('Ocorreu um erro ao cadastrar o lançamento');
371 371
 			return $this->redirect('/financeiro/listar_cadastros');
372 372
 		}
Please login to merge, or discard this patch.