parent
f2bef8dcf6
commit
e8ce8e42fd
|
@ -0,0 +1,73 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`clientCreate`(
|
||||||
|
vFirstname VARCHAR(50),
|
||||||
|
vSurnames VARCHAR(50),
|
||||||
|
vFi VARCHAR(9),
|
||||||
|
vAddress TEXT,
|
||||||
|
vPostcode CHAR(5),
|
||||||
|
vCity VARCHAR(25),
|
||||||
|
vProvinceFk SMALLINT(5),
|
||||||
|
vCompanyFk SMALLINT(5),
|
||||||
|
vPhone VARCHAR(11),
|
||||||
|
vEmail VARCHAR(255),
|
||||||
|
vUserFk INT)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Create new client
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
DECLARE vPayMethodFk INT DEFAULT 4;
|
||||||
|
DECLARE vDueDay INT DEFAULT 5;
|
||||||
|
DECLARE vDefaultCredit DECIMAL(10, 2) DEFAULT 300.00;
|
||||||
|
DECLARE vIsTaxDataChecked TINYINT(1) DEFAULT 1;
|
||||||
|
DECLARE vHasCoreVnl BOOLEAN DEFAULT TRUE;
|
||||||
|
DECLARE vMandateTypeFk INT DEFAULT 2;
|
||||||
|
|
||||||
|
INSERT INTO `client` (
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
street,
|
||||||
|
fi,
|
||||||
|
phone,
|
||||||
|
email,
|
||||||
|
provinceFk,
|
||||||
|
city,
|
||||||
|
postcode,
|
||||||
|
socialName,
|
||||||
|
payMethodFk,
|
||||||
|
dueDay,
|
||||||
|
credit,
|
||||||
|
isTaxDataChecked,
|
||||||
|
hasCoreVnl,
|
||||||
|
isEqualizated)
|
||||||
|
VALUES (
|
||||||
|
vUserFk,
|
||||||
|
CONCAT(vFirstname, ' ', vSurnames),
|
||||||
|
vAddress,
|
||||||
|
TRIM(vFi),
|
||||||
|
vPhone,
|
||||||
|
vEmail,
|
||||||
|
vProvinceFk,
|
||||||
|
vCity,
|
||||||
|
vPostcode,
|
||||||
|
CONCAT(vSurnames, ' ', vFirstname),
|
||||||
|
vPayMethodFk,
|
||||||
|
vDueDay,
|
||||||
|
vDefaultCredit,
|
||||||
|
vIsTaxDataChecked,
|
||||||
|
vHasCoreVnl,
|
||||||
|
FALSE
|
||||||
|
) ON duplicate key update
|
||||||
|
payMethodFk = vPayMethodFk,
|
||||||
|
dueDay = vDueDay,
|
||||||
|
credit = vDefaultCredit,
|
||||||
|
isTaxDataChecked = vIsTaxDataChecked,
|
||||||
|
hasCoreVnl = vHasCoreVnl,
|
||||||
|
isActive = TRUE;
|
||||||
|
|
||||||
|
IF (SELECT COUNT(*) FROM mandate WHERE clientFk = vUserFk AND companyFk = vCompanyFk AND mandateTypeFk = vMandateTypeFk) = 0 THEN
|
||||||
|
INSERT INTO mandate (clientFk, companyFk, mandateTypeFk)
|
||||||
|
VALUES (vUserFk, vCompanyFk, vMandateTypeFk);
|
||||||
|
END IF;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,9 @@
|
||||||
|
INSERT INTO vn.businessType (code,description)
|
||||||
|
VALUES ('worker','Trabajador');
|
||||||
|
|
||||||
|
ALTER TABLE `vn`.`workerConfig` ADD businessTypeFk varchar(100) NULL
|
||||||
|
COMMENT 'Tipo de negocio por defecto al dar de alta un trabajador nuevo';
|
||||||
|
|
||||||
|
UPDATE `vn`.`workerConfig`
|
||||||
|
SET businessTypeFk = 'worker'
|
||||||
|
WHERE id = 1;
|
|
@ -2800,9 +2800,9 @@ INSERT INTO `vn`.`payDemDetail` (`id`, `detail`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1);
|
(1, 1);
|
||||||
|
|
||||||
INSERT INTO `vn`.`workerConfig` (`id`, `businessUpdated`, `roleFk`)
|
INSERT INTO `vn`.`workerConfig` (`id`, `businessUpdated`, `roleFk`, `businessTypeFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, NULL, 1);
|
(1, NULL, 1, 'worker');
|
||||||
|
|
||||||
INSERT INTO `vn`.`ticketRefund`(`refundTicketFk`, `originalTicketFk`)
|
INSERT INTO `vn`.`ticketRefund`(`refundTicketFk`, `originalTicketFk`)
|
||||||
VALUES
|
VALUES
|
||||||
|
|
|
@ -27,7 +27,6 @@ module.exports = Self => {
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
const summaryObj = await getSummary(models.Client, clientFk, myOptions);
|
const summaryObj = await getSummary(models.Client, clientFk, myOptions);
|
||||||
|
|
||||||
summaryObj.mana = await models.Client.getMana(clientFk, myOptions);
|
summaryObj.mana = await models.Client.getMana(clientFk, myOptions);
|
||||||
summaryObj.debt = await models.Client.getDebt(clientFk, myOptions);
|
summaryObj.debt = await models.Client.getDebt(clientFk, myOptions);
|
||||||
summaryObj.averageInvoiced = await models.Client.getAverageInvoiced(clientFk, myOptions);
|
summaryObj.averageInvoiced = await models.Client.getAverageInvoiced(clientFk, myOptions);
|
||||||
|
@ -115,6 +114,12 @@ module.exports = Self => {
|
||||||
fields: ['claimingRate', 'priceIncreasing'],
|
fields: ['claimingRate', 'priceIncreasing'],
|
||||||
limit: 1
|
limit: 1
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
relation: 'businessType',
|
||||||
|
scope: {
|
||||||
|
fields: ['description']
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
where: {id: clientId}
|
where: {id: clientId}
|
||||||
|
|
|
@ -64,6 +64,9 @@
|
||||||
<vn-label-value label="Channel"
|
<vn-label-value label="Channel"
|
||||||
value="{{$ctrl.summary.contactChannel.name}}">
|
value="{{$ctrl.summary.contactChannel.name}}">
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
|
<vn-label-value label="Business type"
|
||||||
|
value="{{$ctrl.summary.businessType.description}}">
|
||||||
|
</vn-label-value>
|
||||||
</vn-one>
|
</vn-one>
|
||||||
<vn-one>
|
<vn-one>
|
||||||
<h4 ng-show="$ctrl.isEmployee">
|
<h4 ng-show="$ctrl.isEmployee">
|
||||||
|
|
|
@ -23,3 +23,4 @@ Latest tickets: Últimos tickets
|
||||||
Rating: Clasificación
|
Rating: Clasificación
|
||||||
Value from 1 to 20. The higher the better value: Valor del 1 al 20. Cuanto más alto mejor valoración
|
Value from 1 to 20. The higher the better value: Valor del 1 al 20. Cuanto más alto mejor valoración
|
||||||
Go to grafana: Ir a grafana
|
Go to grafana: Ir a grafana
|
||||||
|
Business type: Tipo de negocio
|
|
@ -1,4 +1,4 @@
|
||||||
/* eslint max-len: ["error", { "code": 130 }]*/
|
/* eslint max-len: ["error", { "code": 150 }]*/
|
||||||
const UserError = require('vn-loopback/util/user-error');
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
|
@ -139,7 +139,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
if (!client) {
|
if (!client) {
|
||||||
const nickname = args.firstName.concat(' ', args.lastNames);
|
const nickname = args.firstName.concat(' ', args.lastNames);
|
||||||
const workerConfig = await models.WorkerConfig.findOne({fields: ['roleFk']});
|
const workerConfig = await models.WorkerConfig.findOne({fields: ['roleFk', 'businessTypeFk']});
|
||||||
const [randomPassword] = await models.Worker.rawSql(
|
const [randomPassword] = await models.Worker.rawSql(
|
||||||
'SELECT account.passwordGenerate() as password;'
|
'SELECT account.passwordGenerate() as password;'
|
||||||
);
|
);
|
||||||
|
@ -196,7 +196,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
client = await models.Client.findById(
|
client = await models.Client.findById(
|
||||||
user.id,
|
user.id,
|
||||||
{fields: ['id', 'name', 'socialName', 'street', 'city', 'iban', 'bankEntityFk', 'defaultAddressFk']},
|
{fields: ['id', 'name', 'socialName', 'street', 'city', 'iban', 'bankEntityFk', 'defaultAddressFk', 'businessTypeFk']},
|
||||||
myOptions
|
myOptions
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,9 @@
|
||||||
},
|
},
|
||||||
"roleFk": {
|
"roleFk": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
|
},
|
||||||
|
"businessTypeFk": {
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"acls": [
|
"acls": [
|
||||||
|
|
Loading…
Reference in New Issue