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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <window id="editBatchDetails">
  2. <layout type="vertical">
  3. <layout type="horizontal">
  4. <label>Roasted Weight: </label>
  5. <line id="roasted" validator="numeric" />
  6. <line id="roastunit" writable="false" />
  7. </layout>
  8. <button type="check" name="Approved" id="approval" />
  9. <layout type="horizontal">
  10. <label>Annotation</label>
  11. <textarea id="annotation" />
  12. </layout>
  13. <button type="push" id="submit" name="Submit" />
  14. </layout>
  15. <program>
  16. <![CDATA[
  17. var window = this;
  18. var approvalButton = findChildObject(this, 'approval');
  19. var annotationField = findChildObject(this, 'annotation');
  20. var parentWindow;
  21. var tableReference;
  22. var rowReference;
  23. var timeKey;
  24. var machineKey;
  25. var submit = findChildObject(this, 'submit');
  26. submit.enabled = false;
  27. var roastedEdit = findChildObject(this, 'roasted');
  28. var unitEdit = findChildObject(this, 'roastunit');
  29. var conversion = 1;
  30. this.loadData = function(parent, table, row, time, machine, approval, annotation, roastWeight, unit) {
  31. parentWindow = parent;
  32. tableReference = table;
  33. rowReference = row;
  34. if(approval == "true") {
  35. approvalButton.checked = true;
  36. }
  37. annotationField.plainText = annotation;
  38. timeKey = time;
  39. machineKey = machine;
  40. submit.enabled = true;
  41. roastedEdit.text = roastWeight;
  42. if(unit == 0) {
  43. unitEdit.text = TTR("editBatchDetails", "Kg");
  44. conversion = 2.2;
  45. } else {
  46. unitEdit.text = TTR("editBatchDetails", "Lb");
  47. }
  48. };
  49. submit.clicked.connect(function() {
  50. var query = new QSqlQuery;
  51. query.prepare("UPDATE roasting_log SET roasted_quantity = :roasted, approval = :approval, annotation = :annotation WHERE time = :time AND machine = :machine");
  52. query.bind(":approval", approvalButton.checked);
  53. query.bind(":annotation", annotationField.plainText);
  54. query.bind(":roasted", Number(roastedEdit.text)/conversion);
  55. query.bind(":time", timeKey);
  56. query.bind(":machine", Number(machineKey));
  57. query.exec();
  58. parentWindow.loadData(tableReference, rowReference);
  59. window.close();
  60. });
  61. ]]>
  62. </program>
  63. </window>