This commit is contained in:
parent
05380df4f8
commit
e0732835d0
|
@ -13,7 +13,7 @@
|
||||||
"AuthCode": {
|
"AuthCode": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"Bank": {
|
"Accounting": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"Buyer": {
|
"Buyer": {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
"name": "Bank",
|
"name": "Accounting",
|
||||||
"base": "VnModel",
|
"base": "VnModel",
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "bank"
|
"table": "accounting"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
|
@ -22,10 +22,7 @@
|
||||||
},
|
},
|
||||||
"accountingTypeFk": {
|
"accountingTypeFk": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"required": true,
|
"required": true
|
||||||
"mysql": {
|
|
||||||
"columnName": "cash"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"entityFk": {
|
"entityFk": {
|
||||||
"type": "number",
|
"type": "number",
|
|
@ -47,7 +47,7 @@
|
||||||
},
|
},
|
||||||
"bank": {
|
"bank": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Bank",
|
"model": "Accounting",
|
||||||
"foreignKey": "bankFk"
|
"foreignKey": "bankFk"
|
||||||
},
|
},
|
||||||
"payMethod": {
|
"payMethod": {
|
||||||
|
|
|
@ -22,7 +22,7 @@ BEGIN
|
||||||
FROM vn.component WHERE code = 'manaClaim';
|
FROM vn.component WHERE code = 'manaClaim';
|
||||||
|
|
||||||
SELECT id INTO vManaBankId
|
SELECT id INTO vManaBankId
|
||||||
FROM vn.bank WHERE code = 'mana';
|
FROM vn.accounting WHERE code = 'mana';
|
||||||
|
|
||||||
SELECT id INTO vManaGreugeTypeId
|
SELECT id INTO vManaGreugeTypeId
|
||||||
FROM vn.greugeType WHERE code = 'mana';
|
FROM vn.greugeType WHERE code = 'mana';
|
||||||
|
|
|
@ -54,7 +54,7 @@ p: BEGIN
|
||||||
FROM vn.`client` WHERE id = vCustomer;
|
FROM vn.`client` WHERE id = vCustomer;
|
||||||
|
|
||||||
SELECT account INTO vAccount
|
SELECT account INTO vAccount
|
||||||
FROM vn.bank WHERE id = vBank;
|
FROM vn.accounting WHERE id = vBank;
|
||||||
|
|
||||||
DELETE FROM vn.XDiario
|
DELETE FROM vn.XDiario
|
||||||
WHERE SUBCTA = vSubaccount
|
WHERE SUBCTA = vSubaccount
|
||||||
|
|
|
@ -254,8 +254,8 @@ BEGIN
|
||||||
) sub GROUP BY ASIEN
|
) sub GROUP BY ASIEN
|
||||||
)sub2 ON sub2.ASIEN = x.ASIEN
|
)sub2 ON sub2.ASIEN = x.ASIEN
|
||||||
LEFT JOIN ( SELECT DISTINCT(account),cu.code
|
LEFT JOIN ( SELECT DISTINCT(account),cu.code
|
||||||
FROM vn.bank b
|
FROM vn.accounting a
|
||||||
JOIN vn.currency cu ON cu.id = b.currencyFk
|
JOIN vn.currency cu ON cu.id = a.currencyFk
|
||||||
WHERE cu.code <> 'EUR' -- no se informa cuando la divisa en EUR
|
WHERE cu.code <> 'EUR' -- no se informa cuando la divisa en EUR
|
||||||
)sub3 ON sub3.account = x.SUBCTA
|
)sub3 ON sub3.account = x.SUBCTA
|
||||||
WHERE x.enlazadoSage = FALSE
|
WHERE x.enlazadoSage = FALSE
|
||||||
|
|
|
@ -17,15 +17,15 @@ BEGIN
|
||||||
e.id accountFk,
|
e.id accountFk,
|
||||||
UCASE(e.name),
|
UCASE(e.name),
|
||||||
''
|
''
|
||||||
FROM vn.expense e
|
FROM expense e
|
||||||
UNION
|
UNION
|
||||||
SELECT company_getCode(vCompanyFk),
|
SELECT company_getCode(vCompanyFk),
|
||||||
b.account,
|
a.account,
|
||||||
UCASE(b.bank),
|
UCASE(a.bank),
|
||||||
''
|
''
|
||||||
FROM vn.bank b
|
FROM accounting a
|
||||||
WHERE b.isActive
|
WHERE a.isActive
|
||||||
AND b.`account`
|
AND a.`account`
|
||||||
UNION
|
UNION
|
||||||
SELECT CodigoEmpresa,
|
SELECT CodigoEmpresa,
|
||||||
CodigoCuenta,
|
CodigoCuenta,
|
||||||
|
|
|
@ -34,7 +34,7 @@ BEGIN
|
||||||
-- Inserta los asientos contables
|
-- Inserta los asientos contables
|
||||||
|
|
||||||
SELECT account INTO vAccount
|
SELECT account INTO vAccount
|
||||||
FROM bank WHERE id = vBank;
|
FROM accounting WHERE id = vBank;
|
||||||
|
|
||||||
SELECT accountingAccount INTO vSubaccount
|
SELECT accountingAccount INTO vSubaccount
|
||||||
FROM `client` WHERE id = vClient;
|
FROM `client` WHERE id = vClient;
|
||||||
|
|
|
@ -10,13 +10,11 @@ BEGIN
|
||||||
INSERT INTO mail (receiver,replyTo,subject,body)
|
INSERT INTO mail (receiver,replyTo,subject,body)
|
||||||
SELECT 'administracion@verdnatura.es' receiver,
|
SELECT 'administracion@verdnatura.es' receiver,
|
||||||
'noreply@verdnatura.es' replyTo,
|
'noreply@verdnatura.es' replyTo,
|
||||||
CONCAT('El seguro de la poliza ',b.id,' ',b.bank,' ha finalizado.') subject,
|
CONCAT('El seguro de la poliza ',a.id,' ',a.bank,' ha finalizado.') subject,
|
||||||
CONCAT('El seguro de la poliza ',b.id,' ',b.bank,' ha finalizado.') body
|
CONCAT('El seguro de la poliza ',a.id,' ',a.bank,' ha finalizado.') body
|
||||||
FROM vn.bankPolicy bp
|
FROM bankPolicy bp
|
||||||
LEFT JOIN vn.supplier s
|
LEFT JOIN supplier s ON s.id = bp.supplierFk
|
||||||
ON s.id = bp.supplierFk
|
LEFT JOIN accounting a ON a.id = bp.accountingFk
|
||||||
LEFT JOIN vn.bank b
|
|
||||||
ON b.id = bp.accountingFk
|
|
||||||
WHERE bp.insuranceExpired = util.VN_CURDATE();
|
WHERE bp.insuranceExpired = util.VN_CURDATE();
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -39,7 +39,8 @@ BEGIN
|
||||||
FROM receipt r
|
FROM receipt r
|
||||||
JOIN `client` c ON c.id = r.clientFk
|
JOIN `client` c ON c.id = r.clientFk
|
||||||
JOIN tmp.client tc ON tc.id = c.id
|
JOIN tmp.client tc ON tc.id = c.id
|
||||||
JOIN bank b ON r.bankFk = b.id AND b.code = 'mana'
|
JOIN accounting a ON r.bankFk = a.id
|
||||||
|
AND a.code = 'mana'
|
||||||
WHERE r.payed > vFromDated
|
WHERE r.payed > vFromDated
|
||||||
AND r.payed <= util.VN_CURDATE()
|
AND r.payed <= util.VN_CURDATE()
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
|
|
@ -94,7 +94,7 @@ BEGIN
|
||||||
'payment'
|
'payment'
|
||||||
FROM payment p
|
FROM payment p
|
||||||
LEFT JOIN currency c ON c.id = p.currencyFk
|
LEFT JOIN currency c ON c.id = p.currencyFk
|
||||||
LEFT JOIN bank b ON b.id = p.bankFk
|
LEFT JOIN accounting a ON a.id = p.bankFk
|
||||||
LEFT JOIN payMethod pm ON pm.id = p.payMethodFk
|
LEFT JOIN payMethod pm ON pm.id = p.payMethodFk
|
||||||
LEFT JOIN promissoryNote pn ON pn.paymentFk = p.id
|
LEFT JOIN promissoryNote pn ON pn.paymentFk = p.id
|
||||||
WHERE p.received > '2014-12-31'
|
WHERE p.received > '2014-12-31'
|
||||||
|
|
|
@ -10,21 +10,21 @@ BEGIN
|
||||||
|
|
||||||
-- PAK 10/02/15 No se asientan los pagos directamente, salvo en el caso de las cajas de CASH
|
-- PAK 10/02/15 No se asientan los pagos directamente, salvo en el caso de las cajas de CASH
|
||||||
SELECT (at2.code = 'cash') INTO bolCASH
|
SELECT (at2.code = 'cash') INTO bolCASH
|
||||||
FROM vn.bank b
|
FROM accounting a
|
||||||
JOIN vn.accountingType at2 ON at2.id = b.cash
|
JOIN accountingType at2 ON at2.id = a.accountingTypeFk
|
||||||
WHERE b.id = NEW.bankFk;
|
WHERE a.id = NEW.bankFk;
|
||||||
|
|
||||||
IF bolCASH THEN
|
IF bolCASH THEN
|
||||||
|
|
||||||
SELECT account INTO cuenta_banco
|
SELECT account INTO cuenta_banco
|
||||||
FROM bank
|
FROM accounting
|
||||||
WHERE id = NEW.bankFk;
|
WHERE id = NEW.bankFk;
|
||||||
|
|
||||||
SELECT account INTO cuenta_proveedor
|
SELECT account INTO cuenta_proveedor
|
||||||
FROM supplier
|
FROM supplier
|
||||||
WHERE id = NEW.supplierFk;
|
WHERE id = NEW.supplierFk;
|
||||||
|
|
||||||
CALL vn.ledger_next(vNewBookEntry);
|
CALL ledger_next(vNewBookEntry);
|
||||||
|
|
||||||
INSERT INTO XDiario ( ASIEN,
|
INSERT INTO XDiario ( ASIEN,
|
||||||
FECHA,
|
FECHA,
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|
||||||
SQL SECURITY DEFINER
|
|
||||||
VIEW `vn`.`bank`
|
|
||||||
AS SELECT `a`.`id` AS `id`,
|
|
||||||
`a`.`bank` AS `bank`,
|
|
||||||
`a`.`account` AS `account`,
|
|
||||||
`a`.`accountingTypeFk` AS `cash`,
|
|
||||||
`a`.`entityFk` AS `entityFk`,
|
|
||||||
`a`.`isActive` AS `isActive`,
|
|
||||||
`a`.`currencyFk` AS `currencyFk`,
|
|
||||||
`a`.`code` AS `code`
|
|
||||||
FROM `vn`.`accounting` `a`
|
|
|
@ -7,9 +7,9 @@ AS SELECT `p`.`received` AS `received`,
|
||||||
FROM (
|
FROM (
|
||||||
(
|
(
|
||||||
`vn`.`payment` `p`
|
`vn`.`payment` `p`
|
||||||
JOIN `vn`.`bank` `b` ON(`b`.`id` = `p`.`bankFk`)
|
JOIN `vn`.`accounting` `a` ON(`a`.`id` = `p`.`bankFk`)
|
||||||
)
|
)
|
||||||
JOIN `vn`.`accountingType` `at2` ON(`at2`.`id` = `b`.`cash`)
|
JOIN `vn`.`accountingType` `at2` ON(`at2`.`id` = `a`.`accountingTypeFk`)
|
||||||
)
|
)
|
||||||
WHERE `p`.`currencyFk` = 2
|
WHERE `p`.`currencyFk` = 2
|
||||||
AND `at2`.`code` = 'wireTransfer'
|
AND `at2`.`code` = 'wireTransfer'
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||||
SQL SECURITY DEFINER
|
SQL SECURITY DEFINER
|
||||||
VIEW `vn2008`.`Bancos`
|
VIEW `vn2008`.`Bancos`
|
||||||
AS SELECT `b`.`id` AS `Id_Banco`,
|
AS SELECT `a`.`id` AS `Id_Banco`,
|
||||||
`b`.`bank` AS `Banco`,
|
`a`.`bank` AS `Banco`,
|
||||||
`b`.`account` AS `Cuenta`,
|
`a`.`account` AS `Cuenta`,
|
||||||
`b`.`cash` AS `cash`,
|
`a`.`accountingTypeFk` AS `cash`,
|
||||||
`b`.`entityFk` AS `entity_id`,
|
`a`.`entityFk` AS `entity_id`,
|
||||||
`b`.`isActive` AS `activo`,
|
`a`.`isActive` AS `activo`,
|
||||||
`b`.`currencyFk` AS `currencyFk`
|
`a`.`currencyFk` AS `currencyFk`
|
||||||
FROM `vn`.`bank` `b`
|
FROM `vn`.`accounting` `a`
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
REVOKE SELECT ON TABLE vn.bank FROM administrative, hr;
|
||||||
|
GRANT SELECT ON TABLE vn.accounting TO administrative, hr;
|
|
@ -69,7 +69,7 @@ module.exports = function(Self) {
|
||||||
delete args.ctx; // Remove unwanted properties
|
delete args.ctx; // Remove unwanted properties
|
||||||
|
|
||||||
const originalClient = await models.Client.findById(args.clientFk, null, myOptions);
|
const originalClient = await models.Client.findById(args.clientFk, null, myOptions);
|
||||||
const bank = await models.Bank.findById(args.bankFk, null, myOptions);
|
const bank = await models.Accounting.findById(args.bankFk, null, myOptions);
|
||||||
const accountingType = await models.AccountingType.findById(bank.accountingTypeFk, null, myOptions);
|
const accountingType = await models.AccountingType.findById(bank.accountingTypeFk, null, myOptions);
|
||||||
|
|
||||||
if (accountingType.code == 'compensation') {
|
if (accountingType.code == 'compensation') {
|
||||||
|
|
|
@ -28,7 +28,7 @@ module.exports = Self => {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const receipt = await models.Receipt.findById(id, {fields: ['clientFk', 'bankFk']});
|
const receipt = await models.Receipt.findById(id, {fields: ['clientFk', 'bankFk']});
|
||||||
|
|
||||||
const bank = await models.Bank.findById(receipt.bankFk);
|
const bank = await models.Accounting.findById(receipt.bankFk);
|
||||||
if (!bank)
|
if (!bank)
|
||||||
throw new UserError(`Receipt's bank was not found`);
|
throw new UserError(`Receipt's bank was not found`);
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
},
|
},
|
||||||
"bank": {
|
"bank": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Bank",
|
"model": "Accounting",
|
||||||
"foreignKey": "bankFk"
|
"foreignKey": "bankFk"
|
||||||
},
|
},
|
||||||
"supplier": {
|
"supplier": {
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
"relations": {
|
"relations": {
|
||||||
"bank": {
|
"bank": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Bank",
|
"model": "Accounting",
|
||||||
"foreignKey": "bankFk"
|
"foreignKey": "bankFk"
|
||||||
},
|
},
|
||||||
"worker": {
|
"worker": {
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
"relations": {
|
"relations": {
|
||||||
"bank": {
|
"bank": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Bank",
|
"model": "Accounting",
|
||||||
"foreignKey": "bankFk"
|
"foreignKey": "bankFk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue