Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 2650-add_button_edit_on_summaries
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Jorge Padawan 2021-01-12 07:40:10 +01:00
commit 809811ea10
14 changed files with 1583 additions and 1165 deletions

View File

@ -13144,9 +13144,9 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
@ -13162,7 +13162,7 @@ BEGIN
DECLARE vOk BOOL;
DECLARE vDone BOOL DEFAULT FALSE;
DECLARE vWarehouse INT;
DECLARE vShipment DATETIME;
DECLARE vShipment DATE;
DECLARE vTicket INT;
DECLARE vNotes VARCHAR(255);
DECLARE vItem INT;
@ -16842,7 +16842,7 @@ CREATE TABLE `clientesProveedores` (
`IBAN` varchar(34) COLLATE utf8_unicode_ci NOT NULL,
`CodigoCondiciones` smallint(6) NOT NULL,
`StatusTraspasadoIME` tinyint(4) NOT NULL,
`TipoImportacionIME` tinyint(4) NOT NULL,
`TipoImportacionIME` tinyint(4) NOT NULL DEFAULT '2',
`TipoPlanCuentaIME` smallint(6) NOT NULL DEFAULT '2',
`Contrapartida` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
`CodigoCuentaImpagado` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
@ -17481,8 +17481,7 @@ BEGIN
*/
TRUNCATE XDiario_movConta_IVA;
DELETE FROM movConta WHERE enlazadoSage = FALSE ;
DELETE FROM movConta WHERE enlazadoSage = FALSE AND Asiento <> 1 ;
CALL clientesProveedoresAdd;
CALL planCuentasPgcAdd;
CALL XDiario_movConta_IVA_InvoiceOutAdd_Manager;
@ -17588,7 +17587,7 @@ BEGIN
IF(x.EURODEBE,x.EURODEBE,x.EUROHABER) AS ImporteAsiento, -- DOBLE(19)
MONTH(x.FECHA) AS NumeroPeriodo, -- ENT(2) "-1" Al informar este valor se calcula automát. A partir de la fecha de asiento
IF( sub2.FECREGCON IS NULL, sub2.FECHA_EX, sub2.FECREGCON) FechaGrabacion, -- FECHA(8)
IFNULL(xmi.CodigoDivisa, sub3.code) CodigoDivisa, -- VARCHAR(3)
IF(x.CAMBIO,IFNULL(xmi.CodigoDivisa, sub3.code),'') CodigoDivisa, -- VARCHAR(3)
x.CAMBIO AS ImporteCambio, -- DOBLE(19)
IFNULL(x.DEBEME,x.HABERME) AS ImporteDivisa, -- DOBLE(19)
IF(x.CAMBIO,1,0) AS FactorCambio, -- DOBLE(19)
@ -17675,6 +17674,7 @@ BEGIN
LEFT JOIN ( SELECT DISTINCT(account),cu.code
FROM vn.bank b
JOIN vn.currency cu ON cu.id = b.currencyFk
WHERE cu.code <> "EUR" -- no se informa cuando la divisa en EUR
)sub3 ON sub3.account = x.SUBCTA
WHERE x.enlazadoSage = 0
AND c.companyCode;
@ -30637,6 +30637,100 @@ CREATE TABLE `payMethod` (
) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `payment`
--
DROP TABLE IF EXISTS `payment`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `payment` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`received` date NOT NULL,
`supplierFk` int(11) NOT NULL,
`amount` decimal(10,2) NOT NULL DEFAULT '0.00',
`currencyFk` tinyint(3) unsigned NOT NULL DEFAULT '1',
`divisa` decimal(10,2) DEFAULT NULL,
`bankFk` int(11) NOT NULL DEFAULT '0',
`payMethodFk` tinyint(3) unsigned NOT NULL,
`bankingFees` double(6,2) unsigned NOT NULL DEFAULT '0.00',
`concept` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
`companyFk` smallint(5) unsigned NOT NULL DEFAULT '442',
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`isConciliated` tinyint(1) unsigned zerofill NOT NULL DEFAULT '0',
`exchangeInsuranceFk` int(11) DEFAULT NULL,
`dueDated` date DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `empresa_id` (`companyFk`),
KEY `id_banco` (`bankFk`),
KEY `id_moneda` (`currencyFk`),
KEY `pay_met` (`payMethodFk`),
KEY `fk_pago_pago_sdc1_idx` (`exchangeInsuranceFk`),
KEY `pagoDueDatedIdx` (`dueDated`),
KEY `pago_ibfk_3` (`supplierFk`),
CONSTRAINT `pago_ibfk_3` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE,
CONSTRAINT `pago_moneda_1` FOREIGN KEY (`currencyFk`) REFERENCES `currency` (`id`) ON UPDATE CASCADE,
CONSTRAINT `pago_pay_met` FOREIGN KEY (`payMethodFk`) REFERENCES `payMethod` (`id`) ON UPDATE CASCADE,
CONSTRAINT `payment_ibfk_1` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE,
CONSTRAINT `payment_ibfk_2` FOREIGN KEY (`bankFk`) REFERENCES `bank` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `payment_beforeInsert` BEFORE INSERT ON `payment` FOR EACH ROW
-- Edit trigger body code below this line. Do not edit lines above this one
BEGIN
DECLARE cuenta_banco,cuenta_proveedor DOUBLE;
DECLARE vNewBookEntry INT;
DECLARE bolCASH BOOLEAN;
-- PAK 10/02/15 No se asientan los pagos directamente, salvo en el caso de las cajas de CASH
SELECT (cash = 1) INTO bolCASH FROM bank WHERE bank.id = NEW.bankFk ;
IF bolCASH THEN
SELECT account INTO cuenta_banco
FROM bank
WHERE id = NEW.bankFk;
SELECT account INTO cuenta_proveedor
FROM supplier
WHERE id = NEW.supplierFk;
CALL vn.ledger_next(vNewBookEntry);
INSERT INTO XDiario (ASIEN,FECHA,SUBCTA,CONTRA,CONCEPTO,EURODEBE,EUROHABER,empresa_id)
SELECT vNewBookEntry,NEW.received,SUBCTA,CONTRA,NEW.concept,EURODEBE,EUROHABER,NEW.companyFk
FROM
( SELECT cuenta_banco SUBCTA,cuenta_proveedor CONTRA,0 EURODEBE, NEW.amount + NEW.bankingFees EUROHABER
UNION ALL
SELECT cuenta_proveedor SUBCTA, cuenta_banco CONTRA,NEW.amount EURODEBE, 0 EUROHABER
) gf;
IF NEW.bankingFees <> 0 THEN
INSERT INTO XDiario (ASIEN,FECHA,SUBCTA,CONTRA,CONCEPTO,EURODEBE,EUROHABER,empresa_id)
SELECT vNewBookEntry,NEW.received,IF(c.id = 1,6260000002,IF(CEE = 1,6260000003,6260000004)),cuenta_banco,NEW.concept,NEW.bankingFees,0,NEW.companyFk
FROM supplier s
JOIN country c ON s.countryFk = c.id
WHERE s.id = NEW.supplierFk;
END IF;
END IF;
SET NEW.dueDated = IFNULL(NEW.dueDated, NEW.received);
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
--
-- Temporary table structure for view `payment__`
--
@ -33333,7 +33427,26 @@ CREATE TABLE `tag` (
CONSTRAINT `fgnTag` FOREIGN KEY (`ediTypeFk`) REFERENCES `edi`.`type` (`type_id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Categorias para etiquetar los productos';
/*!40101 SET character_set_client = @saved_cs_client */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`tag_BEFORE_INSERT` BEFORE INSERT ON `tag` FOR EACH ROW
BEGIN
IF NEW.ediTypeFk IS NULL AND (SELECT COUNT(*) FROM tag WHERE `name` = NEW.`name`) THEN
CALL util.throw('name duplicated');
END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
--
-- Table structure for table `tagAbbreviation`
@ -33622,7 +33735,7 @@ DELIMITER ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `ticket_beforeUpdate`
BEFORE UPDATE ON `ticket`
@ -33668,6 +33781,9 @@ BEGIN
' a ',
TIME(NEW.shipped));
END IF;
INSERT IGNORE INTO zoneAgencyMode (agencyModeFk,zoneFk)
SELECT r.agencyModeFk, NEW.zoneFk FROM route r
WHERE r.id = NEW.routeFk;
END IF;
END */;;
DELIMITER ;
@ -36110,6 +36226,25 @@ CREATE TABLE `zone` (
) ENGINE=InnoDBDEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `zoneAgencyMode`
--
DROP TABLE IF EXISTS `zoneAgencyMode`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `zoneAgencyMode` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`agencyModeFk` int(11) NOT NULL,
`zoneFk` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `zoneAgencyMode_UN` (`agencyModeFk`,`zoneFk`),
KEY `zoneAgencyMode_FK_1` (`zoneFk`),
CONSTRAINT `zoneAgencyMode_FK` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `zoneAgencyMode_FK_1` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='junta agencias con zonas para que al enrutar se puedan proponer tickets.';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `zoneClosure`
--
@ -40362,7 +40497,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` FUNCTION `ticketSplitCounter`(vTicketFk INT) RETURNS varchar(15) CHARSET utf8 COLLATE utf8_unicode_ci
CREATE DEFINER=`root`@`%` FUNCTION `ticketSplitCounter`(vTicketFk INT) RETURNS varchar(15) CHARSET utf8
READS SQL DATA
BEGIN
DECLARE vSplitCounter VARCHAR(15);
@ -40375,7 +40510,9 @@ BEGIN
LEFT JOIN vn2008.movement_label l ON l.Id_Movimiento = s.id
WHERE ticketFk = vTicketFk
) sub;
RETURN vSplitCounter;
RETURN IFNULL(vSplitCounter,'--');
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -42906,10 +43043,10 @@ proc: BEGIN
FROM edi.warehouseFloramondo
WHERE warehouseFk = vWarehouseFk;
CALL cache.visible_refresh(vVisibleCache, FALSE, vWarehouseFk);
CALL cache.visible_refresh(vVisibleCache, TRUE, vWarehouseFk);
IF (NOT vIsLogifloraAllowed AND vVNHWarehouseFk != vWarehouseFk)
OR (vShipped > TIMESTAMPADD(DAY, vMaxLogifloraDays + vRangeLogifloraDays, CURDATE()) )
OR (vShipped > TIMESTAMPADD(DAY, vMaxLogifloraDays + vRangeLogifloraDays, CURDATE()) )
THEN
DELETE tl FROM tmp.ticketLot tl
JOIN item i ON i.id = tl.itemFk
@ -65147,6 +65284,150 @@ BEGIN
CLOSE rsTicket;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `ticket_cloneWeekly__3` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `ticket_cloneWeekly__3`(IN vWeek INT)
BEGIN
DECLARE vIsDone BOOL;
DECLARE vLanding DATE;
DECLARE vShipment DATE;
DECLARE vWarehouse INT;
DECLARE vTicket INT;
DECLARE vWeekDay INT;
DECLARE vClient INT;
DECLARE vEmpresa INT;
DECLARE vConsignatario INT;
DECLARE vAgencia INT;
DECLARE vNewTicket INT;
DECLARE vYear INT;
DECLARE rsTicket CURSOR FOR
SELECT tt.Id_Ticket, weekDay, Id_Cliente, warehouse_id, empresa_id, Id_Consigna, Id_Agencia
FROM Tickets_turno tt
JOIN Tickets t ON tt.Id_Ticket = t.Id_Ticket;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vIsDone = TRUE;
SET vYear = YEAR(CURDATE()) + IF(vWeek < WEEK(CURDATE()),1, 0);
OPEN rsTicket;
myLoop: LOOP
BEGIN
DECLARE vSalesPersonEmail VARCHAR(150);
DECLARE vMailSent BOOL;
DECLARE vSubject VARCHAR(150);
DECLARE vMessage TEXT;
/*DECLARE vError TEXT;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
BEGIN
GET DIAGNOSTICS CONDITION 1
vError = MESSAGE_TEXT;
END;*/
SET vIsDone = FALSE;
FETCH rsTicket INTO vTicket, vWeekDay, vClient, vWarehouse, vEmpresa, vConsignatario, vAgencia;
IF vIsDone THEN
LEAVE myLoop;
END IF;
SELECT date INTO vShipment
FROM `time`
WHERE `year` = vYear AND `week` = vWeek
AND WEEKDAY(date) = vWeekDay;
-- busca si el ticket ya ha sido clonado
IF (SELECT COUNT(*) FROM vn.ticket tOrig
JOIN vn.sale saleOrig ON tOrig.id = saleOrig.ticketFk
JOIN vn.saleCloned sc ON sc.saleOriginalFk = saleOrig.id
JOIN vn.sale saleClon ON saleClon.id = sc.saleClonedFk
JOIN vn.ticket tClon ON tClon.id = saleClon.ticketFk
WHERE tOrig.id = vTicket AND tClon.isDeleted = FALSE AND DATE(tClon.shipped) = vShipment) > 0
THEN
ITERATE myLoop;
END IF;
CALL vn.zone_getLanded(vShipment, vConsignatario, vAgencia, vWarehouse,FALSE);
SELECT landed INTO vLanding from tmp.zoneGetLanded LIMIT 1;
IF (SELECT COUNT(*) FROM Agencias WHERE Id_Agencia = vAgencia AND Agencia LIKE '%turno%') THEN
SET vAgencia = NULL;
END IF;
CALL vn.ticketCreateWithoutZone(vClient, vShipment, vWarehouse, vEmpresa, vConsignatario, vAgencia, NULL, vLanding,account.userGetId(), vNewTicket);
IF (vLanding IS NULL) THEN
SELECT e.email INTO vSalesPersonEmail
FROM vn.client c
JOIN vn.worker sp ON sp.id = c.salesPersonFk
JOIN account.emailUser e ON e.userFk = sp.userFk
WHERE c.id = vClient;
SET vSubject = CONCAT('Turnos - No se ha podido clonar correctamente el ticket ', vTicket,
' para el dia: ', vShipment);
SET vMessage = CONCAT('No se ha podido clonar el ticket ', vTicket,
' para el dia: ', vShipment,
' porque no hay una zona de envío disponible. Se ha creado el ticket: ', vNewTicket,
' pero ha que revisar las fechas y la agencia');
SELECT COUNT(*) INTO vMailSent
FROM vn.mail
WHERE sender = vSalesPersonEmail
AND subject = vSubject;
IF NOT vMailSent THEN
INSERT INTO vn2008.mail (`to`,`subject`,`text`)
VALUES (vSalesPersonEmail, vSubject, vMessage);
END IF;
CALL vn.ticketStateUpdate (vNewTicket, 'FIXING');
END IF;
INSERT INTO vn.sale (ticketFk, itemFk, concept, quantity, price, discount, priceFixed, isPriceFixed)
SELECT vNewTicket, saleOrig.itemFk , saleOrig.concept , saleOrig.quantity, saleOrig.price , saleOrig.discount, saleOrig.priceFixed, saleOrig.isPriceFixed
FROM vn.sale saleOrig
WHERE saleOrig.ticketFk = vTicket;
INSERT IGNORE INTO vn.saleCloned(saleOriginalFk, saleClonedFk)
SELECT saleOriginal.id, saleClon.id
FROM vn.sale saleOriginal
JOIN vn.sale saleClon ON saleOriginal.itemFk = saleClon.itemFk AND saleOriginal.quantity = saleClon.quantity
WHERE saleOriginal.ticketFk = vTicket AND saleClon.ticketFk = vNewTicket;
INSERT INTO Ordenes (orden,datorden,datticket,codvendedor,codcomprador,cantidad,preciomax,preu,id_article,id_cliente,comentario,
ok, total,datcompra,ko,id_movimiento)
SELECT o.orden,o.datorden,vShipment,o.codvendedor,o.codcomprador,o.cantidad,o.preciomax,o.preu,o.id_article,o.id_cliente,o.comentario,
o.ok, o.total,o.datcompra,o.ko,m2.Id_Movimiento
FROM Movimientos m JOIN Ordenes o ON o.Id_Movimiento = m.Id_Movimiento
JOIN Movimientos m2 ON m.Concepte = m2.Concepte AND m.Cantidad = m2.Cantidad AND m.Id_Article = m2.Id_Article
WHERE m.Id_Ticket = vTicket AND m2.Id_Ticket = vNewTicket;
INSERT INTO ticket_observation(Id_Ticket,observation_type_id,text) VALUES(vNewTicket,4,CONCAT('turno desde ticket: ',vTicket))
ON DUPLICATE KEY UPDATE text = CONCAT(ticket_observation.text,VALUES(text),' ');
INSERT INTO ticket_observation(Id_Ticket,observation_type_id,text) VALUES(vNewTicket,1,'ATENCION: Contiene lineas de TURNO')
ON DUPLICATE KEY UPDATE text = CONCAT(ticket_observation.text,VALUES(text),' ');
CALL vn.ticketCalculateClon(vNewTicket, vTicket);
END;
END LOOP;
CLOSE rsTicket;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -76215,4 +76496,4 @@ USE `vncontrol`;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2021-01-05 9:34:47
-- Dump completed on 2021-01-08 10:00:22

View File

@ -59,7 +59,6 @@ IGNORETABLES=(
--ignore-table=vn.mail__
--ignore-table=vn.manaSpellers
--ignore-table=vn.outgoingInvoiceKk
--ignore-table=vn.payment
--ignore-table=vn.paymentExchangeInsurance
--ignore-table=vn.payrollCenter
--ignore-table=vn.plantpassport__

View File

@ -187,7 +187,10 @@ export default class Field extends FormInput {
}
onChange() {
this.emit('change', {value: this.field});
// Changes doesn't reflect until appling async
this.$.$applyAsync(() => {
this.emit('change', {value: this.field});
});
}
}
Field.$inject = ['$element', '$scope'];

View File

@ -1,4 +1,5 @@
import Component from '../../lib/component';
import './style.scss';
export default class SearchPanel extends Component {
set filter(value) {

View File

@ -1,4 +1,4 @@
@import "variables";
@import "./variables";
vn-searchbar {
display: block;
@ -44,4 +44,27 @@ vn-searchbar {
& > form {
padding: $spacing-lg;
}
& > form#manifold-form {
padding: 0;
.manifold-panel {
border: $border-thin-light;
border-radius: 5px;
position: relative;
text-align: right;
.or {
font-weight: bold;
font-size: 26px;
color: $color-font-secondary
}
vn-icon[icon="info"] {
position: absolute;
top: 2px;
right: 2px
}
}
}
}

View File

@ -86,5 +86,7 @@
"The social name cannot be empty": "The social name cannot be empty",
"The nif cannot be empty": "The nif cannot be empty",
"A travel with this data already exists": "A travel with this data already exists",
"The observation type can't be repeated": "The observation type can't be repeated"
"The observation type can't be repeated": "The observation type can't be repeated",
"New ticket request has been created with price": "New ticket request has been created '{{description}}' for day <strong>{{shipped}}</strong>, with a quantity of <strong>{{quantity}}</strong> and a price of <strong>{{price}} €</strong>",
"New ticket request has been created": "New ticket request has been created '{{description}}' for day <strong>{{shipped}}</strong>, with a quantity of <strong>{{quantity}}</strong>"
}

View File

@ -164,5 +164,7 @@
"You can not select this payment method without a registered bankery account": "No se puede utilizar este método de pago si no has registrado una cuenta bancaria",
"You can't upload images on the test environment": "No puedes subir imágenes en el entorno de pruebas",
"The selected ticket is not suitable for this route": "El ticket seleccionado no es apto para esta ruta",
"Sorts whole route": "Reordena ruta entera"
"Sorts whole route": "Reordena ruta entera",
"New ticket request has been created with price": "Se ha creado una nueva petición de compra '{{description}}' para el día <strong>{{shipped}}</strong>, con una cantidad de <strong>{{quantity}}</strong> y un precio de <strong>{{price}} €</strong>",
"New ticket request has been created": "Se ha creado una nueva petición de compra '{{description}}' para el día <strong>{{shipped}}</strong>, con una cantidad de <strong>{{quantity}}</strong>"
}

View File

@ -24,9 +24,9 @@ exports.translateValues = async(instance, changes) => {
function formatDate(date) {
return new Intl.DateTimeFormat('es', {
year: '2-digit',
month: '2-digit',
day: '2-digit',
year: 'numeric',
month: 'numeric',
day: 'numeric',
hour: '2-digit',
minute: '2-digit',
second: '2-digit'

View File

@ -8,10 +8,38 @@ module.exports = function(Self) {
Self.observe('before save', async function(ctx) {
if (ctx.isNewInstance) {
const loopBackContext = LoopBackContext.getCurrentContext();
let filter = {where: {userFk: loopBackContext.active.accessToken.userId}};
let worker = await Self.app.models.Worker.findOne(filter);
const filter = {where: {userFk: loopBackContext.active.accessToken.userId}};
const models = Self.app.models;
const worker = await models.Worker.findOne(filter);
ctx.instance.requesterFk = worker.id;
const instance = ctx.instance;
instance.requesterFk = worker.id;
const httpCtx = {req: loopBackContext.active};
const httpRequest = httpCtx.req.http .req;
const $t = httpRequest.__;
const attenderId = instance.attenderFk;
if (attenderId) {
const ticket = await models.Ticket.findById(instance.ticketFk);
let messageText = 'New ticket request has been created';
if (instance.price)
messageText = 'New ticket request has been created with price';
const shipped = new Intl.DateTimeFormat('es', {
year: 'numeric',
month: 'numeric',
day: 'numeric'
}).format(ticket.shipped);
const message = $t(messageText, {
description: instance.description,
shipped: shipped,
quantity: instance.quantity,
price: instance.price
});
await models.Chat.sendCheckingPresence(httpCtx, attenderId, message);
}
}
});
};

View File

@ -1,6 +1,6 @@
<div class="search-panel">
<form ng-submit="$ctrl.onSearch()">
<vn-horizontal>
<form id="manifold-form" ng-submit="$ctrl.onSearch()">
<vn-horizontal class="vn-px-lg vn-pt-lg">
<vn-textfield
vn-one
label="General search"
@ -9,7 +9,7 @@
vn-focus>
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-horizontal class="vn-px-lg">
<vn-textfield
vn-one
label="Client id"
@ -21,27 +21,37 @@
ng-model="filter.orderFk">
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-date-picker
vn-one
label="From"
ng-model="filter.from">
</vn-date-picker>
<vn-date-picker
vn-one
label="To"
ng-model="filter.to">
</vn-date-picker>
<vn-input-number
vn-one
min="0"
step="1"
label="Days onward"
ng-model="filter.scopeDays"
display-controls="true">
</vn-input-number>
</vn-horizontal>
<vn-horizontal>
<section class="vn-px-md">
<vn-horizontal class="manifold-panel vn-pa-md">
<vn-date-picker
vn-one
label="From"
ng-model="filter.from"
on-change="$ctrl.from = value">
</vn-date-picker>
<vn-date-picker
vn-one
label="To"
ng-model="filter.to"
on-change="$ctrl.to = value">
</vn-date-picker>
<vn-none class="or vn-px-md">O</vn-none>
<vn-input-number
vn-one
min="0"
step="1"
label="Days onward"
ng-model="filter.scopeDays"
on-change="$ctrl.scopeDays = value"
display-controls="true">
</vn-input-number>
<vn-icon color-marginal
icon="info"
vn-tooltip="Cannot choose a range of dates and days onward at the same time">
</vn-icon>
</vn-horizontal>
</section>
<vn-horizontal class="vn-px-lg">
<vn-textfield
vn-one
label="Nickname"
@ -63,7 +73,7 @@
ng-model="filter.refFk">
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-horizontal class="vn-px-lg">
<vn-autocomplete
vn-one
label="Agency"
@ -87,7 +97,7 @@
</tpl-item>
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-horizontal class="vn-px-lg">
<vn-autocomplete
vn-one
label="Warehouse"
@ -101,7 +111,7 @@
url="Provinces">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-horizontal class="vn-px-lg">
<vn-check
vn-one
label="My team"
@ -121,7 +131,7 @@
triple-state="true">
</vn-check>
</vn-horizontal>
<vn-horizontal class="vn-mt-lg">
<vn-horizontal class="vn-px-lg vn-pb-lg vn-mt-lg">
<vn-submit label="Search"></vn-submit>
</vn-horizontal>
</form>

View File

@ -1,8 +1,11 @@
import ngModule from '../module';
import SearchPanel from 'core/components/searchbar/search-panel';
class Controller extends SearchPanel {
constructor($, $element) {
super($, $element);
this.filter = this.$.filter;
this.getGroupedStates();
}
@ -19,6 +22,35 @@ class Controller extends SearchPanel {
this.groupedStates = groupedStates;
});
}
get from() {
return this._from;
}
set from(value) {
this._from = value;
this.filter.scopeDays = null;
}
get to() {
return this._to;
}
set to(value) {
this._to = value;
this.filter.scopeDays = null;
}
get scopeDays() {
return this._scopeDays;
}
set scopeDays(value) {
this._scopeDays = value;
this.filter.from = null;
this.filter.to = null;
}
}
ngModule.vnComponent('vnTicketSearchPanel', {

View File

@ -10,10 +10,11 @@ describe('Ticket Component vnTicketSearchPanel', () => {
$httpBackend = _$httpBackend_;
controller = $componentController('vnTicketSearchPanel', {$element: null});
controller.$t = () => {};
controller.filter = {};
}));
describe('getGroupedStates()', () => {
it('should set an array of groupedStates with the aditionof a name translation', () => {
it('should set an array of groupedStates with the adition of a name translation', () => {
jest.spyOn(controller, '$t').mockReturnValue('miCodigo');
const data = [
{
@ -32,4 +33,39 @@ describe('Ticket Component vnTicketSearchPanel', () => {
}]);
});
});
describe('from() setter', () => {
it('should clear the scope days when setting the from property', () => {
controller.filter.scopeDays = 1;
controller.from = new Date();
expect(controller.filter.scopeDays).toBeNull();
expect(controller.from).toBeDefined();
});
});
describe('to() setter', () => {
it('should clear the scope days when setting the to property', () => {
controller.filter.scopeDays = 1;
controller.to = new Date();
expect(controller.filter.scopeDays).toBeNull();
expect(controller.to).toBeDefined();
});
});
describe('scopeDays() setter', () => {
it('should clear the date range when setting the scopeDays property', () => {
controller.filter.from = new Date();
controller.filter.to = new Date();
controller.scopeDays = 1;
expect(controller.filter.from).toBeNull();
expect(controller.filter.to).toBeNull();
expect(controller.scopeDays).toBeDefined();
});
});
});

View File

@ -17,3 +17,4 @@ FREE: Libre
DELIVERED: Servido
ON_PREPARATION: En preparacion
PACKED: Encajado
Cannot choose a range of dates and days onward at the same time: No se puede selecionar un rango de fechas y días en adelante a la vez

View File

@ -4,4 +4,4 @@ You are going to delete this weekly ticket: Vas a eliminar este ticket programad
This ticket will be removed from weekly tickets! Continue anyway?: Este ticket se eliminará de tickets programados! ¿Continuar de todas formas?
Search weekly ticket by id or client id: Busca tickets programados por el identificador o el identificador del cliente
Search by weekly ticket: Buscar por tickets programados
weekDay: Dia
Weekday: Llegada