Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 4480-vnUser
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Joan Sanchez 2023-02-02 08:23:17 +01:00
commit 7a700de5c2
32 changed files with 238 additions and 214 deletions

View File

@ -12,11 +12,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- (Trabajadores -> Nuevo trabajador) Nueva sección
### Changed
-
- (Entradas -> Compras) Cambiados los campos "Precio Grouping/Packing" por "PVP" y "Precio" por "Coste"
- (Artículos -> Últimas entradas) Cambiados los campos "P.P.U." y "P.P.P." por "PVP"
- (Rutas -> Sumario/Tickets) Actualizados campos de los tickets
### Fixed
- (Artículos -> Etiquetas) Permite intercambiar la relevancia entre dos etiquetas.
- (Cliente -> Datos Fiscales) No se permite seleccionar 'Notificar vía e-mail' a los clientes sin e-mail
- (Tickets -> Añadir pago) Eliminado "null" en las referencias
## [2302.01] - 2023-01-26

View File

@ -0,0 +1,6 @@
UPDATE `vn`.`client`
SET isToBeMailed = FALSE
WHERE
mailAddress is NULL
AND email is NULL
AND isToBeMailed = TRUE;

View File

@ -944,9 +944,9 @@ export default {
routeSummary: {
header: 'vn-route-summary > vn-card > h5',
cost: 'vn-route-summary vn-label-value[label="Cost"]',
firstTicketID: 'vn-route-summary vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(2) > span',
firstTicketID: 'vn-route-summary vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(10) > span',
firstTicketDescriptor: '.vn-popover.shown vn-ticket-descriptor',
firstAlias: 'vn-route-summary vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(3) > span',
firstAlias: 'vn-route-summary vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(5) > span',
firstClientDescriptor: '.vn-popover.shown vn-client-descriptor',
goToRouteSummaryButton: 'vn-route-summary > vn-card > h5 > a',

View File

@ -23,6 +23,7 @@ describe('Worker time control path', () => {
it('should go to the next month, go to current month and go 1 month in the past', async() => {
let date = new Date();
date.setDate(1);
date.setMonth(date.getMonth() + 1);
let month = date.toLocaleString('default', {month: 'long'});
@ -32,6 +33,7 @@ describe('Worker time control path', () => {
expect(result).toContain(month);
date = new Date();
date.setDate(1);
month = date.toLocaleString('default', {month: 'long'});
await page.click(selectors.workerTimeControl.previousMonthButton);
@ -40,6 +42,7 @@ describe('Worker time control path', () => {
expect(result).toContain(month);
date = new Date();
date.setDate(1);
date.setMonth(date.getMonth() - 1);
const timestamp = Math.round(date.getTime() / 1000);
month = date.toLocaleString('default', {month: 'long'});

View File

@ -87,6 +87,7 @@ ngModule.vnComponent('vnButtonMenu', {
selectFields: '<?',
initialData: '<?',
showFilter: '<?',
fields: '<?',
field: '=?',
url: '@?',
data: '<?',

View File

@ -42,6 +42,7 @@ vn-log {
& > td.after,
& > th.after {
width: 40%;
white-space: pre-line;
}
}
}

View File

@ -67,7 +67,7 @@
"Changed client paymethod": "I have changed the pay method for client [{{clientName}} ({{clientId}})]({{{url}}})",
"Sent units from ticket": "I sent *{{quantity}}* units of [{{concept}} ({{itemId}})]({{{itemUrl}}}) to *\"{{nickname}}\"* coming from ticket id [{{ticketId}}]({{{ticketUrl}}})",
"Change quantity": "{{concept}} change of {{oldQuantity}} to {{newQuantity}}",
"Claim will be picked": "The product from the claim [({{claimId}})]({{{claimUrl}}}) from the client *{{clientName}}* will be picked",
"Claim will be picked": "The product from the claim [({{claimId}})]({{{claimUrl}}}) from the client *{{clientName}}* will be picked",
"Claim state has changed to incomplete": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *incomplete*",
"Claim state has changed to canceled": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *canceled*",
"Customs agent is required for a non UEE member": "Customs agent is required for a non UEE member",
@ -137,15 +137,18 @@
"Password does not meet requirements": "Password does not meet requirements",
"You don't have privileges to change the zone": "You don't have privileges to change the zone or for these parameters there are more than one shipping options, talk to agencies",
"Not enough privileges to edit a client": "Not enough privileges to edit a client",
"Claim pickup order sent": "Claim pickup order sent [{{claimId}}]({{{claimUrl}}}) to client *{{clientName}}*",
"Claim pickup order sent": "Claim pickup order sent [{{claimId}}]({{{claimUrl}}}) to client *{{clientName}}*",
"You don't have grant privilege": "You don't have grant privilege",
"You don't own the role and you can't assign it to another user": "You don't own the role and you can't assign it to another user",
"Email verify": "Email verify",
"Email verify": "Email verify",
"Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) merged with [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})",
"Sale(s) blocked, please contact production": "Sale(s) blocked, please contact production",
"App locked": "App locked by user {{userId}}",
"The sales of the receiver ticket can't be modified": "The sales of the receiver ticket can't be modified",
"Receipt's bank was not found": "Receipt's bank was not found",
"This receipt was not compensated": "This receipt was not compensated",
"Client's email was not found": "Client's email was not found"
"The sales of the receiver ticket can't be modified": "The sales of the receiver ticket can't be modified",
"Receipt's bank was not found": "Receipt's bank was not found",
"This receipt was not compensated": "This receipt was not compensated",
"Client's email was not found": "Client's email was not found",
"It is not possible to modify tracked sales": "It is not possible to modify tracked sales",
"It is not possible to modify sales that their articles are from Floramondo": "It is not possible to modify sales that their articles are from Floramondo",
"It is not possible to modify cloned sales": "It is not possible to modify cloned sales",
"Valid priorities: 1,2,3": "Valid priorities: 1,2,3"
}

View File

@ -84,7 +84,6 @@
"The current ticket can't be modified": "El ticket actual no puede ser modificado",
"The current claim can't be modified": "La reclamación actual no puede ser modificada",
"The sales of this ticket can't be modified": "Las lineas de este ticket no pueden ser modificadas",
"Sale(s) blocked, contact production": "Linea(s) bloqueada(s), contacte con produccion",
"Please select at least one sale": "Por favor selecciona al menos una linea",
"All sales must belong to the same ticket": "Todas las lineas deben pertenecer al mismo ticket",
"NO_ZONE_FOR_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada",
@ -259,5 +258,9 @@
"Try again": "Vuelve a intentarlo",
"Aplicación bloqueada por el usuario 9": "Aplicación bloqueada por el usuario 9",
"Failed to upload file": "Error al subir archivo",
"The DOCUWARE PDF document does not exists": "The DOCUWARE PDF document does not exists"
"The DOCUWARE PDF document does not exists": "El documento PDF Docuware no existe",
"It is not possible to modify tracked sales": "No es posible modificar líneas de pedido que se hayan empezado a preparar",
"It is not possible to modify sales that their articles are from Floramondo": "No es posible modificar líneas de pedido cuyos artículos sean de Floramondo",
"It is not possible to modify cloned sales": "No es posible modificar líneas de pedido clonadas",
"There is no assigned email for this client": "No hay correo asignado para este cliente"
}

View File

@ -141,6 +141,16 @@ module.exports = Self => {
done();
}
Self.validateAsync('isToBeMailed', isToBeMailed, {
message: 'There is no assigned email for this client'
});
function isToBeMailed(err, done) {
if (this.isToBeMailed == true && !this.email)
err();
done();
}
Self.validateAsync('defaultAddressFk', isActive,
{message: 'Unable to default a disabled consignee'}
);

View File

@ -59,13 +59,11 @@ class Controller extends Dialog {
if (value) {
const accountingType = value.accountingType;
if (this.originalDescription) {
this.receipt.description =
`${accountingType && accountingType.receiptDescription}, ${this.originalDescription}`;
} else {
this.receipt.description =
`${accountingType && accountingType.receiptDescription}`;
}
if (accountingType.receiptDescription != null) {
this.receipt.description = accountingType.receiptDescription;
if (this.originalDescription) this.receipt.description += `, ${this.originalDescription}`;
} else if (this.originalDescription)
this.receipt.description = this.originalDescription;
this.maxAmount = accountingType && accountingType.maxAmount;
this.receipt.payed = new Date();

View File

@ -1,5 +1,5 @@
Edit buy(s): Editar compra(s)
Buying value: Precio
Buying value: Coste
Freight value: Porte
Commission value: Comisión
Package value: Embalaje
@ -16,4 +16,4 @@ Field to edit: Campo a editar
PackageName: Cubo
Edit: Editar
buy(s): compra(s)
Package out: Embalaje envíos
Package out: Embalaje envíos

View File

@ -38,7 +38,7 @@
</vn-one>
<vn-one>
<vn-label-value label="Reference">
<span
<span
ng-click="travelDescriptor.show($event, $ctrl.entryData.travel.id)"
class="link">
{{$ctrl.entryData.travel.ref}}
@ -114,8 +114,7 @@
<th translate center field="grouping">Grouping</th>
<th translate center field="buyingValue">Buying value</th>
<th translate center field="price3">Import</th>
<th translate center expand field="price2">Grouping price</th>
<th translate center expand field="price3">Packing price</th>
<th translate center expand field="price">PVP</th>
</tr>
</thead>
<tbody ng-repeat="line in buys">
@ -125,19 +124,18 @@
<td center title="{{::line.packageFk | dashIfEmpty}}">{{::line.packageFk | dashIfEmpty}}</td>
<td center title="{{::line.weight}}">{{::line.weight}}</td>
<td center>
<vn-chip class="transparent" translate-attr="line.groupingMode == 2 ? {title: 'Minimun amount'} : {title: 'Packing'}" ng-class="{'message': line.groupingMode == 2}">
<vn-chip class="transparent" translate-attr="line.groupingMode == 2 ? {title: 'Minimun amount'} : {title: 'Packing'}" ng-class="{'message': line.groupingMode == 2}">
<span>{{::line.packing | dashIfEmpty}}</span>
</vn-chip>
</td>
<td center>
<vn-chip class="transparent" translate-attr="line.groupingMode == 1 ? {title: 'Minimun amount'} : {title: 'Grouping'}" ng-class="{'message': line.groupingMode == 1}">
<vn-chip class="transparent" translate-attr="line.groupingMode == 1 ? {title: 'Minimun amount'} : {title: 'Grouping'}" ng-class="{'message': line.groupingMode == 1}">
<span>{{::line.grouping | dashIfEmpty}}</span>
</vn-chip>
</vn-td>
<td center title="{{::line.buyingValue | currency: 'EUR':2}}">{{::line.buyingValue | currency: 'EUR':2}}</td>
<td center title="{{::line.quantity * line.buyingValue | currency: 'EUR':2}}">{{::line.quantity * line.buyingValue | currency: 'EUR':2}}</td>
<td center title="{{::line.price2 | currency: 'EUR':2}}">{{::line.price2 | currency: 'EUR':2}}</td>
<td center title="{{::line.price3 | currency: 'EUR':2}}">{{::line.price3 | currency: 'EUR':2}}</td>
<td center title="Grouping / Packing">{{::line.price2 | currency: 'EUR':2 | dashIfEmpty}} / {{::line.price3 | currency: 'EUR':2 | dashIfEmpty}}</td>
</tr>
<tr class="dark-row">
<td shrink>
@ -195,7 +193,7 @@
vn-id="item-descriptor"
warehouse-fk="$ctrl.vnConfig.warehouseFk">
</vn-item-descriptor-popover>
<vn-travel-descriptor-popover
<vn-travel-descriptor-popover
vn-id="travelDescriptor">
</vn-travel-descriptor-popover>

View File

@ -47,44 +47,32 @@ module.exports = function(Self) {
}
try {
const promises = [];
if (args.deletes) {
for (const itemTagId of args.deletes) {
const itemTagDeleted = models.ItemTag.destroyById(itemTagId, myOptions);
promises.push(itemTagDeleted);
}
for (const itemTagId of args.deletes)
await models.ItemTag.destroyById(itemTagId, myOptions);
}
if (args.updates) {
for (const row of args.updates) {
if (row.data.priority) {
const itemTag = await models.ItemTag.findById(row.where.id, null, myOptions);
const itemTagUpdatedPriority = itemTag.updateAttributes({
await itemTag.updateAttributes({
priority: row.data.priority + args.maxPriority
}, myOptions);
promises.push(itemTagUpdatedPriority);
}
}
for (const row of args.updates) {
const itemTag = await models.ItemTag.findById(row.where.id, null, myOptions);
const itemTagUpdated = itemTag.updateAttributes(row.data, myOptions);
promises.push(itemTagUpdated);
await itemTag.updateAttributes(row.data, myOptions);
}
}
if (args.creates) {
for (const itemTag of args.creates) {
const newItemTag = models.ItemTag.create(itemTag, myOptions);
promises.push(newItemTag);
}
for (const itemTag of args.creates)
await models.ItemTag.create(itemTag, myOptions);
}
const resolvedPromises = await Promise.all(promises);
if (tx) await tx.commit();
return resolvedPromises;
} catch (e) {
if (tx) await tx.rollback();
throw e;

View File

@ -12,9 +12,8 @@ describe('tag onSubmit()', () => {
deletes: deletes
}
};
const result = await models.Tag.onSubmit(ctx, options);
await models.Tag.onSubmit(ctx, options);
expect(result.length).toEqual(1);
await tx.rollback();
} catch (e) {
await tx.rollback();
@ -33,9 +32,8 @@ describe('tag onSubmit()', () => {
updates: updates
}
};
const result = await models.Tag.onSubmit(ctx, options);
await models.Tag.onSubmit(ctx, options);
expect(result.length).toEqual(1);
await tx.rollback();
} catch (e) {
await tx.rollback();
@ -62,9 +60,8 @@ describe('tag onSubmit()', () => {
creates: creates
}
};
const result = await models.Tag.onSubmit(ctx, options);
await models.Tag.onSubmit(ctx, options);
expect(result.length).toEqual(1);
await tx.rollback();
} catch (e) {
await tx.rollback();
@ -88,9 +85,8 @@ describe('tag onSubmit()', () => {
}
};
const result = await models.Tag.onSubmit(ctx, options);
await models.Tag.onSubmit(ctx, options);
expect(result.length).toEqual(4);
await tx.rollback();
} catch (e) {
await tx.rollback();

View File

@ -9,15 +9,15 @@
</vn-crud-model>
<vn-card class="vn-w-md vn-pa-md">
<vn-horizontal>
<vn-horizontal>
<vn-date-picker class="vn-pa-xs"
vn-one
label="Since"
vn-one
label="Since"
ng-model="$ctrl.dateFrom">
</vn-date-picker>
<vn-date-picker class="vn-pa-xs"
vn-one
label="To"
vn-one
label="To"
ng-model="$ctrl.dateTo">
</vn-date-picker>
</vn-horizontal>
@ -35,8 +35,7 @@
<vn-th field="warehouseFk">Warehouse</vn-th>
<vn-th field="landed">Landed</vn-th>
<vn-th number>Entry</vn-th>
<vn-th number vn-tooltip="Price Per Unit">P.P.U</vn-th>
<vn-th number vn-tooltip="Price Per Package">P.P.P</vn-th>
<vn-th vn-tooltip="Grouping / Packing">PVP</vn-th>
<vn-th number class="expendable">Label</vn-th>
<vn-th number>Packing</vn-th>
<vn-th number>Grouping</vn-th>
@ -51,7 +50,7 @@
<vn-tbody>
<vn-tr ng-repeat="entry in entries">
<vn-td center>
<vn-check
<vn-check
ng-model="entry.isIgnored"
disabled="true">
</vn-check>
@ -65,30 +64,31 @@
{{::entry.entryFk | dashIfEmpty}}
</span>
</vn-td>
<vn-td number>{{::entry.price2 | dashIfEmpty}}</vn-td>
<vn-td number>{{::entry.price3 | dashIfEmpty}}</vn-td>
<vn-td title="{{::entry.price2 | currency: 'EUR':2 | dashIfEmpty}} / {{::entry.price3 | currency: 'EUR':2 | dashIfEmpty}}">
{{::entry.price2 | currency: 'EUR':2 | dashIfEmpty}} / {{::entry.price3 | currency: 'EUR':2 | dashIfEmpty}}
</vn-td>
<vn-td number class="expendable">{{entry.stickers | dashIfEmpty}}</vn-td>
<vn-td number>
<vn-chip translate-attr="{title: 'Packing'}" ng-class="{'message': entry.groupingMode == 2}">
<vn-chip translate-attr="{title: 'Packing'}" ng-class="{'message': entry.groupingMode == 2}">
<span>{{::entry.packing | dashIfEmpty}}</span>
</vn-chip>
</vn-td>
<vn-td number>
<vn-chip translate-attr="{title: 'Grouping'}" ng-class="{'message': entry.groupingMode == 1}">
<vn-chip translate-attr="{title: 'Grouping'}" ng-class="{'message': entry.groupingMode == 1}">
<span>{{::entry.grouping | dashIfEmpty}}</span>
</vn-chip>
</vn-td>
<vn-td number class="expendable">{{::entry.stems | dashIfEmpty}}</vn-td>
<vn-td number>{{::entry.quantity}}</vn-td>
<vn-td number
<vn-td number
class="expendable">
<span
vn-tooltip="
{{::$ctrl.$t('Cost')}}: {{::entry.buyingValue| dashIfEmpty}}<br>
{{::$ctrl.$t('Package')}}: {{::entry.packageValue| dashIfEmpty}}<br>
{{::$ctrl.$t('Freight')}}: {{::entry.freightValue| dashIfEmpty}}<br>
{{::$ctrl.$t('Comission')}}: {{::entry.comissionValue| dashIfEmpty}}">
{{::entry.cost | dashIfEmpty}}
{{::$ctrl.$t('Cost')}}: {{::entry.buyingValue | currency: 'EUR':2 | dashIfEmpty}}<br>
{{::$ctrl.$t('Package')}}: {{::entry.packageValue | currency: 'EUR':2 | dashIfEmpty}}<br>
{{::$ctrl.$t('Freight')}}: {{::entry.freightValue | currency: 'EUR':2 | dashIfEmpty}}<br>
{{::$ctrl.$t('Comission')}}: {{::entry.comissionValue | currency: 'EUR':2 | dashIfEmpty}}">
{{::entry.cost | currency: 'EUR':2 | dashIfEmpty}}
</span>
</vn-td>
<vn-td number>{{::entry.weight | dashIfEmpty}}</vn-td>
@ -113,24 +113,24 @@
ng-click="contextmenu.filterBySelection()">
Filter by selection
</vn-item>
<vn-item translate
ng-if="contextmenu.isFilterAllowed()"
<vn-item translate
ng-if="contextmenu.isFilterAllowed()"
ng-click="contextmenu.excludeSelection()">
Exclude selection
</vn-item>
<vn-item translate
ng-if="contextmenu.isFilterAllowed()"
<vn-item translate
ng-if="contextmenu.isFilterAllowed()"
ng-click="contextmenu.removeFilter()">
Remove filter
</vn-item>
<vn-item translate
<vn-item translate
ng-click="contextmenu.removeAllFilters()">
Remove all filters
</vn-item>
<vn-item translate
ng-if="contextmenu.isActionAllowed()"
<vn-item translate
ng-if="contextmenu.isActionAllowed()"
ng-click="contextmenu.copyValue()">
Copy value
</vn-item>
</slot-menu>
</vn-contextmenu>
</vn-contextmenu>

View File

@ -50,14 +50,17 @@ module.exports = Self => {
am.name AS agencyModeName,
u.nickname AS userNickname,
vn.ticketTotalVolume(t.id) AS volume,
tob.description
tob.description,
GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt
FROM vn.route r
JOIN ticket t ON t.routeFk = r.id
JOIN vn.sale s ON s.ticketFk = t.id
JOIN vn.item i ON i.id = s.itemFk
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
LEFT JOIN state st ON st.id = ts.stateFk
LEFT JOIN warehouse wh ON wh.id = t.warehouseFk
LEFT JOIN observationType ot ON ot.code = 'delivery'
LEFT JOIN ticketObservation tob ON tob.ticketFk = t.id
LEFT JOIN ticketObservation tob ON tob.ticketFk = t.id
AND tob.observationTypeFk = ot.id
LEFT JOIN address a ON a.id = t.addressFk
LEFT JOIN agencyMode am ON am.id = t.agencyModeFk
@ -70,7 +73,9 @@ module.exports = Self => {
const where = filter.where;
where['r.id'] = filter.id;
stmt.merge(conn.makeSuffix(filter));
stmt.merge(conn.makeWhere(filter.where));
stmt.merge(conn.makeGroupBy('t.id'));
stmt.merge(conn.makeOrderBy(filter.order));
const tickets = await conn.executeStmt(stmt, myOptions);

View File

@ -10,26 +10,26 @@
</h5>
<vn-horizontal>
<vn-one>
<vn-label-value label="Id"
<vn-label-value label="Id"
value="{{$ctrl.summary.route.id}}">
</vn-label-value>
<vn-label-value label="Date"
<vn-label-value label="Date"
value="{{$ctrl.summary.route.created | date: 'dd/MM/yyyy'}}">
</vn-label-value>
<vn-label-value label="Agency"
<vn-label-value label="Agency"
value="{{$ctrl.summary.route.agencyMode.name}}">
</vn-label-value>
<vn-label-value label="Vehicle"
<vn-label-value label="Vehicle"
value="{{$ctrl.summary.route.vehicle.numberPlate}}">
</vn-label-value>
<vn-label-value label="Driver">
<span
<span
ng-click="workerDescriptor.show($event, $ctrl.summary.route.workerFk)"
class="link">
{{$ctrl.summary.route.worker.user.name}}
</span>
</vn-label-value>
<vn-label-value label="Cost"
<vn-label-value label="Cost"
value="{{$ctrl.summary.route.cost | currency: 'EUR':2}}">
</vn-label-value>
</vn-one>
@ -40,35 +40,35 @@
<vn-label-value label="Finishing time"
value="{{$ctrl.summary.route.finished | date: 'HH:MM'}}">
</vn-label-value>
<vn-label-value label="Km Start"
<vn-label-value label="Km Start"
value="{{$ctrl.summary.route.kmStart}}">
</vn-label-value>
<vn-label-value label="Km End"
<vn-label-value label="Km End"
value="{{$ctrl.summary.route.kmEnd}}">
</vn-label-value>
<vn-label-value label="Volume"
<vn-label-value label="Volume"
value="{{$ctrl.summary.route.m3 | dashIfEmpty}} / {{$ctrl.summary.route.vehicle.m3 | dashIfEmpty}} m³">
</vn-label-value>
<vn-label-value label="Packages"
<vn-label-value label="Packages"
value="{{$ctrl.packagesTotal}}">
</vn-label-value>
</vn-one>
<vn-one>
<vn-textarea
disabled="true"
label="Description"
label="Description"
ng-model="$ctrl.summary.route.description">
</vn-textarea>
</vn-one>
<vn-auto>
<h4 ng-show="$ctrl.isDelivery">
<a
<a
ui-sref="route.card.tickets({id:$ctrl.route.id})"
target="_self">
<span translate vn-tooltip="Go to">Ticket</span>
</a>
</h4>
<h4
<h4
translate
ng-show="!$ctrl.isDelivery">
Ticket
@ -77,45 +77,49 @@
<vn-thead>
<vn-tr>
<vn-th shrink>Order</vn-th>
<vn-th number>Ticket id</vn-th>
<vn-th>Alias</vn-th>
<vn-th>Street</vn-th>
<vn-th>City</vn-th>
<vn-th shrink>PC</vn-th>
<vn-th>Client</vn-th>
<vn-th>Warehouse</vn-th>
<vn-th number shrink>Packages</vn-th>
<vn-th shrink></vn-th>
<vn-th>Warehouse</vn-th>
<vn-th shrink>PC</vn-th>
<vn-th>Street</vn-th>
<vn-th shrink>Packaging</vn-th>
<vn-th number>Ticket</vn-th>
<vn-th shrink></vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="ticket in $ctrl.summary.tickets">
<vn-td shrink>{{ticket.priority | dashIfEmpty}}</vn-td>
<vn-td expand title="{{ticket.address.street}}">{{ticket.street}}</vn-td>
<vn-td expand>{{ticket.city}}</vn-td>
<vn-td shrink>{{ticket.postalCode}}</vn-td>
<vn-td>
<span
ng-click="clientDescriptor.show($event, ticket.clientFk)"
class="link">
{{ticket.nickname}}
</span>
</vn-td>
<vn-td>{{ticket.warehouseName}}</vn-td>
<vn-td number shrink>{{ticket.packages}}</vn-td>
<vn-td shrink>{{ticket.volume}}</vn-td>
<vn-td shrink>{{ticket.ipt}}</vn-td>
<vn-td number>
<span
<span
ng-click="ticketDescriptor.show($event, ticket.id)"
class="link">
{{ticket.id}}
</span>
</vn-td>
<vn-td>
<span
ng-click="clientDescriptor.show($event, ticket.clientFk)"
class="link">
{{ticket.nickname}}
</span>
</vn-td>
<vn-td number shrink>{{ticket.packages}}</vn-td>
<vn-td shrink>{{ticket.volume}}</vn-td>
<vn-td>{{ticket.warehouseName}}</vn-td>
<vn-td shrink>{{ticket.postalCode}}</vn-td>
<vn-td expand title="{{ticket.address.street}}">{{ticket.street}}</vn-td>
<vn-td shrink>
<vn-icon
ng-if="ticket.notes.length"
vn-tooltip="{{ticket.notes[0].description}}"
icon="insert_drive_file"
class="bright">
</vn-icon>
<vn-icon-button
ng-if="::ticket.description"
vn-tooltip="{{::ticket.description}}"
icon="icon-notes"
tabindex="-1">
</vn-icon-button>
</vn-td>
</vn-tr>
</vn-tbody>
@ -123,12 +127,12 @@
</vn-auto>
</vn-horizontal>
</vn-card>
<vn-ticket-descriptor-popover
<vn-ticket-descriptor-popover
vn-id="ticketDescriptor">
</vn-ticket-descriptor-popover>
<vn-client-descriptor-popover
vn-id="clientDescriptor">
</vn-client-descriptor-popover>
<vn-worker-descriptor-popover
<vn-worker-descriptor-popover
vn-id="workerDescriptor">
</vn-worker-descriptor-popover>

View File

@ -6,9 +6,9 @@
data="$ctrl.tickets"
auto-load="true">
</vn-crud-model>
<vn-data-viewer
<vn-data-viewer
model="model">
<form
<form
class="vn-w-xl"
name="form">
<vn-card>
@ -25,18 +25,18 @@
vn-tooltip="Open buscaman"
icon="icon-buscaman">
</vn-button>
<vn-button
<vn-button
disabled="!$ctrl.isChecked"
ng-click="$ctrl.deletePriority()"
vn-tooltip="Delete priority"
icon="filter_alt">
</vn-button>
<vn-button
<vn-button
ng-click="$ctrl.setOrderedPriority($ctrl.tickets)"
vn-tooltip="Renumber all tickets in the order you see on the screen"
icon="format_list_numbered">
</vn-button>
<vn-button
<vn-button
vn-acl="deliveryBoss"
vn-acl-action="remove"
disabled="!$ctrl.isChecked"
@ -59,8 +59,10 @@
<vn-th field="city">City</vn-th>
<vn-th field="postalCode" translate-attr="{title: 'Postcode'}" shrink>PC</vn-th>
<vn-th field="clientFk" expand>Client</vn-th>
<vn-th field="warehouse" expand>Warehouse</vn-th>
<vn-th field="packages" shrink>Packages</vn-th>
<vn-th field="volume" shrink></vn-th>
<vn-th field="packaging" shrink>Packaging</vn-th>
<vn-th field="id" number>Ticket</vn-th>
<vn-th shrink></vn-th>
<vn-th shrink></vn-th>
@ -100,8 +102,10 @@
{{::ticket.nickname}}
</span>
</vn-td>
<vn-td>{{ticket.warehouseName}}</vn-td>
<vn-td shrink>{{::ticket.packages}}</vn-td>
<vn-td shrink>{{::ticket.volume | number:2}}</vn-td>
<vn-td shrink>{{::ticket.ipt}}</vn-td>
<vn-td number>
<span
ng-click="ticketDescriptor.show($event, ticket.id)"
@ -140,13 +144,13 @@
</vn-card>
</form>
</vn-data-viewer>
<vn-ticket-descriptor-popover
<vn-ticket-descriptor-popover
vn-id="ticketDescriptor">
</vn-ticket-descriptor-popover>
<vn-client-descriptor-popover
vn-id="clientDescriptor">
</vn-client-descriptor-popover>
<vn-confirm
<vn-confirm
vn-id="confirm"
question="Delete ticket from route?"
on-accept="$ctrl.removeTicketFromRoute($index)">
@ -160,7 +164,7 @@
<div fixed-bottom-right>
<vn-vertical style="align-items: center;">
<a vn-bind="+">
<vn-button
<vn-button
class="round md vn-mb-sm"
ng-click="$ctrl.$.ticketPopup.show()"
icon="add"
@ -172,14 +176,14 @@
</a>
</vn-vertical>
</div>
<vn-ticket-descriptor-popover
<vn-ticket-descriptor-popover
vn-id="ticket-descriptor">
</vn-ticket-descriptor-popover>
<vn-client-descriptor-popover
<vn-client-descriptor-popover
vn-id="client-descriptor">
</vn-client-descriptor-popover>
<!-- SMS Dialog -->
<vn-route-sms
vn-id="sms"
sms="$ctrl.newSMS">
</vn-route-sms>
</vn-route-sms>

View File

@ -24,36 +24,42 @@
</vn-textfield>
<vn-input-number
type="number"
step="0.01"
label="Minimum M3"
ng-model="supplierAgencyTerm.minimumM3"
rule>
</vn-input-number>
<vn-input-number
type="number"
step="0.01"
label="Package Price"
ng-model="supplierAgencyTerm.packagePrice"
rule>
</vn-input-number>
<vn-input-number
type="number"
step="0.01"
label="Km Price"
ng-model="supplierAgencyTerm.kmPrice"
rule>
</vn-input-number>
<vn-input-number
type="number"
step="0.01"
label="M3 Price"
ng-model="supplierAgencyTerm.m3Price"
rule>
</vn-input-number>
<vn-input-number
type="number"
step="0.01"
label="Route Price"
ng-model="supplierAgencyTerm.routePrice"
rule>
</vn-input-number>
<vn-input-number
type="number"
step="0.01"
label="Minimum Km"
ng-model="supplierAgencyTerm.minimumKm"
rule>

View File

@ -56,6 +56,13 @@ module.exports = Self => {
const shouldEditCloned = canEditCloned || !hasSaleCloned;
const shouldEditFloramondo = canEditFloramondo || !hasSaleFloramondo;
return shouldEditTracked && shouldEditCloned && shouldEditFloramondo;
if (!shouldEditTracked)
throw new UserError('It is not possible to modify tracked sales');
if (!shouldEditCloned)
throw new UserError('It is not possible to modify cloned sales');
if (!shouldEditFloramondo)
throw new UserError('It is not possible to modify sales that their articles are from Floramondo');
return true;
};
};

View File

@ -43,9 +43,7 @@ module.exports = Self => {
try {
const saleIds = sales.map(sale => sale.id);
const canEditSales = await models.Sale.canEdit(ctx, saleIds, myOptions);
if (!canEditSales)
throw new UserError(`Sale(s) blocked, please contact production`);
await models.Sale.canEdit(ctx, saleIds, myOptions);
const ticket = await models.Ticket.findById(ticketId, {
include: {

View File

@ -37,9 +37,7 @@ module.exports = Self => {
try {
const salesIds = sales.map(sale => sale.id);
const canEditSale = await models.Sale.canEdit(ctx, salesIds, myOptions);
if (!canEditSale)
throw new UserError(`Sale(s) blocked, please contact production`);
await models.Sale.canEdit(ctx, salesIds, myOptions);
const query = `
DROP TEMPORARY TABLE IF EXISTS tmp.recalculateSales;

View File

@ -51,9 +51,7 @@ module.exports = Self => {
try {
const salesIds = sales.map(sale => sale.id);
const canEditSale = await models.Sale.canEdit(ctx, salesIds, myOptions);
if (!canEditSale)
throw new UserError(`Sale(s) blocked, please contact production`);
await models.Sale.canEdit(ctx, salesIds, myOptions);
let changesMade = '';
const promises = [];

View File

@ -50,7 +50,7 @@ describe('sale canEdit()', () => {
it('should return false if any of the sales has a saleTracking record', async() => {
const tx = await models.Sale.beginTransaction({});
let error;
try {
const options = {transaction: tx};
@ -59,15 +59,15 @@ describe('sale canEdit()', () => {
const sales = [31];
const result = await models.Sale.canEdit(ctx, sales, options);
expect(result).toEqual(false);
await models.Sale.canEdit(ctx, sales, options);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
error = e;
}
expect(error).toEqual(
new Error('It is not possible to modify tracked sales'));
});
});
@ -75,22 +75,22 @@ describe('sale canEdit()', () => {
const saleCloned = [29];
it('should return false if any of the sales is cloned', async() => {
const tx = await models.Sale.beginTransaction({});
let error;
try {
const options = {transaction: tx};
const buyerId = 35;
const ctx = {req: {accessToken: {userId: buyerId}}};
const result = await models.Sale.canEdit(ctx, saleCloned, options);
expect(result).toEqual(false);
await models.Sale.canEdit(ctx, saleCloned, options);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
error = e;
}
expect(error).toEqual(
new Error('It is not possible to modify cloned sales'));
});
it('should return true if any of the sales is cloned and has the correct role', async() => {
@ -130,7 +130,7 @@ describe('sale canEdit()', () => {
it('should return false if any of the sales isFloramondo', async() => {
const tx = await models.Sale.beginTransaction({});
const sales = [26];
let error;
try {
const options = {transaction: tx};
@ -140,15 +140,15 @@ describe('sale canEdit()', () => {
const saleToEdit = await models.Sale.findById(sales[0], null, options);
await saleToEdit.updateAttribute('itemFk', 9, options);
const result = await models.Sale.canEdit(ctx, sales, options);
expect(result).toEqual(false);
await models.Sale.canEdit(ctx, sales, options);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
error = e;
}
expect(error).toEqual(
new Error('It is not possible to modify sales that their articles are from Floramondo'));
});
it('should return true if any of the sales is of isFloramondo and has the correct role', async() => {

View File

@ -40,10 +40,7 @@ module.exports = Self => {
try {
const currentLine = await models.Sale.findById(id, null, myOptions);
const canEditSale = await models.Sale.canEdit(ctx, [id], myOptions);
if (!canEditSale)
throw new UserError(`Sale(s) blocked, please contact production`);
await models.Sale.canEdit(ctx, [id], myOptions);
const line = await currentLine.updateAttributes({concept: newConcept}, myOptions);

View File

@ -66,9 +66,7 @@ module.exports = Self => {
const sale = await models.Sale.findById(id, filter, myOptions);
const canEditSale = await models.Sale.canEdit(ctx, [id], myOptions);
if (!canEditSale)
throw new UserError(`Sale(s) blocked, please contact production`);
await models.Sale.canEdit(ctx, [id], myOptions);
const oldPrice = sale.price;
const userId = ctx.req.accessToken.userId;

View File

@ -41,9 +41,7 @@ module.exports = Self => {
}
try {
const canEditSale = await models.Sale.canEdit(ctx, [id], myOptions);
if (!canEditSale)
throw new UserError(`Sale(s) blocked, please contact production`);
await models.Sale.canEdit(ctx, [id], myOptions);
const filter = {
include: {

View File

@ -24,7 +24,7 @@ module.exports = Self => {
if (typeof options == 'object')
Object.assign(myOptions, options);
let statesList = await models.State.find({where: filter.where}, myOptions);
let statesList = await models.State.find(filter, myOptions);
const isProduction = await models.VnUser.hasRole(userId, 'production', myOptions);
const isSalesPerson = await models.VnUser.hasRole(userId, 'salesPerson', myOptions);
const isAdministrative = await models.VnUser.hasRole(userId, 'administrative', myOptions);

View File

@ -22,6 +22,7 @@
disabled="!$ctrl.isEditable"
label="State"
value-field="code"
fields="['id', 'name', 'alertLevel', 'code']"
url="States/editableStates"
on-change="$ctrl.changeState(value)">
</vn-button-menu>

View File

@ -1,6 +1,6 @@
<vn-card class="summary">
<h5>
<a
<a
ng-if="::$ctrl.summary.id"
vn-tooltip="Go to the ticket"
ui-sref="ticket.card.summary({id: {{::$ctrl.summary.id}}})"
@ -8,36 +8,37 @@
<vn-icon-button icon="launch"></vn-icon-button>
</a>
<span>
Ticket #{{$ctrl.summary.id}} - {{$ctrl.summary.client.name}}
Ticket #{{$ctrl.summary.id}} - {{$ctrl.summary.client.name}}
({{$ctrl.summary.client.id}}) - {{$ctrl.summary.nickname}}
</span>
<vn-button-menu
<vn-button-menu
disabled="!$ctrl.isEditable"
class="message"
label="Change state"
value-field="code"
fields="['id', 'name', 'alertLevel', 'code']"
url="States/editableStates"
on-change="$ctrl.changeState(value)">
</vn-button-menu>
<vn-ticket-descriptor-menu
<vn-ticket-descriptor-menu
ng-if="!$ctrl.isOnTicketCard"
ticket-id="$ctrl.summary.id"
ticket-id="$ctrl.summary.id"
parent-reload="$ctrl.reload()"
/>
</h5>
<vn-horizontal>
<vn-one>
<vn-label-value label="State"
<vn-label-value label="State"
value="{{$ctrl.summary.ticketState.state.name}}">
</vn-label-value>
<vn-label-value label="Salesperson">
<span
<span
ng-click="workerDescriptor.show($event, $ctrl.summary.client.salesPersonFk)"
class="link">
{{$ctrl.summary.client.salesPersonUser.name}}
</span>
</vn-label-value>
<vn-label-value label="Agency"
<vn-label-value label="Agency"
value="{{$ctrl.summary.agencyMode.name}}">
</vn-label-value>
<vn-label-value label="Zone">
@ -47,11 +48,11 @@
{{$ctrl.summary.zone.name}}
</span>
</vn-label-value>
<vn-label-value label="Warehouse"
<vn-label-value label="Warehouse"
value="{{$ctrl.summary.warehouse.name}}">
</vn-label-value>
<vn-label-value label="Route">
<span
<span
ng-click="routeDescriptor.show($event, $ctrl.summary.routeFk)"
class="link">
{{$ctrl.summary.routeFk}}
@ -66,17 +67,17 @@
</vn-label-value>
</vn-one>
<vn-two>
<vn-label-value label="Shipped"
<vn-label-value label="Shipped"
value="{{$ctrl.summary.shipped | date: 'dd/MM/yyyy HH:mm'}}">
</vn-label-value>
<vn-label-value label="Landed"
<vn-label-value label="Landed"
value="{{$ctrl.summary.landed | date: 'dd/MM/yyyy'}}">
</vn-label-value>
<vn-label-value label="Package size"
<vn-label-value label="Package size"
value="{{$ctrl.summary.packages}}">
</vn-label-value>
<vn-label-value label="Address phone"
ng-if="$ctrl.summary.address.phone != null"
ng-if="$ctrl.summary.address.phone != null"
value="{{$ctrl.summary.address.phone}}">
</vn-label-value>
<vn-label-value label="Address mobile"
@ -109,7 +110,7 @@
</vn-one>
<vn-auto name="sales">
<h4>
<a
<a
ui-sref="ticket.card.sale({id:$ctrl.ticket.id})"
target="_self">
<span translate vn-tooltip="Go to">Sale</span>
@ -146,13 +147,13 @@
vn-tooltip="{{::$ctrl.$t('Claim')}}: {{::sale.claimBeginning.claimFk}}">
</vn-icon>
</a>
<vn-icon
ng-show="::(sale.visible < 0)"
<vn-icon
ng-show="::(sale.visible < 0)"
color-main
icon="warning"
vn-tooltip="Visible: {{::sale.visible || 0}}">
</vn-icon>
<vn-icon ng-show="sale.reserved"
<vn-icon ng-show="sale.reserved"
icon="icon-reserve"
translate-attr="{title: 'Reserved'}">
</vn-icon>
@ -170,22 +171,22 @@
</vn-icon>
</vn-td>
<vn-td number shrink>
<span
<span
ng-click="itemDescriptor.show($event, sale.itemFk, sale.id, $ctrl.ticket.shipped)"
class="link">
{{sale.itemFk | zeroFill:6}}
</span>
</vn-td>
<vn-td number shrink>
<vn-chip
class="transparent"
<vn-chip
class="transparent"
ng-class="{'alert': sale.visible < 0}">
{{::sale.visible}}
</vn-chip>
</vn-td>
<vn-td number shrink>
<vn-chip
class="transparent"
<vn-chip
class="transparent"
ng-class="{'alert': sale.available < 0}">
{{::sale.available}}
</vn-chip>
@ -216,7 +217,7 @@
</vn-auto>
<vn-one ng-if="$ctrl.summary.packagings.length != 0">
<h4>
<a
<a
ui-sref="ticket.card.package({id:$ctrl.ticket.id})"
target="_self">
<span translate vn-tooltip="Go to">Packages</span>
@ -241,7 +242,7 @@
</vn-one>
<vn-one class="services" ng-if="$ctrl.summary.services.length != 0">
<h4>
<a
<a
ui-sref="ticket.card.service({id:$ctrl.ticket.id})"
target="_self">
<span translate vn-tooltip="Go to">Service</span>
@ -276,7 +277,7 @@
<vn-horizontal>
<vn-auto ng-if="$ctrl.summary.requests.length != 0">
<h4>
<a
<a
ui-sref="ticket.card.request.index({id:$ctrl.ticket.id})"
target="_self">
<span translate vn-tooltip="Go to">Purchase request</span>
@ -304,7 +305,7 @@
<vn-td number>{{::request.quantity}}</vn-td>
<vn-td number>{{::request.price}}</vn-td>
<vn-td number>
<span
<span
ng-show="::request.saleFk"
ng-click="itemDescriptor.show($event, request.sale.itemFk, request.sale.id)"
class="link">
@ -336,9 +337,9 @@
<vn-invoice-out-descriptor-popover
vn-id="invoice-out-descriptor">
</vn-invoice-out-descriptor-popover>
<vn-worker-descriptor-popover
<vn-worker-descriptor-popover
vn-id="workerDescriptor">
</vn-worker-descriptor-popover>
<vn-zone-descriptor-popover
<vn-zone-descriptor-popover
vn-id="zoneDescriptor">
</vn-zone-descriptor-popover>
</vn-zone-descriptor-popover>

View File

@ -4,9 +4,9 @@
<div class="content">
<h1 class="title centered uppercase">{{$t('title')}}</h1>
<p class="centered">
Recibo de <strong class="uppercase">{{client.socialName}}</strong>, la cantidad de
<strong>{{receipt.amountPaid}} €</strong> en concepto de 'entrega a cuenta', quedando pendiente en
la cuenta del cliente un saldo de <strong>{{receipt.amountUnpaid}} €</strong>.
Recibo #{{receipt.id}} de <strong class="uppercase">{{client.socialName}}</strong>,
la cantidad de <strong>{{receipt.amountPaid}} €</strong>
en concepto de 'entrega a cuenta'.
</p>
<div class="signature">
<img v-bind:src="getReportSrc('signature.png')" />

View File

@ -1,11 +1,10 @@
SELECT
r.id,
r.amountPaid,
cr.amount AS amountUnpaid,
r.payed,
SELECT
r.id,
r.amountPaid,
r.payed,
r.companyFk
FROM receipt r
JOIN client c ON c.id = r.clientFk
JOIN vn.clientRisk cr ON cr.clientFk = c.id
AND cr.companyFk = r.companyFk
WHERE r.id = ?
WHERE r.id = ?