Version beta 1 del bionic
This commit is contained in:
parent
434e8e46c1
commit
c7f171a71c
|
@ -13,14 +13,12 @@ Vn.Basket = new Class
|
||||||
{
|
{
|
||||||
var res = resultSet.fetchResult ();
|
var res = resultSet.fetchResult ();
|
||||||
|
|
||||||
if (!res.next ())
|
if (res.next ())
|
||||||
return;
|
|
||||||
|
|
||||||
switch (res.get ('stat'))
|
switch (res.get ('stat'))
|
||||||
{
|
{
|
||||||
case 'BAD_CONFIG':
|
case 'BAD_CONFIG':
|
||||||
case 'NOT_EXISTS':
|
case 'NOT_EXISTS':
|
||||||
this.onConfigureClick ();
|
this.hash.set ({'form': 'ecomerce/checkout'});
|
||||||
break;
|
break;
|
||||||
case 'UPDATED':
|
case 'UPDATED':
|
||||||
(new Htk.Toast ()).showWarning (_('OrderItemsUpdated'));
|
(new Htk.Toast ()).showWarning (_('OrderItemsUpdated'));
|
||||||
|
|
|
@ -3,14 +3,13 @@
|
||||||
<vn-param id="order"/>
|
<vn-param id="order"/>
|
||||||
<db-form id="order-form">
|
<db-form id="order-form">
|
||||||
<db-model updatable="true">
|
<db-model updatable="true">
|
||||||
SELECT id, date_send, agency_id, wh_id
|
SELECT id, date_send, agency_id
|
||||||
FROM order_view WHERE id = #id
|
FROM basket
|
||||||
<sql-batch property="batch">
|
<sql-batch property="batch">
|
||||||
<item name="id" param="order"/>
|
<item name="id" param="order"/>
|
||||||
</sql-batch>
|
</sql-batch>
|
||||||
</db-model>
|
</db-model>
|
||||||
<db-param column="date_send" id="date"/>
|
<db-param column="date_send" id="date"/>
|
||||||
<db-param column="wh_id" id="warehouse"/>
|
|
||||||
<db-param column="address_id" id="address"/>
|
<db-param column="address_id" id="address"/>
|
||||||
</db-form>
|
</db-form>
|
||||||
</vn-group>
|
</vn-group>
|
||||||
|
@ -33,14 +32,13 @@
|
||||||
<div>
|
<div>
|
||||||
<htk-grid show-header="false">
|
<htk-grid show-header="false">
|
||||||
<db-model result-index="1" id="order-rows" updatable="true">
|
<db-model result-index="1" id="order-rows" updatable="true">
|
||||||
CALL bionic_by_order (@calc);
|
CALL bionic_from_basket (@calc);
|
||||||
SELECT m.id, m.amount, t.available, a.Article, a.Categoria,
|
SELECT m.id, m.amount, t.available, a.Article, a.Categoria,
|
||||||
a.Medida, a.Tallos, a.Color, o.Abreviatura, m.price2 price, a.Foto
|
a.Medida, a.Tallos, a.Color, o.Abreviatura, m.price price, a.Foto
|
||||||
FROM order_row_view m
|
FROM basket_item m
|
||||||
INNER JOIN vn2008.Articles a ON a.Id_Article = m.item_id
|
INNER JOIN vn2008.Articles a ON a.Id_Article = m.item_id
|
||||||
LEFT JOIN vn2008.Origen o ON a.id_origen = o.id
|
LEFT JOIN vn2008.Origen o ON a.id_origen = o.id
|
||||||
LEFT JOIN cache.bionic t ON m.warehouse_id = t.warehouse_id AND m.item_id = t.item_id AND t.calc_id = @calc
|
LEFT JOIN cache.bionic t ON m.warehouse_id = t.warehouse_id AND m.item_id = t.item_id AND t.calc_id = @calc;
|
||||||
WHERE m.order_id = #order;
|
|
||||||
<sql-batch property="batch">
|
<sql-batch property="batch">
|
||||||
<item name="order" param="order"/>
|
<item name="order" param="order"/>
|
||||||
</sql-batch>
|
</sql-batch>
|
||||||
|
|
|
@ -182,59 +182,56 @@ Vn.Catalog = new Class
|
||||||
,onAddLotClick: function (column, value, row, button)
|
,onAddLotClick: function (column, value, row, button)
|
||||||
{
|
{
|
||||||
var model = this.$('item-lots');
|
var model = this.$('item-lots');
|
||||||
|
|
||||||
var grouping = model.get (row, 'grouping');
|
var grouping = model.get (row, 'grouping');
|
||||||
var warehouse = model.get (row, 'warehouse_id');
|
var warehouse = model.get (row, 'warehouse_id');
|
||||||
var rate = model.get (row, 'rate');
|
|
||||||
|
|
||||||
for (var i = 0; i < this.items.length; i++)
|
|
||||||
{
|
|
||||||
var t = this.items[i];
|
|
||||||
if (t.warehouse == warehouse && t.rate == rate)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i >= this.items.length)
|
|
||||||
this.items.push ({
|
|
||||||
warehouse: warehouse,
|
|
||||||
rate: rate,
|
|
||||||
amount: grouping
|
|
||||||
});
|
|
||||||
else
|
|
||||||
t.amount += grouping;
|
|
||||||
|
|
||||||
this.$('amount').value += grouping;
|
var lotAmount = this.items[warehouse];
|
||||||
|
|
||||||
|
if (lotAmount === undefined)
|
||||||
|
lotAmount = 0;
|
||||||
|
|
||||||
|
lotAmount += grouping;
|
||||||
|
|
||||||
|
if (lotAmount <= model.get (row, 'available'))
|
||||||
|
{
|
||||||
|
this.items[warehouse] = lotAmount;
|
||||||
|
this.$('amount').value += grouping;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
(new Htk.Toast ()).showError (_('NoMoreAmountAvailable'));
|
||||||
}
|
}
|
||||||
|
|
||||||
,onEraseClick: function ()
|
,onEraseClick: function ()
|
||||||
{
|
{
|
||||||
this.$('amount').value = 0;
|
this.$('amount').value = 0;
|
||||||
this.items = [];
|
this.items = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
,onConfirmClick: function ()
|
,onConfirmClick: function ()
|
||||||
{
|
{
|
||||||
if (this.items.length > 0)
|
var sql = '';
|
||||||
{
|
var batch = new Sql.Batch ();
|
||||||
var sql = '';
|
var query = new Sql.String ({query: 'CALL basket_item_add (#warehouse, #item, #amount);'});
|
||||||
var batch = new Sql.Batch ();
|
|
||||||
var query = new Sql.String ({query: 'CALL order_row_new (#warehouse, #item, #rate, #amount);'});
|
|
||||||
|
|
||||||
for (var i = 0; i < this.items.length; i++)
|
|
||||||
{
|
|
||||||
var t = this.items[i];
|
|
||||||
batch.addValue ('warehouse', t.warehouse);
|
|
||||||
batch.addValue ('item', this.itemId);
|
|
||||||
batch.addValue ('rate', t.rate);
|
|
||||||
batch.addValue ('amount', t.amount);
|
|
||||||
sql += query.render (batch);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.conn.execQuery (sql);
|
for (var warehouse in this.items)
|
||||||
|
{
|
||||||
|
batch.addValue ('warehouse', warehouse);
|
||||||
|
batch.addValue ('item', this.itemId);
|
||||||
|
batch.addValue ('amount', this.items[warehouse]);
|
||||||
|
sql += query.render (batch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sql != '')
|
||||||
|
this.conn.execQuery (sql);
|
||||||
|
|
||||||
this.popup.hide ();
|
this.popup.hide ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
,onStatusChange: function (model)
|
||||||
|
{
|
||||||
|
if (this.popup)
|
||||||
|
this.popup.reset ();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Htk.Realm = new Class
|
Htk.Realm = new Class
|
||||||
|
|
|
@ -19,27 +19,31 @@
|
||||||
</sql-filter-item>
|
</sql-filter-item>
|
||||||
</sql-filter>
|
</sql-filter>
|
||||||
<db-model result-index="1" id="items-model">
|
<db-model result-index="1" id="items-model">
|
||||||
CALL bionic_by_type (@calc, #type);
|
CALL bionic_from_type (@calc, #type);
|
||||||
SELECT t.item_id, SUM(t.available) available, MIN(t.price) price,
|
SELECT t.item_id, SUM(t.available) available, MIN(t.price) price,
|
||||||
a.Foto, a.Article, a.Categoria, a.Medida, a.Tallos, a.Color, o.Abreviatura
|
a.Foto, a.Article, a.Categoria, a.Medida, a.Tallos, a.Color, o.Abreviatura
|
||||||
FROM cache.bionic t
|
FROM cache.bionic t
|
||||||
JOIN vn2008.Articles a ON a.Id_Article = t.item_id
|
JOIN vn2008.Articles a ON a.Id_Article = t.item_id
|
||||||
LEFT JOIN vn2008.Origen o ON a.id_origen = o.id
|
LEFT JOIN vn2008.Origen o ON a.id_origen = o.id
|
||||||
WHERE t.calc_id = @calc AND t.available > 0
|
WHERE t.calc_id = @calc AND t.available > 0
|
||||||
GROUP BY item_id
|
GROUP BY item_id
|
||||||
ORDER BY a.Article, a.Medida
|
ORDER BY a.Article, a.Medida
|
||||||
LIMIT 400;
|
LIMIT 400;
|
||||||
<sql-batch property="batch" id="batch">
|
<sql-batch property="batch" id="batch">
|
||||||
<item name="type" param="type"/>
|
<item name="type" param="type"/>
|
||||||
</sql-batch>
|
</sql-batch>
|
||||||
</db-model>
|
</db-model>
|
||||||
<db-model id="item-lots" result-index="1">
|
<db-model id="item-lots" result-index="1" on-status-changed-after="onStatusChange">
|
||||||
CALL bionic_by_type (@calc, #type);
|
CALL bionic_from_type (@calc, #type);
|
||||||
SELECT warehouse_id, items, grouping, price, rate
|
SELECT l.warehouse_id, l.items, l.grouping, l.price, l.rate, b.available
|
||||||
FROM cache.bionic_lot
|
FROM cache.bionic b
|
||||||
WHERE calc_id = @calc
|
JOIN cache.bionic_lot l
|
||||||
AND item_id = #item
|
ON l.warehouse_id = b.warehouse_id
|
||||||
ORDER BY warehouse_id, grouping;
|
AND l.item_id = b.item_id
|
||||||
|
AND l.calc_id = @calc
|
||||||
|
WHERE b.calc_id = @calc
|
||||||
|
AND b.item_id = #item
|
||||||
|
ORDER BY warehouse_id, grouping;
|
||||||
<sql-batch property="batch" id="lots-batch" blocked="true">
|
<sql-batch property="batch" id="lots-batch" blocked="true">
|
||||||
<item name="type" param="type"/>
|
<item name="type" param="type"/>
|
||||||
</sql-batch>
|
</sql-batch>
|
||||||
|
|
|
@ -10,26 +10,25 @@
|
||||||
<db-form id="defaults" on-ready="onValuesReady">
|
<db-form id="defaults" on-ready="onValuesReady">
|
||||||
<db-model>
|
<db-model>
|
||||||
SELECT delivery_method, agency_id, address_id
|
SELECT delivery_method, agency_id, address_id
|
||||||
FROM order_defaults_view
|
FROM basket_defaults
|
||||||
</db-model>
|
</db-model>
|
||||||
</db-form>
|
</db-form>
|
||||||
<db-form id="order-form" on-ready="onValuesReady">
|
<db-form id="order-form" on-ready="onValuesReady">
|
||||||
<db-model>
|
<db-model>
|
||||||
SELECT v.code delivery_method, o.date_send, o.agency_id, o.address_id
|
SELECT v.code delivery_method, o.date_send, o.agency_id, o.address_id
|
||||||
FROM order_view o
|
FROM basket o
|
||||||
JOIN vn2008.Vistas v ON o.delivery_method_id = v.vista_id
|
JOIN vn2008.Vistas v ON o.delivery_method_id = v.vista_id
|
||||||
LIMIT 1
|
|
||||||
</db-model>
|
</db-model>
|
||||||
</db-form>
|
</db-form>
|
||||||
<db-model property="model" id="agencies" auto-load="false" result-index="1">
|
<db-model property="model" id="agencies" auto-load="false" result-index="1">
|
||||||
CALL agency_list_by_date (#date, #address);
|
CALL agency_list_from_date (#date, #address);
|
||||||
SELECT a.Id_Agencia, a.description
|
SELECT a.Id_Agencia, a.description
|
||||||
FROM t_agency t
|
FROM t_agency t
|
||||||
JOIN vn2008.Agencias a ON a.Id_Agencia = t.agency_id
|
JOIN vn2008.Agencias a ON a.Id_Agencia = t.agency_id
|
||||||
JOIN vn2008.Vistas v ON a.Vista = v.vista_id
|
JOIN vn2008.Vistas v ON a.Vista = v.vista_id
|
||||||
WHERE a.web != FALSE
|
WHERE a.web != FALSE
|
||||||
AND v.code = 'AGENCY'
|
AND v.code = 'AGENCY'
|
||||||
ORDER BY a.description;
|
ORDER BY a.description;
|
||||||
DROP TEMPORARY TABLE t_agency;
|
DROP TEMPORARY TABLE t_agency;
|
||||||
<sql-batch property="batch">
|
<sql-batch property="batch">
|
||||||
<item name="address" param="address"/>
|
<item name="address" param="address"/>
|
||||||
|
@ -37,14 +36,14 @@
|
||||||
</sql-batch>
|
</sql-batch>
|
||||||
</db-model>
|
</db-model>
|
||||||
<db-model property="model" id="warehouses" auto-load="false" result-index="1">
|
<db-model property="model" id="warehouses" auto-load="false" result-index="1">
|
||||||
CALL agency_list_by_date (#date, NULL);
|
CALL agency_list_from_date (#date, NULL);
|
||||||
SELECT a.Id_Agencia, SUBSTR(a.description, 5) description
|
SELECT a.Id_Agencia, SUBSTR(a.description, 5) description
|
||||||
FROM t_agency t
|
FROM t_agency t
|
||||||
JOIN vn2008.Agencias a ON a.Id_Agencia = t.agency_id
|
JOIN vn2008.Agencias a ON a.Id_Agencia = t.agency_id
|
||||||
JOIN vn2008.Vistas v ON a.Vista = v.vista_id
|
JOIN vn2008.Vistas v ON a.Vista = v.vista_id
|
||||||
WHERE a.web != FALSE
|
WHERE a.web != FALSE
|
||||||
AND v.code = 'PICKUP'
|
AND v.code = 'PICKUP'
|
||||||
ORDER BY a.description;
|
ORDER BY a.description;
|
||||||
DROP TEMPORARY TABLE t_agency;
|
DROP TEMPORARY TABLE t_agency;
|
||||||
<sql-batch property="batch">
|
<sql-batch property="batch">
|
||||||
<item name="date" param="date"/>
|
<item name="date" param="date"/>
|
||||||
|
|
|
@ -5,15 +5,14 @@
|
||||||
</vn-param>
|
</vn-param>
|
||||||
<db-form id="order-form" on-ready="onOrderReady">
|
<db-form id="order-form" on-ready="onOrderReady">
|
||||||
<db-model>
|
<db-model>
|
||||||
SELECT o.id, o.date_send, o.note, o.company_id,
|
SELECT o.id, o.date_send, o.note,
|
||||||
ag.description agency, v.code method, c.credit,
|
ag.description agency, v.code method, c.credit,
|
||||||
ad.consignee, ad.zip_code, ad.city, ad.name address
|
ad.consignee, ad.zip_code, ad.city, ad.name address
|
||||||
FROM order_view o
|
FROM basket o
|
||||||
JOIN vn2008.Agencias ag ON ag.Id_Agencia = o.agency_id
|
JOIN vn2008.Agencias ag ON ag.Id_Agencia = o.agency_id
|
||||||
LEFT JOIN address_view ad ON ad.id = o.address_id
|
LEFT JOIN address_view ad ON ad.id = o.address_id
|
||||||
JOIN vn2008.Vistas v ON v.vista_id = o.delivery_method_id
|
JOIN vn2008.Vistas v ON v.vista_id = o.delivery_method_id
|
||||||
JOIN customer_view c
|
JOIN customer_view c
|
||||||
WHERE o.id = #order
|
|
||||||
<sql-batch property="batch">
|
<sql-batch property="batch">
|
||||||
<item name="order" param="order-id"/>
|
<item name="order" param="order-id"/>
|
||||||
</sql-batch>
|
</sql-batch>
|
||||||
|
@ -21,7 +20,7 @@
|
||||||
</db-form>
|
</db-form>
|
||||||
<db-form id="total-form" on-ready="onImportReady">
|
<db-form id="total-form" on-ready="onImportReady">
|
||||||
<db-model result-index="1">
|
<db-model result-index="1">
|
||||||
CALL order_get_vat (#order);
|
CALL basket_get_vat ();
|
||||||
SELECT
|
SELECT
|
||||||
IFNULL(SUM(tax_base), 0) tax_base,
|
IFNULL(SUM(tax_base), 0) tax_base,
|
||||||
IFNULL(SUM(vat + surcharge), 0) vat
|
IFNULL(SUM(vat + surcharge), 0) vat
|
||||||
|
@ -33,8 +32,8 @@
|
||||||
</db-model>
|
</db-model>
|
||||||
</db-form>
|
</db-form>
|
||||||
<db-query id="confirm-query" on-ready="onConfirm">
|
<db-query id="confirm-query" on-ready="onConfirm">
|
||||||
CALL order_confirm_bionic (#order);
|
CALL basket_confirm ();
|
||||||
SELECT customer_get_debt() debt;
|
SELECT customer_get_debt();
|
||||||
<sql-batch property="batch">
|
<sql-batch property="batch">
|
||||||
<item name="order" param="order-id"/>
|
<item name="order" param="order-id"/>
|
||||||
</sql-batch>
|
</sql-batch>
|
||||||
|
|
|
@ -573,8 +573,8 @@ img.icon
|
||||||
.htk-calendar div.enabled:hover
|
.htk-calendar div.enabled:hover
|
||||||
{
|
{
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
background-color: #DDD;
|
background-color: #008678;
|
||||||
color: #555;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Date chooser */
|
/* Date chooser */
|
||||||
|
|
|
@ -793,7 +793,7 @@ Db.Model.implement
|
||||||
|
|
||||||
for (var i = 0; i < ops.length; i++)
|
for (var i = 0; i < ops.length; i++)
|
||||||
this.operationsMap[ops[i].row.index] = ops[i];
|
this.operationsMap[ops[i].row.index] = ops[i];
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1091,6 +1091,7 @@ Db.Model.implement
|
||||||
{
|
{
|
||||||
this._status = status;
|
this._status = status;
|
||||||
this.signalEmit ('status-changed', status);
|
this.signalEmit ('status-changed', status);
|
||||||
|
this.signalEmit ('status-changed-after', status);
|
||||||
}
|
}
|
||||||
|
|
||||||
,_createTarget: function (tableIndex)
|
,_createTarget: function (tableIndex)
|
||||||
|
|
|
@ -45,7 +45,6 @@ Htk.Image = new Class
|
||||||
|
|
||||||
,render: function (force)
|
,render: function (force)
|
||||||
{
|
{
|
||||||
console.log (this._value);
|
|
||||||
if (this._value)
|
if (this._value)
|
||||||
{
|
{
|
||||||
var url = '';
|
var url = '';
|
||||||
|
|
|
@ -36,11 +36,14 @@ Htk.Popup = new Class
|
||||||
document.addEventListener ('mousedown', this.hideHandler);
|
document.addEventListener ('mousedown', this.hideHandler);
|
||||||
|
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.setPosition ();
|
this.reset ();
|
||||||
}
|
}
|
||||||
|
|
||||||
,setPosition: function ()
|
,reset: function ()
|
||||||
{
|
{
|
||||||
|
if (!this.parent)
|
||||||
|
return;
|
||||||
|
|
||||||
var spacing = 5;
|
var spacing = 5;
|
||||||
var rect = this.parent.getBoundingClientRect ();
|
var rect = this.parent.getBoundingClientRect ();
|
||||||
var left = rect.left;
|
var left = rect.left;
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
,"SelectSubtype": "Por favor, seleccione el subtipo en el menú de la derecha"
|
,"SelectSubtype": "Por favor, seleccione el subtipo en el menú de la derecha"
|
||||||
,"ArticleNotFound": "Artículo no encontrado"
|
,"ArticleNotFound": "Artículo no encontrado"
|
||||||
,"ArticleNotAvailable": "Artículo no disponible"
|
,"ArticleNotAvailable": "Artículo no disponible"
|
||||||
|
,"NoMoreAmountAvailable": "No hay mas cantidad disponible"
|
||||||
|
|
||||||
,"StartOrder": "Empezar pedido"
|
,"StartOrder": "Empezar pedido"
|
||||||
,"ShoppingBasket": "Cesta de la compra"
|
,"ShoppingBasket": "Cesta de la compra"
|
||||||
|
|
|
@ -53,9 +53,21 @@ class Service
|
||||||
self::sendReply ();
|
self::sendReply ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static function errorHandler ($code, $message, $file, $line, $context)
|
static function errorHandler ($errno, $message, $file, $line, $context)
|
||||||
{
|
{
|
||||||
self::setError ('PHP', 'error', "$file:$line:$message");
|
switch ($errno)
|
||||||
|
{
|
||||||
|
case E_ERROR:
|
||||||
|
case E_PARSE:
|
||||||
|
case E_CORE_ERROR:
|
||||||
|
case E_USER_ERROR:
|
||||||
|
case E_COMPILE_ERROR:
|
||||||
|
self::setError ('PHP', $errno, "$file:$line:$message");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
self::addWarning ('PHP', $errno, "$file:$line:$message");
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue