Typica is a free program for professional coffee roasters. https://typica.us
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

history.xml 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <window id="history">
  2. <layout type="vertical">
  3. <sqlview id="table" />
  4. </layout>
  5. <program>
  6. <![CDATA[
  7. var q = "SELECT time, machine, (SELECT name FROM items WHERE id = roasted_id) AS name, unroasted_total_quantity AS green, roasted_quantity AS roasted, ((unroasted_total_quantity - roasted_quantity) / unroasted_total_quantity * 100::numeric)::numeric(12,2) AS weight_loss, duration FROM roasting_log ORDER BY time DESC";
  8. //var q = "SELECT time, name, unroasted_total_quantity AS green, roasted_quantity AS roasted, weight_loss AS loss, duration FROM short_log ORDER BY time DESC";
  9. var table = findChildObject(this, 'table');
  10. table.setQuery(q);
  11. table.hideColumn(1);
  12. table.openEntryRow.connect(function(arg) {
  13. var details = createWindow("batchDetails");
  14. details.loadData(table, arg);
  15. });
  16. /*
  17. table.openEntry.connect(function(arg) {
  18. var details = createWindow("batchDetails");
  19. details.windowTitle = 'Typica - Batch Details';
  20. q = "SELECT time, (SELECT name FROM items WHERE id = roasted_id) AS name, unroasted_total_quantity, roasted_quantity, duration, approval, files FROM roasting_log WHERE time = :time";
  21. query = new QSqlQuery();
  22. query.prepare(q);
  23. query.bind(":time", arg);
  24. query.exec();
  25. query.next();
  26. var timefield = findChildObject(details, 'time');
  27. timefield.text = query.value(0);
  28. var namefield = findChildObject(details, 'name');
  29. namefield.text = query.value(1);
  30. var greenfield = findChildObject(details, 'green');
  31. greenfield.text = query.value(2);
  32. var roastedfield = findChildObject(details, 'roasted');
  33. roastedfield.text = query.value(3);
  34. var durationfield = findChildObject(details, 'duration');
  35. durationfield.text = query.value(4);
  36. var approvalfield = findChildObject(details, 'approval');
  37. approvalfield.text = query.value(5);
  38. var filesfield = findChildObject(details, 'files');
  39. filesfield.text = query.value(6);
  40. query = query.invalidate();
  41. });
  42. */
  43. ]]>
  44. </program>
  45. </window>