Browse Source

Propagate invoice ID to fee editor

Neal Wilson 9 years ago
parent
commit
c3797df7aa
2 changed files with 7 additions and 2 deletions
  1. 4
    2
      config/Windows/editfee.xml
  2. 3
    0
      config/Windows/invoiceinfo.xml

+ 4
- 2
config/Windows/editfee.xml View File

15
 	<program>
15
 	<program>
16
 		<![CDATA[
16
 		<![CDATA[
17
 			window = this;
17
 			window = this;
18
+                        var invoiceID = 0;
18
 			this.windowTitle = 'Typica - Fee Detail';
19
 			this.windowTitle = 'Typica - Fee Detail';
19
 			var descField = findChildObject(this, 'description');
20
 			var descField = findChildObject(this, 'description');
20
 			var costField = findChildObject(this, 'cost');
21
 			var costField = findChildObject(this, 'cost');
21
 			this.dataSet = function() {
22
 			this.dataSet = function() {
22
 				descField.text = window.rowData[2];
23
 				descField.text = window.rowData[2];
23
 				costField.text = window.rowData[7];
24
 				costField.text = window.rowData[7];
25
+                                invoiceID = window.invoiceID;
24
 			};
26
 			};
25
 			button = findChildObject(this, 'submit');
27
 			button = findChildObject(this, 'submit');
26
 			button.clicked.connect(function() {
28
 			button.clicked.connect(function() {
27
 				var query = new QSqlQuery();
29
 				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");
30
+				query.prepare("UPDATE invoice_items SET description = :name, cost = :cost WHERE invoice_id = :id AND record_type = 'FEE' AND description = :oldname AND cost = :oldcost");
29
 				query.bind(":name", descField.text);
31
 				query.bind(":name", descField.text);
30
 				query.bind(":cost", Number(costField.text));
32
 				query.bind(":cost", Number(costField.text));
31
-				query.bind(":id", Number(window.rowData[1]));
33
+				query.bind(":id", Number(invoiceID));
32
 				query.bind(":oldname", window.rowData[2]);
34
 				query.bind(":oldname", window.rowData[2]);
33
 				query.bind(":oldcost", window.rowData[7]);
35
 				query.bind(":oldcost", window.rowData[7]);
34
 				query.exec();
36
 				query.exec();

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

14
 	<program>
14
 	<program>
15
 		<![CDATA[
15
 		<![CDATA[
16
 			var window = this;
16
 			var window = this;
17
+                        var invoiceID = 0;
17
 			var table = findChildObject(this, 'itemtable');
18
 			var table = findChildObject(this, 'itemtable');
18
 			this.setInvoiceID = function(arg) {
19
 			this.setInvoiceID = function(arg) {
19
 				window.invoiceID = arg;
20
 				window.invoiceID = arg;
21
+                                invoiceID = arg;
20
 				window.windowTitle = "Typica - Invoice Details " + arg;
22
 				window.windowTitle = "Typica - Invoice Details " + arg;
21
 			};
23
 			};
22
 			button = findChildObject(this, 'edit');
24
 			button = findChildObject(this, 'edit');
43
 					for(var i = 0; i < 8; i++) {
45
 					for(var i = 0; i < 8; i++) {
44
 						feeWindow.rowData[i] = table.data(arg, i);
46
 						feeWindow.rowData[i] = table.data(arg, i);
45
 					}
47
 					}
48
+                                        feeWindow.invoiceID = invoiceID;
46
 					feeWindow.dataSet();
49
 					feeWindow.dataSet();
47
 				}
50
 				}
48
 			});
51
 			});

Loading…
Cancel
Save