ソースを参照

Propagate invoice ID to fee editor

Neal Wilson 9年前
コミット
c3797df7aa
2個のファイルの変更7行の追加2行の削除
  1. 4
    2
      config/Windows/editfee.xml
  2. 3
    0
      config/Windows/invoiceinfo.xml

+ 4
- 2
config/Windows/editfee.xml ファイルの表示

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

+ 3
- 0
config/Windows/invoiceinfo.xml ファイルの表示

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

読み込み中…
キャンセル
保存