test
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
ea6e234cde
commit
d3b5300553
|
@ -35,6 +35,15 @@
|
|||
"DmsContainer": {
|
||||
"dataSource": "dmsStorage"
|
||||
},
|
||||
"Dms": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"DmsType": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"EmailUser": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Image": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
|
@ -53,38 +62,32 @@
|
|||
"Province": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"TempContainer": {
|
||||
"dataSource": "tempStorage"
|
||||
},
|
||||
"UserConfig": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Warehouse": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"SageWithholding": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"UserConfigView": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"EmailUser": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Dms": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"DmsType": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Town": {
|
||||
"Payment": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Postcode": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"SageWithholding": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"TempContainer": {
|
||||
"dataSource": "tempStorage"
|
||||
},
|
||||
"Town": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"UserConfig": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"UserConfigView": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"UserLog": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Warehouse": {
|
||||
"dataSource": "vn"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
{
|
||||
"name": "Payment",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "payment"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"received": {
|
||||
"type": "date"
|
||||
},
|
||||
"amount": {
|
||||
"type": "number"
|
||||
},
|
||||
"divisa": {
|
||||
"type": "number"
|
||||
},
|
||||
"concept": {
|
||||
"type": "string"
|
||||
},
|
||||
"created": {
|
||||
"type": "date"
|
||||
},
|
||||
"isConciliated": {
|
||||
"type": "date"
|
||||
},
|
||||
"dueDated": {
|
||||
"type": "date"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"supplier": {
|
||||
"type": "belongsTo",
|
||||
"model": "Supplier",
|
||||
"foreignKey": "supplierFk"
|
||||
},
|
||||
"currency": {
|
||||
"type": "belongsTo",
|
||||
"model": "Currency",
|
||||
"foreignKey": "currencyFk"
|
||||
},
|
||||
"bank": {
|
||||
"type": "belongsTo",
|
||||
"model": "Bank",
|
||||
"foreignKey": "bankFk"
|
||||
},
|
||||
"payMethod": {
|
||||
"type": "belongsTo",
|
||||
"model": "PayMethodFk",
|
||||
"foreignKey": "payMethodFk"
|
||||
},
|
||||
"company": {
|
||||
"type": "belongsTo",
|
||||
"model": "Company",
|
||||
"foreignKey": "companyFk"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
DROP PROCEDURE IF EXISTS vn.ledger_doCompensation;
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`ledger_doCompensation`(vDated DATE, vCompensationAccount VARCHAR(10) , vBankFk VARCHAR(10), vConcept VARCHAR(255), vAmount DECIMAL(10,2), vCompanyFk INT, vOriginalAccount VARCHAR(10))
|
||||
BEGIN
|
||||
/**
|
||||
* Compensa un pago o un recibo insertando en contabilidad
|
||||
*
|
||||
* @param vDated fecha en la cual se anota
|
||||
* @param vCompensationAccount cuenta contable contra la que se compensa
|
||||
* @param vBankFk banco de la compensacion
|
||||
* @param vConcept descripcion
|
||||
* @param vAmount cantidad que se compensa
|
||||
* @param vCompany empresa
|
||||
* @param vOriginalAccount cuenta contable desde la cual se compensa
|
||||
*
|
||||
*/
|
||||
DECLARE vNewBookEntry INT;
|
||||
DECLARE vIsClientCompensation INT;
|
||||
DECLARE vClientFk INT;
|
||||
DECLARE vSupplierFk INT;
|
||||
DECLARE vIsOriginalAClient BOOL;
|
||||
DECLARE vPayMethodCompensation INT;
|
||||
|
||||
CALL ledger_next(vNewBookEntry);
|
||||
|
||||
SELECT COUNT(id) INTO vIsOriginalAClient FROM client WHERE accountingAccount LIKE vOriginalAccount COLLATE utf8_general_ci;
|
||||
|
||||
SELECT id, COUNT(id) INTO vClientFk, vIsClientCompensation
|
||||
FROM client
|
||||
WHERE accountingAccount LIKE vCompensationAccount COLLATE utf8_general_ci;
|
||||
|
||||
SET @vAmount1:= 0.0;
|
||||
SET @vAmount2:= 0.0;
|
||||
|
||||
INSERT INTO XDiario (ASIEN, FECHA, SUBCTA, CONTRA, CONCEPTO, EURODEBE, EUROHABER, empresa_id)
|
||||
VALUES ( vNewBookEntry,
|
||||
vDated,
|
||||
vOriginalAccount,
|
||||
vCompensationAccount,
|
||||
vConcept,
|
||||
@vAmount1:= IF(
|
||||
(vIsOriginalAClient OR NOT vIsOriginalAClient)
|
||||
AND vAmount > 0,
|
||||
0,
|
||||
ABS(vAmount)
|
||||
),
|
||||
@vAmount2:= IF(@vAmount1,
|
||||
0,
|
||||
ABS(vAmount)
|
||||
),
|
||||
vCompanyFk
|
||||
),
|
||||
( vNewBookEntry,
|
||||
vDated,
|
||||
vCompensationAccount,
|
||||
vOriginalAccount,
|
||||
vConcept,
|
||||
@vAmount2,
|
||||
@vAmount1,
|
||||
vCompanyFk);
|
||||
|
||||
IF vIsClientCompensation THEN
|
||||
IF vIsOriginalAClient THEN
|
||||
SET vAmount = -vAmount;
|
||||
END IF;
|
||||
INSERT INTO receipt(invoiceFk, amountPaid, payed, bankFk, companyFk, clientFk, isConciliate)
|
||||
VALUES (vConcept, vAmount, vDated, vBankFk, vCompanyFk, vClientFk, TRUE);
|
||||
ELSE
|
||||
IF NOT vIsOriginalAClient THEN
|
||||
SET vAmount = -vAmount;
|
||||
END IF;
|
||||
SELECT id INTO vSupplierFk FROM supplier WHERE `account` LIKE vCompensationAccount COLLATE utf8_general_ci;
|
||||
SELECT id INTO vPayMethodCompensation FROM payMethod WHERE `code` = 'compensation';
|
||||
|
||||
INSERT INTO payment (received, dueDated, supplierFk, amount, bankFk, payMethodFk, concept, companyFk, isConciliated)
|
||||
VALUES(vDated, vDated, vSupplierFk, vAmount, vBankFk, vPayMethodCompensation, vConcept, vCompanyFk, TRUE);
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -82,6 +82,7 @@ describe('Travel descriptor path', () => {
|
|||
await page.waitToClick('vn-icon[icon="preview"]'); // summary icon
|
||||
await page.waitForState('travel.card.summary');
|
||||
await page.waitToClick(selectors.travelDescriptor.dotMenu);
|
||||
|
||||
await page.waitToClick(selectors.travelDescriptor.dotMenuCloneWithEntries);
|
||||
await page.waitToClick(selectors.travelDescriptor.acceptClonation);
|
||||
await page.waitForState('travel.card.basicData');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
|
||||
fdescribe('Receipt createReceipt', () => {
|
||||
describe('Receipt createReceipt', () => {
|
||||
const clientFk = 108;
|
||||
const payed = Date();
|
||||
const companyFk = 442;
|
||||
|
@ -27,7 +27,6 @@ fdescribe('Receipt createReceipt', () => {
|
|||
where: {
|
||||
bankFk: bankFk,
|
||||
in: amountPaid,
|
||||
dated: payed,
|
||||
number: clientFk
|
||||
}
|
||||
});
|
||||
|
@ -79,9 +78,7 @@ fdescribe('Receipt createReceipt', () => {
|
|||
const receipt = await app.models.Receipt.createReceipt(ctx);
|
||||
const receiptCompensated = await app.models.Receipt.findOne({
|
||||
where: {
|
||||
clientFk: ctx.args.clientFk,
|
||||
payed: ctx.args.payed,
|
||||
amountPaid: ctx.args.amountPaid,
|
||||
clientFk: 1,
|
||||
bankFk: ctx.args.bankFk
|
||||
}
|
||||
});
|
||||
|
@ -90,14 +87,16 @@ fdescribe('Receipt createReceipt', () => {
|
|||
where: {
|
||||
bankFk: bankFk,
|
||||
in: amountPaid,
|
||||
dated: payed,
|
||||
number: clientFk
|
||||
}
|
||||
});
|
||||
|
||||
delete ctx.args.payed;
|
||||
|
||||
expect(receipt).toEqual(jasmine.objectContaining(ctx.args));
|
||||
expect(receipt.amountPaid).toEqual(-receiptCompensated.amountPaid);
|
||||
|
||||
console.log(till);
|
||||
// restores
|
||||
await receipt.destroy();
|
||||
await receiptCompensated.destroy();
|
||||
|
@ -117,23 +116,33 @@ fdescribe('Receipt createReceipt', () => {
|
|||
}
|
||||
};
|
||||
const receipt = await app.models.Receipt.createReceipt(ctx);
|
||||
/* esperar a que payment este en vn
|
||||
const receiptCompensated = await app.models.Payment.findOne({
|
||||
|
||||
const paymentCompensated = await app.models.Payment.findOne({
|
||||
where: {
|
||||
clientFk: ctx.args.sale,
|
||||
payed: ctx.args.payed,
|
||||
amountPaid: ctx.args.amountPaid,
|
||||
bankFk: ctx.args.bankFk
|
||||
}
|
||||
});*/
|
||||
});
|
||||
|
||||
const till = await app.models.Till.findOne({
|
||||
where: {
|
||||
bankFk: ctx.args.bankFk,
|
||||
in: amountPaid,
|
||||
number: clientFk
|
||||
}
|
||||
});
|
||||
|
||||
delete ctx.args.payed;
|
||||
|
||||
expect(receipt).toEqual(jasmine.objectContaining(ctx.args));
|
||||
// expect(receiptCompensated.amountPaid).toEqual(receiptCompensated.amountPaid);
|
||||
|
||||
expect(paymentCompensated.amountPaid).toEqual(paymentCompensated.amountPaid);
|
||||
|
||||
// restores
|
||||
await receipt.destroy();
|
||||
// destroy payment
|
||||
// destroy till
|
||||
// destroy XDiario
|
||||
await paymentCompensated.destroy();
|
||||
await till.destroy();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -46,13 +46,13 @@
|
|||
"relations": {
|
||||
"bank": {
|
||||
"type": "belongsTo",
|
||||
"model": "BankEntity",
|
||||
"foreignKey": "bankEntityFk"
|
||||
"model": "Bank",
|
||||
"foreignKey": "bankFk"
|
||||
},
|
||||
"salesPersonUser": {
|
||||
"worker": {
|
||||
"type": "belongsTo",
|
||||
"model": "Account",
|
||||
"foreignKey": "salesPersonFk"
|
||||
"foreignKey": "workerFk"
|
||||
},
|
||||
"company": {
|
||||
"type": "belongsTo",
|
||||
|
|
Loading…
Reference in New Issue