1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Pman.Tab.XtupleGeneralLedger = new Roo.XComponent({
6 part : ["Xtuple","GeneralLedger"],
7 order : '005-Pman.Tab.XtupleGeneralLedger',
9 parent : 'Pman.Tab.XtupleAccountsTab',
10 name : "unnamed module",
18 xtype: 'NestedLayoutPanel',
24 title : "General Ledger",
26 xtype: 'BorderLayout',
33 activate : function() {
36 _this.wgrid.ds.load({});
54 //_this.dialog = Pman.Dialog.FILL_IN
55 if (_this.wpanel.active) {
59 rowclick : function (_self, rowIndex, e)
61 var s = _this.wgrid.ds.getAt(rowIndex);
63 if(s.data.accnt_id * 1 < 1){
67 _this.grid.footer.onClick('first');
71 rowdblclick : function (_self, rowIndex, e)
73 var ret = _this.wgrid.ds.getAt(rowIndex).data;
74 if(ret.accnt_id * 1 < 1){
75 Roo.MessageBox.alert("Error", "Error occur on getting the account id!");
78 Pman.Dialog.XtupleGLAccountNameEdit.show( {accnt_id : ret.accnt_id}, function() {
79 _this.wgrid.ds.load({});
83 autoExpandColumn : 'accnt_descrip',
93 specialkey : function (_self, e)
95 _this.wgrid.ds.load({});
97 render : function (_self)
99 _this.searchBox = _self;
108 click : function (_self, e)
110 _this.wgrid.ds.load({});
114 icon : rootURL + '/Pman/templates/images/search.gif'
120 click : function (_self, e)
122 _this.searchBox.setValue('');
\r
123 _this.wgrid.ds.load({});
\r
127 icon : rootURL + '/Pman/templates/images/edit-clear.gif'
133 render : function (_self)
\r
135 _this.dateSel = _self;
\r
136 _self.setValue( new Date() );
\r
138 select : function (combo, date)
140 _this.wgrid.ds.load({});
155 render : function (_self)
157 _this.orderBox = _self;
165 text : "Download / Upload",
174 click : function (_self, e)
176 _this.active = (_this.active) ? 0 : 1;
177 this.setText(_this.active ? "Show Inactive" : "Hide Inactive");
178 _this.wgrid.ds.load({});
181 text : "Show Inactive"
191 click : function (_self, e)
195 url : baseURL + '/Roo/accnt.php',
200 _with_xt_balances : 1,
201 'csvTitles[0]' : 'Name', 'csvCols[0]' : 'accnt_name',
202 'csvTitles[1]' : 'Description', 'csvCols[1]' : 'accnt_descrip',
203 'csvTitles[2]' : 'Alternative Code', 'csvCols[2]' : 'accnt_code_alt',
204 'csvTitles[3]' : 'Alternative Description', 'csvCols[3]' : 'accnt_code_descrip',
205 'csvTitles[4]' : 'ADJUST', 'csvCols[4]' : 'balance_base'
211 text : "Download Balances"
217 click : function (_self, e)
219 Pman.Dialog.XtupleUploadBalances.show( {} , function(res) {
220 Pman.Dialog.Image.show({
221 _url : baseURL + '/Xtuple/Import/JournalEntry?' + Roo.urlEncode(res)
223 _this.wgrid.ds.load({});
228 text : "Upload JE adjustment"
238 click : function (_self, e)
242 url : baseURL + '/Roo/Metasql',
255 Roo.MessageBox.alert("Notice", "This may take some time to calculate");
258 text : "Download AP - Day by Day Comparison"
264 click : function (_self, e)
268 url : baseURL + '/Roo/Metasql',
273 _name : 'bydatesummary',
280 Roo.MessageBox.alert("Notice", "This may take some time to calculate");
283 text : "Download AP open vs GL - summary of bad days"
289 click : function (_self, e)
293 url : baseURL + '/Roo/Metasql',
297 'startDate:text' : _this.dateSel.getValue().format('Y-m-d'),
298 'endDate:text' : _this.dateSel.getValue().add(Date.DAY,1).format('Y-m-d'),
308 Roo.MessageBox.alert("Notice", "This may take some time to calculate");
311 text : "Download AP - Transactions on a single day"
317 click : function (_self, e)
321 url : baseURL + '/Roo/Metasql',
325 'relDate:text' : _this.dateSel.getValue().format('Y-m-d'),
326 'useDocDate:text' : 'FALSE',
336 Roo.MessageBox.alert("Notice", "This may take some time to calculate");
339 text : "Download AP Aging at this date"
345 click : function (_self, e)
349 url : baseURL + '/Roo/Metasql',
362 Roo.MessageBox.alert("Notice", "This may take some time to calculate");
365 text : "Download AP Aging History"
375 click : function (_self, e)
379 url : baseURL + '/Roo/Metasql',
384 'startDate:text' : _this.dateSel.getValue().format('Y-m-d'),
385 'endDate:text' : _this.dateSel.getValue().add(Date.DAY,1).format('Y-m-d'),
394 text : "Download AR - Transactions on a day"
400 click : function (_self, e)
404 url : baseURL + '/Roo/Metasql',
417 text : "Download AR - Day by Day Comparison"
426 text : "Gltrans vs Stock (COHEAD)",
435 click : function (_self, e)
439 url : baseURL + '/Roo/Metasql',
442 _group : 'gltrans_stock',
451 text : "Download Gltrans vs Stock By Date"
457 click : function (_self, e)
459 var dt = _this.dateSel.getValue();
461 url : baseURL + '/Roo/Metasql',
464 _group : 'gltrans_stock',
466 '_as_of:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
474 text : "Download Gltrans"
480 click : function (_self, e)
482 var dt = _this.dateSel.getValue();
484 url : baseURL + '/Roo/Metasql',
487 _group : 'gltrans_stock',
489 '_as_of:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
497 text : "Download Stock"
509 text : "Gltrans vs Stock (PO)",
518 click : function (_self, e)
522 url : baseURL + '/Roo/Metasql',
526 _group : 'gltrans_stock',
535 text : "Download Gltrans vs Stock By PO"
541 click : function (_self, e)
543 var ord = _this.orderBox.getValue();
546 Roo.MessageBox.alert('Error','Please enter a PO number');
552 url : baseURL + '/Roo/Metasql',
555 _group : 'gltrans_stock',
556 _name : 'byordergltrans',
557 'docnumber:text' : ord,
565 text : "Download Gltrans"
571 click : function (_self, e)
573 var ord = _this.orderBox.getValue();
576 Roo.MessageBox.alert('Error','Please enter a PO number');
582 url : baseURL + '/Roo/Metasql',
585 _group : 'gltrans_stock',
586 _name : 'byorderstock',
587 'docnumber:text' : ord,
595 text : "Download Stock"
616 click : function (_self, e)
620 url : baseURL+'/Xtuple/Kingdee/Currency',
624 Roo.MessageBox.alert("Notice", "Report will download shortly");
633 click : function (_self, e)
637 url : baseURL+'/Xtuple/Kingdee/Rate',
641 Roo.MessageBox.alert("Notice", "Report will download shortly");
644 text : "Exchange Rate"
650 click : function (_self, e)
654 url : baseURL+'/Xtuple/Kingdee/Account',
658 Roo.MessageBox.alert("Notice", "Report will download shortly");
667 click : function (_self, e)
670 url : baseURL+'/Xtuple/Kingdee/VoucherGroup',
674 Roo.MessageBox.alert("Notice", "Report will download shortly");
677 text : "Voucher Category"
683 click : function (_self, e)
685 var dt = _this.dateSel.getValue();
687 url : baseURL+'/Xtuple/Kingdee/Voucher',
691 _as_of : (typeof(dt) == 'string') ? dt : dt.format('Y-m-d')
694 Roo.MessageBox.alert("Notice", "Report will download shortly - If you wanna import again, please delete all the exist!");
697 text : "Transactions"
711 beforeload : function (_self, options)
713 options.params = options.params || {};
715 options.params.limit = 9999;
717 options.params._general_ledger = 1;
719 options.params['search[name]'] = _this.searchBox.getValue();
721 if (_this.active) {
\r
722 options.params.accnt_active = 1;
\r
725 options.params._with_balances = 1;
726 \r var dt = _this.dateSel.getValue();
\r
727 options.params._as_of = typeof(dt) == 'string' ? dt : dt.format('Y-m-d');
733 sortInfo : { field : 'accnt_name', direction: 'ASC' },
738 loadexception : function (This, o, arg, e)
744 url : baseURL + '/Roo/accnt.php'
751 totalProperty : 'total',
758 'name': 'accnt_name',
762 'name': 'accnt_descrip',
766 'name': 'accnt_type',
770 'name': 'accnt_subaccnttype_code',
774 'name': 'accnt_curr_id_curr_name',
778 'name': 'accnt_curr_id_curr_id',
786 xtype: 'ColumnModel',
788 dataIndex : 'accnt_name',
792 renderer : function(v) { return String.format('{0}', v); }
795 xtype: 'ColumnModel',
797 dataIndex : 'accnt_code_alt',
798 header : 'Alternative Code',
802 renderer : function(v) { return String.format('{0}', v); }
805 xtype: 'ColumnModel',
807 dataIndex : 'accnt_descrip_alt',
808 header : 'Alternative Description',
812 renderer : function(v) { return String.format('{0}', v); }
815 xtype: 'ColumnModel',
817 dataIndex : 'accnt_type',
821 renderer : function(v,x,r) {
822 return String.format('{0}-{1}', v,r.data.accnt_subaccnttype_code);
826 xtype: 'ColumnModel',
828 dataIndex : 'accnt_descrip',
829 header : 'Description',
832 renderer : function(v,x,r)
834 if(r.data.accnt_descrip_alt){
835 return String.format('{0} ({1})', v, r.data.accnt_descrip_alt);
838 return String.format('{0}', v);
842 xtype: 'ColumnModel',
845 dataIndex : 'accnt_curr_id_curr_name',
849 renderer : function(v) {
850 var base = baseURL.match(/sg\.php$/) ? 'SGD' : 'HKD';
852 return String.format('<span style="color:green">{0}</span>', v);
855 return String.format('{0}', v);
859 xtype: 'ColumnModel',
861 dataIndex : 'balance',
865 renderer : function(v) {
\r
866 return String.format('<span style="color:blue;text-decoration:underline;">{0}</span>',
\r
867 Roo.util.Format.usMoney(v) );
877 activate : function() {
880 _this.grid.ds.load({});
888 tableName : 'gltrans',
889 title : "Transactions",
897 //_this.dialog = Pman.Dialog.FILL_IN
898 /* if (_this.panel.active) {
902 afteredit : function (e)
904 var r = _this.grid.ds.getAt(e.row);
906 if(e.value == e.originalValue || !r){
911 url : baseURL + '/Roo/Gltrans.php',
914 gltrans_id : r.data.gltrans_id,
915 gltrans_notes : e.value,
919 success : function() {
921 _this.grid.footer.onClick('refresh');
927 rowclass : function (gridview, rowcfg)
929 rowcfg.rowClass = 'dragon-gl-fixedheight';
931 celldblclick : function (_self, rowIndex, columnIndex, e)
933 var cm = this.colModel.config[columnIndex].dataIndex;
934 var r = this.ds.getAt(rowIndex);
935 if (cm != 'gltrans_date') {
939 url : baseURL+ '/Roo/Metasql',
944 'gltrans_sequence:number' : r.data.gltrans_sequence,
951 autoExpandColumn : 'gltrans_notes',
962 specialkey : function (_self, e)
964 _this.grid.footer.onClick('first');
966 render : function (_self)
968 _this.gltransBox = _self;
976 click : function (_self, e)
978 _this.grid.footer.onClick('first');
982 icon : rootURL + '/Pman/templates/images/search.gif'
988 click : function (_self, e)
990 _this.gltransBox.setValue('');
\r
991 _this.grid.footer.onClick('first');
\r
995 icon : rootURL + '/Pman/templates/images/edit-clear.gif'
1004 cls : 'x-btn-text-icon',
1006 icon : rootURL + '/Pman/templates/images/spreadsheet.gif',
1015 click : function (_self, e)
1017 var s = _this.wgrid.getSelectionModel().getSelected();
1020 Roo.MessageBox.alert("Error", "Please select a account");
1024 var dt = _this.dateSel.getValue();
1027 Roo.MessageBox.alert("Error", "Please select a date on the right");
1031 var g = _this.gltransBox.getValue();
1034 '_group' : 'account',
1035 '_name' : 'summary',
1037 'accnt_id:number' : s.data.accnt_id,
1038 'endDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
1044 params['search:text'] = g;
1048 url : baseURL + '/Roo/Metasql',
1053 Roo.MessageBox.alert("Notice", "All Transactions Report for " + s.data.accnt_descrip + " will download shortly");
1056 text : "Download All Transactions"
1062 click : function (_self, e)
1064 var s = _this.wgrid.getSelectionModel().getSelected();
1067 Roo.MessageBox.alert("Error", "Please select a account");
1071 var dt = _this.dateSel.getValue();
1074 Roo.MessageBox.alert("Error", "Please select a date on the right");
1079 url : baseURL + '/Roo/Gltrans.php',
1082 gltrans_accnt_id : s.data.accnt_id,
1083 _as_of : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
1088 Roo.MessageBox.alert("Notice", "Financial Year Report for " + s.data.accnt_descrip + " will download shortly");
1091 text : "Download All Transactions (Selected Financial Year)"
1097 click : function (_self, e)
1099 var dt = _this.dateSel.getValue();
1102 Roo.MessageBox.alert("Error", "Please select a date on the right");
1107 url : baseURL + '/Roo/Gltrans.php',
1111 _as_of : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
1116 Roo.MessageBox.alert("Notice", "Financial Year Report for all accounts will download shortly! it might take several minutes");
1119 text : "Download All Transactions / All Accounts (Selected Financial Year)"
1130 beforeload : function (_self, options)
1132 options.params = options.params || {};
1134 var s = _this.wgrid.getSelectionModel().getSelected();
1140 var dt = _this.dateSel.getValue();
1141 var g = _this.gltransBox.getValue();
1146 'accnt_id:number' : s.data.accnt_id,
1147 'endDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d')
1151 params['search:text'] = g;
1154 Roo.apply(options.params,params);
1156 var cm = _this.grid.getColumnModel();
1157 var hide = (g.length) ? true : false;
1159 cm.setHidden(cm.getIndexByDataIndex('gltrans_balance'), hide);
1170 url : baseURL + '/Roo/Metasql.php'
1173 xtype: 'JsonReader',
1177 totalProperty : 'total',
1180 'name': 'gltrans_id',
1184 'name': 'gltrans_accnt_id',
1188 'name': 'gltrans_source',
1192 'name': 'gltrans_amount',
1196 'name': 'gltrans_notes',
1203 xtype: 'PagingToolbar',
1210 text : "Double Click To Edit"
1216 xtype: 'ColumnModel',
1218 dataIndex : 'gltrans_date',
1222 renderer : function(v,x,r) {
1223 return String.format('{0}<br/><i style="color:#ccc;">{1}</i>',
1224 v ? v : '', r.data.gltrans_sequence
1229 xtype: 'ColumnModel',
1231 dataIndex : 'gltrans_source',
1232 header : 'Source / Who',
1235 renderer : function(v,x,r) {
1236 return String.format('{0} - {1}<br/>{2}', v,r.data.gltrans_doctype, r.data.gltrans_username);
1240 xtype: 'ColumnModel',
1242 dataIndex : 'gltrans_docnumber',
1243 header : 'Doc Number',
1249 xtype: 'ColumnModel',
1251 dataIndex : 'gltrans_notes',
1254 renderer : function(v,x,r)
1256 return String.format(
1257 '<span qtip="{2}"><b>{0}</b>' + "\n" + '{1}',
1258 r.data.gltrans_docnumber, v,
1259 v.split('\n').join('<br/>')
1260 ).split('\n').join('<br/>');
1264 xtype: 'GridEditor',
1273 xtype: 'ColumnModel',
1276 dataIndex : 'gltrans_base_curr',
1277 header : 'Currency',
1280 renderer : function(v) {
1281 return String.format('{0}', v);
1285 xtype: 'ColumnModel',
1288 dataIndex : 'gltrans_credit_amount',
1292 renderer : function(v,x,r) {
1293 return String.format('{0}', v ? Roo.util.Format.number(v*1,2) : '' );
1297 xtype: 'ColumnModel',
1300 dataIndex : 'gltrans_debit_amount',
1304 renderer : function(v,x,r) {
1305 return String.format('{0}', v ? Roo.util.Format.number(v*1,2) : '' );
1309 xtype: 'ColumnModel',
1312 dataIndex : 'gltrans_balance',
1316 renderer : function(v) {
1317 var c =v >= 0.0 ? 'black' : 'red';
1319 return String.format('<span style="color:' + c + ';">{0}</span>',
\r
1320 Roo.util.Format.number(v,2) );
1328 xtype: 'LayoutRegion',
1333 xtype: 'LayoutRegion',
1336 tabPosition : 'top',