Atualizando saídas
This commit is contained in:
parent
390264fd51
commit
b3255724ad
1 changed files with 56 additions and 35 deletions
91
vendor/model/FinancialMovements.class.php
vendored
91
vendor/model/FinancialMovements.class.php
vendored
|
|
@ -673,37 +673,53 @@ class FinancialMovements
|
|||
$this->and = '';
|
||||
|
||||
/** Consulta SQL */
|
||||
$this->sql = 'select fm.financial_movements_id,
|
||||
fm.financial_accounts_id,
|
||||
fm.financial_entries_id,
|
||||
fm.financial_outputs_id,
|
||||
fm.user_id,
|
||||
fm.company_id,
|
||||
fm.description,
|
||||
fm.movement_value,
|
||||
fm.movement_value_paid,
|
||||
fm.movement_value_fees,
|
||||
fm.movement_date,
|
||||
fm.movement_date_scheduled,
|
||||
fm.movement_date_paid,
|
||||
fm.reference as movement_reference,
|
||||
fm.status,
|
||||
c.reference,
|
||||
c.cns,
|
||||
c.name_fantasy,
|
||||
c.contract_type,
|
||||
(select fmn.notification_date from financial_movements_notify fmn where fmn.financial_movements_id = fm.financial_movements_id order by fmn.financial_movements_notify_id desc limit 0, 1) as notification_date,
|
||||
(select fmn.message from financial_movements_notify fmn where fmn.financial_movements_id = fm.financial_movements_id order by fmn.financial_movements_notify_id desc limit 0, 1) as message,
|
||||
cbc.companies_budgets_commissions_id,
|
||||
cbc.value,
|
||||
cbc.commission_date_paid,
|
||||
u.name_first,
|
||||
u.name_last
|
||||
from financial_movements fm
|
||||
left join companies c on fm.company_id = c.company_id
|
||||
left join companies_budgets_commissions cbc on fm.financial_movements_id = cbc.financial_movements_id
|
||||
left join users u on cbc.user_id = u.user_id
|
||||
where fm.movement_date_cancel is null ';
|
||||
$this->sql = 'SELECT
|
||||
fm.financial_movements_id,
|
||||
fm.financial_accounts_id,
|
||||
fm.financial_entries_id,
|
||||
fm.financial_outputs_id,
|
||||
fm.user_id,
|
||||
fm.company_id,
|
||||
fm.description,
|
||||
fm.movement_value,
|
||||
fm.movement_value_paid,
|
||||
fm.movement_value_fees,
|
||||
fm.movement_date,
|
||||
fm.movement_date_scheduled,
|
||||
fm.movement_date_paid,
|
||||
fm.reference AS movement_reference,
|
||||
fm.status,
|
||||
c.reference,
|
||||
c.cns,
|
||||
c.name_fantasy,
|
||||
c.contract_type,
|
||||
(
|
||||
SELECT fmn.notification_date
|
||||
FROM financial_movements_notify fmn
|
||||
WHERE fmn.financial_movements_id = fm.financial_movements_id
|
||||
ORDER BY fmn.financial_movements_notify_id DESC
|
||||
LIMIT 1
|
||||
) AS notification_date,
|
||||
(
|
||||
SELECT fmn.message
|
||||
FROM financial_movements_notify fmn
|
||||
WHERE fmn.financial_movements_id = fm.financial_movements_id
|
||||
ORDER BY fmn.financial_movements_notify_id DESC
|
||||
LIMIT 1
|
||||
) AS message,
|
||||
cbc.companies_budgets_commissions_id,
|
||||
cbc.value,
|
||||
cbc.commission_date_paid,
|
||||
u.name_first,
|
||||
u.name_last
|
||||
FROM financial_movements fm
|
||||
LEFT JOIN companies c
|
||||
ON fm.company_id = c.company_id
|
||||
LEFT JOIN companies_budgets_commissions cbc
|
||||
ON fm.financial_movements_id = cbc.financial_movements_id
|
||||
LEFT JOIN users u
|
||||
ON cbc.user_id = u.user_id
|
||||
WHERE fm.movement_date_cancel IS NULL ';
|
||||
|
||||
/** verifica se a consulta será pela data de pagamento */
|
||||
if($this->status == 2){
|
||||
|
|
@ -824,10 +840,15 @@ class FinancialMovements
|
|||
$this->dateEnd = $dateEnd;
|
||||
|
||||
/** Consulta SQL */
|
||||
$this->sql = 'select count(fm.financial_movements_id) as qtde
|
||||
from financial_movements fm
|
||||
left join companies c on fm.company_id = c.company_id
|
||||
where fm.movement_date_cancel is null';
|
||||
$this->sql = 'SELECT COUNT(DISTINCT fm.financial_movements_id) AS total
|
||||
FROM financial_movements fm
|
||||
LEFT JOIN companies c
|
||||
ON fm.company_id = c.company_id
|
||||
LEFT JOIN companies_budgets_commissions cbc
|
||||
ON fm.financial_movements_id = cbc.financial_movements_id
|
||||
LEFT JOIN users u
|
||||
ON cbc.user_id = u.user_id
|
||||
WHERE fm.movement_date_cancel IS NULL';
|
||||
|
||||
/** verifica se a consulta será pela data de pagamento */
|
||||
if($this->status == 2){
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue