3802-ticket_sale_mana #924
File diff suppressed because one or more lines are too long
|
@ -2480,9 +2480,11 @@ INSERT INTO `bs`.`defaulter` (`clientFk`, `amount`, `created`, `defaulterSinced`
|
|||
UPDATE `vn`.`agency`
|
||||
SET `supplierFk`=1
|
||||
WHERE `id`=1;
|
||||
|
||||
UPDATE `vn`.`agency`
|
||||
SET `supplierFk`=1
|
||||
WHERE `id`=2;
|
||||
|
||||
UPDATE `vn`.`agency`
|
||||
SET `supplierFk`=2
|
||||
WHERE `id`=3;
|
||||
|
@ -2490,6 +2492,7 @@ WHERE `id`=3;
|
|||
UPDATE `vn`.`route`
|
||||
SET `invoiceInFk`=1
|
||||
WHERE `id`=1;
|
||||
|
||||
UPDATE `vn`.`route`
|
||||
SET `invoiceInFk`=2
|
||||
WHERE `id`=2;
|
||||
|
@ -2505,6 +2508,7 @@ INSERT INTO `bs`.`sale` (`saleFk`, `amount`, `dated`, `typeFk`, `clientFk`)
|
|||
(3, 200.78, CURDATE(), 2, 1101),
|
||||
(4, 33.8, CURDATE(), 1, 1101),
|
||||
(30, 34.4, CURDATE(), 1, 1108);
|
||||
|
||||
INSERT INTO `vn`.`docuware` (`code`, `fileCabinetName`, `dialogName` , `find`)
|
||||
VALUES
|
||||
('deliveryClientTest', 'deliveryClientTest', 'findTest', 'word');
|
||||
|
@ -2513,6 +2517,18 @@ INSERT INTO `vn`.`docuwareConfig` (`url`)
|
|||
VALUES
|
||||
('https://verdnatura.docuware.cloud/docuware/platform');
|
||||
|
||||
INSERT INTO `vn`.`calendarHolidaysName` (`id`, `name`)
|
||||
VALUES
|
||||
(1, 'dayOfIT');
|
||||
|
||||
INSERT INTO `vn`.`calendarHolidaysType` (`id`, `name`, `hexColour`)
|
||||
VALUES
|
||||
(1, 'National', '#4169E1');
|
||||
|
||||
INSERT INTO `vn`.`calendarHolidays` (`id`, `calendarHolidaysTypeFk`, `dated`, `calendarHolidaysNameFk`, `workCenterFk`)
|
||||
VALUES
|
||||
(1, 1, CONCAT(YEAR(CURDATE()), '-12-09'), 1, 1);
|
||||
|
||||
INSERT INTO `vn`.`supplierAgencyTerm` (`agencyFk`, `supplierFk`, `minimumPackages`, `kmPrice`, `packagePrice`, `routePrice`, `minimumKm`, `minimumM3`, `m3Price`)
|
||||
VALUES
|
||||
(1, 1, 0, 0.00, 0.00, NULL, 0, 0.00, 23),
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -66,7 +66,7 @@ describe('Claim development', () => {
|
|||
.waitToGetProperty(selectors.claimDevelopment.firstClaimRedelivery, 'value');
|
||||
|
||||
expect(reason).toEqual('Calor');
|
||||
expect(result).toEqual('Cocido');
|
||||
expect(result).toEqual('Baboso/Cocido');
|
||||
expect(responsible).toEqual('Calidad general');
|
||||
expect(worker).toEqual('adminAssistantNick');
|
||||
expect(redelivery).toEqual('Cliente');
|
||||
|
|
|
@ -50,7 +50,7 @@ describe('InvoiceOut manual invoice path', () => {
|
|||
});
|
||||
|
||||
it('should create an invoice from a client', async() => {
|
||||
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceClient, 'Charles Xavier');
|
||||
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceClient, 'Max Eisenhardt');
|
||||
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceSerial, 'Global nacional');
|
||||
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTaxArea, 'national');
|
||||
await page.waitToClick(selectors.invoiceOutIndex.saveInvoice);
|
||||
|
|
|
@ -52,10 +52,12 @@ class Controller extends Section {
|
|||
}
|
||||
|
||||
scrollToLine(lineFk) {
|
||||
this.$.$applyAsync(() => {
|
||||
const hashFk = this.lineFk || lineFk;
|
||||
const hash = `vnItemDiary-${hashFk}`;
|
||||
this.$location.hash(hash);
|
||||
this.$anchorScroll();
|
||||
});
|
||||
}
|
||||
|
||||
showDescriptor(event, sale) {
|
||||
|
|
|
@ -47,6 +47,8 @@ describe('Item', () => {
|
|||
controller.lineFk = 1;
|
||||
controller.scrollToLine('invalidValue');
|
||||
|
||||
$scope.$apply();
|
||||
|
||||
expect(controller.$location.hash()).toEqual(`vnItemDiary-${1}`);
|
||||
expect(controller.$anchorScroll).toHaveBeenCalledWith();
|
||||
});
|
||||
|
@ -56,6 +58,8 @@ describe('Item', () => {
|
|||
controller.lineFk = undefined;
|
||||
controller.scrollToLine(1);
|
||||
|
||||
$scope.$apply();
|
||||
|
||||
expect(controller.$location.hash()).toEqual(`vnItemDiary-${1}`);
|
||||
expect(controller.$anchorScroll).toHaveBeenCalledWith();
|
||||
});
|
||||
|
|
|
@ -222,8 +222,8 @@ describe('SalesMonitor salesFilter()', () => {
|
|||
const firstTicket = result.shift();
|
||||
const secondTicket = result.shift();
|
||||
|
||||
expect(firstTicket.totalProblems).toEqual(3);
|
||||
expect(secondTicket.totalProblems).toEqual(2);
|
||||
expect(firstTicket.totalProblems).toEqual(1);
|
||||
expect(secondTicket.totalProblems).toEqual(1);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
|
|
|
@ -28,16 +28,6 @@ module.exports = Self => {
|
|||
type: 'date',
|
||||
description: 'The shipped from date filter'
|
||||
},
|
||||
{
|
||||
arg: 'shippedTo',
|
||||
type: 'date',
|
||||
description: 'The shipped to date filter'
|
||||
},
|
||||
{
|
||||
arg: 'landedFrom',
|
||||
type: 'date',
|
||||
description: 'The landed from date filter'
|
||||
},
|
||||
{
|
||||
arg: 'landedTo',
|
||||
type: 'date',
|
||||
|
@ -101,10 +91,6 @@ module.exports = Self => {
|
|||
return {'t.ref': {like: `%${value}%`}};
|
||||
case 'shippedFrom':
|
||||
return {'t.shipped': {gte: value}};
|
||||
case 'shippedTo':
|
||||
return {'t.shipped': {lte: value}};
|
||||
case 'landedFrom':
|
||||
return {'t.landed': {gte: value}};
|
||||
case 'landedTo':
|
||||
return {'t.landed': {lte: value}};
|
||||
case 'continent':
|
||||
|
@ -162,6 +148,7 @@ module.exports = Self => {
|
|||
|
||||
stmt.merge(conn.makeWhere(filter.where));
|
||||
stmt.merge(conn.makeGroupBy('t.id'));
|
||||
stmt.merge(conn.makeOrderBy(filter.order));
|
||||
stmt.merge(conn.makeLimit(filter));
|
||||
stmts.push(stmt);
|
||||
|
||||
|
|
|
@ -46,15 +46,64 @@ describe('Travel extraCommunityFilter()', () => {
|
|||
expect(result.length).toEqual(3);
|
||||
});
|
||||
|
||||
it('should return the routes matching "landed from" and "landed to"', async() => {
|
||||
const from = new Date();
|
||||
const to = new Date();
|
||||
from.setHours(0, 0, 0, 0);
|
||||
to.setHours(23, 59, 59, 999);
|
||||
to.setDate(to.getDate() + 14);
|
||||
it('should return the travel matching "warehouse in"', async() => {
|
||||
const ctx = {
|
||||
args: {
|
||||
landedFrom: from,
|
||||
warehouseInFk: 1
|
||||
}
|
||||
};
|
||||
|
||||
const result = await app.models.Travel.extraCommunityFilter(ctx, filter);
|
||||
|
||||
expect(result.length).toEqual(4);
|
||||
});
|
||||
|
||||
it('should return the travel matching "continent"', async() => {
|
||||
const ctx = {
|
||||
args: {
|
||||
continent: 'AM'
|
||||
}
|
||||
};
|
||||
|
||||
const result = await app.models.Travel.extraCommunityFilter(ctx, filter);
|
||||
|
||||
expect(result.length).toEqual(3);
|
||||
});
|
||||
|
||||
it('should return the travel matching "agencyFk"', async() => {
|
||||
const ctx = {
|
||||
args: {
|
||||
agencyFk: 1
|
||||
}
|
||||
};
|
||||
|
||||
const result = await app.models.Travel.extraCommunityFilter(ctx, filter);
|
||||
|
||||
expect(result.length).toEqual(8);
|
||||
});
|
||||
|
||||
it('should return the travel matching "cargoSupplierFk"', async() => {
|
||||
const ctx = {
|
||||
args: {
|
||||
cargoSupplierFk: 1
|
||||
}
|
||||
};
|
||||
|
||||
const result = await app.models.Travel.extraCommunityFilter(ctx, filter);
|
||||
|
||||
expect(result.length).toEqual(4);
|
||||
});
|
||||
|
||||
it('should return the routes matching "shipped from" and "landed to"', async() => {
|
||||
const from = new Date();
|
||||
from.setDate(from.getDate() - 2);
|
||||
from.setHours(0, 0, 0, 0);
|
||||
const to = new Date();
|
||||
to.setHours(23, 59, 59, 999);
|
||||
to.setDate(to.getDate() + 7);
|
||||
const ctx = {
|
||||
args: {
|
||||
shippedFrom: from,
|
||||
landedTo: to
|
||||
}
|
||||
};
|
||||
|
|
|
@ -47,17 +47,6 @@
|
|||
ng-model="$ctrl.landedTo">
|
||||
</vn-date-picker>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-date-picker
|
||||
vn-one
|
||||
label="Shipped to"
|
||||
ng-model="$ctrl.shippedTo">
|
||||
</vn-date-picker>
|
||||
<vn-date-picker
|
||||
vn-one
|
||||
label="Landed from"
|
||||
ng-model="$ctrl.landedFrom">
|
||||
</vn-date-picker>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete vn-one
|
||||
|
|
|
@ -14,31 +14,6 @@ class Controller extends SearchPanel {
|
|||
|
||||
set shippedFrom(value) {
|
||||
this.filter.shippedFrom = value;
|
||||
|
||||
if (!this.filter.landedFrom)
|
||||
this.filter.landedFrom = value;
|
||||
}
|
||||
|
||||
get shippedTo() {
|
||||
return this.filter.shippedTo;
|
||||
}
|
||||
|
||||
set shippedTo(value) {
|
||||
this.filter.shippedTo = value;
|
||||
|
||||
if (!this.filter.landedTo)
|
||||
this.filter.landedTo = value;
|
||||
}
|
||||
|
||||
get landedFrom() {
|
||||
return this.filter.landedFrom;
|
||||
}
|
||||
|
||||
set landedFrom(value) {
|
||||
this.filter.landedFrom = value;
|
||||
|
||||
if (!this.filter.shippedFrom)
|
||||
this.filter.shippedFrom = value;
|
||||
}
|
||||
|
||||
get landedTo() {
|
||||
|
@ -47,9 +22,6 @@ class Controller extends SearchPanel {
|
|||
|
||||
set landedTo(value) {
|
||||
this.filter.landedTo = value;
|
||||
|
||||
if (!this.filter.shippedTo)
|
||||
this.filter.shippedTo = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
vn-id="model"
|
||||
url="Travels/extraCommunityFilter"
|
||||
data="travels"
|
||||
order="landed ASC, shipped ASC, travelFk, loadPriority, agencyModeFk, evaNotes"
|
||||
order="shipped ASC, landed ASC, travelFk, loadPriority, agencyModeFk, evaNotes"
|
||||
limit="20"
|
||||
auto-load="true">
|
||||
</vn-crud-model>
|
||||
|
|
|
@ -17,16 +17,18 @@ class Controller extends Section {
|
|||
this.draggableElement = 'a[draggable]';
|
||||
this.droppableElement = 'vn-tbody[vn-droppable]';
|
||||
|
||||
const scopeDays = 14;
|
||||
const landedFrom = new Date();
|
||||
landedFrom.setHours(0, 0, 0, 0);
|
||||
const twoDays = 2;
|
||||
const shippedFrom = new Date();
|
||||
shippedFrom.setDate(shippedFrom.getDate() - twoDays);
|
||||
shippedFrom.setHours(0, 0, 0, 0);
|
||||
|
||||
const sevenDays = 7;
|
||||
const landedTo = new Date();
|
||||
landedTo.setDate(landedTo.getDate() + scopeDays);
|
||||
landedTo.setDate(landedTo.getDate() + sevenDays);
|
||||
landedTo.setHours(23, 59, 59, 59);
|
||||
|
||||
this.defaultFilter = {
|
||||
landedFrom: landedFrom,
|
||||
shippedFrom: shippedFrom,
|
||||
landedTo: landedTo,
|
||||
continent: 'AM'
|
||||
};
|
||||
|
@ -34,10 +36,12 @@ class Controller extends Section {
|
|||
|
||||
get hasDateRange() {
|
||||
const userParams = this.$.model.userParams;
|
||||
const hasLanded = userParams.landedFrom || userParams.landedTo;
|
||||
const hasShipped = userParams.shippedFrom || userParams.shippedTo;
|
||||
const hasLanded = userParams.landedTo;
|
||||
const hasShipped = userParams.shippedFrom;
|
||||
const hasContinent = userParams.continent;
|
||||
const hasWarehouseOut = userParams.warehouseOutFk;
|
||||
|
||||
return hasLanded || hasShipped;
|
||||
return hasLanded || hasShipped || hasContinent || hasWarehouseOut;
|
||||
}
|
||||
|
||||
findDraggable($event) {
|
||||
|
|
|
@ -9,8 +9,8 @@ vn-travel-extra-community {
|
|||
padding-bottom: 7px;
|
||||
padding-bottom: 4px;
|
||||
font-weight: lighter;
|
||||
background-color: #fde6ca;
|
||||
color: $color-font-light;
|
||||
background-color: $color-bg;
|
||||
color: white;
|
||||
border-bottom: 1px solid #f7931e;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
|
|
|
@ -34,6 +34,9 @@
|
|||
},
|
||||
"notificationEmail": {
|
||||
"type": "string"
|
||||
},
|
||||
"hasToMistake": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -198,7 +198,7 @@ class Controller extends Section {
|
|||
const event = this.events[stamp];
|
||||
const calendar = $event.target.closest('vn-calendar').$ctrl;
|
||||
|
||||
if (event) {
|
||||
if (event && event.absenceId) {
|
||||
if (event.type == this.absenceType.code)
|
||||
this.delete(calendar, day, event);
|
||||
else
|
||||
|
@ -230,6 +230,7 @@ class Controller extends Section {
|
|||
.then(calendar.repaint())
|
||||
.then(() => this.getContractHolidays())
|
||||
.then(() => this.getYearHolidays())
|
||||
.then(() => this.repaint())
|
||||
);
|
||||
});
|
||||
}
|
||||
|
@ -266,6 +267,7 @@ class Controller extends Section {
|
|||
.then(calendar.repaint())
|
||||
.then(() => this.getContractHolidays())
|
||||
.then(() => this.getYearHolidays())
|
||||
.then(() => this.repaint())
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -191,7 +191,8 @@ describe('Worker', () => {
|
|||
const selectedDay = new Date();
|
||||
const expectedEvent = {
|
||||
dated: selectedDay,
|
||||
type: 'holiday'
|
||||
type: 'holiday',
|
||||
absenceId: 1
|
||||
};
|
||||
const $event = {
|
||||
target: {
|
||||
|
@ -214,7 +215,8 @@ describe('Worker', () => {
|
|||
const selectedDay = new Date();
|
||||
const expectedEvent = {
|
||||
dated: selectedDay,
|
||||
type: 'leaveOfAbsence'
|
||||
type: 'leaveOfAbsence',
|
||||
absenceId: 1
|
||||
};
|
||||
const $event = {
|
||||
target: {
|
||||
|
|
|
@ -8,11 +8,16 @@ module.exports = {
|
|||
async serverPrefetch() {
|
||||
this.filters = this.$options.filters;
|
||||
const args = {
|
||||
landedFrom: this.landedStart,
|
||||
landedTo: this.landedEnd,
|
||||
shippedFrom: this.shippedStart,
|
||||
shippedTo: this.shippedEnd,
|
||||
continent: this.continent
|
||||
continent: this.continent,
|
||||
id: this.id,
|
||||
agencyFk: this.agencyFk,
|
||||
warehouseInFk: this.warehouseInFk,
|
||||
warehouseOutFk: this.warehouseOutFk,
|
||||
totalEntries: this.totalEntries,
|
||||
ref: this.ref,
|
||||
cargoSupplierFk: this.cargoSupplierFk
|
||||
};
|
||||
|
||||
const travels = await this.fetchTravels(args);
|
||||
|
@ -38,11 +43,6 @@ module.exports = {
|
|||
dated: function() {
|
||||
return this.filters.date(new Date(), '%d-%m-%Y');
|
||||
},
|
||||
landedStart: function() {
|
||||
if (!this.landedFrom) return;
|
||||
|
||||
return this.filters.date(this.landedFrom, '%Y-%m-%d');
|
||||
},
|
||||
landedEnd: function() {
|
||||
if (!this.landedTo) return;
|
||||
|
||||
|
@ -52,11 +52,6 @@ module.exports = {
|
|||
if (!this.shippedFrom) return;
|
||||
|
||||
return this.filters.date(this.shippedFrom, '%Y-%m-%d');
|
||||
},
|
||||
shippedEnd: function() {
|
||||
if (!this.shippedTo) return;
|
||||
|
||||
return this.filters.date(this.shippedTo, '%Y-%m-%d');
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -65,20 +60,29 @@ module.exports = {
|
|||
switch (key) {
|
||||
case 'shippedFrom':
|
||||
return `t.shipped >= ${value}`;
|
||||
case 'shippedTo':
|
||||
return `t.shipped <= ${value}`;
|
||||
case 'landedFrom':
|
||||
return `t.landed >= ${value}`;
|
||||
case 'landedTo':
|
||||
return `t.landed <= ${value}`;
|
||||
case 'continent':
|
||||
return `cnt.code = ${value}`;
|
||||
case 'ref':
|
||||
return {'t.ref': {like: `%${value}%`}};
|
||||
case 'id':
|
||||
return `t.id = ${value}`;
|
||||
case 'agencyFk':
|
||||
return `am.id = ${value}`;
|
||||
case 'warehouseOutFk':
|
||||
return `wo.id = ${value}`;
|
||||
case 'warehouseInFk':
|
||||
return `w.id = ${value}`;
|
||||
case 'cargoSupplierFk':
|
||||
return `s.id = ${value}`;
|
||||
}
|
||||
});
|
||||
|
||||
let query = this.getSqlFromDef('travels');
|
||||
query = db.merge(query, where);
|
||||
query = db.merge(query, 'GROUP BY t.id');
|
||||
query = db.merge(query, 'ORDER BY `shipped` ASC, `landed` ASC, `travelFk`, `loadPriority`, `agencyModeFk`, `evaNotes`');
|
||||
|
||||
return this.rawSql(query);
|
||||
},
|
||||
|
@ -92,10 +96,15 @@ module.exports = {
|
|||
'report-footer': reportFooter.build()
|
||||
},
|
||||
props: [
|
||||
'landedFrom',
|
||||
'landedTo',
|
||||
'shippedFrom',
|
||||
'shippedTo',
|
||||
'continent'
|
||||
'continent',
|
||||
'ref',
|
||||
'id',
|
||||
'agencyFk',
|
||||
'warehouseOutFk',
|
||||
'warehouseInFk',
|
||||
'totalEntries',
|
||||
'cargoSupplierFk'
|
||||
]
|
||||
};
|
||||
|
|
|
@ -4,6 +4,7 @@ SELECT
|
|||
t.shipped,
|
||||
t.landed,
|
||||
t.kg,
|
||||
am.id AS agencyModeFk,
|
||||
SUM(b.stickers) AS stickers,
|
||||
CAST(SUM(i.density * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as loadedKg,
|
||||
CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg
|
||||
|
|
Loading…
Reference in New Issue