Browse Source

Add NOTIFY support to purchase reports

Neal Wilson 7 years ago
parent
commit
2be763e598
3 changed files with 12 additions and 1 deletions
  1. 4
    0
      config/Reports/fypurchase.xml
  2. 5
    1
      config/Reports/invoices.xml
  3. 3
    0
      config/Windows/navigation.xml

+ 4
- 0
config/Reports/fypurchase.xml View File

@@ -131,6 +131,10 @@
131 131
 				buffer.close();
132 132
 			}
133 133
 			refresh();
134
+            var notifier = Application.subscribe("purchasechange");
135
+            notifier.notify.connect(function() {
136
+                refresh();
137
+            });
134 138
 			/* Update report as needed. */
135 139
 			dateSelect.rangeUpdated.connect(function() {
136 140
 				refresh();

+ 5
- 1
config/Reports/invoices.xml View File

@@ -154,5 +154,9 @@
154 154
                 buffer.close();
155 155
             }
156 156
             refresh();
157
+            var notifier = Application.subscribe("invoiceschange");
158
+            notifier.notify.connect(function() {
159
+                refresh();
160
+            });
157 161
         ]]>
158
-    </program>
162
+    </program>

+ 3
- 0
config/Windows/navigation.xml View File

@@ -328,6 +328,9 @@
328 328
             query.exec("CREATE TRIGGER notify_purchase_changed AFTER INSERT OR UPDATE OR DELETE ON purchase FOR EACH STATEMENT EXECUTE PROCEDURE notify_purchase_changed()");
329 329
             query.exec("CREATE OR REPLACE FUNCTION notify_sale_changed() RETURNS trigger AS $$ BEGIN NOTIFY SaleChange; RETURN NULL; END; $$ LANGUAGE plpgsql");
330 330
             query.exec("CREATE TRIGGER notify_sale_changed AFTER INSERT OR UPDATE OR DELETE ON sale FOR EACH STATEMENT EXECUTE PROCEDURE notify_sale_changed()");
331
+            query.exec("CREATE OR REPLACE FUNCTION notify_invoices_changed() RETURNS trigger AS $$ BEGIN NOTIFY InvoicesChange; RETURN NULL; END; $$ LANGUAGE plpgsql");
332
+            query.exec("CREATE TRIGGER nofify_invoices_changed AFTER INSERT OR UPDATE OR DELETE ON invoices FOR EACH STATEMENT EXECUTE PROCEDURE notify_invoices_changed()");
333
+            query.exec("CREATE TRIGGER notify_invoices_changed AFTER INSERT OR UPDATE OR DELETE ON invoice_items FOR EACH STATEMENT EXECUTE PROCEDURE notify_invoices_changed()");
331 334
             
332 335
             query.exec("UPDATE TypicaFeatures SET version = 8 WHERE feature = 'base-features'");
333 336
             query = query.invalidate();

Loading…
Cancel
Save