Skip to content

Commit

Permalink
Corrigindo para Mostrar nos logs Vendas ID e lançamentoid
Browse files Browse the repository at this point in the history
  • Loading branch information
cabralwms committed Jul 31, 2024
1 parent bde19bd commit 99629b8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions application/controllers/Vendas.php
Original file line number Diff line number Diff line change
Expand Up @@ -548,12 +548,15 @@ public function faturar()
$this->db->trans_begin();

if ($this->vendas_model->add('lancamentos', $data)) {
$lancamentos_id = $this->db->insert_id(); // Obtém o ID do lançamento recém-inserido

$this->db->set('faturado', 1);
$this->db->set('valorTotal', $valorTotal);
$this->db->set('lancamentos_id', $lancamentos_id); // Salva o ID do lançamento
$this->db->set('status', 'Faturado');
$this->db->where('idVendas', $venda_id);
$this->db->update('vendas');

if ($this->db->trans_status() === false) {
$this->db->trans_rollback();
$this->session->set_flashdata('error', 'Ocorreu um erro ao tentar faturar venda.');
Expand All @@ -562,7 +565,7 @@ public function faturar()
exit();
} else {
$this->db->trans_commit();
log_info('Faturou uma venda.');
log_info('Faturou a Venda de ID: ' . $venda_id);
$this->session->set_flashdata('success', 'Venda faturada com sucesso!');
$json = ['result' => true];
echo json_encode($json);
Expand Down

0 comments on commit 99629b8

Please sign in to comment.