summaryrefslogtreecommitdiffstats
path: root/src/pdf-stock
diff options
context:
space:
mode:
Diffstat (limited to 'src/pdf-stock')
-rw-r--r--src/pdf-stock/pdf-stock-interface.vala2
-rw-r--r--src/pdf-stock/pdf-stock.vala5
-rw-r--r--src/pdf-stock/test.vala2
3 files changed, 6 insertions, 3 deletions
diff --git a/src/pdf-stock/pdf-stock-interface.vala b/src/pdf-stock/pdf-stock-interface.vala
index 5168250..87d9f61 100644
--- a/src/pdf-stock/pdf-stock-interface.vala
+++ b/src/pdf-stock/pdf-stock-interface.vala
@@ -15,5 +15,5 @@
[DBus (name = "io.mainframe.shopsystem.StockPDF")]
public interface PDFStock : Object {
- public abstract uint8[] generate() throws DBusError, IOError;
+ public abstract uint8[] generate(bool allProducts) throws DBusError, IOError;
}
diff --git a/src/pdf-stock/pdf-stock.vala b/src/pdf-stock/pdf-stock.vala
index 2edba88..6270c43 100644
--- a/src/pdf-stock/pdf-stock.vala
+++ b/src/pdf-stock/pdf-stock.vala
@@ -154,7 +154,7 @@ public class StockPDF {
return Cairo.Status.SUCCESS;
}
- public uint8[] generate() throws DBusError, IOError {
+ public uint8[] generate(bool allProducts) throws DBusError, IOError {
data = null;
var surface = new Cairo.PdfSurface.for_stream(pdf_write, a4w, a4h);
@@ -187,6 +187,9 @@ public class StockPDF {
render_table_header();
foreach(var p in stock) {
+ if (!allProducts && p.amount <= 0) {
+ continue;
+ }
render_table_row(p);
y += eanh + 6;
diff --git a/src/pdf-stock/test.vala b/src/pdf-stock/test.vala
index 2e35f9c..92b6232 100644
--- a/src/pdf-stock/test.vala
+++ b/src/pdf-stock/test.vala
@@ -16,7 +16,7 @@
public static int main(string args[]) {
try {
PDFStock stock = Bus.get_proxy_sync(BusType.SYSTEM, "io.mainframe.shopsystem.StockPDF", "/io/mainframe/shopsystem/stockpdf");
- var pdfdata = stock.generate();
+ var pdfdata = stock.generate(true);
FileUtils.set_contents("test.pdf", (string) pdfdata, pdfdata.length);
} catch(IOError e) {
error(_("IO Error: %s"), e.message);