forked from verdnatura/hedera-web
Backup
This commit is contained in:
parent
bbecb5fce9
commit
5779a5bfa6
|
@ -5,30 +5,33 @@ Vn.Shelves = new Class
|
|||
|
||||
,activate: function ()
|
||||
{
|
||||
this.$('warehouse').value = 44;
|
||||
this.$('date').value = new Date ();
|
||||
this.$('shelf').value = 4;
|
||||
this.$('reign').value = 1;
|
||||
this.$('family').value = 2;
|
||||
this.$('filter').value = 'Ant ';
|
||||
this.$('max-amount').value = 50;
|
||||
this.$('show-packing').value = true;
|
||||
this.$('stack').value = true;
|
||||
}
|
||||
|
||||
,onFamilyChange: function ()
|
||||
,onConfigChange: function ()
|
||||
{
|
||||
this.$('report-title').value = this.$('family').get ('Tipo');
|
||||
var c = this.$('config');
|
||||
this.$('warehouse').value = c.get ('warehouse_id');
|
||||
this.$('shelf').value = c.get ('shelf_id');
|
||||
this.$('reign').value = c.get ('reino_id');
|
||||
this.$('family').value = c.get ('family_id');
|
||||
this.$('filter').value = c.get ('name_prefix');
|
||||
this.$('max-amount').value = c.get ('max_amount');
|
||||
this.$('show-packing').value = c.get ('show_packing');
|
||||
this.$('stack').value = c.get ('stack');
|
||||
this.$('report-title').value = c.get ('name');
|
||||
}
|
||||
|
||||
,onPreviewClick: function ()
|
||||
{
|
||||
var batch = new Sql.Batch ();
|
||||
batch.addParam ('shelf', this.$('shelf'));
|
||||
batch.addParam ('wh', this.$('warehouse'));
|
||||
batch.addParam ('date', this.$('date'));
|
||||
batch.addParam ('family', this.$('family'));
|
||||
batch.addValue ('filter', this.$('filter').value);
|
||||
batch.addParams ({
|
||||
'shelf': this.$('shelf'),
|
||||
'wh': this.$('warehouse'),
|
||||
'date': this.$('date'),
|
||||
'family': this.$('family'),
|
||||
'filter': this.$('filter')
|
||||
});
|
||||
|
||||
var report = new Vn.ShelvesReport ({conn: this.conn});
|
||||
report.setParams (
|
||||
|
@ -47,7 +50,7 @@ Vn.ShelvesReport = new Class
|
|||
Extends: Vn.Report
|
||||
|
||||
,nItem: -1
|
||||
,nColors: 4
|
||||
,nColors: 5
|
||||
|
||||
,setParams: function (title, maxAmount, showPacking, stack, batch)
|
||||
{
|
||||
|
@ -61,9 +64,9 @@ Vn.ShelvesReport = new Class
|
|||
,open: function ()
|
||||
{
|
||||
var query =
|
||||
'SELECT id, name, width, height, max_height, tray_height, '+
|
||||
'SELECT id, name, width, height, depth, max_height, tray_height, '+
|
||||
'first_tray_elevation, tray_density, vspacing, hspacing '+
|
||||
'FROM vn2008.shelf WHERE id = #shelf; '+
|
||||
'FROM shelf WHERE id = #shelf; '+
|
||||
'CALL item_organizer (#wh, #date, #family, #filter)';
|
||||
|
||||
this.conn.execQuery (query, this.onQueryExec.bind (this), this.batch);
|
||||
|
@ -76,12 +79,19 @@ Vn.ShelvesReport = new Class
|
|||
var res = resultSet.fetchResult ();
|
||||
res.next ();
|
||||
|
||||
var scale = 0.065;
|
||||
var maxWidth = 170;
|
||||
var maxHeight = 200;
|
||||
|
||||
var scale = maxWidth / res.get ('width');
|
||||
|
||||
if (res.get ('max_height') * scale > maxHeight)
|
||||
scale = maxHeight / res.get ('max_height');
|
||||
|
||||
var shelf = this.shelf =
|
||||
{
|
||||
width: res.get ('width') * scale
|
||||
,height: res.get ('height') * scale
|
||||
,depth: res.get ('depth') * scale
|
||||
,maxHeight: res.get ('max_height') * scale
|
||||
,trayHeight: res.get ('tray_height') * scale
|
||||
,firstTrayElevation: res.get ('first_tray_elevation') * scale
|
||||
|
@ -94,21 +104,32 @@ Vn.ShelvesReport = new Class
|
|||
var remainings = [];
|
||||
var res = resultSet.fetchResult ();
|
||||
|
||||
if (res.data.length == 0)
|
||||
{
|
||||
Htk.Toast.showError (_('No items found, check that all fields are correct'));
|
||||
return;
|
||||
}
|
||||
|
||||
var boxScale = scale * 10;
|
||||
|
||||
while (res.next ())
|
||||
if (res.get ('etiquetas') <= this.maxAmount)
|
||||
if (!this.maxAmount || res.get ('etiquetas') <= this.maxAmount)
|
||||
{
|
||||
items.push ({
|
||||
name: res.get ('Article')
|
||||
id: res.get ('Id_Article')
|
||||
,name: res.get ('Article')
|
||||
,packing: res.get ('packing')
|
||||
,boxHeight: res.get ('z') * 10 * scale
|
||||
,boxWidth: res.get ('x') * 10 * scale
|
||||
,amount: res.get ('etiquetas')
|
||||
,boxHeight: res.get ('z') * boxScale
|
||||
,boxWidth: res.get ('x') * boxScale
|
||||
,boxDepth: res.get ('y') * boxScale
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
remainings.push ({
|
||||
name: res.get ('Article')
|
||||
id: res.get ('Id_Article')
|
||||
,name: res.get ('Article')
|
||||
,packing: res.get ('packing')
|
||||
,amount: res.get ('etiquetas')
|
||||
});
|
||||
|
@ -125,14 +146,16 @@ Vn.ShelvesReport = new Class
|
|||
(shelf.height - shelf.firstTrayElevation) /
|
||||
(shelf.trayHeight + shelf.trayDensity)
|
||||
);
|
||||
alloc.trayWidth = shelf.width - shelf.hspacing * 2;
|
||||
alloc.width = shelf.width - shelf.hspacing * 2;
|
||||
alloc.depth = shelf.depth;
|
||||
alloc.trayHeight = shelf.trayHeight - shelf.vspacing;
|
||||
alloc.topTrayHeight = shelf.maxHeight - shelf.vspacing
|
||||
- shelf.firstTrayElevation - (alloc.nTrays - 1) * shelf.trayHeight;
|
||||
|
||||
// Opens the report
|
||||
|
||||
this.createWindow ('shelves');
|
||||
if (!this.createWindow ('shelves'))
|
||||
return;
|
||||
|
||||
// Remaining amount
|
||||
|
||||
|
@ -143,10 +166,15 @@ Vn.ShelvesReport = new Class
|
|||
this.doc.body.appendChild (sheet);
|
||||
|
||||
var title = this.doc.createElement ('h1');
|
||||
title.appendChild (this.doc.createTextNode (this.title +' - '));
|
||||
title.appendChild (this.doc.createTextNode (_('Pallets')));
|
||||
title.className = 'title';
|
||||
title.appendChild (this.doc.createTextNode (this.title));
|
||||
sheet.appendChild (title);
|
||||
|
||||
var subtitle = this.doc.createElement ('h2');
|
||||
subtitle.className = 'subtitle';
|
||||
subtitle.appendChild (this.doc.createTextNode (_('Pallets')));
|
||||
sheet.appendChild (subtitle);
|
||||
|
||||
var ul = this.doc.createElement ('ul');
|
||||
sheet.appendChild (ul);
|
||||
|
||||
|
@ -155,6 +183,11 @@ Vn.ShelvesReport = new Class
|
|||
var li = this.doc.createElement ('li');
|
||||
ul.appendChild (li);
|
||||
|
||||
var span = this.doc.createElement ('span');
|
||||
span.className = 'item-id';
|
||||
span.appendChild (this.doc.createTextNode (remainings[i].id.toLocaleString ()));
|
||||
li.appendChild (span);
|
||||
|
||||
var span = this.doc.createElement ('span');
|
||||
span.className = 'item';
|
||||
span.appendChild (this.doc.createTextNode (remainings[i].name));
|
||||
|
@ -173,9 +206,10 @@ Vn.ShelvesReport = new Class
|
|||
// Draws the shelves
|
||||
|
||||
alloc.run ();
|
||||
this.drawShelfEnding ();
|
||||
}
|
||||
|
||||
,drawShelf: function (allocator)
|
||||
,drawShelf: function (allocator, item)
|
||||
{
|
||||
var shelf = this.shelf;
|
||||
|
||||
|
@ -185,27 +219,32 @@ Vn.ShelvesReport = new Class
|
|||
|
||||
// Draws the title
|
||||
|
||||
var title = this.doc.createElement ('h1');
|
||||
title.className = 'title';
|
||||
title.appendChild (this.doc.createTextNode (this.title));
|
||||
sheet.appendChild (title);
|
||||
|
||||
var pageNumber = this.doc.createElement ('h1');
|
||||
pageNumber.className = 'page-number';
|
||||
pageNumber.appendChild (this.doc.createTextNode (allocator.currentShelf + 1));
|
||||
sheet.appendChild (pageNumber);
|
||||
|
||||
var title = this.doc.createElement ('h1');
|
||||
title.className = 'title';
|
||||
title.appendChild (this.doc.createTextNode (this.title));
|
||||
sheet.appendChild (title);
|
||||
|
||||
var subtitle = this.doc.createElement ('h2');
|
||||
subtitle.className = 'subtitle';
|
||||
subtitle.appendChild (this.doc.createTextNode (item.id.toLocaleString ()));
|
||||
sheet.appendChild (subtitle);
|
||||
|
||||
this.drawShelfEnding ();
|
||||
this.lastSubtitle = subtitle;
|
||||
|
||||
// Draws the shelf
|
||||
|
||||
var shelfDiv = this.shelfDiv = this.doc.createElement ('div');
|
||||
shelfDiv.className = 'shelf';
|
||||
shelfDiv.style.width = this.shelf.width +'mm';
|
||||
shelfDiv.style.height = this.shelf.maxHeight +'mm';
|
||||
shelfDiv.style.width = this.mm (shelf.width);
|
||||
shelfDiv.style.height = this.mm (shelf.maxHeight);
|
||||
sheet.appendChild (shelfDiv);
|
||||
|
||||
this.drawEdge ().style.left = 0;
|
||||
this.drawEdge ().style.right = 0;
|
||||
|
||||
// Draws trays
|
||||
|
||||
var lastTrayY = shelf.firstTrayElevation;
|
||||
|
@ -215,24 +254,25 @@ Vn.ShelvesReport = new Class
|
|||
{
|
||||
var tray = this.doc.createElement ('div');
|
||||
tray.className = 'tray';
|
||||
tray.style.width = this.shelf.width +'mm';
|
||||
tray.style.height = '1mm';
|
||||
tray.style.bottom = lastTrayY +'mm';
|
||||
tray.style.width = this.mm (shelf.width);
|
||||
tray.style.height = this.mm (shelf.trayDensity);
|
||||
tray.style.bottom = this.mm (lastTrayY);
|
||||
shelfDiv.appendChild (tray);
|
||||
|
||||
lastTrayY += shelf.trayHeight + shelf.trayDensity;
|
||||
}
|
||||
}
|
||||
|
||||
,drawEdge: function (shelfDiv)
|
||||
,drawShelfEnding: function ()
|
||||
{
|
||||
var edge = this.doc.createElement ('div');
|
||||
edge.className = 'edge';
|
||||
edge.style.width = '1mm';
|
||||
edge.style.height = this.shelf.height +'mm';
|
||||
edge.style.bottom = 0;
|
||||
this.shelfDiv.appendChild (edge);
|
||||
return edge;
|
||||
if (this.lastSubtitle)
|
||||
this.lastSubtitle.appendChild (
|
||||
this.doc.createTextNode (' - '+ this.lastItem.id.toLocaleString ()));
|
||||
}
|
||||
|
||||
,mm: function (size)
|
||||
{
|
||||
return size.toFixed (2) +'mm';
|
||||
}
|
||||
|
||||
,drawBox: function (allocator, item, amount)
|
||||
|
@ -251,10 +291,10 @@ Vn.ShelvesReport = new Class
|
|||
box.className = 'box';
|
||||
this.shelfDiv.appendChild (box);
|
||||
|
||||
box.style.left = x +'mm';
|
||||
box.style.bottom = y +'mm';
|
||||
box.style.width = item.boxWidth +'mm';
|
||||
box.style.height = item.boxHeight +'mm';
|
||||
box.style.left = this.mm (x);
|
||||
box.style.bottom = this.mm (y);
|
||||
box.style.width = this.mm (item.boxWidth);
|
||||
box.style.height = this.mm (item.boxHeight);
|
||||
|
||||
if (amount == 0)
|
||||
this.nItem++;
|
||||
|
@ -264,38 +304,38 @@ Vn.ShelvesReport = new Class
|
|||
|
||||
if (amount == 0 || allocator.firstShelfBox)
|
||||
{
|
||||
if (this.showPacking)
|
||||
{
|
||||
var packing = this.doc.createElement ('span');
|
||||
packing.className = 'packing';
|
||||
packing.appendChild (this.doc.createTextNode (item.packing));
|
||||
box.appendChild (packing);
|
||||
}
|
||||
var fontSize = item.boxWidth / 5.2;
|
||||
|
||||
var boxLabel = this.doc.createElement ('span');
|
||||
if (fontSize > item.boxHeight - 1)
|
||||
fontSize = item.boxHeight - 1;
|
||||
|
||||
var boxLabel = this.doc.createElement ('div');
|
||||
boxLabel.className = 'box-label';
|
||||
boxLabel.appendChild (this.doc.createTextNode (item.name));
|
||||
boxLabel.style.fontSize = this.mm (fontSize);
|
||||
boxLabel.appendChild (this.doc.createTextNode (item.id.toLocaleString ()));
|
||||
box.appendChild (boxLabel);
|
||||
}
|
||||
|
||||
this.lastItem = item;
|
||||
}
|
||||
});
|
||||
|
||||
Vn.Allocator = new Class
|
||||
({
|
||||
addShelf: function ()
|
||||
addShelf: function (item)
|
||||
{
|
||||
this.currentShelf++;
|
||||
this.firstShelfBox = true;
|
||||
|
||||
if (this.shelfFunc)
|
||||
this.shelfFunc (this);
|
||||
this.shelfFunc (this, item);
|
||||
}
|
||||
|
||||
,addTray: function ()
|
||||
,addTray: function (item)
|
||||
{
|
||||
if (this.currentTray <= 0)
|
||||
{
|
||||
this.addShelf ();
|
||||
this.addShelf (item);
|
||||
this.currentTray = this.nTrays - 1;
|
||||
}
|
||||
else
|
||||
|
@ -304,17 +344,17 @@ Vn.Allocator = new Class
|
|||
this.trayX = 0;
|
||||
}
|
||||
|
||||
,addColumn: function (width)
|
||||
,addColumn: function (item)
|
||||
{
|
||||
if (this.trayX + this.columnWidth + width > this.trayWidth
|
||||
if (this.trayX + this.columnWidth + item.boxWidth > this.width
|
||||
|| this.currentTray == -1)
|
||||
this.addTray ();
|
||||
this.addTray (item);
|
||||
else
|
||||
this.trayX += this.columnWidth;
|
||||
|
||||
this.trayY = 0;
|
||||
this.columnWidth = width;
|
||||
this.lastBoxWidth = width;
|
||||
this.columnWidth = item.boxWidth;
|
||||
this.lastBoxWidth = item.boxWidth;
|
||||
}
|
||||
|
||||
,addBox: function (item, amount)
|
||||
|
@ -327,7 +367,7 @@ Vn.Allocator = new Class
|
|||
if (this.trayY + item.boxHeight > trayHeight
|
||||
|| item.boxWidth > this.lastBoxWidth
|
||||
|| (!this.stack && amount == 0))
|
||||
this.addColumn (item.boxWidth);
|
||||
this.addColumn (item);
|
||||
|
||||
if (this.boxFunc)
|
||||
this.boxFunc (this, item, amount);
|
||||
|
@ -352,8 +392,12 @@ Vn.Allocator = new Class
|
|||
for (var i = 0; i < this.items.length; i++)
|
||||
{
|
||||
var item = this.items[i];
|
||||
var boxIncrement = Math.floor (this.depth / item.boxDepth);
|
||||
|
||||
for (var amount = 0; amount < item.amount; amount++)
|
||||
if (boxIncrement < 1)
|
||||
boxIncrement = 1;
|
||||
|
||||
for (var amount = 0; amount < item.amount; amount += boxIncrement)
|
||||
{
|
||||
this.addBox (item, amount);
|
||||
this.firstShelfBox = false;
|
||||
|
|
|
@ -1,10 +1,31 @@
|
|||
<vn>
|
||||
<vn-group>
|
||||
<db-model property="model" id="configs-model">
|
||||
SELECT c.id, c.name, c.name_prefix, c.warehouse_id, c.family_id,
|
||||
c.shelf_id, c.max_amount, c.show_packing, c.stack, t.reino_id
|
||||
FROM shelf_config c
|
||||
JOIN vn2008.Tipos t ON t.tipo_id = c.family_id
|
||||
</db-model>
|
||||
</vn-group>
|
||||
<div id="title">
|
||||
<h1><t>Shelves</t></h1>
|
||||
</div>
|
||||
<div id="form" class="shelves">
|
||||
<div class="box">
|
||||
<div class="body">
|
||||
<div class="form-group">
|
||||
<label><t>Configuration</t></label>
|
||||
<htk-combo
|
||||
id="config"
|
||||
placeholder="_Select config"
|
||||
model="configs-model"
|
||||
on-changed="onConfigChange"
|
||||
on-ready="onConfigChange"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label><t>Date</t></label>
|
||||
<htk-date-chooser id="date"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label><t>Reign</t></label>
|
||||
<htk-combo id="reign">
|
||||
|
@ -16,7 +37,7 @@
|
|||
</div>
|
||||
<div class="form-group">
|
||||
<label><t>Family</t></label>
|
||||
<htk-combo id="family" on-changed="onFamilyChange" on-ready="onFamilyChange">
|
||||
<htk-combo id="family">
|
||||
<db-model property="model">
|
||||
SELECT tipo_id, Tipo FROM vn2008.Tipos
|
||||
WHERE reino_id = #reign ORDER BY Tipo
|
||||
|
@ -35,21 +56,17 @@
|
|||
</db-model>
|
||||
</htk-combo>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label><t>Date</t></label>
|
||||
<htk-date-chooser id="date"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label><t>Shelf</t></label>
|
||||
<htk-combo id="shelf">
|
||||
<db-model property="model" id="shelves">
|
||||
SELECT id, name FROM vn2008.shelf
|
||||
SELECT id, name FROM shelf
|
||||
</db-model>
|
||||
</htk-combo>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label><t>Name prefix</t></label>
|
||||
<input type="text" id="filter"/>
|
||||
<htk-entry id="filter"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label><t>Limit amount per item</t></label>
|
||||
|
|
|
@ -37,11 +37,13 @@
|
|||
<sql-search-tags param="search"/>
|
||||
</sql-filter-item>
|
||||
<!--
|
||||
<pointer object="op-realm"/>
|
||||
<pointer object="op-type"/>
|
||||
<pointer object="op-color"/>
|
||||
<pointer object="op-origin"/>
|
||||
<pointer object="op-category"/>
|
||||
<list property="operands">
|
||||
<pointer object="op-realm"/>
|
||||
<pointer object="op-type"/>
|
||||
<pointer object="op-color"/>
|
||||
<pointer object="op-origin"/>
|
||||
<pointer object="op-category"/>
|
||||
</list>
|
||||
-->
|
||||
</sql-filter>
|
||||
<db-query id="basket-lines">
|
||||
|
|
|
@ -5,9 +5,6 @@ Vn.Orders = new Class
|
|||
|
||||
,activate: function ()
|
||||
{
|
||||
this.payPopup = new Htk.Popup ();
|
||||
this.payPopup.setChildNode (this.$('balance-popup'));
|
||||
|
||||
Vn.Tpv.check (this.conn);
|
||||
}
|
||||
|
||||
|
@ -40,14 +37,8 @@ Vn.Orders = new Class
|
|||
|
||||
,onPayButtonClick: function ()
|
||||
{
|
||||
this.payPopup.show (this.$('pay-button').getNode ());
|
||||
}
|
||||
|
||||
,onCompanyPayClick: function (column, value, row)
|
||||
{
|
||||
var model = this.$('balance');
|
||||
var company = model.get (row, 'id');
|
||||
var amount = model.get (row, 'amount');
|
||||
var company = 442;
|
||||
var amount = this.$('debt').value;
|
||||
|
||||
amount = amount <= 0 ? null : amount;
|
||||
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
<vn>
|
||||
<vn-group>
|
||||
<db-model id="debt-model" result-index="1">
|
||||
CALL customer_get_debt_by_company ();
|
||||
SELECT * FROM t_customer_debt;
|
||||
DROP TEMPORARY TABLE t_customer_debt;
|
||||
</db-model>
|
||||
</vn-group>
|
||||
<div id="title">
|
||||
<h1><t>LastOrders</t></h1>
|
||||
</div>
|
||||
|
@ -6,7 +13,7 @@
|
|||
<div id="balance">
|
||||
<span class="label"><t>PendingBalance:</t></span>
|
||||
<htk-label format="%.2d€" conditional-func="balanceConditionalFunc">
|
||||
<db-calc-sum model="balance" column-name="amount"/>
|
||||
<db-calc-sum model="debt-model" column-name="amount" id="debt"/>
|
||||
</htk-label>
|
||||
<img src="image/dark/info.svg" title="_PaymentInfo" class="balance-info" alt="Info"/>
|
||||
</div>
|
||||
|
@ -39,16 +46,4 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="balance-popup" class="balance-popup">
|
||||
<htk-grid class="balance-grid" show-header="false">
|
||||
<db-model id="balance" result-index="1">
|
||||
CALL customer_get_debt_by_company ();
|
||||
SELECT * FROM t_customer_debt;
|
||||
DROP TEMPORARY TABLE t_customer_debt;
|
||||
</db-model>
|
||||
<htk-column-text title="_Company" column="abbreviation"/>
|
||||
<htk-column-spin title="_Pending" column="amount" unit="€" digits="2"/>
|
||||
<htk-column-button title="_Pay" image="image/pay.svg" tip="Pay" on-clicked="onCompanyPayClick"/>
|
||||
</htk-grid>
|
||||
</div>
|
||||
</vn>
|
||||
|
|
Binary file not shown.
|
@ -33,21 +33,22 @@
|
|||
background-color: white;
|
||||
margin: 10mm auto;
|
||||
box-shadow: 0 1mm 1mm #CCC;
|
||||
padding: 15mm;
|
||||
padding: 20mm;
|
||||
}
|
||||
.print-button
|
||||
{
|
||||
position: fixed;
|
||||
top: 6mm;
|
||||
right: 6mm;
|
||||
top: 1.5em;
|
||||
right: 1.5em;
|
||||
border-radius: 2px;
|
||||
background-color: #009688;
|
||||
color: white;
|
||||
padding: 2mm;
|
||||
padding: .4em;
|
||||
z-index: 100;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 1mm 1mm #AAA;
|
||||
box-shadow: 0 .1em .1em #AAA;
|
||||
font-size: 1.4em;
|
||||
}
|
||||
.print-button:hover
|
||||
{
|
||||
|
@ -56,7 +57,7 @@
|
|||
}
|
||||
*
|
||||
{
|
||||
font-family: 'Droid Sans', 'Sans';
|
||||
font-family: 'Open Sans';
|
||||
}
|
||||
body
|
||||
{
|
||||
|
|
|
@ -29,13 +29,13 @@ Vn.Report = new Class
|
|||
,createWindow: function (reportPath)
|
||||
{
|
||||
var reportWindow = window.open (''/*'js/hedera/report.html'*/, '_blank'/*reportPath*/,
|
||||
'resizable=yes,height=900,width=900,scrollbars=yes,menubar=true');
|
||||
'resizable=yes,height=900,width=900,scrollbars=yes,menubar=false');
|
||||
|
||||
if (!reportWindow)
|
||||
{
|
||||
Htk.Toast.showError (
|
||||
_('Can\'t open the report, please unlock popup block and try again'));
|
||||
return;
|
||||
_('Please unlock popups and try again'));
|
||||
return null;
|
||||
}
|
||||
|
||||
this.window = reportWindow;
|
||||
|
|
|
@ -79,12 +79,24 @@ Sql.Batch = new Class
|
|||
new Sql.Value ({value: value}));
|
||||
}
|
||||
|
||||
,addValues: function (values)
|
||||
{
|
||||
for (var id in values)
|
||||
this.addValue (id, values[id]);
|
||||
}
|
||||
|
||||
,addParam: function (id, param)
|
||||
{
|
||||
this._addObject (id,
|
||||
new Sql.Value ({param: param}));
|
||||
}
|
||||
|
||||
,addParams: function (params)
|
||||
{
|
||||
for (var id in params)
|
||||
this.addParam (id, params[id]);
|
||||
}
|
||||
|
||||
,remove: function (id)
|
||||
{
|
||||
if (this.objects[id])
|
||||
|
|
|
@ -243,6 +243,73 @@ Vn.Builder = new Class
|
|||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++ Alpha
|
||||
|
||||
,compile: function (node, dstDocument)
|
||||
{
|
||||
this.contexts = [];
|
||||
this.contextMap = {};
|
||||
this.propLinks = [];
|
||||
this.childLinks = [];
|
||||
this.document = dstDocument ? dstDocument : document;
|
||||
|
||||
this.compileRec (node, null);
|
||||
|
||||
for (var i = 0; i < this.propLinks.length; i++)
|
||||
{
|
||||
var pl = this.propLinks[i];
|
||||
var contextId = this.contextMap[pl.value];
|
||||
|
||||
if (contextId)
|
||||
{
|
||||
pl.context.objectProps[pl.prop] = contextId;
|
||||
continue;
|
||||
}
|
||||
|
||||
var object = this.parentBuilder.get (pl.value);
|
||||
|
||||
if (object)
|
||||
{
|
||||
pl.context.props[pl.prop] = object;
|
||||
continue;
|
||||
}
|
||||
|
||||
console.warn ('Vn.Builder: Referenced unexistent object with id \'%s\'',
|
||||
pl.value);
|
||||
}
|
||||
|
||||
delete this.propLinks;
|
||||
|
||||
for (var i = 0; i < this.childLinks.length; i++)
|
||||
{
|
||||
var cl = this.childLinks[i];
|
||||
var contextId = this.contextMap[pl.value];
|
||||
|
||||
if (contextId)
|
||||
pl.context.childs.push (contextId);
|
||||
else
|
||||
console.warn ('Vn.Builder: Referenced unexistent object with id \'%s\'',
|
||||
pl.value);
|
||||
}
|
||||
|
||||
delete this.childLinks;
|
||||
}
|
||||
|
||||
,compileRec: function (node)
|
||||
{
|
||||
var tagName = null;
|
||||
|
||||
if (node.tagName)
|
||||
tagName = node.tagName.toLowerCase ();
|
||||
|
||||
var nextId = this.contexts.length;
|
||||
var context =
|
||||
createTextTemplate (nextId, node, tagName)
|
||||
|| createObjectTemplate (nextId, node, tagName)
|
||||
|| createHtmlTemplate (nextId, node, tagName);
|
||||
|
||||
this.contexts.push (context);
|
||||
return context;
|
||||
}
|
||||
|
||||
,load: function (thisData)
|
||||
{
|
||||
var contexts = this.contexts;
|
||||
|
@ -251,97 +318,24 @@ Vn.Builder = new Class
|
|||
for (var i = 0; i < contexts.length; i++)
|
||||
{
|
||||
var context = contexts[i];
|
||||
objects[i] = context.func (context.template);
|
||||
|
||||
if (context.func)
|
||||
objects[i] = context.func (context);
|
||||
}
|
||||
|
||||
var links = this.links;
|
||||
|
||||
for (var i = 0; i < links.length; i++)
|
||||
for (var i = 0; i < contexts.length; i++)
|
||||
{
|
||||
var link = links[i];
|
||||
objects[link.contextId][link.propName] = objects[link.valueContext];
|
||||
var context = contexts[i];
|
||||
|
||||
if (context.linkFunc)
|
||||
context.linkFunc (context, objects[i]);
|
||||
}
|
||||
}
|
||||
|
||||
,compile: function (node, dstDocument)
|
||||
{
|
||||
this.contexts = [];
|
||||
this.contextMap = {};
|
||||
this.pointers = [];
|
||||
this.links = [];
|
||||
this.document = dstDocument ? dstDocument : document;
|
||||
|
||||
this.compileRec (node, null);
|
||||
|
||||
for (var i = 0; i < this.pointers.length; i++)
|
||||
{
|
||||
var pointerId = this.pointers[i].template;
|
||||
var refContext = this.contextMap[pointerId];
|
||||
}
|
||||
}
|
||||
|
||||
,compileRec: function (node, parentContext)
|
||||
{
|
||||
var tagName = null;
|
||||
|
||||
if (node.tagName)
|
||||
tagName = node.tagName.toLowerCase ();
|
||||
|
||||
var context = {
|
||||
node: node
|
||||
,parent: parentContext
|
||||
,template: template
|
||||
,id: this.contexts.length
|
||||
,func: null
|
||||
};
|
||||
this.contexts.push (context);
|
||||
|
||||
var template =
|
||||
createTextTemplate (context, node, tagName)
|
||||
|| createPointerTemplate (context, node, tagName)
|
||||
|| createObjectTemplate (context, node, tagName)
|
||||
|| createHtmlTemplate (context, node, tagName);
|
||||
|
||||
var id = node.getAttribute ('id');
|
||||
|
||||
if (id)
|
||||
this.contextMap[id] = context;
|
||||
|
||||
if (parentContext)
|
||||
{
|
||||
var parentProperty = node.getAttribute ('property');
|
||||
|
||||
if (!parentProperty && parentContext.template.klass)
|
||||
parentProperty = parentContext.template.klass.Child;
|
||||
|
||||
if (parentProperty)
|
||||
{
|
||||
this.links.push ({
|
||||
contextId: context.id,
|
||||
propName: propName,
|
||||
valueContext: valueContext.id
|
||||
});
|
||||
}
|
||||
|
||||
this.registerLink (parentContext, parentProperty, context);
|
||||
|
||||
if (klass.Parent)
|
||||
this.registerLink (context, klass.Parent, parentContext);
|
||||
}
|
||||
|
||||
var childs = node.childNodes;
|
||||
|
||||
if (childs)
|
||||
for (var i = 0; i < childs.length; i++)
|
||||
this.compileRec (childs[i], context);
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a text node template.
|
||||
**/
|
||||
,createTextTemplate: function (context, node, tagName)
|
||||
,createTextTemplate: function (contextId, node, tagName)
|
||||
{
|
||||
if (tagName === 't')
|
||||
var text = _(node.firstChild.textContent);
|
||||
|
@ -350,42 +344,28 @@ Vn.Builder = new Class
|
|||
else
|
||||
return null;
|
||||
|
||||
return
|
||||
|
||||
context.func = createTextInstance;
|
||||
return text;
|
||||
return {
|
||||
id: contextId,
|
||||
text: text,
|
||||
func: this.createTextInstance
|
||||
};
|
||||
}
|
||||
|
||||
,createTextInstance: function (template)
|
||||
,createTextInstance: function (context)
|
||||
{
|
||||
return this.document.createTextNode (template);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a object pointer template.
|
||||
**/
|
||||
,createPointerTemplate: function (context, node, tagName)
|
||||
{
|
||||
if (tagName !== 'pointer')
|
||||
return null;
|
||||
|
||||
this.pointers.push (context);
|
||||
return node.getAttribute ('object');
|
||||
}
|
||||
|
||||
,createPointerInstance: function (template)
|
||||
{
|
||||
return this.objectMap[template];
|
||||
return this.document.createTextNode (context.text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a object template.
|
||||
**/
|
||||
,createObjectTemplate: function (context, node, tagName)
|
||||
,createObjectTemplate: function (contextId, node, tagName)
|
||||
{
|
||||
var id = null;
|
||||
var handler;
|
||||
var props = {};
|
||||
var objectProps = {};
|
||||
var childs = [];
|
||||
var events = null;
|
||||
var klass = Vn.customTags[tagName];
|
||||
|
||||
|
@ -401,7 +381,7 @@ Vn.Builder = new Class
|
|||
|
||||
if (attribute === 'id')
|
||||
{
|
||||
id = value;
|
||||
this.contextMap[value] = contextId;
|
||||
}
|
||||
else if ((handler = this.getEventHandler (attribute, value)))
|
||||
{
|
||||
|
@ -417,12 +397,49 @@ Vn.Builder = new Class
|
|||
}
|
||||
}
|
||||
|
||||
context.func = createObjectInstance;
|
||||
return {
|
||||
var context = {
|
||||
id: contextId,
|
||||
func: this.createObjectInstance,
|
||||
linkFunc: this.createObjectLink,
|
||||
klass: klass,
|
||||
props: props,
|
||||
events: events,
|
||||
id: id
|
||||
objectProps: objectProps,
|
||||
childs: childs
|
||||
};
|
||||
|
||||
var childs = node.childNodes;
|
||||
|
||||
if (childs)
|
||||
for (var i = 0; i < childs.length; i++)
|
||||
{
|
||||
var child = childs[i];
|
||||
var childTagName = child.tagName.toLowerCase ();
|
||||
|
||||
if (childTagName === 'pointer')
|
||||
{
|
||||
this.childLinks.push ({
|
||||
context: context,
|
||||
objectId: child.getAttribute ('object')
|
||||
});
|
||||
}
|
||||
else if (childTagName === 'custom')
|
||||
{
|
||||
context.custom = child.firstElementChild;
|
||||
}
|
||||
else
|
||||
{
|
||||
var childContext = this.compileRec (child);
|
||||
var prop = child.getAttribute ('property');
|
||||
|
||||
if (prop)
|
||||
objectProps[prop] = childContext.id;
|
||||
else
|
||||
childs.push (childContext.id);
|
||||
}
|
||||
}
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
,createPropTemplate: function (context, klass, props, node, attribute, value)
|
||||
|
@ -469,37 +486,56 @@ Vn.Builder = new Class
|
|||
}
|
||||
else if (propInfo.type instanceof Function)
|
||||
{
|
||||
this.registerLink (context, attribute, value);
|
||||
this.propLinks.push ({
|
||||
context: context,
|
||||
prop: attribute,
|
||||
value: value
|
||||
});
|
||||
}
|
||||
else
|
||||
console.warn ('Vn.Builder: Attribute \'%s\' invalid for tag \'%s\'',
|
||||
attribute, node.tagName);
|
||||
}
|
||||
|
||||
,createObjectInstance: function (template)
|
||||
,createObjectInstance: function (context)
|
||||
{
|
||||
var object = new template.klass (template.props);
|
||||
var object = new context.klass (context.props);
|
||||
|
||||
var events = template.events;
|
||||
var events = context.events;
|
||||
|
||||
for (var event in events)
|
||||
object.on (event,
|
||||
events[event].bind (this.signalData));
|
||||
|
||||
if (template.id)
|
||||
this.objectMap[id] = object;
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
,createObjectLink: function (context, object)
|
||||
{
|
||||
var objectProps = context.objectProps;
|
||||
|
||||
if (objectProps)
|
||||
for (var prop in objectProps)
|
||||
object[prop] = this.objects[objectProps[prop].id];
|
||||
|
||||
var childs = context.childs;
|
||||
|
||||
if (childs)
|
||||
for (var i = 0; i < childs.length; i++)
|
||||
object.appendChild (childs[i]);
|
||||
|
||||
if (context.custom)
|
||||
object.loadXml (context.custom);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a HTML node template.
|
||||
**/
|
||||
,createHtmlTemplate: function (context, node, tagName)
|
||||
,createHtmlTemplate: function (contextId, node, tagName)
|
||||
{
|
||||
var id = null;
|
||||
var handler;
|
||||
var events = null;
|
||||
var childs = [];
|
||||
var htmlNode = this.document.createElement (tagName);
|
||||
|
||||
var a = node.attributes;
|
||||
|
@ -511,7 +547,7 @@ Vn.Builder = new Class
|
|||
|
||||
if (attribute === 'id')
|
||||
{
|
||||
id = value;
|
||||
this.contextMap[value] = contextId;
|
||||
}
|
||||
else if ((handler = this.getEventHandler (attribute, value)))
|
||||
{
|
||||
|
@ -525,28 +561,45 @@ Vn.Builder = new Class
|
|||
this.translateValue (nodeValue));
|
||||
}
|
||||
|
||||
context.func = createHtmlInstance;
|
||||
var childNodes = node.childNodes;
|
||||
|
||||
if (childNodes)
|
||||
for (var i = 0; i < childNodes.length; i++)
|
||||
{
|
||||
var childContext = this.compileRec (childNodes[i]);
|
||||
childs.push (childContext.id);
|
||||
}
|
||||
|
||||
return {
|
||||
id: contextId,
|
||||
func: this.createHtmlInstance,
|
||||
linkFunc: this.createHtmlLink,
|
||||
node: htmlNode,
|
||||
events: events,
|
||||
id: id
|
||||
childs: childs
|
||||
};
|
||||
}
|
||||
|
||||
,createHtmlInstance: function (template)
|
||||
,createHtmlInstance: function (context)
|
||||
{
|
||||
var node = new template.node.cloneNode (false);
|
||||
var object = new context.node.cloneNode (false);
|
||||
|
||||
var events = template.events;
|
||||
var events = context.events;
|
||||
|
||||
for (var event in events)
|
||||
node.addEventListener (event,
|
||||
object.addEventListener (event,
|
||||
events[event].bind (this.signalData));
|
||||
|
||||
if (template.id)
|
||||
this.objectMap[id] = node;
|
||||
return object;
|
||||
}
|
||||
|
||||
return node;
|
||||
,createHtmlLink: function (context, object)
|
||||
{
|
||||
var childs = context.childs;
|
||||
|
||||
if (childs)
|
||||
for (var i = 0; i < childs.length; i++)
|
||||
object.appendChild (this.objects[childs[i]]);
|
||||
}
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++ Utilities
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
{
|
||||
"Reign": "Reino"
|
||||
"Configuration": "Configuración"
|
||||
,"Select config": "Selecciona configuración"
|
||||
,"Reign": "Reino"
|
||||
,"Family": "Familia"
|
||||
,"Store": "Almacén"
|
||||
,"Date": "Fecha"
|
||||
|
@ -11,4 +13,9 @@
|
|||
,"Stack different items": "Apilar artículos distintos"
|
||||
|
||||
,"Preview": "Mostrar"
|
||||
|
||||
,"Pallets": "Palets"
|
||||
|
||||
,"No items found, check that all fields are correct":
|
||||
"No se han encontrado artículos, comprueba que todos los campos son correctos"
|
||||
}
|
||||
|
|
|
@ -17,7 +17,10 @@ Vn.Locale.add
|
|||
,"TestTheNewWebsite": "¡Prueba la nueva web!"
|
||||
,"ReturnToOldWebsite": "Web antigua"
|
||||
,"ChangeLog": "Cambios recientes"
|
||||
|
||||
,"Print": "Imprimir"
|
||||
,"Please unlock popups and try again":
|
||||
"Por favor, desploquea los popups y vuélvelo a intentar"
|
||||
|
||||
,"ErrorLoadingForm": "Error al cargar formulario"
|
||||
,"CookiesNotification": "Al utilizar este sitio web aceptas el uso de cookies para la personalización de contenidos y análisis."
|
||||
|
|
|
@ -4,15 +4,22 @@
|
|||
h1
|
||||
{
|
||||
font-weight: normal;
|
||||
font-size: 15mm;
|
||||
font-size: 500%;
|
||||
margin: 0;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
h1.title
|
||||
h2.subtitle
|
||||
{
|
||||
float: left;
|
||||
margin: 0;
|
||||
font-size: 400%;
|
||||
font-weight: normal;
|
||||
color: #333;
|
||||
}
|
||||
h1.page-number
|
||||
{
|
||||
padding-left: 4mm;
|
||||
float: right;
|
||||
text-align: right;
|
||||
}
|
||||
|
@ -20,50 +27,53 @@ h1.page-number
|
|||
{
|
||||
position: relative;
|
||||
margin: 0 auto;
|
||||
padding-top: 40mm;
|
||||
padding-top: 10mm;
|
||||
}
|
||||
.edge,
|
||||
.tray
|
||||
{
|
||||
position: absolute;
|
||||
border: 1px solid black;
|
||||
border-top: 2px solid black;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.edge
|
||||
{
|
||||
width: 0;
|
||||
}
|
||||
.box
|
||||
{
|
||||
position: absolute;
|
||||
border: 1px solid black;
|
||||
padding: .8mm;
|
||||
box-sizing: padding-box;
|
||||
border-bottom: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.box .box-label
|
||||
{
|
||||
text-align: left;
|
||||
text-align: right;
|
||||
font-size: 55%;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
.box .packing
|
||||
{
|
||||
margin: 3%;
|
||||
display: block;
|
||||
float: right;
|
||||
font-size: 80%;
|
||||
box-sizing: border-box;
|
||||
padding: 0 4%;
|
||||
}
|
||||
.color0
|
||||
{
|
||||
background-color: #ECC !important;
|
||||
background-color: #FDD !important;
|
||||
}
|
||||
.color1
|
||||
{
|
||||
background-color: #CEC !important;
|
||||
background-color: #DFD !important;
|
||||
}
|
||||
.color2
|
||||
{
|
||||
background-color: #CCE !important;
|
||||
background-color: #DDF !important;
|
||||
}
|
||||
.color3
|
||||
{
|
||||
background-color: #ECE !important;
|
||||
background-color: #DFF !important;
|
||||
}
|
||||
.color4
|
||||
{
|
||||
background-color: #FFD !important;
|
||||
}
|
||||
|
||||
/* Remaining amounts*/
|
||||
|
@ -74,13 +84,20 @@ ul
|
|||
}
|
||||
li *
|
||||
{
|
||||
font-size: 6mm;
|
||||
line-height: 12mm;
|
||||
font-size: 200%;
|
||||
line-height: 200%;
|
||||
}
|
||||
.item-id
|
||||
{
|
||||
display: inline-block;
|
||||
text-align: right;
|
||||
margin: 0 5mm;
|
||||
width: 30mm;
|
||||
}
|
||||
.item
|
||||
{
|
||||
display: inline-block;
|
||||
width: 100mm;
|
||||
width: 80mm;
|
||||
}
|
||||
.amount
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue