order sales by concept #1166
gitea/salix/dev This commit looks good Details

This commit is contained in:
Joan Sanchez 2019-03-04 12:04:23 +01:00
parent 00f9754c1e
commit 3c6d27a285
5 changed files with 58 additions and 7 deletions

View File

@ -0,0 +1,36 @@
DROP PROCEDURE IF EXISTS vn.ticketGetVisibleAvailable;
DELIMITER $$
$$
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`ticketGetVisibleAvailable`(
vTicket INT)
BEGIN
DECLARE vVisibleCalc INT;
DECLARE vAvailableCalc INT;
DECLARE vShipped DATE;
DECLARE vWarehouse TINYINT;
DECLARE vAlertLevel INT;
SELECT t.warehouseFk, t.shipped, ts.alertLevel INTO vWarehouse, vShipped, vAlertLevel
FROM ticket t
LEFT JOIN ticketState ts ON ts.ticketFk = vTicket
WHERE t.id = vTicket;
IF vAlertLevel IS NULL OR vAlertLevel = 0 THEN
IF vShipped >= CURDATE() THEN
CALL cache.available_refresh(vAvailableCalc, FALSE, vWarehouse, vShipped);
END IF;
IF vShipped = CURDATE() THEN
CALL cache.visible_refresh(vVisibleCalc, FALSE, vWarehouse);
END IF;
END IF;
SELECT s.id, s.itemFk, s.quantity, s.concept, s.price, s.reserved, s.discount, v.visible, av.available, it.image
FROM sale s
LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCalc
LEFT JOIN cache.available av ON av.item_id = s.itemFk AND av.calc_id = vAvailableCalc
LEFT JOIN item it ON it.id = s.itemFk
WHERE s.ticketFk = vTicket
ORDER BY s.concept;
END$$
DELIMITER ;

View File

@ -15,21 +15,21 @@ describe('Ticket List sale path', () => {
const value = await nightmare
.waitToGetProperty(selectors.ticketSales.firstSaleColour, 'innerText');
expect(value).toContain('Red');
expect(value).toContain('Yellow');
});
it('should confirm the first ticket sale contains the lenght', async() => {
const value = await nightmare
.waitToGetProperty(selectors.ticketSales.firstSaleText, 'innerText');
expect(value).toContain('3');
expect(value).toContain('5');
});
it('should confirm the first ticket sale contains the price', async() => {
const value = await nightmare
.waitToGetProperty(selectors.ticketSales.firstSalePrice, 'innerText');
expect(value).toContain('1.30');
expect(value).toContain('2.30');
});
it('should confirm the first ticket sale contains the discount', async() => {
@ -43,7 +43,7 @@ describe('Ticket List sale path', () => {
const value = await nightmare
.waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText');
expect(value).toContain('19.50');
expect(value).toContain('23');
});
it('should navigate to the catalog by pressing the new item button', async() => {

View File

@ -1,11 +1,23 @@
@import "variables";
vn-td-editable {
cursor: pointer;
text {
cursor: pointer;
display: block
}
outline: none;
position: relative;
&:not([disabled="true"]) {
cursor: initial;
text:hover::after {
font-family: 'salixfont';
float: right;
content: '\e900';
display: block
}
}
&.selected > .text {
visibility: hidden;

View File

@ -6,6 +6,9 @@ describe('ticket getSales()', () => {
expect(sales.length).toEqual(4);
expect(sales[0].tags).toBeDefined();
expect(sales[1].claim).toBeDefined();
expect(sales[1].tags).toBeDefined();
expect(sales[2].tags).toBeDefined();
expect(sales[3].tags).toBeDefined();
expect(sales[2].claim).toBeDefined();
});
});

View File

@ -113,7 +113,7 @@ module.exports = Self => {
where: {
ticketFk: ticketFk
},
order: 'itemFk ASC',
order: 'concept',
include: [
{relation: 'item'},
{relation: 'claimBeginning'}