Merge branch 'dev' of https://git.verdnatura.es/salix into dev

This commit is contained in:
Gerard 2018-10-25 10:54:23 +02:00
commit 3eef3b05ce
19 changed files with 2406 additions and 1165 deletions

View File

@ -5,108 +5,92 @@ describe('Claim edit basic data path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
nightmare
.waitForLogin('salesAssistant');
});
it('should click on the Claims button of the top bar menu', done => {
return nightmare
it('should click on the Claims button of the top bar menu', async() => {
let url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.claimsButton)
.wait(selectors.claimsIndex.searchClaimInput)
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/claim/index');
done();
}).catch(done.fail);
.parsedUrl();
expect(url.hash).toEqual('#!/claim/index');
});
it('should search for the claim with id 1', done => {
return nightmare
it('should search for the claim with id 1', async() => {
let resultCount = await nightmare
.wait(selectors.claimsIndex.searchResult)
.type(selectors.claimsIndex.searchClaimInput, '1')
.click(selectors.claimsIndex.searchButton)
.waitForNumberOfElements(selectors.claimsIndex.searchResult, 1)
.countElement(selectors.claimsIndex.searchResult)
.then(result => {
expect(result).toEqual(1);
done();
}).catch(done.fail);
.countElement(selectors.claimsIndex.searchResult);
expect(resultCount).toEqual(1);
});
it(`should click on the search result to access to the claim Basic Data`, done => {
return nightmare
it(`should click on the search result to access to the claim Basic Data`, async() => {
let url = await nightmare
.waitToClick(selectors.claimsIndex.searchResult)
.waitToClick(selectors.claimBasicData.basicDataButton)
.waitForURL('basic-data')
.url()
.then(url => {
expect(url).toContain('basic-data');
done();
}).catch(done.fail);
.url();
expect(url).toContain('basic-data');
});
it(`should edit claim state, is paid with mana and observation fields`, done => {
return nightmare
it(`should edit claim state, is paid with mana and observation fields`, async() => {
let result = await nightmare
.waitToClick(selectors.claimBasicData.claimStateSelect)
.waitToClick(selectors.claimBasicData.claimStateSelectThirdOption)
.waitToClick(selectors.claimBasicData.isPaidWithManaCheckbox)
.clearInput(selectors.claimBasicData.observationInput)
.type(selectors.claimBasicData.observationInput, 'edited observation')
.click(selectors.claimBasicData.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
done();
}).catch(done.fail);
.waitForSnackbar();
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
});
it('should confirm the claim state was edited', done => {
return nightmare
it('should confirm the claim state was edited', async() => {
let result = await nightmare
.click(selectors.claimDetails.detailsButton)
.wait(selectors.claimDetails.addItemButton)
.click(selectors.claimBasicData.basicDataButton)
.wait(selectors.claimBasicData.claimStateSelect)
.getInputValue(selectors.claimBasicData.claimStateSelect)
.then(result => {
expect(result).toEqual('Gestionado');
done();
}).catch(done.fail);
.getInputValue(selectors.claimBasicData.claimStateSelect);
expect(result).toEqual('Gestionado');
});
it('should confirm the Is paid with mana checkbox is checked', done => {
return nightmare
it('should confirm the Is paid with mana checkbox is checked', async() => {
let value = await nightmare
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.claimBasicData.isPaidWithManaCheckbox)
.then(value => {
expect(value).toBeTruthy();
done();
}).catch(done.fail);
}, selectors.claimBasicData.isPaidWithManaCheckbox);
expect(value).toBeTruthy();
});
it('should confirm the claim observation was edited', done => {
return nightmare
.getInputValue(selectors.claimBasicData.observationInput)
.then(result => {
expect(result).toEqual('edited observation');
done();
}).catch(done.fail);
it('should confirm the claim observation was edited', async() => {
let result = await nightmare
.getInputValue(selectors.claimBasicData.observationInput);
expect(result).toEqual('edited observation');
});
it(`should edit the claim to leave it untainted`, done => {
return nightmare
it(`should edit the claim to leave it untainted`, async() => {
let result = await nightmare
.waitToClick(selectors.claimBasicData.claimStateSelect)
.waitToClick(selectors.claimBasicData.claimStateSelectFourthOption)
.waitToClick(selectors.claimBasicData.isPaidWithManaCheckbox)
.clearInput(selectors.claimBasicData.observationInput)
.type(selectors.claimBasicData.observationInput, 'Observation one')
.click(selectors.claimBasicData.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
done();
}).catch(done.fail);
.waitForSnackbar();
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
});
});

View File

@ -10,138 +10,116 @@ describe('Client', () => {
.waitForLogin('employee');
});
it('should access to the clients index by clicking the clients button', done => {
return nightmare
it('should access to the clients index by clicking the clients button', async() => {
let url = await nightmare
.click(selectors.moduleAccessView.clientsSectionButton)
.wait(selectors.clientsIndex.createClientButton)
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/client/index');
done();
}).catch(done.fail);
.parsedUrl();
expect(url.hash).toEqual('#!/client/index');
});
it(`should search for the user Carol Danvers to confirm it isn't created yet`, done => {
return nightmare
it(`should search for the user Carol Danvers to confirm it isn't created yet`, async() => {
let result = await nightmare
.wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Carol Danvers')
.click(selectors.clientsIndex.searchButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 0)
.countElement(selectors.clientsIndex.searchResult)
.then(result => {
expect(result).toEqual(0);
done();
}).catch(done.fail);
.countElement(selectors.clientsIndex.searchResult);
expect(result).toEqual(0);
});
it('should access to the create client view by clicking the create-client floating button', done => {
return nightmare
it('should access to the create client view by clicking the create-client floating button', async() => {
let url = await nightmare
.click(selectors.clientsIndex.createClientButton)
.wait(selectors.createClientView.createButton)
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/client/create');
done();
}).catch(done.fail);
.parsedUrl();
expect(url.hash).toEqual('#!/client/create');
});
it('should return to the client index by clicking the cancel button', done => {
return nightmare
it('should return to the client index by clicking the cancel button', async() => {
let url = await nightmare
.click(selectors.createClientView.cancelButton)
.wait(selectors.clientsIndex.createClientButton)
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/client/index');
done();
}).catch(done.fail);
.parsedUrl();
expect(url.hash).toEqual('#!/client/index');
});
it('should now access to the create client view by clicking the create-client floating button', done => {
return nightmare
it('should now access to the create client view by clicking the create-client floating button', async() => {
let url = await nightmare
.click(selectors.clientsIndex.createClientButton)
.wait(selectors.createClientView.createButton)
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/client/create');
done();
}).catch(done.fail);
.parsedUrl();
expect(url.hash).toEqual('#!/client/create');
});
it('should receive an error when clicking the create button having all the form fields empty', done => {
return nightmare
it('should receive an error when clicking the create button having all the form fields empty', async() => {
let result = await nightmare
.click(selectors.createClientView.createButton)
.waitForLastSnackbar()
.then(result => {
expect(result).toEqual('Some fields are invalid');
done();
}).catch(done.fail);
.waitForLastSnackbar();
expect(result).toEqual('Some fields are invalid');
});
it('should receive an error when clicking the create button having name and Business name fields empty', done => {
return nightmare
it('should receive an error when clicking the create button having name and Business name fields empty', async() => {
let result = await nightmare
.type(selectors.createClientView.taxNumber, '74451390E')
.type(selectors.createClientView.userName, 'CaptainMarvel')
.type(selectors.createClientView.email, 'CarolDanvers@verdnatura.es')
.waitToClick(selectors.createClientView.salesPersonInput)
.waitToClick(selectors.createClientView.salesBruceBannerOption)
.click(selectors.createClientView.createButton)
.waitForLastSnackbar()
.then(result => {
expect(result).toEqual('Some fields are invalid');
done();
}).catch(done.fail);
.waitForLastSnackbar();
expect(result).toEqual('Some fields are invalid');
});
it(`should attempt to create a new user with all it's data but wrong email`, done => {
return nightmare
it(`should attempt to create a new user with all it's data but wrong email`, async() => {
let result = await nightmare
.type(selectors.createClientView.name, 'Carol Danvers')
.type(selectors.createClientView.socialName, 'AVG tax')
.clearInput(selectors.createClientView.email)
.type(selectors.createClientView.email, 'incorrect email format')
.click(selectors.createClientView.createButton)
.waitForLastSnackbar()
.then(result => {
expect(result).toEqual('Some fields are invalid');
done();
}).catch(done.fail);
.waitForLastSnackbar();
expect(result).toEqual('Some fields are invalid');
});
it(`should create a new user with all correct data`, done => {
return nightmare
it(`should create a new user with all correct data`, async() => {
let result = await nightmare
.clearInput(selectors.createClientView.email)
.type(selectors.createClientView.email, 'caroldanvers@verdnatura.es')
.click(selectors.createClientView.createButton)
.waitForLastSnackbar()
.then(result => {
expect(result).toEqual('Data saved!');
done();
}).catch(done.fail);
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should click on the Clients button of the top bar menu', done => {
return nightmare
it('should click on the Clients button of the top bar menu', async() => {
let url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/client/index');
done();
}).catch(done.fail);
.parsedUrl();
expect(url.hash).toEqual('#!/client/index');
});
it(`should search for the user Carol Danvers to confirm it exists`, done => {
return nightmare
it(`should search for the user Carol Danvers to confirm it exists`, async() => {
let result = await nightmare
.wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Carol Danvers')
.click(selectors.clientsIndex.searchButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countElement(selectors.clientsIndex.searchResult)
.then(result => {
expect(result).toEqual(1);
done();
}).catch(done.fail);
.countElement(selectors.clientsIndex.searchResult);
expect(result).toEqual(1);
});
});
});

955
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -35,11 +35,11 @@
"cors": "^2.8.4",
"css-loader": "^0.25.0",
"del": "^2.2.2",
"eslint": "^3.19.0",
"eslint": "^5.7.0",
"eslint-config-angular": "^0.5.0",
"eslint-config-google": "^0.6.0",
"eslint-config-loopback": "^4.0.0",
"eslint-config-xo": "^0.17.0",
"eslint-config-google": "^0.11.0",
"eslint-config-loopback": "^12.0.0",
"eslint-config-xo": "^0.25.0",
"eslint-plugin-jasmine": "^2.10.1",
"fancy-log": "^1.3.2",
"file-loader": "^1.1.11",

View File

@ -1,18 +1,18 @@
::IMPORTANT Any changes in this file are to applyed to mirror file export-data.sh
echo USE `account`; > install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info account role roleRole roleInherit >> install/dump/03-dumpedFixtures.sql
echo USE `salix`; >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info salix ACL >> install/dump/03-dumpedFixtures.sql
echo USE `vn`; >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn cplusInvoiceType477 cplusSubjectOp cplusTaxBreak bookingPlanner pgc tag alertLevel>> install/dump/03-dumpedFixtures.sql
echo USE `vn2008`; >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn2008 accion_dits Gastos Tintas tarifa_componentes tarifa_componentes_series state bionic_updating_options Grupos Monedas container iva_group_codigo escritos cl_est cl_con cl_res cl_dev cl_mot >> install/dump/03-dumpedFixtures.sql
echo USE `bi`; >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info bi tarifa_componentes tarifa_componentes_series >> install/dump/03-dumpedFixtures.sql
echo USE `cache`; >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info cache cache >> install/dump/03-dumpedFixtures.sql
echo USE `hedera`; >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info hedera tpvError tpvResponse tpvConfig >> install/dump/03-dumpedFixtures.sql
echo USE `account`; > install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info account role roleRole roleInherit >> install/dump/dumpedFixtures.sql
echo USE `salix`; >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info salix ACL >> install/dump/dumpedFixtures.sql
echo USE `vn`; >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn cplusInvoiceType477 cplusSubjectOp cplusTaxBreak bookingPlanner pgc tag alertLevel>> install/dump/dumpedFixtures.sql
echo USE `vn2008`; >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn2008 accion_dits Gastos Tintas tarifa_componentes tarifa_componentes_series state bionic_updating_options Grupos Monedas container iva_group_codigo escritos cl_est cl_con cl_res cl_dev cl_mot >> install/dump/dumpedFixtures.sql
echo USE `bi`; >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info bi tarifa_componentes tarifa_componentes_series >> install/dump/dumpedFixtures.sql
echo USE `cache`; >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info cache cache >> install/dump/dumpedFixtures.sql
echo USE `hedera`; >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info hedera tpvError tpvResponse tpvConfig >> install/dump/dumpedFixtures.sql

View File

@ -1,16 +1,16 @@
#!/bin/bash
#IMPORTANT Any changes in this file are to applyed to mirror file export-data.cmd
echo "USE \`account\`;" > install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info account role roleRole roleInherit >> install/dump/03-dumpedFixtures.sql
echo "USE \`salix\`;" >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info salix ACL >> install/dump/03-dumpedFixtures.sql
echo "USE \`vn\`;" >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn cplusInvoiceType477 cplusSubjectOp cplusTaxBreak bookingPlanner pgc tag alertLevel >> install/dump/03-dumpedFixtures.sql
echo "USE \`vn2008\`;" >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn2008 accion_dits Gastos Tintas tarifa_componentes tarifa_componentes_series state bionic_updating_options Grupos Monedas container iva_group_codigo escritos cl_est cl_con cl_res cl_dev cl_mot >> install/dump/03-dumpedFixtures.sql
echo "USE \`bi\`;" >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info bi tarifa_componentes tarifa_componentes_series >> install/dump/03-dumpedFixtures.sql
echo "USE \`cache\`;" >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info cache cache >> install/dump/03-dumpedFixtures.sql
echo "USE \`hedera\`;" >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info hedera tpvError tpvResponse tpvConfig >> install/dump/03-dumpedFixtures.sql
echo "USE \`account\`;" > install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info account role roleRole roleInherit >> install/dump/dumpedFixtures.sql
echo "USE \`salix\`;" >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info salix ACL >> install/dump/dumpedFixtures.sql
echo "USE \`vn\`;" >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn cplusInvoiceType477 cplusSubjectOp cplusTaxBreak bookingPlanner pgc tag alertLevel >> install/dump/dumpedFixtures.sql
echo "USE \`vn2008\`;" >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn2008 accion_dits Gastos Tintas tarifa_componentes tarifa_componentes_series state bionic_updating_options Grupos Monedas container iva_group_codigo escritos cl_est cl_con cl_res cl_dev cl_mot >> install/dump/dumpedFixtures.sql
echo "USE \`bi\`;" >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info bi tarifa_componentes tarifa_componentes_series >> install/dump/dumpedFixtures.sql
echo "USE \`cache\`;" >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info cache cache >> install/dump/dumpedFixtures.sql
echo "USE \`hedera\`;" >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info hedera tpvError tpvResponse tpvConfig >> install/dump/dumpedFixtures.sql

View File

@ -1,2 +1,2 @@
::IMPORTANT Any changes in this file are to applyed to mirror file export-structure.sh
mysqldump --defaults-file=connect.ini --default-character-set=utf8 --no-data --comments --triggers --routines --events --databases account util vn2008 vn edi bs bi pbx cache salix vncontrol hedera stock > install/dump/01-structure.sql
mysqldump --defaults-file=connect.ini --default-character-set=utf8 --no-data --comments --triggers --routines --events --databases account util vn2008 vn edi bs bi pbx cache salix vncontrol hedera stock > install/dump/structure.sql

View File

@ -1,3 +1,3 @@
#!/bin/bash
#IMPORTANT Any changes in this file are to applyed to mirror file export-structure.cmd
mysqldump --defaults-file=connect.ini --default-character-set=utf8 --no-data --comments --triggers --routines --events --databases account util vn2008 vn edi bs bi pbx cache salix vncontrol hedera stock > install/dump/01-structure.sql
mysqldump --defaults-file=connect.ini --default-character-set=utf8 --no-data --comments --triggers --routines --events --databases account util vn2008 vn edi bs bi pbx cache salix vncontrol hedera stock > install/dump/structure.sql

View File

@ -3,9 +3,6 @@
* Ya está en producción
**/
ALTER TABLE `vn2008`.`Clientes`
ADD COLUMN `bankEntityFk` INT(10) UNSIGNED NULL AFTER `hasLcr`;
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED

View File

@ -1,13 +0,0 @@
ALTER TABLE `vn`.`clientLog`
CHANGE COLUMN `newInstance` `newInstance` TEXT NULL DEFAULT NULL ;
ALTER TABLE `vn`.`clientLog`
CHANGE COLUMN `model` `changedModel` TEXT CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NULL DEFAULT NULL ,
ADD COLUMN `changedModelId` INT(11) NULL DEFAULT NULL AFTER `newInstance`,
ADD COLUMN `changedModelValue` VARCHAR(45) NULL DEFAULT NULL AFTER `changedModelId`;
ALTER TABLE `vn`.`clientLog`
CHANGE COLUMN `changedModel` `changedModel` VARCHAR(45) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NULL DEFAULT NULL ;

View File

@ -1,11 +0,0 @@
DROP TRIGGER IF EXISTS `vn`.`clientLog_BEFORE_INSERT`;
DELIMITER $$
USE `vn`$$
CREATE DEFINER=`root`@`%` TRIGGER `vn`.`clientLog_BEFORE_INSERT` BEFORE INSERT ON `clientLog` FOR EACH ROW
BEGIN
IF NEW.newInstance is NULL THEN
SET NEW.newInstance = NEW.description;
END IF;
END$$
DELIMITER ;

View File

@ -1,10 +0,0 @@
ALTER TABLE `vn`.`clientLog`
DROP FOREIGN KEY `clientLog_ibfk_2`;
ALTER TABLE `vn`.`clientLog`
CHANGE COLUMN `userFk` `userFk` INT(10) UNSIGNED NULL DEFAULT NULL ;
ALTER TABLE `vn`.`clientLog`
ADD CONSTRAINT `clientLog_ibfk_2`
FOREIGN KEY (`userFk`)
REFERENCES `account`.`user` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE;

View File

@ -1,17 +0,0 @@
INSERT INTO salix.ACL(id, model, property, accessType, permission, principalType, principalId)
VALUES
(104, 'Item', '*', 'WRITE', 'ALLOW', 'ROLE', 'marketingBoss'),
(105, 'ItemBarcode', '*', 'WRITE', 'ALLOW', 'ROLE', 'marketingBoss'),
(106, 'ItemBotanical', '*', 'WRITE', 'ALLOW', 'ROLE', 'marketingBoss'),
(107, 'ItemNiche', '*', 'WRITE', 'ALLOW', 'ROLE', 'marketingBoss'),
(108, 'ItemPlacement', '*', 'WRITE', 'ALLOW', 'ROLE', 'marketingBoss'),
(109, 'UserConfig', '*', '*', 'ALLOW', 'ROLE', 'employee'),
(110, 'Bank', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
(111, 'ClientLog', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
(112, 'Defaulter', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
(113, 'ClientRisk', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
(114, 'Receipt', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
(115, 'Receipt', '*', 'WRITE', 'ALLOW', 'ROLE', 'administrative');
UPDATE salix.ACL
SET model='ItemTag', property='*', accessType='WRITE', permission='ALLOW', principalType='ROLE', principalId='marketingBoss'
WHERE id=52;

View File

@ -1,8 +0,0 @@
CREATE TABLE `vn`.`userConfig` (
`userFk` int(10) unsigned NOT NULL,
`warehouseFk` smallint(6) DEFAULT NULL,
`companyFk` smallint(5) unsigned DEFAULT NULL,
`created` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`userFk`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Configuración de usuario en Salix';

View File

@ -1,119 +0,0 @@
USE `vn`;
DROP procedure IF EXISTS `itemDiary`;
DELIMITER $$
USE `vn`$$
CREATE DEFINER=`root`@`%` PROCEDURE `itemDiary`(IN vItemId INT, IN vWarehouse INT)
BEGIN
DECLARE vDateInventory DATETIME;
DECLARE vCurdate DATE DEFAULT CURDATE();
DECLARE vDayEnd DATETIME DEFAULT util.dayEnd(vCurdate);
-- traduccion: date, alertLevel, origin, reference, name, In, Out, Balance
SELECT Fechainventario INTO vDateInventory FROM vn2008.tblContadores;
SET @a = 0;
SELECT sql_no_cache DATE(date) AS date,
alertLevel,
stateName,
origin,
reference,
clientFk,
name,
`in`,
`out`,
@a := @a + IFNULL(`in`,0) - IFNULL(`out`,0) as balance,
isPicked,
isTicket
FROM
( SELECT tr.landed as date,
b.quantity as `in`,
NULL as `out`,
IF(tr.isReceived != FALSE,3, IF(tr.isDelivered,1,0)) as alertLevel,
st.name AS stateName,
s.name as name,
e.ref as reference,
e.id as origin,
s.id as clientFk,
TRUE isPicked,
FALSE AS isTicket
FROM vn.buy b
JOIN vn.entry e ON e.id = b.entryFk
JOIN vn.travel tr ON tr.id = e.travelFk
JOIN vn.supplier s ON s.id = e.supplierFk
JOIN vn.alertLevel al ON al.alertLevel =
CASE
WHEN tr.isReceived != FALSE THEN 3
WHEN tr.isDelivered THEN 1
ELSE 0
END
JOIN vn.state st ON st.code = al.code
WHERE tr.landed >= vDateInventory
AND vWarehouse = tr.warehouseInFk
AND b.itemFk = vItemId
AND e.isInventory = 0
UNION ALL
SELECT tr.shipped as date,
NULL as `in`,
b.quantity as `out`,
IF(tr.isReceived != FALSE,3, IF(tr.isDelivered,1,0)) as alertLevel,
st.name AS stateName,
s.name as name,
e.ref as reference,
e.id as origin,
s.id as clientFk,
TRUE isPicked,
FALSE AS isTicket
FROM vn.buy b
JOIN vn.entry e ON e.id = b.entryFk
JOIN vn.travel tr ON tr.id = e.travelFk
JOIN vn.warehouse w ON w.id = tr.warehouseOutFk
JOIN vn.supplier s ON s.id = e.supplierFk
JOIN vn.alertLevel al ON al.alertLevel =
CASE
WHEN tr.isReceived != FALSE THEN 3
WHEN tr.isDelivered THEN 1
ELSE 0
END
JOIN vn.state st ON st.code = al.code
WHERE tr.shipped >= vDateInventory
AND vWarehouse =tr.warehouseOutFk
AND s.id <> 4
AND b.itemFk = vItemId
AND e.isInventory = 0
AND w.isFeedStock = 0
UNION ALL
SELECT t.shipped as date,
NULL as `in`,
s.quantity as `out`,
al.alertLevel as alertLevel,
st.name AS stateName,
t.nickname as name,
t.refFk as reference,
t.id as origin,
t.clientFk,
TRUE as isPicked, -- stk.id as isPicked
TRUE as isTicket
FROM vn.sale s
JOIN vn.ticket t ON t.id = s.ticketFk
LEFT JOIN vn.ticketState ts ON ts.ticket = t.id
JOIN vn.client c ON c.id = t.clientFk
JOIN vn.alertLevel al ON al.alertLevel =
CASE
WHEN t.shipped < vCurdate THEN 3
WHEN t.shipped > vDayEnd THEN 0
ELSE IFNULL(ts.alertLevel, 0)
END
JOIN vn.state st ON st.code = al.code
-- LEFT JOIN vn.saleTracking stk ON stk.saleFk = s.id AND stk.stateFk = 14
WHERE t.shipped >= vDateInventory
AND s.itemFk = vItemId
AND vWarehouse =t.warehouseFk
) AS itemDiary
ORDER BY date DESC, alertLevel DESC, isPicked DESC, `in` DESC, `out` DESC;
END$$
DELIMITER ;

View File

@ -1,14 +0,0 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn`.`defaulter` AS
SELECT
`d`.`client` AS `clientFk`,
`d`.`date` AS `created`,
`d`.`amount` AS `amount`,
`d`.`defaulterSince` AS `defaulterSinced`,
`d`.`hasChanged` AS `hasChanged`
FROM
`bi`.`defaulters` `d`;

View File

@ -1,12 +0,0 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `clientRisk` AS
SELECT
`c`.`customer_id` AS `clientFk`,
`c`.`company_id` AS `companyFk`,
`c`.`amount` AS `amount`
FROM
`bi`.`customer_risk` `c`;

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff