Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Dialog.XtupleDiscountOfInvoice.bjs
1 {
2     "id": "roo-file-7",
3     "name": "Pman.Dialog.XtupleDiscountOfInvoice",
4     "parent": "",
5     "title": "",
6     "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Dialog.XtupleDiscountOfInvoice.bjs",
7     "items": [
8         {
9             "listeners": {
10                 "show": "function (_self)\n{\n  _this.form.findField('discount').focus();\n}"
11             },
12             "closable": false,
13             "height": 150,
14             "modal": true,
15             "resizable": false,
16             "title": "% Discount to Offer",
17             "width": 400,
18             "xtype": "LayoutDialog",
19             "|xns": "Roo",
20             "items": [
21                 {
22                     "|xns": "Roo",
23                     "xtype": "LayoutRegion",
24                     "*prop": "center"
25                 },
26                 {
27                     "region": "center",
28                     "xtype": "ContentPanel",
29                     "|xns": "Roo",
30                     "items": [
31                         {
32                             "listeners": {
33                                 "rendered": "function (form)\n{\n  _this.form = form;\n}"
34                             },
35                             "labelWidth": 150,
36                             "xtype": "Form",
37                             "|xns": "Roo.form",
38                             "items": [
39                                 {
40                                     "allowBlank": false,
41                                     "allowDecimals": true,
42                                     "allowNegative": false,
43                                     "decimalPrecision": 2,
44                                     "fieldLabel": "% Discount to Offer.",
45                                     "name": "discount",
46                                     "width": 200,
47                                     "xtype": "NumberField",
48                                     "|xns": "Roo.form"
49                                 },
50                                 {
51                                     "name": "invchead_id",
52                                     "xtype": "Hidden",
53                                     "|xns": "Roo.form"
54                                 }
55                             ]
56                         }
57                     ]
58                 },
59                 {
60                     "listeners": {
61                         "click": "function (_self, e)\n{\n   _this.dialog.hide();\n \n }"
62                     },
63                     "*prop": "buttons[]",
64                     "text": "Cancel",
65                     "xtype": "Button",
66                     "|xns": "Roo"
67                 },
68                 {
69                     "listeners": {
70                         "click": "function (_self, e)\n{\n   var data = _this.form.getFieldValues();\n   \n   if (data.invchead_id * 1 < 1) {\n        Roo.MessageBox.alert(\"Error\", \"Missing invchead_id\");\n        return;\n   }\n   \n   if(data.discount > 100){\n        Roo.MessageBox.alert(\"Error\", \"Maximum of discount value is 100\");\n        return;\n   }\n   \n   var discount = 100 - data.discount;\n   \n   var params  = {\n        template: 'Shipping-Invoice-' + baseURL.split('/').pop().split('.').shift(),\n        filename : 'Shipping-Invoice-' + data.invchead_id,\n        'param[0]':   \"invchead_id:integer='\" + data.invchead_id + \"'\",\n        'param[1]':   \"discount:integer='\" + discount + \"'\"\n    };\n    \n   new Pman.Download({\n        url : baseURL + '/Xtuple/Print',\n        method : 'GET',\n        params : params,\n        success : function() {\n\n        }\n    })\n    _this.dialog.hide();\n}"
71                     },
72                     "*prop": "buttons[]",
73                     "text": "OK",
74                     "xtype": "Button",
75                     "|xns": "Roo"
76                 }
77             ]
78         }
79     ],
80     "permname": "",
81     "modOrder": "001"
82 }