0
1
Fork 0
This commit is contained in:
Juan Ferrer Toribio 2017-04-07 13:00:33 +02:00
parent 944a955068
commit 0be33631ca
38 changed files with 410 additions and 579 deletions

View File

@ -2,21 +2,17 @@
<vn-group> <vn-group>
<db-form id="user-form"> <db-form id="user-form">
<db-model property="model" id="user-model" updatable="true"> <db-model property="model" id="user-model" updatable="true">
<custom> SELECT user_id, default_address
SELECT user_id, default_address FROM customer_view c
FROM customer_view c
</custom>
</db-model> </db-model>
</db-form> </db-form>
<db-model id="addresses" updatable="true"> <db-model id="addresses" updatable="true">
<custom> SELECT a.id, a.consignee, p.name province, a.zip_code,
SELECT a.id, a.consignee, p.name province, a.zip_code, a.city, a.name, a.active, c.Pais country
a.city, a.name, a.active, c.Pais country FROM address_view a
FROM address_view a LEFT JOIN vn2008.province p ON a.province_id = p.province_id
LEFT JOIN vn2008.province p ON a.province_id = p.province_id JOIN vn2008.Paises c ON c.Id = p.Paises_Id
JOIN vn2008.Paises c ON c.Id = p.Paises_Id WHERE active != FALSE
WHERE active != FALSE
</custom>
</db-model> </db-model>
</vn-group> </vn-group>
<h1 id="title"> <h1 id="title">

View File

@ -8,19 +8,13 @@
property="model" property="model"
updatable="true" updatable="true"
mode="ON_DEMAND" mode="ON_DEMAND"
lot="hash"
on-operations-done="onOperationsDone"> on-operations-done="onOperationsDone">
<custom> SELECT a.id, a.name, a.consignee, a.city, a.zip_code, a.province_id, c.Id country_id
SELECT a.id, a.name, a.consignee, a.city, a.zip_code, a.province_id, c.Id country_id FROM address_view a
FROM address_view a LEFT JOIN vn2008.province p ON p.province_id = a.province_id
LEFT JOIN vn2008.province p ON p.province_id = a.province_id JOIN vn2008.Paises c ON c.Id = p.Paises_Id
JOIN vn2008.Paises c ON c.Id = p.Paises_Id WHERE active != FALSE AND a.id = #address
WHERE active != FALSE AND a.id = #address
</custom>
<sql-batch property="batch">
<custom>
<item name="address" param="address"/>
</custom>
</sql-batch>
</db-model> </db-model>
</db-form> </db-form>
</vn-group> </vn-group>
@ -65,10 +59,8 @@
name="country_id" name="country_id"
one-way="true"/> one-way="true"/>
<db-model property="model"> <db-model property="model">
<custom> SELECT Id, Pais FROM vn2008.Paises
SELECT Id, Pais FROM vn2008.Paises ORDER BY Pais
ORDER BY Pais
</custom>
</db-model> </db-model>
</htk-combo> </htk-combo>
</div> </div>
@ -76,16 +68,9 @@
<label><t>Province</t></label> <label><t>Province</t></label>
<htk-combo lot="iter" name="province_id"> <htk-combo lot="iter" name="province_id">
<db-model property="model"> <db-model property="model">
<custom> SELECT province_id, name FROM vn2008.province
SELECT province_id, name FROM vn2008.province WHERE Paises_Id = #country
WHERE Paises_Id = #country ORDER BY name
ORDER BY name
</custom>
<sql-batch property="batch">
<custom>
<item name="country" param="country"/>
</custom>
</sql-batch>
</db-model> </db-model>
</htk-combo> </htk-combo>
</div> </div>

View File

@ -1,18 +1,9 @@
<vn> <vn>
<vn-group> <vn-group>
<vn-param id="user"/>
<vn-hash-param key="user" param="user"/>
<db-form id="user-form"> <db-form id="user-form">
<db-model property="model"> <db-model property="model" lot="hash">
<custom> SELECT Id_Cliente, Cliente, Telefono, movil
SELECT Id_Cliente, Cliente, Telefono, movil FROM vn2008.Clientes WHERE Id_Cliente = #user
FROM vn2008.Clientes WHERE Id_Cliente = #user
</custom>
<sql-batch property="batch">
<custom>
<item name="user" param="user"/>
</custom>
</sql-batch>
</db-model> </db-model>
</db-form> </db-form>
</vn-group> </vn-group>
@ -37,21 +28,14 @@
<div class="card"> <div class="card">
<div> <div>
<htk-repeater form-id="iter"> <htk-repeater form-id="iter">
<db-model property="model"> <db-model property="model" lot="hash">
<custom> SELECT u.stamp, a.platform, a.browser, a.version, a.javascript, a.cookies
SELECT u.stamp, a.platform, a.browser, a.version, a.javascript, a.cookies FROM visitUser u
FROM visitUser u JOIN visitAccess c ON c.id = u.access
JOIN visitAccess c ON c.id = u.access JOIN visitAgent a ON a.id = c.agent
JOIN visitAgent a ON a.id = c.agent WHERE u.user = #user
WHERE u.user = #user ORDER BY u.stamp DESC
ORDER BY u.stamp DESC LIMIT 8
LIMIT 8
</custom>
<sql-batch property="batch">
<custom>
<item name="user" param="user"/>
</custom>
</sql-batch>
</db-model> </db-model>
<custom> <custom>
<div class="list-row"> <div class="list-row">

View File

@ -21,18 +21,16 @@
<div class="card list"> <div class="card list">
<htk-repeater form-id="iter" renderer="repeaterFunc"> <htk-repeater form-id="iter" renderer="repeaterFunc">
<db-model property="model" id="sessions" on-status-changed="onModelStatusChange"> <db-model property="model" id="sessions" on-status-changed="onModelStatusChange">
<custom> SELECT vu.user userId, vu.stamp, c.Cliente, s.lastUpdate,
SELECT vu.user userId, vu.stamp, c.Cliente, s.lastUpdate, a.platform, a.browser, a.version, u.name user
a.platform, a.browser, a.version, u.name user FROM userSession s
FROM userSession s JOIN visitUser vu ON vu.id = s.userVisit
JOIN visitUser vu ON vu.id = s.userVisit JOIN visitAccess ac ON ac.id = vu.access
JOIN visitAccess ac ON ac.id = vu.access JOIN visitAgent a ON a.id = ac.agent
JOIN visitAgent a ON a.id = ac.agent JOIN visit v ON v.id = a.visit
JOIN visit v ON v.id = a.visit JOIN account.user u ON u.id = vu.user
JOIN account.user u ON u.id = vu.user JOIN vn2008.Clientes c ON c.Id_cliente = vu.user
JOIN vn2008.Clientes c ON c.Id_cliente = vu.user ORDER BY lastUpdate DESC
ORDER BY lastUpdate DESC
</custom>
</db-model> </db-model>
<custom> <custom>
<a id="link" class="list-row" title="_Access log"> <a id="link" class="list-row" title="_Access log">

View File

@ -6,10 +6,8 @@
<div class="card list"> <div class="card list">
<htk-repeater form-id="iter" renderer="repeaterFunc"> <htk-repeater form-id="iter" renderer="repeaterFunc">
<db-model property="model"> <db-model property="model">
<custom> SELECT image, name, description, link FROM link
SELECT image, name, description, link FROM link ORDER BY name
ORDER BY name
</custom>
</db-model> </db-model>
<custom> <custom>
<a id="link" class="list-row" target="_blank"> <a id="link" class="list-row" target="_blank">

View File

@ -20,9 +20,7 @@
<label><t>Collection</t></label> <label><t>Collection</t></label>
<htk-combo id="schema"> <htk-combo id="schema">
<db-model property="model"> <db-model property="model">
<custom> SELECT name, `desc` FROM image_schema ORDER BY `desc`
SELECT name, `desc` FROM image_schema ORDER BY `desc`
</custom>
</db-model> </db-model>
</htk-combo> </htk-combo>
<input type="hidden" name="schema" id="schema-field"/> <input type="hidden" name="schema" id="schema-field"/>

View File

@ -20,12 +20,10 @@
on-changed="onConfigChange" on-changed="onConfigChange"
on-ready="onConfigChange"> on-ready="onConfigChange">
<db-model property="model" id="configs-model"> <db-model property="model" id="configs-model">
<custom> SELECT c.id, c.name reportTitle, c.namePrefix, c.warehouse, c.family,
SELECT c.id, c.name reportTitle, c.namePrefix, c.warehouse, c.family, c.shelf, c.maxAmount, c.showPacking, c.stack, t.reino_id realm
c.shelf, c.maxAmount, c.showPacking, c.stack, t.reino_id realm FROM shelfConfig c
FROM shelfConfig c JOIN vn2008.Tipos t ON t.tipo_id = c.family
JOIN vn2008.Tipos t ON t.tipo_id = c.family
</custom>
</db-model> </db-model>
</htk-combo> </htk-combo>
</div> </div>
@ -37,26 +35,17 @@
<label><t>Reign</t></label> <label><t>Reign</t></label>
<htk-combo lot="set" name="realm" id="realm"> <htk-combo lot="set" name="realm" id="realm">
<db-model property="model"> <db-model property="model">
<custom> SELECT id, reino FROM vn2008.reinos
SELECT id, reino FROM vn2008.reinos WHERE display != FALSE ORDER BY reino
WHERE display != FALSE ORDER BY reino
</custom>
</db-model> </db-model>
</htk-combo> </htk-combo>
</div> </div>
<div> <div>
<label><t>Family</t></label> <label><t>Family</t></label>
<htk-combo lot="set" name="family"> <htk-combo lot="set" name="family">
<db-model property="model"> <db-model property="model" lot="config">
<custom> SELECT tipo_id, Tipo FROM vn2008.Tipos
SELECT tipo_id, Tipo FROM vn2008.Tipos WHERE reino_id = #realm ORDER BY Tipo
WHERE reino_id = #realm ORDER BY Tipo
</custom>
<sql-batch property="batch">
<custom>
<item name="realm" param="realm"/>
</custom>
</sql-batch>
</db-model> </db-model>
</htk-combo> </htk-combo>
</div> </div>
@ -64,10 +53,8 @@
<label><t>Store</t></label> <label><t>Store</t></label>
<htk-combo lot="set" name="warehouse"> <htk-combo lot="set" name="warehouse">
<db-model property="model"> <db-model property="model">
<custom> SELECT id, name FROM vn2008.warehouse
SELECT id, name FROM vn2008.warehouse WHERE reserve ORDER BY name
WHERE reserve ORDER BY name
</custom>
</db-model> </db-model>
</htk-combo> </htk-combo>
</div> </div>
@ -75,9 +62,7 @@
<label><t>Shelf</t></label> <label><t>Shelf</t></label>
<htk-combo lot="set" name="shelf"> <htk-combo lot="set" name="shelf">
<db-model property="model"> <db-model property="model">
<custom> SELECT id, name FROM shelf
SELECT id, name FROM shelf
</custom>
</db-model> </db-model>
</htk-combo> </htk-combo>
</div> </div>

View File

@ -1,33 +1,21 @@
<vn> <vn>
<vn-group>
<vn-param id="user-name"/>
<vn-hash-param key="user" param="user-name"/>
</vn-group>
<h1 id="title"> <h1 id="title">
<t>UserManagement</t> <t>UserManagement</t>
</h1> </h1>
<div id="actions"> <div id="actions">
<htk-search-entry <htk-search-entry lot="hash" name="user"/>
param="user-name"/>
</div> </div>
<div id="main" class="users"> <div id="main" class="users">
<div class="card list"> <div class="card list">
<htk-repeater form-id="iter" renderer="repeaterFunc"> <htk-repeater form-id="iter" renderer="repeaterFunc">
<db-model property="model"> <db-model property="model" lot="hash">
<custom> SELECT u.id, u.name, c.Cliente
SELECT u.id, u.name, c.Cliente FROM account.user u
FROM account.user u
INNER JOIN vn2008.Clientes c ON u.id = c.Id_Cliente INNER JOIN vn2008.Clientes c ON u.id = c.Id_Cliente
WHERE u.name LIKE CONCAT('%', #user, '%') WHERE u.name LIKE CONCAT('%', #user, '%')
OR c.Cliente LIKE CONCAT('%', #user, '%') OR c.Cliente LIKE CONCAT('%', #user, '%')
OR u.id = #user OR u.id = #user
ORDER BY u.name LIMIT 200 ORDER BY u.name LIMIT 200
</custom>
<sql-batch property="batch">
<custom>
<item name="user" param="user-name"/>
</custom>
</sql-batch>
</db-model> </db-model>
<custom> <custom>
<a id="link" class="list-row" title="_AccessLog"> <a id="link" class="list-row" title="_AccessLog">

View File

@ -16,15 +16,11 @@
<div class="card form"> <div class="card form">
<div> <div>
<label><t>From</t></label> <label><t>From</t></label>
<htk-date-chooser> <htk-date-chooser lot="hash" name="from"/>
<vn-param property="param" id="from"/>
</htk-date-chooser>
</div> </div>
<div> <div>
<label><t>To</t></label> <label><t>To</t></label>
<htk-date-chooser> <htk-date-chooser lot="hash" name="to"/>
<vn-param property="param" id="to"/>
</htk-date-chooser>
</div> </div>
</div> </div>
<div class="summary card form"> <div class="summary card form">
@ -47,27 +43,20 @@
</div> </div>
<div class="card list "> <div class="card list ">
<htk-repeater form-id="iter" empty-message="_Select date interval"> <htk-repeater form-id="iter" empty-message="_Select date interval">
<db-model property="model" id="visits"> <db-model property="model" id="visits" lot="hash">
<custom> SELECT browser
SELECT browser ,MIN(CAST(version AS DECIMAL(4,1))) minVersion
,MIN(CAST(version AS DECIMAL(4,1))) minVersion ,MAX(CAST(version AS DECIMAL(4,1))) maxVersion
,MAX(CAST(version AS DECIMAL(4,1))) maxVersion ,MAX(c.stamp) lastVisit
,MAX(c.stamp) lastVisit ,COUNT(DISTINCT c.id) visits
,COUNT(DISTINCT c.id) visits ,SUM(a.firstAccess = c.id AND v.firstAgent = a.id) newVisits
,SUM(a.firstAccess = c.id AND v.firstAgent = a.id) newVisits FROM visitUser e
FROM visitUser e
JOIN visitAccess c ON e.access = c.id JOIN visitAccess c ON e.access = c.id
JOIN visitAgent a ON c.agent = a.id JOIN visitAgent a ON c.agent = a.id
JOIN visit v ON a.visit = v.id JOIN visit v ON a.visit = v.id
WHERE c.stamp BETWEEN TIMESTAMP(#from,'00:00:00') AND TIMESTAMP(#to,'23:59:59') WHERE c.stamp BETWEEN TIMESTAMP(#from,'00:00:00') AND TIMESTAMP(#to,'23:59:59')
GROUP BY browser ORDER BY visits DESC GROUP BY browser
</custom> ORDER BY visits DESC
<sql-batch property="batch">
<custom>
<item name="from" param="from"/>
<item name="to" param="to"/>
</custom>
</sql-batch>
</db-model> </db-model>
<custom> <custom>
<div class="list-row"> <div class="list-row">

View File

@ -5,8 +5,13 @@ Hedera.Visits = new Class
,activate: function () ,activate: function ()
{ {
this.$('from').value = new Date (); var hash = this.hash;
this.$('to').value = new Date ();
if (!hash.get ('to'))
{
hash.set ('from', new Date ());
hash.set ('to', new Date ());
}
} }
,onRefreshClick: function () ,onRefreshClick: function ()

View File

@ -6,9 +6,7 @@
<div class="card"> <div class="card">
<htk-grid> <htk-grid>
<db-model property="model"> <db-model property="model">
<custom> CALL vn2008.agencia_volume ()
CALL vn2008.agencia_volume ()
</custom>
</db-model> </db-model>
<htk-column-button <htk-column-button
column="agency_id" column="agency_id"

View File

@ -1,23 +1,12 @@
<vn> <vn>
<vn-group>
<vn-param id="agency"/>
<vn-hash-param key="agency" param="agency"/>
</vn-group>
<h1 id="title"> <h1 id="title">
<t>ByProvince</t> <t>ByProvince</t>
</h1> </h1>
<div id="main" class="provinces"> <div id="main" class="provinces">
<div class="card"> <div class="card">
<htk-grid> <htk-grid>
<db-model property="model"> <db-model property="model" lot="hash">
<custom> CALL vn2008.desglose_volume (#agency)
CALL vn2008.desglose_volume (#agency)
</custom>
<sql-batch property="batch">
<custom>
<item name="agency" param="agency"/>
</custom>
</sql-batch>
</db-model> </db-model>
<htk-column-text title="_Province" column="Provincia"/> <htk-column-text title="_Province" column="Provincia"/>
<htk-column-spin title="_Expeditions" column="expediciones"/> <htk-column-spin title="_Expeditions" column="expediciones"/>

View File

@ -13,10 +13,8 @@
<div class="column mansonry" id="news-column"> <div class="column mansonry" id="news-column">
<htk-repeater form-id="new"> <htk-repeater form-id="new">
<db-model property="model"> <db-model property="model">
<custom> SELECT title, date_time, text, image, id FROM news
SELECT title, date_time, text, image, id FROM news ORDER BY priority, date_time DESC
ORDER BY priority, date_time DESC
</custom>
</db-model> </db-model>
<custom> <custom>
<div class="masonry-box"> <div class="masonry-box">

View File

@ -6,11 +6,9 @@
<div class="column mansonry" id="news-column"> <div class="column mansonry" id="news-column">
<htk-repeater form-id="new"> <htk-repeater form-id="new">
<db-model property="model"> <db-model property="model">
<custom> SELECT title, date_time, text, image, id FROM news
SELECT title, date_time, text, image, id FROM news WHERE tag = 'course'
WHERE tag = 'course' ORDER BY priority, date_time DESC
ORDER BY priority, date_time DESC
</custom>
</db-model> </db-model>
<custom> <custom>
<div class="masonry-box"> <div class="masonry-box">

View File

@ -28,13 +28,11 @@
</div> </div>
<htk-repeater form-id="iter" renderer="repeaterFunc"> <htk-repeater form-id="iter" renderer="repeaterFunc">
<db-model id="items" property="model" updatable="true"> <db-model id="items" property="model" updatable="true">
<custom> SELECT i.id, i.amount, i.price, a.Article, a.Categoria,
SELECT i.id, i.amount, i.price, a.Article, a.Categoria, a.Medida, a.Tallos, a.Color, o.Abreviatura, a.Foto
a.Medida, a.Tallos, a.Color, o.Abreviatura, a.Foto FROM basket_item i
FROM basket_item i JOIN vn2008.Articles a ON a.Id_Article = i.item_id
JOIN vn2008.Articles a ON a.Id_Article = i.item_id LEFT JOIN vn2008.Origen o ON a.id_origen = o.id
LEFT JOIN vn2008.Origen o ON a.id_origen = o.id
</custom>
</db-model> </db-model>
<custom> <custom>
<div class="line"> <div class="line">

View File

@ -42,27 +42,22 @@
</sql-filter> </sql-filter>
<db-form id="basket" on-ready="onBasketReady"> <db-form id="basket" on-ready="onBasketReady">
<db-model property="model"> <db-model property="model">
<custom> SELECT o.id, o.date_send, ag.description agency, v.code method
SELECT o.id, o.date_send, ag.description agency, v.code method FROM basket 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 JOIN vn2008.Vistas v ON v.vista_id = o.delivery_method_id
JOIN vn2008.Vistas v ON v.vista_id = o.delivery_method_id
</custom>
</db-model> </db-model>
</db-form> </db-form>
<db-query id="basket-lines"> <db-query id="basket-lines">
<custom> SELECT item_id, warehouse_id, SUM(amount) amount
SELECT item_id, warehouse_id, SUM(amount) amount FROM basket_item
FROM basket_item GROUP BY warehouse_id
GROUP BY warehouse_id
</custom>
</db-query> </db-query>
<db-model <db-model
id="items-model" id="items-model"
result-index="2" result-index="2"
on-status-changed="onItemsChange"> on-status-changed="onItemsChange">
<custom> CREATE TEMPORARY TABLE tmp.bionic_calc
CREATE TEMPORARY TABLE tmp.bionic_calc
(INDEX (item_id)) (INDEX (item_id))
ENGINE=MEMORY ENGINE=MEMORY
SELECT a.Id_Article item_id FROM vn2008.Articles a SELECT a.Id_Article item_id FROM vn2008.Articles a
@ -79,8 +74,7 @@
LEFT JOIN vn_locale.origin_view o ON o.origin_id = a.id_origen LEFT JOIN vn_locale.origin_view o ON o.origin_id = a.id_origen
WHERE b.available > 0 WHERE b.available > 0
ORDER BY a.Article, a.Medida ORDER BY a.Article, a.Medida
LIMIT 400; LIMIT 400;
</custom>
<sql-batch property="batch" id="filter-batch"> <sql-batch property="batch" id="filter-batch">
<custom> <custom>
<item name="filter" object="filter"/> <item name="filter" object="filter"/>
@ -98,12 +92,10 @@
property="model" property="model"
batch="card-batch" batch="card-batch"
on-status-changed-after="onStatusChange"> on-status-changed-after="onStatusChange">
<custom> SELECT a.description, o.str origin
SELECT a.description, o.str origin FROM vn2008.Articles a
FROM vn2008.Articles a LEFT JOIN vn_locale.origin_view o ON o.origin_id = a.id_origen
LEFT JOIN vn_locale.origin_view o ON o.origin_id = a.id_origen WHERE a.Id_Article = #item
WHERE a.Id_Article = #item
</custom>
</db-model> </db-model>
</db-form> </db-form>
<db-model <db-model
@ -111,14 +103,12 @@
result-index="1" result-index="1"
on-status-changed-after="onStatusChange" on-status-changed-after="onStatusChange"
batch="card-batch"> batch="card-batch">
<custom> CALL bionic_from_item (#item);
CALL bionic_from_item (#item); SELECT p.warehouse_id, w.name warehouse, p.grouping, p.price, p.rate, l.available
SELECT p.warehouse_id, w.name warehouse, p.grouping, p.price, p.rate, l.available FROM tmp.bionic_lot l
FROM tmp.bionic_lot l JOIN tmp.bionic_price p ON p.warehouse_id = l.warehouse_id
JOIN tmp.bionic_price p ON p.warehouse_id = l.warehouse_id JOIN vn2008.warehouse w ON w.id = p.warehouse_id
JOIN vn2008.warehouse w ON w.id = p.warehouse_id ORDER BY warehouse_id, grouping;
ORDER BY warehouse_id, grouping;
</custom>
</db-model> </db-model>
</vn-group> </vn-group>
<h1 id="title"> <h1 id="title">
@ -216,13 +206,11 @@
id="realms-model" id="realms-model"
property="model" property="model"
on-status-changed="refreshTitleColor"> on-status-changed="refreshTitleColor">
<custom> SELECT r.id, l.str name, r.color
SELECT r.id, l.str name, r.color FROM vn2008.reinos r
FROM vn2008.reinos r LEFT JOIN vn_locale.realm_view l ON l.realm_id = r.id
LEFT JOIN vn_locale.realm_view l ON l.realm_id = r.id WHERE r.display != FALSE
WHERE r.display != FALSE ORDER BY name
ORDER BY name
</custom>
</db-model> </db-model>
<custom> <custom>
<a id="link" class="clickable"> <a id="link" class="clickable">
@ -247,16 +235,14 @@
conn="conn" conn="conn"
result-index="1" result-index="1"
on-status-changed="refreshTitle"> on-status-changed="refreshTitle">
<custom> CALL item_available ();
CALL item_available (); SELECT DISTINCT t.tipo_id, l.str name
SELECT DISTINCT t.tipo_id, l.str name FROM vn2008.Tipos t
FROM vn2008.Tipos t JOIN vn2008.Articles a ON a.tipo_id = t.tipo_id
JOIN vn2008.Articles a ON a.tipo_id = t.tipo_id LEFT JOIN vn_locale.family_view l ON l.family_id = t.tipo_id
LEFT JOIN vn_locale.family_view l ON l.family_id = t.tipo_id JOIN tmp.item_available i ON i.item_id = a.Id_Article
JOIN tmp.item_available i ON i.item_id = a.Id_Article WHERE #filter
WHERE #filter ORDER BY name
ORDER BY name
</custom>
</db-model> </db-model>
<sql-filter property="filter" type="AND"> <sql-filter property="filter" type="AND">
<sql-filter-item type="EQUAL"> <sql-filter-item type="EQUAL">
@ -269,22 +255,20 @@
placeholder="_Color" placeholder="_Color"
param="color"> param="color">
<db-model property="model" auto-load="false" result-index="1"> <db-model property="model" auto-load="false" result-index="1">
<custom> CALL item_available ();
CALL item_available (); SELECT DISTINCT c.Id_Tinta, l.str name
SELECT DISTINCT c.Id_Tinta, l.str name FROM vn2008.Tintas c
FROM vn2008.Tintas c JOIN vn2008.Articles a ON a.Color = c.Id_Tinta
JOIN vn2008.Articles a ON a.Color = c.Id_Tinta JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id
JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id LEFT JOIN vn_locale.color_view l ON l.color_id = c.Id_Tinta
LEFT JOIN vn_locale.color_view l ON l.color_id = c.Id_Tinta JOIN tmp.item_available i ON i.item_id = a.Id_Article
JOIN tmp.item_available i ON i.item_id = a.Id_Article WHERE #filter
WHERE #filter ORDER BY name
ORDER BY name
</custom>
</db-model> </db-model>
<sql-filter property="filter" always-ready="true" type="AND"> <sql-filter property="filter" always-ready="true" type="AND">
<pointer object="op-realm"/> <pointer object="op-realm"/>
<pointer object="op-type"/> <pointer object="op-type"/>
<pointer object="op-name"/> <pointer object="op-name="/>
<pointer object="op-origin"/> <pointer object="op-origin"/>
<pointer object="op-category"/> <pointer object="op-category"/>
<pointer object="op-producer"/> <pointer object="op-producer"/>
@ -294,21 +278,19 @@
placeholder="_Producer" placeholder="_Producer"
param="producer"> param="producer">
<db-model property="model" auto-load="false" result-index="1"> <db-model property="model" auto-load="false" result-index="1">
<custom> CALL item_available ();
CALL item_available (); SELECT DISTINCT p.producer_id, p.name
SELECT DISTINCT p.producer_id, p.name FROM vn2008.producer p
FROM vn2008.producer p JOIN vn2008.Articles a ON a.producer_id = p.producer_id
JOIN vn2008.Articles a ON a.producer_id = p.producer_id JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id
JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id JOIN tmp.item_available i ON i.item_id = a.Id_Article
JOIN tmp.item_available i ON i.item_id = a.Id_Article WHERE #filter
WHERE #filter ORDER BY name
ORDER BY name
</custom>
</db-model> </db-model>
<sql-filter property="filter" always-ready="true" type="AND"> <sql-filter property="filter" always-ready="true" type="AND">
<pointer object="op-realm"/> <pointer object="op-realm"/>
<pointer object="op-type"/> <pointer object="op-type"/>
<pointer object="op-name"/> <pointer object="op-name="/>
<pointer object="op-origin"/> <pointer object="op-origin"/>
<pointer object="op-color"/> <pointer object="op-color"/>
<pointer object="op-category"/> <pointer object="op-category"/>
@ -318,22 +300,20 @@
placeholder="_Origin" placeholder="_Origin"
param="origin"> param="origin">
<db-model property="model" auto-load="false" result-index="1"> <db-model property="model" auto-load="false" result-index="1">
<custom> CALL item_available ();
CALL item_available (); SELECT DISTINCT o.id, l.str name, o.Abreviatura
SELECT DISTINCT o.id, l.str name, o.Abreviatura FROM vn2008.Origen o
FROM vn2008.Origen o JOIN vn2008.Articles a ON a.id_origen = o.id
JOIN vn2008.Articles a ON a.id_origen = o.id JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id
JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id LEFT JOIN vn_locale.origin_view l ON l.origin_id = o.id
LEFT JOIN vn_locale.origin_view l ON l.origin_id = o.id JOIN tmp.item_available i ON i.item_id = a.Id_Article
JOIN tmp.item_available i ON i.item_id = a.Id_Article WHERE #filter
WHERE #filter ORDER BY name
ORDER BY name
</custom>
</db-model> </db-model>
<sql-filter property="filter" always-ready="true" type="AND"> <sql-filter property="filter" always-ready="true" type="AND">
<pointer object="op-realm"/> <pointer object="op-realm"/>
<pointer object="op-type"/> <pointer object="op-type"/>
<pointer object="op-name"/> <pointer object="op-name="/>
<pointer object="op-color"/> <pointer object="op-color"/>
<pointer object="op-category"/> <pointer object="op-category"/>
<pointer object="op-producer"/> <pointer object="op-producer"/>
@ -343,20 +323,18 @@
placeholder="_Category" placeholder="_Category"
param="category"> param="category">
<db-model property="model" auto-load="false" result-index="1"> <db-model property="model" auto-load="false" result-index="1">
<custom> CALL item_available ();
CALL item_available (); SELECT DISTINCT a.Categoria, a.Categoria category
SELECT DISTINCT a.Categoria, a.Categoria category FROM vn2008.Articles a
FROM vn2008.Articles a JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id
JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id JOIN tmp.item_available i ON i.item_id = a.Id_Article
JOIN tmp.item_available i ON i.item_id = a.Id_Article WHERE #filter
WHERE #filter ORDER BY a.Categoria
ORDER BY a.Categoria
</custom>
</db-model> </db-model>
<sql-filter property="filter" always-ready="true" type="AND"> <sql-filter property="filter" always-ready="true" type="AND">
<pointer object="op-realm"/> <pointer object="op-realm"/>
<pointer object="op-type"/> <pointer object="op-type"/>
<pointer object="op-name"/> <pointer object="op-name="/>
<pointer object="op-color"/> <pointer object="op-color"/>
<pointer object="op-origin"/> <pointer object="op-origin"/>
<pointer object="op-producer"/> <pointer object="op-producer"/>
@ -433,14 +411,14 @@
</p> </p>
<p class="color"> <p class="color">
<t>Color</t> <htk-text lot="card" name="color"/> <t>Color</t> <htk-text lot="card" name="color"/>
<htk-text lot="card" name"Tallos" format="_, %.0d Units"/> <htk-text lot="card" name="Tallos" format="_, %.0d Units"/>
</p> </p>
<p> <p>
<t>Origin</t> <htk-text lot="card-extend" name"origin"/> <t>Origin</t> <htk-text lot="card-extend" name="origin"/>
</p> </p>
</div> </div>
<p class="desc"> <p class="desc">
<htk-text lot="card-extend" name"description" id="desc"/> <htk-text lot="card-extend" name="description" id="desc"/>
</p> </p>
</div> </div>
<htk-grid class="lots-grid" model="item-lots" show-header="false"> <htk-grid class="lots-grid" model="item-lots" show-header="false">

View File

@ -39,11 +39,12 @@ Hedera.Checkout = new Class
date.setHours (0, 0, 0, 0); date.setHours (0, 0, 0, 0);
} }
this.$('date').value = date; this.$('lot').assign ({
this.$('method').value = i.get ('delivery_method'); date: date,
this.$('agency').value = i.get ('agency_id'); method: i.get ('delivery_method'),
this.$('address').value = i.get ('address_id'); agency: i.get ('agency_id'),
address: i.get ('address_id')
});
this.autoStepLocked = false; this.autoStepLocked = false;
} }
@ -58,16 +59,9 @@ Hedera.Checkout = new Class
{ {
this.disableButtons (true); this.disableButtons (true);
var query = 'CALL basketConfigure (#date, #method, #agency, #address)'; var query = 'CALL basketConfigure (#date, #method, #agency, #address)';
var batch = new Sql.Batch ();
batch.addParam ('method', this.$('method'));
batch.addParam ('date', this.$('date'));
batch.addParam ('agency', this.$('agency'));
batch.addParam ('address', this.$('address'));
this.conn.execQuery (query, this.conn.execQuery (query,
this.onBasketConfigured.bind (this), batch); this.onBasketConfigured.bind (this), this.$('lot').params);
} }
,onBasketConfigured: function (resultSet) ,onBasketConfigured: function (resultSet)
@ -82,7 +76,7 @@ Hedera.Checkout = new Class
else else
Htk.Toast.showMessage (_('OrderStarted')); Htk.Toast.showMessage (_('OrderStarted'));
this.hash.setAll ({'form': 'ecomerce/catalog'}); this.hash.setAll ({form: 'ecomerce/catalog'});
} }
,onCancelClick: function () ,onCancelClick: function ()
@ -162,7 +156,7 @@ Hedera.Checkout = new Class
,onAddressClick: function (addressId) ,onAddressClick: function (addressId)
{ {
this.$('address').value = addressId; this.$('lot').set ('address', addressId);
this.goNextStep (); this.goNextStep ();
} }
@ -171,7 +165,7 @@ Hedera.Checkout = new Class
if (this.selectedNode) if (this.selectedNode)
Vn.Node.removeClass (this.selectedNode, 'selected'); Vn.Node.removeClass (this.selectedNode, 'selected');
var row = this.$('addresses').search ('id', this.$('address').value); var row = this.$('addresses').search ('id', this.$('lot').get ('address'));
if (row != -1) if (row != -1)
{ {

View File

@ -1,47 +1,25 @@
<vn> <vn>
<vn-group> <vn-group>
<vn-param id="method"/> <vn-basic-set id="lot" on-change="onAddressChange"/>
<vn-param id="date"/>
<vn-param id="agency"/>
<vn-param id="address" on-changed="onAddressChange"/>
<db-form id="defaults" on-ready="onValuesReady"> <db-form id="defaults" on-ready="onValuesReady">
<db-model property="model"> <db-model property="model">
<custom> SELECT delivery_method, agency_id, address_id
SELECT delivery_method, agency_id, address_id FROM basket_defaults
FROM basket_defaults
</custom>
</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 property="model"> <db-model property="model">
<custom> SELECT d.code delivery_method, o.date_send, o.agency_id, o.address_id
SELECT d.code delivery_method, o.date_send, o.agency_id, o.address_id FROM basket o
FROM basket o JOIN vn.deliveryMethod d ON d.id = o.delivery_method_id
JOIN vn.deliveryMethod d ON d.id = o.delivery_method_id
</custom>
</db-model> </db-model>
</db-form> </db-form>
<db-model id="agencies" auto-load="false" on-status-changed="onAgenciesReady"> <db-model
<custom> id="agencies"
CALL vn.agencyListForMethod(#date, #address, 'AGENCY') lot="lot"
</custom> auto-load="false"
<sql-batch property="batch"> on-status-changed="onAgenciesReady">
<custom> CALL vn.agencyListForMethod(#date, #address, #method)
<item name="address" param="address"/>
<item name="date" param="date"/>
</custom>
</sql-batch>
</db-model>
<db-model id="warehouses" auto-load="false" on-status-changed="onWarehousesReady">
<custom>
CALL vn.agencyListForMethod(#date, #address, 'PICKUP')
</custom>
<sql-batch property="batch">
<custom>
<item name="address" param="address"/>
<item name="date" param="date"/>
</custom>
</sql-batch>
</db-model> </db-model>
</vn-group> </vn-group>
<h1 id="title"> <h1 id="title">
@ -66,6 +44,8 @@
<div class="answers radio"> <div class="answers radio">
<htk-radio-group <htk-radio-group
id="rg-method" id="rg-method"
lot="lot"
name="method"
param="method" param="method"
on-changed="onFieldChange"/> on-changed="onFieldChange"/>
<div> <div>
@ -103,21 +83,19 @@
on-change="onAddressChange" on-change="onAddressChange"
renderer="addressRenderer"> renderer="addressRenderer">
<db-model property="model" id="addresses"> <db-model property="model" id="addresses">
<custom> SELECT a.id, a.consignee, p.name province, a.zip_code, a.city, a.name, a.active, c.Pais country
SELECT a.id, a.consignee, p.name province, a.zip_code, a.city, a.name, a.active, c.Pais country FROM address_view a
FROM address_view a
LEFT JOIN vn2008.province p ON a.province_id = p.province_id LEFT JOIN vn2008.province p ON a.province_id = p.province_id
JOIN vn2008.Paises c ON c.Id = p.Paises_Id JOIN vn2008.Paises c ON c.Id = p.Paises_Id
WHERE active != FALSE WHERE active != FALSE
</custom>
</db-model> </db-model>
<custom> <custom>
<div class="address" id="address"> <div class="address" id="address">
<p class="consignee"> <p class="consignee">
<htk-text lot="iter" name"consignee"/> <htk-text lot="iter" name="consignee"/>
</p> </p>
<p> <p>
<htk-text lot="iter" name"name"/> <htk-text lot="iter" name="name"/>
</p> </p>
</div> </div>
</custom> </custom>
@ -129,7 +107,8 @@
<div class="answers target"> <div class="answers target">
<htk-combo <htk-combo
id="agency-combo" id="agency-combo"
param="agency" lot="lot"
name="agency"
on-changed="onFieldChange" on-changed="onFieldChange"
model="agencies"/> model="agencies"/>
</div> </div>
@ -139,7 +118,8 @@
<div class="answers target"> <div class="answers target">
<htk-combo <htk-combo
id="warehouse-combo" id="warehouse-combo"
param="agency" lot="lot"
name="agency"
on-changed="onFieldChange" on-changed="onFieldChange"
model="warehouses"/> model="warehouses"/>
</div> </div>
@ -152,11 +132,11 @@
<htk-text format="%D" param="date"/> <htk-text format="%D" param="date"/>
</p> </p>
<p> <p>
<htk-text lot="address-form" name"name"/> <htk-text lot="address-form" name="name"/>
</p> </p>
<p> <p>
<t>Agency</t> <t>Agency</t>
<htk-text lot="agency-combo" name"description"/> <htk-text lot="agency-combo" name="description"/>
</p> </p>
<button id="confirm-agency" class="thin" on-click="onConfirmClick"> <button id="confirm-agency" class="thin" on-click="onConfirmClick">
<t>Confirm</t> <t>Confirm</t>
@ -172,7 +152,7 @@
<htk-text format="%D" param="date"/> <htk-text format="%D" param="date"/>
</p> </p>
<p> <p>
<htk-text lot="address-form" name"name"/> <htk-text lot="address-form" name="name"/>
</p> </p>
<p> <p>
<t>ReceiveThroughtRoute</t> <t>ReceiveThroughtRoute</t>
@ -192,7 +172,7 @@
</p> </p>
<p> <p>
<t>Warehouse</t> <t>Warehouse</t>
<htk-text lot="warehouse-combo" name"description"/> <htk-text lot="warehouse-combo" name="description"/>
</p> </p>
<button id="confirm-pickup" class="thin" on-click="onConfirmClick"> <button id="confirm-pickup" class="thin" on-click="onConfirmClick">
<t>Confirm</t> <t>Confirm</t>

View File

@ -50,11 +50,14 @@ Hedera.Confirm = new Class
Htk.Toast.showWarning ( Htk.Toast.showWarning (
_('You have exceeded your credit.')); _('You have exceeded your credit.'));
this.$('debt').value = debt; this.$('lot').assign ({
this.$('total-debt').value = totalDebt; debt: debt,
this.$('total-amount').value = totalDebt; totalDebt: totalDebt,
this.$('credit-excess').value = exceededCredit; totalAmount: totalDebt,
this.$('excess-amount').value = exceededCredit; creditExcess: exceededCredit,
excessAmount: exceededCredit,
payAmount: 'ALL'
});
this.$('pay-amount').value = 'ALL'; this.$('pay-amount').value = 'ALL';
@ -66,7 +69,7 @@ Hedera.Confirm = new Class
{ {
this.$('amount-selector').style.display = 'block'; this.$('amount-selector').style.display = 'block';
this.$('exceeded-info').style.display = 'table-row'; this.$('exceeded-info').style.display = 'table-row';
this.$('pay-amount').value = 'EXCEEDED'; lot.assign ({payAmount: 'EXCEEDED'});
} }
} }
@ -93,7 +96,7 @@ Hedera.Confirm = new Class
for (var i = 0; i < methods.length; i++) for (var i = 0; i < methods.length; i++)
this.$(methods[i] +'-method').style.display = 'block'; this.$(methods[i] +'-method').style.display = 'block';
this.$('pay-method').value = selectedMethod; lot.assign ({payAmount: selectedMethod});
} }
,onPayMethodChange: function (payMethod) ,onPayMethodChange: function (payMethod)

View File

@ -1,32 +1,29 @@
<vn> <vn>
<vn-group> <vn-group>
<vn-basic-set id="lot"/>
<db-form id="order-form" on-ready="onOrderReady"> <db-form id="order-form" on-ready="onOrderReady">
<db-model property="model" result-index="1"> <db-model property="model" result-index="1">
<custom> CALL basket_get_vat ();
CALL basket_get_vat (); SELECT o.id, o.date_send, o.note, o.company_id,
SELECT o.id, o.date_send, o.note, o.company_id, ag.description agency, v.code method,
ag.description agency, v.code method, ad.consignee, ad.zip_code, ad.city, ad.name address,
ad.consignee, ad.zip_code, ad.city, ad.name address, t.*, c.credit, clientGetDebt() debt
t.*, c.credit, clientGetDebt() debt FROM basket 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 JOIN (
JOIN ( 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 FROM t_order_vat
FROM t_order_vat ) t;
) t; DROP TEMPORARY TABLE t_order_vat;
DROP TEMPORARY TABLE t_order_vat;
</custom>
</db-model> </db-model>
</db-form> </db-form>
<db-query id="confirm-query" on-ready="onConfirm"> <db-query id="confirm-query" on-ready="onConfirm">
<custom> CALL basket_confirm ()
CALL basket_confirm ()
</custom>
</db-query> </db-query>
</vn-group> </vn-group>
<h1 id="title"> <h1 id="title">
@ -38,23 +35,23 @@
<div class="delivery"> <div class="delivery">
<p> <p>
<t>Delivery at</t> <t>Delivery at</t>
<htk-text format="%D" lot="order-form" name"date_send"/> <htk-text format="%D" lot="order-form" name="date_send"/>
</p> </p>
<p> <p>
<span id="method"><t>Agency</t></span> <span id="method"><t>Agency</t></span>
<htk-text lot="order-form" name"agency"/> <htk-text lot="order-form" name="agency"/>
</p> </p>
</div> </div>
<div id="address" class="address"> <div id="address" class="address">
<p> <p>
<htk-text lot="order-form" name"consignee"/> <htk-text lot="order-form" name="consignee"/>
</p> </p>
<p> <p>
<htk-text lot="order-form" name"address"/> <htk-text lot="order-form" name="address"/>
</p> </p>
<p> <p>
<htk-text lot="order-form" name"zip_code"/>, <htk-text lot="order-form" name="zip_code"/>,
<htk-text lot="order-form" name"city"/> <htk-text lot="order-form" name="city"/>
</p> </p>
</div> </div>
</div> </div>
@ -68,7 +65,7 @@
<t>Previous balance</t> <t>Previous balance</t>
</td> </td>
<td class="currency"> <td class="currency">
<htk-text format="%.2d€" id="debt"/> <htk-text format="%.2d€" lot="lot" name="debt"/>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -76,7 +73,7 @@
<t>Order total</t> <t>Order total</t>
</td> </td>
<td class="currency"> <td class="currency">
<htk-text format="%.2d€" lot="order-form" name"tax_base"/> <htk-text format="%.2d€" lot="order-form" name="tax_base"/>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -84,7 +81,7 @@
<t>Order VAT</t> <t>Order VAT</t>
</td> </td>
<td class="currency"> <td class="currency">
<htk-text format="%.2d€" lot="order-form" name"vat"/> <htk-text format="%.2d€" lot="order-form" name="vat"/>
</td> </td>
</tr> </tr>
<tr class="total-debt sum-total"> <tr class="total-debt sum-total">
@ -92,7 +89,7 @@
<t>Total debt</t> <t>Total debt</t>
</td> </td>
<td class="currency"> <td class="currency">
<htk-text format="%.2d€" id="total-debt"/> <htk-text format="%.2d€" lot="lot" name="totalDebt"/>
</td> </td>
</tr> </tr>
<tr id="credit-info" class="credit-info"> <tr id="credit-info" class="credit-info">
@ -100,7 +97,7 @@
<t>Credit</t> <t>Credit</t>
</td> </td>
<td class="currency"> <td class="currency">
<htk-text format="%.2d€" lot="order-form" name"credit"/> <htk-text format="%.2d€" lot="order-form" name="credit"/>
</td> </td>
</tr> </tr>
<tr id="exceeded-info" class="exceeded-info sum-total"> <tr id="exceeded-info" class="exceeded-info sum-total">
@ -108,7 +105,7 @@
<t>Exceeded credit</t> <t>Exceeded credit</t>
</td> </td>
<td class="currency"> <td class="currency">
<htk-text format="%.2d€" id="credit-excess"/> <htk-text format="%.2d€" lot="lot" name="creditExcess"/>
</td> </td>
</tr> </tr>
</tbody> </tbody>
@ -125,14 +122,14 @@
<htk-radio radio-group="pay-amount" value="ALL"/> <htk-radio radio-group="pay-amount" value="ALL"/>
<label> <label>
<t>Total debt</t>, <t>Total debt</t>,
<htk-text format="%.2d€" id="total-amount"/> <htk-text format="%.2d€" lot="lot" name="totalAmount"/>
</label> </label>
</div> </div>
<div> <div>
<htk-radio radio-group="pay-amount" value="EXCEEDED"/> <htk-radio radio-group="pay-amount" value="EXCEEDED"/>
<label> <label>
<t>Exceeded credit</t>, <t>Exceeded credit</t>,
<htk-text format="%.2d€" id="excess-amount"/> <htk-text format="%.2d€" lot="lot" name="excessAmount"/>
</label> </label>
</div> </div>
</div> </div>
@ -143,7 +140,8 @@
</h2> </h2>
<div class="pay-methods radio"> <div class="pay-methods radio">
<htk-radio-group <htk-radio-group
id="pay-method" lot="lot"
name="payMethod"
on-changed="onPayMethodChange"/> on-changed="onPayMethodChange"/>
<div id="balance-method"> <div id="balance-method">
<htk-radio radio-group="pay-method" value="BALANCE"/> <htk-radio radio-group="pay-method" value="BALANCE"/>
@ -181,14 +179,14 @@
<custom> <custom>
<div class="transfer-account"> <div class="transfer-account">
<p> <p>
<htk-text lot="iter" name"description"/> <htk-text lot="iter" name="description"/>
</p> </p>
<p> <p>
<htk-text lot="iter" name"iban"/> <htk-text lot="iter" name="iban"/>
<htk-text lot="iter" name"entity_id"/> <htk-text lot="iter" name="entity_id"/>
<htk-text lot="iter" name"office"/> <htk-text lot="iter" name="office"/>
<htk-text lot="iter" name"dc"/> <htk-text lot="iter" name="dc"/>
<htk-text lot="iter" name"number"/> <htk-text lot="iter" name="number"/>
</p> </p>
</div> </div>
</custom> </custom>

View File

@ -7,12 +7,10 @@
<div> <div>
<htk-grid show-header="false"> <htk-grid show-header="false">
<db-model property="model" id="tickets"> <db-model property="model" id="tickets">
<custom> SELECT invoice_id, serial_num, issued, amount
SELECT invoice_id, serial_num, issued, amount FROM invoice_view
FROM invoice_view ORDER BY issued DESC
ORDER BY issued DESC LIMIT 100
LIMIT 100
</custom>
</db-model> </db-model>
<htk-column-text title="_Serial" column="serial_num"/> <htk-column-text title="_Serial" column="serial_num"/>
<htk-column-date title="_Date" column="issued" format="_%e %b %Y"/> <htk-column-date title="_Date" column="issued" format="_%e %b %Y"/>

View File

@ -11,12 +11,12 @@ Hedera.Orders = new Class
}); });
this.tpv.check (this._onTpvCheck.bind (this)); this.tpv.check (this._onTpvCheck.bind (this));
if (!this.$('from').value) if (!this.hash.get ('from'))
{ {
var from = new Date (); var from = new Date ();
from.setDate (from.getDate () - 30); from.setDate (from.getDate () - 30);
from.setHours (0, 0, 0, 0); from.setHours (0, 0, 0, 0);
this.$('from').value = from; this.hash.assign ({from: from});
} }
} }
@ -34,8 +34,8 @@ Hedera.Orders = new Class
,repeaterFunc: function (res, form) ,repeaterFunc: function (res, form)
{ {
res.$('link').href = this.hash.make ({ res.$('link').href = this.hash.make ({
'form': 'ecomerce/ticket', form: 'ecomerce/ticket',
'ticket': form.get ('ticket_id') ticket: form.get ('ticket_id')
}); });
} }

View File

@ -1,12 +1,8 @@
<vn> <vn>
<vn-group> <vn-group>
<vn-param id="from"/>
<vn-hash-param type="Date" key="from" param="from"/>
<db-form id="debt"> <db-form id="debt">
<db-model property="model"> <db-model property="model">
<custom> SELECT clientGetDebt() debt
SELECT clientGetDebt() debt
</custom>
</db-model> </db-model>
</db-form> </db-form>
</vn-group> </vn-group>
@ -30,7 +26,7 @@
<t>Balance:</t> <t>Balance:</t>
</span> </span>
<span class="amount" id="balance"> <span class="amount" id="balance">
<htk-text lot="debt" name"debt" format="%.2d€"/> <htk-text lot="debt" name="debt" format="%.2d€"/>
</span> </span>
<img <img
src="image/icon/dark/info.svg" src="image/icon/dark/info.svg"
@ -43,37 +39,30 @@
<div class="card form"> <div class="card form">
<div> <div>
<label><t>Show orders from</t></label> <label><t>Show orders from</t></label>
<htk-date-chooser param="from"/> <htk-date-chooser lot="hash" name="from"/>
</div> </div>
</div> </div>
<div class="card list"> <div class="card list">
<htk-repeater form-id="iter" renderer="repeaterFunc"> <htk-repeater form-id="iter" renderer="repeaterFunc">
<db-model property="model" id="tickets"> <db-model property="model" id="tickets" lot="hash">
<custom> CALL clientTicketList (#from, NULL)
CALL clientTicketList (#from, NULL)
</custom>
<sql-batch property="batch">
<custom>
<item name="from" param="from"/>
</custom>
</sql-batch>
</db-model> </db-model>
<custom> <custom>
<a id="link" class="list-row" title="_SeeOrder"> <a id="link" class="list-row" title="_SeeOrder">
<p class="important total"> <p class="important total">
<htk-text lot="iter" name"total" format="%.2d€"/> <htk-text lot="iter" name="total" format="%.2d€"/>
</p> </p>
<p class="important"> <p class="important">
<htk-text lot="iter" name"date" format="%D"/> <htk-text lot="iter" name="date" format="%D"/>
</p> </p>
<p> <p>
<htk-text lot="iter" name"consignee"/> <htk-text lot="iter" name="consignee"/>
</p> </p>
<p> <p>
<htk-text lot="iter" name"type"/> <htk-text lot="iter" name="type"/>
</p> </p>
<p> <p>
<htk-text lot="iter" name"ticket_id"/> <htk-text lot="iter" name="ticket_id"/>
</p> </p>
</a> </a>
</custom> </custom>

View File

@ -1,17 +1,8 @@
<vn> <vn>
<vn-group> <vn-group>
<vn-param id="ticket-id" on-changed="onTicketChange"/>
<vn-hash-param key="ticket" param="ticket-id"/>
<db-form id="ticket"> <db-form id="ticket">
<db-model property="model"> <db-model property="model" lot="hash">
<custom> CALL clientTicketGet(#ticket)
CALL clientTicketGet(#ticket)
</custom>
<sql-batch property="batch">
<custom>
<item name="ticket" param="ticket-id"/>
</custom>
</sql-batch>
</db-model> </db-model>
</db-form> </db-form>
</vn-group> </vn-group>
@ -29,67 +20,60 @@
<div class="head"> <div class="head">
<div> <div>
<p class="important ticket-id"> <p class="important ticket-id">
<htk-text name"id" lot="ticket"/> <htk-text name="id" lot="ticket"/>
</p> </p>
<p> <p>
<htk-text lot="ticket" name"delivery" format="%D"/> <htk-text lot="ticket" name="delivery" format="%D"/>
</p> </p>
</div> </div>
<div> <div>
<p> <p>
<t>Delivery</t> <htk-text lot="ticket" name"Agencia"/> <t>Delivery</t> <htk-text lot="ticket" name="Agencia"/>
</p> </p>
<p> <p>
<htk-text lot="ticket" name"consignee"/> <htk-text lot="ticket" name="consignee"/>
</p> </p>
<p> <p>
<htk-text lot="ticket" name"name"/> <htk-text lot="ticket" name="name"/>
</p> </p>
<p> <p>
<htk-text lot="ticket" name"zip_code"/> <htk-text lot="ticket" name="zip_code"/>
<htk-text lot="ticket" name"city"/> <htk-text lot="ticket" name="city"/>
(<htk-text lot="ticket" name"province"/>) (<htk-text lot="ticket" name="province"/>)
</p> </p>
</div> </div>
<div> <div>
<p class="important total"> <p class="important total">
<t>Total</t> <t>Total</t>
<htk-text lot="ticket" name"total" format="%.2d€"/> <htk-text lot="ticket" name="total" format="%.2d€"/>
</p> </p>
<p class="important total"> <p class="important total">
<t>Total + VAT</t> <t>Total + VAT</t>
<htk-text lot="ticket" name"totalPlusVat" format="%.2d€"/> <htk-text lot="ticket" name="totalPlusVat" format="%.2d€"/>
</p> </p>
</div> </div>
</div> </div>
<htk-repeater form-id="iter" renderer="repeaterFunc"> <htk-repeater form-id="iter" renderer="repeaterFunc">
<db-model property="model" id="movements"> <db-model property="model" id="movements" lot="hash">
<custom> CALL clientTicketRowGet(#ticket)
CALL clientTicketRowGet(#ticket)
</custom>
<sql-batch property="batch">
<custom>
<item name="ticket" param="ticket-id"/>
</custom>
</sql-batch>
</db-model> </db-model>
<custom> <custom>
<div class="line"> <div class="line">
<htk-image <htk-image
lot="iter" lot="iter"
name"Foto" name="Foto"
class="photo" class="photo"
directory="catalog" directory="catalog"
subdir="200x200" subdir="200x200"
full-dir="900x900"/> full-dir="900x900"/>
<p class="concept"> <p class="concept">
<htk-text lot="iter" name"concept"/> <htk-text lot="iter" name="concept"/>
<htk-text lot="iter" name"Medida"/> <htk-text lot="iter" name="Medida"/>
<htk-text lot="iter" name"Categoria"/> <htk-text lot="iter" name="Categoria"/>
</p> </p>
<p class="amount"> <p class="amount">
<htk-text lot="iter" name"amount"/> x <htk-text lot="iter" name="amount"/> x
<htk-text lot="iter" name"price" format="%.2d€"/> <htk-text lot="iter" name="price" format="%.2d€"/>
<span class="subtotal"> <span class="subtotal">
<htk-text id="subtotal" format="%.2d€"/> <htk-text id="subtotal" format="%.2d€"/>
</span> </span>

View File

@ -63,7 +63,7 @@ Hedera.New = new Class
,onStatusChange: function (form) ,onStatusChange: function (form)
{ {
if (this.$('new-id').value == 0) if (this.hash.get('new') == 0)
form.insertRow (); form.insertRow ();
} }

View File

@ -1,25 +1,17 @@
<vn> <vn>
<vn-group> <vn-group>
<vn-param id="new-id"/>
<vn-hash-param key="new" param="new-id"/>
<db-form id="iter" on-status-changed="onStatusChange"> <db-form id="iter" on-status-changed="onStatusChange">
<db-model <db-model
id="model" id="model"
property="model" property="model"
updatable="true" updatable="true"
lot="hash"
on-operations-done="onOperationsDone"> on-operations-done="onOperationsDone">
<custom> SELECT id, title, text, tag
SELECT id, title, text, tag FROM news WHERE id = #new
FROM news WHERE id = #new
</custom>
<sql-batch property="batch">
<custom>
<item name="new" param="new-id"/>
</custom>
</sql-batch>
</db-model> </db-model>
</db-form> </db-form>
<vn-param lot="iter" name"text" on-changed="onBodyChange"/> <vn-param lot="iter" name="text" on-changed="onBodyChange"/>
</vn-group> </vn-group>
<h1 id="title"> <h1 id="title">
<t>AddEditNew</t> <t>AddEditNew</t>
@ -38,16 +30,14 @@
<div class="card form"> <div class="card form">
<div> <div>
<label><t>Title</t></label> <label><t>Title</t></label>
<htk-entry lot="iter" name"title"/> <htk-entry lot="iter" name="title"/>
</div> </div>
<div> <div>
<label><t>Tag</t></label> <label><t>Tag</t></label>
<htk-combo lot="iter" name"tag"> <htk-combo lot="iter" name="tag">
<db-model property="model"> <db-model property="model">
<custom> SELECT name, description FROM news_tag
SELECT name, description FROM news_tag ORDER BY description
ORDER BY description
</custom>
</db-model> </db-model>
</htk-combo> </htk-combo>
</div> </div>

View File

@ -12,26 +12,24 @@
<div class="card"> <div class="card">
<htk-repeater form-id="iter" renderer="repeaterFunc"> <htk-repeater form-id="iter" renderer="repeaterFunc">
<db-model property="model" id="news-model" updatable="true"> <db-model property="model" id="news-model" updatable="true">
<custom> SELECT n.id, c.Cliente, priority, image, title
SELECT n.id, c.Cliente, priority, image, title FROM news n
FROM news n
JOIN vn2008.Clientes c ON n.user_id = c.Id_Cliente JOIN vn2008.Clientes c ON n.user_id = c.Id_Cliente
ORDER BY priority, n.date_time DESC ORDER BY priority, n.date_time DESC
</custom>
</db-model> </db-model>
<custom> <custom>
<a id="link" class="list-row" title="_EditNew"> <a id="link" class="list-row" title="_EditNew">
<div class="actions"> <div class="actions">
<htk-button <htk-button
lot="iter" lot="iter"
name"id" name="id"
tip="_Remove" tip="_Remove"
icon="delete" icon="delete"
on-click="onDeleteClick"/> on-click="onDeleteClick"/>
</div> </div>
<htk-image <htk-image
lot="iter" lot="iter"
name"image" name="image"
class="photo" class="photo"
directory="news" directory="news"
subdir="200x200" subdir="200x200"
@ -39,14 +37,14 @@
editable="true" editable="true"
conn="conn"/> conn="conn"/>
<p class="important"> <p class="important">
<htk-text lot="iter" name"title"/> <htk-text lot="iter" name="title"/>
</p> </p>
<p> <p>
<htk-text lot="iter" name"Cliente"/> <htk-text lot="iter" name="Cliente"/>
</p> </p>
<p> <p>
<t>Priority</t> <t>Priority</t>
<htk-text lot="iter" name"priority"/> <htk-text lot="iter" name="priority"/>
</p> </p>
</a> </a>
</custom> </custom>

View File

@ -271,6 +271,9 @@ Model.implement
this._setStatus (Status.CLEAN); this._setStatus (Status.CLEAN);
} }
/**
* Deprecated.
*/
,loadXml: function (builder, node) ,loadXml: function (builder, node)
{ {
this.parent (builder, node); this.parent (builder, node);
@ -281,6 +284,12 @@ Model.implement
this.query = query; this.query = query;
} }
,appendChild: function (child)
{
if (child.nodeType === Node.TEXT_NODE)
this.query = child.textContent;
}
,_autoLoad: function () ,_autoLoad: function ()
{ {
if (this.autoLoad) if (this.autoLoad)
@ -289,39 +298,43 @@ Model.implement
this.clean (); this.clean ();
} }
/**
* Checks wether the model is ready to execute its query.
*
* @return {Boolean} %true if its ready, %false otherwise
*/
,isReady: function ()
{
if (!this._stmt || !this._conn)
return false;
var ids = this._stmt.findHolders ();
if (!ids)
return true;
if (!this._lot)
return false;
var lotParams = this._lot.params;
for (var i = 0; i < ids.length; i++)
if (lotParams[ids[i]] === undefined)
return false;
return true;
}
/** /**
* Refresh the model data reexecuting the query on the database. * Refresh the model data reexecuting the query on the database.
*/ */
,refresh: function () ,refresh: function ()
{ {
var ready = false; if (this.isReady ())
if (this._stmt && this._conn)
{
var ids = this._stmt.findHolders ();
if (ids)
{
if (this._batch && this._batch.isReady ())
{
ready = true;
for (var i = 0; i < ids.length; i++)
if (!this._batch.get (ids[i]))
{
ready = false;
break;
}
}
}
else
ready = true;
}
if (ready)
{ {
var params = this._lot ? this._lot.params : null;
this._setStatus (Status.LOADING); this._setStatus (Status.LOADING);
this._conn.execStmt (this._stmt, this._selectDone.bind (this), this._batch); this._conn.execStmt (this._stmt, this._selectDone.bind (this), params);
} }
else else
this.clean (); this.clean ();

View File

@ -181,7 +181,7 @@ module.exports = new Class
({ ({
lot: this._hash, lot: this._hash,
type: Boolean, type: Boolean,
key: 'guest' name: 'guest'
}); });
this.link ({_isGuest: isGuest}, {'changed': this._onGuestChange}); this.link ({_isGuest: isGuest}, {'changed': this._onGuestChange});
@ -189,7 +189,7 @@ module.exports = new Class
({ ({
lot: this._hash, lot: this._hash,
type: String, type: String,
key: 'token' name: 'token'
}); });
this.link ({_token: token}, {'changed': this._onTokenChange}); this.link ({_token: token}, {'changed': this._onTokenChange});
} }

View File

@ -40,7 +40,6 @@
left: 0; left: 0;
display: none; display: none;
border: none; border: none;
background-color: transparent;
padding: 0 .4em; padding: 0 .4em;
margin: 0; margin: 0;
height: 100%; height: 100%;
@ -61,6 +60,9 @@
padding: .8em .6em; padding: .8em .6em;
padding-right: .3em; padding-right: .3em;
margin: 0; margin: 0;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
} }
.vn-gui .navbar > .htk-spinner .vn-gui .navbar > .htk-spinner
{ {

View File

@ -80,7 +80,7 @@ module.exports = new Class
this.formParam = new Vn.Param ({ this.formParam = new Vn.Param ({
lot: this.hash, lot: this.hash,
type: String, type: String,
key: 'form' name: 'form',
}); });
this.formParam.on ('changed', this._onFormChange, this); this.formParam.on ('changed', this._onFormChange, this);

View File

@ -112,21 +112,21 @@ module.exports = new Class
* *
* @param {Boolean} editable Whether the user is allowed to edit the entry * @param {Boolean} editable Whether the user is allowed to edit the entry
*/ */
,setEditable: function (editable) {} ,setEditable: function () {}
/** /**
* Virtual method that must be implemented by class childs to put the value * Virtual method that must be implemented by class childs to put the value
* on the associated entry. * on the associated entry.
* *
* @param {Object} value The new value for the entry * @param {*} value The new value for the entry
*/ */
,putValue: function (value) {} ,putValue: function () {}
/** /**
* Protected method that should be called from class childs when the value * Protected method that should be called from class childs when the value
* on the associated entry changes. * on the associated entry changes.
* *
* @param {Object} value The new entry value * @param {*} value The new entry value
*/ */
,valueChanged: function (value) ,valueChanged: function (value)
{ {

View File

@ -26,7 +26,7 @@ module.exports = new Class
/** /**
* Through the query looking for containers and adds it to the batch. * Through the query looking for containers and adds it to the batch.
* *
* @return {Object} The found statement parameters * @return {Array} An array with the names of the found parameters
*/ */
,findHolders: function () {} ,findHolders: function () {}
}); });

View File

@ -334,12 +334,11 @@ module.exports = new Class
for (var i = 0; i < childNodes.length; i++) for (var i = 0; i < childNodes.length; i++)
{ {
var child = childNodes[i]; var child = childNodes[i];
var childContext = null;
if (child.nodeType !== Node.ELEMENT_NODE) var childTagName = null;
continue;
var childContext; if (child.nodeType === Node.ELEMENT_NODE)
var childTagName = child.tagName.toLowerCase (); childTagName = child.tagName.toLowerCase ();
if (childTagName === 'pointer') if (childTagName === 'pointer')
{ {
@ -351,8 +350,11 @@ module.exports = new Class
} }
else if (childContext = this._compileNode (child)) else if (childContext = this._compileNode (child))
{ {
var prop = child.getAttribute ('property'); var prop = null;
if (childTagName)
prop = child.getAttribute ('property');
if (prop) if (prop)
{ {
prop = prop.replace (/-./g, this._replaceFunc); prop = prop.replace (/-./g, this._replaceFunc);

View File

@ -23,17 +23,17 @@ module.exports = new Class
return this._param; return this._param;
} }
}, },
key: name:
{ {
type: String type: String
,set: function (x) ,set: function (x)
{ {
this._key = x; this._name = x;
this._onLotChange (); this._onLotChange ();
} }
,get: function () ,get: function ()
{ {
return this._key; return this._name;
} }
}, },
value: value:
@ -96,16 +96,16 @@ module.exports = new Class
,_paramLock: false ,_paramLock: false
,_value: undefined ,_value: undefined
,_lot: null ,_lot: null
,_key: null ,_name: null
,_type: null ,_type: null
,_oneWay: false ,_oneWay: false
,_onLotChange: function () ,_onLotChange: function ()
{ {
if (this._lotLock || !this._key || !this._lot) if (this._lotLock || !this._name || !this._lot)
return; return;
var newValue = this._lot.get (this._key, this._type); var newValue = this._lot.get (this._name, this._type);
this._lotLock = true; this._lotLock = true;
this._setValue (newValue, true); this._setValue (newValue, true);
@ -122,10 +122,10 @@ module.exports = new Class
this._value = newValue; this._value = newValue;
if (this._lot && this._key && !this._lotLock && !this._oneWay) if (this._lot && this._name && !this._lotLock && !this._oneWay)
{ {
this._lotLock = true; this._lotLock = true;
this._lot.set (this._key, newValue); this._lot.set (this._name, newValue);
this._lotLock = false; this._lotLock = false;
} }

View File

@ -1,59 +1,55 @@
<vn> <vn>
<vn-group> <vn-group>
<db-form id="ticket"> <db-form id="ticket">
<db-model property="model" id="ticket-data" conn="conn" batch="batch"> <db-model property="model" id="ticket-data" conn="conn" lot="hash">
<custom> CALL clientTicketGet(#ticket)
CALL clientTicketGet(#ticket)
</custom>
</db-model> </db-model>
</db-form> </db-form>
</vn-group> </vn-group>
<div id="report" class="sheet"> <div id="report" class="sheet">
<h2> <h2>
<htk-text name"id" lot="ticket"/> <htk-text name="id" lot="ticket"/>
</h2> </h2>
<div class="header"> <div class="header">
<p> <p>
<htk-text lot="ticket" name"consignee"/> <htk-text lot="ticket" name="consignee"/>
</p> </p>
<p> <p>
<htk-text lot="ticket" name"date" format="%D"/> <htk-text lot="ticket" name="date" format="%D"/>
</p> </p>
<p> <p>
<htk-text lot="ticket" name"name"/> <htk-text lot="ticket" name="name"/>
</p> </p>
<p> <p>
<htk-text lot="ticket" name"zip_code"/> <htk-text lot="ticket" name="zip_code"/>
<htk-text lot="ticket" name"city"/> <htk-text lot="ticket" name="city"/>
(<htk-text lot="ticket" name"province"/>) (<htk-text lot="ticket" name="province"/>)
</p> </p>
<p> <p>
<t>Delivery</t> <htk-text lot="ticket" name"Agencia"/> <t>Delivery</t> <htk-text lot="ticket" name="Agencia"/>
</p> </p>
</div> </div>
<htk-grid> <htk-grid>
<db-model property="model" id="movements" conn="conn" batch="batch"> <db-model property="model" id="movements" conn="conn" lot="hash">
<custom> CALL clientTicketRowGet(#ticket)
CALL clientTicketRowGet(#ticket)
</custom>
</db-model> </db-model>
<htk-column-spin title="_Ref" name"item"/> <htk-column-spin title="_Ref" name="item"/>
<htk-column-spin title="_Amount" name"amount"/> <htk-column-spin title="_Amount" name="amount"/>
<htk-column-text title="_Item" name"concept"/> <htk-column-text title="_Item" name="concept"/>
<htk-column-text title="_S1" name"Medida"/> <htk-column-text title="_S1" name="Medida"/>
<htk-column-text title="_Cat" name"Categoria"/> <htk-column-text title="_Cat" name="Categoria"/>
<htk-column-text title="_Color" name"Color"/> <htk-column-text title="_Color" name="Color"/>
<htk-column-spin title="_Price" name"price" unit="€" digits="2"/> <htk-column-spin title="_Price" name="price" unit="€" digits="2"/>
<htk-column-spin title="_Import" unit="€" digits="2" renderer="subtotalRenderer"/> <htk-column-spin title="_Import" unit="€" digits="2" renderer="subtotalRenderer"/>
</htk-grid> </htk-grid>
<div class="footer"> <div class="footer">
<p> <p>
<t>Total</t> <t>Total</t>
<htk-text lot="ticket" name"total" format="%.2d€"/> <htk-text lot="ticket" name="total" format="%.2d€"/>
</p> </p>
<p> <p>
<t>Total + VAT</t> <t>Total + VAT</t>
<htk-text lot="ticket" name"totalPlusVat" format="%.2d€"/> <htk-text lot="ticket" name="totalPlusVat" format="%.2d€"/>
</p> </p>
</div> </div>
</div> </div>

View File

@ -6,11 +6,9 @@
<htk-grid> <htk-grid>
<db-model <db-model
property="model" property="model"
batch="batch" lot="hash"
conn="conn"> conn="conn">
<custom> CALL item_list (#warehouse, CURDATE(), #realm, #rate)
CALL item_list (#warehouse, CURDATE(), #realm, #rate)
</custom>
</db-model> </db-model>
<htk-column-image <htk-column-image
column="Foto" column="Foto"

View File

@ -8,20 +8,21 @@ Hedera.ShelvesReport = new Class
,trayThickness: 2 ,trayThickness: 2
,trayMargin: 5 ,trayMargin: 5
,activate: function (batch) ,activate: function (lot)
{ {
this.title = batch.getValue ('reportTitle'); this.title = lot.get ('reportTitle');
this.maxAmount = batch.getValue ('maxAmount'); this.maxAmount = lot.get ('maxAmount');
this.showPacking = batch.getValue ('showPacking'); this.showPacking = lot.get ('showPacking');
this.stack = batch.getValue ('stack'); this.stack = lot.get ('stack');
this.useIds = batch.getValue ('useIds'); this.useIds = lot.get ('useIds');
var query = var query =
'SELECT id, name, nTrays, topTrayHeight, trayHeight, width, depth '+ 'SELECT id, name, nTrays, topTrayHeight, trayHeight, width, depth '+
'FROM shelf WHERE id = #shelf; '+ 'FROM shelf WHERE id = #shelf; '+
'CALL itemAllocator (#warehouse, #date, #family, #namePrefix, #useIds)'; 'CALL itemAllocator (#warehouse, #date, #family, #namePrefix, #useIds)';
this.conn.execQuery (query, this.onQueryExec.bind (this), this.batch); this.conn.execQuery (query,
this.onQueryExec.bind (this), lot);
} }
,onQueryExec: function (resultSet) ,onQueryExec: function (resultSet)