forked from verdnatura/hedera-web
DB refactor
This commit is contained in:
parent
bc083a94e6
commit
52a0b588ec
|
@ -1,4 +1,4 @@
|
|||
hedera-web (1.405.58) stable; urgency=low
|
||||
hedera-web (1.405.59) stable; urgency=low
|
||||
|
||||
* Initial Release.
|
||||
|
||||
|
|
|
@ -5,15 +5,15 @@ Hedera.AddressList = new Class
|
|||
|
||||
,activate: function ()
|
||||
{
|
||||
this.$('user-model').setInfo ('c', 'customer_view', 'hedera');
|
||||
this.$('addresses').setInfo ('a', 'address_view', 'hedera');
|
||||
this.$('user-model').setInfo ('c', 'myClient', 'hedera');
|
||||
this.$('addresses').setInfo ('a', 'myAddress', 'hedera');
|
||||
}
|
||||
|
||||
,onAddAddressClick: function ()
|
||||
{
|
||||
this.hash.set ({
|
||||
'form': 'account/address',
|
||||
'address': 0
|
||||
form: 'account/address',
|
||||
address: 0
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -34,8 +34,8 @@ Hedera.AddressList = new Class
|
|||
,onEditAddressClick: function (button, form)
|
||||
{
|
||||
this.hash.set ({
|
||||
'form': 'account/address',
|
||||
'address': form.get ('id')
|
||||
form: 'account/address',
|
||||
address: form.get ('id')
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -3,19 +3,19 @@
|
|||
<db-form id="user-form">
|
||||
<db-model property="model" id="user-model" updatable="true">
|
||||
<custom>
|
||||
SELECT user_id, default_address
|
||||
FROM customer_view c
|
||||
SELECT id, defaultAddressFk
|
||||
FROM myClient c
|
||||
</custom>
|
||||
</db-model>
|
||||
</db-form>
|
||||
<db-model id="addresses" updatable="true">
|
||||
<custom>
|
||||
SELECT a.id, a.consignee, p.name province, a.zip_code,
|
||||
a.city, a.name, a.active, c.Pais country
|
||||
FROM address_view a
|
||||
LEFT JOIN vn2008.province p ON a.province_id = p.province_id
|
||||
JOIN vn2008.Paises c ON c.Id = p.Paises_Id
|
||||
WHERE active != FALSE
|
||||
SELECT a.id, a.nickname, p.name province, a.postalCode,
|
||||
a.city, a.street, a.active, c.country
|
||||
FROM myAddress a
|
||||
LEFT JOIN vn.province p ON p.id = a.provinceFk
|
||||
JOIN vn.country c ON c.id = p.countryFk
|
||||
WHERE a.active != FALSE
|
||||
</custom>
|
||||
</db-model>
|
||||
</vn-group>
|
||||
|
@ -32,7 +32,7 @@
|
|||
<div class="box">
|
||||
<htk-radio-group
|
||||
id="default-address"
|
||||
column="default_address"
|
||||
column="defaultAddressFk"
|
||||
form="user-form"/>
|
||||
<htk-repeater model="addresses" form-id="iter">
|
||||
<custom>
|
||||
|
@ -57,13 +57,13 @@
|
|||
on-click="onEditAddressClick"/>
|
||||
</div>
|
||||
<p class="important">
|
||||
<htk-text form="iter" column="consignee"/>
|
||||
<htk-text form="iter" column="nickname"/>
|
||||
</p>
|
||||
<p>
|
||||
<htk-text form="iter" column="name"/>
|
||||
<htk-text form="iter" column="street"/>
|
||||
</p>
|
||||
<p>
|
||||
<htk-text form="iter" column="zip_code"/>,
|
||||
<htk-text form="iter" column="postalCode"/>,
|
||||
<htk-text form="iter" column="city"/>
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
@ -5,8 +5,8 @@ Hedera.Address = new Class
|
|||
|
||||
,activate: function ()
|
||||
{
|
||||
this.$('model').setInfo ('a', 'address_view', 'hedera', ['id'], 'id');
|
||||
this.$('model').setDefault ('customer_id', 'a',
|
||||
this.$('model').setInfo ('a', 'myAddress', 'hedera', ['id'], 'id');
|
||||
this.$('model').setDefault ('clientFk', 'a',
|
||||
new Sql.Function ({schema: 'account', name: 'userGetId'}));
|
||||
}
|
||||
|
||||
|
|
|
@ -10,11 +10,12 @@
|
|||
mode="ON_DEMAND"
|
||||
on-operations-done="onOperationsDone">
|
||||
<custom>
|
||||
SELECT a.id, a.name, a.consignee, a.city, a.zip_code, a.province_id, c.Id country_id
|
||||
FROM address_view a
|
||||
LEFT JOIN vn2008.province p ON p.province_id = a.province_id
|
||||
JOIN vn2008.Paises c ON c.Id = p.Paises_Id
|
||||
WHERE active != FALSE AND a.id = #address
|
||||
SELECT a.id, a.street, a.nickname, a.city,
|
||||
a.postalCode, a.provinceFk, c.id countryFk
|
||||
FROM myAddress a
|
||||
LEFT JOIN vn.province p ON p.id = a.provinceFk
|
||||
JOIN vn.country c ON c.id = p.countryFk
|
||||
WHERE a.active AND a.id = #address
|
||||
</custom>
|
||||
<sql-batch property="batch">
|
||||
<custom>
|
||||
|
@ -42,11 +43,11 @@
|
|||
<div class="form">
|
||||
<div class="form-group">
|
||||
<label><t>Name</t></label>
|
||||
<htk-entry column="consignee" form="iter"/>
|
||||
<htk-entry column="nickname" form="iter"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label><t>Address</t></label>
|
||||
<htk-entry column="name" form="iter"/>
|
||||
<htk-entry column="street" form="iter"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label><t>City</t></label>
|
||||
|
@ -54,7 +55,7 @@
|
|||
</div>
|
||||
<div class="form-group">
|
||||
<label><t>ZipCode</t></label>
|
||||
<htk-entry column="zip_code" form="iter"/>
|
||||
<htk-entry column="postalCode" form="iter"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label><t>Country</t></label>
|
||||
|
@ -63,23 +64,23 @@
|
|||
id="country"
|
||||
property="param"
|
||||
form="iter"
|
||||
column="country_id"
|
||||
column="countryFk"
|
||||
one-way="true"/>
|
||||
<db-model property="model">
|
||||
<custom>
|
||||
SELECT Id, Pais FROM vn2008.Paises
|
||||
ORDER BY Pais
|
||||
SELECT id, country FROM vn.country
|
||||
ORDER BY country
|
||||
</custom>
|
||||
</db-model>
|
||||
</htk-combo>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label><t>Province</t></label>
|
||||
<htk-combo column="province_id" form="iter">
|
||||
<htk-combo column="provinceFk" form="iter">
|
||||
<db-model property="model">
|
||||
<custom>
|
||||
SELECT province_id, name FROM vn2008.province
|
||||
WHERE Paises_Id = #country
|
||||
SELECT id, name FROM vn.province
|
||||
WHERE countryFk = #country
|
||||
ORDER BY name
|
||||
</custom>
|
||||
<sql-batch property="batch">
|
||||
|
|
|
@ -5,8 +5,7 @@ Hedera.Conf = new Class
|
|||
|
||||
,activate: function ()
|
||||
{
|
||||
this.$('user-model').setInfo ('c', 'customer_view', 'hedera');
|
||||
this.$('addresses').setInfo ('a', 'address_view', 'hedera');
|
||||
this.$('user-model').setInfo ('c', 'myClient', 'hedera');
|
||||
}
|
||||
|
||||
,onPassChangeClick: function ()
|
||||
|
@ -38,8 +37,8 @@ Hedera.Conf = new Class
|
|||
throw new Error (_('Passwords doesn\'t match'));
|
||||
|
||||
var params = {
|
||||
'oldPassword': oldPassword,
|
||||
'newPassword': newPassword
|
||||
oldPassword: oldPassword,
|
||||
newPassword: newPassword
|
||||
};
|
||||
this.conn.send ('core/change-password', params,
|
||||
this._onPassChange.bind (this));
|
||||
|
@ -72,7 +71,7 @@ Hedera.Conf = new Class
|
|||
|
||||
,onAddressesClick: function ()
|
||||
{
|
||||
this.hash.set ({'form': 'account/address-list'});
|
||||
this.hash.set ({form: 'account/address-list'});
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -12,23 +12,13 @@
|
|||
<db-model property="model" id="user-model" updatable="true">
|
||||
<custom>
|
||||
SELECT u.id, u.name, u.email, u.recoverPass,
|
||||
u.nickname, u.lang, c.mail, c.user_id
|
||||
u.nickname, u.lang, c.isToBeMailed, c.id clientFk
|
||||
FROM account.userView u
|
||||
LEFT JOIN customer_view c
|
||||
ON u.id = c.user_id
|
||||
LEFT JOIN myClient c
|
||||
ON u.id = c.id
|
||||
</custom>
|
||||
</db-model>
|
||||
</db-form>
|
||||
<db-model id="addresses" updatable="true">
|
||||
<custom>
|
||||
SELECT a.id, a.consignee, p.name province,
|
||||
a.zip_code, a.city, a.name, a.active, c.Pais country
|
||||
FROM address_view a
|
||||
LEFT JOIN vn2008.province p ON a.province_id = p.province_id
|
||||
JOIN vn2008.Paises c ON c.Id = p.Paises_Id
|
||||
WHERE active
|
||||
</custom>
|
||||
</db-model>
|
||||
</vn-group>
|
||||
<div id="title">
|
||||
<h1><t>Configuration</t></h1>
|
||||
|
@ -70,7 +60,7 @@
|
|||
</div>
|
||||
<div class="form-group">
|
||||
<label for="mail"><t>Receive invoices by email</t></label>
|
||||
<htk-check form="user-form" column="mail"/>
|
||||
<htk-check form="user-form" column="isToBeMailed"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -24,7 +24,7 @@ Hedera.Orders = new Class
|
|||
{
|
||||
res.$('link').href = this.hash.make ({
|
||||
form: 'ecomerce/ticket',
|
||||
ticket: form.get ('ticket_id')
|
||||
ticket: form.get ('id')
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
<htk-repeater form-id="iter" renderer="repeaterFunc">
|
||||
<db-model property="model" id="tickets">
|
||||
<custom>
|
||||
CALL ticket_list ();
|
||||
CALL myTicketList (NULL, NULL);
|
||||
</custom>
|
||||
</db-model>
|
||||
<custom>
|
||||
|
@ -53,16 +53,16 @@
|
|||
<htk-text form="iter" column="total" format="%.2d€"/>
|
||||
</p>
|
||||
<p class="important">
|
||||
<htk-text form="iter" column="date" format="%D"/>
|
||||
<htk-text form="iter" column="landed" format="%D"/>
|
||||
</p>
|
||||
<p>
|
||||
@<htk-text form="iter" column="ticket_id"/>
|
||||
@<htk-text form="iter" column="id"/>
|
||||
</p>
|
||||
<p>
|
||||
<htk-text form="iter" column="consignee"/>
|
||||
<htk-text form="iter" column="nickname"/>
|
||||
</p>
|
||||
<p>
|
||||
<htk-text form="iter" column="type"/>
|
||||
<htk-text form="iter" column="agency"/>
|
||||
</p>
|
||||
<div class="clear"/>
|
||||
</a>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
,"Delivery": "Entrega"
|
||||
,"Total": "Total"
|
||||
,"Total + tax": "Total + IVA"
|
||||
,"Tax base": "Base imposable"
|
||||
,"VAT": "IVA"
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
,"Delivery": "Delivery"
|
||||
,"Total": "Total"
|
||||
,"Total + tax": "Total + tax"
|
||||
,"Tax base": "Tax base"
|
||||
,"VAT": "VAT"
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
,"Delivery": "Entrega"
|
||||
,"Total": "Total"
|
||||
,"Total + tax": "Total + IVA"
|
||||
,"Tax base": "Base imponible"
|
||||
,"VAT": "IVA"
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
,"Delivery": "Livraison"
|
||||
,"Total": "Total"
|
||||
,"Total + tax": "Total + impôt"
|
||||
,"Tax base": "Imposable"
|
||||
,"VAT": "TVA"
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
,"Delivery": "Delivery"
|
||||
,"Total": "Total"
|
||||
,"Total + tax": "Total + tax"
|
||||
,"Tax base": "Tax base"
|
||||
,"VAT": "VAT"
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
,"Delivery": "Entrega"
|
||||
,"Total": "Total"
|
||||
,"Total + tax": "Total + imposto"
|
||||
,"Tax base": "Tributável"
|
||||
,"VAT": "IVA"
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@ Hedera.Ticket = new Class
|
|||
|
||||
var batch = new Sql.Batch ();
|
||||
batch.addValue ('ticket', ticket.value);
|
||||
this.conn.execQuery ('CALL ticketLog (#ticket)', null, batch);
|
||||
this.conn.execQuery ('CALL myTicketLogAccess (#ticket)', null, batch);
|
||||
}
|
||||
|
||||
,onPrintClick: function (event)
|
||||
,onPrintClick: function ()
|
||||
{
|
||||
var batch = new Sql.Batch ();
|
||||
batch.addValue ('ticket', this.$('ticket-id').value);
|
||||
|
@ -34,11 +34,7 @@ Hedera.Ticket = new Class
|
|||
{
|
||||
var price = form.get ('price');
|
||||
var discount = form.get ('discount');
|
||||
|
||||
if (price && form.get ('fixed'))
|
||||
return form.get ('amount') * price * ((100 - discount) / 100);
|
||||
else
|
||||
return null;
|
||||
return form.get ('quantity') * price * ((100 - discount) / 100);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -5,13 +5,7 @@
|
|||
<db-form id="ticket">
|
||||
<db-model id="ticket-data" property="model">
|
||||
<custom>
|
||||
SELECT t.id, date, a.Agencia, note, p.name province,
|
||||
zip_code, city, c.name, consignee, invoice, delivery
|
||||
FROM ticket_view t
|
||||
JOIN address_view c ON t.address_id = c.id
|
||||
JOIN vn2008.Agencias a ON t.agency_id = a.Id_Agencia
|
||||
JOIN vn2008.province p ON c.province_id = p.province_id
|
||||
WHERE t.id = #ticket
|
||||
CALL myTicketGet (#ticket)
|
||||
</custom>
|
||||
<sql-batch property="batch">
|
||||
<custom>
|
||||
|
@ -38,21 +32,21 @@
|
|||
<htk-text column="id" form="ticket"/>
|
||||
</p>
|
||||
<p>
|
||||
<htk-text form="ticket" column="delivery" format="%D"/>
|
||||
<htk-text form="ticket" column="landed" format="%D"/>
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<p>
|
||||
<t>Delivery</t> <htk-text form="ticket" column="Agencia"/>
|
||||
<t>Delivery</t> <htk-text form="ticket" column="agency"/>
|
||||
</p>
|
||||
<p>
|
||||
<htk-text form="ticket" column="consignee"/>
|
||||
<htk-text form="ticket" column="nickname"/>
|
||||
</p>
|
||||
<p>
|
||||
<htk-text form="ticket" column="name"/>
|
||||
<htk-text form="ticket" column="street"/>
|
||||
</p>
|
||||
<p>
|
||||
<htk-text form="ticket" column="zip_code"/>
|
||||
<htk-text form="ticket" column="postalCode"/>
|
||||
<htk-text form="ticket" column="city"/>
|
||||
(<htk-text form="ticket" column="province"/>)
|
||||
</p>
|
||||
|
@ -60,23 +54,18 @@
|
|||
<div>
|
||||
<p class="important total">
|
||||
<t>Total</t>
|
||||
<htk-text format="%.2d€">
|
||||
<db-calc-sum property="param" func="subtotal" model="movements"/>
|
||||
</htk-text>
|
||||
<htk-text format="%.2d€" form="ticket" column="taxBase"/>
|
||||
</p>
|
||||
<p class="important total">
|
||||
<t>Total + tax</t>
|
||||
<htk-text format="%.2d€" form="ticket" column="total"/>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<htk-repeater form-id="iter" renderer="repeaterFunc">
|
||||
<db-model property="model" id="movements">
|
||||
<custom>
|
||||
SELECT m.item_id, amount, concept, Categoria, Medida, Tallos, Color,
|
||||
Abreviatura, IF(fixed != FALSE, price, NULL) price, fixed, discount
|
||||
FROM ticket_row_view m
|
||||
INNER JOIN vn2008.Articles a
|
||||
ON m.item_id = a.Id_Article AND ticket_id = #ticket
|
||||
LEFT JOIN vn2008.Origen o
|
||||
ON a.id_origen = o.id
|
||||
ORDER BY concept
|
||||
CALL myTicketGetRows (#ticket)
|
||||
</custom>
|
||||
<sql-batch property="batch">
|
||||
<custom>
|
||||
|
@ -88,11 +77,11 @@
|
|||
<div class="line">
|
||||
<p class="concept">
|
||||
<htk-text form="iter" column="concept"/>
|
||||
<htk-text form="iter" column="Medida"/>
|
||||
<htk-text form="iter" column="Categoria"/>
|
||||
<htk-text form="iter" column="size"/>
|
||||
<htk-text form="iter" column="category"/>
|
||||
</p>
|
||||
<p class="amount">
|
||||
<htk-text form="iter" column="amount"/> x
|
||||
<htk-text form="iter" column="quantity"/> x
|
||||
<htk-text form="iter" column="price" format="%.2d€"/>
|
||||
</p>
|
||||
<p class="subtotal">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "hedera-web",
|
||||
"version": "1.405.58",
|
||||
"version": "1.405.59",
|
||||
"description": "Verdnatura web page",
|
||||
"license": "GPL-3.0",
|
||||
"repository": {
|
||||
|
|
|
@ -12,10 +12,6 @@ Hedera.DeliveryNote = new Class
|
|||
{
|
||||
var price = form.get ('price');
|
||||
var discount = form.get ('discount');
|
||||
|
||||
if (price && form.get ('fixed'))
|
||||
return form.get ('amount') * price * ((100 - discount) / 100);
|
||||
else
|
||||
return null;
|
||||
return form.get ('quantity') * price * ((100 - discount) / 100);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -21,13 +21,16 @@ h2
|
|||
text-align: right;
|
||||
margin: .1em 0;
|
||||
}
|
||||
.footer
|
||||
.important
|
||||
{
|
||||
font-size: 1.2em;
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
}
|
||||
.footer
|
||||
{
|
||||
margin-top: .2em;
|
||||
border-top: 1px solid #333;
|
||||
padding-top: .3em;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,13 +3,7 @@
|
|||
<db-form id="ticket">
|
||||
<db-model property="model" id="ticket-data" conn="conn" batch="batch">
|
||||
<custom>
|
||||
SELECT t.id, date, a.Agencia, note, p.name province,
|
||||
zip_code, city, c.name, consignee, invoice
|
||||
FROM ticket_view t
|
||||
JOIN address_view c ON t.address_id = c.id
|
||||
JOIN vn2008.Agencias a ON t.agency_id = a.Id_Agencia
|
||||
JOIN vn2008.province p ON c.province_id = p.province_id
|
||||
WHERE t.id = #ticket
|
||||
CALL myTicketGet (#ticket)
|
||||
</custom>
|
||||
</db-model>
|
||||
</db-form>
|
||||
|
@ -20,48 +14,45 @@
|
|||
</h2>
|
||||
<div class="header">
|
||||
<p>
|
||||
<htk-text form="ticket" column="consignee"/>
|
||||
<htk-text form="ticket" column="nickname"/>
|
||||
</p>
|
||||
<p>
|
||||
<htk-text form="ticket" column="date" format="%D"/>
|
||||
<htk-text form="ticket" column="landed" format="%D"/>
|
||||
</p>
|
||||
<p>
|
||||
<htk-text form="ticket" column="name"/>
|
||||
<htk-text form="ticket" column="street"/>
|
||||
</p>
|
||||
<p>
|
||||
<htk-text form="ticket" column="zip_code"/>
|
||||
<htk-text form="ticket" column="postalCode"/>
|
||||
<htk-text form="ticket" column="city"/>
|
||||
(<htk-text form="ticket" column="province"/>)
|
||||
(<htk-text form="ticket" column="province"/>) aaa
|
||||
</p>
|
||||
<p>
|
||||
<t>Delivery</t> <htk-text form="ticket" column="Agencia"/>
|
||||
<t>Delivery</t> <htk-text form="ticket" column="agency"/>
|
||||
</p>
|
||||
</div>
|
||||
<htk-grid>
|
||||
<db-model property="model" id="movements" conn="conn" batch="batch">
|
||||
<custom>
|
||||
SELECT m.item_id, amount, concept, Categoria, Medida, Tallos, Color,
|
||||
Abreviatura, IF(fixed != FALSE, price, NULL) price, fixed, discount
|
||||
FROM ticket_row_view m
|
||||
INNER JOIN vn2008.Articles a
|
||||
ON m.item_id = a.Id_Article AND ticket_id = #ticket
|
||||
LEFT JOIN vn2008.Origen o
|
||||
ON a.id_origen = o.id
|
||||
ORDER BY concept
|
||||
CALL myTicketGetRows (#ticket)
|
||||
</custom>
|
||||
</db-model>
|
||||
<htk-column-spin title="_Ref" column="item_id"/>
|
||||
<htk-column-spin title="_Amount" column="amount"/>
|
||||
<htk-column-spin title="_Ref" column="itemFk"/>
|
||||
<htk-column-spin title="_Amount" column="quantity"/>
|
||||
<htk-column-text title="_Item" column="concept"/>
|
||||
<htk-column-text title="_S1" column="Medida"/>
|
||||
<htk-column-text title="_Cat" column="Categoria"/>
|
||||
<htk-column-text title="_S1" column="size"/>
|
||||
<htk-column-text title="_Cat" column="category"/>
|
||||
<htk-column-spin title="_Price" column="price" unit="€" digits="2"/>
|
||||
<htk-column-spin title="_Subtotal" unit="€" digits="2" renderer="subtotalRenderer"/>
|
||||
</htk-grid>
|
||||
<p class="footer">
|
||||
<p class="footer important">
|
||||
<htk-text format="%.2d€">
|
||||
<db-calc-sum property="param" func="subtotal" model="movements"/>
|
||||
</htk-text>
|
||||
</p>
|
||||
<p class="important">
|
||||
<t>Total + tax</t>
|
||||
<htk-text format="%.2d€" form="ticket" column="total"/>
|
||||
</p>
|
||||
</div>
|
||||
</vn>
|
||||
|
|
Loading…
Reference in New Issue