Atualizando arquivos
This commit is contained in:
parent
c7268ad9c8
commit
8064c99dda
2 changed files with 15 additions and 15 deletions
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
/** Importação de classes */
|
||||
use vendor\model\ClientBudgets;
|
||||
use vendor\controller\client_budgets\ClientBudgetsValidate;
|
||||
use vendor\model\CompaniesBudgets;
|
||||
use vendor\controller\client_budgets\CompaniesBudgetsValidate;
|
||||
|
||||
try{
|
||||
|
||||
|
|
@ -10,33 +10,33 @@ try{
|
|||
if($Main->verifyToken()){
|
||||
|
||||
/** Instânciamento de classes */
|
||||
$ClientBudgets = new ClientBudgets();
|
||||
$ClientBudgetsValidate = new ClientBudgetsValidate();
|
||||
$CompaniesBudgets = new CompaniesBudgets();
|
||||
$CompaniesBudgetsValidate = new CompaniesBudgetsValidate();
|
||||
|
||||
/** Parametros de entrada */
|
||||
$clientBudgetsId = isset($_POST['client_budgets_id']) ? (int)filter_input(INPUT_POST,'client_budgets_id', FILTER_SANITIZE_NUMBER_INT) : 0;
|
||||
$clientsId = isset($_POST['clients_id']) ? (int)filter_input(INPUT_POST, 'clients_id', FILTER_SANITIZE_NUMBER_INT) : 0;
|
||||
$CompaniesBudgetsId = isset($_POST['companies_budgets_id']) ? (int)filter_input(INPUT_POST,'companies_budgets_id', FILTER_SANITIZE_NUMBER_INT) : 0;
|
||||
$companiesId = isset($_POST['company_id']) ? (int)filter_input(INPUT_POST, 'company_id', FILTER_SANITIZE_NUMBER_INT) : 0;
|
||||
|
||||
/** Validando os campos de entrada */
|
||||
$ClientBudgetsValidate->setClientsBudgetsId($clientBudgetsId);
|
||||
$ClientBudgetsValidate->setClientsId($clientsId);
|
||||
$CompaniesBudgetsValidate->setCompaniesBudgetsId($CompaniesBudgetsId);
|
||||
$CompaniesBudgetsValidate->setCompanyId($companiesId);
|
||||
|
||||
/** Verifico a existência de erros */
|
||||
if (!empty($ClientBudgetsValidate->getErrors())) {
|
||||
if (!empty($CompaniesBudgetsValidate->getErrors())) {
|
||||
|
||||
/** Informo */
|
||||
throw new InvalidArgumentException($ClientBudgetsValidate->getErrors(), 0);
|
||||
throw new InvalidArgumentException($CompaniesBudgetsValidate->getErrors(), 0);
|
||||
|
||||
} else {
|
||||
|
||||
/** Salva as alterações ou cadastra um novo registro */
|
||||
if($ClientBudgets->Delete($ClientBudgetsValidate->getClientsBudgetsId())){
|
||||
if($CompaniesBudgets->Delete($CompaniesBudgetsValidate->getClientsBudgetsId())){
|
||||
|
||||
|
||||
$procedure = '<script type="text/javascript">';
|
||||
$procedure .= '$(document).ready(function(e) {';
|
||||
$procedure .= ' setTimeout(() => {';
|
||||
$procedure .= ' request(\'FOLDER=view&TABLE=clients_budgets&ACTION=clients_budgets_datagrid&clients_id='.$ClientBudgetsValidate->getClientsId().'\', \'#loadBudgests\', true, \'Carregando orçamentos...\', \'\', \'\', \'Carregando orçamentos\', \'blue\', \'circle\', \'sm\', true);';
|
||||
$procedure .= ' request(\'FOLDER=view&TABLE=companies_budgets&ACTION=companies_budgets_datagrid&company_id='.$CompaniesBudgetsValidate->getCompanyId().'\', \'#loadBudgests\', true, \'Carregando orçamentos...\', \'\', \'\', \'Carregando orçamentos\', \'blue\', \'circle\', \'sm\', true);';
|
||||
$procedure .= ' }, "2000");';
|
||||
$procedure .= '});';
|
||||
$procedure .= '</script>';
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ try{
|
|||
for($i=0; $i < count($itens); $i++){
|
||||
|
||||
/** Atualiza o valor do produto do orçamento */
|
||||
$ProductsCompanies->UpdateValueProduct($CompaniesBudgetsValidate->getcompanyId(),
|
||||
$ProductsCompanies->UpdateValueProduct($CompaniesBudgetsValidate->getCompanyId(),
|
||||
$itens[$i],
|
||||
$CompaniesBudgetsValidate->getReadjustmentBudget()/(count($itens)));
|
||||
}
|
||||
|
|
@ -111,7 +111,7 @@ try{
|
|||
}else {
|
||||
|
||||
/** Atualiza o valor do produto do orçamento */
|
||||
$ProductsCompanies->UpdateValueProduct($CompaniesBudgetsValidate->getcompanyId(),
|
||||
$ProductsCompanies->UpdateValueProduct($CompaniesBudgetsValidate->getCompanyId(),
|
||||
$itens[0],
|
||||
$CompaniesBudgetsValidate->getReadjustmentBudget());
|
||||
}
|
||||
|
|
@ -120,7 +120,7 @@ try{
|
|||
$procedure = '<script type="text/javascript">';
|
||||
$procedure .= '$(document).ready(function(e) {';
|
||||
$procedure .= ' setTimeout(() => {';
|
||||
$procedure .= ' request(\'FOLDER=view&TABLE=clients_budgets&ACTION=clients_budgets_datagrid&company_id='.$CompaniesBudgetsValidate->getcompanyId().'\', \'#loadBudgests\', true, \'Carregando orçamentos...\', \'\', \'\', \'Carregando orçamentos\', \'blue\', \'circle\', \'sm\', true);';
|
||||
$procedure .= ' request(\'FOLDER=view&TABLE=companies_budgets&ACTION=companies_budgets_datagrid&company_id='.$CompaniesBudgetsValidate->getCompanyId().'\', \'#loadBudgests\', true, \'Carregando orçamentos...\', \'\', \'\', \'Carregando orçamentos\', \'blue\', \'circle\', \'sm\', true);';
|
||||
$procedure .= ' }, "2000");';
|
||||
$procedure .= '});';
|
||||
$procedure .= '</script>';
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue