diff options
Diffstat (limited to 'src/pdf-stock')
-rw-r--r-- | src/pdf-stock/Makefile | 4 | ||||
-rw-r--r-- | src/pdf-stock/pdf-stock-interface.vala | 3 | ||||
-rw-r--r-- | src/pdf-stock/pdf-stock.vala | 5 |
3 files changed, 8 insertions, 4 deletions
diff --git a/src/pdf-stock/Makefile b/src/pdf-stock/Makefile index 2c8be58..a9ad1a6 100644 --- a/src/pdf-stock/Makefile +++ b/src/pdf-stock/Makefile @@ -6,10 +6,10 @@ all: pdf-stock @echo > /dev/null pdf-stock: main.vala pdf-stock.vala ../database/db-interface.vala ../price.vapi ../../libcairobarcode/libcairobarcode.vapi - ${VALAC} -X -w ${LIBCAIROBARCODE} -o $@ --pkg cairo --pkg pangocairo --pkg gio-2.0 --pkg posix $^ + valac -X -w ${LIBCAIROBARCODE} -o $@ --pkg cairo --pkg pangocairo --pkg gio-2.0 --pkg posix $^ test: test.vala pdf-stock-interface.vala - ${VALAC} -X -w -o $@ --pkg gio-2.0 $^ + valac -X -w -o $@ --pkg gio-2.0 $^ run: pdf-stock LD_LIBRARY_PATH=../../libcairobarcode ./pdf-stock diff --git a/src/pdf-stock/pdf-stock-interface.vala b/src/pdf-stock/pdf-stock-interface.vala index 415916f..be49a20 100644 --- a/src/pdf-stock/pdf-stock-interface.vala +++ b/src/pdf-stock/pdf-stock-interface.vala @@ -15,5 +15,6 @@ [DBus (name = "io.mainframe.shopsystem.StockPDF")] public interface PDFStock : Object { - public abstract uint8[] generate() throws IOError; + // if false, only products with an amount > 0 are selected + public abstract uint8[] generate(bool allProducts) throws IOError; } diff --git a/src/pdf-stock/pdf-stock.vala b/src/pdf-stock/pdf-stock.vala index e971f78..ac51c23 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() { + public uint8[] generate(bool allProducts) { 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; |