2394 - Removed call to order_total() #358

Merged
carlosjr merged 4 commits from 2394-order_index_total into dev 2020-08-31 08:23:52 +00:00
4 changed files with 13 additions and 35 deletions

View File

@ -136,14 +136,10 @@ module.exports = Self => {
let stmts = []; let stmts = [];
let stmt; let stmt;
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.filter');
stmt = new ParameterizedSQL( stmt = new ParameterizedSQL(
`CREATE TEMPORARY TABLE tmp.filter `SELECT
(INDEX (id))
ENGINE = MEMORY
SELECT
o.id, o.id,
o.total,
o.date_send landed, o.date_send landed,
o.date_make created, o.date_make created,
o.customer_id clientFk, o.customer_id clientFk,
@ -178,36 +174,13 @@ module.exports = Self => {
} }
stmt.merge(conn.makeWhere(filter.where)); stmt.merge(conn.makeWhere(filter.where));
stmt.merge({ stmt.merge(`GROUP BY o.id`);
sql: `GROUP BY o.id`
});
stmt.merge(conn.makePagination(filter)); stmt.merge(conn.makePagination(filter));
stmts.push(stmt); stmts.push(stmt);
stmts.push(` const sql = ParameterizedSQL.join(stmts, ';');
CREATE TEMPORARY TABLE tmp.order const result = await conn.executeStmt(sql);
(INDEX (orderFk))
ENGINE = MEMORY
SELECT id AS orderFk
FROM tmp.filter`);
stmts.push('CALL hedera.order_getTotal()'); return result;
stmt = new ParameterizedSQL(
`SELECT f.*, ot.*
FROM tmp.filter f
LEFT JOIN tmp.orderTotal ot ON ot.orderFk = f.id`);
const orderIndex = stmts.push(stmt) - 1;
stmts.push(`
DROP TEMPORARY TABLE
tmp.order,
tmp.orderTotal,
tmp.filter`);
let sql = ParameterizedSQL.join(stmts, ';');
let result = await conn.executeStmt(sql);
return result[orderIndex];
}; };
}; };

View File

@ -79,6 +79,9 @@
"mysql": { "mysql": {
"columnName": "confirm_date" "columnName": "confirm_date"
} }
},
"total": {
"type": "Number"
} }
}, },
"relations": { "relations": {

View File

@ -23,4 +23,5 @@ Created from: Creado desde
Search order by id: Buscar el pedido por identificador Search order by id: Buscar el pedido por identificador
order: pedido order: pedido
Confirm lines: Confirmar las lineas Confirm lines: Confirmar las lineas
Confirm: Confirmar Confirm: Confirmar
Real hour: Hora real

View File

@ -7,4 +7,5 @@ Agency: Agencia
Application: Aplicación Application: Aplicación
SalesPerson: Comercial SalesPerson: Comercial
Order confirmed: Pedido confirmado Order confirmed: Pedido confirmado
Show empty: Mostrar vacías Show empty: Mostrar vacías
Search orders by id: Buscar pedido por id