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.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 'salesPersonFk':
case 'fi':
@ -103,12 +111,8 @@ module.exports = Self => {
case 'postcode':
case 'provinceFk':
case 'email':
case 'phone':
param = `c.${param}`;
return {[param]: value};
case 'zoneFk':
param = 'a.postalCode';
return {[param]: {inq: postalCode}};
return {[param]: {like: `%${value}%`}};
}
});
@ -122,6 +126,7 @@ module.exports = Self => {
c.fi,
c.socialName,
c.phone,
c.mobile,
c.city,
c.postcode,
c.email,

View File

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

View File

@ -137,9 +137,11 @@ module.exports = Self => {
const params = [args.id, args.shipped, args.warehouseFk];
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);
if (salesNewTicket.length) {
const salesNewTicketLength = salesNewTicket.length;
if (salesNewTicketLength && sales.length != salesNewTicketLength) {
const newTicket = await models.Ticket.transferSales(ctx, args.id, null, salesNewTicket, myOptions);
args.id = newTicket.id;
}

View File

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

View File

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

View File

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

View File

@ -25,7 +25,6 @@ module.exports = {
ticketIds = [this.id];
this.labelsData = await this.rawSqlFromDef('labelsData', [ticketIds]);
if (!this.labelsData.length)
throw new UserError('Empty data source');
},
@ -44,6 +43,19 @@ module.exports = {
});
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: {
'report-body': reportBody.build()

View File

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

View File

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