Atualização ClientBugets.class.php

This commit is contained in:
Kenio 2025-07-29 15:36:09 -03:00
parent ac8aef8419
commit c10d634c90

View file

@ -59,7 +59,7 @@ class ClientBudgets
{
/** Consulta SQL */
$this->sql = "describe client_budgets";
$this->sql = "describe companies_budgets";
/** Preparo o SQL para execução */
$this->stmt = $this->connection->connect()->prepare($this->sql);
@ -98,7 +98,7 @@ class ClientBudgets
$this->clientBudgetsId = $clientBudgetsId;
/** Consulta SQL */
$this->sql = 'select cb.client_budgets_id,
$this->sql = 'select cb.companies_budgets_id,
cb.clients_id,
cb.users_id,
cb.users_id_update,
@ -119,15 +119,15 @@ class ClientBudgets
cb.date_start,
cb.description,
c.fantasy_name
from client_budgets cb
from companies_budgets cb
left join clients c on cb.clients_id = c.clients_id
where cb.client_budgets_id = :client_budgets_id';
where cb.companies_budgets_id = :companies_budgets_id';
/** Preparo o SQL para execução */
$this->stmt = $this->connection->connect()->prepare($this->sql);
/** Preencho os parâmetros do SQL */
$this->stmt->bindParam(':client_budgets_id', $this->clientBudgetsId);
$this->stmt->bindParam(':companies_budgets_id', $this->clientBudgetsId);
/** Executo o SQL */
$this->stmt->execute();
@ -144,7 +144,7 @@ class ClientBudgets
$this->clientsId = $clientsId;
/** Consulta SQL */
$this->sql = 'select cb.client_budgets_id,
$this->sql = 'select cb.companies_budgets_id,
cb.clients_id,
cb.users_id,
cb.products_id,
@ -162,7 +162,7 @@ class ClientBudgets
cb.date_start,
cb.description,
u.name_first as responsible
from client_budgets cb
from companies_budgets cb
left join users u on cb.users_id = u.users_id
where cb.clients_id = :clients_id';
@ -188,8 +188,8 @@ class ClientBudgets
$this->clientsId = $clientsId;
/** Consulta SQL */
$this->sql = 'select count(client_budgets_id) as qtde
from client_budgets
$this->sql = 'select count(companies_budgets_id) as qtde
from companies_budgets
where clients_id = :clients_id';
/** Preparo o SQL para execução */
@ -250,7 +250,7 @@ class ClientBudgets
if($this->clientBudgetsId > 0){
/** Consulta SQL */
$this->sql = 'update client_budgets set budget = :budget,
$this->sql = 'update companies_budgets set budget = :budget,
day_due = :day_due,
readjustment_index = :readjustment_index,
readjustment_value = :readjustment_value,
@ -264,12 +264,12 @@ class ClientBudgets
financial_categories_id = :financial_categories_id,
financial_accounts_id = :financial_accounts_id,
products_id = :products_id
where client_budgets_id = :client_budgets_id';
where companies_budgets_id = :companies_budgets_id';
}else{//Se o ID não foi informado, grava-se um novo registro
/** Consulta SQL */
$this->sql = 'insert into client_budgets(clients_id,
$this->sql = 'insert into companies_budgets(clients_id,
users_id,
budget,
day_due,
@ -315,7 +315,7 @@ class ClientBudgets
if($this->clientBudgetsId > 0){
/** Preencho os parâmetros do SQL */
$this->stmt->bindParam('client_budgets_id', $this->clientBudgetsId);
$this->stmt->bindParam('companies_budgets_id', $this->clientBudgetsId);
}else{
@ -369,14 +369,14 @@ class ClientBudgets
$this->clientBudgetsId = $clientBudgetsId;
/** Consulta SQL */
$this->sql = 'delete from client_budgets
where client_budgets_id = :client_budgets_id';
$this->sql = 'delete from companies_budgets
where companies_budgets_id = :companies_budgets_id';
/** Preparo o sql para receber os valores */
$this->stmt = $this->connection->connect()->prepare($this->sql);
/** Preencho os parâmetros do SQL */
$this->stmt->bindParam('client_budgets_id', $this->clientBudgetsId);
$this->stmt->bindParam('companies_budgets_id', $this->clientBudgetsId);
/** Executo o SQL */
return $this->stmt->execute();