Typica is a free program for professional coffee roasters. https://typica.us
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <window id="invoiceinfo">
  2. <layout type="vertical">
  3. <layout type="horizontal">
  4. <label>Date:</label>
  5. <line id="date" writable="false" />
  6. <label>Vendor:</label>
  7. <line id="vendor" writable="false" />
  8. <label>Invoice:</label>
  9. <line id="invoice" writable="false" />
  10. <button id="edit" name="Edit" type="push" />
  11. </layout>
  12. <sqlview id="itemtable" />
  13. </layout>
  14. <program>
  15. <![CDATA[
  16. var window = this;
  17. var invoiceID = 0;
  18. var table = findChildObject(this, 'itemtable');
  19. var timefield = findChildObject(this, 'date');
  20. var vendorfield = findChildObject(this, 'vendor');
  21. var invoicefield = findChildObject(this, 'invoice');
  22. var w = window;
  23. this.setInvoiceID = function(arg) {
  24. w.invoiceID = arg;
  25. invoiceID = arg;
  26. w.windowTitle = TTR("invoiceinfo", "Typica - Invoice Details ") + arg;
  27. var query = new QSqlQuery();
  28. query.exec("SELECT time, invoice, vendor FROM invoices WHERE id = " + arg);
  29. query.next();
  30. timefield.text = query.value(0);
  31. vendorfield.text = query.value(2);
  32. invoicefield.text = query.value(1);
  33. table.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");
  34. query = query.invalidate();
  35. };
  36. this.refresh = function() {
  37. w.setInvoiceID(w.invoiceID);
  38. };
  39. button = findChildObject(this, 'edit');
  40. button.clicked.connect(function() {
  41. var editInvoiceDetails = createWindow("editinvoice");
  42. editInvoiceDetails.invoiceID = window.invoiceID;
  43. var invoiceLine = findChildObject(editInvoiceDetails, 'invoice');
  44. var localInvoiceLine = findChildObject(window, 'invoice');
  45. invoiceLine.text = localInvoiceLine.text;
  46. editInvoiceDetails.invoiceID = window.invoiceID;
  47. });
  48. table.openEntryRow.connect(function(arg) {
  49. if(table.data(arg, 0) == 'PURCHASE') {
  50. var itemWindow = createWindow("invoiceitemdetail");
  51. itemWindow.rowData = [];
  52. itemWindow.pWindow = w;
  53. for(var i = 0; i < 8; i++) {
  54. itemWindow.rowData[i] = table.data(arg, i);
  55. }
  56. itemWindow.dataSet();
  57. }
  58. else {
  59. var feeWindow = createWindow("invoicefeedetail");
  60. feeWindow.rowData = [];
  61. feeWindow.pWindow = w;
  62. for(var i = 0; i < 8; i++) {
  63. feeWindow.rowData[i] = table.data(arg, i);
  64. }
  65. feeWindow.invoiceID = invoiceID;
  66. feeWindow.dataSet();
  67. }
  68. });
  69. ]]>
  70. </program>
  71. </window>