Merge branch 'dev' into 4875-skip-tests
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Pau 2022-12-01 13:33:52 +00:00
commit 691d157da8
9 changed files with 64 additions and 40 deletions

View File

@ -95,6 +95,14 @@ module.exports = Self => {
{'c.name': {like: `%${value}%`}}, {'c.name': {like: `%${value}%`}},
{'c.socialName': {like: `%${value}%`}}, {'c.socialName': {like: `%${value}%`}},
]}; ]};
case 'phone':
return {or: [
{'c.phone': {like: `%${value}%`}},
{'c.mobile': {like: `%${value}%`}},
]};
case 'zoneFk':
param = 'a.postalCode';
return {[param]: {inq: postalCode}};
case 'name': case 'name':
case 'salesPersonFk': case 'salesPersonFk':
case 'fi': case 'fi':
@ -103,12 +111,8 @@ module.exports = Self => {
case 'postcode': case 'postcode':
case 'provinceFk': case 'provinceFk':
case 'email': case 'email':
case 'phone':
param = `c.${param}`; param = `c.${param}`;
return {[param]: value}; return {[param]: {like: `%${value}%`}};
case 'zoneFk':
param = 'a.postalCode';
return {[param]: {inq: postalCode}};
} }
}); });
@ -122,6 +126,7 @@ module.exports = Self => {
c.fi, c.fi,
c.socialName, c.socialName,
c.phone, c.phone,
c.mobile,
c.city, c.city,
c.postcode, c.postcode,
c.email, c.email,
@ -135,7 +140,7 @@ module.exports = Self => {
LEFT JOIN account.user u ON u.id = c.salesPersonFk LEFT JOIN account.user u ON u.id = c.salesPersonFk
LEFT JOIN province p ON p.id = c.provinceFk LEFT JOIN province p ON p.id = c.provinceFk
JOIN vn.address a ON a.clientFk = c.id JOIN vn.address a ON a.clientFk = c.id
` `
); );
stmt.merge(conn.makeWhere(filter.where)); stmt.merge(conn.makeWhere(filter.where));

View File

@ -57,14 +57,16 @@ module.exports = Self => {
r.clientFk, r.clientFk,
FALSE hasPdf, FALSE hasPdf,
FALSE isInvoice, FALSE isInvoice,
CASE WHEN at2.code LIKE 'compensation' THEN True ELSE False END as isCompensation at2.id IS NOT NULL as isCompensation
FROM vn.receipt r FROM vn.receipt r
LEFT JOIN vn.worker w ON w.id = r.workerFk LEFT JOIN vn.worker w ON w.id = r.workerFk
LEFT JOIN account.user u ON u.id = w.userFk LEFT JOIN account.user u ON u.id = w.userFk
JOIN vn.company c ON c.id = r.companyFk JOIN vn.company c ON c.id = r.companyFk
JOIN vn.accounting a ON a.id = r.bankFk LEFT JOIN vn.accounting a ON a.id = r.bankFk
JOIN vn.accountingType at2 ON at2.id = a.accountingTypeFk LEFT JOIN vn.accountingType at2 ON at2.id = a.accountingTypeFk AND at2.code = 'compensation'
WHERE r.clientFk = ? AND r.companyFk = ? WHERE
r.clientFk = ?
AND r.companyFk = ?
UNION ALL UNION ALL
SELECT SELECT
i.id, i.id,
@ -81,13 +83,10 @@ module.exports = Self => {
i.clientFk, i.clientFk,
i.hasPdf, i.hasPdf,
TRUE isInvoice, TRUE isInvoice,
CASE WHEN at2.code LIKE 'compensation' THEN True ELSE False END as isCompensation NULL
FROM vn.invoiceOut i FROM vn.invoiceOut i
JOIN vn.company c ON c.id = i.companyFk JOIN vn.company c ON c.id = i.companyFk
JOIN vn.accounting a ON a.id = i.bankFk
JOIN vn.accountingType at2 ON at2.id = a.accountingTypeFk
WHERE i.clientFk = ? AND i.companyFk = ? WHERE i.clientFk = ? AND i.companyFk = ?
ORDER BY payed DESC, created DESC
) t ORDER BY payed DESC, created DESC`, ) t ORDER BY payed DESC, created DESC`,
[ [
clientId, clientId,

View File

@ -137,9 +137,11 @@ module.exports = Self => {
const params = [args.id, args.shipped, args.warehouseFk]; const params = [args.id, args.shipped, args.warehouseFk];
const [salesMovable] = await Self.rawSql(query, params, myOptions); const [salesMovable] = await Self.rawSql(query, params, myOptions);
const sales = await models.Sale.find({ticketFk: args.id}, myOptions);
const salesNewTicket = salesMovable.filter(sale => (sale.movable ? sale.movable : 0) >= sale.quantity); const salesNewTicket = salesMovable.filter(sale => (sale.movable ? sale.movable : 0) >= sale.quantity);
if (salesNewTicket.length) { const salesNewTicketLength = salesNewTicket.length;
if (salesNewTicketLength && sales.length != salesNewTicketLength) {
const newTicket = await models.Ticket.transferSales(ctx, args.id, null, salesNewTicket, myOptions); const newTicket = await models.Ticket.transferSales(ctx, args.id, null, salesNewTicket, myOptions);
args.id = newTicket.id; args.id = newTicket.id;
} }

View File

@ -67,6 +67,7 @@ class Controller extends Component {
ticketHaveNegatives() { ticketHaveNegatives() {
let haveNegatives = false; let haveNegatives = false;
let haveNotNegatives = false; let haveNotNegatives = false;
this.ticket.withoutNegatives = false;
const haveDifferences = this.ticket.sale.haveDifferences; const haveDifferences = this.ticket.sale.haveDifferences;
this.ticket.sale.items.forEach(item => { this.ticket.sale.items.forEach(item => {
@ -76,8 +77,9 @@ class Controller extends Component {
haveNotNegatives = true; haveNotNegatives = true;
}); });
this.ticket.withoutNegatives = true;
this.haveNegatives = (haveNegatives && haveNotNegatives && haveDifferences); this.haveNegatives = (haveNegatives && haveNotNegatives && haveDifferences);
if (this.haveNegatives)
this.ticket.withoutNegatives = true;
} }
onSubmit() { onSubmit() {

View File

@ -1,5 +1,5 @@
html { html {
font-family: "Roboto"; font-family: Arial, Helvetica, sans-serif;
margin-top: -6px; margin-top: -6px;
} }
* { * {
@ -9,12 +9,15 @@ html {
} }
#vertical { #vertical {
writing-mode: vertical-rl; writing-mode: vertical-rl;
height: 240px; height: 230px;
font-size: 29px;
margin-left: -13px; margin-left: -13px;
} }
.outline { .outline {
border: 1px solid black; border: 1px solid black;
padding: 5px; padding: 5px;
height: 37px;
width: 100px;
} }
#nickname { #nickname {
font-size: 22px; font-size: 22px;
@ -22,17 +25,20 @@ html {
} }
#agencyDescripton { #agencyDescripton {
font-size: 32px; font-size: 32px;
width: 375px;
font-weight: bold; font-weight: bold;
} }
#bold { #bold {
font-weight: bold; font-weight: bold;
} }
#barcode{ #barcode{
width: 390px; width: 370px;
} }
#shipped { #shipped {
font-weight: bold; font-weight: bold;
width: 50px;
max-width: 100px;
} }
#ticketFk, #vertical { #ticketFk {
font-size: 34px; font-size: 32px;
} }

View File

@ -4,31 +4,29 @@
<table v-for="labelData in labelsData" style="break-before: page"> <table v-for="labelData in labelsData" style="break-before: page">
<tbody> <tbody>
<tr> <tr>
<td rowspan="6"><span id="vertical" class="ellipsize"> <td rowspan="6"><span id="vertical" class="ellipsize">{{getVertical(labelData)}}</span></td>
{{labelData.collectionFk ? `${labelData.collectionFk} ~ ${labelData.wagon}-${labelData.level}` : '-'.repeat(23)}}
</span></td>
<td id="ticketFk"> <td id="ticketFk">
{{labelData.clientFk ? `${labelData.ticketFk} « ${labelData.clientFk}` : labelData.ticketFk}} {{labelData.clientFk ? `${labelData.ticketFk} « ${labelData.clientFk}` : labelData.ticketFk}}
</td> </td>
<td colspan="2" id="shipped">{{labelData.shipped ? labelData.shipped : '---'}}</td> <td colspan="2" id="shipped">{{labelData.shipped || '---'}}</td>
</tr> </tr>
<tr> <tr>
<td rowspan="3"><div v-html="getBarcode(labelData.ticketFk)" id="barcode"></div></td> <td rowspan="3"><div v-html="getBarcode(labelData.ticketFk)" id="barcode"></div></td>
<td class="outline">{{labelData.workerCode ? labelData.workerCode : '---'}}</td> <td class="outline">{{labelData.workerCode || '---'}}</td>
</tr> </tr>
<tr> <tr>
<td class="outline">{{labelData.labelCount ? labelData.labelCount : 0}}</td> <td class="outline">{{labelData.labelCount || 0}}</td>
</tr> </tr>
<tr> <tr>
<td class="outline">{{labelData.code == 'plant' ? labelData.size + 'cm' : labelData.volume + 'm³'}}</td> <td class="outline">{{labelData.code == 'V' ? (labelData.size || 0) + 'cm' : (labelData.volume || 0) + 'm³'}}</td>
</tr> </tr>
<tr> <tr>
<td><div id="agencyDescripton" class="ellipsize">{{labelData.agencyDescription}}</div></td> <td><div id="agencyDescripton" class="ellipsize">{{labelData.agencyDescription ? labelData.agencyDescription.toUpperCase() : '---'}}</div></td>
<td id="bold">{{labelData.lineCount ? labelData.lineCount : 0}}</td> <td id="bold">{{labelData.lineCount || 0}}</td>
</tr> </tr>
<tr> <tr>
<td id="nickname" class="ellipsize">{{labelData.nickName ? labelData.nickName : '---'}}</td> <td id="nickname" class="ellipsize">{{labelData.nickName ? labelData.nickName.toUpperCase() : '---'}}</td>
<td id="bold">{{labelData.shipped ? labelData.shippedHour : labelData.zoneHour}}</td> <td id="bold">{{labelData.shippedHour || labelData.zoneHour}}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -25,7 +25,6 @@ module.exports = {
ticketIds = [this.id]; ticketIds = [this.id];
this.labelsData = await this.rawSqlFromDef('labelsData', [ticketIds]); this.labelsData = await this.rawSqlFromDef('labelsData', [ticketIds]);
if (!this.labelsData.length) if (!this.labelsData.length)
throw new UserError('Empty data source'); throw new UserError('Empty data source');
}, },
@ -44,6 +43,19 @@ module.exports = {
}); });
return xmlSerializer.serializeToString(svgNode); return xmlSerializer.serializeToString(svgNode);
}, },
getVertical(labelData) {
let value;
if (labelData.collectionFk) {
value = `${labelData.collectionFk} ~ `;
if (labelData.code == 'V')
value = value + `${labelData.wagon}-${labelData.level}`;
else
value = value + `${labelData.color.substring(0, 4)}`;
} else
value = '-'.repeat(19);
return value;
},
}, },
components: { components: {
'report-body': reportBody.build() 'report-body': reportBody.build()

View File

@ -1,6 +1,6 @@
{ {
"width": "10.4cm", "width": "10.4cm",
"height": "4.8cm", "height": "4.9cm",
"margin": { "margin": {
"top": "0.3cm", "top": "0.3cm",
"right": "0.6cm", "right": "0.6cm",

View File

@ -1,13 +1,13 @@
SELECT tc.collectionFk, SELECT c.itemPackingTypeFk code,
tc.collectionFk,
SUBSTRING('ABCDEFGH', tc.wagon, 1) wagon, SUBSTRING('ABCDEFGH', tc.wagon, 1) wagon,
tc.`level`, tc.`level`,
t.id ticketFk, t.id ticketFk,
COALESCE(et.description, zo.name, am.name) agencyDescription, COALESCE(et.description, zo.name, am.name) agencyDescription,
am.name, cc.code color,
t.clientFk, t.clientFk,
CAST(SUM(sv.volume) AS DECIMAL(5, 2)) volume, CAST(SUM(sv.volume) AS DECIMAL(5, 2)) volume,
MAX(i.`size`) `size`, MAX(i.`size`) `size`,
ic.code,
w.code workerCode, w.code workerCode,
TIME_FORMAT(t.shipped, '%H:%i') shippedHour, TIME_FORMAT(t.shipped, '%H:%i') shippedHour,
TIME_FORMAT(zo.`hour`, '%H:%i') zoneHour, TIME_FORMAT(zo.`hour`, '%H:%i') zoneHour,
@ -16,8 +16,8 @@ SELECT tc.collectionFk,
tt.labelCount, tt.labelCount,
COUNT(*) lineCount COUNT(*) lineCount
FROM vn.ticket t FROM vn.ticket t
LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = t.id JOIN vn.ticketCollection tc ON tc.ticketFk = t.id
LEFT JOIN vn.collection c ON c.id = tc.collectionFk JOIN vn.collection c ON c.id = tc.collectionFk
LEFT JOIN vn.collectionColors cc ON cc.shelve = tc.`level` LEFT JOIN vn.collectionColors cc ON cc.shelve = tc.`level`
AND cc.wagon = tc.wagon AND cc.wagon = tc.wagon
AND cc.trainFk = c.trainFk AND cc.trainFk = c.trainFk
@ -26,7 +26,7 @@ SELECT tc.collectionFk,
JOIN vn.item i ON i.id = s.itemFk JOIN vn.item i ON i.id = s.itemFk
JOIN vn.itemType it ON it.id = i.typeFk JOIN vn.itemType it ON it.id = i.typeFk
JOIN vn.itemCategory ic ON ic.id = it.categoryFk JOIN vn.itemCategory ic ON ic.id = it.categoryFk
LEFT JOIN vn.worker w ON w.id = c.workerFk JOIN vn.worker w ON w.id = c.workerFk
JOIN vn.agencyMode am ON am.id = t.agencyModeFk JOIN vn.agencyMode am ON am.id = t.agencyModeFk
LEFT JOIN vn.ticketTrolley tt ON tt.ticket = t.id LEFT JOIN vn.ticketTrolley tt ON tt.ticket = t.id
LEFT JOIN vn.`zone` zo ON t.zoneFk = zo.id LEFT JOIN vn.`zone` zo ON t.zoneFk = zo.id