3802-ticket_sale_mana #924

Merged
carlosjr merged 10 commits from 3802-ticket_sale_mana into dev 2022-04-11 10:50:20 +00:00
20 changed files with 1714 additions and 1016 deletions
Showing only changes of commit 8e27ab612d - Show all commits

File diff suppressed because one or more lines are too long

View File

@ -2478,21 +2478,24 @@ INSERT INTO `bs`.`defaulter` (`clientFk`, `amount`, `created`, `defaulterSinced`
(1109, 500, CURDATE(), CURDATE()); (1109, 500, CURDATE(), CURDATE());
UPDATE `vn`.`agency` UPDATE `vn`.`agency`
SET `supplierFk`=1 SET `supplierFk`=1
WHERE `id`=1; WHERE `id`=1;
UPDATE `vn`.`agency` UPDATE `vn`.`agency`
SET `supplierFk`=1 SET `supplierFk`=1
WHERE `id`=2; WHERE `id`=2;
UPDATE `vn`.`agency` UPDATE `vn`.`agency`
SET `supplierFk`=2 SET `supplierFk`=2
WHERE `id`=3; WHERE `id`=3;
UPDATE `vn`.`route` UPDATE `vn`.`route`
SET `invoiceInFk`=1 SET `invoiceInFk`=1
WHERE `id`=1; WHERE `id`=1;
UPDATE `vn`.`route` UPDATE `vn`.`route`
SET `invoiceInFk`=2 SET `invoiceInFk`=2
WHERE `id`=2; WHERE `id`=2;
INSERT INTO `bs`.`salesPerson` (`workerFk`, `year`, `month`, `portfolioWeight`) INSERT INTO `bs`.`salesPerson` (`workerFk`, `year`, `month`, `portfolioWeight`)
VALUES VALUES
(18, YEAR(CURDATE()), MONTH(CURDATE()), 807.23), (18, YEAR(CURDATE()), MONTH(CURDATE()), 807.23),
@ -2505,6 +2508,7 @@ INSERT INTO `bs`.`sale` (`saleFk`, `amount`, `dated`, `typeFk`, `clientFk`)
(3, 200.78, CURDATE(), 2, 1101), (3, 200.78, CURDATE(), 2, 1101),
(4, 33.8, CURDATE(), 1, 1101), (4, 33.8, CURDATE(), 1, 1101),
(30, 34.4, CURDATE(), 1, 1108); (30, 34.4, CURDATE(), 1, 1108);
INSERT INTO `vn`.`docuware` (`code`, `fileCabinetName`, `dialogName` , `find`) INSERT INTO `vn`.`docuware` (`code`, `fileCabinetName`, `dialogName` , `find`)
VALUES VALUES
('deliveryClientTest', 'deliveryClientTest', 'findTest', 'word'); ('deliveryClientTest', 'deliveryClientTest', 'findTest', 'word');
@ -2513,6 +2517,18 @@ INSERT INTO `vn`.`docuwareConfig` (`url`)
VALUES VALUES
('https://verdnatura.docuware.cloud/docuware/platform'); ('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`) INSERT INTO `vn`.`supplierAgencyTerm` (`agencyFk`, `supplierFk`, `minimumPackages`, `kmPrice`, `packagePrice`, `routePrice`, `minimumKm`, `minimumM3`, `m3Price`)
VALUES VALUES
(1, 1, 0, 0.00, 0.00, NULL, 0, 0.00, 23), (1, 1, 0, 0.00, 0.00, NULL, 0, 0.00, 23),

File diff suppressed because it is too large Load Diff

View File

@ -66,7 +66,7 @@ describe('Claim development', () => {
.waitToGetProperty(selectors.claimDevelopment.firstClaimRedelivery, 'value'); .waitToGetProperty(selectors.claimDevelopment.firstClaimRedelivery, 'value');
expect(reason).toEqual('Calor'); expect(reason).toEqual('Calor');
expect(result).toEqual('Cocido'); expect(result).toEqual('Baboso/Cocido');
expect(responsible).toEqual('Calidad general'); expect(responsible).toEqual('Calidad general');
expect(worker).toEqual('adminAssistantNick'); expect(worker).toEqual('adminAssistantNick');
expect(redelivery).toEqual('Cliente'); expect(redelivery).toEqual('Cliente');

View File

@ -50,7 +50,7 @@ describe('InvoiceOut manual invoice path', () => {
}); });
it('should create an invoice from a client', async() => { 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.manualInvoiceSerial, 'Global nacional');
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTaxArea, 'national'); await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTaxArea, 'national');
await page.waitToClick(selectors.invoiceOutIndex.saveInvoice); await page.waitToClick(selectors.invoiceOutIndex.saveInvoice);

View File

@ -52,10 +52,12 @@ class Controller extends Section {
} }
scrollToLine(lineFk) { scrollToLine(lineFk) {
this.$.$applyAsync(() => {
const hashFk = this.lineFk || lineFk; const hashFk = this.lineFk || lineFk;
const hash = `vnItemDiary-${hashFk}`; const hash = `vnItemDiary-${hashFk}`;
this.$location.hash(hash); this.$location.hash(hash);
this.$anchorScroll(); this.$anchorScroll();
});
} }
showDescriptor(event, sale) { showDescriptor(event, sale) {

View File

@ -47,6 +47,8 @@ describe('Item', () => {
controller.lineFk = 1; controller.lineFk = 1;
controller.scrollToLine('invalidValue'); controller.scrollToLine('invalidValue');
$scope.$apply();
expect(controller.$location.hash()).toEqual(`vnItemDiary-${1}`); expect(controller.$location.hash()).toEqual(`vnItemDiary-${1}`);
expect(controller.$anchorScroll).toHaveBeenCalledWith(); expect(controller.$anchorScroll).toHaveBeenCalledWith();
}); });
@ -56,6 +58,8 @@ describe('Item', () => {
controller.lineFk = undefined; controller.lineFk = undefined;
controller.scrollToLine(1); controller.scrollToLine(1);
$scope.$apply();
expect(controller.$location.hash()).toEqual(`vnItemDiary-${1}`); expect(controller.$location.hash()).toEqual(`vnItemDiary-${1}`);
expect(controller.$anchorScroll).toHaveBeenCalledWith(); expect(controller.$anchorScroll).toHaveBeenCalledWith();
}); });

View File

@ -222,8 +222,8 @@ describe('SalesMonitor salesFilter()', () => {
const firstTicket = result.shift(); const firstTicket = result.shift();
const secondTicket = result.shift(); const secondTicket = result.shift();
expect(firstTicket.totalProblems).toEqual(3); expect(firstTicket.totalProblems).toEqual(1);
expect(secondTicket.totalProblems).toEqual(2); expect(secondTicket.totalProblems).toEqual(1);
await tx.rollback(); await tx.rollback();
} catch (e) { } catch (e) {

View File

@ -28,16 +28,6 @@ module.exports = Self => {
type: 'date', type: 'date',
description: 'The shipped from date filter' 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', arg: 'landedTo',
type: 'date', type: 'date',
@ -101,10 +91,6 @@ module.exports = Self => {
return {'t.ref': {like: `%${value}%`}}; return {'t.ref': {like: `%${value}%`}};
case 'shippedFrom': case 'shippedFrom':
return {'t.shipped': {gte: value}}; return {'t.shipped': {gte: value}};
case 'shippedTo':
return {'t.shipped': {lte: value}};
case 'landedFrom':
return {'t.landed': {gte: value}};
case 'landedTo': case 'landedTo':
return {'t.landed': {lte: value}}; return {'t.landed': {lte: value}};
case 'continent': case 'continent':
@ -162,6 +148,7 @@ module.exports = Self => {
stmt.merge(conn.makeWhere(filter.where)); stmt.merge(conn.makeWhere(filter.where));
stmt.merge(conn.makeGroupBy('t.id')); stmt.merge(conn.makeGroupBy('t.id'));
stmt.merge(conn.makeOrderBy(filter.order));
stmt.merge(conn.makeLimit(filter)); stmt.merge(conn.makeLimit(filter));
stmts.push(stmt); stmts.push(stmt);

View File

@ -46,15 +46,64 @@ describe('Travel extraCommunityFilter()', () => {
expect(result.length).toEqual(3); expect(result.length).toEqual(3);
}); });
it('should return the routes matching "landed from" and "landed to"', async() => { it('should return the travel matching "warehouse in"', 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);
const ctx = { const ctx = {
args: { 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 landedTo: to
} }
}; };

View File

@ -47,17 +47,6 @@
ng-model="$ctrl.landedTo"> ng-model="$ctrl.landedTo">
</vn-date-picker> </vn-date-picker>
</vn-horizontal> </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-horizontal> <vn-horizontal>
<vn-autocomplete vn-one <vn-autocomplete vn-one

View File

@ -14,31 +14,6 @@ class Controller extends SearchPanel {
set shippedFrom(value) { set shippedFrom(value) {
this.filter.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() { get landedTo() {
@ -47,9 +22,6 @@ class Controller extends SearchPanel {
set landedTo(value) { set landedTo(value) {
this.filter.landedTo = value; this.filter.landedTo = value;
if (!this.filter.shippedTo)
this.filter.shippedTo = value;
} }
} }

View File

@ -2,7 +2,7 @@
vn-id="model" vn-id="model"
url="Travels/extraCommunityFilter" url="Travels/extraCommunityFilter"
data="travels" data="travels"
order="landed ASC, shipped ASC, travelFk, loadPriority, agencyModeFk, evaNotes" order="shipped ASC, landed ASC, travelFk, loadPriority, agencyModeFk, evaNotes"
limit="20" limit="20"
auto-load="true"> auto-load="true">
</vn-crud-model> </vn-crud-model>

View File

@ -17,16 +17,18 @@ class Controller extends Section {
this.draggableElement = 'a[draggable]'; this.draggableElement = 'a[draggable]';
this.droppableElement = 'vn-tbody[vn-droppable]'; this.droppableElement = 'vn-tbody[vn-droppable]';
const scopeDays = 14; const twoDays = 2;
const landedFrom = new Date(); const shippedFrom = new Date();
landedFrom.setHours(0, 0, 0, 0); shippedFrom.setDate(shippedFrom.getDate() - twoDays);
shippedFrom.setHours(0, 0, 0, 0);
const sevenDays = 7;
const landedTo = new Date(); const landedTo = new Date();
landedTo.setDate(landedTo.getDate() + scopeDays); landedTo.setDate(landedTo.getDate() + sevenDays);
landedTo.setHours(23, 59, 59, 59); landedTo.setHours(23, 59, 59, 59);
this.defaultFilter = { this.defaultFilter = {
landedFrom: landedFrom, shippedFrom: shippedFrom,
landedTo: landedTo, landedTo: landedTo,
continent: 'AM' continent: 'AM'
}; };
@ -34,10 +36,12 @@ class Controller extends Section {
get hasDateRange() { get hasDateRange() {
const userParams = this.$.model.userParams; const userParams = this.$.model.userParams;
const hasLanded = userParams.landedFrom || userParams.landedTo; const hasLanded = userParams.landedTo;
const hasShipped = userParams.shippedFrom || userParams.shippedTo; const hasShipped = userParams.shippedFrom;
const hasContinent = userParams.continent;
const hasWarehouseOut = userParams.warehouseOutFk;
return hasLanded || hasShipped; return hasLanded || hasShipped || hasContinent || hasWarehouseOut;
} }
findDraggable($event) { findDraggable($event) {

View File

@ -9,8 +9,8 @@ vn-travel-extra-community {
padding-bottom: 7px; padding-bottom: 7px;
padding-bottom: 4px; padding-bottom: 4px;
font-weight: lighter; font-weight: lighter;
background-color: #fde6ca; background-color: $color-bg;
color: $color-font-light; color: white;
border-bottom: 1px solid #f7931e; border-bottom: 1px solid #f7931e;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;

View File

@ -34,6 +34,9 @@
}, },
"notificationEmail": { "notificationEmail": {
"type": "string" "type": "string"
},
"hasToMistake": {
"type": "number"
} }
} }
} }

View File

@ -198,7 +198,7 @@ class Controller extends Section {
const event = this.events[stamp]; const event = this.events[stamp];
const calendar = $event.target.closest('vn-calendar').$ctrl; const calendar = $event.target.closest('vn-calendar').$ctrl;
if (event) { if (event && event.absenceId) {
if (event.type == this.absenceType.code) if (event.type == this.absenceType.code)
this.delete(calendar, day, event); this.delete(calendar, day, event);
else else
@ -230,6 +230,7 @@ class Controller extends Section {
.then(calendar.repaint()) .then(calendar.repaint())
.then(() => this.getContractHolidays()) .then(() => this.getContractHolidays())
.then(() => this.getYearHolidays()) .then(() => this.getYearHolidays())
.then(() => this.repaint())
); );
}); });
} }
@ -266,6 +267,7 @@ class Controller extends Section {
.then(calendar.repaint()) .then(calendar.repaint())
.then(() => this.getContractHolidays()) .then(() => this.getContractHolidays())
.then(() => this.getYearHolidays()) .then(() => this.getYearHolidays())
.then(() => this.repaint())
); );
}); });
} }

View File

@ -191,7 +191,8 @@ describe('Worker', () => {
const selectedDay = new Date(); const selectedDay = new Date();
const expectedEvent = { const expectedEvent = {
dated: selectedDay, dated: selectedDay,
type: 'holiday' type: 'holiday',
absenceId: 1
}; };
const $event = { const $event = {
target: { target: {
@ -214,7 +215,8 @@ describe('Worker', () => {
const selectedDay = new Date(); const selectedDay = new Date();
const expectedEvent = { const expectedEvent = {
dated: selectedDay, dated: selectedDay,
type: 'leaveOfAbsence' type: 'leaveOfAbsence',
absenceId: 1
}; };
const $event = { const $event = {
target: { target: {

View File

@ -8,11 +8,16 @@ module.exports = {
async serverPrefetch() { async serverPrefetch() {
this.filters = this.$options.filters; this.filters = this.$options.filters;
const args = { const args = {
landedFrom: this.landedStart,
landedTo: this.landedEnd, landedTo: this.landedEnd,
shippedFrom: this.shippedStart, 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); const travels = await this.fetchTravels(args);
@ -38,11 +43,6 @@ module.exports = {
dated: function() { dated: function() {
return this.filters.date(new Date(), '%d-%m-%Y'); 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() { landedEnd: function() {
if (!this.landedTo) return; if (!this.landedTo) return;
@ -52,11 +52,6 @@ module.exports = {
if (!this.shippedFrom) return; if (!this.shippedFrom) return;
return this.filters.date(this.shippedFrom, '%Y-%m-%d'); 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: { methods: {
@ -65,20 +60,29 @@ module.exports = {
switch (key) { switch (key) {
case 'shippedFrom': case 'shippedFrom':
return `t.shipped >= ${value}`; return `t.shipped >= ${value}`;
case 'shippedTo':
return `t.shipped <= ${value}`;
case 'landedFrom':
return `t.landed >= ${value}`;
case 'landedTo': case 'landedTo':
return `t.landed <= ${value}`; return `t.landed <= ${value}`;
case 'continent': case 'continent':
return `cnt.code = ${value}`; 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'); let query = this.getSqlFromDef('travels');
query = db.merge(query, where); query = db.merge(query, where);
query = db.merge(query, 'GROUP BY t.id'); 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); return this.rawSql(query);
}, },
@ -92,10 +96,15 @@ module.exports = {
'report-footer': reportFooter.build() 'report-footer': reportFooter.build()
}, },
props: [ props: [
'landedFrom',
'landedTo', 'landedTo',
'shippedFrom', 'shippedFrom',
'shippedTo', 'continent',
'continent' 'ref',
'id',
'agencyFk',
'warehouseOutFk',
'warehouseInFk',
'totalEntries',
'cargoSupplierFk'
] ]
}; };

View File

@ -4,6 +4,7 @@ SELECT
t.shipped, t.shipped,
t.landed, t.landed,
t.kg, t.kg,
am.id AS agencyModeFk,
SUM(b.stickers) AS stickers, 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(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 CAST(SUM(167.5 * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000 ) as DECIMAL(10,0)) as volumeKg