7691-testToMaster #2703
|
@ -3889,11 +3889,25 @@ INSERT INTO `vn`.`calendarHolidays` (calendarHolidaysTypeFk, dated, calendarHoli
|
|||
(1, '2001-05-17', 1, 5),
|
||||
(1, '2001-05-18', 1, 5);
|
||||
|
||||
INSERT INTO vn.payrollComponent
|
||||
(id, name, isSalaryAgreed, isVariable, isException)
|
||||
VALUES
|
||||
(1, 'Salario1', 1, 0, 0),
|
||||
(2, 'Salario2', 1, 1, 0),
|
||||
(3, 'Salario3', 1, 0, 1);
|
||||
|
||||
INSERT INTO dipole.printer (id, description)
|
||||
VALUES(1, '');
|
||||
|
||||
INSERT INTO dipole.expedition_PrintOut (expeditionFk, ticketFk, addressFk, street, postalCode, city, shopName, isPrinted, created, printerFk, routeFk, parkingCode,
|
||||
truckName, clientFk, phone, province, agency, m3, workerCode, itemFk, quantity, longName, shelvingFk, comments)
|
||||
VALUES(1, 1, 0, ' ', ' ', ' ', ' ', 0, '2001-01-01 00:00:00', 1, 0, ' ', ' ', 0, NULL, '', NULL, 0.000, NULL, 10, NULL, NULL, 'NCC', NULL);
|
||||
INSERT INTO vn.workerIncome
|
||||
(debit, credit, incomeTypeFk, paymentDate, workerFk, concept)
|
||||
VALUES
|
||||
(1000.00, 900.00, 2, '2000-01-01', 1106, NULL),
|
||||
(1001.00, 800.00, 2, '2000-01-01', 1106, NULL);
|
||||
|
||||
|
||||
INSERT INTO dipole.printer (id, description)
|
||||
VALUES(1, '');
|
||||
|
||||
INSERT INTO dipole.expedition_PrintOut (expeditionFk, ticketFk, addressFk, street, postalCode, city, shopName, isPrinted, created, printerFk, routeFk, parkingCode,
|
||||
truckName, clientFk, phone, province, agency, m3, workerCode, itemFk, quantity, longName, shelvingFk, comments)
|
||||
VALUES(1, 1, 0, ' ', ' ', ' ', ' ', 0, '2001-01-01 00:00:00', 1, 0, ' ', ' ', 0, NULL, '', NULL, 0.000, NULL, 10, NULL, NULL, 'NCC', NULL);
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ BEGIN
|
|||
JOIN province p ON p.id = c.provinceFk
|
||||
LEFT JOIN autonomy a ON a.id = p.autonomyFk
|
||||
JOIN country co ON co.id = p.countryFk
|
||||
JOIN bs.clientDiedPeriod cdp ON cdp.countryFk = co.id
|
||||
WHERE cd.warning = 'third'
|
||||
AND cp.clientFk IS NULL
|
||||
AND sp.salesPersonFk IS NULL
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_DelayTruckSplit`(vTicketFk INT)
|
||||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_DelayTruckSplit`(
|
||||
vTicketFk INT
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Splita las lineas de ticket que no estan ubicadas
|
||||
|
@ -50,8 +52,8 @@ BEGIN
|
|||
SET s.ticketFk = vNewTicketFk;
|
||||
END IF;
|
||||
|
||||
CALL ticketStateUpdate(vNewTicketFk, 'FIXING');
|
||||
CALL ticket_setState(vNewTicketFk, 'FIXING');
|
||||
|
||||
DROP TEMPORARY TABLE tmp.SalesToSplit;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_cloneWeekly`(vDateFrom DATE, vDateTo DATE)
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_cloneWeekly`(
|
||||
vDateFrom DATE,
|
||||
vDateTo DATE
|
||||
)
|
||||
BEGIN
|
||||
DECLARE vIsDone BOOL;
|
||||
DECLARE vLanding DATE;
|
||||
|
@ -39,9 +42,16 @@ BEGIN
|
|||
DECLARE vIsDuplicateMail BOOL;
|
||||
DECLARE vSubject VARCHAR(150);
|
||||
DECLARE vMessage TEXT;
|
||||
|
||||
|
||||
SET vIsDone = FALSE;
|
||||
FETCH rsTicket INTO vTicketFk,vClientFk, vWarehouseFk, vCompanyFk, vAddressFk, vAgencyModeFk,vShipment;
|
||||
FETCH rsTicket INTO
|
||||
vTicketFk,
|
||||
vClientFk,
|
||||
vWarehouseFk,
|
||||
vCompanyFk,
|
||||
vAddressFk,
|
||||
vAgencyModeFk,
|
||||
vShipment;
|
||||
|
||||
IF vIsDone THEN
|
||||
LEAVE myLoop;
|
||||
|
@ -67,7 +77,7 @@ BEGIN
|
|||
AND isDefaultAddress;
|
||||
END IF;
|
||||
|
||||
CALL zone_getLanded(vShipment, vAddressFk, vAgencyModeFk, vWarehouseFk,FALSE);
|
||||
CALL zone_getLanded(vShipment, vAddressFk, vAgencyModeFk, vWarehouseFk, FALSE);
|
||||
SET vLanding = NULL;
|
||||
SELECT landed INTO vLanding FROM tmp.zoneGetLanded LIMIT 1;
|
||||
|
||||
|
@ -88,16 +98,22 @@ BEGIN
|
|||
SET clonedFrom = vTicketFk
|
||||
WHERE id = vNewTicket;
|
||||
|
||||
INSERT INTO sale (ticketFk, itemFk, concept, quantity, price,
|
||||
discount, priceFixed, isPriceFixed)
|
||||
INSERT INTO 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
|
||||
saleOrig.itemFk,
|
||||
saleOrig.concept,
|
||||
saleOrig.quantity,
|
||||
saleOrig.price,
|
||||
saleOrig.discount,
|
||||
saleOrig.priceFixed,
|
||||
saleOrig.isPriceFixed
|
||||
FROM sale saleOrig
|
||||
WHERE saleOrig.ticketFk = vTicketFk;
|
||||
|
||||
|
@ -123,20 +139,20 @@ BEGIN
|
|||
,attenderFk,
|
||||
ticketFk)
|
||||
SELECT description,
|
||||
ordered,
|
||||
shipped,
|
||||
quantity,
|
||||
price,
|
||||
itemFk,
|
||||
clientFk,
|
||||
response,
|
||||
total,
|
||||
buyed,
|
||||
requesterFk,
|
||||
attenderFk,
|
||||
vNewTicket
|
||||
ordered,
|
||||
shipped,
|
||||
quantity,
|
||||
price,
|
||||
itemFk,
|
||||
clientFk,
|
||||
response,
|
||||
total,
|
||||
buyed,
|
||||
requesterFk,
|
||||
attenderFk,
|
||||
vNewTicket
|
||||
FROM ticketRequest
|
||||
WHERE ticketFk =vTicketFk;
|
||||
WHERE ticketFk =vTicketFk;
|
||||
|
||||
SELECT id INTO vSalesPersonFK
|
||||
FROM observationType
|
||||
|
@ -189,7 +205,7 @@ BEGIN
|
|||
IF NOT vIsDuplicateMail THEN
|
||||
CALL mail_insert(vSalesPersonEmail, NULL, vSubject, vMessage);
|
||||
END IF;
|
||||
CALL ticketStateUpdate (vNewTicket, 'FIXING');
|
||||
CALL ticket_setState(vNewTicket, 'FIXING');
|
||||
ELSE
|
||||
CALL ticketCalculateClon(vNewTicket, vTicketFk);
|
||||
END IF;
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_split`(vTicketFk INT, vTicketFutureFk INT, vDated DATE)
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_split`(
|
||||
vTicketFk INT,
|
||||
vTicketFutureFk INT,
|
||||
vDated DATE
|
||||
)
|
||||
proc:BEGIN
|
||||
/**
|
||||
* Mueve las lineas con problemas a otro ticket existente o a uno nuevo.
|
||||
|
@ -17,60 +21,56 @@ proc:BEGIN
|
|||
FROM tmp.salesToSplit
|
||||
WHERE ticketFk = vTicketFk;
|
||||
|
||||
SELECT count(*) INTO vTotalLines
|
||||
FROM vn.sale s
|
||||
SELECT COUNT(*) INTO vTotalLines
|
||||
FROM sale s
|
||||
WHERE s.ticketFk = vTicketFk;
|
||||
|
||||
SET vHasFullProblem = (vTotalLines = vProblemLines);
|
||||
|
||||
-- Ticket completo
|
||||
IF vHasFullProblem THEN
|
||||
|
||||
UPDATE vn.ticket
|
||||
SET landed = vDated + INTERVAL 1 DAY,
|
||||
UPDATE ticket
|
||||
SET landed = vDated + INTERVAL 1 DAY,
|
||||
shipped = vDated,
|
||||
nickname = CONCAT('(',DAY(util.VN_CURDATE()),') ', nickname )
|
||||
nickname = CONCAT('(',DAY(util.VN_CURDATE()),') ', nickname)
|
||||
WHERE id = vTicketFk;
|
||||
|
||||
SELECT "moved" message, NULL ticketFuture;
|
||||
SELECT 'moved' message, NULL ticketFuture;
|
||||
LEAVE proc;
|
||||
|
||||
END IF;
|
||||
|
||||
-- Ticket a futuro existe
|
||||
IF vTicketFutureFk THEN
|
||||
|
||||
UPDATE vn.sale s
|
||||
JOIN tmp.salesToSplit ss ON s.id = ss.saleFk
|
||||
UPDATE sale s
|
||||
JOIN tmp.salesToSplit ss ON s.id = ss.saleFk
|
||||
SET s.ticketFk = vTicketFutureFk,
|
||||
s.concept = CONCAT('(s) ', s.concept)
|
||||
WHERE ss.ticketFk = vTicketFk;
|
||||
|
||||
SELECT "future" message, NULL ticketFuture;
|
||||
SELECT 'future' message, NULL ticketFuture;
|
||||
LEAVE proc;
|
||||
|
||||
END IF;
|
||||
|
||||
-- Ticket nuevo
|
||||
CALL vn.ticket_Clone(vTicketFk, vTicketFutureFk);
|
||||
CALL ticket_Clone(vTicketFk, vTicketFutureFk);
|
||||
|
||||
UPDATE vn.ticket t
|
||||
JOIN vn.productionConfig pc
|
||||
UPDATE ticket t
|
||||
JOIN productionConfig pc
|
||||
SET t.routeFk = IF(t.shipped = vDated , t.routeFk, NULL),
|
||||
t.landed = vDated + INTERVAL 1 DAY,
|
||||
t.landed = vDated + INTERVAL 1 DAY,
|
||||
t.shipped = vDated,
|
||||
t.agencyModeFk = pc.defautlAgencyMode,
|
||||
t.zoneFk = pc.defaultZone
|
||||
WHERE t.id = vTicketFutureFk;
|
||||
|
||||
UPDATE vn.sale s
|
||||
JOIN tmp.salesToSplit sts ON sts.saleFk = s.id
|
||||
|
||||
UPDATE sale s
|
||||
JOIN tmp.salesToSplit sts ON sts.saleFk = s.id
|
||||
SET s.ticketFk = vTicketFutureFk,
|
||||
s.concept = CONCAT('(s) ', s.concept)
|
||||
WHERE sts.ticketFk = vTicketFk;
|
||||
|
||||
CALL vn.ticketStateUpdate(vTicketFutureFk, 'FIXING');
|
||||
CALL ticket_setState(vTicketFutureFk, 'FIXING');
|
||||
|
||||
SELECT "new" message,vTicketFutureFk ticketFuture;
|
||||
SELECT 'new' message, vTicketFutureFk ticketFuture;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
-- Place your SQL code here
|
||||
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
|
||||
VALUES
|
||||
('WorkerIncome', '*', '*', 'ALLOW', 'ROLE', 'hr'),
|
||||
('PayrollComponent', '*', '*', 'ALLOW', 'ROLE', 'hr'),
|
||||
('Worker', '__get__incomes', '*', 'ALLOW', 'ROLE', 'hr');
|
|
@ -27,7 +27,7 @@
|
|||
vn-id="country"
|
||||
ng-model="$ctrl.data.countryFk"
|
||||
url="Countries"
|
||||
fields="['id', 'country', 'code']"
|
||||
fields="['id', 'name', 'code']"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
label="Country">
|
||||
|
|
|
@ -50,7 +50,7 @@ module.exports = function(Self) {
|
|||
{
|
||||
relation: 'country',
|
||||
scope: {
|
||||
fields: ['id', 'country']
|
||||
fields: ['id', 'name']
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -54,7 +54,7 @@ module.exports = Self => {
|
|||
{
|
||||
relation: 'country',
|
||||
scope: {
|
||||
fields: ['country']
|
||||
fields: ['name']
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -37,7 +37,7 @@ class Controller extends Section {
|
|||
include: {
|
||||
relation: 'country',
|
||||
scope: {
|
||||
fields: ['id', 'country']
|
||||
fields: ['id', 'name']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ class Controller extends Section {
|
|||
field: 'countryFk',
|
||||
autocomplete: {
|
||||
url: 'Countries',
|
||||
showField: 'country',
|
||||
showField: 'name',
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -59,7 +59,7 @@ module.exports = Self => {
|
|||
include: [{
|
||||
relation: 'country',
|
||||
scope: {
|
||||
fields: ['id', 'country']
|
||||
fields: ['id', 'name']
|
||||
}
|
||||
}, {
|
||||
relation: 'taxClass',
|
||||
|
|
|
@ -55,7 +55,7 @@ module.exports = Self => {
|
|||
{
|
||||
relation: 'country',
|
||||
scope: {
|
||||
fields: ['id', 'country', 'code']
|
||||
fields: ['id', 'name', 'code']
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -125,6 +125,12 @@
|
|||
"Locker": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"PayrollComponent": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"WorkerIncome": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"TrainingCourse": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"name": "PayrollComponent",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "payrollComponent"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"id": true,
|
||||
"type": "number"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"isSalaryAgreed": {
|
||||
"type": "number"
|
||||
},
|
||||
"isVariable": {
|
||||
"type": "number"
|
||||
},
|
||||
"isException": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"name": "WorkerIncome",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "workerIncome"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"id": true,
|
||||
"type": "number"
|
||||
},
|
||||
"debit": {
|
||||
"type": "number"
|
||||
},
|
||||
"credit": {
|
||||
"type": "number"
|
||||
},
|
||||
"incomeTypeFk": {
|
||||
"type": "number"
|
||||
},
|
||||
"paymentDate": {
|
||||
"type": "date"
|
||||
},
|
||||
"workerFk": {
|
||||
"type": "number"
|
||||
},
|
||||
"concept": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"payrollComponent": {
|
||||
"type": "belongsTo",
|
||||
"model": "PayrollComponent",
|
||||
"foreignKey": "id"
|
||||
},
|
||||
"worker": {
|
||||
"type": "belongsTo",
|
||||
"model": "Worker",
|
||||
"foreignKey": "workerFk"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -116,6 +116,11 @@
|
|||
"model": "Locker",
|
||||
"foreignKey": "workerFk"
|
||||
},
|
||||
"incomes": {
|
||||
"type": "hasMany",
|
||||
"model": "WorkerIncome",
|
||||
"foreignKey": "workerFk"
|
||||
},
|
||||
"trainingCourse": {
|
||||
"type": "hasMany",
|
||||
"model": "TrainingCourse",
|
||||
|
@ -131,4 +136,4 @@
|
|||
"principalId": "$owner"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue