2517-clientBalanceCompensaciones #506

Merged
carlosjr merged 49 commits from 2517-clientBalanceCompensaciones into dev 2021-02-01 11:13:57 +00:00
34 changed files with 923 additions and 169 deletions

View File

@ -35,6 +35,15 @@
"DmsContainer": { "DmsContainer": {
"dataSource": "dmsStorage" "dataSource": "dmsStorage"
}, },
"Dms": {
"dataSource": "vn"
},
"DmsType": {
"dataSource": "vn"
},
"EmailUser": {
"dataSource": "vn"
},
"Image": { "Image": {
"dataSource": "vn" "dataSource": "vn"
}, },
@ -53,38 +62,32 @@
"Province": { "Province": {
"dataSource": "vn" "dataSource": "vn"
}, },
"TempContainer": { "Payment": {
"dataSource": "tempStorage"
},
"UserConfig": {
"dataSource": "vn"
},
"Warehouse": {
"dataSource": "vn"
},
"SageWithholding": {
"dataSource": "vn"
},
"UserConfigView": {
"dataSource": "vn"
},
"EmailUser": {
"dataSource": "vn"
},
"Dms": {
"dataSource": "vn"
},
"DmsType": {
"dataSource": "vn"
},
"Town": {
"dataSource": "vn" "dataSource": "vn"
}, },
"Postcode": { "Postcode": {
"dataSource": "vn" "dataSource": "vn"
}, },
"SageWithholding": {
"dataSource": "vn"
},
"TempContainer": {
"dataSource": "tempStorage"
},
"Town": {
"dataSource": "vn"
},
"UserConfig": {
"dataSource": "vn"
},
"UserConfigView": {
"dataSource": "vn"
},
"UserLog": { "UserLog": {
"dataSource": "vn" "dataSource": "vn"
},
"Warehouse": {
"dataSource": "vn"
} }
} }

View File

@ -8,17 +8,20 @@
}, },
"properties": { "properties": {
"id": { "id": {
"type": "Number", "type": "number",
"id": true, "id": true,
"description": "Identifier" "description": "Identifier"
}, },
"description": { "description": {
"type": "String", "type": "string",
"required": true "required": true
}, },
"receiptDescription": { "receiptDescription": {
"type": "String", "type": "string",
"required": true "required": true
},
"code": {
"type": "string"
} }
}, },
"acls": [{ "acls": [{

View File

@ -18,6 +18,9 @@
}, },
"expired": { "expired": {
"type": "date" "type": "date"
},
"isOfficial": {
"type": "boolean"
} }
}, },

64
back/models/payment.json Normal file
View File

@ -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": "boolean"
},
"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"
}
}
}

View File

@ -1,2 +1 @@
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) VALUES ('Image', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'); INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) VALUES ('Image', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee');
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('PayDem', '*', 'READ', 'ALLOW', 'ROLE', 'employee');

View File

@ -1,3 +1,5 @@
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('FixedPrice', '*', '*', 'ALLOW', 'ROLE', 'buyer');
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('PayDem', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Client', 'createReceipt', '*', 'ALLOW', 'ROLE', 'administrative');
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
VALUES ('PrintServerQueue', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'); VALUES ('PrintServerQueue', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee');
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('FixedPrice', '*', '*', 'ALLOW', 'ROLE', 'buyer');

View File

@ -0,0 +1,82 @@
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 ;

View File

@ -0,0 +1,17 @@
DROP TRIGGER IF EXISTS vn.receipt_beforInsert;
DELIMITER $$
$$
CREATE TRIGGER receipt_beforInsert
BEFORE INSERT
ON receipt FOR EACH ROW
BEGIN
SELECT isAutoConciliated INTO @isAutoConciliated
FROM accounting a
JOIN accountingType at2 ON at2.id = a.accountingTypeFk
WHERE a.id =NEW.bankFk;
SET NEW.isConciliate = @isAutoConciliated;
END
$$
DELIMITER ;

View File

@ -151,20 +151,19 @@ INSERT INTO `vn`.`shelving` (`code`, `parkingFk`, `isPrinted`, `priority`, `park
INSERT INTO `vn`.`accountingType`(`id`, `description`, `receiptDescription`,`code`) INSERT INTO `vn`.`accountingType`(`id`, `description`, `receiptDescription`,`code`)
VALUES VALUES
(1, 'CC y Polizas de crédito', NULL, NULL), (1, 'CC y Polizas de crédito', NULL, NULL),
(2, 'Caja registradora', NULL, NULL), (2, 'Cash', NULL, 'cash'),
(3, 'Tarjeta de credito', NULL, NULL), (3, 'Credit card', NULL, 'creditCard'),
(4, 'Lineas de financiacion', NULL, NULL), (4, 'Finalcial lines', NULL, NULL),
(5, 'Otros productos', NULL, NULL), (5, 'Other products', NULL, NULL),
(6, 'Prestamos', NULL, NULL), (6, 'Loans', NULL, NULL),
(7, 'Leasing', NULL, NULL), (7, 'Leasing', NULL, NULL),
(8, 'Compensaciones', NULL, NULL), (8, 'Compensations', 'Compensations', 'Compensations');
(9, 'Cash', 'Cash', NULL),
(10, 'Card', 'Pay on receipt', NULL);
INSERT INTO `vn`.`bank`(`id`, `bank`, `account`, `cash`, `entityFk`, `isActive`, `currencyFk`) INSERT INTO `vn`.`bank`(`id`, `bank`, `account`, `cash`, `entityFk`, `isActive`, `currencyFk`)
VALUES VALUES
(1, 'Pay on receipt', '0000000000', 10, 0, 1, 1), (1, 'Pay on receipt', '0000000000', 3, 0, 1, 1),
(2, 'Cash', '1111111111', 9, 0, 1, 1); (2, 'Cash', '1111111111', 2, 0, 1, 1),
(3, 'Compensation', '0000000000', 8, 0, 1, 1);
INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`) INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`)
VALUES VALUES
@ -212,13 +211,13 @@ UPDATE `vn`.`agencyMode` SET `web` = 1;
UPDATE `vn`.`agencyMode` SET `code` = 'refund' WHERE `id` = 23; UPDATE `vn`.`agencyMode` SET `code` = 'refund' WHERE `id` = 23;
INSERT INTO `vn`.`payMethod`(`id`, `name`, `graceDays`, `outstandingDebt`, `ibanRequired`) INSERT INTO `vn`.`payMethod`(`id`,`code`, `name`, `graceDays`, `outstandingDebt`, `ibanRequired`)
VALUES VALUES
(1, 'PayMethod one', 0, 001, 0), (1, NULL, 'PayMethod one', 0, 001, 0),
(2, 'PayMethod two', 10, 001, 0), (2, NULL, 'PayMethod two', 10, 001, 0),
(3, 'PayMethod three', 0, 001, 0), (3, 'compensation', 'PayMethod three', 0, 001, 0),
(4, 'PayMethod with IBAN', 0, 001, 1), (4, NULL, 'PayMethod with IBAN', 0, 001, 1),
(5, 'PayMethod five', 10, 001, 0); (5, NULL, 'PayMethod five', 10, 001, 0);
INSERT INTO `vn`.`payDem`(`id`, `payDem`) INSERT INTO `vn`.`payDem`(`id`, `payDem`)
VALUES VALUES
@ -271,17 +270,17 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`)
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`fax`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`,`mailAddress`,`cplusTerIdNifFk`,`hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`) INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`fax`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`,`mailAddress`,`cplusTerIdNifFk`,`hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`)
VALUES VALUES
(101, 'Bruce Wayne', '84612325V', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1), (101, 'Bruce Wayne', '84612325V', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
(102, 'Petter Parker', '87945234L', 'Spider man', 'Aunt May', '20 Ingram Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1), (102, 'Petter Parker', '87945234L', 'Spider man', 'Aunt May', '20 Ingram Street, Queens, USA', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
(103, 'Clark Kent', '06815934E', 'Super man', 'lois lane', '344 Clinton Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 0, 19, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1), (103, 'Clark Kent', '06815934E', 'Super man', 'lois lane', '344 Clinton Street, Apartament 3-D', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 0, 19, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
(104, 'Tony Stark', '06089160W', 'Iron man', 'Pepper Potts', '10880 Malibu Point', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1), (104, 'Tony Stark', '06089160W', 'Iron man', 'Pepper Potts', '10880 Malibu Point, 90265', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
(105, 'Max Eisenhardt', '251628698', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 8, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1), (105, 'Max Eisenhardt', '251628698', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 8, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1),
(106, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'Evil hideout', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1), (106, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'City of New York, New York, USA', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1),
(107, 'Hank Pym', '09854837G', 'Ant man', 'Hawk', 'Anthill', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1), (107, 'Hank Pym', '09854837G', 'Ant man', 'Hawk', 'Anthill, San Francisco, California', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1),
(108, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1), (108, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1),
(109, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1), (109, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1),
(110, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1), (110, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1),
(111, 'Missing', NULL, 'Missing man', 'Anton', 'The space', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, NULL, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1), (111, 'Missing', NULL, 'Missing man', 'Anton', 'The space, Universe far away', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, NULL, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1),
(112, 'Trash', NULL, 'Garbage man', 'Unknown name', 'New York city', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, NULL, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1); (112, 'Trash', NULL, 'Garbage man', 'Unknown name', 'New York city, Underground', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, NULL, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1);
INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `gestdocFk`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`) INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `gestdocFk`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`)
SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), CONCAT(name, 'Social'), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'SILLA', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, CURDATE(), 1 SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), CONCAT(name, 'Social'), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'SILLA', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, CURDATE(), 1

View File

@ -186,8 +186,11 @@ export default {
clientBalance: { clientBalance: {
company: 'vn-client-balance-index vn-autocomplete[ng-model="$ctrl.companyId"]', company: 'vn-client-balance-index vn-autocomplete[ng-model="$ctrl.companyId"]',
newPaymentButton: `vn-float-button`, newPaymentButton: `vn-float-button`,
newPaymentBank: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.receipt.bankFk"]', newPaymentBank: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.bankFk"]',
newPaymentAmount: '.vn-dialog.shown vn-input-number[ng-model="$ctrl.receipt.amountPaid"]', newPaymentAmount: '.vn-dialog.shown vn-input-number[ng-model="$ctrl.amountPaid"]',
newDescription: 'vn-textfield[ng-model="$ctrl.receipt.description"]',
deliveredAmount: '.vn-dialog vn-input-number[ng-model="$ctrl.deliveredAmount"]',
refundAmount: '.vn-dialog vn-input-number[ng-model="$ctrl.amountToReturn"]',
saveButton: '.vn-dialog.shown [response="accept"]', saveButton: '.vn-dialog.shown [response="accept"]',
firstLineBalance: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)', firstLineBalance: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)',
firstLineReference: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td-editable', firstLineReference: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td-editable',
@ -400,7 +403,8 @@ export default {
sixthTicketCheckbox: 'vn-ticket-index vn-tbody > a:nth-child(6) > vn-td:nth-child(1) > vn-check', sixthTicketCheckbox: 'vn-ticket-index vn-tbody > a:nth-child(6) > vn-td:nth-child(1) > vn-check',
payoutButton: 'vn-ticket-index vn-button[icon="icon-recovery"]', payoutButton: 'vn-ticket-index vn-button[icon="icon-recovery"]',
payoutCompany: '.vn-dialog vn-autocomplete[ng-model="$ctrl.receipt.companyFk"]', payoutCompany: '.vn-dialog vn-autocomplete[ng-model="$ctrl.receipt.companyFk"]',
payoutBank: '.vn-dialog vn-autocomplete[ng-model="$ctrl.receipt.bankFk"]', payoutBank: '.vn-dialog vn-autocomplete[ng-model="$ctrl.bankFk"]',
payoutDescription: 'vn-textfield[ng-model="$ctrl.receipt.description"]',
submitPayout: '.vn-dialog button[response="accept"]', submitPayout: '.vn-dialog button[response="accept"]',
searchWeeklyResult: 'vn-ticket-weekly-index vn-table vn-tbody > vn-tr', searchWeeklyResult: 'vn-ticket-weekly-index vn-table vn-tbody > vn-tr',
searchResultDate: 'vn-ticket-summary [label=Landed] span', searchResultDate: 'vn-ticket-summary [label=Landed] span',

View File

@ -38,7 +38,7 @@ describe('Client balance path', () => {
expect(message.text).toContain('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should click the new payment button', async() => { it('should reload the section', async() => {
await page.closePopup(); await page.closePopup();
await page.reloadSection('client.card.balance.index'); await page.reloadSection('client.card.balance.index');
}); });
@ -46,7 +46,8 @@ describe('Client balance path', () => {
it('should create a new payment that clears the debt', async() => { it('should create a new payment that clears the debt', async() => {
await page.closePopup(); await page.closePopup();
await page.waitToClick(selectors.clientBalance.newPaymentButton); await page.waitToClick(selectors.clientBalance.newPaymentButton);
await page.autocompleteSearch(selectors.clientBalance.newPaymentBank, 'Pay on receipt'); await page.autocompleteSearch(selectors.clientBalance.newPaymentBank, 'Cash');
await page.write(selectors.clientBalance.newDescription, 'Description');
await page.waitToClick(selectors.clientBalance.saveButton); await page.waitToClick(selectors.clientBalance.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
@ -78,16 +79,24 @@ describe('Client balance path', () => {
expect(firstBalanceLine).toContain('0.00'); expect(firstBalanceLine).toContain('0.00');
}); });
it('should create a new payment that sets the balance to positive value', async() => { it('should create a new payment and check the cash comparison works correctly', async() => {
const amountPaid = '100';
const cashHanded = '500';
const expectedRefund = '400';
await page.waitToClick(selectors.clientBalance.newPaymentButton); await page.waitToClick(selectors.clientBalance.newPaymentButton);
await page.overwrite(selectors.clientBalance.newPaymentAmount, '100'); await page.write(selectors.clientBalance.newPaymentAmount, amountPaid);
await page.write(selectors.clientBalance.newDescription, 'Payment');
await page.write(selectors.clientBalance.deliveredAmount, cashHanded);
const refund = await page.waitToGetProperty(selectors.clientBalance.refundAmount, 'value');
await page.waitToClick(selectors.clientBalance.saveButton); await page.waitToClick(selectors.clientBalance.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(refund).toEqual(expectedRefund);
expect(message.text).toContain('Data saved!'); expect(message.text).toContain('Data saved!');
}); });
it('should check balance is now -100', async() => { it('should check the balance value is now -100', async() => {
let result = await page let result = await page
.waitToGetProperty(selectors.clientBalance.firstLineBalance, 'innerText'); .waitToGetProperty(selectors.clientBalance.firstLineBalance, 'innerText');
@ -96,7 +105,9 @@ describe('Client balance path', () => {
it('should create a new payment that sets the balance back to the original negative value', async() => { it('should create a new payment that sets the balance back to the original negative value', async() => {
await page.waitToClick(selectors.clientBalance.newPaymentButton); await page.waitToClick(selectors.clientBalance.newPaymentButton);
await page.autocompleteSearch(selectors.clientBalance.newPaymentBank, 'Pay on receipt');
await page.overwrite(selectors.clientBalance.newPaymentAmount, '-150'); await page.overwrite(selectors.clientBalance.newPaymentAmount, '-150');
await page.write(selectors.clientBalance.newDescription, 'Description');
await page.waitToClick(selectors.clientBalance.saveButton); await page.waitToClick(selectors.clientBalance.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();

View File

@ -38,7 +38,10 @@ describe('Ticket index payout path', () => {
}); });
it('should fill the company and bank to perform a payout', async() => { it('should fill the company and bank to perform a payout', async() => {
await page.autocompleteSearch(selectors.ticketsIndex.payoutCompany, 'VNL');
await page.autocompleteSearch(selectors.ticketsIndex.payoutBank, 'cash'); await page.autocompleteSearch(selectors.ticketsIndex.payoutBank, 'cash');
await page.write(selectors.clientBalance.newPaymentAmount, '100');
await page.write(selectors.ticketsIndex.payoutDescription, 'Payment');
await page.waitToClick(selectors.ticketsIndex.submitPayout); await page.waitToClick(selectors.ticketsIndex.submitPayout);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();

View File

@ -20,7 +20,7 @@ export default class Autocomplete extends Field {
constructor($element, $, $compile, $transclude) { constructor($element, $, $compile, $transclude) {
super($element, $, $compile); super($element, $, $compile);
this.$transclude = $transclude; this.$transclude = $transclude;
this.$compile = $compile;
this._selection = null; this._selection = null;
this.input = this.element.querySelector('input'); this.input = this.element.querySelector('input');
} }
@ -149,6 +149,9 @@ export default class Autocomplete extends Field {
where: where where: where
}; };
if (this.include)
filter.include = this.include;
let json = encodeURIComponent(JSON.stringify(filter)); let json = encodeURIComponent(JSON.stringify(filter));
this.$http.get(`${this.url}?filter=${json}`).then( this.$http.get(`${this.url}?filter=${json}`).then(
json => this.onSelectionRequest(json.data), json => this.onSelectionRequest(json.data),
@ -182,8 +185,14 @@ export default class Autocomplete extends Field {
} else { } else {
display = this._selection[this.showField]; display = this._selection[this.showField];
if (hasTemplate) { if (hasTemplate) {
let template = this.$transclude(() => {}, null, 'tplItem').text(); let template = this.$transclude(() => {}, null, 'tplItem');
display = this.$interpolate(template)(this._selection); const element = template[0];
const description = element.querySelector('.text-secondary');
if (description) description.remove();
const displayElement = angular.element(element);
const displayText = displayElement.text();
display = this.$interpolate(displayText)(this._selection);
} }
} }
} }

View File

@ -85,6 +85,8 @@
"You need to fill sage information before you check verified data": "You need to fill sage information before you check verified data", "You need to fill sage information before you check verified data": "You need to fill sage information before you check verified data",
"The social name cannot be empty": "The social name cannot be empty", "The social name cannot be empty": "The social name cannot be empty",
"The nif cannot be empty": "The nif cannot be empty", "The nif cannot be empty": "The nif cannot be empty",
"Amount cannot be zero": "Amount cannot be zero",
"Company has to be official": "Company has to be official",
"A travel with this data already exists": "A travel with this data already exists", "A travel with this data already exists": "A travel with this data already exists",
"The observation type can't be repeated": "The observation type can't be repeated", "The observation type can't be repeated": "The observation type can't be repeated",
"New ticket request has been created with price": "New ticket request has been created '{{description}}' for day <strong>{{shipped}}</strong>, with a quantity of <strong>{{quantity}}</strong> and a price of <strong>{{price}} €</strong>", "New ticket request has been created with price": "New ticket request has been created '{{description}}' for day <strong>{{shipped}}</strong>, with a quantity of <strong>{{quantity}}</strong> and a price of <strong>{{price}} €</strong>",

View File

@ -161,10 +161,13 @@
"The nif cannot be empty": "El NIF no puede quedar en blanco", "The nif cannot be empty": "El NIF no puede quedar en blanco",
"You need to fill sage information before you check verified data": "Debes rellenar la información de sage antes de marcar datos comprobados", "You need to fill sage information before you check verified data": "Debes rellenar la información de sage antes de marcar datos comprobados",
"ASSIGN_ZONE_FIRST": "Asigna una zona primero", "ASSIGN_ZONE_FIRST": "Asigna una zona primero",
"Amount cannot be zero": "El importe no puede ser cero",
"Company has to be official": "Empresa inválida",
"You can not select this payment method without a registered bankery account": "No se puede utilizar este método de pago si no has registrado una cuenta bancaria", "You can not select this payment method without a registered bankery account": "No se puede utilizar este método de pago si no has registrado una cuenta bancaria",
"You can't upload images on the test environment": "No puedes subir imágenes en el entorno de pruebas", "You can't upload images on the test environment": "No puedes subir imágenes en el entorno de pruebas",
"The selected ticket is not suitable for this route": "El ticket seleccionado no es apto para esta ruta", "The selected ticket is not suitable for this route": "El ticket seleccionado no es apto para esta ruta",
"Sorts whole route": "Reordena ruta entera", "Sorts whole route": "Reordena ruta entera",
"Invalid account": "Cuenta inválida",
"New ticket request has been created with price": "Se ha creado una nueva petición de compra '{{description}}' para el día <strong>{{shipped}}</strong>, con una cantidad de <strong>{{quantity}}</strong> y un precio de <strong>{{price}} €</strong>", "New ticket request has been created with price": "Se ha creado una nueva petición de compra '{{description}}' para el día <strong>{{shipped}}</strong>, con una cantidad de <strong>{{quantity}}</strong> y un precio de <strong>{{price}} €</strong>",
"New ticket request has been created": "Se ha creado una nueva petición de compra '{{description}}' para el día <strong>{{shipped}}</strong>, con una cantidad de <strong>{{quantity}}</strong>", "New ticket request has been created": "Se ha creado una nueva petición de compra '{{description}}' para el día <strong>{{shipped}}</strong>, con una cantidad de <strong>{{quantity}}</strong>",
"That item doesn't exists": "Ese artículo no existe" "That item doesn't exists": "Ese artículo no existe"

View File

@ -0,0 +1,144 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = function(Self) {
Self.remoteMethodCtx('createReceipt', {
description: 'Creates receipt and its compensation if necessary',
accepts: [{
arg: 'clientFk',
type: 'number',
description: 'The client id',
http: {source: 'path'}
},
{
arg: 'payed',
type: 'Date',
required: true
},
{
arg: 'companyFk',
type: 'number',
required: true
},
{
arg: 'bankFk',
type: 'number',
required: true
},
{
arg: 'amountPaid',
type: 'number',
required: true
},
{
arg: 'description',
type: 'string',
required: true
},
{
arg: 'compensationAccount',
type: 'any'
}],
returns: {
root: true,
type: 'Object'
},
http: {
verb: 'post',
path: '/:clientFk/createReceipt'
}
});
Self.createReceipt = async ctx => {
const models = Self.app.models;
const args = ctx.args;
const tx = await models.Address.beginTransaction({});
try {
const options = {transaction: tx};
delete args.ctx; // Remove unwanted properties
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) {
const supplierCompensation = await models.Supplier.findOne({
where: {
account: args.compensationAccount
}
});
let clientCompensation = {};
if (!supplierCompensation) {
clientCompensation = await models.Client.findOne({
where: {
accountingAccount: args.compensationAccount
}
});
}
if (!supplierCompensation && !clientCompensation)
throw new UserError('Invalid account');
await Self.rawSql(
`CALL vn.ledger_doCompensation(?, ?, ?, ?, ?, ?, ?)`,
[
Date(),
args.compensationAccount,
args.bankFk,
accountingType.receiptDescription + args.compensationAccount,
args.amountPaid,
args.companyFk,
clientOriginal.accountingAccount
],
options);
} else {
const description = `${clientOriginal.id} : ${clientOriginal.nickname} - ${accountingType.receiptDescription}`;
const [xdiarioNew] = await Self.rawSql(
`SELECT xdiario_new(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ledger;`,
[
null,
Date(),
bank.account,
clientOriginal.accountingAccount,
description,
args.amountPaid,
0,
0,
'',
'',
null,
null,
false,
args.companyFk
],
options);
await Self.rawSql(
`SELECT xdiario_new(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);`,
[
xdiarioNew.ledger,
Date(),
clientOriginal.accountingAccount,
bank.account,
description,
0,
args.amountPaid,
0,
'',
'',
null,
null,
false,
args.companyFk
],
options);
}
await tx.commit();
return newReceipt;
} catch (e) {
await tx.rollback();
throw e;
}
};
};

View File

@ -0,0 +1,148 @@
const app = require('vn-loopback/server/server');
describe('Client createReceipt', () => {
const clientFk = 108;
const payed = Date();
const companyFk = 442;
const amountPaid = 12.50;
const description = 'Receipt description';
it('should create a new receipt', async() => {
const bankFk = 1;
let ctx = {
args: {
clientFk: clientFk,
payed: payed,
companyFk: companyFk,
bankFk: bankFk,
amountPaid: amountPaid,
description: description
}
};
const receipt = await app.models.Client.createReceipt(ctx);
delete ctx.args.payed;
const till = await app.models.Till.findOne({
where: {
bankFk: bankFk,
in: amountPaid,
number: clientFk
}
});
expect(receipt).toEqual(jasmine.objectContaining(ctx.args));
// restores
await receipt.destroy();
await till.destroy();
});
it('should throw Invalid account if compensationAccount does not belongs to a client nor a supplier', async() => {
let error;
const bankFk = 3;
const ctx = {
args: {
clientFk: clientFk,
payed: payed,
companyFk: companyFk,
bankFk: bankFk,
amountPaid: amountPaid,
description: description,
compensationAccount: 'non existing account'
}
};
try {
await app.models.Client.createReceipt(ctx);
} catch (e) {
error = e;
}
expect(error).toBeDefined();
expect(error.message).toEqual('Invalid account');
});
it('should create a new receipt with a compensation for a client', async() => {
const bankFk = 3;
const ctx = {
args: {
clientFk: clientFk,
payed: payed,
companyFk: companyFk,
bankFk: bankFk,
amountPaid: amountPaid,
description: description,
compensationAccount: '4300000001'
}
};
const receipt = await app.models.Client.createReceipt(ctx);
const receiptCompensated = await app.models.Receipt.findOne({
where: {
clientFk: 1,
bankFk: ctx.args.bankFk
}
});
const till = await app.models.Till.findOne({
where: {
bankFk: bankFk,
in: amountPaid,
number: clientFk
}
});
delete ctx.args.payed;
expect(receipt).toEqual(jasmine.objectContaining(ctx.args));
expect(receipt.amountPaid).toEqual(-receiptCompensated.amountPaid);
// restores
await receipt.destroy();
await receiptCompensated.destroy();
await till.destroy();
});
it('should create a new receipt with a compensation for a supplier', async() => {
const ctx = {
args: {
clientFk: clientFk,
payed: payed,
companyFk: companyFk,
bankFk: 3,
amountPaid: amountPaid,
description: description,
compensationAccount: '4100000001'
}
};
const receipt = await app.models.Client.createReceipt(ctx);
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(paymentCompensated.amountPaid).toEqual(paymentCompensated.amountPaid);
// restores
await receipt.destroy();
await paymentCompensated.destroy();
await till.destroy();
});
});

View File

@ -8,6 +8,7 @@ describe('Address updateAddress', () => {
const customAgentOneId = 1; const customAgentOneId = 1;
it('should throw the non uee member error if no incoterms is defined', async() => { it('should throw the non uee member error if no incoterms is defined', async() => {
let err;
const ctx = { const ctx = {
args: { args: {
provinceFk: provinceId, provinceFk: provinceId,
@ -26,6 +27,7 @@ describe('Address updateAddress', () => {
}); });
it('should throw a non uee member error if no customsAgent is defined', async() => { it('should throw a non uee member error if no customsAgent is defined', async() => {
let err;
const ctx = { const ctx = {
args: { args: {
provinceFk: provinceId, provinceFk: provinceId,

View File

@ -104,6 +104,9 @@
"ClientDms": { "ClientDms": {
"dataSource": "vn" "dataSource": "vn"
}, },
"Till": {
"dataSource": "vn"
},
"CustomsAgent": { "CustomsAgent": {
"dataSource": "vn" "dataSource": "vn"
}, },

View File

@ -0,0 +1,84 @@
{
"name": "XDiario",
"base": "VnModel",
"options": {
"mysql": {
"table": "XDiario"
}
},
"properties": {
"ASIEN": {
"type": "number",
"id": true,
"description": "Identifier"
},
"FECHA": {
"type": "date"
},
"SUBCTA": {
"type": "string"
},
"CONTRA": {
"type": "string"
},
"CONCEPTO": {
"type": "string"
},
"EURODEBE": {
"type": "number"
},
"EUROHABER": {
"type": "number"
},
"BASEEURO": {
"type": "number"
},
"SERIE": {
"type": "string"
},
"CAMBIO": {
"type": "number"
},
"DEBEME": {
"type": "number"
},
"HABERME": {
"type": "number"
},
"FACTURA": {
"type": "string"
},
"IVA": {
"type": "number"
},
"RECEQUIV": {
"type": "number"
},
"METAL": {
"type": "number"
},
"METALIMP": {
"type": "number"
},
"CLIENTE": {
"type": "string"
},
"METALEJE": {
"type": "string"
},
"AUXILIAR": {
"type": "string"
},
"MONEDAUSO": {
"type": "string"
}
},
"relations": {
"company": {
"type": "belongsTo",
"model": "Company",
"foreignKey": "empresa_id"
}
}
}

View File

@ -30,6 +30,7 @@ module.exports = Self => {
require('../methods/client/createAddress')(Self); require('../methods/client/createAddress')(Self);
require('../methods/client/updateAddress')(Self); require('../methods/client/updateAddress')(Self);
require('../methods/client/consumption')(Self); require('../methods/client/consumption')(Self);
require('../methods/client/createReceipt')(Self);
// Validations // Validations

View File

@ -1,13 +1,44 @@
module.exports = function(Self) { module.exports = function(Self) {
require('../methods/receipt/filter')(Self); require('../methods/receipt/filter')(Self);
Self.validateBinded('amountPaid', isNotZero, {
message: 'Amount cannot be zero',
allowNull: false,
allowBlank: false
});
function isNotZero(value) {
return !isNaN(value) && value != 0;
}
Self.validateAsync('companyFk', isOfficialCompany, {
message: 'Company has to be official'
});
async function isOfficialCompany(err, done) {
const hasCompany = await Self.app.models.Company.exists(this.companyFk);
if (!hasCompany) err();
done();
}
Self.observe('before save', async function(ctx) { Self.observe('before save', async function(ctx) {
if (ctx.isNewInstance) { if (ctx.isNewInstance) {
let token = ctx.options.accessToken; let token = ctx.options.accessToken;
let userId = token && token.userId; let userId = token && token.userId;
let worker = await Self.app.models.Worker.findOne({where: {userFk: userId}});
ctx.instance.workerFk = worker.id; ctx.instance.workerFk = userId;
await Self.app.models.Till.create({
workerFk: userId,
bankFk: ctx.instance.bankFk,
in: ctx.instance.amountPaid,
concept: ctx.instance.description,
dated: ctx.instance.payed,
serie: 'A',
isAccountable: true,
number: ctx.instance.clientFk,
companyFk: ctx.instance.companyFk
});
} }
}); });
}; };

View File

@ -9,17 +9,19 @@
"properties": { "properties": {
"id": { "id": {
"id": true, "id": true,
"type": "Number", "type": "number",
"description": "Identifier" "description": "Identifier"
}, },
"amountPaid": { "amountPaid": {
"type": "Number" "type": "number",
"required": true
}, },
"amountUnpaid": { "amountUnpaid": {
"type": "Number" "type": "number"
}, },
"payed": { "payed": {
"type": "date" "type": "date",
"required": true
}, },
"created": { "created": {
"type": "date" "type": "date"
@ -31,7 +33,16 @@
"type": "string", "type": "string",
"mysql": { "mysql": {
"columnName": "invoiceFk" "columnName": "invoiceFk"
} },
"required": true
},
"bankFk": {
"type": "number",
"required": true
},
"companyFk": {
"type": "number",
"required": true
} }
}, },
"relations": { "relations": {

View File

@ -0,0 +1,64 @@
{
"name": "Till",
"base": "VnModel",
"options": {
"mysql": {
"table": "till"
}
},
"properties": {
"id": {
"type": "number",
"id": true,
"description": "Identifier"
},
"dated": {
"type": "date",
"required": true
},
"isAccountable": {
"type": "boolean"
},
"serie": {
"type": "string",
"required": true
},
"number": {
"type": "number"
},
"concept": {
"type": "string",
"required": true
},
"in": {
"type": "number"
},
"out": {
"type": "number"
},
"created": {
"type": "date"
},
"isConciliate": {
"type": "boolean"
}
},
"relations": {
"bank": {
"type": "belongsTo",
"model": "Bank",
"foreignKey": "bankFk"
},
"worker": {
"type": "belongsTo",
"model": "Account",
"foreignKey": "workerFk"
},
"company": {
"type": "belongsTo",
"model": "Company",
"foreignKey": "companyFk"
}
}
}

View File

@ -6,19 +6,23 @@
auto-load="true" auto-load="true"
url="Companies" url="Companies"
data="companies" data="companies"
order="code"> order="code"
required="true">
</vn-crud-model> </vn-crud-model>
<vn-horizontal> <vn-horizontal>
<vn-date-picker <vn-date-picker
label="Date" label="Date"
ng-model="$ctrl.receipt.payed"> ng-model="$ctrl.receipt.payed"
required="true">
</vn-date-picker> </vn-date-picker>
<vn-autocomplete <vn-autocomplete
data="companies" data="companies"
label="Company" label="Company"
show-field="code" show-field="code"
value-field="id" value-field="id"
ng-model="$ctrl.receipt.companyFk"> ng-model="$ctrl.receipt.companyFk"
required="true"
rule>
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
@ -29,27 +33,51 @@
value-field="id" value-field="id"
fields="['accountingTypeFk']" fields="['accountingTypeFk']"
include="{relation: 'accountingType'}" include="{relation: 'accountingType'}"
ng-model="$ctrl.receipt.bankFk" ng-model="$ctrl.bankFk"
search-function="{or: [{id: $search}, {bank: {like: '%'+ $search +'%'}}]}" search-function="{or: [{id: $search}, {bank: {like: '%'+ $search +'%'}}]}"
selection="$ctrl.bankSelection" selection="$ctrl.bankSelection"
order="id"> order="id"
required="true">
<tpl-item>{{id}}: {{bank}}</tpl-item> <tpl-item>{{id}}: {{bank}}</tpl-item>
</vn-autocomplete> </vn-autocomplete>
<vn-input-number <vn-input-number
vn-focus vn-focus
label="Amount" label="Amount"
ng-model="$ctrl.receipt.amountPaid" ng-model="$ctrl.amountPaid"
step="0.01" step="0.01"
rule> required="true">
</vn-input-number> </vn-input-number>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-textfield <vn-textfield
label="Reference" label="Reference"
ng-model="$ctrl.receipt.description" ng-model="$ctrl.receipt.description"
rule> rule
required="true">
</vn-textfield> </vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-vertical ng-show="$ctrl.bankSelection.accountingType.code == 'cash'">
<h6 translate>Cash</h6>
<vn-horizontal>
<vn-input-number
ng-model="$ctrl.deliveredAmount"
label="Delivered amount">
</vn-input-number>
<vn-input-number
disabled="true"
ng-model="$ctrl.amountToReturn"
label="Amount to return">
</vn-input-number>
</vn-horizontal>
</vn-vertical>
<vn-vertical ng-show="$ctrl.bankSelection.accountingType.code == 'compensation'">
<h6 translate>Compensation</h6>
<vn-textfield
ng-model="$ctrl.receipt.compensationAccount"
label="Compensation Account"
on-change="$ctrl.accountShortToStandard(value)">
</vn-textfield>
</vn-vertical>
</tpl-body> </tpl-body>
<tpl-buttons> <tpl-buttons>
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/> <input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>

View File

@ -6,10 +6,7 @@ class Controller extends Dialog {
super($element, $, $transclude); super($element, $, $transclude);
this.receipt = { this.receipt = {
payed: new Date(), payed: new Date()
clientFk: this.$params.id,
companyFk: this.vnConfig.companyFk,
bankFk: this.vnConfig.bankFk
}; };
} }
@ -17,12 +14,9 @@ class Controller extends Dialog {
this.receipt.payed = value; this.receipt.payed = value;
} }
set bankFk(value) {
this.receipt.bankFk = value;
}
set amountPaid(value) { set amountPaid(value) {
this.receipt.amountPaid = value; this.receipt.amountPaid = value;
this.amountToReturn = this.deliveredAmount - value;
} }
get amountPaid() { get amountPaid() {
@ -63,6 +57,30 @@ class Controller extends Dialog {
} }
} }
set deliveredAmount(value) {
this._deliveredAmount = value;
this.amountToReturn = value - this.receipt.amountPaid;
}
get deliveredAmount() {
return this._deliveredAmount;
}
get bankFk() {
if (!this.receipt.bankFk)
this.receipt.bankFk = this.vnConfig.bankFk;
return this.receipt.bankFk;
}
set bankFk(value) {
this.receipt.bankFk = value;
}
accountShortToStandard(value) {
this.receipt.compensationAccount = value.replace('.', '0'.repeat(11 - value.length));
}
getAmountPaid() { getAmountPaid() {
const filter = { const filter = {
where: { where: {
@ -80,7 +98,7 @@ class Controller extends Dialog {
if (response !== 'accept') if (response !== 'accept')
return super.responseHandler(response); return super.responseHandler(response);
return this.$http.post(`Receipts`, this.receipt) return this.$http.post(`Clients/${this.clientFk}/createReceipt`, this.receipt)
.then(() => super.responseHandler(response)) .then(() => super.responseHandler(response))
.then(() => this.vnApp.showSuccess(this.$t('Data saved!'))); .then(() => this.vnApp.showSuccess(this.$t('Data saved!')));
} }

View File

@ -65,12 +65,30 @@ describe('Client', () => {
controller.$params = {id: 101}; controller.$params = {id: 101};
$httpBackend.expect('POST', `Receipts`).respond({id: 1}); $httpBackend.expect('POST', `Clients/101/createReceipt`).respond({id: 1});
controller.responseHandler('accept'); controller.responseHandler('accept');
$httpBackend.flush(); $httpBackend.flush();
expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.vnApp.showSuccess).toHaveBeenCalled();
}); });
}); });
describe('deliveredAmount() setter', () => {
it('should set the deliveredAmount property', () => {
controller.amountPaid = 999;
controller.deliveredAmount = 1000;
expect(controller.amountToReturn).toEqual(1);
});
});
describe('accountShortToStandard()', () => {
it('should get de account in stardard format', () => {
const shortAccount = '4.3';
controller.accountShortToStandard(shortAccount);
expect(controller.receipt.compensationAccount).toEqual('4000000003');
});
});
}); });
}); });

View File

@ -139,7 +139,8 @@
<vn-client-balance-create <vn-client-balance-create
vn-id="balance-create" vn-id="balance-create"
on-accept="$ctrl.getData()" on-accept="$ctrl.getData()"
company-fk="$ctrl.companyId"> company-fk="$ctrl.companyId"
client-fk="$ctrl.$params.id">
</vn-client-balance-create> </vn-client-balance-create>
<vn-worker-descriptor-popover <vn-worker-descriptor-popover
vn-id="workerDescriptor"> vn-id="workerDescriptor">

View File

@ -0,0 +1,2 @@
Compensation: Compensación
Cash: Efectivo

View File

@ -82,7 +82,6 @@
value-field="id" value-field="id"
label="Previous client" label="Previous client"
info="In case of a company succession, specify the grantor company" info="In case of a company succession, specify the grantor company"
vn-acl="salesAssistant"
rule> rule>
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>

View File

@ -58,3 +58,6 @@ Samples: Plantillas
Send sample: Enviar plantilla Send sample: Enviar plantilla
Log: Historial Log: Historial
Consumption: Consumo Consumption: Consumo
Compensation Account: Cuenta para compensar
Amount to return: Cantidad a devolver
Delivered amount: Cantidad entregada

View File

@ -1,5 +1,3 @@
const app = require('vn-loopback/server/server');
module.exports = Self => { module.exports = Self => {
Self.validate('range', function(err) { Self.validate('range', function(err) {
if (this.type == 'range' if (this.type == 'range'

135
package-lock.json generated
View File

@ -5893,7 +5893,7 @@
}, },
"util": { "util": {
"version": "0.10.3", "version": "0.10.3",
"resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz", "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz",
"integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -6864,7 +6864,7 @@
"base": { "base": {
"version": "0.11.2", "version": "0.11.2",
"resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz",
"integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", "integrity": "sha1-e95c7RRbbVUakNuH+DxVi060io8=",
"dev": true, "dev": true,
"requires": { "requires": {
"cache-base": "^1.0.1", "cache-base": "^1.0.1",
@ -7185,7 +7185,7 @@
}, },
"browserify-rsa": { "browserify-rsa": {
"version": "4.0.1", "version": "4.0.1",
"resolved": "http://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz",
"integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -7376,7 +7376,7 @@
"cache-base": { "cache-base": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz",
"integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", "integrity": "sha1-Cn9GQWgxyLZi7jb+TnxZ129marI=",
"dev": true, "dev": true,
"requires": { "requires": {
"collection-visit": "^1.0.0", "collection-visit": "^1.0.0",
@ -7584,7 +7584,7 @@
"class-utils": { "class-utils": {
"version": "0.3.6", "version": "0.3.6",
"resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz",
"integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", "integrity": "sha1-+TNprouafOAv1B+q0MqDAzGQxGM=",
"dev": true, "dev": true,
"requires": { "requires": {
"arr-union": "^3.1.0", "arr-union": "^3.1.0",
@ -10021,7 +10021,7 @@
}, },
"file-loader": { "file-loader": {
"version": "1.1.11", "version": "1.1.11",
"resolved": "http://registry.npmjs.org/file-loader/-/file-loader-1.1.11.tgz", "resolved": "https://registry.npmjs.org/file-loader/-/file-loader-1.1.11.tgz",
"integrity": "sha512-TGR4HU7HUsGg6GCOPJnFk06RhWgEWFLAGWiT6rcD+GRC2keU3s9RGJ+b3Z6/U73jwwNb2gKLJ7YCrp+jvU4ALg==", "integrity": "sha512-TGR4HU7HUsGg6GCOPJnFk06RhWgEWFLAGWiT6rcD+GRC2keU3s9RGJ+b3Z6/U73jwwNb2gKLJ7YCrp+jvU4ALg==",
"dev": true, "dev": true,
"requires": { "requires": {
@ -10143,11 +10143,6 @@
"parse-filepath": "^1.0.1" "parse-filepath": "^1.0.1"
} }
}, },
"first-chunk-stream": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-0.1.0.tgz",
"integrity": "sha1-dV0+wU1JqG49L8wIvurVwMornAo="
},
"flagged-respawn": { "flagged-respawn": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-1.0.1.tgz", "resolved": "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-1.0.1.tgz",
@ -11207,7 +11202,7 @@
"global-modules": { "global-modules": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz",
"integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", "integrity": "sha1-bXcPDrUjrHgWTXK15xqIdyZcw+o=",
"dev": true, "dev": true,
"requires": { "requires": {
"global-prefix": "^1.0.1", "global-prefix": "^1.0.1",
@ -13100,9 +13095,9 @@
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
}, },
"ini": { "ini": {
"version": "1.3.5", "version": "1.3.8",
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="
}, },
"internal-ip": { "internal-ip": {
"version": "4.3.0", "version": "4.3.0",
@ -13394,7 +13389,7 @@
"is-plain-object": { "is-plain-object": {
"version": "2.0.4", "version": "2.0.4",
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
"integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", "integrity": "sha1-LBY7P6+xtgbZ0Xko8FwqHDjgdnc=",
"dev": true, "dev": true,
"requires": { "requires": {
"isobject": "^3.0.1" "isobject": "^3.0.1"
@ -13478,7 +13473,8 @@
"is-utf8": { "is-utf8": {
"version": "0.2.1", "version": "0.2.1",
"resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
"integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=" "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=",
"dev": true
}, },
"is-valid-glob": { "is-valid-glob": {
"version": "1.0.0", "version": "1.0.0",
@ -22352,7 +22348,7 @@
"dependencies": { "dependencies": {
"jsesc": { "jsesc": {
"version": "0.5.0", "version": "0.5.0",
"resolved": "http://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz",
"integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=",
"dev": true "dev": true
} }
@ -22694,7 +22690,7 @@
}, },
"safe-regex": { "safe-regex": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz",
"integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -22908,7 +22904,7 @@
"dependencies": { "dependencies": {
"source-map": { "source-map": {
"version": "0.4.4", "version": "0.4.4",
"resolved": "http://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz",
"integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -23369,7 +23365,7 @@
"snapdragon-node": { "snapdragon-node": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz",
"integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", "integrity": "sha1-bBdfhv8UvbByRWPo88GwIaKGhTs=",
"dev": true, "dev": true,
"requires": { "requires": {
"define-property": "^1.0.0", "define-property": "^1.0.0",
@ -23420,7 +23416,7 @@
"snapdragon-util": { "snapdragon-util": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz",
"integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", "integrity": "sha1-+VZHlIbyrNeXAGk/b3uAXkWrVuI=",
"dev": true, "dev": true,
"requires": { "requires": {
"kind-of": "^3.2.0" "kind-of": "^3.2.0"
@ -23438,40 +23434,43 @@
} }
}, },
"soap": { "soap": {
"version": "0.26.0", "version": "0.35.0",
"resolved": "https://registry.npmjs.org/soap/-/soap-0.26.0.tgz", "resolved": "https://registry.npmjs.org/soap/-/soap-0.35.0.tgz",
"integrity": "sha512-tTS3lnGl6lfjQQuJgNnWOgC0Xa6qYQSwl2G7DX3kCdGmek/FTNmHDM/7icKP1KBMFfCrKpAWEbZiGefa92SCYw==", "integrity": "sha512-nRzW37ZdsdPKW8AtRKj6ibK+xVqgN8HFeowf+7NiJUtrHUbdiES3pFtRN0ZNU4q9Z1c75Epg77+9ENrtx9ulTw==",
"requires": { "requires": {
"bluebird": "^3.5.0", "debug": "^4.1.1",
"concat-stream": "^1.5.1", "get-stream": "^6.0.0",
"debug": "^2.6.9",
"ejs": "~2.5.5",
"finalhandler": "^1.0.3",
"httpntlm": "^1.5.2", "httpntlm": "^1.5.2",
"lodash": "^4.17.5", "lodash": "^4.17.19",
"request": ">=2.9.0", "request": ">=2.9.0",
"sax": ">=0.6", "sax": ">=0.6",
"serve-static": "^1.11.1", "strip-bom": "^3.0.0",
"strip-bom": "~0.3.1", "uuid": "^8.3.0",
"uuid": "^3.1.0", "xml-crypto": "^2.0.0"
"xml-crypto": "~0.8.0"
}, },
"dependencies": { "dependencies": {
"concat-stream": { "debug": {
"version": "1.6.2", "version": "4.3.1",
"resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
"integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==",
"requires": { "requires": {
"buffer-from": "^1.0.0", "ms": "2.1.2"
"inherits": "^2.0.3",
"readable-stream": "^2.2.2",
"typedarray": "^0.0.6"
} }
}, },
"ejs": { "get-stream": {
"version": "2.5.9", "version": "6.0.0",
"resolved": "https://registry.npmjs.org/ejs/-/ejs-2.5.9.tgz", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.0.tgz",
"integrity": "sha512-GJCAeDBKfREgkBtgrYSf9hQy9kTb3helv0zGdzqhM7iAkW8FA/ZF97VQDbwFiwIT8MQLLOe5VlPZOEvZAqtUAQ==" "integrity": "sha512-A1B3Bh1UmL0bidM/YX2NsCOTnGJePL9rO/M+Mw3m9f2gUpfokS0hi5Eah0WSUEWZdZhIZtMjkIYS7mDfOqNHbg=="
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
} }
} }
}, },
@ -23704,7 +23703,7 @@
"split-string": { "split-string": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz",
"integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", "integrity": "sha1-fLCd2jqGWFcFxks5pkZgOGguj+I=",
"dev": true, "dev": true,
"requires": { "requires": {
"extend-shallow": "^3.0.0" "extend-shallow": "^3.0.0"
@ -23958,13 +23957,9 @@
} }
}, },
"strip-bom": { "strip-bom": {
"version": "0.3.1", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-0.3.1.tgz", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
"integrity": "sha1-noo57/RW/5q8LwWfXyIluw8/fKU=", "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM="
"requires": {
"first-chunk-stream": "^0.1.0",
"is-utf8": "^0.2.0"
}
}, },
"strip-eof": { "strip-eof": {
"version": "1.0.0", "version": "1.0.0",
@ -25006,7 +25001,7 @@
"touch": { "touch": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz",
"integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", "integrity": "sha1-/jZfX3XsntTlaCXgu3bSSrdK+Ds=",
"dev": true, "dev": true,
"requires": { "requires": {
"nopt": "~1.0.10" "nopt": "~1.0.10"
@ -25088,7 +25083,7 @@
}, },
"tty-browserify": { "tty-browserify": {
"version": "0.0.0", "version": "0.0.0",
"resolved": "http://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz",
"integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=",
"dev": true "dev": true
}, },
@ -26779,12 +26774,12 @@
"dev": true "dev": true
}, },
"xml-crypto": { "xml-crypto": {
"version": "0.8.5", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/xml-crypto/-/xml-crypto-0.8.5.tgz", "resolved": "https://registry.npmjs.org/xml-crypto/-/xml-crypto-2.0.0.tgz",
"integrity": "sha1-K7z7PrM/OoKiGLgiv2craxwg5Tg=", "integrity": "sha512-/a04qr7RpONRZHOxROZ6iIHItdsQQjN3sj8lJkYDDss8tAkEaAs0VrFjb3tlhmS5snQru5lTs9/5ISSMdPDHlg==",
"requires": { "requires": {
"xmldom": "=0.1.19", "xmldom": "0.1.27",
"xpath.js": ">=0.0.3" "xpath": "0.0.27"
} }
}, },
"xml-name-validator": { "xml-name-validator": {
@ -26811,7 +26806,7 @@
}, },
"xmlbuilder": { "xmlbuilder": {
"version": "9.0.7", "version": "9.0.7",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", "resolved": "http://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz",
"integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=" "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0="
}, },
"xmlchars": { "xmlchars": {
@ -26826,14 +26821,14 @@
"integrity": "sha1-+mv3YqYKQT+z3Y9LA8WyaSONMI8=" "integrity": "sha1-+mv3YqYKQT+z3Y9LA8WyaSONMI8="
}, },
"xmldom": { "xmldom": {
"version": "0.1.19", "version": "0.1.27",
"resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.19.tgz", "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.27.tgz",
"integrity": "sha1-Yx/Ad3bv2EEYvyUXGzftTQdaCrw=" "integrity": "sha1-1QH5ezvbQDr4757MIFcxh6rawOk="
}, },
"xpath.js": { "xpath": {
"version": "1.1.0", "version": "0.0.27",
"resolved": "https://registry.npmjs.org/xpath.js/-/xpath.js-1.1.0.tgz", "resolved": "https://registry.npmjs.org/xpath/-/xpath-0.0.27.tgz",
"integrity": "sha512-jg+qkfS4K8E7965sqaUl8mRngXiKb3WZGfONgE18pr03FUQiuSV6G+Ej4tS55B+rIQSFEIw3phdVAQ4pPqNWfQ==" "integrity": "sha512-fg03WRxtkCV6ohClePNAECYsmpKKTv5L8y/X3Dn1hQrec3POx2jHZ/0P2qQ6HvsrU1BmeqXcof3NGGueG6LxwQ=="
}, },
"xtend": { "xtend": {
"version": "1.0.3", "version": "1.0.3",

View File

@ -35,7 +35,7 @@
"require-yaml": "0.0.1", "require-yaml": "0.0.1",
"sharp": "^0.25.4", "sharp": "^0.25.4",
"smbhash": "0.0.1", "smbhash": "0.0.1",
"soap": "^0.26.0", "soap": "^0.35.0",
"strong-error-handler": "^2.3.2", "strong-error-handler": "^2.3.2",
"uuid": "^3.3.3", "uuid": "^3.3.3",
"vn-loopback": "file:./loopback", "vn-loopback": "file:./loopback",