Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Dialog.XtupleReceivePayment.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Pman.Dialog.XtupleReceivePayment = {
6
7     dialog : false,
8     callback:  false,
9
10     show : function(data, cb)
11     {
12         if (!this.dialog) {
13             this.create();
14         }
15
16         this.callback = cb;
17         this.data = data;
18         this.dialog.show(this.data._el);
19         if (this.form) {
20            this.form.reset();
21            this.form.setValues(data);
22            this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
23         }
24
25     },
26
27     create : function()
28     {
29         var _this = this;
30         this.dialog = Roo.factory({
31             xtype: 'LayoutDialog',
32             xns: Roo,
33             listeners : {
34                 show : function (_self)
35                 {
36                     this.layout.getRegion('center').showPanel(0);
37                 }
38             },
39             closable : false,
40             collapsible : false,
41             height : 400,
42             modal : true,
43             resizable : false,
44             title : "Create Receive Payment",
45             width : 600,
46             items : [
47                 {
48                     xtype: 'ContentPanel',
49                     xns: Roo,
50                     region : 'center',
51                     items : [
52                         {
53                             xtype: 'Form',
54                             xns: Roo.form,
55                             listeners : {
56                                 actioncomplete : function(_self,action)
57                                 {
58                                     if (action.type == 'setdata') {
59                                         if(_this.data.cashrcpt_id){
60                                            _this.dialog.el.mask("Loading");
61                                            this.load({ method: 'GET', params: { '_id' : _this.data.cashrcpt_id }});
62                                            return;
63                                        }
64                                     }
65                                     if (action.type == 'load') {
66                                         _this.dialog.el.unmask();
67                                         return;
68                                     }
69                                     if (action.type =='submit') {
70                                     
71                                         _this.dialog.el.unmask();
72                                         _this.dialog.hide();
73                                     
74                                          if (_this.callback) {
75                                             _this.callback.call(_this, _this.form.getValues());
76                                          }
77                                          _this.form.reset();
78                                          return;
79                                     }
80                                 },
81                                 rendered : function (form)
82                                 {
83                                     _this.form= form;
84                                 }
85                             },
86                             labelWidth : 150,
87                             method : 'POST',
88                             style : 'margin:10px;',
89                             url : baseURL + '/Roo/cashrcpt.php',
90                             items : [
91                                 {
92                                     xtype: 'NumberField',
93                                     xns: Roo.form,
94                                     allowBlank : false,
95                                     allowDecimals : true,
96                                     decimalPrecision : 2,
97                                     fieldLabel : 'Amount Received',
98                                     name : 'cashrcpt_amount',
99                                     readOnly : true,
100                                     width : 200
101                                 },
102                                 {
103                                     xtype: 'ComboBox',
104                                     xns: Roo.form,
105                                     allowBlank : false,
106                                     disabled : true,
107                                     displayField : 'curr_name',
108                                     editable : false,
109                                     emptyText : "Select curr_name",
110                                     fieldLabel : 'Currency',
111                                     forceSelection : true,
112                                     hiddenName : 'cashrcpt_curr_id',
113                                     listWidth : 400,
114                                     loadingText : "Searching...",
115                                     minChars : 2,
116                                     name : 'cashrcpt_curr_id_curr_name',
117                                     pageSize : 20,
118                                     qtip : "Select Currency",
119                                     queryParam : 'query[curr_name]',
120                                     selectOnFocus : true,
121                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{curr_name}</b> </div>',
122                                     triggerAction : 'all',
123                                     typeAhead : true,
124                                     valueField : 'curr_id',
125                                     width : 200,
126                                     store : {
127                                         xtype: 'Store',
128                                         xns: Roo.data,
129                                         listeners : {
130                                             beforeload : function (_self, o){
131                                                 o.params = o.params || {};
132                                                 // set more here
133                                                
134                                             }
135                                         },
136                                         remoteSort : true,
137                                         sortInfo : { direction : 'ASC', field: 'curr_symbol' },
138                                         proxy : {
139                                             xtype: 'HttpProxy',
140                                             xns: Roo.data,
141                                             method : 'GET',
142                                             url : baseURL + '/Roo/curr_symbol.php'
143                                         },
144                                         reader : {
145                                             xtype: 'JsonReader',
146                                             xns: Roo.data,
147                                             id : 'curr_id',
148                                             root : 'data',
149                                             totalProperty : 'total',
150                                             fields : [{"name":"curr_id","type":"int"},"curr_symbol"]
151                                         }
152                                     }
153                                 },
154                                 {
155                                     xtype: 'ComboBox',
156                                     xns: Roo.form,
157                                     allowBlank : false,
158                                     displayField : 'fname',
159                                     editable : false,
160                                     fieldLabel : 'Funds Type',
161                                     hiddenName : 'cashrcpt_fundstype',
162                                     listWidth : 200,
163                                     mode : 'local',
164                                     name : 'cashrcpt_fundstype_name',
165                                     triggerAction : 'all',
166                                     valueField : 'ftype',
167                                     width : 200,
168                                     store : {
169                                         xtype: 'SimpleStore',
170                                         xns: Roo.data,
171                                         data : [ 
172                                             [ 'C', "Check"],
173                                             [ 'K' , "Cash"]
174                                         ],
175                                         fields : [  'ftype', 'fname']
176                                     }
177                                 },
178                                 {
179                                     xtype: 'TextField',
180                                     xns: Roo.form,
181                                     allowBlank : true,
182                                     fieldLabel : 'Check / Document #',
183                                     name : 'cashrcpt_docnumber',
184                                     width : 200
185                                 },
186                                 {
187                                     xtype: 'DateField',
188                                     xns: Roo.form,
189                                     allowBlank : false,
190                                     fieldLabel : 'Check / Document Date',
191                                     format : 'Y-m-d',
192                                     name : 'cashrcpt_docdate',
193                                     width : 200
194                                 },
195                                 {
196                                     xtype: 'DateField',
197                                     xns: Roo.form,
198                                     allowBlank : false,
199                                     fieldLabel : 'Distribution Date',
200                                     format : 'Y-m-d',
201                                     name : 'cashrcpt_distdate',
202                                     width : 200
203                                 },
204                                 {
205                                     xtype: 'DateField',
206                                     xns: Roo.form,
207                                     allowBlank : false,
208                                     fieldLabel : 'Application Date',
209                                     format : 'Y-m-d',
210                                     name : 'cashrcpt_applydate',
211                                     width : 200
212                                 },
213                                 {
214                                     xtype: 'ComboBox',
215                                     xns: Roo.form,
216                                     allowBlank : false,
217                                     displayField : 'bankaccnt_name',
218                                     editable : false,
219                                     emptyText : "Select Bank Accnt",
220                                     fieldLabel : 'Post to',
221                                     forceSelection : true,
222                                     hiddenName : 'cashrcpt_bankaccnt_id',
223                                     listWidth : 400,
224                                     loadingText : "Searching...",
225                                     minChars : 2,
226                                     name : 'cashrcpt_bankaccnt_id_name',
227                                     pageSize : 20,
228                                     qtip : "Select Bank Accnt",
229                                     queryParam : 'query[bankaccnt_name]',
230                                     selectOnFocus : true,
231                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{bankaccnt_name} - {bankaccnt_descrip}</b> </div>',
232                                     triggerAction : 'all',
233                                     typeAhead : true,
234                                     valueField : 'bankaccnt_id',
235                                     width : 200,
236                                     store : {
237                                         xtype: 'Store',
238                                         xns: Roo.data,
239                                         listeners : {
240                                             beforeload : function (_self, o){
241                                                 o.params = o.params || {};
242                                                 // set more here
243                                                
244                                             }
245                                         },
246                                         remoteSort : true,
247                                         sortInfo : { direction : 'DESC', field: 'bankaccnt_id' },
248                                         proxy : {
249                                             xtype: 'HttpProxy',
250                                             xns: Roo.data,
251                                             method : 'GET',
252                                             url : baseURL + '/Roo/bankaccnt.php'
253                                         },
254                                         reader : {
255                                             xtype: 'JsonReader',
256                                             xns: Roo.data,
257                                             id : 'bankaccnt_id',
258                                             root : 'data',
259                                             totalProperty : 'total',
260                                             fields : [{"name":"bankaccnt_id","type":"int"},"bankaccnt_name"]
261                                         }
262                                     }
263                                 },
264                                 {
265                                     xtype: 'TextArea',
266                                     xns: Roo.form,
267                                     fieldLabel : 'Notes',
268                                     name : 'cashrcpt_notes'
269                                 },
270                                 {
271                                     xtype: 'Hidden',
272                                     xns: Roo.form,
273                                     name : 'cashrcpt_id'
274                                 },
275                                 {
276                                     xtype: 'Hidden',
277                                     xns: Roo.form,
278                                     name : 'cashrcpt_aropen_id'
279                                 },
280                                 {
281                                     xtype: 'Hidden',
282                                     xns: Roo.form,
283                                     name : 'cashrcpt_cust_id'
284                                 },
285                                 {
286                                     xtype: 'Hidden',
287                                     xns: Roo.form,
288                                     name : 'cashrcpt_salescat_id'
289                                 },
290                                 {
291                                     xtype: 'Hidden',
292                                     xns: Roo.form,
293                                     name : 'cashrcpt_discount'
294                                 },
295                                 {
296                                     xtype: 'Hidden',
297                                     xns: Roo.form,
298                                     name : 'cashrcpt_usecustdeposit'
299                                 }
300                             ]
301                         }
302                     ]
303                 }
304             ],
305             center : {
306                 xtype: 'LayoutRegion',
307                 xns: Roo
308             },
309             buttons : [
310                 {
311                     xtype: 'Button',
312                     xns: Roo,
313                     listeners : {
314                         click : function (_self, e)
315                         {
316                             _this.dialog.hide();
317                         }
318                     },
319                     text : "Cancel"
320                 },
321                 {
322                     xtype: 'Button',
323                     xns: Roo,
324                     listeners : {
325                         click : function (_self, e)
326                         {
327                             // do some checks?
328                              
329                             
330                           //  _this.dialog.el.mask("Saving");
331                             _this.form.doAction("submit");
332                         
333                         }
334                     },
335                     text : "Save"
336                 }
337             ]
338         });
339     }
340 };