Typica is a free program for professional coffee roasters. https://typica.us
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

invoicelist.xml 1.6KB

12345678910111213141516171819202122232425262728
  1. <window id="invoicelist">
  2. <layout type="vertical">
  3. <sqlview id="table" />
  4. </layout>
  5. <program>
  6. <![CDATA[
  7. this.windowTitle = "Typica - Invoice List";
  8. var table = findChildObject(this, 'table');
  9. table.setQuery("SELECT id, time, invoice, vendor, (SELECT sum(cost) FROM invoice_items WHERE invoice_id = id) AS cost FROM invoices ORDER BY time DESC");
  10. table.openEntry.connect(function(arg) {
  11. var info = createWindow("invoiceinfo");
  12. info.setInvoiceID(arg);
  13. var query = new QSqlQuery();
  14. query.exec("SELECT time, invoice, vendor FROM invoices WHERE id = " + arg);
  15. query.next();
  16. var timefield = findChildObject(info, 'date');
  17. timefield.text = query.value(0);
  18. var vendorfield = findChildObject(info, 'vendor');
  19. vendorfield.text = query.value(2);
  20. var invoicefield = findChildObject(info, 'invoice');
  21. invoicefield.text = query.value(1);
  22. var itemtable = findChildObject(info, 'itemtable');
  23. itemtable.setQuery("SELECT record_type, item_id, description, (SELECT reference FROM items WHERE id = item_id) AS reference, (SELECT cost FROM purchase WHERE item = item_id) AS unit_cost, (SELECT quantity FROM purchase WHERE item = item_id) AS quantity, ((SELECT quantity FROM purchase WHERE item = item_id)/(SELECT conversion FROM lb_bag_conversion WHERE item = item_id))::numeric(12,2) AS sacks, cost FROM invoice_items WHERE invoice_id = " + arg + " AND record_type = 'PURCHASE' UNION SELECT record_type, NULL, description, NULL, NULL, NULL, NULL, cost FROM invoice_items WHERE invoice_id = " + arg + " AND record_type = 'FEE' ORDER BY item_id");
  24. query = query.invalidate();
  25. });
  26. ]]>
  27. </program>
  28. </window>