Atualização companies_budgets_form.php
This commit is contained in:
parent
2015fc4bcf
commit
7e633d7109
2 changed files with 72 additions and 73 deletions
141
vendor/model/CompaniesBudgetsCommissions.class.php
vendored
141
vendor/model/CompaniesBudgetsCommissions.class.php
vendored
|
|
@ -25,7 +25,7 @@ class CompaniesBudgetsCommissions
|
|||
private $limit = null;
|
||||
private $CompaniesBudgetsCommissionsId = null;
|
||||
private $financialMovementsId = null;
|
||||
private $clientBudgetsId = null;
|
||||
private $CompaniesBudgetsId = null;
|
||||
private $commissionValuePaid = null;
|
||||
private $commissionDatePaid = null;
|
||||
private $usersIdConfirm = null;
|
||||
|
|
@ -38,7 +38,7 @@ class CompaniesBudgetsCommissions
|
|||
private $lastId = null;
|
||||
private $info = null;
|
||||
private $parcel = null;
|
||||
private $clientsId = null;
|
||||
private $CompanyBudgetsId = null;
|
||||
private $and = null;
|
||||
private $dateStart = null;
|
||||
private $dateEnd = null;
|
||||
|
|
@ -56,7 +56,7 @@ class CompaniesBudgetsCommissions
|
|||
{
|
||||
|
||||
/** Consulta SQL */
|
||||
$this->sql = "describe client_budgets_commissions";
|
||||
$this->sql = "describe companies_budgets_commissions";
|
||||
|
||||
/** Preparo o SQL para execução */
|
||||
$this->stmt = $this->connection->connect()->prepare($this->sql);
|
||||
|
|
@ -95,12 +95,12 @@ class CompaniesBudgetsCommissions
|
|||
$this->CompaniesBudgetsCommissionsId = $CompaniesBudgetsCommissionsId;
|
||||
|
||||
/** Consulta SQL */
|
||||
$this->sql = 'select cm.client_budgets_commissions_id,
|
||||
$this->sql = 'select cm.companies_budgets_commissions_id,
|
||||
cm.financial_movements_id,
|
||||
cm.client_budgets_id,
|
||||
cm.users_id,
|
||||
cm.users_id_create,
|
||||
cm.users_id_confirm,
|
||||
cm.companies_budgets_id,
|
||||
cm.user_id,
|
||||
cm.user_id_create,
|
||||
cm.user_id_confirm,
|
||||
cm.value,
|
||||
cm.date_create,
|
||||
cm.description,
|
||||
|
|
@ -109,15 +109,15 @@ class CompaniesBudgetsCommissions
|
|||
cm.commission_date_paid,
|
||||
cm.commission_date_confirm,
|
||||
f.movement_value_paid
|
||||
from client_budgets_commissions cm
|
||||
from companies_budgets_commissions cm
|
||||
left join financial_movements f on cm.financial_movements_id = f.financial_movements_id
|
||||
where cm.client_budgets_commissions_id = :client_budgets_commissions_id';
|
||||
where cm.companies_budgets_commissions_id = :companies_budgets_commissions_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_commissions_id', $this->CompaniesBudgetsCommissionsId);
|
||||
$this->stmt->bindParam(':companies_budgets_commissions_id', $this->CompaniesBudgetsCommissionsId);
|
||||
|
||||
/** Executo o SQL */
|
||||
$this->stmt->execute();
|
||||
|
|
@ -128,25 +128,25 @@ class CompaniesBudgetsCommissions
|
|||
}
|
||||
|
||||
/** Lista os registros do banco de dados com limitação */
|
||||
public function Check(int $clientBudgetsId, int $usersId)
|
||||
public function Check(int $CompaniesBudgetsId, int $usersId)
|
||||
{
|
||||
|
||||
/** Parametros de entrada */
|
||||
$this->clientBudgetsId = $clientBudgetsId;
|
||||
$this->CompaniesBudgetsId = $CompaniesBudgetsId;
|
||||
$this->usersId = $usersId;
|
||||
|
||||
/** Consulta SQL */
|
||||
$this->sql = 'select count(cm.client_budgets_commissions_id) as qtde
|
||||
from client_budgets_commissions cm
|
||||
where cm.client_budgets_id = :client_budgets_id
|
||||
and cm.users_id = :users_id';
|
||||
$this->sql = 'select count(cm.companies_budgets_commissions_id) as qtde
|
||||
from companies_budgets_commissions cm
|
||||
where cm.companies_budgets_id = :companies_budgets_id
|
||||
and cm.user_id = :user_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(':users_id', $this->usersId);
|
||||
$this->stmt->bindParam(':companies_budgets_id', $this->CompaniesBudgetsId);
|
||||
$this->stmt->bindParam(':user_id', $this->usersId);
|
||||
|
||||
/** Executo o SQL */
|
||||
$this->stmt->execute();
|
||||
|
|
@ -158,16 +158,16 @@ class CompaniesBudgetsCommissions
|
|||
|
||||
|
||||
/** Lista todos os egistros do banco com ou sem paginação*/
|
||||
public function All(int $start, int $max, int $clientsId, int $usersId, string $dateStart, string $dateEnd)
|
||||
public function All(int $start, int $max, int $CompanyBudgetsId, int $usersId, string $dateStart, string $dateEnd)
|
||||
{
|
||||
/** Parametros de entrada */
|
||||
$this->clientsId = $clientsId;
|
||||
$this->CompanyBudgetsId = $CompanyBudgetsId;
|
||||
$this->usersId = $usersId;
|
||||
$this->dateStart = $dateStart;
|
||||
$this->dateEnd = $dateEnd;
|
||||
$this->and = '';
|
||||
$this->and .= $this->clientsId > 0 ? ' and cb.clients_id = :clients_id ' : '';
|
||||
$this->and .= $this->usersId > 0 ? ' and cm.users_id = :users_id ' : '';
|
||||
$this->and .= $this->CompanyBudgetsId > 0 ? ' and cb.company_id = :company_id ' : '';
|
||||
$this->and .= $this->usersId > 0 ? ' and cm.user_id = :user_id ' : '';
|
||||
|
||||
/** Período de consulta */
|
||||
if(!empty($this->dateStart) && !empty($this->dateEnd)){
|
||||
|
|
@ -176,11 +176,11 @@ class CompaniesBudgetsCommissions
|
|||
}
|
||||
|
||||
/** Consulta SQL */
|
||||
$this->sql = 'select cm.client_budgets_commissions_id,
|
||||
cm.client_budgets_id,
|
||||
cm.users_id,
|
||||
$this->sql = 'select cm.companies_budgets_commissions_id,
|
||||
cm.companies_budgets_id,
|
||||
cm.user_id,
|
||||
cm.value,
|
||||
cm.users_id_create,
|
||||
cm.user_id_create,
|
||||
cm.date_create,
|
||||
cm.description,
|
||||
cm.parcel,
|
||||
|
|
@ -194,20 +194,19 @@ class CompaniesBudgetsCommissions
|
|||
fm.movement_date_scheduled,
|
||||
u.name_first,
|
||||
u.name_last,
|
||||
c.fantasy_name,
|
||||
c.reference
|
||||
from client_budgets_commissions cm
|
||||
left join users u on cm.users_id = u.users_id
|
||||
left join client_budgets cb on cm.client_budgets_id = cb.client_budgets_id
|
||||
c.name_fantasy,
|
||||
c.cns
|
||||
from companies_budgets_commissions cm
|
||||
left join users u on cm.user_id = u.user_id
|
||||
left join companies_budgets cb on cm.companies_budgets_id = cb.companies_budgets_id
|
||||
left join financial_movements fm on cm.financial_movements_id = fm.financial_movements_id
|
||||
left join clients c on fm.clients_id = c.clients_id
|
||||
where cm.client_budgets_commissions_id > 0 ';
|
||||
where cm.companies_budgets_commissions_id > 0 ';
|
||||
|
||||
/** Adiciona o filtro */
|
||||
$this->sql .= $this->and;
|
||||
|
||||
/** Ordenação */
|
||||
$this->sql .= ' order by cm.client_budgets_commissions_id asc';
|
||||
$this->sql .= ' order by cm.companies_budgets_commissions_id asc';
|
||||
|
||||
/** Verifico se há paginação */
|
||||
if($this->max > 0){
|
||||
|
|
@ -222,17 +221,17 @@ class CompaniesBudgetsCommissions
|
|||
$this->stmt = $this->connection->connect()->prepare($this->sql);
|
||||
|
||||
/** Verifica se o cliente foi informado */
|
||||
if($this->clientsId > 0){
|
||||
if($this->CompanyBudgetsId > 0){
|
||||
|
||||
/** Preencho os parâmetros do SQL */
|
||||
$this->stmt->bindParam('clients_id', $this->clientsId);
|
||||
$this->stmt->bindParam('company_id', $this->CompanyBudgetsId);
|
||||
}
|
||||
|
||||
/** Verifica se o usuário foi informado */
|
||||
if($this->usersId > 0){
|
||||
|
||||
/** Preencho os parâmetros do SQL */
|
||||
$this->stmt->bindParam('users_id', $this->usersId);
|
||||
$this->stmt->bindParam('user_id', $this->usersId);
|
||||
}
|
||||
|
||||
/** Período de consulta */
|
||||
|
|
@ -253,17 +252,17 @@ class CompaniesBudgetsCommissions
|
|||
|
||||
|
||||
/** Conta a quantidades de registros */
|
||||
public function Count(int $clientsId, int $usersId, string $dateStart, string $dateEnd)
|
||||
public function Count(int $CompanyBudgetsId, int $usersId, string $dateStart, string $dateEnd)
|
||||
{
|
||||
|
||||
/** Parametros de entrada */
|
||||
$this->clientsId = $clientsId;
|
||||
$this->CompanyBudgetsId = $CompanyBudgetsId;
|
||||
$this->usersId = $usersId;
|
||||
$this->dateStart = $dateStart;
|
||||
$this->dateEnd = $dateEnd;
|
||||
$this->and = '';
|
||||
$this->and .= $this->clientsId > 0 ? ' and cb.clients_id = :clients_id ' : '';
|
||||
$this->and .= $this->usersId > 0 ? ' and cm.users_id = :users_id ' : '';
|
||||
$this->and .= $this->CompanyBudgetsId > 0 ? ' and cb.company_id = :company_id ' : '';
|
||||
$this->and .= $this->usersId > 0 ? ' and cm.user_id = :user_id ' : '';
|
||||
|
||||
/** Período de consulta */
|
||||
if(!empty($this->dateStart) && !empty($this->dateEnd)){
|
||||
|
|
@ -272,11 +271,11 @@ class CompaniesBudgetsCommissions
|
|||
}
|
||||
|
||||
/** Consulta SQL */
|
||||
$this->sql = 'select count(cm.client_budgets_commissions_id) as qtde
|
||||
from client_budgets_commissions cm
|
||||
left join client_budgets cb on cm.client_budgets_id = cb.client_budgets_id
|
||||
$this->sql = 'select count(cm.companies_budgets_commissions_id) as qtde
|
||||
from companies_budgets_commissions cm
|
||||
left join companies_budgets cb on cm.companies_budgets_id = cb.companies_budgets_id
|
||||
left join financial_movements fm on cm.financial_movements_id = fm.financial_movements_id
|
||||
where cm.client_budgets_commissions_id > 0 ';
|
||||
where cm.companies_budgets_commissions_id > 0 ';
|
||||
|
||||
/** Adiciona o filtro */
|
||||
$this->sql .= $this->and;
|
||||
|
|
@ -285,17 +284,17 @@ class CompaniesBudgetsCommissions
|
|||
$this->stmt = $this->connection->connect()->prepare($this->sql);
|
||||
|
||||
/** Verifica se o cliente foi informado */
|
||||
if($this->clientsId > 0){
|
||||
if($this->CompanyBudgetsId > 0){
|
||||
|
||||
/** Preencho os parâmetros do SQL */
|
||||
$this->stmt->bindParam('clients_id', $this->clientsId);
|
||||
$this->stmt->bindParam('company_id', $this->CompanyBudgetsId);
|
||||
}
|
||||
|
||||
/** Verifica se o usuário foi informado */
|
||||
if($this->usersId > 0){
|
||||
|
||||
/** Preencho os parâmetros do SQL */
|
||||
$this->stmt->bindParam('users_id', $this->usersId);
|
||||
$this->stmt->bindParam('user_id', $this->usersId);
|
||||
}
|
||||
|
||||
/** Período de consulta */
|
||||
|
|
@ -317,7 +316,7 @@ class CompaniesBudgetsCommissions
|
|||
/** Insere um novo registro no banco */
|
||||
public function Save(? int $CompaniesBudgetsCommissionsId,
|
||||
? int $financialMovementsId,
|
||||
? int $clientBudgetsId,
|
||||
? int $CompaniesBudgetsId,
|
||||
? int $usersId,
|
||||
? float $value,
|
||||
? int $usersIdCreate,
|
||||
|
|
@ -331,7 +330,7 @@ class CompaniesBudgetsCommissions
|
|||
/** Parametros */
|
||||
$this->CompaniesBudgetsCommissionsId = $CompaniesBudgetsCommissionsId;
|
||||
$this->financialMovementsId = $financialMovementsId;
|
||||
$this->clientBudgetsId = $clientBudgetsId;
|
||||
$this->CompaniesBudgetsId = $CompaniesBudgetsId;
|
||||
$this->usersId = $usersId;
|
||||
$this->value = $value;
|
||||
$this->usersIdCreate = $usersIdCreate;
|
||||
|
|
@ -346,20 +345,20 @@ class CompaniesBudgetsCommissions
|
|||
if($this->CompaniesBudgetsCommissionsId > 0){
|
||||
|
||||
/** Consulta SQL */
|
||||
$this->sql = 'update client_budgets_commissions set commission_value_paid = :commission_value_paid,
|
||||
$this->sql = 'update companies_budgets_commissions set commission_value_paid = :commission_value_paid,
|
||||
commission_date_paid = :commission_date_paid,
|
||||
users_id_confirm = :users_id_confirm
|
||||
where client_budgets_commissions_id = :client_budgets_commissions_id
|
||||
user_id_confirm = :user_id_confirm
|
||||
where companies_budgets_commissions_id = :companies_budgets_commissions_id
|
||||
and commission_date_paid is null';
|
||||
|
||||
/** Preparo o sql para receber os valores */
|
||||
$this->stmt = $this->connection->connect()->prepare($this->sql);
|
||||
|
||||
/** Preencho os parâmetros do SQL */
|
||||
$this->stmt->bindParam('users_id_confirm', $this->usersIdConfirm);
|
||||
$this->stmt->bindParam('user_id_confirm', $this->usersIdConfirm);
|
||||
$this->stmt->bindParam('commission_date_paid', $this->commissionDatePaid);
|
||||
$this->stmt->bindParam('commission_value_paid', $this->commissionValuePaid);
|
||||
$this->stmt->bindParam('client_budgets_commissions_id', $this->CompaniesBudgetsCommissionsId);
|
||||
$this->stmt->bindParam('companies_budgets_commissions_id', $this->CompaniesBudgetsCommissionsId);
|
||||
|
||||
/** Executo o SQL */
|
||||
return $this->stmt->execute();
|
||||
|
|
@ -367,20 +366,20 @@ class CompaniesBudgetsCommissions
|
|||
}else{//Se o ID não foi informado, grava-se um novo registro
|
||||
|
||||
/** Consulta SQL */
|
||||
$this->sql = 'insert into client_budgets_commissions(client_budgets_commissions_id,
|
||||
$this->sql = 'insert into companies_budgets_commissions(companies_budgets_commissions_id,
|
||||
financial_movements_id,
|
||||
client_budgets_id,
|
||||
users_id,
|
||||
companies_budgets_id,
|
||||
user_id,
|
||||
value,
|
||||
users_id_create,
|
||||
user_id_create,
|
||||
description,
|
||||
parcel
|
||||
) values (:client_budgets_commissions_id,
|
||||
) values (:companies_budgets_commissions_id,
|
||||
:financial_movements_id,
|
||||
:client_budgets_id,
|
||||
:users_id,
|
||||
:companies_budgets_id,
|
||||
:user_id,
|
||||
:value,
|
||||
:users_id_create,
|
||||
:user_id_create,
|
||||
:description,
|
||||
:parcel)';
|
||||
|
||||
|
|
@ -395,12 +394,12 @@ class CompaniesBudgetsCommissions
|
|||
/** Preencho os parâmetros do SQL */
|
||||
$this->stmt->bindParam('value', $this->value);
|
||||
$this->stmt->bindParam('parcel', $this->parcel);
|
||||
$this->stmt->bindParam('users_id', $this->usersId);
|
||||
$this->stmt->bindParam('user_id', $this->usersId);
|
||||
$this->stmt->bindParam('description', $this->description);
|
||||
$this->stmt->bindParam('users_id_create', $this->usersIdCreate);
|
||||
$this->stmt->bindParam('client_budgets_id', $this->clientBudgetsId);
|
||||
$this->stmt->bindParam('user_id_create', $this->usersIdCreate);
|
||||
$this->stmt->bindParam('companies_budgets_id', $this->CompaniesBudgetsId);
|
||||
$this->stmt->bindParam('financial_movements_id', $this->financialMovementsId);
|
||||
$this->stmt->bindParam('client_budgets_commissions_id', $this->CompaniesBudgetsCommissionsId);
|
||||
$this->stmt->bindParam('companies_budgets_commissions_id', $this->CompaniesBudgetsCommissionsId);
|
||||
|
||||
/** Executo o SQL */
|
||||
$this->stmt->execute();
|
||||
|
|
@ -433,14 +432,14 @@ class CompaniesBudgetsCommissions
|
|||
$this->CompaniesBudgetsCommissionsId = $CompaniesBudgetsCommissionsId;
|
||||
|
||||
/** Consulta SQL */
|
||||
$this->sql = 'delete from client_budgets
|
||||
where client_budgets_commissions_id = :client_budgets_commissions_id';
|
||||
$this->sql = 'delete from companies_budgets
|
||||
where companies_budgets_commissions_id = :companies_budgets_commissions_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_commissions_id', $this->CompaniesBudgetsCommissionsId);
|
||||
$this->stmt->bindParam('companies_budgets_commissions_id', $this->CompaniesBudgetsCommissionsId);
|
||||
|
||||
/** Executo o SQL */
|
||||
return $this->stmt->execute();
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ try{
|
|||
|
||||
|
||||
<tr class=" <?php echo $Result->commission_date_paid != NULL ? 'table-success' : '';?> ">
|
||||
<td class="text-center" width="30"><?php echo ( ($Result->commission_date_paid === NULL) && ($Result->movement_date_paid != NULL) ) ? '<input type="checkbox" name="client_budgets_commissions_id[]" value="'.$Result->client_budgets_commissions_id.'" />' : ($Result->commission_date_paid != NULL ? '<i class="fas fa-check" data-toggle="tooltip" data-placement="top" ></i>' : '');?></td>
|
||||
<td class="text-center" width="30"><?php echo ( ($Result->commission_date_paid === NULL) && ($Result->movement_date_paid != NULL) ) ? '<input type="checkbox" name="companies_budgets_commissions_id[]" value="'.$Result->companies_budgets_commissions_id.'" />' : ($Result->commission_date_paid != NULL ? '<i class="fas fa-check" data-toggle="tooltip" data-placement="top" ></i>' : '');?></td>
|
||||
<td class="text-left"><?php echo $Result->reference;?> - <?php echo $Result->fantasy_name;?></td>
|
||||
<td class="text-center" width="70"><?php echo isset($Result->movement_date_scheduled) ? date('d/m/Y', strtotime($Result->movement_date_scheduled)) : '';?></td>
|
||||
<td class="text-center" width="70"><?php echo isset($Result->movement_date_paid) ? date('d/m/Y', strtotime($Result->movement_date_paid)) : '';?></td>
|
||||
|
|
@ -320,7 +320,7 @@ try{
|
|||
$message .= '<input type="hidden" name="TABLE" value="clients_budgets"/>';
|
||||
$message .= '<input type="hidden" name="ACTION" value="clients_budgets_commissions_confim_payment"/>';
|
||||
$message .= '<input type="hidden" name="FOLDER" value="action" />';
|
||||
$message .= '<input type="hidden" name="clients_budgets_commissions_id" value="'.$Result->client_budgets_commissions_id.'" />';
|
||||
$message .= '<input type="hidden" name="clients_budgets_commissions_id" value="'.$Result->companies_budgets_commissions_id.'" />';
|
||||
|
||||
$message .= '<div class="col-sm-12">';
|
||||
$message .= ' <button type="button" class="btn btn-primary btn-user btn-block mb-0" onclick="sendForm(\'#frmCommissions\', \'\', true, \'\', 0, \'#sendMovement\', \'Confirmando pagamento da comissão\', \'random\', \'circle\', \'sm\', true)">';
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue