Merge branch '5172-cliente-impagado' of https://gitea.verdnatura.es/verdnatura/salix into 5172-cliente-impagado
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Alexandre Riera 2023-02-22 14:24:33 +01:00
commit 3a3dcc941b
107 changed files with 925 additions and 478 deletions

View File

@ -5,17 +5,30 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2306.01] - 2023-02-23
## [2308.01] - 2023-03-09
### Added
- (Client -> Descriptor) Nuevo icono $ con barrotes para los clientes con impago
### Changed
-
### Fixed
-
## [2306.01] - 2023-02-23
### Added
- (Tickets -> Datos Básicos) Mensaje de confirmación al intentar generar tickets con negativos
- (Artículos) El visible y disponible se calcula a partir de un almacén diferente dependiendo de la sección en la que te encuentres. Se ha añadido un icono que informa sobre a partir de que almacén se esta calculando.
### Changed
- (General -> Inicio) Ahora permite recuperar la contraseña tanto con el correo de recuperación como el usuario
### Fixed
- (Monitor de tickets) Cuando ordenas por columna, ya no se queda deshabilitado el botón de 'Actualizar'
- (Zone -> Días de entrega) Al hacer click en un día, muestra correctamente las zonas
- (Artículos) El disponible en la vista previa se muestra correctamente
## [2304.01] - 2023-02-09

View File

@ -20,10 +20,9 @@
"type": "date"
}
},
"scope": {
"where" :{
"expired": null
}
}
}
}

View File

@ -3,7 +3,3 @@ ALTER TABLE `vn`.`itemConfig` ADD CONSTRAINT itemConfig_FK FOREIGN KEY (defaultT
ALTER TABLE `vn`.`itemConfig` ADD validPriorities varchar(50) DEFAULT '[1,2,3]' NOT NULL;
ALTER TABLE `vn`.`itemConfig` ADD defaultPriority INT DEFAULT 2 NOT NULL;
ALTER TABLE `vn`.`item` MODIFY COLUMN relevancy tinyint(1) DEFAULT 0 NOT NULL COMMENT 'La web ordena de forma descendiente por este campo para mostrar los artículos';
INSERT INTO `salix`.`ACL`
(model, property, accessType, permission, principalType, principalId)
VALUES('ItemConfig', '*', 'READ', 'ALLOW', 'ROLE', 'buyer');

View File

@ -3,7 +3,3 @@ ALTER TABLE `vn`.`itemConfig` ADD CONSTRAINT itemConfig_FK FOREIGN KEY (defaultT
ALTER TABLE `vn`.`itemConfig` ADD validPriorities varchar(50) DEFAULT '[1,2,3]' NOT NULL;
ALTER TABLE `vn`.`itemConfig` ADD defaultPriority INT DEFAULT 2 NOT NULL;
ALTER TABLE `vn`.`item` MODIFY COLUMN relevancy tinyint(1) DEFAULT 0 NOT NULL COMMENT 'La web ordena de forma descendiente por este campo para mostrar los artículos';
INSERT INTO `salix`.`ACL`
(model, property, accessType, permission, principalType, principalId)
VALUES('ItemConfig', '*', 'READ', 'ALLOW', 'ROLE', 'buyer');

View File

@ -0,0 +1,30 @@
DROP FUNCTION IF EXISTS `vn`.`invoiceOut_getWeight`;
DELIMITER $$
$$
CREATE DEFINER=`root`@`localhost` FUNCTION `vn`.`invoiceOut_getWeight`(vInvoice VARCHAR(15)) RETURNS decimal(10,2)
READS SQL DATA
BEGIN
/**
* Calcula el peso de una factura emitida
*
* @param vInvoice Id de la factura
* @return vTotalWeight peso de la factura
*/
DECLARE vTotalWeight DECIMAL(10,2);
SELECT SUM(CAST(IFNULL(i.stems, 1)
* s.quantity
* IF(ic.grams, ic.grams, IFNULL(i.weightByPiece, 0)) / 1000 AS DECIMAL(10,2)))
INTO vTotalWeight
FROM ticket t
JOIN sale s ON s.ticketFk = t.id
JOIN item i ON i.id = s.itemFk
JOIN itemCost ic ON ic.itemFk = i.id
AND ic.warehouseFk = t.warehouseFk
WHERE t.refFk = vInvoice
AND i.intrastatFk;
RETURN vTotalWeight;
END$$
DELIMITER ;

View File

@ -0,0 +1,3 @@
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
VALUES
('Client', 'getClientOrSupplierReference', 'READ', 'ALLOW', 'ROLE', 'employee');

View File

@ -0,0 +1,127 @@
DROP PROCEDURE IF EXISTS `vn`.`ticket_canAdvance`;
DELIMITER $$
$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_canAdvance`(vDateFuture DATE, vDateToAdvance DATE, vWarehouseFk INT)
BEGIN
/**
* Devuelve los tickets y la cantidad de lineas de venta que se pueden adelantar.
*
* @param vDateFuture Fecha de los tickets que se quieren adelantar.
* @param vDateToAdvance Fecha a cuando se quiere adelantar.
* @param vWarehouseFk Almacén
*/
DECLARE vDateInventory DATE;
SELECT inventoried INTO vDateInventory FROM config;
DROP TEMPORARY TABLE IF EXISTS tmp.stock;
CREATE TEMPORARY TABLE tmp.stock
(itemFk INT PRIMARY KEY,
amount INT)
ENGINE = MEMORY;
INSERT INTO tmp.stock(itemFk, amount)
SELECT itemFk, SUM(quantity) amount FROM
(
SELECT itemFk, quantity
FROM itemTicketOut
WHERE shipped >= vDateInventory
AND shipped < vDateFuture
AND warehouseFk = vWarehouseFk
UNION ALL
SELECT itemFk, quantity
FROM itemEntryIn
WHERE landed >= vDateInventory
AND landed < vDateFuture
AND isVirtualStock = FALSE
AND warehouseInFk = vWarehouseFk
UNION ALL
SELECT itemFk, quantity
FROM itemEntryOut
WHERE shipped >= vDateInventory
AND shipped < vDateFuture
AND warehouseOutFk = vWarehouseFk
) t
GROUP BY itemFk HAVING amount != 0;
DROP TEMPORARY TABLE IF EXISTS tmp.filter;
CREATE TEMPORARY TABLE tmp.filter
(INDEX (id))
SELECT
origin.ticketFk futureId,
dest.ticketFk id,
dest.state,
origin.futureState,
origin.futureIpt,
dest.ipt,
origin.workerFk,
origin.futureLiters,
origin.futureLines,
dest.shipped,
origin.shipped futureShipped,
dest.totalWithVat,
origin.totalWithVat futureTotalWithVat,
dest.agency,
origin.futureAgency,
dest.lines,
dest.liters,
origin.futureLines - origin.hasStock AS notMovableLines,
(origin.futureLines = origin.hasStock) AS isFullMovable
FROM (
SELECT
s.ticketFk,
t.workerFk,
t.shipped,
t.totalWithVat,
st.name futureState,
t.addressFk,
am.name futureAgency,
count(s.id) futureLines,
GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) futureIpt,
CAST(SUM(litros) AS DECIMAL(10,0)) futureLiters,
SUM((s.quantity <= IFNULL(st.amount,0))) hasStock
FROM ticket t
JOIN sale s ON s.ticketFk = t.id
JOIN saleVolume sv ON sv.saleFk = s.id
JOIN item i ON i.id = s.itemFk
JOIN ticketState ts ON ts.ticketFk = t.id
JOIN state st ON st.id = ts.stateFk
JOIN agencyMode am ON t.agencyModeFk = am.id
LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
LEFT JOIN tmp.stock st ON st.itemFk = i.id
WHERE t.shipped BETWEEN vDateFuture AND util.dayend(vDateFuture)
AND t.warehouseFk = vWarehouseFk
GROUP BY t.id
) origin
JOIN (
SELECT
t.id ticketFk,
t.addressFk,
st.name state,
GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) ipt,
t.shipped,
t.totalWithVat,
am.name agency,
CAST(SUM(litros) AS DECIMAL(10,0)) liters,
CAST(COUNT(*) AS DECIMAL(10,0)) `lines`
FROM ticket t
JOIN sale s ON s.ticketFk = t.id
JOIN saleVolume sv ON sv.saleFk = s.id
JOIN item i ON i.id = s.itemFk
JOIN ticketState ts ON ts.ticketFk = t.id
JOIN state st ON st.id = ts.stateFk
JOIN agencyMode am ON t.agencyModeFk = am.id
LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
WHERE t.shipped BETWEEN vDateToAdvance AND util.dayend(vDateToAdvance)
AND t.warehouseFk = vWarehouseFk
AND st.order <= 5
GROUP BY t.id
) dest ON dest.addressFk = origin.addressFk
WHERE origin.hasStock != 0;
DROP TEMPORARY TABLE tmp.stock;
END$$
DELIMITER ;

View File

@ -0,0 +1,4 @@
ALTER TABLE `vn`.`itemConfig` ADD warehouseFk smallint(6) unsigned NULL;
UPDATE `vn`.`itemConfig`
SET warehouseFk=60
WHERE id=0;

View File

@ -0,0 +1,3 @@
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
VALUES
('ItemConfig', '*', '*', 'ALLOW', 'ROLE', 'employee');

View File

@ -717,7 +717,8 @@ INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeF
(28, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE()),
(29, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE()),
(30, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE()),
(31, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE());
(31, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE()),
(32, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE());
INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`)
VALUES
@ -1019,7 +1020,9 @@ INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `pric
(34, 4, 28, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(35, 4, 29, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(36, 4, 30, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(37, 4, 31, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE());
(37, 4, 31, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(38, 2, 32, 'Melee weapon combat fist 15cm', 30, 7.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)),
(39, 1, 32, 'Ranged weapon longbow 2m', 2, 103.49, 0, 0, 0, util.VN_CURDATE());
INSERT INTO `vn`.`saleChecked`(`saleFk`, `isChecked`)
VALUES
@ -2744,9 +2747,9 @@ INSERT INTO `vn`.`collection` (`id`, `created`, `workerFk`, `stateFk`, `itemPack
VALUES
(3, util.VN_NOW(), 1107, 5, NULL, 0, 0, 1, NULL, NULL);
INSERT INTO `vn`.`itemConfig` (`id`, `isItemTagTriggerDisabled`, `monthToDeactivate`, `wasteRecipients`, `validPriorities`, `defaultPriority`, `defaultTag`)
INSERT INTO `vn`.`itemConfig` (`id`, `isItemTagTriggerDisabled`, `monthToDeactivate`, `wasteRecipients`, `validPriorities`, `defaultPriority`, `defaultTag`, `warehouseFk`)
VALUES
(0, 0, 24, '', '[1,2,3]', 2, 56);
(0, 0, 24, '', '[1,2,3]', 2, 56, 60);
INSERT INTO `vn`.`ticketCollection` (`ticketFk`, `collectionFk`, `created`, `level`, `wagon`, `smartTagFk`, `usedShelves`, `itemCount`, `liters`)
VALUES

View File

@ -26286,6 +26286,7 @@ CREATE TABLE `entry` (
`typeFk` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL COMMENT 'Tipo de entrada',
`reference` varchar(50) COLLATE utf8mb3_unicode_ci DEFAULT NULL COMMENT 'Referencia para eti',
`ref` varchar(50) GENERATED ALWAYS AS (`invoiceNumber`) VIRTUAL COMMENT 'Columna virtual provisional para Salix',
`observationEditorFk` INT(10) unsigned NULL COMMENT 'Último usuario que ha modificado el campo evaNotes',
PRIMARY KEY (`id`),
KEY `Id_Proveedor` (`supplierFk`),
KEY `Fecha` (`dated`),
@ -26300,7 +26301,8 @@ CREATE TABLE `entry` (
CONSTRAINT `entry_FK_1` FOREIGN KEY (`typeFk`) REFERENCES `entryType` (`code`) ON UPDATE CASCADE,
CONSTRAINT `entry_ibfk_1` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE,
CONSTRAINT `entry_ibfk_6` FOREIGN KEY (`travelFk`) REFERENCES `travel` (`id`) ON UPDATE CASCADE,
CONSTRAINT `entry_ibfk_7` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE
CONSTRAINT `entry_ibfk_7` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE,
CONSTRAINT `entry_observationEditorFk` FOREIGN KEY (`observationEditorFk`) REFERENCES `account`.`user`(`id`) ON UPDATE CASCADE
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='InnoDB free: 88064 kB; (`Id_Proveedor`) REFER `vn2008/Provee';
/*!40101 SET character_set_client = @saved_cs_client */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;

View File

@ -778,18 +778,16 @@ export default {
ipt: 'vn-autocomplete[label="Destination IPT"]',
tableIpt: 'vn-autocomplete[name="ipt"]',
tableFutureIpt: 'vn-autocomplete[name="futureIpt"]',
futureState: 'vn-check[label="Pending Origin"]',
state: 'vn-check[label="Pending Destination"]',
isFullMovable: 'vn-check[ng-model="filter.isFullMovable"]',
warehouseFk: 'vn-autocomplete[label="Warehouse"]',
tableButtonSearch: 'vn-button[vn-tooltip="Search"]',
moveButton: 'vn-button[vn-tooltip="Advance tickets"]',
acceptButton: '.vn-confirm.shown button[response="accept"]',
multiCheck: 'vn-multi-check',
firstCheck: 'tbody > tr:nth-child(1) > td > vn-check',
tableId: 'vn-textfield[name="id"]',
tableFutureId: 'vn-textfield[name="futureId"]',
tableLiters: 'vn-textfield[name="liters"]',
tableLines: 'vn-textfield[name="lines"]',
tableStock: 'vn-textfield[name="hasStock"]',
submit: 'vn-submit[label="Search"]',
table: 'tbody > tr:not(.empty-rows)'
},

View File

@ -55,7 +55,7 @@ describe('Ticket Summary path', () => {
let result = await page
.waitToGetProperty(selectors.ticketSummary.firstSaleItemId, 'innerText');
expect(result).toContain('000002');
expect(result).toContain('2');
});
it(`should click on the first sale ID to make the item descriptor visible`, async() => {

View File

@ -4,12 +4,17 @@ import getBrowser from '../../helpers/puppeteer';
describe('Ticket Advance path', () => {
let browser;
let page;
const httpRequests = [];
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('employee', 'ticket');
await page.accessToSection('ticket.advance');
page.on('request', req => {
if (req.url().includes(`Tickets/getTicketsAdvance`))
httpRequests.push(req.url());
});
});
afterAll(async() => {
@ -43,91 +48,74 @@ describe('Ticket Advance path', () => {
it('should search with the required data', async() => {
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.waitToClick(selectors.ticketAdvance.submit);
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
expect(httpRequests.length).toBeGreaterThan(0);
});
it('should search with the origin IPT', async() => {
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.autocompleteSearch(selectors.ticketAdvance.ipt, 'Horizontal');
await page.waitToClick(selectors.ticketAdvance.submit);
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.clearInput(selectors.ticketAdvance.ipt);
await page.waitToClick(selectors.ticketAdvance.submit);
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
});
it('should search with the destination IPT', async() => {
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.autocompleteSearch(selectors.ticketAdvance.futureIpt, 'Horizontal');
await page.waitToClick(selectors.ticketAdvance.submit);
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
const request = httpRequests.find(req => req.includes(('futureIpt=H')));
expect(request).toBeDefined();
httpRequests.splice(httpRequests.indexOf(request), 1);
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.clearInput(selectors.ticketAdvance.futureIpt);
await page.waitToClick(selectors.ticketAdvance.submit);
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
});
it('should search with the origin pending state', async() => {
it('should search with the destination IPT', async() => {
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.waitToClick(selectors.ticketAdvance.futureState);
await page.autocompleteSearch(selectors.ticketAdvance.ipt, 'Horizontal');
await page.waitToClick(selectors.ticketAdvance.submit);
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
const request = httpRequests.find(req => req.includes(('ipt=H')));
expect(request).toBeDefined();
httpRequests.splice(httpRequests.indexOf(request), 1);
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.waitToClick(selectors.ticketAdvance.futureState);
await page.clearInput(selectors.ticketAdvance.ipt);
await page.waitToClick(selectors.ticketAdvance.submit);
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 0);
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.waitToClick(selectors.ticketAdvance.futureState);
await page.waitToClick(selectors.ticketAdvance.submit);
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
});
it('should search with the destination grouped state', async() => {
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.waitToClick(selectors.ticketAdvance.state);
await page.waitToClick(selectors.ticketAdvance.submit);
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 0);
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.waitToClick(selectors.ticketAdvance.state);
await page.waitToClick(selectors.ticketAdvance.submit);
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.waitToClick(selectors.ticketAdvance.state);
await page.waitToClick(selectors.ticketAdvance.submit);
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
});
it('should search in smart-table with an IPT Origin', async() => {
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
await page.autocompleteSearch(selectors.ticketAdvance.tableFutureIpt, 'Vertical');
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
const request = httpRequests.find(req => req.includes(('futureIpt')));
expect(request).toBeDefined();
httpRequests.splice(httpRequests.indexOf(request), 1);
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.waitToClick(selectors.ticketAdvance.submit);
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
});
it('should search in smart-table with an IPT Destination', async() => {
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
await page.autocompleteSearch(selectors.ticketAdvance.tableIpt, 'Vertical');
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
const request = httpRequests.find(req => req.includes(('ipt')));
expect(request).toBeDefined();
httpRequests.splice(httpRequests.indexOf(request), 1);
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
await page.waitToClick(selectors.ticketAdvance.submit);
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
});
it('should check the one ticket and move to the present', async() => {
await page.waitToClick(selectors.ticketAdvance.multiCheck);
it('should check the first ticket and move to the present', async() => {
await page.waitToClick(selectors.ticketAdvance.firstCheck);
await page.waitToClick(selectors.ticketAdvance.moveButton);
await page.waitToClick(selectors.ticketAdvance.acceptButton);
const message = await page.waitForSnackbar();

View File

@ -45,7 +45,7 @@ describe('Claim summary path', () => {
it('should display the claimed line(s)', async() => {
const result = await page.waitToGetProperty(selectors.claimSummary.firstSaleItemId, 'innerText');
expect(result).toContain('000002');
expect(result).toContain('2');
});
it(`should click on the first sale ID making the item descriptor visible`, async() => {

View File

@ -3,5 +3,4 @@ import './ucwords';
import './dash-if-empty';
import './percentage';
import './currency';
import './zero-fill';
import './id';

View File

@ -1,25 +0,0 @@
describe('ZeroFill filter', () => {
let zeroFillFilter;
beforeEach(ngModule('vnCore'));
beforeEach(inject(_zeroFillFilter_ => {
zeroFillFilter = _zeroFillFilter_;
}));
it('should return null for a input null', () => {
expect(zeroFillFilter(null, null)).toBeNull();
});
it('should return a positive number pads a number with five zeros', () => {
expect(zeroFillFilter(1, 5)).toBe('00001');
});
it('should return negative number pads a number with five zeros', () => {
expect(zeroFillFilter(-1, 5)).toBe('-00001');
});
it('should return zero number with zero zeros', () => {
expect(zeroFillFilter(0, 1)).toBe('0');
});
});

View File

@ -1,17 +0,0 @@
import ngModule from '../module';
/**
* Pads a number with zeros.
*
* @param {Number} input The number to pad
* @param {Number} padLength The resulting number of digits
* @return {String} The zero-filled number
*/
export default function zeroFill() {
return function(input, padLength) {
if (input == null) return input;
let sign = Math.sign(input) === -1 ? '-' : '';
return sign + new Array(padLength).concat([Math.abs(input)]).join('0').slice(-padLength);
};
}
ngModule.filter('zeroFill', zeroFill);

View File

@ -32,6 +32,9 @@
.icon-100:before {
content: "\e95a";
}
.icon-clientUnpaid:before {
content: "\e95b";
}
.icon-history:before {
content: "\e968";
}
@ -337,6 +340,9 @@
.icon-solunion:before {
content: "\e94e";
}
.icon-stowaway:before {
content: "\e94f";
}
.icon-splitline:before {
content: "\e93e";
}

View File

@ -82,9 +82,11 @@
<glyph unicode="&#xe948;" glyph-name="linesprepaired" d="M870.4 857.6h-213.333c-21.333 59.733-76.8 102.4-145.067 102.4s-123.733-42.667-145.067-102.4h-213.333c-55.467 0-102.4-46.933-102.4-102.4v-716.8c0-55.467 46.933-102.4 102.4-102.4h716.8c55.467 0 102.4 46.933 102.4 102.4v716.8c0 55.467-46.933 102.4-102.4 102.4zM512 857.6c29.867 0 51.2-21.333 51.2-51.2s-21.333-51.2-51.2-51.2-51.2 21.333-51.2 51.2 21.333 51.2 51.2 51.2zM614.4 140.8h-358.4v102.4h358.4v-102.4zM768 345.6h-512v102.4h512v-102.4zM768 550.4h-512v102.4h512v-102.4z" />
<glyph unicode="&#xe949;" glyph-name="control" d="M418.133 315.733l-128-123.733 256-256 469.333 469.333-128 128-341.333-341.333zM546.133 311.467l34.133 34.133h-68.267zM230.4 128l-59.733 64 153.6 153.6h-68.267v102.4h426.667l204.8 204.8 85.333-85.333v187.733c0 55.467-46.933 102.4-102.4 102.4h-213.333c-21.333 59.733-76.8 102.4-145.067 102.4s-123.733-42.667-145.067-102.4h-213.333c-55.467 0-102.4-46.933-102.4-102.4v-716.8c0-55.467 46.933-102.4 102.4-102.4h273.067l-196.267 192zM512 857.6c29.867 0 51.2-21.333 51.2-51.2s-21.333-51.2-51.2-51.2-51.2 21.333-51.2 51.2c0 29.867 21.333 51.2 51.2 51.2zM256 652.8h512v-102.4h-512v102.4zM665.6-64h204.8c55.467 0 102.4 46.933 102.4 102.4v204.8l-307.2-307.2z" />
<glyph unicode="&#xe94a;" glyph-name="revision" d="M358.4 140.8h-102.4v102.4h81.067c0 0 0 4.267 0 4.267 0 34.133 8.533 68.267 21.333 98.133h-102.4v102.4h170.667c51.2 51.2 123.733 85.333 200.533 102.4h-371.2v102.4h512v-93.867c76.8-8.533 149.333-34.133 204.8-72.533v268.8c0 55.467-46.933 102.4-102.4 102.4h-213.333c-21.333 59.733-76.8 102.4-145.067 102.4s-123.733-42.667-145.067-102.4h-213.333c-55.467 0-102.4-46.933-102.4-102.4v-716.8c0-55.467 46.933-102.4 102.4-102.4h546.133c-157.867 8.533-290.133 89.6-341.333 204.8zM512 857.6c29.867 0 51.2-21.333 51.2-51.2s-21.333-51.2-51.2-51.2-51.2 21.333-51.2 51.2c0 29.867 21.333 51.2 51.2 51.2zM721.067 452.267c-136.533 0-251.733-85.333-302.933-204.8 46.933-119.467 162.133-204.8 302.933-204.8s251.733 85.333 302.933 204.8c-46.933 119.467-162.133 204.8-302.933 204.8zM721.067 110.933c-76.8 0-136.533 59.733-136.533 136.533s64 136.533 136.533 136.533 136.533-64 136.533-136.533-59.733-136.533-136.533-136.533zM721.067 328.533c-46.933 0-81.067-38.4-81.067-81.067s38.4-81.067 81.067-81.067c46.933 0 81.067 38.4 81.067 81.067s-34.133 81.067-81.067 81.067z" />
<glyph unicode="&#xe94b;" glyph-name="deaulter" d="M677.973-64c-30.72 35.84-61.867 70.827-91.307 107.52-40.96 51.2-80.64 103.253-121.173 154.88-16.64 21.333-21.76 20.48-30.72-4.693-13.227-36.693-25.6-73.387-40.107-109.653-5.12-12.8-13.227-26.88-24.32-34.56-51.627-34.987-104.107-69.12-157.867-100.693-10.667-6.4-30.72-5.547-41.813 0.853-8.107 4.693-12.373 23.893-11.093 35.84 0.853 8.96 11.093 19.627 19.627 25.6 39.253 26.453 78.933 51.627 119.040 76.8 18.347 11.52 30.293 26.027 35.84 47.787 12.373 48.213 27.307 95.573 39.253 143.36 8.533 33.707 26.88 58.88 56.32 77.227 40.533 25.173 80.64 52.053 120.747 78.507 6.4 4.267 10.24 11.52 15.36 17.493-7.253 2.56-14.933 7.253-22.187 6.827-75.52-6.4-151.467-13.227-226.987-20.48-2.133 0-4.693-0.853-6.827-0.853-22.613-1.707-39.253 10.24-40.96 29.867s12.373 33.707 35.413 35.84c45.227 4.267 90.88 8.96 136.107 12.8 65.707 5.547 131.84 10.667 197.547 15.36 26.027 1.707 53.76-21.76 67.413-55.467 9.813-23.893 5.12-46.080-18.347-65.28-49.92-40.107-100.693-78.933-151.040-118.187-23.040-17.92-23.893-23.467-6.4-46.507 58.453-78.080 116.48-156.587 174.933-234.667 27.307-36.693 25.173-50.773-12.373-75.52-5.12 0-9.813 0-14.080 0zM791.893 649.813c-43.093 1.28-76.373-31.573-77.227-75.52-0.853-44.373 29.44-76.8 72.107-77.653 45.227-1.28 77.653 29.44 78.080 73.813 0.427 45.227-29.44 78.080-72.96 79.36zM671.147 737.707c0-72.107-34.133-136.107-87.467-176.64l-235.52-21.76c-72.107 36.693-122.027 111.787-122.027 198.4 0 122.88 99.84 222.293 222.72 222.293 122.453 0 222.293-99.413 222.293-222.293zM592.213 680.533l-50.347 18.347c-2.133-8.533-5.12-16.213-9.813-22.613-5.12-6.4-10.24-11.947-16.213-17.067-5.973-4.267-12.373-8.107-19.2-11.093s-13.653-4.693-20.053-5.547c-17.92-2.987-33.707-0.427-48.64 6.827s-26.88 18.347-36.693 32.853l76.373 12.373 7.253 32.427-97.28-15.787c-1.28 5.547-2.987 11.093-3.84 16.64l-0.853 4.267 99.413 16.213 7.253 32.427-106.667-17.493c0.853 9.387 2.987 17.493 6.4 26.027 3.84 8.533 8.107 16.213 14.080 23.040 5.547 6.827 12.8 12.373 21.333 17.067s17.92 8.107 28.587 9.813c6.827 1.28 13.227 1.707 20.907 1.28s14.507-1.707 21.333-3.84c6.827-2.133 13.653-5.973 20.053-10.24 5.973-4.693 11.947-11.093 17.493-18.773l38.827 37.973c-13.227 17.92-30.293 31.147-52.053 39.253-21.76 8.533-46.080 10.667-73.387 6.4-19.627-2.987-36.267-9.387-51.2-17.92-14.507-8.533-26.88-19.2-37.547-32-10.667-12.373-18.773-26.027-23.893-40.96-5.547-14.507-8.96-29.867-9.813-45.653l-21.76-3.84-7.253-32.427 29.013 4.693 0.427-2.987c1.28-6.827 2.56-12.8 4.267-18.347l-23.467-3.84-8.107-32.427 43.52 7.253c6.827-13.653 15.787-26.027 26.027-36.693 10.24-11.52 22.187-20.48 35.413-27.733 13.227-7.68 27.307-12.8 42.667-15.787s31.573-3.413 47.36-0.853c12.373 2.133 24.32 5.12 35.84 10.667s22.613 11.52 32.853 19.2c10.24 8.107 18.347 16.64 26.027 26.453 6.827 9.387 12.373 20.48 15.36 32.427z" />
<glyph unicode="&#xe94b;" glyph-name="defaulter" d="M677.973-64c-30.72 35.84-61.867 70.827-91.307 107.52-40.96 51.2-80.64 103.253-121.173 154.88-16.64 21.333-21.76 20.48-30.72-4.693-13.227-36.693-25.6-73.387-40.107-109.653-5.12-12.8-13.227-26.88-24.32-34.56-51.627-34.987-104.107-69.12-157.867-100.693-10.667-6.4-30.72-5.547-41.813 0.853-8.107 4.693-12.373 23.893-11.093 35.84 0.853 8.96 11.093 19.627 19.627 25.6 39.253 26.453 78.933 51.627 119.040 76.8 18.347 11.52 30.293 26.027 35.84 47.787 12.373 48.213 27.307 95.573 39.253 143.36 8.533 33.707 26.88 58.88 56.32 77.227 40.533 25.173 80.64 52.053 120.747 78.507 6.4 4.267 10.24 11.52 15.36 17.493-7.253 2.56-14.933 7.253-22.187 6.827-75.52-6.4-151.467-13.227-226.987-20.48-2.133 0-4.693-0.853-6.827-0.853-22.613-1.707-39.253 10.24-40.96 29.867s12.373 33.707 35.413 35.84c45.227 4.267 90.88 8.96 136.107 12.8 65.707 5.547 131.84 10.667 197.547 15.36 26.027 1.707 53.76-21.76 67.413-55.467 9.813-23.893 5.12-46.080-18.347-65.28-49.92-40.107-100.693-78.933-151.040-118.187-23.040-17.92-23.893-23.467-6.4-46.507 58.453-78.080 116.48-156.587 174.933-234.667 27.307-36.693 25.173-50.773-12.373-75.52-5.12 0-9.813 0-14.080 0zM791.893 649.813c-43.093 1.28-76.373-31.573-77.227-75.52-0.853-44.373 29.44-76.8 72.107-77.653 45.227-1.28 77.653 29.44 78.080 73.813 0.427 45.227-29.44 78.080-72.96 79.36zM671.147 737.707c0-72.107-34.133-136.107-87.467-176.64l-235.52-21.76c-72.107 36.693-122.027 111.787-122.027 198.4 0 122.88 99.84 222.293 222.72 222.293 122.453 0 222.293-99.413 222.293-222.293zM592.213 680.533l-50.347 18.347c-2.133-8.533-5.12-16.213-9.813-22.613-5.12-6.4-10.24-11.947-16.213-17.067-5.973-4.267-12.373-8.107-19.2-11.093s-13.653-4.693-20.053-5.547c-17.92-2.987-33.707-0.427-48.64 6.827s-26.88 18.347-36.693 32.853l76.373 12.373 7.253 32.427-97.28-15.787c-1.28 5.547-2.987 11.093-3.84 16.64l-0.853 4.267 99.413 16.213 7.253 32.427-106.667-17.493c0.853 9.387 2.987 17.493 6.4 26.027 3.84 8.533 8.107 16.213 14.080 23.040 5.547 6.827 12.8 12.373 21.333 17.067s17.92 8.107 28.587 9.813c6.827 1.28 13.227 1.707 20.907 1.28s14.507-1.707 21.333-3.84c6.827-2.133 13.653-5.973 20.053-10.24 5.973-4.693 11.947-11.093 17.493-18.773l38.827 37.973c-13.227 17.92-30.293 31.147-52.053 39.253-21.76 8.533-46.080 10.667-73.387 6.4-19.627-2.987-36.267-9.387-51.2-17.92-14.507-8.533-26.88-19.2-37.547-32-10.667-12.373-18.773-26.027-23.893-40.96-5.547-14.507-8.96-29.867-9.813-45.653l-21.76-3.84-7.253-32.427 29.013 4.693 0.427-2.987c1.28-6.827 2.56-12.8 4.267-18.347l-23.467-3.84-8.107-32.427 43.52 7.253c6.827-13.653 15.787-26.027 26.027-36.693 10.24-11.52 22.187-20.48 35.413-27.733 13.227-7.68 27.307-12.8 42.667-15.787s31.573-3.413 47.36-0.853c12.373 2.133 24.32 5.12 35.84 10.667s22.613 11.52 32.853 19.2c10.24 8.107 18.347 16.64 26.027 26.453 6.827 9.387 12.373 20.48 15.36 32.427z" />
<glyph unicode="&#xe94c;" glyph-name="services" d="M951.467 217.6c0 8.533 0 21.333 0 29.867s0 21.333-4.267 29.867l64 51.2c4.267 4.267 8.533 12.8 4.267 21.333l-64 106.667c-4.267 8.533-12.8 8.533-17.067 8.533l-76.8-29.867c-17.067 12.8-34.133 21.333-51.2 29.867l-12.8 81.067c0 8.533-8.533 12.8-17.067 12.8h-123.733c-8.533 0-12.8-4.267-17.067-12.8l-12.8-81.067c-17.067-8.533-38.4-17.067-51.2-29.867l-76.8 29.867c-8.533 4.267-17.067 0-17.067-8.533l-64-106.667c-4.267-8.533-4.267-17.067 4.267-21.333l64-51.2c0-8.533-4.267-21.333-4.267-29.867s0-21.333 4.267-29.867l-55.467-51.2c-4.267-4.267-8.533-12.8-4.267-21.333l64-106.667c4.267-8.533 12.8-8.533 17.067-8.533l76.8 29.867c17.067-12.8 34.133-21.333 51.2-29.867l12.8-81.067c0-8.533 8.533-12.8 17.067-12.8h123.733c8.533 0 12.8 4.267 17.067 12.8l12.8 81.067c17.067 8.533 38.4 17.067 51.2 29.867l76.8-29.867c8.533-4.267 17.067 0 17.067 8.533l64 106.667c4.267 8.533 4.267 17.067-4.267 21.333 0 0-68.267 51.2-68.267 51.2zM721.067 132.267c-64 0-115.2 51.2-115.2 115.2s51.2 115.2 115.2 115.2 115.2-51.2 115.2-115.2c0-64-51.2-115.2-115.2-115.2zM345.6 174.933h-89.6v102.4h81.067c4.267 34.133 8.533 68.267 21.333 102.4h-102.4v102.4h162.133c34.133 42.667 72.533 76.8 119.467 102.4h-281.6v102.4h520.533v-59.733c51.2-8.533 102.4-25.6 145.067-51.2v281.6c0 55.467-46.933 102.4-102.4 102.4h-622.933c-55.467 0-102.4-46.933-102.4-102.4v-819.2c0-55.467 46.933-102.4 102.4-102.4h302.933c-81.067 55.467-136.533 140.8-153.6 238.933z" />
<glyph unicode="&#xe94d;" glyph-name="albaran" d="M819.2 960h-622.933c-55.467 0-102.4-46.933-102.4-102.4v-819.2c0-55.467 46.933-102.4 102.4-102.4h622.933c55.467 0 102.4 46.933 102.4 102.4v819.2c0 55.467-46.933 102.4-102.4 102.4zM358.4 174.933h-102.4v102.4h503.467v-102.4h-401.067zM256 379.733v102.4h503.467v-102.4h-503.467zM759.467 584.533h-503.467v102.4h503.467v-102.4z" />
<glyph unicode="&#xe94e;" glyph-name="solunion" d="M759.467 870.4v-136.533h-601.6c0 0-128-341.333 106.667-341.333s469.333 0 469.333 0 34.133 0 34.133-34.133-8.533-98.133-8.533-98.133h-541.867c0 0-247.467 29.867-204.8 320 0 0 8.533 140.8 72.533 298.667 0 0 21.333-8.533 85.333-8.533h588.8zM853.333 25.6c64 0 85.333-8.533 85.333-8.533 64 153.6 72.533 298.667 72.533 298.667 42.667 290.133-204.8 320-204.8 320h-541.867c0 0-8.533-64-8.533-98.133s34.133-34.133 34.133-34.133 238.933 0 469.333 0 106.667-341.333 106.667-341.333h-601.6v-136.533h588.8z" />
<glyph unicode="&#xe94f;" glyph-name="stowaway" d="M1006.933 452.267l-260.267 106.667 29.867 29.867c4.267 4.267 4.267 12.8 4.267 17.067-4.267 4.267-8.533 8.533-12.8 8.533h-157.867c0 93.867 76.8 157.867 174.933 157.867 4.267 0 8.533 4.267 12.8 8.533s4.267 8.533 0 17.067l-81.067 153.6c-4.267 0-12.8 4.267-17.067 4.267-46.933 0-93.867-17.067-132.267-42.667-21.333-17.067-42.667-38.4-55.467-59.733-12.8 21.333-29.867 42.667-55.467 59.733-34.133 12.8-81.067 34.133-128 34.133-4.267 0-12.8-4.267-12.8-8.533l-85.333-153.6c-4.267-4.267-4.267-4.267 0-12.8 4.267-4.267 8.533-8.533 12.8-8.533 98.133 0 174.933-59.733 174.933-153.6v0h-140.8c-4.267 0-12.8-4.267-12.8-8.533-8.533-4.267-4.267-17.067 0-21.333l21.333-21.333-277.333-110.933c-8.533-8.533-12.8-12.8-8.533-21.333 0-8.533 8.533-12.8 17.067-12.8v0l98.133 4.267-81.067-85.333c0-4.267-4.267-8.533 0-12.8 0-4.267 4.267-8.533 8.533-8.533l85.333-34.133v-179.2c0-8.533 4.267-12.8 8.533-12.8l358.4-145.067h8.533l358.4 145.067c4.267 4.267 8.533 8.533 8.533 12.8v179.2l85.333 34.133c4.267 0 8.533 4.267 8.533 8.533s0 8.533-4.267 12.8l-68.267 98.133 102.4-4.267c8.533 0 12.8 4.267 17.067 12.8 8.533 0 4.267 4.267-4.267 12.8zM110.933 456.533l196.267 76.8 8.533-8.533-166.4-64-38.4-4.267zM153.6 285.867v0l-68.267 34.133 68.267 98.133 328.533-132.267-68.267-98.133-260.267 98.133zM490.667-29.867l-328.533 132.267v153.6l243.2-98.133h12.8c0 0 0 0 4.267 0v0c0 0 4.267 0 4.267 4.267l64 85.333c0-4.267 0-277.333 0-277.333zM490.667 324.267l-298.667 115.2 149.333 64 153.6-157.867v-17.067h-4.267zM529.067 337.067l157.867 157.867 140.8-55.467-298.667-115.2c0 0 0 12.8 0 12.8zM849.067 102.4l-328.533-132.267v281.6l64-85.333c0 0 0-4.267 4.267-4.267v0h17.067l243.2 98.133v-157.867zM938.667 324.267l-324.267-132.267-68.267 98.133 328.533 132.267 64-98.133zM870.4 460.8l-157.867 64 12.8 8.533 187.733-76.8-42.667 4.267z" />
<glyph unicode="&#xe950;" glyph-name="agency-term" d="M789.333 266.667c-55.467 0-102.4-46.933-102.4-102.4s46.933-102.4 102.4-102.4c55.467 0 102.4 46.933 102.4 102.4 0 59.733-46.933 102.4-102.4 102.4zM789.333 113.067c-29.867 0-51.2 21.333-51.2 51.2s21.333 51.2 51.2 51.2c29.867 0 51.2-21.333 51.2-51.2 0-25.6-25.6-51.2-51.2-51.2zM251.733 266.667c-55.467 0-102.4-46.933-102.4-102.4s46.933-102.4 102.4-102.4 102.4 46.933 102.4 102.4c0 59.733-46.933 102.4-102.4 102.4zM251.733 113.067c-29.867 0-51.2 21.333-51.2 51.2s21.333 51.2 51.2 51.2 51.2-21.333 51.2-51.2c0-25.6-25.6-51.2-51.2-51.2zM1006.933 539.733l-196.267 192c-12.8 12.8-29.867 17.067-46.933 17.067h-98.133v38.4c0 25.6-21.333 51.2-51.2 51.2h-563.2c-29.867 0-51.2-21.333-51.2-51.2v-554.667c0-29.867 25.6-51.2 51.2-51.2h68.267c8.533 64 64 115.2 132.267 115.2 64 0 123.733-51.2 132.267-115.2h268.8c8.533 64 64 115.2 132.267 115.2s128-51.2 136.533-115.2h51.2c29.867 0 51.2 25.6 51.2 51.2v260.267c0 17.067-8.533 34.133-17.067 46.933v0zM725.333 684.8c0 4.267 4.267 8.533 8.533 8.533h34.133c0 0 4.267 0 4.267-4.267l153.6-145.067c4.267 0 0-12.8-4.267-12.8h-187.733c-8.533 0-8.533 4.267-8.533 8.533v145.067zM509.013 556.373c0-113.92-92.16-206.080-206.080-206.080s-206.080 92.16-206.080 206.080 92.16 206.507 206.080 206.507 206.080-92.587 206.080-206.507zM342.613 494.080h-87.893l-15.36-40.107h-78.933l100.693 230.827h76.373l100.693-230.827h-80.213l-15.36 40.107zM321.28 550.4l-22.613 58.027-22.187-58.027h44.8z" />
<glyph unicode="&#xe951;" glyph-name="apps" d="M0 704h256v256h-256v-256zM384-64h256v256h-256v-256zM0-64h256v256h-256v-256zM0 320h256v256h-256v-256zM384 320h256v256h-256v-256zM768 960v-256h256v256h-256zM384 704h256v256h-256v-256zM768 320h256v256h-256v-256zM768-64h256v256h-256v-256z" />
<glyph unicode="&#xe952;" glyph-name="info" d="M512 960c-281.6 0-512-230.4-512-512s230.4-512 512-512 512 230.4 512 512-230.4 512-512 512zM563.2 192h-102.4v307.2h102.4v-307.2zM563.2 601.6h-102.4v102.4h102.4v-102.4z" />
@ -96,6 +98,7 @@
<glyph unicode="&#xe958;" glyph-name="headercol" d="M362.667-64h302.933v678.4h-302.933v-678.4zM0-64h302.933v678.4h-302.933v-678.4zM721.067 614.4v-678.4h302.933v678.4h-302.933zM362.667 678.4h302.933v281.6h-302.933v-281.6zM0 678.4h302.933v281.6h-302.933v-281.6zM721.067 960v-281.6h302.933v281.6h-302.933z" />
<glyph unicode="&#xe959;" glyph-name="reserva" d="M841.6 864c48 0 86.4-38.4 86.4-86.4v-662.4c0-48-38.4-86.4-86.4-86.4h-659.2c-48 3.2-86.4 41.6-86.4 89.6v659.2c0 48 38.4 86.4 86.4 86.4h659.2zM841.6 960h-659.2c-99.2 0-182.4-83.2-182.4-182.4v-662.4c0-96 83.2-179.2 182.4-179.2h662.4c99.2 0 182.4 83.2 182.4 182.4v659.2c-3.2 99.2-86.4 182.4-185.6 182.4v0zM611.2 192l-99.2 144h-108.8v-144h-118.4v512h220.8c44.8 0 83.2-6.4 118.4-22.4 32-16 57.6-35.2 76.8-64s25.6-60.8 25.6-99.2c0-38.4-9.6-70.4-28.8-99.2s-44.8-48-76.8-64l115.2-163.2h-124.8zM582.4 585.6c-19.2 16-44.8 22.4-80 22.4h-96v-179.2h96c35.2 0 64 6.4 80 22.4 19.2 16 28.8 38.4 28.8 67.2-3.2 28.8-9.6 51.2-28.8 67.2z" />
<glyph unicode="&#xe95a;" glyph-name="100" d="M640 38.4l-17.067-17.067h-213.333v153.6h-153.6v102.4h200.533l102.4 102.4h-302.933v102.4h405.333l102.4 102.4h-507.733v102.4h520.533v-89.6l72.533 72.533c17.067 17.067 42.667 29.867 68.267 29.867 4.267 0 8.533 0 8.533 0v157.867c0 55.467-46.933 102.4-102.4 102.4h-627.2c-55.467 0-102.4-46.933-102.4-102.4v-819.2c0-55.467 46.933-102.4 102.4-102.4h627.2c55.467 0 102.4 46.933 102.4 102.4v285.867l-285.867-285.867zM917.333 635.733c8.533 0 17.067-4.267 21.333-8.533l76.8-76.8c12.8-12.8 12.8-34.133 0-46.933l-64-64-119.467 119.467 64 64c4.267 8.533 12.8 12.8 21.333 12.8zM797.867 529.067l119.467-123.733-320-320h-123.733v119.467l324.267 324.267z" />
<glyph unicode="&#xe95b;" glyph-name="clientUnpaid" horiz-adv-x="1135" d="M1135.22-64v47.845h-84.359v927.41l8.574 0.42c3.118 0.18 6.295 0.36 9.473 0.36h23.683c14.21 0.060 28.36 0.060 42.569 0.060v47.905c-314.713-0.18-629.485-0.24-944.258-0.24h-190.902v-47.726h83.16s0-928.069 0-928.069h-83.16v-47.726h140.898c331.44 0 662.881 0 994.321-0.24zM821.526 911.255h180.17v-926.93h-180.17v926.93zM591.892 911.735h180.11v-926.93h-180.11v926.87zM362.258 911.735h180.17v-926.93h-180.17v926.93zM132.624 911.255h180.17v-926.93h-180.17v926.93zM748.139 719.694c4.916-1.079 9.653-2.578 14.27-4.197v142.157c-7.555 1.739-15.169 3.358-22.963 4.737-16.668 2.818-33.576 4.437-50.364 6.595h-52.642c-2.938-0.48-5.876-1.199-8.814-1.439-8.754-0.719-17.507-1.679-26.141-2.998v-144.735c47.785 14.569 97.19 10.732 146.654-0.060zM878.545 627.6c27.82 34.775 55.94 69.969 84.179 105.284-38.072 44.428-81.661 78.543-131.605 101.447v-162.842c16.368-13.61 31.357-28.899 47.426-43.828zM467.003 283.809c-0.3 0.6 0 1.559 0 3.058h65.892v101.806h-97.43c-6.535 32.437-3.477 64.693-4.257 97.849h101.687v101.866h-74.706c0.060 1.439 0 2.039 0.18 2.458 18.107 37.653 42.509 69.43 74.526 93.652v161.403c-3.298-1.379-6.655-2.818-9.893-4.317-60.496-28.599-111.34-66.012-151.091-113.438v-564.612c37.953-46.646 86.997-82.8 147.194-108.342 4.557-1.919 9.173-3.717 13.79-5.456v153.489c-26.921 20.505-48.445 48.085-65.832 80.702zM297.925 591.806c-1.919-6.056-4.617-7.794-10.852-7.734-35.075 0.3-70.149 0.18-105.224 0.18h-9.293v-93.652h100.787c0.899-33.156 1.799-65.233 2.758-98.149h-103.605v-101.746h9.293c36.693 0 73.447-0.36 110.14 0.24 5.276 0.12 8.694-0.839 11.212-3.238v319.389c-1.799-5.036-3.657-10.073-5.276-15.289zM736.688 286.866v101.806h-135.202v-101.806h135.202zM736.808 588.329h-135.322v-101.866h135.322v101.866zM954.27 163.236c-28.419 34.055-56.539 67.811-83.999 100.727-13.31-10.972-26.201-21.884-39.152-32.556v-169.258c13.49 6.415 26.681 13.79 39.571 22.304 32.257 21.345 59.777 47.726 83.58 78.783zM615.215 167.493c-4.677 0.839-9.233 1.799-13.73 2.938v-138.68c32.017-5.036 64.633-5.816 97.789-3.178 21.524 1.739 42.629 4.916 63.134 9.773v145.695c-45.447-21.524-95.031-25.781-147.194-16.548z" />
<glyph unicode="&#xe95d;" glyph-name="sign" d="M725.333 960c72.533-72.533 145.067-145.067 217.6-217.6-4.267-4.267-8.533-12.8-17.067-17.067-179.2-179.2-358.4-362.667-537.6-541.867-8.533-8.533-25.6-17.067-38.4-21.333-81.067-21.333-166.4-42.667-247.467-64-4.267 0-12.8-4.267-21.333-4.267 0 8.533 0 17.067 4.267 21.333 21.333 85.333 42.667 166.4 64 251.733 4.267 8.533 8.533 21.333 17.067 25.6 183.467 187.733 371.2 371.2 554.667 554.667 0 8.533 0 12.8 4.267 12.8zM849.067 25.6c-25.6-21.333-46.933-42.667-72.533-59.733-29.867-17.067-59.733-25.6-89.6-29.867-21.333-4.267-42.667 0-55.467 12.8-12.8 8.533-25.6 46.933-38.4 51.2-4.267 0-12.8 0-17.067-4.267-68.267-25.6-145.067-55.467-221.867-55.467-106.667 0-209.067 0-315.733 0-4.267 0-8.533 0-12.8 0-4.267 4.267-12.8 8.533-12.8 12.8s8.533 12.8 12.8 17.067c4.267 4.267 12.8 0 21.333 0 102.4 0 204.8 0 307.2 4.267 76.8 0 153.6 25.6 221.867 64 8.533 4.267 12.8 12.8 12.8 21.333 4.267 55.467 12.8 106.667 42.667 153.6 17.067 29.867 42.667 51.2 81.067 55.467 55.467 0 85.333-38.4 64-89.6-17.067-34.133-42.667-64-64-89.6-21.333-21.333-51.2-38.4-72.533-55.467-4.267-4.267-8.533-17.067-8.533-21.333 8.533-34.133 29.867-51.2 59.733-42.667 29.867 4.267 59.733 17.067 81.067 34.133 25.6 17.067 46.933 42.667 72.533 64 8.533 8.533 17.067 21.333 29.867 25.6 8.533 4.267 21.333 8.533 29.867 4.267 4.267-4.267 8.533-21.333 4.267-29.867-8.533-21.333-17.067-42.667-25.6-64-4.267-8.533-8.533-25.6 0-34.133s29.867-4.267 38.4 4.267c25.6 17.067 51.2 34.133 72.533 55.467 8.533 8.533 17.067 17.067 25.6 8.533 4.267-4.267 4.267-21.333 0-29.867-25.6-34.133-59.733-59.733-102.4-72.533-46.933-12.8-76.8 17.067-68.267 64-4.267 12.8-4.267 17.067 0 25.6zM618.667 72.533c0 0 0-4.267 0-4.267s4.267 0 4.267 0c29.867 25.6 59.733 51.2 85.333 81.067 12.8 12.8 21.333 34.133 29.867 51.2 8.533 21.333 0 34.133-21.333 38.4-25.6 4.267-42.667-8.533-55.467-25.6-29.867-46.933-38.4-93.867-42.667-140.8z" />
<glyph unicode="&#xe95e;" glyph-name="polizon" d="M1011.2 456.533l-264.533 106.667 29.867 29.867c4.267 4.267 4.267 12.8 4.267 17.067-4.267 4.267-8.533 8.533-12.8 8.533h-157.867c0 93.867 76.8 157.867 174.933 157.867 4.267 0 8.533 4.267 12.8 8.533s4.267 8.533 0 17.067l-81.067 153.6c-4.267 0-12.8 4.267-17.067 4.267-46.933 0-93.867-17.067-132.267-42.667-25.6-17.067-42.667-38.4-55.467-59.733-12.8 25.6-29.867 42.667-55.467 59.733-38.4 25.6-85.333 42.667-132.267 42.667-4.267 0-12.8-4.267-12.8-8.533l-81.067-153.6c-4.267-4.267-4.267-8.533 0-17.067 4.267-4.267 8.533-8.533 12.8-8.533 98.133 0 174.933-59.733 174.933-153.6v0h-140.8c-4.267 0-12.8-4.267-12.8-8.533-4.267-4.267 0-12.8 4.267-17.067l21.333-21.333-277.333-110.933c-8.533-8.533-12.8-12.8-8.533-21.333 0-8.533 8.533-12.8 17.067-12.8 0 0 0 0 0 0l98.133 4.267-76.8-98.133c0-4.267-4.267-8.533 0-12.8 0-4.267 4.267-8.533 8.533-8.533l85.333-34.133v-179.2c0-8.533 4.267-12.8 8.533-12.8l362.667-145.067c0 0 4.267 0 4.267 0s4.267 0 4.267 0l362.667 145.067c4.267 4.267 8.533 8.533 8.533 12.8v179.2l85.333 34.133c4.267 0 8.533 4.267 8.533 8.533s0 8.533-4.267 12.8l-72.533 98.133 102.4-4.267c8.533 0 12.8 4.267 17.067 12.8 0 8.533-4.267 12.8-12.8 17.067zM110.933 460.8l200.533 81.067 8.533-8.533-170.667-68.267-38.4-4.267zM153.6 294.4v4.267l-72.533 29.867 72.533 98.133 328.533-132.267-72.533-98.133-256 102.4v-4.267zM494.933-25.6l-328.533 132.267v153.6l243.2-98.133c0 0 4.267 0 4.267 0h4.267c0 0 4.267 0 4.267 0v0c0 0 0 0 4.267 0v0c0 0 4.267 0 4.267 4.267l64 85.333v-277.333zM494.933 328.533l-302.933 119.467 149.333 59.733 153.6-162.133v-17.067zM529.067 345.6l162.133 157.867 140.8-55.467-302.933-119.467v17.067zM857.6 106.667l-328.533-132.267v281.6l64-85.333c0 0 0-4.267 4.267-4.267v0c0 0 4.267 0 4.267 0v0c0 0 4.267 0 4.267 0v0 0c0 0 4.267 0 4.267 0l243.2 98.133v-157.867zM942.933 328.533l-328.533-132.267-72.533 98.133 328.533 132.267 72.533-98.133zM874.667 465.067l-162.133 64 12.8 8.533 187.733-76.8-38.4 4.267z" />
<glyph unicode="&#xe95f;" glyph-name="solclaim" d="M1024 917.333v-938.667h-938.667v68.267h234.667v51.2h38.4c8.533-4.267 17.067-4.267 29.867-4.267h298.667c42.667 0 76.8 34.133 76.8 76.8 0 0 0 0 0 0 29.867 12.8 46.933 38.4 46.933 72.533 0 0 0 0 0 0 29.867 12.8 46.933 38.4 46.933 72.533s-21.333 59.733-46.933 72.533c0 0 0 0 0 0 0 42.667-34.133 76.8-76.8 76.8h-106.667c21.333 21.333 29.867 55.467 17.067 89.6-12.8 25.6-38.4 42.667-68.267 42.667-12.8 0-21.333-4.267-34.133-8.533l-217.6-98.133v29.867h-238.933v396.8h362.667v-209.067h209.067v209.067h366.933zM0 89.6h281.6v51.2h89.6c4.267-4.267 12.8-4.267 17.067-4.267h298.667c21.333 0 34.133 12.8 34.133 34.133s-12.8 34.133-34.133 34.133h-136.533v12.8h183.467c21.333 0 34.133 12.8 34.133 29.867 0 21.333-12.8 29.867-34.133 29.867h-179.2v12.8h234.667c21.333 0 34.133 8.533 34.133 29.867s-12.8 29.867-34.133 29.867h-230.4v12.8h183.467c21.333 0 29.867 12.8 29.867 34.133s-12.8 34.133-34.133 34.133h-230.4l93.867 64c12.8 8.533 21.333 29.867 12.8 46.933s-29.867 25.6-51.2 17.067l-251.733-119.467c-4.267 0-4.267-4.267-8.533-4.267-4.267-4.267-8.533-8.533-12.8-12.8h-8.533v55.467h-281.6v-388.267z" />
@ -128,4 +131,4 @@
<glyph unicode="&#xe980;" glyph-name="grid" d="M0 704h256v256h-256v-256zM384-64h256v256h-256v-256zM0-64h256v256h-256v-256zM0 320h256v256h-256v-256zM384 320h256v256h-256v-256zM768 960v-256h256v256h-256zM384 704h256v256h-256v-256zM768 320h256v256h-256v-256zM768-64h256v256h-256v-256z" />
<glyph unicode="&#xe982;" glyph-name="web" d="M827.733 533.333c-29.867 145.067-157.867 256-315.733 256-123.733 0-230.4-68.267-285.867-170.667-128-17.067-226.133-123.733-226.133-256 0-140.8 115.2-256 256-256h554.667c119.467 0 213.333 93.867 213.333 213.333 0 110.933-85.333 204.8-196.267 213.333z" />
<glyph unicode="&#xe984;" glyph-name="dfiscales" d="M140.8 520.533v-341.333h149.333v341.333h-149.333zM439.467 520.533v-341.333h149.333v341.333h-149.333zM38.4-64h942.933v145.067h-942.933v-145.067zM733.867 520.533v-341.333h149.333v341.333h-149.333zM512 960l-473.6-243.2v-98.133h942.933v98.133l-469.333 243.2z" />
</font></defs></svg>
</font></defs></svg>

Before

Width:  |  Height:  |  Size: 157 KiB

After

Width:  |  Height:  |  Size: 162 KiB

View File

@ -0,0 +1,17 @@
module.exports = Self => {
Self.remoteMethodCtx('post', {
description: 'Returns the sent parameters',
returns: {
type: 'object',
root: true
},
http: {
path: `/post`,
verb: 'POST'
}
});
Self.post = async ctx => {
return ctx.req.body;
};
};

View File

@ -1,4 +1,5 @@
module.exports = function(Self) {
require('../methods/application/status')(Self);
require('../methods/application/post')(Self);
};

View File

@ -7,6 +7,12 @@
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
},
{
"property": "post",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]
}

View File

@ -4,7 +4,7 @@ module.exports = () => {
if (!env || env === 'development')
return new Date(Date.UTC(2001, 0, 1, 11));
return new Date(Date.UTC());
return new Date();
};
Date.vnNew = () => {

View File

@ -101,7 +101,7 @@
<vn-span
ng-click="itemDescriptor.show($event, saleClaimed.itemFk)"
class="link">
{{::saleClaimed.itemFk | zeroFill:6}}
{{::saleClaimed.itemFk}}
</vn-span>
</td>
<td number>

View File

@ -115,7 +115,7 @@
<span
ng-click="itemDescriptor.show($event, saleClaimed.sale.itemFk, saleClaimed.sale.id)"
class="link">
{{::saleClaimed.sale.itemFk | zeroFill:6}}
{{::saleClaimed.sale.itemFk}}
</span>
</vn-td>
<vn-td expand>{{::saleClaimed.sale.ticket.landed | date: 'dd/MM/yyyy'}}</vn-td>
@ -241,7 +241,7 @@
<span
ng-click="itemDescriptor.show($event, action.sale.itemFk, action.sale.id)"
class="link">
{{::action.sale.itemFk | zeroFill:6}}
{{::action.sale.itemFk}}
</span>
</vn-td>
<vn-td number>

View File

@ -67,7 +67,7 @@ module.exports = function(Self) {
try {
delete args.ctx; // Remove unwanted properties
const newReceipt = await models.Receipt.create(args, myOptions);
const originalClient = await models.Client.findById(args.clientFk, null, myOptions);
const bank = await models.Bank.findById(args.bankFk, null, myOptions);
const accountingType = await models.AccountingType.findById(bank.accountingTypeFk, null, myOptions);
@ -76,23 +76,8 @@ module.exports = function(Self) {
if (!args.compensationAccount)
throw new UserError('Compensation account is empty');
const supplierCompensation = await models.Supplier.findOne({
where: {
account: args.compensationAccount
}
}, myOptions);
let clientCompensation = {};
if (!supplierCompensation) {
clientCompensation = await models.Client.findOne({
where: {
accountingAccount: args.compensationAccount
}
}, myOptions);
}
if (!supplierCompensation && !clientCompensation)
throw new UserError('Invalid account');
// Check compensation account exists
await models.Client.getClientOrSupplierReference(args.compensationAccount, myOptions);
await Self.rawSql(
`CALL vn.ledger_doCompensation(?, ?, ?, ?, ?, ?, ?)`,
@ -151,7 +136,7 @@ module.exports = function(Self) {
myOptions
);
}
const newReceipt = await models.Receipt.create(args, myOptions);
if (tx) await tx.commit();
return newReceipt;

View File

@ -0,0 +1,57 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethod('getClientOrSupplierReference', {
description: 'Returns the reference of a compensation providing a bank account',
accessType: 'READ',
accepts: {
arg: 'bankAccount',
type: 'number',
required: true,
description: 'The bank account of a client or a supplier'
},
returns: {
type: 'string',
root: true
},
http: {
path: `/getClientOrSupplierReference`,
verb: 'GET'
}
});
Self.getClientOrSupplierReference = async(bankAccount, options) => {
const models = Self.app.models;
const myOptions = {};
let reference = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
const supplierCompensation = await models.Supplier.findOne({
where: {
account: bankAccount
}
}, myOptions);
reference.supplierId = supplierCompensation?.id;
reference.supplierName = supplierCompensation?.name;
let clientCompensation = {};
if (!supplierCompensation) {
clientCompensation = await models.Client.findOne({
where: {
accountingAccount: bankAccount
}
}, myOptions);
reference.clientId = clientCompensation?.id;
reference.clientName = clientCompensation?.name;
}
if (!supplierCompensation && !clientCompensation)
throw new UserError('Invalid account');
return reference;
};
};

View File

@ -47,4 +47,5 @@ module.exports = Self => {
require('../methods/client/incotermsAuthorizationEmail')(Self);
require('../methods/client/consumptionSendQueued')(Self);
require('../methods/client/filter')(Self);
require('../methods/client/getClientOrSupplierReference')(Self);
};

View File

@ -11,7 +11,7 @@
</vn-crud-model>
<vn-horizontal>
<vn-date-picker
label="Date"
label="Date"
ng-model="$ctrl.receipt.payed"
required="true">
</vn-date-picker>
@ -48,6 +48,14 @@
max="$ctrl.maxAmount">
</vn-input-number>
</vn-horizontal>
<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>
<vn-horizontal>
<vn-textfield
label="Reference"
@ -71,17 +79,9 @@
</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>
<vn-horizontal ng-show="$ctrl.bankSelection.accountingType.code == 'cash'">
<vn-check
label="View receipt"
<vn-check
label="View receipt"
ng-model="$ctrl.viewReceipt">
</vn-check>
</vn-horizontal>
@ -89,4 +89,4 @@
<tpl-buttons>
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
<button response="accept" translate vn-focus>Accept</button>
</tpl-buttons>
</tpl-buttons>

View File

@ -61,12 +61,15 @@ class Controller extends Dialog {
this.receipt.description = [];
this.viewReceipt = accountingType.code == 'cash';
if (accountingType.receiptDescription != null && accountingType.receiptDescription != '')
this.receipt.description.push(accountingType.receiptDescription);
if (this.originalDescription)
this.receipt.description.push(this.originalDescription);
this.receipt.description.join(', ');
if (accountingType.code == 'compensation')
this.receipt.description = '';
else {
if (accountingType.receiptDescription != null && accountingType.receiptDescription != '')
this.receipt.description.push(accountingType.receiptDescription);
if (this.originalDescription)
this.receipt.description.push(this.originalDescription);
this.receipt.description.join(', ');
}
this.maxAmount = accountingType && accountingType.maxAmount;
this.receipt.payed = Date.vnNew();
@ -112,7 +115,25 @@ class Controller extends Dialog {
}
accountShortToStandard(value) {
this.receipt.compensationAccount = value.replace('.', '0'.repeat(11 - value.length));
if (value) {
this.receipt.compensationAccount = value.replace('.', '0'.repeat(11 - value.length));
const params = {bankAccount: this.receipt.compensationAccount};
this.$http.get(`Clients/getClientOrSupplierReference`, {params})
.then(res => {
if (res.data.clientId) {
this.receipt.description = this.$t('Client Compensation Reference', {
clientId: res.data.clientId,
clientName: res.data.clientName
});
} else {
this.receipt.description = this.$t('Supplier Compensation Reference', {
supplierId: res.data.supplierId,
supplierName: res.data.supplierName
});
}
});
} else
this.receipt.description = '';
}
getAmountPaid() {

View File

@ -1,2 +1,4 @@
View receipt: Ver recibo
Amount exceeded: Según ley contra el fraude no se puede recibir cobros por importe igual o superior a {{maxAmount}}
Amount exceeded: Según ley contra el fraude no se puede recibir cobros por importe igual o superior a {{maxAmount}}
Client Compensation Reference: "({{clientId}}) Ntro Cliente: {{clientName}}"
Supplier Compensation Reference: "({{supplierId}}) Ntro Proveedor: {{supplierName}}"

View File

@ -1,3 +1,4 @@
const LoopBackContext = require('loopback-context');
module.exports = Self => {
require('../methods/entry/filter')(Self);
require('../methods/entry/getEntry')(Self);
@ -7,4 +8,41 @@ module.exports = Self => {
require('../methods/entry/importBuysPreview')(Self);
require('../methods/entry/lastItemBuys')(Self);
require('../methods/entry/entryOrderPdf')(Self);
Self.observe('before save', async function(ctx, options) {
if (ctx.isNewInstance) return;
const changes = ctx.data || ctx.instance;
const orgData = ctx.currentInstance;
const observation = changes.observation || orgData.observation;
const hasChanges = orgData && changes;
const observationChanged = hasChanges
&& orgData.observation != observation;
if (observationChanged) {
let tx;
const myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
if (!myOptions.transaction) {
tx = await Self.beginTransaction({});
myOptions.transaction = tx;
}
try {
const loopbackContext = LoopBackContext.getCurrentContext();
const userId = loopbackContext.active.accessToken.userId;
const id = changes.id || orgData.id;
const entry = await Self.app.models.Entry.findById(id, null, myOptions);
await entry.updateAttribute('observationEditorFk', userId, myOptions);
if (tx) await tx.commit();
} catch (e) {
if (tx) await tx.rollback();
throw e;
}
}
});
};

View File

@ -77,6 +77,9 @@
"companyFk": {
"type": "number",
"required": true
},
"observationEditorFk": {
"type": "number"
}
},
"relations": {
@ -99,6 +102,11 @@
"type": "belongsTo",
"model": "Currency",
"foreignKey": "currencyFk"
},
"observationEditor": {
"type": "belongsTo",
"model": "Account",
"foreignKey": "observationEditorFk"
}
}
}

View File

@ -60,7 +60,7 @@
ng-if="buy.id"
ng-click="itemDescriptor.show($event, buy.item.id)"
class="link">
{{::buy.item.id | zeroFill:6}}
{{::buy.item.id}}
</span>
<vn-autocomplete ng-if="!buy.id" class="dense"
vn-focus

View File

@ -148,7 +148,7 @@
<span
ng-click="itemDescriptor.show($event, line.item.id)"
class="link">
{{::line.item.id | zeroFill:6}}
{{::line.item.id}}
</span>
</td>
<td number shrink>

View File

@ -47,7 +47,7 @@
show-field="description"
rule
vn-focus>
<tpl-item>{{id | zeroFill:8}}: {{description}}</tpl-item>
<tpl-item>{{id}}: {{description}}</tpl-item>
</vn-autocomplete>
<vn-input-number
label="Amount"

View File

@ -141,7 +141,7 @@
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="intrastat in $ctrl.summary.invoiceInIntrastat">
<vn-td>{{::intrastat.intrastatFk | zeroFill:8}}: {{::intrastat.intrastat.description}}</vn-td>
<vn-td>{{::intrastat.intrastatFk}}: {{::intrastat.intrastat.description}}</vn-td>
<vn-td>{{::intrastat.amount | currency: 'EUR':2}}</vn-td>
<vn-td>{{::intrastat.net}}</vn-td>
<vn-td>{{::intrastat.stems}}</vn-td>

View File

@ -35,8 +35,7 @@ module.exports = Self => {
const tickets = await models.Ticket.find(filter, myOptions);
const ticketsIds = tickets.map(ticket => ticket.id);
const refundedTickets = await models.Ticket.refund(ticketsIds, myOptions);
const refundedTickets = await models.Ticket.refund(ticketsIds, true, myOptions);
if (tx) await tx.commit();

View File

@ -17,7 +17,7 @@ describe('InvoiceOut refund()', () => {
try {
const result = await models.InvoiceOut.refund('T1111111', options);
expect(result.length).toEqual(2);
expect(result.length).toEqual(1);
await tx.rollback();
} catch (e) {

View File

@ -98,9 +98,8 @@ module.exports = Self => {
summary.tags = res[1];
[summary.botanical] = res[2];
const userConfig = await models.UserConfig.getUserConfig(ctx, myOptions);
res = await models.Item.getVisibleAvailable(summary.item.id, userConfig.warehouseFk, null, myOptions);
const itemConfig = await models.ItemConfig.findOne(null, myOptions);
res = await models.Item.getVisibleAvailable(summary.item.id, itemConfig.warehouseFk, undefined, myOptions);
summary.available = res.available;
summary.visible = res.visible;

View File

@ -12,7 +12,7 @@ describe('item getVisibleAvailable()', () => {
const result = await models.Item.getVisibleAvailable(itemFk, warehouseFk, dated, options);
expect(result.available).toEqual(187);
expect(result.available).toEqual(185);
expect(result.visible).toEqual(92);
await tx.rollback();

View File

@ -25,6 +25,9 @@
},
"defaultTag": {
"type": "int"
},
"warehouseFk": {
"type": "int"
}
},
"relations": {

View File

@ -1,6 +1,6 @@
<vn-portal slot="menu">
<vn-item-descriptor
warehouse-fk="$ctrl.vnConfig.warehouseFk"
<vn-item-descriptor
warehouse-fk="$ctrl.warehouseFk"
item="$ctrl.item"
card-reload="$ctrl.reload()"></vn-item-descriptor>
<vn-left-menu source="card"></vn-left-menu>

View File

@ -19,7 +19,7 @@
<slot-before>
<div class="photo" text-center>
<img vn-id="photo"
ng-src="{{$root.imagePath('catalog', '200x200', $ctrl.item.id)}}"
ng-src="{{$root.imagePath('catalog', '200x200', $ctrl.item.id)}}"
zoom-image="{{$root.imagePath('catalog', '1600x900', $ctrl.item.id)}}"
on-error-src/>
<vn-float-button ng-click="uploadPhoto.show('catalog', $ctrl.item.id)"
@ -36,13 +36,23 @@
<p translate>Available</p>
<p>{{$ctrl.available | dashIfEmpty}}</p>
</vn-one>
<vn-one>
<p>
<vn-icon
ng-if="$ctrl.showIcon"
icon="info_outline"
vn-tooltip="{{$ctrl.warehouseText}}"
pointer>
</vn-icon>
</p>
</vn-one>
</vn-horizontal>
</slot-before>
<slot-body>
<div class="attributes">
<vn-label-value
label="Buyer">
<span
<span
ng-click="workerDescriptor.show($event, $ctrl.item.itemType.worker.userFk)"
class="link">
{{$ctrl.item.itemType.worker.user.name}}
@ -50,22 +60,22 @@
</vn-label-value>
<vn-label-value
label="{{$ctrl.item.tag5}}"
ng-if="$ctrl.item.value5"
ng-if="$ctrl.item.value5"
value="{{$ctrl.item.value5}}">
</vn-label-value>
<vn-label-value
label="{{$ctrl.item.tag6}}"
ng-if="$ctrl.item.value6"
label="{{$ctrl.item.tag6}}"
ng-if="$ctrl.item.value6"
value="{{$ctrl.item.value6}}">
</vn-label-value>
<vn-label-value
label="{{$ctrl.item.tag7}}"
ng-if="$ctrl.item.value7"
label="{{$ctrl.item.tag7}}"
ng-if="$ctrl.item.value7"
value="{{$ctrl.item.value7}}">
</vn-label-value>
<vn-label-value
label="{{$ctrl.item.tag8}}"
ng-if="$ctrl.item.value8"
label="{{$ctrl.item.tag8}}"
ng-if="$ctrl.item.value8"
value="{{$ctrl.item.value8}}">
</vn-label-value>
</div>
@ -112,7 +122,7 @@
question="Do you want to clone this item?"
message="All it's properties will be copied">
</vn-confirm>
<vn-worker-descriptor-popover
<vn-worker-descriptor-popover
vn-id="workerDescriptor">
</vn-worker-descriptor-popover>
<vn-popup vn-id="summary">
@ -120,7 +130,7 @@
</vn-popup>
<!-- Upload photo dialog -->
<vn-upload-photo
vn-id="uploadPhoto"
<vn-upload-photo
vn-id="uploadPhoto"
on-response="$ctrl.onUploadResponse()">
</vn-upload-photo>
</vn-upload-photo>

View File

@ -30,7 +30,10 @@ class Controller extends Descriptor {
set warehouseFk(value) {
this._warehouseFk = value;
if (value) this.updateStock();
if (value) {
this.updateStock();
this.getWarehouseName(value);
}
}
loadData() {
@ -89,6 +92,22 @@ class Controller extends Descriptor {
this.$.photo.setAttribute('src', newSrc);
this.$.photo.setAttribute('zoom-image', newZoomSrc);
}
getWarehouseName(warehouseFk) {
this.showIcon = false;
const filter = {
where: {id: warehouseFk}
};
this.$http.get('Warehouses/findOne', {filter})
.then(res => {
this.warehouseText = this.$t('WarehouseFk', {
warehouseName: res.data.name
});
this.showIcon = true;
});
}
}
Controller.$inject = ['$element', '$scope', '$rootScope'];
@ -100,6 +119,6 @@ ngModule.vnComponent('vnItemDescriptor', {
item: '<',
dated: '<',
cardReload: '&',
warehouseFk: '<?'
warehouseFk: '<'
}
});

View File

@ -37,6 +37,7 @@ class Controller extends Section {
set warehouseFk(value) {
if (value && value != this._warehouseFk) {
this._warehouseFk = value;
this.card.warehouseFk = value;
this.$state.go(this.$state.current.name, {
warehouseFk: value
@ -76,5 +77,8 @@ ngModule.vnComponent('vnItemDiary', {
controller: Controller,
bindings: {
item: '<'
},
require: {
card: '?^vnItemCard'
}
});

View File

@ -14,6 +14,7 @@ describe('Item', () => {
controller = $componentController('vnItemDiary', {$element, $scope});
controller.$.model = crudModel;
controller.$params = {id: 1};
controller.card = {};
}));
describe('set item()', () => {

View File

@ -11,6 +11,8 @@
<vn-card class="vn-w-md vn-pa-md">
<vn-horizontal>
<vn-date-picker class="vn-pa-xs"
vn-one
label="Since"
vn-one
label="Since"
ng-model="$ctrl.dateFrom">
@ -35,7 +37,7 @@
<vn-th field="warehouseFk">Warehouse</vn-th>
<vn-th field="landed">Landed</vn-th>
<vn-th number>Entry</vn-th>
<vn-th vn-tooltip="Grouping / Packing">PVP</vn-th>
<vn-th vn-tooltip="Grouping / Packing" expand>PVP</vn-th>
<vn-th number class="expendable">Label</vn-th>
<vn-th number>Packing</vn-th>
<vn-th number>Grouping</vn-th>
@ -64,7 +66,7 @@
{{::entry.entryFk | dashIfEmpty}}
</span>
</vn-td>
<vn-td title="{{::entry.price2 | currency: 'EUR':2 | dashIfEmpty}} / {{::entry.price3 | currency: 'EUR':2 | dashIfEmpty}}">
<vn-td title="Grouping / Packing">
{{::entry.price2 | currency: 'EUR':2 | dashIfEmpty}} / {{::entry.price3 | currency: 'EUR':2 | dashIfEmpty}}
</vn-td>
<vn-td number class="expendable">{{entry.stickers | dashIfEmpty}}</vn-td>

View File

@ -11,7 +11,7 @@
<vn-horizontal>
<vn-one>
<img style="width: 100%; display: block;"
ng-src="{{$root.imagePath('catalog', '200x200', $ctrl.item.id)}}"
ng-src="{{$root.imagePath('catalog', '200x200', $ctrl.item.id)}}"
zoom-image="{{$root.imagePath('catalog', '1600x900', $ctrl.item.id)}}" on-error-src/>
<vn-horizontal class="item-state">
<vn-one>
@ -22,44 +22,54 @@
<p translate>Available</p>
<p>{{$ctrl.summary.available}}</p>
</vn-one>
<vn-one>
<p>
<vn-icon
ng-if="$ctrl.warehouseText != null"
icon="info_outline"
vn-tooltip="{{$ctrl.warehouseText}}"
pointer>
</vn-icon>
</p>
</vn-one>
</vn-horizontal>
</vn-one>
<vn-one name="basicData">
<h4 ng-show="$ctrl.isBuyer">
<a
<a
ui-sref="item.card.basicData({id:$ctrl.item.id})"
target="_self">
<span translate vn-tooltip="Go to">Basic data</span>
</a>
</h4>
<h4
translate
translate
ng-show="!$ctrl.isBuyer">
Basic data
</h4>
<vn-label-value label="Name"
value="{{$ctrl.summary.item.name}}">
</vn-label-value>
<vn-label-value label="Full name"
<vn-label-value label="Full name"
value="{{$ctrl.summary.item.longName}}">
</vn-label-value>
<vn-label-value label="Item family"
<vn-label-value label="Item family"
value="{{$ctrl.summary.item.itemType.name}}">
</vn-label-value>
<vn-label-value label="Size"
<vn-label-value label="Size"
value="{{$ctrl.summary.item.size}}">
</vn-label-value>
<vn-label-value label="Origin"
<vn-label-value label="Origin"
value="{{$ctrl.summary.item.origin.name}}">
</vn-label-value>
<vn-label-value label="stems"
<vn-label-value label="stems"
value="{{$ctrl.summary.item.stems}}">
</vn-label-value>
<vn-label-value label="Multiplier"
<vn-label-value label="Multiplier"
value="{{$ctrl.summary.item.stemMultiplier}}">
</vn-label-value>
<vn-label-value label="Buyer">
<span
<span
ng-click="workerDescriptor.show($event, $ctrl.summary.item.itemType.worker.userFk)"
class="link">
{{$ctrl.summary.item.itemType.worker.user.name}}
@ -68,45 +78,45 @@
</vn-one>
<vn-one name="otherData">
<h4 ng-show="$ctrl.isBuyer">
<a
<a
ui-sref="item.card.basicData({id:$ctrl.item.id})"
target="_self">
<span translate vn-tooltip="Go to">Other data</span>
</a>
</h4>
<h4
translate
translate
ng-show="!$ctrl.isBuyer">
Other data
</h4>
<vn-label-value label="Intrastat code"
<vn-label-value label="Intrastat code"
value="{{$ctrl.summary.item.intrastat.id}}">
</vn-label-value>
<vn-label-value label="Intrastat"
<vn-label-value label="Intrastat"
value="{{$ctrl.summary.item.intrastat.description}}">
</vn-label-value>
<vn-label-value label="Reference"
<vn-label-value label="Reference"
value="{{$ctrl.summary.item.comment}}">
</vn-label-value>
<vn-label-value label="Relevancy"
<vn-label-value label="Relevancy"
value="{{$ctrl.summary.item.relevancy}}">
</vn-label-value>
<vn-label-value label="Weight/Piece"
<vn-label-value label="Weight/Piece"
value="{{$ctrl.summary.item.weightByPiece}}">
</vn-label-value>
<vn-label-value label="Expense"
<vn-label-value label="Expense"
value="{{$ctrl.summary.item.expense.name}}">
</vn-label-value>
</vn-one>
<vn-one name="tags">
<h4 ng-show="$ctrl.isBuyer || $ctrl.isReplenisher">
<a
<a
ui-sref="item.card.tags({id:$ctrl.item.id})"
target="_self">
<span translate vn-tooltip="Go to">Tags</span>
</a>
</h4>
<h4
<h4
translate
ng-show="!$ctrl.isBuyer && !$ctrl.isReplenisher">
Tags
@ -119,14 +129,14 @@
</vn-one>
<vn-one name="description" ng-if="$ctrl.summary.item.description">
<h4 ng-show="$ctrl.isBuyer">
<a
<a
ui-sref="item.card.basicData({id:$ctrl.item.id})"
target="_self">
<span translate vn-tooltip="Go to">Description</span>
</a>
</h4>
<h4
translate
translate
ng-show="!$ctrl.isBuyer">
Description
</h4>
@ -136,13 +146,13 @@
</vn-one>
<vn-one name="tax">
<h4 ng-show="$ctrl.isBuyer || $ctrl.isAdministrative">
<a
<a
ui-sref="item.card.tax({id:$ctrl.item.id})"
target="_self">
<span translate vn-tooltip="Go to">Tax</span>
</a>
</h4>
<h4
<h4
translate
ng-show="!$ctrl.isBuyer && !$ctrl.isAdministrative">
Tax
@ -154,33 +164,33 @@
</vn-one>
<vn-one name="botanical">
<h4 ng-show="$ctrl.isBuyer">
<a
<a
ui-sref="item.card.botanical({id:$ctrl.item.id})"
target="_self">
<span translate vn-tooltip="Go to">Botanical</span>
</a>
</h4>
<h4
<h4
translate
ng-show="!$ctrl.isBuyer">
Botanical
</h4>
<vn-label-value label="Genus"
<vn-label-value label="Genus"
value="{{$ctrl.summary.botanical.genus.name}}">
</vn-label-value>
<vn-label-value label="Specie"
<vn-label-value label="Specie"
value="{{$ctrl.summary.botanical.specie.name}}">
</vn-label-value>
</vn-one>
<vn-one name="barcode">
<h4 ng-show="$ctrl.isBuyer || $ctrl.isReplenisher">
<a
<a
ui-sref="item.card.itemBarcode({id:$ctrl.item.id})"
target="_self">
<span translate vn-tooltip="Go to">Barcode</span>
</a>
</h4>
<h4
<h4
translate
ng-show="!$ctrl.isBuyer && !$ctrl.isReplenisher">
Barcode
@ -191,6 +201,6 @@
</vn-one>
</vn-horizontal>
</vn-card>
<vn-worker-descriptor-popover
<vn-worker-descriptor-popover
vn-id="workerDescriptor">
</vn-worker-descriptor-popover>
</vn-worker-descriptor-popover>

View File

@ -7,6 +7,24 @@ class Controller extends Summary {
this.$http.get(`Items/${this.item.id}/getSummary`).then(response => {
this.summary = response.data;
});
this.$http.get('ItemConfigs/findOne')
.then(res => {
if (this.card) this.card.warehouseFk = res.data.warehouseFk;
this.getWarehouseName(res.data.warehouseFk);
});
}
getWarehouseName(warehouseFk) {
const filter = {
where: {id: warehouseFk}
};
this.$http.get('Warehouses/findOne', {filter})
.then(res => {
this.warehouseText = this.$t('WarehouseFk', {
warehouseName: res.data.name
});
});
}
$onChanges() {
@ -37,4 +55,7 @@ ngModule.vnComponent('vnItemSummary', {
bindings: {
item: '<',
},
require: {
card: '?^vnItemCard'
}
});

View File

@ -14,12 +14,15 @@ describe('Item', () => {
const $element = angular.element('<vn-item-summary></vn-item-summary>');
controller = $componentController('vnItemSummary', {$element, $scope});
controller.item = {id: 1};
controller.card = {};
}));
describe('getSummary()', () => {
it('should perform a query to set summary', () => {
let data = {id: 1, name: 'Gem of mind'};
$httpBackend.expect('GET', `Items/1/getSummary`).respond(200, data);
$httpBackend.expect('GET', `ItemConfigs/findOne`).respond({});
$httpBackend.expect('GET', `Warehouses/findOne`).respond({});
controller.getSummary();
$httpBackend.flush();

View File

@ -0,0 +1 @@
WarehouseFk: Calculated on the warehouse of {{ warehouseName }}

View File

@ -1,3 +1,4 @@
Barcode: Códigos de barras
Other data: Otros datos
Go to the item: Ir al artículo
Go to the item: Ir al artículo
WarehouseFk: Calculado sobre el almacén de {{ warehouseName }}

View File

@ -29,7 +29,11 @@ vn-item-summary {
padding: 0;
&:nth-child(1) {
border-right: 1px solid white;
border-right: 1px solid white;
}
&:nth-child(2) {
border-right: 1px solid white;
}
}
}
}

View File

@ -40,6 +40,7 @@ class Controller extends Section {
this.$.model.refresh();
this.$.watcher.notifySaved();
this.$.watcher.updateOriginalData();
this.card.reload();
});
}
}

View File

@ -39,7 +39,7 @@
<vn-td number>
<span ng-click="itemDescriptor.show($event, row.itemFk)"
class="link">
{{::row.itemFk | zeroFill:6}}
{{::row.itemFk}}
</span>
</vn-td>
<vn-td vn-fetched-tags>

View File

@ -95,7 +95,7 @@
<span
ng-click="itemDescriptor.show($event, row.itemFk)"
class="link">
{{::row.itemFk | zeroFill:6}}
{{::row.itemFk}}
</span>
</vn-td>
<vn-td vn-fetched-tags>

View File

@ -21,3 +21,5 @@ companyFk: empresa
agencyModeFk: agencia
ticketFk: ticket
mergedTicket: ticket fusionado
withWarningAccept: aviso negativos
isWithoutNegatives: sin negativos

View File

@ -12,6 +12,11 @@ module.exports = Self => {
arg: 'servicesIds',
type: ['number']
},
{
arg: 'createSingleTicket',
type: 'boolean',
required: false
}
],
returns: {
type: ['number'],
@ -23,7 +28,7 @@ module.exports = Self => {
}
});
Self.refund = async(salesIds, servicesIds, options) => {
Self.refund = async(salesIds, servicesIds, createSingleTicket = false, options) => {
const models = Self.app.models;
const myOptions = {};
let tx;
@ -63,38 +68,37 @@ module.exports = Self => {
const ticketsIds = [...new Set(sales.map(sale => sale.ticketFk))];
const refundTickets = [];
const now = Date.vnNew();
const mappedTickets = new Map();
const now = Date.vnNew();
for (let ticketId of ticketsIds) {
const filter = {include: {relation: 'address'}};
const ticket = await models.Ticket.findById(ticketId, filter, myOptions);
const refundTicket = await models.Ticket.create({
clientFk: ticket.clientFk,
shipped: now,
addressFk: ticket.address().id,
agencyModeFk: refundAgencyMode.id,
nickname: ticket.address().nickname,
warehouseFk: ticket.warehouseFk,
companyFk: ticket.companyFk,
landed: now,
zoneFk: refoundZoneId
}, myOptions);
refundTickets.push(refundTicket);
mappedTickets.set(ticketId, refundTicket.id);
await models.TicketRefund.create({
refundTicketFk: refundTicket.id,
originalTicketFk: ticket.id,
}, myOptions);
const [firstTicketId] = ticketsIds;
if (createSingleTicket) {
await createTicketRefund(
firstTicketId,
refundTickets,
mappedTickets,
now,
refundAgencyMode,
refoundZoneId,
myOptions
);
} else {
for (let ticketId of ticketsIds) {
await createTicketRefund(
ticketId,
refundTickets,
mappedTickets,
now,
refundAgencyMode,
refoundZoneId,
myOptions
);
}
}
for (const sale of sales) {
const refundTicketId = mappedTickets.get(sale.ticketFk);
const refundTicketId = await getTicketRefundId(createSingleTicket, sale.ticketFk, refundTickets, mappedTickets);
const createdSale = await models.Sale.create({
ticketFk: refundTicketId,
itemFk: sale.itemFk,
@ -118,7 +122,7 @@ module.exports = Self => {
const services = await models.TicketService.find(servicesFilter, myOptions);
for (const service of services) {
const refundTicketId = mappedTickets.get(service.ticketFk);
const refundTicketId = await getTicketRefundId(createSingleTicket, service.ticketFk, refundTickets, mappedTickets);
await models.TicketService.create({
description: service.description,
@ -139,4 +143,47 @@ module.exports = Self => {
throw e;
}
};
async function createTicketRefund(
ticketId,
refundTickets,
mappedTickets,
now,
refundAgencyMode,
refoundZoneId,
myOptions
) {
const models = Self.app.models;
const filter = {include: {relation: 'address'}};
const ticket = await models.Ticket.findById(ticketId, filter, myOptions);
const refundTicket = await models.Ticket.create({
clientFk: ticket.clientFk,
shipped: now,
addressFk: ticket.address().id,
agencyModeFk: refundAgencyMode.id,
nickname: ticket.address().nickname,
warehouseFk: ticket.warehouseFk,
companyFk: ticket.companyFk,
landed: now,
zoneFk: refoundZoneId
}, myOptions);
refundTickets.push(refundTicket);
mappedTickets.set(ticketId, refundTicket.id);
await models.TicketRefund.create({
refundTicketFk: refundTicket.id,
originalTicketFk: ticket.id,
}, myOptions);
}
async function getTicketRefundId(createSingleTicket, ticketId, refundTickets, mappedTickets) {
if (createSingleTicket) {
const [firstRefundTicket] = refundTickets;
return firstRefundTicket.id;
} else return mappedTickets.get(ticketId);
}
};

View File

@ -1,7 +1,7 @@
const models = require('vn-loopback/server/server').models;
const LoopBackContext = require('loopback-context');
describe('sale refund()', () => {
describe('Sale refund()', () => {
const userId = 5;
const activeCtx = {
accessToken: {userId: userId},
@ -22,7 +22,7 @@ describe('sale refund()', () => {
try {
const options = {transaction: tx};
const response = await models.Sale.refund(salesIds, servicesIds, options);
const response = await models.Sale.refund(salesIds, servicesIds, false, options);
expect(response.length).toBeGreaterThanOrEqual(1);
@ -40,7 +40,8 @@ describe('sale refund()', () => {
try {
const options = {transaction: tx};
const tickets = await models.Sale.refund(salesIds, servicesIds, options);
const createSingleTicket = false;
const tickets = await models.Sale.refund(salesIds, servicesIds, createSingleTicket, options);
const ticketsIds = tickets.map(ticket => ticket.id);

View File

@ -83,6 +83,11 @@ module.exports = Self => {
type: 'boolean',
description: 'Is whithout negatives',
required: true
},
{
arg: 'withWarningAccept',
type: 'boolean',
description: 'Has pressed in confirm message',
}],
returns: {
type: ['object'],

View File

@ -50,15 +50,9 @@ module.exports = Self => {
required: false
},
{
arg: 'isNotValidated',
arg: 'isFullMovable',
type: 'boolean',
description: 'Origin state',
required: false
},
{
arg: 'futureIsNotValidated',
type: 'boolean',
description: 'Destination state',
description: 'True when lines and stock of origin are equal',
required: false
},
{
@ -93,22 +87,20 @@ module.exports = Self => {
return {'f.futureId': value};
case 'ipt':
return {or:
[
{'f.ipt': {like: `%${value}%`}},
{'f.ipt': null}
]
[
{'f.ipt': {like: `%${value}%`}},
{'f.ipt': null}
]
};
case 'futureIpt':
return {or:
[
{'f.futureIpt': {like: `%${value}%`}},
{'f.futureIpt': null}
]
[
{'f.futureIpt': {like: `%${value}%`}},
{'f.futureIpt': null}
]
};
case 'isNotValidated':
return {'f.isNotValidated': value};
case 'futureIsNotValidated':
return {'f.futureIsNotValidated': value};
case 'isFullMovable':
return {'f.isFullMovable': value};
}
});

View File

@ -8,6 +8,11 @@ module.exports = Self => {
type: ['number'],
required: true
},
{
arg: 'createSingleTicket',
type: 'boolean',
required: false
}
],
returns: {
type: ['number'],
@ -19,7 +24,7 @@ module.exports = Self => {
}
});
Self.refund = async(ticketsIds, options) => {
Self.refund = async(ticketsIds, createSingleTicket = false, options) => {
const models = Self.app.models;
const myOptions = {};
let tx;
@ -41,7 +46,7 @@ module.exports = Self => {
const services = await models.TicketService.find(filter, myOptions);
const servicesIds = services.map(service => service.id);
const refundedTickets = await models.Sale.refund(salesIds, servicesIds, myOptions);
const refundedTickets = await models.Sale.refund(salesIds, servicesIds, createSingleTicket, myOptions);
if (tx) await tx.commit();

View File

@ -29,7 +29,7 @@ describe('TicketFuture getTicketsAdvance()', () => {
}
});
it('should return the tickets matching the origin pending state', async() => {
it('should return the tickets matching the fullMovable true', async() => {
const tx = await models.Ticket.beginTransaction({});
try {
@ -39,7 +39,7 @@ describe('TicketFuture getTicketsAdvance()', () => {
dateFuture: tomorrow,
dateToAdvance: today,
warehouseFk: 1,
futureIsNotValidated: true
isFullMovable: true
};
const ctx = {req: {accessToken: {userId: 9}}, args};
@ -54,7 +54,7 @@ describe('TicketFuture getTicketsAdvance()', () => {
}
});
it('should return the tickets matching the destination pending state', async() => {
it('should return the tickets matching the fullMovable false', async() => {
const tx = await models.Ticket.beginTransaction({});
try {
@ -64,7 +64,7 @@ describe('TicketFuture getTicketsAdvance()', () => {
dateFuture: tomorrow,
dateToAdvance: today,
warehouseFk: 1,
isNotValidated: true
isFullMovable: false
};
const ctx = {req: {accessToken: {userId: 9}}, args};
@ -95,7 +95,7 @@ describe('TicketFuture getTicketsAdvance()', () => {
const ctx = {req: {accessToken: {userId: 9}}, args};
const result = await models.Ticket.getTicketsAdvance(ctx, options);
expect(result.length).toBeLessThan(5);
expect(result.length).toBeGreaterThan(5);
await tx.rollback();
} catch (e) {
@ -120,7 +120,7 @@ describe('TicketFuture getTicketsAdvance()', () => {
const ctx = {req: {accessToken: {userId: 9}}, args};
const result = await models.Ticket.getTicketsAdvance(ctx, options);
expect(result.length).toBeLessThan(5);
expect(result.length).toBeGreaterThan(5);
await tx.rollback();
} catch (e) {

View File

@ -86,7 +86,7 @@ describe('sale priceDifference()', () => {
const firstItem = result.items[0];
const secondtItem = result.items[1];
expect(firstItem.movable).toEqual(410);
expect(firstItem.movable).toEqual(380);
expect(secondtItem.movable).toEqual(1790);
await tx.rollback();

View File

@ -41,18 +41,10 @@
<vn-horizontal class="vn-px-lg">
<vn-check
vn-one
label="Pending Origin"
ng-model="filter.futureIsNotValidated"
label="100% movable"
ng-model="filter.isFullMovable"
triple-state="true">
</vn-check>
<vn-check
vn-one
label="Pending Destination"
ng-model="filter.isNotValidated"
triple-state="true">
</vn-check>
</vn-horizontal>
<vn-horizontal class="vn-px-lg">
<vn-autocomplete
vn-one
label="Warehouse"

View File

@ -1,3 +1,2 @@
Advance tickets: Adelantar tickets
Pending Origin: Pendiente origen
Pending Destination: Pendiente destino
100% movable: 100% movible

View File

@ -32,8 +32,8 @@
<thead>
<tr second-header>
<td></td>
<th colspan="9" translate>Origin</th>
<th colspan="7" translate>Destination</th>
<th colspan="9" translate>Origin</th>
</tr>
<tr>
<th shrink>
@ -45,31 +45,7 @@
</th>
<th shrink>
</th>
<th field="futureId">
<span translate>ID</span>
</th>
<th field="futureShipped">
<span translate>Date</span>
</th>
<th field="futureIpt" title="{{'Item Packing Type' | translate}}">
<span>IPT</span>
</th>
<th field="futureState">
<span translate>State</span>
</th>
<th field="futureLiters">
<span translate>Liters</span>
</th>
<th field="hasStock">
<span>Stock</span>
</th>
<th field="futureLines">
<span translate>Lines</span>
</th>
<th field="futureTotalWithVat">
<span translate>Import</span>
</th>
<th separator field="id">
<th field="id">
<span translate>ID</span>
</th>
<th field="shipped">
@ -90,6 +66,30 @@
<th field="totalWithVat">
<span translate>Import</span>
</th>
<th separator field="futureId">
<span translate>ID</span>
</th>
<th field="futureShipped">
<span translate>Date</span>
</th>
<th field="futureIpt" title="{{'Item Packing Type' | translate}}">
<span>IPT</span>
</th>
<th field="futureState">
<span translate>State</span>
</th>
<th field="futureLiters">
<span translate>Liters</span>
</th>
<th field="notMovableLines">
<span translate>Not Movable</span>
</th>
<th field="futureLines">
<span translate>Lines</span>
</th>
<th field="futureTotalWithVat">
<span translate>Import</span>
</th>
</tr>
</thead>
<tbody>
@ -104,36 +104,9 @@
<vn-icon
ng-show="ticket.futureAgency !== ticket.agency"
icon="icon-agency-term"
vn-tooltip="{{$ctrl.agencies(ticket.futureAgency, ticket.agency)}}">
title="{{$ctrl.agencies(ticket.futureAgency, ticket.agency)}}">
</vn-icon>
</td>
<td>
<span
ng-click="ticketDescriptor.show($event, ticket.futureId)"
class="link">
{{::ticket.futureId | dashIfEmpty}}
</span>
</td>
<td shrink-date>
<span class="chip {{$ctrl.compareDate(ticket.futureShipped)}}">
{{::ticket.futureShipped | date: 'dd/MM/yyyy'}}
</span>
</td>
<td>{{::ticket.futureIpt | dashIfEmpty}}</td>
<td>
<span
class="chip {{$ctrl.stateColor(ticket.futureState)}}">
{{::ticket.futureState | dashIfEmpty}}
</span>
</td>
<td>{{::ticket.futureLiters | dashIfEmpty}}</td>
<td>{{::ticket.hasStock | dashIfEmpty}}</td>
<td>{{::ticket.futureLines | dashIfEmpty}}</td>
<td>
<span class="chip {{$ctrl.totalPriceColor(ticket.futureTotalWithVat)}}">
{{::(ticket.futureTotalWithVat ? ticket.futureTotalWithVat : 0) | currency: 'EUR': 2}}
</span>
</td>
<td>
<span
ng-click="ticketDescriptor.show($event, ticket.id)"
@ -156,10 +129,42 @@
<td>{{::ticket.liters | dashIfEmpty}}</td>
<td>{{::ticket.lines | dashIfEmpty}}</td>
<td>
<span class="chip {{$ctrl.totalPriceColor(ticket.totalWithVat)}}">
<span
class="chip {{$ctrl.totalPriceColor(ticket.totalWithVat)}}"
title="{{$ctrl.totalPriceTitle(ticket.totalWithVat) | translate}}">
{{::(ticket.totalWithVat ? ticket.totalWithVat : 0) | currency: 'EUR': 2}}
</span>
</td>
<td separator>
<span
ng-click="ticketDescriptor.show($event, ticket.futureId)"
class="link">
{{::ticket.futureId | dashIfEmpty}}
</span>
</td>
<td shrink-date>
<span class="chip {{$ctrl.compareDate(ticket.futureShipped)}}">
{{::ticket.futureShipped | date: 'dd/MM/yyyy'}}
</span>
</td>
<td>{{::ticket.futureIpt | dashIfEmpty}}</td>
<td>
<span
class="chip {{$ctrl.stateColor(ticket.futureState)}}">
{{::ticket.futureState | dashIfEmpty}}
</span>
</td>
<td>{{::ticket.futureLiters | dashIfEmpty}}</td>
<td>{{::ticket.notMovableLines | dashIfEmpty}}</td>
<td>{{::ticket.futureLines | dashIfEmpty}}</td>
<td>
<span
class="chip {{$ctrl.totalPriceColor(ticket.futureTotalWithVat)}}"
title="{{$ctrl.totalPriceTitle(ticket.futureTotalWithVat) | translate}}">
{{::(ticket.futureTotalWithVat ? ticket.futureTotalWithVat : 0) | currency: 'EUR': 2}}
</span>
</td>
</tr>
</tbody>
</table>

View File

@ -119,9 +119,15 @@ export default class Controller extends Section {
}
totalPriceColor(totalWithVat) {
const total = parseInt(totalWithVat);
if (total > 0 && total < 50)
return 'warning';
return this.isLessThan50(totalWithVat) ? 'warning' : '';
}
totalPriceTitle(totalWithVat) {
return this.isLessThan50(totalWithVat) ? 'Less than 50€' : '';
}
isLessThan50(totalWithVat) {
return (parseInt(totalWithVat) > 0 && parseInt(totalWithVat) < 50);
}
get confirmationMessage() {
@ -134,7 +140,7 @@ export default class Controller extends Section {
agencies(futureAgency, agency) {
return this.$t(`Origin agency`, {agency: futureAgency}) +
'<br/>' + this.$t(`Destination agency`, {agency: agency});
'\n' + this.$t(`Destination agency`, {agency: agency});
}
moveTicketsAdvance() {
@ -171,15 +177,25 @@ export default class Controller extends Section {
case 'futureLines':
return {'futureLines': value};
case 'ipt':
return {'ipt': value};
return {or:
[
{'ipt': {like: `%${value}%`}},
{'ipt': null}
]
};
case 'futureIpt':
return {'futureIpt': value};
return {or:
[
{'futureIpt': {like: `%${value}%`}},
{'futureIpt': null}
]
};
case 'totalWithVat':
return {'totalWithVat': value};
case 'futureTotalWithVat':
return {'futureTotalWithVat': value};
case 'hasStock':
return {'hasStock': value};
case 'notMovableLines':
return {'notMovableLines': value};
}
}
}

View File

@ -7,3 +7,5 @@ Liters: Litros
Item Packing Type: Encajado
Origin agency: "Agencia origen: {{agency}}"
Destination agency: "Agencia destino: {{agency}}"
Less than 50€: Menor a 50€
Not Movable: No movibles

View File

@ -23,7 +23,7 @@
title="{{::sale.item.name}}"
vn-click-stop="itemDescriptor.show($event, sale.itemFk, sale.id)"
class="link">
{{::sale.itemFk | zeroFill:6}}
{{::sale.itemFk}}
</span>
</vn-td>
<vn-td vn-fetched-tags>
@ -40,7 +40,7 @@
</vn-fetched-tags>
</vn-td>
<vn-td ng-if="$ctrl.ticket.sale.haveDifferences" number>
<span
<span
class="chip"
ng-class="{'alert': sale.quantity>sale.movable}">
{{::sale.movable}}
@ -64,14 +64,14 @@
<vn-side-menu side="right">
<div class="vn-pa-md">
<div class="totalBox align-left">
<h6 class="align-center" translate>Total</h6>
<h6 class="align-center" translate>Total</h6>
<div> <vn-label translate>Price</vn-label> {{$ctrl.totalPrice | currency: 'EUR': 2}} </div>
<div> <vn-label translate>New price</vn-label> {{$ctrl.totalNewPrice | currency: 'EUR': 2}} </div>
<div> <vn-label translate>Difference</vn-label> {{$ctrl.totalPriceDifference | currency: 'EUR': 2}} </div>
</div>
<vn-card ng-show="::$ctrl.totalPriceDifference">
<div class="totalBox align-left" >
<h6 class="align-center" translate>Charge difference to</h6>
<h6 class="align-center" translate>Charge difference to</h6>
<div ng-repeat="action in ticketUpdateActions">
<vn-radio
ng-model="$ctrl.ticket.option"
@ -82,7 +82,7 @@
</div>
</vn-card>
<div class="totalBox align-left" ng-show="::$ctrl.haveNegatives">
<vn-check
<vn-check
ng-model="$ctrl.ticket.withoutNegatives"
label="Create without negatives"
info="Clone this ticket with the changes and only sales availables">
@ -95,4 +95,10 @@
warehouse-fk="$ctrl.ticket.warehouseFk"
ticket-fk="$ctrl.ticket.id">
</vn-item-descriptor-popover>
<vn-confirm
vn-id="negativesConfirm"
on-accept="$ctrl.onConfirmAccept()"
question="Negatives are going to be generated, are you sure you want to advance all the lines?"
message="Edit basic data">
</vn-confirm>

View File

@ -83,6 +83,17 @@ class Controller extends Component {
}
onSubmit() {
if (this.haveNegatives && !this.ticket.withoutNegatives)
this.$.negativesConfirm.show();
else this.applyChanges();
}
onConfirmAccept() {
this.ticket.withWarningAccept = true;
this.applyChanges();
}
applyChanges() {
if (!this.ticket.option) {
return this.vnApp.showError(
this.$t('Choose an option')
@ -102,7 +113,8 @@ class Controller extends Component {
landed: this.ticket.landed,
isDeleted: this.ticket.isDeleted,
option: parseInt(this.ticket.option),
isWithoutNegatives: this.ticket.withoutNegatives
isWithoutNegatives: this.ticket.withoutNegatives,
withWarningAccept: this.ticket.withWarningAccept
};
this.$http.post(query, params)

View File

@ -8,4 +8,6 @@ New price: Nuevo precio
Price difference: Diferencia de precio
Create without negatives: Crear sin negativos
Clone this ticket with the changes and only sales availables: Clona este ticket con los cambios y solo las ventas disponibles.
Movable: Movible
Movable: Movible
Negatives are going to be generated, are you sure you want to advance all the lines?: Se van a generar negativos, ¿seguro que quieres adelantar todas las líneas?
Edit basic data: Editar datos básicos

View File

@ -27,7 +27,7 @@
<span
ng-click="itemDescriptor.show($event, sale.itemFk, sale.id)"
class="link">
{{sale.itemFk | zeroFill:6}}
{{sale.itemFk}}
</span>
</td>
<td rowspan="{{::sale.components.length + 1}}" vn-fetched-tags>

View File

@ -55,7 +55,7 @@
ng-model="expedition.checked">
</vn-check>
</vn-td>
<vn-td number expand>{{expedition.id | zeroFill:6}}</vn-td>
<vn-td number expand>{{expedition.id}}</vn-td>
<vn-td number>
<span
ng-class="{link: expedition.packagingItemFk}"

View File

@ -143,7 +143,7 @@
</td>
<td>{{::ticket.liters}}</td>
<td>{{::ticket.lines}}</td>
<td>
<td separator>
<span
ng-click="ticketDescriptor.show($event, ticket.futureId)"
class="link">

View File

@ -149,9 +149,19 @@ export default class Controller extends Section {
case 'lines':
return {'lines': value};
case 'ipt':
return {'ipt': value};
return {or:
[
{'ipt': {like: `%${value}%`}},
{'ipt': null}
]
};
case 'futureIpt':
return {'futureIpt': value};
return {or:
[
{'futureIpt': {like: `%${value}%`}},
{'futureIpt': null}
]
};
}
}
}

View File

@ -75,7 +75,7 @@
ng-show="::request.saleFk"
ng-click="itemDescriptor.show($event, request.sale.itemFk, request.sale.id)"
class="link">
{{::request.saleFk | zeroFill:6}}
{{::request.saleFk}}
</span>
</vn-td>
<vn-td number

View File

@ -131,7 +131,7 @@
</vn-td>
<vn-td>
<span class="link" ng-if="sale.id"
ng-click="itemDescriptor.show($event, sale.itemFk, sale.id)">
ng-click="itemDescriptor.show($event, sale.itemFk, sale.id, $ctrl.ticket.shipped)">
{{sale.itemFk}}
</span>
<vn-autocomplete ng-if="!sale.id" class="dense"
@ -365,7 +365,7 @@
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="sale in $ctrl.transfer.sales">
<vn-td number shrink>{{::sale.itemFk | zeroFill:6}}</vn-td>
<vn-td number shrink>{{::sale.itemFk}}</vn-td>
<vn-td>
<span title="{{::sale.concept}}">{{::sale.concept}}</span>
</vn-td>

View File

@ -177,7 +177,7 @@
<span
ng-click="itemDescriptor.show($event, sale.itemFk, sale.id, $ctrl.ticket.shipped)"
class="link">
{{sale.itemFk | zeroFill:6}}
{{sale.itemFk}}
</span>
</vn-td>
<vn-td number shrink>
@ -312,7 +312,7 @@
ng-show="::request.saleFk"
ng-click="itemDescriptor.show($event, request.sale.itemFk, request.sale.id)"
class="link">
{{request.sale.itemFk | zeroFill:6}}
{{request.sale.itemFk}}
</span>
</vn-td>
<vn-td number>

View File

@ -35,7 +35,7 @@
<span
ng-click="itemDescriptor.show($event, sale.itemFk, sale.id)"
class="link">
{{sale.itemFk | zeroFill:6}}
{{sale.itemFk}}
</span>
</vn-td>
<vn-td vn-fetched-tags>

View File

@ -1,6 +1,6 @@
{
"name": "salix-back",
"version": "23.06.01",
"version": "23.08.01",
"author": "Verdnatura Levante SL",
"description": "Salix backend",
"license": "GPL-3.0",

View File

@ -4,5 +4,4 @@ require('./uppercase');
require('./currency');
require('./percentage');
require('./number');
require('./zerofill');

View File

@ -1,9 +0,0 @@
import zerofill from '../zerofill.js';
describe('zerofill filter', () => {
const superDuperNumber = 1984;
it('should filter the number filling it with zeros up to 6 characters length', () => {
expect(zerofill(superDuperNumber, '000000')).toEqual('001984');
});
});

View File

@ -1,10 +0,0 @@
const Vue = require('vue');
const zerofill = function(value, pad) {
const valueStr = String(value);
return pad.substring(0, pad.length - valueStr.length) + valueStr;
};
Vue.filter('zerofill', zerofill);
module.exports = zerofill;

View File

@ -17,8 +17,8 @@
</p>
<h4 style="text-align: center; margin-top: 10%">{{$t('Agree') | uppercase}}</h4>
<p style="margin-top: 8%; text-align: justify">
{{$t('Date')}} {{formatDate(client.payed, '%d-%m-%Y')}} {{$t('Compensate')}} {{client.amountPaid}} €
{{$t('From client')}} {{client.name}} {{$t('Toclient')}} {{company.name}}.
{{$t('Date')}} {{client.payed | date('%d-%m-%Y')}} {{$t('Compensate')}} {{client.amountPaid}} €
{{$t('From client')}} {{client.name}} {{$t('Against the balance of')}}: {{client.invoiceFk}}.
</p>
<p style="margin-top: 8%">
{{$t('Reception')}} <span style="color: blue">administracion@verdnatura.es</span>

View File

@ -4,13 +4,13 @@ Compensation: Compensación de saldos deudores y acreedores
In one hand: De una parte
CIF: con CIF
NIF: con NIF
Home: y domicilio sito en
Home: y domicilio sito en
In other hand: De la otra
Sr: Don/Doña
Agree: Acuerdan
Date: En fecha de
Compensate: se ha compensado el saldo de
Compensate: se ha compensado el saldo de
From client: del cliente/proveedor
To client: con el cliente/proveedor
Against the balance of: contra el saldo de
Reception: Por favor, rogamos confirmen la recepción de esta compensación al email
Greetings: Saludos cordiales,
Greetings: Saludos cordiales,

View File

@ -4,6 +4,7 @@ SELECT
c.street,
c.fi,
c.city,
r.invoiceFk,
r.amountPaid,
r.payed
FROM client c

View File

@ -45,7 +45,7 @@
</thead>
<tbody v-for="sale in sales">
<tr>
<td>{{sale.itemFk | zerofill('000000')}}</td>
<td>{{sale.itemFk}}</td>
<td class="number">{{Math.trunc(sale.subtotal)}}</td>
<td width="50%">{{sale.concept}}</td>
</tr>

View File

@ -13,7 +13,7 @@
</tr>
<tr>
<td class="font gray uppercase">{{$t('date')}}</td>
<th>{{formatDate(new Date(), '%d-%m-%Y');}}</th>
<th>{{formatDate(new Date(), '%d-%m-%Y')}}</th>
</tr>
</tbody>
</table>
@ -44,7 +44,7 @@
</thead>
<tbody v-for="sale in sales" :key="sale.id">
<tr>
<td>{{formatDate(sale.issued, '%d-%m-%Y');}}</td>
<td>{{formatDate(sale.issued, '%d-%m-%Y')}}</td>
<td>{{sale.ref}}</td>
<td class="number">{{sale.debtOut}}</td>
<td class="number">{{sale.debtIn}}</td>

View File

@ -21,7 +21,7 @@
<td id="outline" class="ellipsize">{{labelData.code == 'V' ? (labelData.size || 0) + 'cm' : (labelData.volume || 0) + 'm³'}}</td>
</tr>
<tr>
<td><div id="agencyDescripton" class="ellipsize">{{labelData.agencyDescription ? labelData.agencyDescription.toUpperCase() : '---'}}</div></td>
<td><div id="agencyDescripton" class="ellipsize">{{getAgencyDescripton(labelData)}}</div></td>
<td id="bold">{{labelData.lineCount || 0}}</td>
</tr>
<tr>

View File

@ -59,5 +59,17 @@ module.exports = {
return value;
},
getAgencyDescripton(labelData) {
let value;
if (labelData.agencyDescription)
value = labelData.agencyDescription.toUpperCase().substring(0, 11);
else
value = '---';
if (labelData.routeFk)
value = `${value} [${labelData.routeFk.toString().substring(0, 3)}]`;
return value;
},
},
};

Some files were not shown because too many files have changed in this diff Show More