xdiario test ok
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
36bace2a94
commit
0c7ddd863d
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
|
@ -58,9 +58,11 @@ module.exports = function(Self) {
|
||||||
|
|
||||||
delete args.ctx; // Remove unwanted properties
|
delete args.ctx; // Remove unwanted properties
|
||||||
const newReceipt = await models.Receipt.create(args, options);
|
const newReceipt = await models.Receipt.create(args, options);
|
||||||
|
const clientOriginal = await models.Client.findById(args.clientFk);
|
||||||
|
const bank = await models.Bank.findById(args.bankFk);
|
||||||
|
const accountingType = await models.AccountingType.findById(bank.accountingTypeFk);
|
||||||
|
|
||||||
if (args.compensationAccount) {
|
if (args.compensationAccount) {
|
||||||
const clientOriginal = await models.Client.findById(args.clientFk);
|
|
||||||
const supplierCompensation = await models.Supplier.findOne({
|
const supplierCompensation = await models.Supplier.findOne({
|
||||||
where: {
|
where: {
|
||||||
account: args.compensationAccount
|
account: args.compensationAccount
|
||||||
|
@ -77,12 +79,6 @@ module.exports = function(Self) {
|
||||||
if (!supplierCompensation && !clientCompensation)
|
if (!supplierCompensation && !clientCompensation)
|
||||||
throw new UserError('Invalid account');
|
throw new UserError('Invalid account');
|
||||||
|
|
||||||
const accountingType = await models.AccountingType.findOne({
|
|
||||||
where: {
|
|
||||||
code: 'compensation'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
await Self.rawSql(
|
await Self.rawSql(
|
||||||
`CALL vn.ledger_doCompensation(?, ?, ?, ?, ?, ?, ?)`,
|
`CALL vn.ledger_doCompensation(?, ?, ?, ?, ?, ?, ?)`,
|
||||||
[
|
[
|
||||||
|
@ -96,15 +92,14 @@ module.exports = function(Self) {
|
||||||
],
|
],
|
||||||
options);
|
options);
|
||||||
} else {
|
} else {
|
||||||
const bank = await models.Bank.findById(args.bankFk);
|
const [xdiarioNew] = await Self.rawSql(
|
||||||
const ledger = await Self.rawSql(
|
`SELECT xdiario_new(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ledger;`,
|
||||||
`SELECT xdiario_new(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);`,
|
|
||||||
[
|
[
|
||||||
null,
|
null,
|
||||||
Date(),
|
Date(),
|
||||||
bank.account,
|
bank.account,
|
||||||
clientOriginal.accountingAccount,
|
clientOriginal.accountingAccount,
|
||||||
clientOriginal.id + ':' + clientOriginal.nickname, '-', accountingType.receiptDescription,
|
clientOriginal.id + ':' + clientOriginal.nickname + '-' + accountingType.receiptDescription,
|
||||||
args.amountPaid,
|
args.amountPaid,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
@ -120,11 +115,11 @@ module.exports = function(Self) {
|
||||||
await Self.rawSql(
|
await Self.rawSql(
|
||||||
`SELECT xdiario_new(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);`,
|
`SELECT xdiario_new(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);`,
|
||||||
[
|
[
|
||||||
ledger,
|
xdiarioNew.ledger,
|
||||||
Date(),
|
Date(),
|
||||||
clientOriginal.accountingAccount,
|
clientOriginal.accountingAccount,
|
||||||
bank.account,
|
bank.account,
|
||||||
clientOriginal.id + ':' + clientOriginal.nickname, '-', accountingType.receiptDescription,
|
clientOriginal.id + ':' + clientOriginal.nickname + '-' + accountingType.receiptDescription,
|
||||||
0,
|
0,
|
||||||
args.amountPaid,
|
args.amountPaid,
|
||||||
0,
|
0,
|
||||||
|
|
Loading…
Reference in New Issue