2024-01-15 11:31:03 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|
|
|
SQL SECURITY DEFINER
|
|
|
|
VIEW `vn`.`exchangeInsuranceOut`
|
|
|
|
AS SELECT `p`.`received` AS `received`,
|
|
|
|
sum(`p`.`divisa`) AS `divisa`,
|
|
|
|
sum(`p`.`divisa`) / sum(`p`.`amount`) AS `rate`
|
|
|
|
FROM (
|
|
|
|
(
|
|
|
|
`vn`.`payment` `p`
|
2024-03-14 07:36:19 +00:00
|
|
|
JOIN `vn`.`accounting` `a` ON(`a`.`id` = `p`.`bankFk`)
|
2024-01-15 11:31:03 +00:00
|
|
|
)
|
2024-03-14 07:36:19 +00:00
|
|
|
JOIN `vn`.`accountingType` `at2` ON(`at2`.`id` = `a`.`accountingTypeFk`)
|
2024-01-15 11:31:03 +00:00
|
|
|
)
|
|
|
|
WHERE `p`.`currencyFk` = 2
|
|
|
|
AND `at2`.`code` = 'wireTransfer'
|
|
|
|
AND `p`.`supplierFk` <> 2213
|
|
|
|
GROUP BY `p`.`received`
|