Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Dialog.XtupleJournalEntry.js
index 5f511f2..635c66f 100644 (file)
@@ -51,16 +51,20 @@ Pman.Dialog.XtupleJournalEntry = {
                                 {
                                     if (action.type == 'setdata') {
                                        //_this.dialog.el.mask("Loading");
-                                       //this.load({ method: 'GET', params: { '_id' : _this.data.id }});
+                                       if (_this.data.gltrans_id) {
+                                            this.load({ method: 'GET', params: { '_id' : _this.data.gltrans_id }});
+                                           return;
+                                       }
+                                       _this.grid.footer.onClick('first'); // clear..
                                        return;
                                     }
                                     if (action.type == 'load') {
-                                        _this.dialog.el.unmask();
+                                         _this.grid.footer.onClick('first');
                                         return;
                                     }
                                     if (action.type =='submit') {
                                     
-                                        _this.dialog.el.unmask();
+                                        
                                         _this.dialog.hide();
                                     
                                          if (_this.callback) {
@@ -90,6 +94,7 @@ Pman.Dialog.XtupleJournalEntry = {
                                             xns: Roo.form,
                                             fieldLabel : 'Sequence',
                                             name : 'gltrans_sequence',
+                                            readOnly : true,
                                             width : 100
                                         },
                                         {
@@ -97,6 +102,7 @@ Pman.Dialog.XtupleJournalEntry = {
                                             xns: Roo.form,
                                             fieldLabel : 'Journal No.',
                                             name : 'gltrans_journalnumber',
+                                            readOnly : true,
                                             width : 75
                                         },
                                         {
@@ -125,8 +131,9 @@ Pman.Dialog.XtupleJournalEntry = {
                                         {
                                             xtype: 'TextField',
                                             xns: Roo.form,
-                                            fieldLabel : 'Entered',
-                                            name : 'gltrans_entered',
+                                            fieldLabel : 'Created',
+                                            name : 'gltrans_created',
+                                            readOnly : true,
                                             width : 150
                                         }
                                     ]
@@ -140,8 +147,9 @@ Pman.Dialog.XtupleJournalEntry = {
                                             xns: Roo.form,
                                             boxLabel : 'Posted',
                                             fieldLabel : 'Status',
-                                            name : 'Posted',
-                                            width : 75
+                                            name : 'gltrans_posted',
+                                            width : 100,
+                                            inputValue : true
                                         },
                                         {
                                             xtype: 'Row',
@@ -153,6 +161,7 @@ Pman.Dialog.XtupleJournalEntry = {
                                                     xns: Roo.form,
                                                     boxLabel : 'Recorded in Bank Reconcile',
                                                     fieldLabel : ' ',
+                                                    inputValue : true,
                                                     name : 'gltrans_rec',
                                                     width : 200
                                                 },
@@ -161,6 +170,7 @@ Pman.Dialog.XtupleJournalEntry = {
                                                     xns: Roo.form,
                                                     boxLabel : 'Deleted',
                                                     fieldLabel : 'Deleted',
+                                                    inputValue : true,
                                                     name : 'gltrans_deleted',
                                                     width : 75
                                                 }
@@ -177,6 +187,7 @@ Pman.Dialog.XtupleJournalEntry = {
                                             xns: Roo.form,
                                             fieldLabel : 'Source',
                                             name : 'gltrans_source',
+                                            readOnly : true,
                                             width : 100
                                         },
                                         {
@@ -184,6 +195,7 @@ Pman.Dialog.XtupleJournalEntry = {
                                             xns: Roo.form,
                                             fieldLabel : 'Doc Type',
                                             name : 'gltrans_doctype',
+                                            readOnly : true,
                                             width : 100
                                         },
                                         {
@@ -191,16 +203,35 @@ Pman.Dialog.XtupleJournalEntry = {
                                             xns: Roo.form,
                                             fieldLabel : 'References',
                                             name : 'gltrans_misc_id',
+                                            readOnly : true,
                                             width : 75
+                                        },
+                                        {
+                                            xtype: 'Button',
+                                            xns: Roo,
+                                            text : "Show"
                                         }
                                     ]
                                 },
                                 {
-                                    xtype: 'TextField',
+                                    xtype: 'Row',
                                     xns: Roo.form,
-                                    fieldLabel : 'Doc No.',
-                                    name : 'gltrans_docnumber',
-                                    width : 400
+                                    items : [
+                                        {
+                                            xtype: 'TextField',
+                                            xns: Roo.form,
+                                            fieldLabel : 'Doc No.',
+                                            name : 'gltrans_docnumber',
+                                            width : 100
+                                        },
+                                        {
+                                            xtype: 'TextField',
+                                            xns: Roo.form,
+                                            fieldLabel : 'Notes',
+                                            name : 'gltrans_notes',
+                                            width : 300
+                                        }
+                                    ]
                                 }
                             ]
                         }
@@ -243,7 +274,7 @@ Pman.Dialog.XtupleJournalEntry = {
                                 }); 
                             }
                         },
-                        autoExpandColumn : 'gltrans_source',
+                        autoExpandColumn : 'gltrans_accnt_id',
                         loadMask : true,
                         dataSource : {
                             xtype: 'Store',
@@ -397,37 +428,37 @@ Pman.Dialog.XtupleJournalEntry = {
                             {
                                 xtype: 'ColumnModel',
                                 xns: Roo.grid,
-                                dataIndex : 'ID#',
-                                header : 'Gltrans',
+                                dataIndex : 'gltrans_id',
+                                header : 'ID#',
                                 width : 50,
                                 renderer : function(v) { return String.format('{0}', v); }
                             },
                             {
                                 xtype: 'ColumnModel',
                                 xns: Roo.grid,
-                                dataIndex : 'gltrans_sequence',
-                                header : 'Gltrans sequence',
+                                dataIndex : 'gltrans_accnt_id',
+                                header : 'Account',
                                 width : 75,
                                 renderer : function(v,x,r) {
                                 
-                                     return String.format('{0}', r.data.gltrans_accnt_id_accnt_descript); 
+                                     return String.format('{0}', r.data.gltrans_accnt_id_accnt_descrip); 
                                  }
                             },
                             {
                                 xtype: 'ColumnModel',
                                 xns: Roo.grid,
-                                header : 'Gltrans amount',
-                                width : 75,
+                                align : 'right',
                                 dataIndex : 'gltrans_amount',
-                                renderer : function(v) { return String.format('{0}', v); }
-                            },
-                            {
-                                xtype: 'ColumnModel',
-                                xns: Roo.grid,
-                                header : 'Gltrans deleted',
-                                width : 75,
-                                dataIndex : 'gltrans_deleted',
-                                renderer : function(v) { return String.format('{0}', v); }
+                                header : 'Gltrans amount',
+                                width : 100,
+                                renderer : function(v) { 
+                                
+                                    var vv = Roo.util.Format.number(v,2);
+                                    if (v*1 < 0 ) {
+                                        return '<span style="color:red">' + vv + '</span>';
+                                    }
+                                    return vv; 
+                                }
                             }
                         ]
                     }
@@ -462,8 +493,10 @@ Pman.Dialog.XtupleJournalEntry = {
                         {
                             // do some checks?
                              
-                            
-                            _this.dialog.el.mask("Saving");
+                            if (_this.data.gltrans_id) {
+                                return;
+                            }
+                        
                             _this.form.doAction("submit");
                         
                         }