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.

editfee.xml 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <window id="invoicefeedetail">
  2. <layout type="vertical">
  3. <layout type="grid">
  4. <row>
  5. <column><label>Description</label></column>
  6. <column><line id="description" /></column>
  7. </row>
  8. <row>
  9. <column><label>Cost</label></column>
  10. <column><line id="cost" validator="numeric"/></column>
  11. </row>
  12. </layout>
  13. <button name="submit" type="push" id="submit" />
  14. </layout>
  15. <program>
  16. <![CDATA[
  17. window = this;
  18. this.windowTitle = 'Typica - Fee Detail';
  19. var descField = findChildObject(this, 'description');
  20. var costField = findChildObject(this, 'cost');
  21. this.dataSet = function() {
  22. descField.text = window.rowData[2];
  23. costField.text = window.rowData[7];
  24. };
  25. button = findChildObject(this, 'submit');
  26. button.clicked.connect(function() {
  27. var query = new QSqlQuery();
  28. query.prepare("UPDATE invoice_items SET description = :name, cost = :cost WHERE invoice_id = :id AND record_type = 'FEE' AND item_id = NULL AND description = :oldname AND cost = :oldcost");
  29. query.bind(":name", descField.text);
  30. query.bind(":cost", Number(costField.text));
  31. query.bind(":id", Number(window.rowData[1]));
  32. query.bind(":oldname", window.rowData[2]);
  33. query.bind(":oldcost", window.rowData[7]);
  34. query.exec();
  35. query = query.invalidate();
  36. window.close();
  37. });
  38. ]]>
  39. </program>
  40. </window>