diff --git a/vendor/model/ClientBudgets.class.php b/vendor/model/companiesBudgets.class.php similarity index 88% rename from vendor/model/ClientBudgets.class.php rename to vendor/model/companiesBudgets.class.php index 44e435a..0425e18 100644 --- a/vendor/model/ClientBudgets.class.php +++ b/vendor/model/companiesBudgets.class.php @@ -1,6 +1,6 @@ clientBudgetsId = $clientBudgetsId; + $this->companiesBudgetsId = $companiesBudgetsId; /** Consulta SQL */ $this->sql = 'select cb.companies_budgets_id, - cb.clients_id, + cb.companies_id, cb.users_id, cb.users_id_update, cb.financial_categories_id, @@ -120,14 +120,14 @@ class ClientBudgets cb.description, c.fantasy_name from companies_budgets cb - left join clients c on cb.clients_id = c.clients_id + left join companies c on cb.company_id = c.company_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(':companies_budgets_id', $this->clientBudgetsId); + $this->stmt->bindParam(':companies_budgets_id', $this->companiesBudgetsId); /** Executo o SQL */ $this->stmt->execute(); @@ -138,14 +138,14 @@ class ClientBudgets } /** Lista todos os egistros do banco com ou sem paginação*/ - public function All(int $clientsId) + public function All(int $companyId) { /** Parametros de entrada */ - $this->clientsId = $clientsId; + $this->companyId = $companyId; /** Consulta SQL */ $this->sql = 'select cb.companies_budgets_id, - cb.clients_id, + cb.company_id, cb.users_id, cb.products_id, cb.budget, @@ -164,13 +164,13 @@ class ClientBudgets u.name_first as responsible from companies_budgets cb left join users u on cb.users_id = u.users_id - where cb.clients_id = :clients_id'; + where cb.company_id = :company_id'; /** Preparo o SQL para execução */ $this->stmt = $this->connection->connect()->prepare($this->sql); /** Preencho os parâmetros do SQL */ - $this->stmt->bindParam('clients_id', $this->clientsId); + $this->stmt->bindParam('company_id', $this->companyId); /** Executo o SQL */ $this->stmt->execute(); @@ -181,22 +181,22 @@ class ClientBudgets } /** Conta a quantidades de registros */ - public function Count(int $clientsId) + public function Count(int $companyId) { /** Parametros de entrada */ - $this->clientsId = $clientsId; + $this->companyId = $companyId; /** Consulta SQL */ $this->sql = 'select count(companies_budgets_id) as qtde from companies_budgets - where clients_id = :clients_id'; + where company_id = :company_id'; /** Preparo o SQL para execução */ $this->stmt = $this->connection->connect()->prepare($this->sql); /** Preencho os parâmetros do SQL */ - $this->stmt->bindParam('clients_id', $this->clientsId); + $this->stmt->bindParam('company_id', $this->companyId); /** Executo o SQL */ $this->stmt->execute(); @@ -207,8 +207,8 @@ class ClientBudgets } /** Insere um novo registro no banco */ - public function Save(int $clientBudgetsId, - int $clientsId, + public function Save(int $companiesBudgetsId, + int $companyId, string $budget, int $dayDue, string $readjustmentIndex, @@ -227,8 +227,8 @@ class ClientBudgets /** Parametros */ - $this->clientBudgetsId = $clientBudgetsId; - $this->clientsId = $clientsId; + $this->companiesBudgetsId = $companiesBudgetsId; + $this->companyId = $companyId; $this->usersId = $_SESSION['USERSID'];//Carrega o ID do usuário logado $this->budget = $budget; $this->dayDue = $dayDue; @@ -247,7 +247,7 @@ class ClientBudgets /** Verifica se o ID do registro foi informado */ - if($this->clientBudgetsId > 0){ + if($this->companiesBudgetsId > 0){ /** Consulta SQL */ $this->sql = 'update companies_budgets set budget = :budget, @@ -269,7 +269,7 @@ class ClientBudgets }else{//Se o ID não foi informado, grava-se um novo registro /** Consulta SQL */ - $this->sql = 'insert into companies_budgets(clients_id, + $this->sql = 'insert into companies_budgets(company_id, users_id, budget, day_due, @@ -285,7 +285,7 @@ class ClientBudgets financial_categories_id, financial_accounts_id, products_id - ) values (:clients_id, + ) values (:company_id, :users_id, :budget, :day_due, @@ -312,16 +312,16 @@ class ClientBudgets /** Inicia a transação */ $this->connection->connect()->beginTransaction(); - if($this->clientBudgetsId > 0){ + if($this->companiesBudgetsId > 0){ /** Preencho os parâmetros do SQL */ - $this->stmt->bindParam('companies_budgets_id', $this->clientBudgetsId); + $this->stmt->bindParam('companies_budgets_id', $this->companiesBudgetsId); }else{ /** Preencho os parâmetros do SQL */ $this->stmt->bindParam('users_id', $this->usersId); - $this->stmt->bindParam('clients_id', $this->clientsId); + $this->stmt->bindParam('company_id', $this->companyId); } @@ -363,10 +363,10 @@ class ClientBudgets } /** Deleta um determinado registro no banco de dados */ - function Delete(int $clientBudgetsId) + function Delete(int $companiesBudgetsId) { /** Parametros de entrada */ - $this->clientBudgetsId = $clientBudgetsId; + $this->companiesBudgetsId = $companiesBudgetsId; /** Consulta SQL */ $this->sql = 'delete from companies_budgets @@ -376,7 +376,7 @@ class ClientBudgets $this->stmt = $this->connection->connect()->prepare($this->sql); /** Preencho os parâmetros do SQL */ - $this->stmt->bindParam('companies_budgets_id', $this->clientBudgetsId); + $this->stmt->bindParam('companies_budgets_id', $this->companiesBudgetsId); /** Executo o SQL */ return $this->stmt->execute(); diff --git a/vendor/view/companies_budgets/companies_budgets_form.php b/vendor/view/companies_budgets/companies_budgets_form.php index 9b96f60..2afc99c 100644 --- a/vendor/view/companies_budgets/companies_budgets_form.php +++ b/vendor/view/companies_budgets/companies_budgets_form.php @@ -1,8 +1,8 @@ verifyToken()){ /** Instânciamento de classes */ - $Clients = new Clients(); - $ClientBudgets = new ClientBudgets(); + $Companies = new Companies(); + $CompaniesBudgets = new CompaniesBudgets(); $FinancialAccounts = new FinancialAccounts(); $FinancialCategories = new FinancialCategories(); $FinancialReadjustments = new FinancialReadjustments(); /** Parametros de entrada */ - $clientsId = isset($_POST['clients_id']) ? (int)filter_input(INPUT_POST, 'clients_id', FILTER_SANITIZE_SPECIAL_CHARS) : 0; - $clientsBudgetsId = isset($_POST['clients_budgets_id']) ? (int)filter_input(INPUT_POST, 'clients_budgets_id', FILTER_SANITIZE_SPECIAL_CHARS) : 0; + $companiesId = isset($_POST['company_id']) ? (int)filter_input(INPUT_POST, 'company_id', FILTER_SANITIZE_SPECIAL_CHARS) : 0; + $companiesBudgetsId = isset($_POST['clients_budgets_id']) ? (int)filter_input(INPUT_POST, 'clients_budgets_id', FILTER_SANITIZE_SPECIAL_CHARS) : 0; /** Verifica se o ID do projeto foi informado */ - if($clientsId > 0){ + if($companiesId > 0){ /** Consulta os dados do controle de acesso */ - $ClientsResult = $Clients->Get($clientsId); - $ClientBudgetsResult = $ClientBudgets->Get($clientsBudgetsId); + $companiesResult = $Companies->Get($companiesId); + $companiesBudgetsResult = $CompaniesBudgets->Get($companiesBudgetsId); }else{/** Caso o ID do controle de acesso não tenha sido informado, carrego os campos como null */ /** Carrega os campos da tabela */ - $ClientsResult = $Clients->Describe(); - $ClientBudgetsResult = $ClientBudgets->Describe(); + $companiesResult = $Companies->Describe(); + $companiesBudgetsResult = $CompaniesBudgets->Describe(); } @@ -72,7 +72,7 @@ try{
-
@@ -131,7 +131,7 @@ try{
CPF / CNPJ:
- formatarCPF_CNPJ($ClientsResult->document);?>  + formatarCPF_CNPJ($companiesResult->document);?> 
@@ -144,7 +144,7 @@ try{
- +
@@ -152,44 +152,44 @@ try{
- +
@@ -230,7 +230,7 @@ try{ foreach ($financialReadjustmentsResult as $resultKey => $result){ ?> - + @@ -242,7 +242,7 @@ try{
- +
@@ -252,13 +252,13 @@ try{
- +
- +
@@ -266,31 +266,31 @@ try{
- +
- +
@@ -308,7 +308,7 @@ try{ ?> - + @@ -335,7 +335,7 @@ try{ ?> - + @@ -356,7 +356,7 @@ try{ - +
@@ -457,30 +457,30 @@ try{ clients_id > 0){ ?> + if($companiesResult->company_id > 0){ ?> /** Carrega os orçamentos do cliente informado */ - request('FOLDER=view&TABLE=clients_budgets&ACTION=clients_budgets_datagrid&clients_id='+$('#clients_id option:selected').val(), '', true, '', '', '#loadBudgests', 'Carregando orçamentos...', 'blue', 'circle', 'sm', true); + request('FOLDER=view&TABLE=clients_budgets&ACTION=clients_budgets_datagrid&company_id='+$('#company_id option:selected').val(), '', true, '', '', '#loadBudgests', 'Carregando orçamentos...', 'blue', 'circle', 'sm', true); /** Carrega as comossões dos orçamentos do cliente informado */ - request('FOLDER=view&TABLE=clients_budgets&ACTION=clients_budgets_commissions_datagrid&clients_id='+$('#clients_id option:selected').val(), '', true, '', '', '#loadCommissions', 'Carregando comissões...', 'blue', 'circle', 'sm', true); + request('FOLDER=view&TABLE=clients_budgets&ACTION=clients_budgets_commissions_datagrid&company_id='+$('#company_id option:selected').val(), '', true, '', '', '#loadCommissions', 'Carregando comissões...', 'blue', 'circle', 'sm', true); /** Carrega os produtos do cliente informado */ - request('FOLDER=view&TABLE=client_products&ACTION=client_products_datagrid&clients_id=clients_id;?>', '', true, '', '', '#loadProducts', 'Carregando produtos...', 'blue', 'circle', 'sm', true); + request('FOLDER=view&TABLE=client_products&ACTION=client_products_datagrid&company_id=company_id;?>', '', true, '', '', '#loadProducts', 'Carregando produtos...', 'blue', 'circle', 'sm', true); /** Carrega os documentos do cliente informado */ - request('FOLDER=view&TABLE=clients&ACTION=clients_documents_datagrid&clients_id=clients_id;?>', '', true, '', '', '#loadDocuments', 'Carregando Documentos...', 'blue', 'circle', 'sm', true); + request('FOLDER=view&TABLE=clients&ACTION=clients_documents_datagrid&company_id=company_id;?>', '', true, '', '', '#loadDocuments', 'Carregando Documentos...', 'blue', 'circle', 'sm', true); /** Carrega os boletos do cliente informado */ - request('FOLDER=view&TABLE=financial_movements&ACTION=financial_movements_tickets_list&clients_id=clients_id;?>', '', true, '', '', '#loadTickets', 'Carregando boletos junto ao Sicoob...', 'blue', 'circle', 'sm', true); + request('FOLDER=view&TABLE=financial_movements&ACTION=financial_movements_tickets_list&company_id=company_id;?>', '', true, '', '', '#loadTickets', 'Carregando boletos junto ao Sicoob...', 'blue', 'circle', 'sm', true); /** Consulta o cliente selecionado */ - $('#clients_id').on('change', function () { + $('#company_id').on('change', function () { /** Carrega os orçamentos do cliente informado */ - request('FOLDER=view&TABLE=clients_budgets&ACTION=clients_budgets_form&clients_id='+$('#clients_id option:selected').val(), '', true, '', '', '#loadContent', 'Carregando orçamento do cliente', 'blue', 'circle', 'sm', true); + request('FOLDER=view&TABLE=clients_budgets&ACTION=clients_budgets_form&company_id='+$('#company_id option:selected').val(), '', true, '', '', '#loadContent', 'Carregando orçamento do cliente', 'blue', 'circle', 'sm', true); }); /** Carrega o valor do reajuste */ @@ -506,7 +506,7 @@ try{ }); - client_budgets_id > 0){?> + client_budgets_id > 0){?> /** Habilita o formulário caso esteja oculto */ $('.collapse').collapse();