#7116 agencyIncoming #2178

Merged
robert merged 11 commits from 7116-agencyIncoming into dev 2024-07-09 06:29:34 +00:00
51 changed files with 480 additions and 183 deletions
Showing only changes of commit f1c9c71f4f - Show all commits

View File

@ -3232,7 +3232,6 @@ INSERT IGNORE INTO vn.itemType
workerFk = 103,
isInventory = TRUE,
life = 10,
density = 250,
itemPackingTypeFk = NULL,
temperatureFk = 'warm';

View File

@ -0,0 +1,12 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `account`.`mailAliasAccount_afterDelete`
AFTER DELETE ON `mailAliasAccount`
FOR EACH ROW
BEGIN
INSERT INTO userLog
SET `action` = 'delete',
`changedModel` = 'MailAliasAccount',
`changedModelId` = OLD.id,
`userFk` = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -0,0 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `account`.`mailAliasAccount_beforeInsert`
BEFORE INSERT ON `mailAliasAccount`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -0,0 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `account`.`mailAliasAccount_beforeUpdate`
BEFORE UPDATE ON `mailAliasAccount`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -59,7 +59,7 @@ BEGIN
JOIN vn.saleComponent sc ON sc.saleFk = s.id
JOIN vn.component c ON c.id = sc.componentFk
JOIN vn.componentType ct ON ct.id = c.typeFk
WHERE ct.code = 'FREIGHT'
WHERE ct.code = 'freight'
AND r.created BETWEEN vDatedFrom AND vDatedTo
GROUP BY r.id
) sub ON sub.routeFk = r.Id_Ruta

View File

@ -2,7 +2,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `bi`.`tarifa_componentes_series`
AS SELECT `ct`.`id` AS `tarifa_componentes_series_id`,
`ct`.`type` AS `Serie`,
`ct`.`name` AS `Serie`,
`ct`.`isBase` AS `base`,
`ct`.`isMargin` AS `margen`
FROM `vn`.`componentType` `ct`

View File

@ -117,7 +117,7 @@ proc: BEGIN
)sub
GROUP BY sub.itemFk;
DROP TEMPORARY TABLE tmp.itemCalc, tItemRange;
DROP TEMPORARY TABLE tmp.itemCalc, tItemRange, tmp.itemList;
CALL cache_calc_end (vCalc);
END$$
DELIMITER ;

View File

@ -121,7 +121,7 @@ proc: BEGIN
)sub
GROUP BY sub.itemFk;
DROP TEMPORARY TABLE tmp.itemCalc, itemRange;
DROP TEMPORARY TABLE tmp.itemCalc, itemRange, tmp.itemList;
CALL cache_calc_end (vCalc);
END$$
DELIMITER ;

View File

@ -7,7 +7,6 @@ BEGIN
*/
DECLARE vRewriteKop INT DEFAULT NULL;
DECLARE vTruncatePutOrder INT DEFAULT NULL;
DECLARE vBarcode CHAR(15) DEFAULT NULL;
DECLARE vKop INT;
DECLARE vPutOrderFk BIGINT;
@ -16,17 +15,6 @@ BEGIN
FROM ekt
WHERE id = vSelf;
-- Generates the barcode
SELECT CONCAT(
LPAD(IFNULL(auction,0), 3, 0),
LPAD(IFNULL(klo, 99), 2, 0),
LPAD(DAYOFYEAR(fec), 3, 0),
COALESCE(agj, RIGHT(batchNumber,7), id))
INTO vBarcode
FROM ekt
WHERE id = vSelf;
-- Rewrites the kop parameter
IF vKop IS NULL THEN
@ -46,10 +34,9 @@ BEGIN
-- Refresh EKT
UPDATE ekt SET
barcode = vBarcode
,kop = vKop
,putOrderFk = vTruncatePutOrder
UPDATE ekt
SET kop = vKop,
putOrderFk = vTruncatePutOrder
WHERE id = vSelf;
END$$
DELIMITER ;

View File

@ -2,7 +2,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `edi`.`ektRecent`
AS SELECT `e`.`id` AS `id`,
`e`.`barcode` AS `barcode`,
`e`.`entryYear` AS `entryYear`,
`e`.`batchNumber` AS `batchNumber`,
`e`.`deliveryNumber` AS `deliveryNumber`,

View File

@ -30,6 +30,7 @@ BEGIN
tmp.ticketComponentPrice,
tmp.ticketComponent,
tmp.ticketLot,
tmp.zoneGetShipped;
tmp.zoneGetShipped,
tmp.item;
END$$
DELIMITER ;

View File

@ -6,19 +6,6 @@ BEGIN
* identificando y notificando los asientos descuadrados
* y ajustando los saldos en caso necesario.
*/
INSERT INTO mail (receiver, subject, body)
SELECT 'cau@verdnatura.es',
'Asientos descuadrados',
GROUP_CONCAT(CONCAT(' Asiento: ', ASIEN, ' - Importe:', recon) SEPARATOR ' | \n')
FROM (
SELECT ASIEN,
SUM(IFNULL(ROUND(Eurodebe, 2), 0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0)) recon
FROM XDiario
WHERE NOT enlazado
GROUP BY ASIEN
HAVING ABS(SUM(IFNULL(ROUND(Eurodebe, 2), 0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0))) > 0.01
) sub
HAVING COUNT(*);
UPDATE XDiario xd
JOIN (

View File

@ -16,9 +16,9 @@ BEGIN
SET @order = 0;
DROP TEMPORARY TABLE IF EXISTS tmp.newSaleList;
DROP TEMPORARY TABLE IF EXISTS tNewSaleList;
CREATE TEMPORARY TABLE tmp.newSaleList
CREATE TEMPORARY TABLE tNewSaleList
SELECT id as saleFk, @order := @order + 1 as orden
FROM vn.sale
WHERE ticketFk = vTargetTicketFk
@ -28,7 +28,8 @@ BEGIN
SELECT ns.saleFk, sc.componentFk, sc.value
FROM vn.saleComponent sc
JOIN tmp.saleList s ON s.saleFk = sc.saleFk
JOIN tmp.newSaleList ns ON ns.orden = s.orden;
JOIN tNewSaleList ns ON ns.orden = s.orden;
DROP TEMPORARY TABLE tNewSaleList;
END$$
DELIMITER ;

View File

@ -8,7 +8,6 @@ BEGIN
*/
DECLARE vTaxRowLimit INT;
DECLARE vLines INT;
DECLARE vHasDistinctTransactions INT;
SELECT taxRowLimit INTO vTaxRowLimit FROM invoiceInConfig;
@ -20,17 +19,5 @@ BEGIN
IF vLines >= vTaxRowLimit THEN
CALL util.throw (CONCAT('The maximum number of lines is ', vTaxRowLimit));
END IF;
SELECT COUNT(DISTINCT transactionTypeSageFk) INTO vHasDistinctTransactions
FROM invoiceIn ii
JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
JOIN invoiceInSerial iis ON iis.code = ii.serial
WHERE ii.id = vInvoiceInFk
AND iis.taxAreaFk = 'CEE'
AND transactionTypeSageFk;
IF vHasDistinctTransactions > 1 THEN
CALL util.throw ('This invoice does not allow different types of transactions');
END IF;
END$$
DELIMITER ;

View File

@ -13,6 +13,19 @@ BEGIN
* @param vBookEntry Id de asiento, si es NULL se genera uno nuevo
*/
DECLARE vFiscalYear INT;
DECLARE vHasDistinctTransactions INT;
SELECT COUNT(DISTINCT transactionTypeSageFk) INTO vHasDistinctTransactions
FROM invoiceIn ii
JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
JOIN invoiceInSerial iis ON iis.code = ii.serial
WHERE ii.id = vSelf
AND iis.taxAreaFk = 'CEE'
AND transactionTypeSageFk;
IF vHasDistinctTransactions > 1 THEN
CALL util.throw ('This invoice does not allow different types of transactions');
END IF;
CREATE OR REPLACE TEMPORARY TABLE tInvoiceIn
ENGINE = MEMORY

View File

@ -59,5 +59,7 @@ BEGIN
WHERE p.pickingOrder BETWEEN vPickingOrderFrom AND vPickingOrderTo
AND p.sectorFk = vSectorFk
ORDER BY p.pickingOrder;
DROP TEMPORARY TABLE tmp.stockMisfit;
END$$
DELIMITER ;

View File

@ -76,5 +76,7 @@ BEGIN
i.quantity amount
FROM tmp.itemAtp i
HAVING amount != 0;
DROP TEMPORARY TABLE tmp.itemAtp;
END$$
DELIMITER ;

View File

@ -15,14 +15,13 @@ BEGIN
* @param vDated Fecha
* @param vShowType Mostrar tipos
*/
DECLARE vCalcFk INT;
DECLARE vAvailableCalcFk INT;
DECLARE vVisibleCalcFk INT;
DECLARE vTypeFk INT;
DECLARE vPriority INT DEFAULT 1;
CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vDated);
-- Añadido temporalmente para que no se cuelgue la db
SET vShowType = TRUE;
CALL cache.available_refresh(vAvailableCalcFk, FALSE, vWarehouseFk, vDated);
CALL cache.visible_refresh(vVisibleCalcFk, FALSE, vWarehouseFk);
WITH itemTags AS (
SELECT i.id,
@ -65,21 +64,21 @@ BEGIN
WHEN b.groupingMode = 'packing' THEN b.packing
ELSE 1
END AS minQuantity,
iss.visible located,
v.visible located,
b.price2
FROM vn.item i
JOIN cache.available a ON a.item_id = i.id
AND a.calc_id = vCalcFk
AND a.calc_id = vAvailableCalcFk
LEFT JOIN cache.visible v ON v.item_id = i.id
AND v.calc_id = vVisibleCalcFk
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id
AND lb.warehouse_id = vWarehouseFk
LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id
AND ip.itemFk = vSelf
LEFT JOIN vn.itemTag it ON it.itemFk = i.id
AND it.priority = vPriority
LEFT JOIN vn.tag t ON t.id = it.tagFk
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id
AND lb.warehouse_id = vWarehouseFk
LEFT JOIN vn.buy b ON b.id = lb.buy_id
LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = i.id
AND iss.warehouseFk = vWarehouseFk
JOIN itemTags its
WHERE a.available > 0
AND (i.typeFk = its.typeFk OR NOT vShowType)

View File

@ -104,5 +104,6 @@ BEGIN
) sub;
DROP TEMPORARY TABLE tmp.whiteTicket;
DROP TEMPORARY TABLE tmp.sectorTypeTicket;
DROP TEMPORARY TABLE tmp.productionBuffer;
END$$
DELIMITER ;

View File

@ -8,7 +8,7 @@ BEGIN
JOIN vn.component c ON c.id = sc.componentFk
JOIN vn.componentType ct ON ct.id = c.typeFk
WHERE s.ticketFk = vTicketFk
AND ct.`type` = 'otros';
AND ct.code = 'other';
UPDATE vn.sale s
JOIN (

View File

@ -22,40 +22,42 @@ proc: BEGIN
CALL util.throw('parkingNotExist');
LEAVE proc;
END IF;
IF vParam REGEXP '^[0-9]+$' THEN
-- Se comprueba si es una preparación previa
SELECT COUNT(*) INTO vIsSaleGroup
FROM vn.saleGroup sg
WHERE sg.id = vParam;
-- Se comprueba si es una preparación previa
SELECT COUNT(*) INTO vIsSaleGroup
FROM vn.saleGroup sg
WHERE sg.id = vParam;
IF vIsSaleGroup THEN
CALL vn.saleGroup_setParking(vParam, vParkingFk);
LEAVE proc;
END IF;
IF vIsSaleGroup THEN
CALL vn.saleGroup_setParking(vParam, vParkingFk);
LEAVE proc;
-- Se comprueba si es un ticket
SELECT COUNT(*) INTO vIsTicket
FROM vn.ticket t
WHERE t.id = vParam
AND t.shipped >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
IF vIsTicket THEN
CALL vn.ticket_setParking(vParam, vParkingFk);
LEAVE proc;
END IF;
-- Se comprueba si es una coleccion de tickets
SELECT COUNT(*) INTO vIsCollection
FROM vn.collection c
WHERE c.id = vParam
AND c.created >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
IF vIsCollection THEN
CALL vn.collection_setParking(vParam, vParkingFk);
LEAVE proc;
END IF;
ELSE
-- Por descarte, se considera una matrícula
CALL vn.shelving_setParking(vParam, vParkingFk);
END IF;
-- Se comprueba si es un ticket
SELECT COUNT(*) INTO vIsTicket
FROM vn.ticket t
WHERE t.id = vParam
AND t.shipped >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
IF vIsTicket THEN
CALL vn.ticket_setParking(vParam, vParkingFk);
LEAVE proc;
END IF;
-- Se comprueba si es una coleccion de tickets
SELECT COUNT(*) INTO vIsCollection
FROM vn.collection c
WHERE c.id = vParam
AND c.created >= TIMESTAMPADD(WEEK,-1,util.VN_CURDATE());
IF vIsCollection THEN
CALL vn.collection_setParking(vParam, vParkingFk);
LEAVE proc;
END IF;
-- Por descarte, se considera una matrícula
CALL vn.shelving_setParking(vParam, vParkingFk);
END$$
DELIMITER ;

View File

@ -3,14 +3,14 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_DelayTruck`(
BEGIN
DECLARE done INT DEFAULT FALSE;
DECLARE vTicketFk INT;
DECLARE cur1 CURSOR FOR SELECT ticketFk FROM tmp.ticket;
DECLARE cur1 CURSOR FOR SELECT ticketFk FROM tTicket;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
CALL vn.productionControl(vWarehouserFk,0) ;
DROP TEMPORARY TABLE IF EXISTS tmp.ticket;
CREATE TEMPORARY TABLE tmp.ticket
DROP TEMPORARY TABLE IF EXISTS tTicket;
CREATE TEMPORARY TABLE tTicket
SELECT ticketFk
FROM tmp.productionBuffer
JOIN alertLevel al ON al.code = 'FREE'
@ -31,5 +31,6 @@ BEGIN
END LOOP;
CLOSE cur1;
DROP TEMPORARY TABLE tTicket, tmp.productionBuffer;
END$$
DELIMITER ;

View File

@ -65,6 +65,8 @@ BEGIN
IF (vZoneFk IS NULL OR vZoneFk = 0) AND vIsRequiredZone THEN
CALL util.throw ('NOT_ZONE_WITH_THIS_PARAMETERS');
END IF;
DROP TEMPORARY TABLE tmp.zoneGetShipped;
END IF;
INSERT INTO ticket (

View File

@ -20,7 +20,8 @@ BEGIN
JOIN itemCategory ic ON ic.id = tp.categoryFk
JOIN saleComponent sc ON sc.saleFk = s.id
JOIN component c ON c.id = sc.componentFk
JOIN componentType ct ON ct.id = c.typeFk AND ct.id = 1
JOIN componentType ct ON ct.id = c.typeFk
AND ct.code = 'cost'
WHERE t.shipped BETWEEN vShippedFrom AND vShippedTo
AND ic.merchandise;

View File

@ -213,6 +213,6 @@ BEGIN
END;
END LOOP;
CLOSE rsTicket;
DROP TEMPORARY TABLE IF EXISTS tmp.time;
DROP TEMPORARY TABLE IF EXISTS tmp.time, tmp.zoneGetLanded;
END$$
DELIMITER ;

View File

@ -66,7 +66,7 @@ BEGIN
JOIN vn.componentType ct ON ct.id = c.typeFk
JOIN vn.sale s ON s.id = sc.saleFk
JOIN tmp.ticket t ON t.ticketFk = s.ticketFk
WHERE ct.code = 'FREIGHT'
WHERE ct.code = 'freight'
GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk
SET tf.freight = sb.freight;
@ -88,7 +88,7 @@ BEGIN
-- Margin
UPDATE tmp.ticketFloramondo tf
JOIN (SELECT SUM(IF(ct.code = 'COST',sc.value, 0)) cost,
JOIN (SELECT SUM(IF(ct.code = 'cost',sc.value, 0)) cost,
SUM(IF(ct.isMargin, sc.value, 0)) margin,
t.ticketFk
FROM vn.saleComponent sc

View File

@ -44,7 +44,6 @@ BEGIN
WHERE s.ticketFk = vTicketFk;
CREATE OR REPLACE TEMPORARY TABLE tmp.saleGroup
(PRIMARY KEY (itemPackingTypeFk))
ENGINE = MEMORY
SELECT itemPackingTypeFk, SUM(litros) totalLitros
FROM tmp.sale
@ -56,8 +55,7 @@ BEGIN
CREATE OR REPLACE TEMPORARY TABLE tmp.ticketIPT (
ticketFk INT,
itemPackingTypeFk VARCHAR(1),
PRIMARY KEY (ticketFk)
itemPackingTypeFk VARCHAR(1)
) ENGINE = MEMORY;
CASE vPackingTypesToSplit

View File

@ -103,6 +103,7 @@ BEGIN
DROP TEMPORARY TABLE
geoCollision,
tmp.zone,
tmp.zoneNodes;
tmp.zoneNodes,
tmp.zoneOption;
END$$
DELIMITER ;

View File

@ -19,4 +19,4 @@ FROM (
)
JOIN `vn`.`componentType` `ct` ON(`ct`.`id` = `c`.`typeFk`)
)
WHERE `ct`.`type` = 'coste'
WHERE `ct`.`code` = 'cost'

View File

@ -16,6 +16,6 @@ FROM (
)
JOIN `vn`.`componentType` `ct` ON(
`ct`.`id` = `c`.`typeFk`
AND `ct`.`type` = 'agencia'
AND `ct`.`code` = 'freight'
)
)

View File

@ -9,14 +9,9 @@ AS SELECT `it`.`id` AS `tipo_id`,
`it`.`workerFk` AS `Id_Trabajador`,
`it`.`life` AS `life`,
`it`.`isPackaging` AS `isPackaging`,
`it`.`density` AS `density`,
`it`.`isInventory` AS `inventory`,
`it`.`created` AS `odbc_date`,
`it`.`making` AS `confeccion`,
`it`.`temperatureFk` AS `Temperatura`,
`it`.`promo` AS `promo`,
`it`.`maneuver` AS `maneuver`,
`it`.`target` AS `target`,
`it`.`topMargin` AS `top_margin`,
`it`.`profit` AS `profit`
`it`.`promo` AS `promo`
FROM `vn`.`itemType` `it`

View File

@ -2,7 +2,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`buy_edi`
AS SELECT `t`.`id` AS `id`,
`t`.`barcode` AS `barcode`,
`t`.`entryYear` AS `entry_year`,
`t`.`deliveryNumber` AS `delivery_number`,
`t`.`fec` AS `fec`,

View File

@ -0,0 +1,9 @@
ALTER TABLE vn.componentType
CHANGE code code varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL NULL AFTER id;
ALTER TABLE vn.componentType
CHANGE `type` name varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL;
UPDATE IGNORE vn.componentType
SET code = LOWER(code);
UPDATE IGNORE vn.componentType
SET code = 'other'
WHERE id = 12;

View File

@ -0,0 +1,6 @@
ALTER TABLE vn.itemType
CHANGE maneuver maneuver__ double DEFAULT 0.21 NOT NULL COMMENT '@deprecated 2024-07-01 refs #7418',
CHANGE target target__ double DEFAULT 0.15 NOT NULL COMMENT '@deprecated 2024-07-01 refs #7418',
CHANGE topMargin topMargin__ double DEFAULT 0.3 NOT NULL COMMENT '@deprecated 2024-07-01 refs #7418',
CHANGE profit profit__ double DEFAULT 0.02 NOT NULL COMMENT '@deprecated 2024-07-01 refs #7418',
CHANGE density density__ double DEFAULT 167 NOT NULL COMMENT '@deprecated 2024-07-01 refs #7418 Almacena el valor por defecto de la densidad en kg/m3 para el calculo de los portes aereos, en articulos se guarda la correcta';

View File

@ -0,0 +1,4 @@
ALTER TABLE account.mailAliasAccount
ADD editorFk INT(10) UNSIGNED DEFAULT NULL,
ADD CONSTRAINT mailAliasAccount_editorFk FOREIGN KEY (editorFk)
REFERENCES account.`user`(id);

View File

@ -0,0 +1,36 @@
module.exports = Self => {
Self.remoteMethodCtx('buyLabel', {
description: 'Returns the entry buys labels',
accessType: 'READ',
accepts: [
{
arg: 'id',
type: 'number',
required: true,
description: 'The entry id',
http: {source: 'path'}
}
],
returns: [
{
arg: 'body',
type: 'file',
root: true
}, {
arg: 'Content-Type',
type: 'String',
http: {target: 'header'}
}, {
arg: 'Content-Disposition',
type: 'String',
http: {target: 'header'}
}
],
http: {
path: '/:id/buy-label',
verb: 'GET'
}
});
Self.buyLabel = (ctx, id) => Self.printReport(ctx, id, 'buy-label');
};

View File

@ -9,6 +9,7 @@ module.exports = Self => {
require('../methods/entry/entryOrderPdf')(Self);
require('../methods/entry/addFromPackaging')(Self);
require('../methods/entry/addFromBuy')(Self);
require('../methods/entry/buyLabel')(Self);
Self.observe('before save', async function(ctx, options) {
if (ctx.isNewInstance) return;

View File

@ -12,7 +12,7 @@
"type": "number",
"description": "Identifier"
},
"type": {
"name": {
"type": "string"
},
"isBase":{

View File

@ -51,7 +51,7 @@
ng-repeat="saleComponent in sale.components track by saleComponent.componentFk"
class="components">
<td>
{{::saleComponent.component.componentType.type}}
{{::saleComponent.component.componentType.name}}
</td>
<td>
{{::saleComponent.component.name}}

View File

@ -20,7 +20,7 @@ class Controller extends Section {
include: {
relation: 'componentType',
scope: {
fields: ['type', 'isBase']
fields: ['name', 'isBase']
}
}
}

View File

@ -26,29 +26,33 @@
},
"labelerFk": {
"type": "number"
},
"isOnReservationMode": {
"type": "boolean",
"required": true
}
},
},
"relations": {
"sector": {
"type": "belongsTo",
"model": "Sector",
"foreignKey": "sectorFk"
},
"sector": {
"type": "belongsTo",
"model": "Sector",
"foreignKey": "sectorFk"
},
"train": {
"type": "belongsTo",
"model": "Train",
"foreignKey": "trainFk"
},
"type": "belongsTo",
"model": "Train",
"foreignKey": "trainFk"
},
"printer": {
"type": "belongsTo",
"model": "Printer",
"foreignKey": "labelerFk"
},
"type": "belongsTo",
"model": "Printer",
"foreignKey": "labelerFk"
},
"itemPackingType": {
"type": "belongsTo",
"model": "ItemPackingType",
"foreignKey": "itemPackingTypeFk",
"type": "belongsTo",
"model": "ItemPackingType",
"foreignKey": "itemPackingTypeFk",
"primaryKey": "code"
}
}
}
}
}
}

View File

@ -1,6 +1,6 @@
{
"name": "salix-back",
"version": "24.28.0",
"version": "24.30.0",
"author": "Verdnatura Levante SL",
"description": "Salix backend",
"license": "GPL-3.0",

View File

@ -0,0 +1,12 @@
const Stylesheet = require(`vn-print/core/stylesheet`);
const path = require('path');
const vnPrintPath = path.resolve('print');
module.exports = new Stylesheet([
`${vnPrintPath}/common/css/spacing.css`,
`${vnPrintPath}/common/css/misc.css`,
`${vnPrintPath}/common/css/layout.css`,
`${vnPrintPath}/common/css/report.css`,
`${__dirname}/style.css`])
.mergeStyles();

View File

@ -0,0 +1,41 @@
html {
font-family: "Roboto", "Helvetica", "Arial", sans-serif;
margin-top: -7px;
font-size: 28px;
}
table {
border: 1px solid;
width: 100%;
font-size: inherit;
}
td {
border: 1px solid;
padding: 5px;
width: 100%;
}
span {
font-size: 48px;
font-weight: bold;
}
.lbl {
color: gray;
font-weight: lighter;
font-size: 18px;
display: block;
}
.cell {
width: 157px;
height: 50px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.barcode {
text-align: center;
}
#variant {
width: 314px;
}
#producer {
width: 471px;
}

View File

@ -0,0 +1,89 @@
<!DOCTYPE html>
<html>
<table v-for="buy in buys" style="break-before: page">
<tbody>
<tr>
<td colspan="2">
<div id="variant" class="cell">
<span class="lbl">{{$t('variety')}}</span>
{{buy.name}}
</div>
</td>
<td>
<div class="cell">
<span class="lbl">{{$t('size')}}</span>
{{buy.size}}
</div>
</td>
</tr>
<tr>
<td>
<div class="cell">
<span class="lbl">{{$t('category')}}</span>
{{buy.category}}
</div>
</td>
<td>
<div class="cell">
<span class="lbl">{{$t('color')}}</span>
{{buy.color}}
</div>
</td>
<td>
<div class="cell">
<span class="lbl">{{$t('origin')}}</span>
{{buy.code}}
</div>
</td>
</tr>
<tr>
<td>
<div class="cell">
<span class="lbl">{{$t('packing')}}</span>
{{buy.packing}}
</div>
</td>
<td>
<div class="cell">
<span class="lbl">{{$t('grouping')}}</span>
{{buy.grouping}}
</div>
</td>
<td>
<div class="cell">
<span class="lbl">{{$t('saleUnit')}}</span>
{{buy.stems}}
</div>
</td>
</tr>
<tr>
<td colspan="3" class="barcode">
<div v-html="getBarcode(buy.id)"></div>
<span>{{buy.id}}</span>
</td>
</tr>
<tr>
<td colspan="3">
<div id="producer" class="cell">
<span class="lbl">{{$t('producer')}}</span>
{{buy.producer}}
</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="cell">
<span class="lbl">{{$t('control')}}</span>
{{`${weekNum} / ${dayNum}`}}
</div>
</td>
<td>
<div class="cell">
<span class="lbl">{{$t('boxNum')}}</span>
{{`${buy.labelNum} / ${maxLabelNum}`}}
</div>
</td>
</tr>
</tbody>
</table>
</html>

View File

@ -0,0 +1,39 @@
const vnReport = require('../../../core/mixins/vn-report.js');
const {DOMImplementation, XMLSerializer} = require('xmldom');
const jsBarcode = require('jsbarcode');
const moment = require('moment');
module.exports = {
name: 'buy-label',
mixins: [vnReport],
async serverPrefetch() {
this.buys = await this.rawSqlFromDef('buys', [this.id]);
this.maxLabelNum = Math.max(...this.buys.map(buy => buy.labelNum));
const date = new Date();
this.weekNum = moment(date).isoWeek();
this.dayNum = moment(date).day();
},
methods: {
getBarcode(id) {
const xmlSerializer = new XMLSerializer();
const document = new DOMImplementation().createDocument('http://www.w3.org/1999/xhtml', 'html', null);
const svgNode = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
jsBarcode(svgNode, id, {
xmlDocument: document,
format: 'code128',
displayValue: false,
width: 3.8,
height: 115,
});
return xmlSerializer.serializeToString(svgNode);
}
},
props: {
id: {
type: Number,
required: true,
description: 'The entry id'
}
}
};

View File

@ -0,0 +1,12 @@
reportName: Entry buys
variety: Bariety
size: Size
category: Category
color: Color
origin: Origin
packing: Packing
grouping: Grouping
unitSale: Un. sale
producer: Producer
control: Control
boxNum: Box no.

View File

@ -0,0 +1,12 @@
reportName: Etiqueta de compras
variety: Variedad
size: Medida
category: Categoría
color: Color
origin: Origen
packing: Packing
grouping: Grouping
saleUnit: Sale un.
producer: Productor
control: Control
boxNum: Caja nº

View File

@ -0,0 +1,11 @@
{
"width": "10cm",
"height": "10cm",
"margin": {
"top": "0.17cm",
"right": "0.2cm",
"bottom": "0cm",
"left": "0cm"
},
"printBackground": true
}

View File

@ -0,0 +1,17 @@
SELECT ROW_NUMBER() OVER(ORDER BY b.id) labelNum,
i.name,
i.`size`,
i.category,
ink.id color,
o.code,
b.packing,
b.`grouping`,
i.stems,
b.id,
p.name producer
FROM buy b
JOIN item i ON i.id = b.itemFk
LEFT JOIN producer p ON p.id = i.producerFk
LEFT JOIN ink ON ink.id = i.inkFk
LEFT JOIN origin o ON o.id = i.originFk
WHERE b.entryFk = ?

View File

@ -1,43 +1,42 @@
SELECT
s.id,
s.itemFk,
s.concept,
s.quantity,
s.price,
s.price - SUM(IF(ctr.id = 6, sc.value, 0)) netPrice,
s.discount,
i.size,
i.stems,
i.category,
it.id itemTypeId,
o.code AS origin,
i.inkFk,
s.ticketFk,
tcl.code vatType,
ib.ediBotanic botanical,
i.tag5,
i.value5,
i.tag6,
i.value6,
i.tag7,
i.value7
FROM vn.sale s
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
LEFT JOIN component cr ON cr.id = sc.componentFk
LEFT JOIN componentType ctr ON ctr.id = cr.typeFk
LEFT JOIN item i ON i.id = s.itemFk
LEFT JOIN ticket t ON t.id = s.ticketFk
LEFT JOIN origin o ON o.id = i.originFk
LEFT JOIN country c ON c.id = o.countryFk
LEFT JOIN supplier sp ON sp.id = t.companyFk
LEFT JOIN itemType it ON it.id = i.typeFk
LEFT JOIN itemCategory ic ON ic.id = it.categoryFk
LEFT JOIN itemTaxCountry itc ON itc.itemFk = i.id
AND itc.countryFk = sp.countryFk
LEFT JOIN taxClass tcl ON tcl.id = itc.taxClassFk
LEFT JOIN itemBotanicalWithGenus ib ON ib.itemFk = i.id
AND ic.code = 'plant'
AND ib.ediBotanic IS NOT NULL
WHERE s.ticketFk = ?
GROUP BY s.id
ORDER BY (it.isPackaging), s.concept, s.itemFk
SELECT s.id,
s.itemFk,
s.concept,
s.quantity,
s.price,
s.price - SUM(IF(ctr.code = 'freight', sc.value, 0)) netPrice,
s.discount,
i.size,
i.stems,
i.category,
it.id itemTypeId,
o.code origin,
i.inkFk,
s.ticketFk,
tcl.code vatType,
ib.ediBotanic botanical,
i.tag5,
i.value5,
i.tag6,
i.value6,
i.tag7,
i.value7
FROM vn.sale s
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
LEFT JOIN component cr ON cr.id = sc.componentFk
LEFT JOIN componentType ctr ON ctr.id = cr.typeFk
LEFT JOIN item i ON i.id = s.itemFk
LEFT JOIN ticket t ON t.id = s.ticketFk
LEFT JOIN origin o ON o.id = i.originFk
LEFT JOIN country c ON c.id = o.countryFk
LEFT JOIN supplier sp ON sp.id = t.companyFk
LEFT JOIN itemType it ON it.id = i.typeFk
LEFT JOIN itemCategory ic ON ic.id = it.categoryFk
LEFT JOIN itemTaxCountry itc ON itc.itemFk = i.id
AND itc.countryFk = sp.countryFk
LEFT JOIN taxClass tcl ON tcl.id = itc.taxClassFk
LEFT JOIN itemBotanicalWithGenus ib ON ib.itemFk = i.id
AND ic.code = 'plant'
AND ib.ediBotanic IS NOT NULL
WHERE s.ticketFk = ?
GROUP BY s.id
ORDER BY (it.isPackaging), s.concept, s.itemFk