invoicing test
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
ffdfd1a7e5
commit
6f5e25493d
|
@ -69,7 +69,7 @@ BEGIN
|
|||
JOIN supplier su ON su.id = t.companyFk
|
||||
JOIN client c ON c.id = t.clientFk
|
||||
LEFT JOIN itemTaxCountry itc ON itc.itemFk = i.id AND itc.countryFk = su.countryFk
|
||||
WHERE YEAR(t.shipped) < 2001
|
||||
WHERE (YEAR(t.shipped) < 2001 AND t.isDeleted)
|
||||
OR c.isTaxDataChecked = FALSE
|
||||
OR t.isDeleted
|
||||
OR c.hasToInvoice = FALSE
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
CREATE SCHEMA IF NOT EXISTS `vn2008`;
|
||||
CREATE SCHEMA IF NOT EXISTS `tmp`;
|
||||
|
||||
UPDATE `util`.`config`
|
||||
SET `environment`= 'development';
|
||||
ALTER TABLE util.config
|
||||
ADD COLUMN `mockUtcTime` datetime DEFAULT NULL,
|
||||
ADD COLUMN `mockEnabled` tinyint(3) unsigned NOT NULL DEFAULT 0,
|
||||
ADD COLUMN `mockTz` varchar(255) DEFAULT NULL;
|
||||
|
||||
UPDATE util.config
|
||||
SET mockUtcTime='2001-01-01 11:00:00',
|
||||
environment= 'development',
|
||||
mockEnabled = TRUE,
|
||||
mockTz='+01:00';
|
||||
|
||||
-- FOR MOCK vn.time
|
||||
|
||||
|
@ -164,7 +172,7 @@ INSERT INTO `vn`.`warehouse`(`id`, `name`, `code`, `isComparative`, `isInventory
|
|||
(3, 'Warehouse Three', NULL, 1, 1, 1, 1, 0, 0, 2, 1, 1),
|
||||
(4, 'Warehouse Four', NULL, 1, 1, 1, 1, 0, 0, 2, 1, 1),
|
||||
(5, 'Warehouse Five', NULL, 1, 1, 1, 1, 0, 0, 2, 1, 1),
|
||||
(13, 'Inventory', NULL, 1, 1, 1, 0, 0, 0, 2, 1, 0),
|
||||
(13, 'Inventory', 'inv', 1, 1, 1, 0, 0, 0, 2, 1, 0),
|
||||
(60, 'Algemesi', NULL, 1, 1, 1, 0, 0, 0, 2, 1, 0);
|
||||
|
||||
|
||||
|
|
|
@ -1043,20 +1043,22 @@ export default {
|
|||
invoiceOutIndex: {
|
||||
topbarSearch: 'vn-searchbar',
|
||||
searchResult: 'vn-invoice-out-index vn-card > vn-table > div > vn-tbody > a.vn-tr',
|
||||
createInvoice: 'vn-invoice-out-index > div > vn-vertical > vn-button > button vn-icon[icon="add"]',
|
||||
createManualInvoice: 'vn-item[name="manualInvoice"]',
|
||||
createGlobalInvoice: 'vn-item[name="globalInvoice"]',
|
||||
createInvoice: 'vn-invoice-out-index > div > vn-button > button vn-icon[icon="add"]',
|
||||
manualInvoiceForm: '.vn-invoice-out-manual',
|
||||
manualInvoiceTicket: 'vn-autocomplete[ng-model="$ctrl.invoice.ticketFk"]',
|
||||
manualInvoiceClient: 'vn-autocomplete[ng-model="$ctrl.invoice.clientFk"]',
|
||||
manualInvoiceSerial: 'vn-autocomplete[ng-model="$ctrl.invoice.serial"]',
|
||||
manualInvoiceTaxArea: 'vn-autocomplete[ng-model="$ctrl.invoice.taxArea"]',
|
||||
saveInvoice: 'button[response="accept"]',
|
||||
globalInvoiceForm: '.vn-invoice-out-global-invoicing',
|
||||
globalInvoiceClientsRange: 'vn-radio[val="clientsRange"]',
|
||||
globalInvoiceDate: '[ng-model="$ctrl.invoice.invoiceDate"]',
|
||||
globalInvoiceFromClient: '[ng-model="$ctrl.invoice.fromClientId"]',
|
||||
globalInvoiceToClient: '[ng-model="$ctrl.invoice.toClientId"]',
|
||||
saveInvoice: 'button[response="accept"]'
|
||||
},
|
||||
invoiceOutGlobalInvoicing: {
|
||||
oneClient: 'vn-invoice-out-global-invoicing vn-side-menu form > vn-vertical > vn-vertical > vn-radio[val="one"]',
|
||||
allClients: 'vn-invoice-out-global-invoicing vn-side-menu form > vn-vertical > vn-vertical > vn-radio[val="all"]',
|
||||
clientId: 'vn-invoice-out-global-invoicing vn-side-menu form > vn-vertical > vn-autocomplete[ng-model="$ctrl.clientId"]',
|
||||
printer: 'vn-invoice-out-global-invoicing vn-side-menu form > vn-vertical > vn-autocomplete[ng-model="$ctrl.printerFk"]',
|
||||
makeInvoice: 'vn-invoice-out-global-invoicing vn-side-menu form > vn-vertical > vn-submit',
|
||||
invoiceDate: 'vn-invoice-out-global-invoicing vn-side-menu form > vn-vertical > vn-date-picker[ng-model="$ctrl.invoiceDate"]',
|
||||
maxShipped: 'vn-invoice-out-global-invoicing vn-side-menu form > vn-vertical > vn-date-picker[ng-model="$ctrl.maxShipped"]'
|
||||
},
|
||||
invoiceOutDescriptor: {
|
||||
moreMenu: 'vn-invoice-out-descriptor vn-icon-button[icon=more_vert]',
|
||||
|
|
|
@ -17,7 +17,6 @@ describe('InvoiceOut manual invoice path', () => {
|
|||
|
||||
it('should open the manual invoice form', async() => {
|
||||
await page.waitToClick(selectors.invoiceOutIndex.createInvoice);
|
||||
await page.waitToClick(selectors.invoiceOutIndex.createManualInvoice);
|
||||
await page.waitForSelector(selectors.invoiceOutIndex.manualInvoiceForm);
|
||||
});
|
||||
|
||||
|
@ -45,7 +44,6 @@ describe('InvoiceOut manual invoice path', () => {
|
|||
|
||||
it('should now open the manual invoice form', async() => {
|
||||
await page.waitToClick(selectors.invoiceOutIndex.createInvoice);
|
||||
await page.waitToClick(selectors.invoiceOutIndex.createManualInvoice);
|
||||
await page.waitForSelector(selectors.invoiceOutIndex.manualInvoiceForm);
|
||||
});
|
||||
|
||||
|
|
|
@ -17,47 +17,53 @@ describe('InvoiceOut global invoice path', () => {
|
|||
await browser.close();
|
||||
});
|
||||
|
||||
let invoicesBefore;
|
||||
let invoicesBeforeOneClient;
|
||||
let invoicesBeforeAllClients;
|
||||
let now = Date.vnNew();
|
||||
|
||||
it('should count the amount of invoices listed before globla invoces are made', async() => {
|
||||
invoicesBefore = await page.countElement(selectors.invoiceOutIndex.searchResult);
|
||||
invoicesBeforeOneClient = await page.countElement(selectors.invoiceOutIndex.searchResult);
|
||||
|
||||
expect(invoicesBefore).toBeGreaterThanOrEqual(4);
|
||||
expect(invoicesBeforeOneClient).toBeGreaterThanOrEqual(4);
|
||||
});
|
||||
|
||||
it('should open the global invoice form', async() => {
|
||||
await page.waitToClick(selectors.invoiceOutIndex.createInvoice);
|
||||
await page.waitToClick(selectors.invoiceOutIndex.createGlobalInvoice);
|
||||
await page.waitForSelector(selectors.invoiceOutIndex.globalInvoiceForm);
|
||||
await page.accessToSection('invoiceOut.global-invoicing');
|
||||
});
|
||||
|
||||
it('should create a global invoice for charles xavier today', async() => {
|
||||
await page.pickDate(selectors.invoiceOutIndex.globalInvoiceDate);
|
||||
await page.waitToClick(selectors.invoiceOutIndex.globalInvoiceClientsRange);
|
||||
await page.autocompleteSearch(selectors.invoiceOutIndex.globalInvoiceFromClient, 'Petter Parker');
|
||||
await page.autocompleteSearch(selectors.invoiceOutIndex.globalInvoiceToClient, 'Petter Parker');
|
||||
await page.waitToClick(selectors.invoiceOutIndex.saveInvoice);
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain('Data saved!');
|
||||
await page.waitToClick(selectors.invoiceOutGlobalInvoicing.oneClient);
|
||||
await page.autocompleteSearch(selectors.invoiceOutGlobalInvoicing.clientId, '1108');
|
||||
await page.pickDate(selectors.invoiceOutGlobalInvoicing.invoiceDate, now);
|
||||
await page.pickDate(selectors.invoiceOutGlobalInvoicing.maxShipped, now);
|
||||
await page.autocompleteSearch(selectors.invoiceOutGlobalInvoicing.printer, '1');
|
||||
await page.waitToClick(selectors.invoiceOutGlobalInvoicing.makeInvoice);
|
||||
await page.waitForTimeout(1000);
|
||||
});
|
||||
|
||||
it('should count the amount of invoices listed after globla invocing', async() => {
|
||||
it('should count the amount of invoices listed after invoice for charles xavier today', async() => {
|
||||
await page.waitToClick('[icon="search"]');
|
||||
await page.waitForTimeout(1000); // index search needs time to return results
|
||||
invoicesBeforeAllClients = await page.countElement(selectors.invoiceOutIndex.searchResult);
|
||||
|
||||
expect(invoicesBeforeAllClients).toBeGreaterThan(invoicesBeforeOneClient);
|
||||
});
|
||||
|
||||
it('should create a global invoice for all clients today', async() => {
|
||||
await page.accessToSection('invoiceOut.global-invoicing');
|
||||
await page.waitToClick(selectors.invoiceOutGlobalInvoicing.allClients);
|
||||
await page.pickDate(selectors.invoiceOutGlobalInvoicing.invoiceDate, now);
|
||||
await page.pickDate(selectors.invoiceOutGlobalInvoicing.maxShipped, now);
|
||||
await page.autocompleteSearch(selectors.invoiceOutGlobalInvoicing.printer, '1');
|
||||
await page.waitToClick(selectors.invoiceOutGlobalInvoicing.makeInvoice);
|
||||
await page.waitForTimeout(1000);
|
||||
});
|
||||
|
||||
it('should count the amount of invoices listed after global invocing', async() => {
|
||||
await page.waitToClick('[icon="search"]');
|
||||
await page.waitForTimeout(1000); // index search needs time to return results
|
||||
const currentInvoices = await page.countElement(selectors.invoiceOutIndex.searchResult);
|
||||
|
||||
expect(currentInvoices).toBeGreaterThan(invoicesBefore);
|
||||
});
|
||||
|
||||
it('should create a global invoice for all clients today', async() => {
|
||||
await page.waitToClick(selectors.invoiceOutIndex.createInvoice);
|
||||
await page.waitToClick(selectors.invoiceOutIndex.createGlobalInvoice);
|
||||
await page.waitForSelector(selectors.invoiceOutIndex.globalInvoiceForm);
|
||||
await page.pickDate(selectors.invoiceOutIndex.globalInvoiceDate);
|
||||
await page.waitToClick(selectors.invoiceOutIndex.saveInvoice);
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain('Data saved!');
|
||||
expect(currentInvoices).toBeGreaterThan(invoicesBeforeAllClients);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -150,5 +150,6 @@
|
|||
"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"
|
||||
"Valid priorities: 1,2,3": "Valid priorities: 1,2,3",
|
||||
"Warehouse inventory not seted": "Warehouse inventory not seted"
|
||||
}
|
|
@ -266,5 +266,6 @@
|
|||
"A supplier with the same name already exists. Change the country.": "Un proveedor con el mismo nombre ya existe. Cambie el país.",
|
||||
"There is no assigned email for this client": "No hay correo asignado para este cliente",
|
||||
"Exists an invoice with a previous date": "Existe una factura con fecha anterior",
|
||||
"Invoice date can't be less than max date": "La fecha de factura no puede ser inferior a la fecha límite"
|
||||
"Invoice date can't be less than max date": "La fecha de factura no puede ser inferior a la fecha límite",
|
||||
"Warehouse inventory not seted": "Warehouse inventory not seted"
|
||||
}
|
|
@ -4,10 +4,6 @@ module.exports = Self => {
|
|||
accessType: 'READ',
|
||||
accepts: [
|
||||
{
|
||||
arg: 'year',
|
||||
type: 'number',
|
||||
required: true
|
||||
}, {
|
||||
arg: 'companyFk',
|
||||
type: 'number',
|
||||
required: true
|
||||
|
@ -23,17 +19,16 @@ module.exports = Self => {
|
|||
}
|
||||
});
|
||||
|
||||
Self.getInvoiceDate = async(year, companyFk) => {
|
||||
Self.getInvoiceDate = async companyFk => {
|
||||
const models = Self.app.models;
|
||||
const [invoiceDate] = await models.InvoiceOut.rawSql(
|
||||
`SELECT MAX(io.issued) issued
|
||||
FROM invoiceOut io
|
||||
JOIN invoiceOutSerial ios ON ios.code = io.serial
|
||||
WHERE ios.type = 'global'
|
||||
AND io.issued BETWEEN MAKEDATE(?, 1) AND
|
||||
util.lastDayOfYear(MAKEDATE(?, 1))
|
||||
AND io.issued
|
||||
AND io.companyFk = ?`,
|
||||
[year, year, companyFk]
|
||||
[companyFk]
|
||||
);
|
||||
return invoiceDate;
|
||||
};
|
||||
|
|
|
@ -15,13 +15,12 @@ class Controller extends Section {
|
|||
.then(res => {
|
||||
this.companyFk = res.data.companyFk;
|
||||
const params = {
|
||||
year: this.maxShipped.getFullYear(),
|
||||
companyFk: this.companyFk
|
||||
};
|
||||
return this.$http.get('InvoiceOuts/getInvoiceDate', {params});
|
||||
})
|
||||
.then(res => {
|
||||
this.minInvoicingDate = new Date(res.data.issued);
|
||||
this.minInvoicingDate = res.data.issued ? new Date(res.data.issued) : null;
|
||||
this.invoiceDate = this.minInvoicingDate;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue