Atualizando página inicial
This commit is contained in:
parent
02d2d2a8cd
commit
997c7def73
2 changed files with 14 additions and 31 deletions
33
vendor/model/FinancialMovements.class.php
vendored
33
vendor/model/FinancialMovements.class.php
vendored
|
|
@ -99,12 +99,9 @@ class FinancialMovements
|
|||
}
|
||||
|
||||
/** Verifica o total de saídas pendentes */
|
||||
public function amountOutput(int $companyId)
|
||||
public function amountOutput()
|
||||
{
|
||||
|
||||
/** Parametros de entrada */
|
||||
$this->companyId = $companyId;
|
||||
|
||||
/** Consulta SQL */
|
||||
$this->sql = 'select count(financial_movements_id) as amount_output,
|
||||
sum(movement_value) as total_value_output
|
||||
|
|
@ -116,9 +113,6 @@ class FinancialMovements
|
|||
/** Preparo o SQL para execução */
|
||||
$this->stmt = $this->connection->connect()->prepare($this->sql);
|
||||
|
||||
/** Preencho os parâmetros do SQL */
|
||||
$this->stmt->bindParam(':company_id', $this->companyId);
|
||||
|
||||
/** Executo o SQL */
|
||||
$this->stmt->execute();
|
||||
|
||||
|
|
@ -127,11 +121,10 @@ class FinancialMovements
|
|||
}
|
||||
|
||||
/** Verifica o total de entradas pendentes */
|
||||
public function amountEntrie(int $companyId, $movementDatePaid, $delay)
|
||||
public function amountEntrie($movementDatePaid, $delay)
|
||||
{
|
||||
|
||||
/** Parametros de entrada */
|
||||
$this->companyId = $companyId;
|
||||
$this->movementDatePaid = $movementDatePaid;
|
||||
$this->delay = $delay;
|
||||
$this->and = $this->movementDatePaid == true ? ' and movement_date_paid is null ' : ' and movement_date_paid is not null ';
|
||||
|
|
@ -142,8 +135,7 @@ class FinancialMovements
|
|||
sum(movement_value) as total_value_entrie,
|
||||
sum(movement_value_fees) as total_value_entrie_fees
|
||||
from financial_movements
|
||||
where company_id = :company_id
|
||||
and financial_entries_id > 0 ';
|
||||
where financial_entries_id > 0 ';
|
||||
|
||||
/** Aplica o filtro de pago ou não */
|
||||
$this->sql .= $this->and;
|
||||
|
|
@ -152,9 +144,6 @@ class FinancialMovements
|
|||
/** Preparo o SQL para execução */
|
||||
$this->stmt = $this->connection->connect()->prepare($this->sql);
|
||||
|
||||
/** Preencho os parâmetros do SQL */
|
||||
$this->stmt->bindParam(':company_id', $this->companyId);
|
||||
|
||||
/** Executo o SQL */
|
||||
$this->stmt->execute();
|
||||
|
||||
|
|
@ -163,27 +152,24 @@ class FinancialMovements
|
|||
}
|
||||
|
||||
/** Consulta uma movimentação por um período informado */
|
||||
public function searchDateEntrie(string $dateStart, string $dateEnd, int $companyId)
|
||||
public function searchDateEntrie(string $dateStart, string $dateEnd)
|
||||
{
|
||||
|
||||
/** Parametros de entrada */
|
||||
$this->dateStart = $dateStart;
|
||||
$this->dateEnd = $dateEnd;
|
||||
$this->companyId = $companyId;
|
||||
|
||||
/** Consulta SQL */
|
||||
$this->sql = 'select sum(movement_value_paid) as total_paid
|
||||
from financial_movements
|
||||
where company_id = :company_id
|
||||
and financial_entries_id > 0
|
||||
where financial_entries_id > 0
|
||||
and movement_date_paid between :date_start and :date_end
|
||||
and movement_date_paid is not null;';
|
||||
|
||||
/** Preparo o SQL para execução */
|
||||
$this->stmt = $this->connection->connect()->prepare($this->sql);
|
||||
|
||||
/** Preencho os parâmetros do SQL */
|
||||
$this->stmt->bindParam(':company_id', $this->companyId);
|
||||
/** Preencho os parâmetros do SQL */
|
||||
$this->stmt->bindParam(':date_start', $this->dateStart);
|
||||
$this->stmt->bindParam(':date_end', $this->dateEnd);
|
||||
|
||||
|
|
@ -246,11 +232,10 @@ class FinancialMovements
|
|||
}
|
||||
|
||||
/** Consulta as entradas de uma empresa pelas categorias */
|
||||
public function searchEntriesCategories(int $companyId, string $dateStart, string $dateEnd)
|
||||
public function searchEntriesCategories(string $dateStart, string $dateEnd)
|
||||
{
|
||||
|
||||
/** Parametros de entrada */
|
||||
$this->companyId = $companyId;
|
||||
$this->dateStart = $dateStart;
|
||||
$this->dateEnd = $dateEnd;
|
||||
|
||||
|
|
@ -261,8 +246,7 @@ class FinancialMovements
|
|||
(select count(fm2.financial_entries_id) from financial_movements fm2 where fm2.financial_entries_id = fm.financial_entries_id and fm2.movement_date_paid between :date_start and :date_end) as total
|
||||
from financial_movements fm
|
||||
left join financial_entries fe on fm.financial_entries_id = fe.financial_entries_id
|
||||
where fm.company_id = :company_id
|
||||
and fm.financial_entries_id > 0
|
||||
where fm.financial_entries_id > 0
|
||||
and fm.movement_date_paid between :date_start and :date_end
|
||||
order by fm.financial_entries_id asc ';
|
||||
|
||||
|
|
@ -270,7 +254,6 @@ class FinancialMovements
|
|||
$this->stmt = $this->connection->connect()->prepare($this->sql);
|
||||
|
||||
/** Preencho os parâmetros do SQL */
|
||||
$this->stmt->bindParam(':company_id', $this->companyId);
|
||||
$this->stmt->bindParam(':date_start', $this->dateStart);
|
||||
$this->stmt->bindParam(':date_end', $this->dateEnd);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ try{
|
|||
$FinancialMovements = new FinancialMovements();
|
||||
|
||||
/** Consulta as saídas pendentes */
|
||||
$result = $FinancialMovements->amountOutput($_SESSION['USERSCOMPANYID']);
|
||||
$result = $FinancialMovements->amountOutput();
|
||||
|
||||
/** Resumos */
|
||||
$amountOutput = $result->amount_output; #Quantidade de saídas pendentes
|
||||
|
|
@ -34,7 +34,7 @@ try{
|
|||
/**************** INICIO ENTRADAS PENDENTES ****************/
|
||||
|
||||
/** Consulta as entradas pendentes */
|
||||
$result = $FinancialMovements->amountEntrie($_SESSION['USERSCOMPANYID'], true, 0);
|
||||
$result = $FinancialMovements->amountEntrie(true, 0);
|
||||
|
||||
/** Resumos entradas pendentes */
|
||||
$amountEntriePendent = $result->amount_entrie; #Quantidade de entradas pendentes
|
||||
|
|
@ -49,7 +49,7 @@ try{
|
|||
/**************** INICIO ENTRADAS PAGAS ****************/
|
||||
|
||||
/** Consulta as entradas pagas */
|
||||
$result = $FinancialMovements->amountEntrie($_SESSION['USERSCOMPANYID'], false, 0);
|
||||
$result = $FinancialMovements->amountEntrie(false, 0);
|
||||
|
||||
/** Resumos entradas pagas */
|
||||
$amountEntrieConfirmed = $result->amount_entrie; #Quantidade de entradas pagas
|
||||
|
|
@ -63,7 +63,7 @@ try{
|
|||
/**************** INICIO VERIFICA ENTRADAS EM ATRASO NOS PRÓXIMOS 5 DIAS ****************/
|
||||
|
||||
/** Consulta as entradas em atraso */
|
||||
$result = $FinancialMovements->amountEntrie($_SESSION['USERSCOMPANYID'], true, $diasParaVencimento);
|
||||
$result = $FinancialMovements->amountEntrie(true, $diasParaVencimento);
|
||||
|
||||
/** Resumos entradas em atraso */
|
||||
$amountEntrieDelay = $result->amount_entrie; #Quantidade de entradas em atraso
|
||||
|
|
@ -114,7 +114,7 @@ try{
|
|||
|
||||
foreach($queryDate as $value){
|
||||
|
||||
$result = $FinancialMovements->searchDateEntrie(date('Y',$value).'-'.date('m',$value).'-01', date('Y', $value).'-'.date('m', $value).'-'.date('t', $value), $_SESSION['USERSCOMPANYID']);
|
||||
$result = $FinancialMovements->searchDateEntrie(date('Y',$value).'-'.date('m',$value).'-01', date('Y', $value).'-'.date('m', $value).'-'.date('t', $value));
|
||||
|
||||
$chartAreaEntrie->label[] = $months[date('m', $value)].'/'.date('Y', $value);
|
||||
$chartAreaEntrie->value[] = isset($result->total_paid) ? $result->total_paid : '0.00';
|
||||
|
|
@ -138,7 +138,7 @@ try{
|
|||
$endDate = date('Y-m-d');
|
||||
|
||||
/** Consulta as entradas de uma empresa pelas categorias */
|
||||
$FinancialMovementsResult = $FinancialMovements->searchEntriesCategories($_SESSION['USERSCOMPANYID'], $startDate, $endDate);
|
||||
$FinancialMovementsResult = $FinancialMovements->searchEntriesCategories($startDate, $endDate);
|
||||
|
||||
/** Controles */
|
||||
$items = [];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue