Ahora se muestra la cantidad restante en estanterias

This commit is contained in:
Juan Ferrer Toribio 2015-10-22 08:59:38 +02:00
parent b615c6b2bf
commit d4c21e866c
3 changed files with 70 additions and 11 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
hedera-web (1.232-deb8) stable; urgency=low
hedera-web (1.233-deb8) stable; urgency=low
* Initial Release.

View File

@ -8,7 +8,7 @@ Vn.Shelves = new Class
this.$('report-title').value = 'Anthuriums';
this.$('warehouse').value = 44;
this.$('date').value = new Date ();
this.$('shelf').value = 1;
this.$('shelf').value = 4;
this.$('reign').value = 1;
this.$('family').value = 2;
this.$('filter').value = 'Ant %';
@ -85,24 +85,33 @@ Vn.ShelvesReport = new Class
};
var items = [];
var remainings = [];
var res = resultSet.fetchResult ();
while (res.next ())
if (res.get ('etiquetas') <= this.maxAmount)
{
items.push ({
name: res.get ('Article') +' x'+ res.get ('Medida')
,boxHeight: res.get ('z') * 10 * scale
,boxWidth: res.get ('x') * 10 * scale
,amount: res.get ('etiquetas')
});
}
else
{
remainings.push ({
name: res.get ('Article') +' x'+ res.get ('Medida')
,amount: res.get ('etiquetas')
});
}
// Intializes the allocator
alloc = new Vn.Allocator ();
alloc.items = items;
alloc.maxAmount = this.maxAmount;
alloc.shelfFunc = this.drawShelf.bind (this);
alloc.boxFunc = this.drawBox.bind (this);
alloc.nTrays = Math.ceil (
(shelf.height - shelf.firstTrayElevation) /
(shelf.trayHeight + shelf.trayDensity)
@ -115,6 +124,40 @@ Vn.ShelvesReport = new Class
// Opens the report
this.createWindow ('shelves');
// Remaining amount
if (remainings.length > 0)
{
var sheet = this.doc.createElement ('div');
sheet.className = 'sheet';
this.doc.body.appendChild (sheet);
var title = this.doc.createElement ('h1');
title.appendChild (this.doc.createTextNode (_('Palets')));
sheet.appendChild (title);
var ul = this.doc.createElement ('ul');
sheet.appendChild (ul);
for (var i = 0; i < remainings.length; i++)
{
var li = this.doc.createElement ('li');
ul.appendChild (li);
var span = this.doc.createElement ('span');
span.className = 'amount';
span.appendChild (this.doc.createTextNode (remainings[i].amount));
li.appendChild (span);
var span = this.doc.createElement ('span');
span.appendChild (this.doc.createTextNode (' '+ remainings[i].name));
li.appendChild (span);
}
}
// Draws the shelves
alloc.run ();
}
@ -124,8 +167,7 @@ Vn.ShelvesReport = new Class
var sheet = this.doc.createElement ('div');
sheet.className = 'sheet';
/* sheet.style.top = (allocator.currentShelf * 297) +'mm';
*/ this.doc.body.appendChild (sheet);
this.doc.body.appendChild (sheet);
// Draws the title
@ -283,6 +325,7 @@ Vn.Allocator = new Class
this.lastBoxWidth = 0;
this.trayX = 0;
this.trayY = 0;
this.remaining = false;
for (var i = 0; i < this.items.length; i++)
{
@ -290,11 +333,6 @@ Vn.Allocator = new Class
for (var amount = 0; amount < item.amount; amount++)
{
if (amount == 0
&& this.maxAmount > 0
&& item.amount > this.maxAmount)
break;
this.addBox (item, amount);
this.firstShelfBox = false;
}

View File

@ -1,4 +1,6 @@
/* Shelves */
h1
{
font-weight: normal;
@ -58,3 +60,22 @@ h1.page-number
{
background-color: #ECE !important;
}
/* Remaining amounts*/
ul
{
list-style-type: none;
}
li *
{
font-size: 6mm;
}
.amount
{
width: 10mm;
text-align: right;
display: inline-block;
padding-right: 1mm;
}