Atualizando arquivos
This commit is contained in:
parent
9aa91495c5
commit
baaa0fec25
3 changed files with 49 additions and 48 deletions
|
|
@ -1698,16 +1698,16 @@ function prepareBudget(id, source, productId, budgetsId){
|
|||
case 'products':
|
||||
|
||||
/** Carrega a descrição */
|
||||
$('#description').val($(id).find('td:eq(2)').text());
|
||||
$('#description').val($(id).find('td:eq(3)').text());
|
||||
|
||||
/** Seleciona o mês */
|
||||
$("#readjustment_month option:contains(" + $(id).find('td:eq(3)').text() + ")").attr('selected', true);
|
||||
$("#readjustment_month option:contains(" + $(id).find('td:eq(4)').text() + ")").attr('selected', true);
|
||||
|
||||
/** Carrega o dia do vencimento*/
|
||||
$('#day_due').val($(id).find('td:eq(4)').text());
|
||||
$('#day_due').val($(id).find('td:eq(5)').text());
|
||||
|
||||
/** Carrega o valor do orçamento */
|
||||
$('#budget').val($(id).find('td:eq(5)').text());
|
||||
$('#budget').val($(id).find('td:eq(6)').text());
|
||||
|
||||
/** Informa o id do produto */
|
||||
$('#products_id').val(productId);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
/** Importação de classes */
|
||||
use vendor\model\ClientBudgets;
|
||||
use vendor\model\CompaniesBudgets;
|
||||
use vendor\model\ClientProducts;
|
||||
use vendor\controller\client_budgets\ClientBudgetsValidate;
|
||||
use vendor\controller\client_budgets\CompaniesBudgetsValidate;
|
||||
|
||||
try{
|
||||
|
||||
|
|
@ -11,9 +11,9 @@ try{
|
|||
if($Main->verifyToken()){
|
||||
|
||||
/** Instânciamento de classes */
|
||||
$ClientBudgets = new ClientBudgets();
|
||||
$CompaniesBudgets = new CompaniesBudgets();
|
||||
$ClientProducts = new ClientProducts();
|
||||
$ClientBudgetsValidate = new ClientBudgetsValidate();
|
||||
$CompaniesBudgetsValidate = new CompaniesBudgetsValidate();
|
||||
|
||||
/** Parametros de entrada */
|
||||
$budget = isset($_POST['budget']) ? (string)filter_input(INPUT_POST, 'budget', FILTER_SANITIZE_SPECIAL_CHARS) : '';
|
||||
|
|
@ -34,58 +34,58 @@ try{
|
|||
$description = isset($_POST['description']) ? (string)filter_input(INPUT_POST, 'description', FILTER_SANITIZE_SPECIAL_CHARS) : '';
|
||||
|
||||
/** Validando os campos de entrada */
|
||||
$ClientBudgetsValidate->setbudget($budget);
|
||||
$ClientBudgetsValidate->setdayDue($dayDue);
|
||||
$ClientBudgetsValidate->setreadjustmentYear($readjustmentYear);
|
||||
$ClientBudgetsValidate->setreadjustmentMonth($readjustmentMonth);
|
||||
$ClientBudgetsValidate->setreadjustmentIndex($readjustmentIndex);
|
||||
$ClientBudgetsValidate->setreadjustmentValue($readjustmentValue);
|
||||
$ClientBudgetsValidate->setreadjustmentBudget($readjustmentBudget);
|
||||
$ClientBudgetsValidate->setreadjustmentType($readjustmentType);
|
||||
$ClientBudgetsValidate->setoften($often);
|
||||
$ClientBudgetsValidate->setdateStart($dateStart);
|
||||
$ClientBudgetsValidate->setcompanyId($companyId);
|
||||
$ClientBudgetsValidate->setClientsBudgetsId($clientsBudgetsId);
|
||||
$ClientBudgetsValidate->setFinancialCategoriesId($financialCategoriesId);
|
||||
$ClientBudgetsValidate->setFinancialAccountsId($financialAccountsId);
|
||||
$ClientBudgetsValidate->setProductsId($productsId);
|
||||
$ClientBudgetsValidate->setDescription($description);
|
||||
$CompaniesBudgetsValidate->setbudget($budget);
|
||||
$CompaniesBudgetsValidate->setdayDue($dayDue);
|
||||
$CompaniesBudgetsValidate->setreadjustmentYear($readjustmentYear);
|
||||
$CompaniesBudgetsValidate->setreadjustmentMonth($readjustmentMonth);
|
||||
$CompaniesBudgetsValidate->setreadjustmentIndex($readjustmentIndex);
|
||||
$CompaniesBudgetsValidate->setreadjustmentValue($readjustmentValue);
|
||||
$CompaniesBudgetsValidate->setreadjustmentBudget($readjustmentBudget);
|
||||
$CompaniesBudgetsValidate->setreadjustmentType($readjustmentType);
|
||||
$CompaniesBudgetsValidate->setoften($often);
|
||||
$CompaniesBudgetsValidate->setdateStart($dateStart);
|
||||
$CompaniesBudgetsValidate->setcompanyId($companyId);
|
||||
$CompaniesBudgetsValidate->setClientsBudgetsId($clientsBudgetsId);
|
||||
$CompaniesBudgetsValidate->setFinancialCategoriesId($financialCategoriesId);
|
||||
$CompaniesBudgetsValidate->setFinancialAccountsId($financialAccountsId);
|
||||
$CompaniesBudgetsValidate->setProductsId($productsId);
|
||||
$CompaniesBudgetsValidate->setDescription($description);
|
||||
|
||||
|
||||
/** Verifica se não existem erros a serem informados,
|
||||
* caso não haja erro(s) salvo os dados do orçamento ou
|
||||
* efetua o cadastro de um novo*/
|
||||
/** 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 */
|
||||
$budgetsId = $ClientBudgets->Save($ClientBudgetsValidate->getClientsBudgetsId(),
|
||||
$ClientBudgetsValidate->getcompanyId(),
|
||||
$ClientBudgetsValidate->getBudget(),
|
||||
$ClientBudgetsValidate->getDayDue(),
|
||||
$ClientBudgetsValidate->getReadjustmentIndex(),
|
||||
$ClientBudgetsValidate->getReadjustmentValue(),
|
||||
$ClientBudgetsValidate->getReadjustmentBudget(),
|
||||
$ClientBudgetsValidate->getReadjustmentType(),
|
||||
$ClientBudgetsValidate->getReadjustmentYear(),
|
||||
$ClientBudgetsValidate->getReadjustmentMonth(),
|
||||
$ClientBudgetsValidate->getOften(),
|
||||
$ClientBudgetsValidate->getDateStart(),
|
||||
$ClientBudgetsValidate->getDescription(),
|
||||
$ClientBudgetsValidate->getFinancialCategoriesId(),
|
||||
$ClientBudgetsValidate->getFinancialAccountsId(),
|
||||
$ClientBudgetsValidate->getProductsId());
|
||||
$budgetsId = $CompaniesBudgets->Save($CompaniesBudgetsValidate->getClientsBudgetsId(),
|
||||
$CompaniesBudgetsValidate->getcompanyId(),
|
||||
$CompaniesBudgetsValidate->getBudget(),
|
||||
$CompaniesBudgetsValidate->getDayDue(),
|
||||
$CompaniesBudgetsValidate->getReadjustmentIndex(),
|
||||
$CompaniesBudgetsValidate->getReadjustmentValue(),
|
||||
$CompaniesBudgetsValidate->getReadjustmentBudget(),
|
||||
$CompaniesBudgetsValidate->getReadjustmentType(),
|
||||
$CompaniesBudgetsValidate->getReadjustmentYear(),
|
||||
$CompaniesBudgetsValidate->getReadjustmentMonth(),
|
||||
$CompaniesBudgetsValidate->getOften(),
|
||||
$CompaniesBudgetsValidate->getDateStart(),
|
||||
$CompaniesBudgetsValidate->getDescription(),
|
||||
$CompaniesBudgetsValidate->getFinancialCategoriesId(),
|
||||
$CompaniesBudgetsValidate->getFinancialAccountsId(),
|
||||
$CompaniesBudgetsValidate->getProductsId());
|
||||
|
||||
/** Verifica se ocorreu algum erro na hora de gravar */
|
||||
if(!empty($ClientBudgets->getErrors())){
|
||||
if(!empty($CompaniesBudgets->getErrors())){
|
||||
|
||||
/** Informo */
|
||||
throw new InvalidArgumentException($ClientBudgets->getErrors(), 0);
|
||||
throw new InvalidArgumentException($CompaniesBudgets->getErrors(), 0);
|
||||
|
||||
}else{
|
||||
|
||||
|
|
@ -94,13 +94,13 @@ try{
|
|||
if($budgetsId > 0){
|
||||
|
||||
/** Atualiza o valor do produto do orçamento */
|
||||
$ClientProducts->UpdateValueProduct($ClientBudgetsValidate->getcompanyId(), $ClientBudgetsValidate->getProductsId(), $ClientBudgetsValidate->getReadjustmentBudget());
|
||||
$ClientProducts->UpdateValueProduct($CompaniesBudgetsValidate->getcompanyId(), $CompaniesBudgetsValidate->getProductsId(), $CompaniesBudgetsValidate->getReadjustmentBudget());
|
||||
|
||||
/** Prepara o retorno */
|
||||
$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='.$ClientBudgetsValidate->getcompanyId().'\', \'#loadBudgests\', true, \'Carregando orçamentos...\', \'\', \'\', \'Carregando orçamentos\', \'blue\', \'circle\', \'sm\', true);';
|
||||
$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 .= ' }, "2000");';
|
||||
$procedure .= '});';
|
||||
$procedure .= '</script>';
|
||||
|
|
@ -110,7 +110,7 @@ try{
|
|||
|
||||
'cod' => 200,
|
||||
'title' => 'Atenção',
|
||||
'message' => '<div class="alert alert-success" role="alert">' . ($ClientBudgetsValidate->getClientsBudgetsId() > 0 ? 'Orçamento atualizado com sucesso!' : 'Orçamento cadastrado com sucesso!') .'</div>',
|
||||
'message' => '<div class="alert alert-success" role="alert">' . ($CompaniesBudgetsValidate->getClientsBudgetsId() > 0 ? 'Orçamento atualizado com sucesso!' : 'Orçamento cadastrado com sucesso!') .'</div>',
|
||||
'procedure' => $procedure
|
||||
|
||||
];
|
||||
|
|
@ -123,7 +123,7 @@ try{
|
|||
|
||||
}else{//Caso ocorra algum erro, informo
|
||||
|
||||
throw new InvalidArgumentException(($ClientBudgetsValidate->getClientBudgetsId() > 0 ? 'Não foi possível atualizar o novo orçamento' : 'Não foi possível cadastrar o novo orçamento'), 0);
|
||||
throw new InvalidArgumentException(($CompaniesBudgetsValidate->getCompaniesBudgetsId() > 0 ? 'Não foi possível atualizar o novo orçamento' : 'Não foi possível cadastrar o novo orçamento'), 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
1
vendor/model/ProductsCompanies.class.php
vendored
1
vendor/model/ProductsCompanies.class.php
vendored
|
|
@ -128,6 +128,7 @@ class ProductsCompanies
|
|||
GROUP_CONCAT(p.description ORDER BY cp.product_company_id SEPARATOR \', \') AS products,
|
||||
GROUP_CONCAT(p.reference ORDER BY cp.product_company_id SEPARATOR \', \') AS `references`,
|
||||
GROUP_CONCAT(cp.product_value ORDER BY cp.product_company_id SEPARATOR \', \') AS product_values,
|
||||
GROUP_CONCAT(p.type ORDER BY cp.product_company_id SEPARATOR \', \') AS product_types,
|
||||
SUM(cp.product_value) AS total_product_value
|
||||
FROM
|
||||
products_companies cp
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue