Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 5077-horaEnvio-ticketBasicData
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alexandre Riera 2023-01-31 11:43:26 +01:00
commit c121f184b6
12 changed files with 67 additions and 74 deletions

View File

@ -17,7 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- (Artículos -> Etiquetas) Permite intercambiar la relevancia entre dos etiquetas.
- (Tickets -> Datos básicos) Permite guardar la hora de envío
- (Tickets -> Añadir pago) Eliminado "null" en las referencias
## [2302.01] - 2023-01-26

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

@ -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

@ -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

@ -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

@ -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.Account.hasRole(userId, 'production', myOptions);
const isSalesPerson = await models.Account.hasRole(userId, 'salesPerson', myOptions);
const isAdministrative = await models.Account.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 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 = ?