1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Roo.namespace('Pman.Tab');
7 Pman.Tab.XtupleGeneralLedger = new Roo.XComponent({
8 part : ["Xtuple", "GeneralLedger" ],
9 order : '100-Pman.Tab.XtupleGeneralLedger',
11 parent : 'Pman.Tab.XtupleAccountsTab',
12 name : "unnamed module",
23 xtype : 'LayoutRegion',
29 xtype : 'LayoutRegion',
36 xtype : 'BorderLayout',
52 specialkey : function (_self, e)
54 _this.wgrid.ds.load({});
56 render : function (_self)
58 _this.searchBox = _self;
63 '|xns' : 'Roo.Toolbar',
66 icon : rootURL + '/Pman/templates/images/search.gif',
69 click : function (_self, e)
71 _this.wgrid.ds.load({});
76 '|xns' : 'Roo.Toolbar',
79 icon : rootURL + '/Pman/templates/images/edit-clear.gif',
82 click : function (_self, e)
84 _this.searchBox.setValue('');
\r
85 _this.wgrid.ds.load({});
\r
97 render : function (_self)
\r
99 _this.dateSel = _self;
\r
100 _self.setValue( new Date() );
\r
102 select : function (combo, date)
104 _this.wgrid.ds.load({});
109 '|xns' : 'Roo.Toolbar',
119 render : function (_self)
121 _this.orderBox = _self;
133 text : "Show Inactive",
137 click : function (_self, e)
139 _this.active = (_this.active) ? 0 : 1;
140 this.setText(_this.active ? "Show Inactive" : "Hide Inactive");
141 _this.wgrid.ds.load({});
152 text : "Export Account Details",
156 click : function (_self, e)
160 url : baseURL + '/Roo/Metasql',
173 Roo.MessageBox.alert("Notice", "Downloading");
179 text : "Download Balances",
183 click : function (_self, e)
187 url : baseURL + '/Roo/accnt.php',
192 _with_xt_balances : 1,
193 'csvTitles[0]' : 'Name', 'csvCols[0]' : 'accnt_name',
194 'csvTitles[1]' : 'Description', 'csvCols[1]' : 'accnt_descrip',
195 'csvTitles[2]' : 'Alternative Code', 'csvCols[2]' : 'accnt_code_alt',
196 'csvTitles[3]' : 'Alternative Description', 'csvCols[3]' : 'accnt_code_descrip',
197 'csvTitles[4]' : 'ADJUST', 'csvCols[4]' : 'balance_base'
211 text : "Upload JE adjustment",
215 click : function (_self, e)
217 Pman.Dialog.XtupleUploadBalances.show( {} , function(res) {
218 Pman.Dialog.Image.show({
219 _url : baseURL + '/Xtuple/Import/JournalEntry?' + Roo.urlEncode(res)
221 _this.wgrid.ds.load({});
229 text : "Upload Account Details",
233 click : function (_self, e)
235 Pman.Dialog.Image.show(
237 _url : baseURL+'/Xtuple/Import/Accounts',
242 Roo.MessageBox.alert("Notice", data);
243 _this.grid.footer.onClick('first');
257 text : "Download AP - Day by Day Comparison",
261 click : function (_self, e)
265 url : baseURL + '/Roo/Metasql',
278 Roo.MessageBox.alert("Notice", "This may take some time to calculate");
284 text : "Download AP open vs GL - summary of bad days",
288 click : function (_self, e)
292 url : baseURL + '/Roo/Metasql',
297 _name : 'bydatesummary',
304 Roo.MessageBox.alert("Notice", "This may take some time to calculate");
310 text : "Download AP - Transactions on a single day",
314 click : function (_self, e)
318 url : baseURL + '/Roo/Metasql',
322 'startDate:text' : _this.dateSel.getValue().format('Y-m-d'),
323 'endDate:text' : _this.dateSel.getValue().add(Date.DAY,1).format('Y-m-d'),
333 Roo.MessageBox.alert("Notice", "This may take some time to calculate");
339 text : "Download AP Aging at this date",
343 click : function (_self, e)
347 url : baseURL + '/Roo/Metasql',
352 'relDate:text' : _this.dateSel.getValue().format('Y-m-d'),
353 'useDocDate:text' : 'FALSE',
363 Roo.MessageBox.alert("Notice", "This may take some time to calculate");
369 text : "Download AP Aging Comparison back from this date",
373 click : function (_self, e)
377 url : baseURL + '/Roo/Metasql',
381 'relDate:text' : _this.dateSel.getValue().format('Y-m-d'),
391 Roo.MessageBox.alert("Notice", "This may take some time to calculate");
402 text : "Download AR - Transactions on a day",
406 click : function (_self, e)
410 url : baseURL + '/Roo/Metasql',
415 'startDate:text' : _this.dateSel.getValue().format('Y-m-d'),
416 'endDate:text' : _this.dateSel.getValue().add(Date.DAY,1).format('Y-m-d'),
428 text : "Download AR - Day by Day Comparison",
432 click : function (_self, e)
436 url : baseURL + '/Roo/Metasql',
463 text : "Download Gltrans vs Stock By Date",
467 click : function (_self, e)
471 url : baseURL + '/Roo/Metasql',
475 _group : 'gltrans_stock',
487 text : "Download Gltrans vs Sales Order",
491 click : function (_self, e)
495 url : baseURL + '/Roo/Metasql',
499 _group : 'gltrans_stock',
511 text : "Download Gltrans",
515 click : function (_self, e)
517 var dt = _this.dateSel.getValue();
519 url : baseURL + '/Roo/Metasql',
522 _group : 'gltrans_stock',
524 '_as_of:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
535 text : "Download Stock",
539 click : function (_self, e)
541 var dt = _this.dateSel.getValue();
543 url : baseURL + '/Roo/Metasql',
546 _group : 'gltrans_stock',
548 '_as_of:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
561 text : "Gltrans vs Stock (COHEAD)",
582 text : "Download Gltrans vs Stock By PO",
586 click : function (_self, e)
590 url : baseURL + '/Roo/Metasql',
594 _group : 'gltrans_stock',
606 text : "Download Gltrans",
610 click : function (_self, e)
612 var ord = _this.orderBox.getValue();
615 Roo.MessageBox.alert('Error','Please enter a PO number');
621 url : baseURL + '/Roo/Metasql',
624 _group : 'gltrans_stock',
625 _name : 'byordergltrans',
626 'docnumber:text' : ord,
637 text : "Download Stock",
641 click : function (_self, e)
643 var ord = _this.orderBox.getValue();
646 Roo.MessageBox.alert('Error','Please enter a PO number');
652 url : baseURL + '/Roo/Metasql',
655 _group : 'gltrans_stock',
656 _name : 'byorderstock',
657 'docnumber:text' : ord,
670 text : "Gltrans vs Stock (PO)",
695 click : function (_self, e)
699 url : baseURL+'/Xtuple/Kingdee/Currency',
703 Roo.MessageBox.alert("Notice", "Report will download shortly");
709 text : "Exchange Rate",
713 click : function (_self, e)
717 url : baseURL+'/Xtuple/Kingdee/Rate',
721 Roo.MessageBox.alert("Notice", "Report will download shortly");
731 click : function (_self, e)
735 url : baseURL+'/Xtuple/Kingdee/Account',
739 Roo.MessageBox.alert("Notice", "Report will download shortly");
745 text : "Voucher Category",
749 click : function (_self, e)
752 url : baseURL+'/Xtuple/Kingdee/VoucherGroup',
756 Roo.MessageBox.alert("Notice", "Report will download shortly");
762 text : "Transactions",
766 click : function (_self, e)
768 var dt = _this.dateSel.getValue();
770 url : baseURL+'/Xtuple/Kingdee/Voucher',
774 _as_of : (typeof(dt) == 'string') ? dt : dt.format('Y-m-d')
777 Roo.MessageBox.alert("Notice", "Report will download shortly - If you wanna import again, please delete all the exist!");
796 '|xns' : 'Roo.Toolbar',
797 text : "Download / Upload",
811 url : baseURL + '/Roo/accnt.php',
816 loadexception : function (This, o, arg, e)
826 xtype : 'JsonReader',
833 'name': 'accnt_name',
837 'name': 'accnt_descrip',
841 'name': 'accnt_type',
845 'name': 'accnt_subaccnttype_code',
849 'name': 'accnt_curr_id_curr_name',
853 'name': 'accnt_curr_id_curr_id',
858 totalProperty : 'total'
863 sortInfo : { field : 'accnt_name', direction: 'ASC' },
866 beforeload : function (_self, options)
868 options.params = options.params || {};
870 options.params.limit = 9999;
872 options.params._general_ledger = 1;
874 options.params['search[name]'] = _this.searchBox.getValue();
876 if (_this.active) {
\r
877 options.params.accnt_active = 1;
878 options.params._with_balances = 1;
\r
882 \r var dt = _this.dateSel.getValue();
\r
883 options.params._as_of = typeof(dt) == 'string' ? dt : dt.format('Y-m-d');
894 autoExpandColumn : 'accnt_descrip',
901 xtype : 'ColumnModel',
905 renderer : function(v) { return String.format('{0}', v); },
907 dataIndex : 'accnt_name'
912 xtype : 'ColumnModel',
914 header : 'Alternative Code',
916 renderer : function(v) { return String.format('{0}', v); },
918 dataIndex : 'accnt_code_alt'
923 xtype : 'ColumnModel',
925 header : 'Alternative Description',
927 renderer : function(v) { return String.format('{0}', v); },
929 dataIndex : 'accnt_descrip_alt'
933 xtype : 'ColumnModel',
937 renderer : function(v,x,r) {
938 return String.format('{0}-{1}', v,r.data.accnt_subaccnttype_code);
941 dataIndex : 'accnt_type'
945 xtype : 'ColumnModel',
947 header : 'Description',
949 renderer : function(v,x,r)
951 if(r.data.accnt_descrip_alt){
952 return String.format('{0} ({1})', v, r.data.accnt_descrip_alt);
955 return String.format('{0}', v);
958 dataIndex : 'accnt_descrip'
963 xtype : 'ColumnModel',
967 renderer : function(v) {
968 var base = baseURL.match(/sg\.php$/) ? 'SGD' : 'HKD';
970 return String.format('<span style="color:green">{0}</span>', v);
973 return String.format('{0}', v);
976 dataIndex : 'accnt_curr_id_curr_name'
980 xtype : 'ColumnModel',
984 renderer : function(v) {
\r
985 return String.format('<span style="color:blue;text-decoration:underline;">{0}</span>',
\r
986 Roo.util.Format.usMoney(v) );
989 dataIndex : 'balance'
993 rowdblclick : function (_self, rowIndex, e)
995 var ret = _this.wgrid.ds.getAt(rowIndex).data;
996 if(ret.accnt_id * 1 < 1){
997 Roo.MessageBox.alert("Error", "Error occur on getting the account id!");
1000 Pman.Dialog.XtupleGLAccountNameEdit.show( {accnt_id : ret.accnt_id}, function() {
1001 _this.wgrid.ds.load({});
1008 //_this.dialog = Pman.Dialog.FILL_IN
1009 if (_this.wpanel.active) {
1013 rowclick : function (_self, rowIndex, e)
1015 var s = _this.wgrid.ds.getAt(rowIndex);
1017 if(s.data.accnt_id * 1 < 1){
1021 _this.grid.footer.onClick('first');
1036 xtype : 'GridPanel',
1037 fitContainer : true,
1039 tableName : 'accnt',
1041 activate : function() {
1042 _this.wpanel = this;
1044 _this.wgrid.ds.load({});
1061 '|xns' : 'Roo.form',
1062 xtype : 'TextField',
1065 specialkey : function (_self, e)
1067 _this.grid.footer.onClick('first');
1069 render : function (_self)
1071 _this.gltransBox = _self;
1077 '|xns' : 'Roo.data',
1078 xtype : 'SimpleStore',
1080 [ 'ALL', "All Transactions"],
1081 [ 'S/R' , "Sales Return"],
1082 [ 'S/O', "Sales Orders"] ,
1083 [ 'A/P', "Accounts Payable"] ,
1084 [ 'A/R', "Accounts Recievable"] ,
1085 [ 'I/M', "Inventory "] ,
1086 [ 'G/L', "General Ledger "]
1090 fields : [ 'gltrans_source', 'gltrans_source_name'],
1093 '|xns' : 'Roo.form',
1095 triggerAction : 'all',
1096 displayField : 'gltrans_source_name',
1097 hiddenName : 'gltrans_source',
1099 valueField : 'gltrans_source',
1106 name : 'gltrans_source_name',
1107 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{gltrans_source_name}</b> </div>',
1109 render : function (_self)
1111 _this.sourceCombo = _self;
1113 select : function (combo, record, index)
1116 _this.grid.footer.onClick('first');
1125 '|xns' : 'Roo.Toolbar',
1128 icon : rootURL + '/Pman/templates/images/search.gif',
1131 click : function (_self, e)
1133 _this.grid.footer.onClick('first');
1138 '|xns' : 'Roo.Toolbar',
1141 icon : rootURL + '/Pman/templates/images/edit-clear.gif',
1144 click : function (_self, e)
1146 _this.gltransBox.setValue('');
\r
1147 _this.grid.footer.onClick('first');
\r
1152 '|xns' : 'Roo.Toolbar',
1158 '|xns' : 'Roo.menu',
1163 '|xns' : 'Roo.menu',
1164 text : "Transactions from search result",
1168 click : function (_self, e)
1178 Roo.MessageBox.alert("Notice", "Search Transactions Report for " + s.data.accnt_descrip + " will download shortly");
1183 '|xns' : 'Roo.menu',
1184 xtype : 'Separator',
1188 '|xns' : 'Roo.menu',
1189 text : "All Transactions",
1193 click : function (_self, e)
1195 var s = _this.wgrid.getSelectionModel().getSelected();
1198 Roo.MessageBox.alert("Error", "Please select a account");
1202 var dt = _this.dateSel.getValue();
1205 Roo.MessageBox.alert("Error", "Please select a date on the right");
1209 var g = _this.gltransBox.getValue();
1212 '_group' : 'account',
1213 '_name' : 'summary',
1215 'accnt_id:number' : s.data.accnt_id,
1216 'endDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
1222 params['search:text'] = g;
1226 url : baseURL + '/Roo/Metasql',
1231 Roo.MessageBox.alert("Notice", "All Transactions Report for " + s.data.accnt_descrip + " will download shortly");
1236 '|xns' : 'Roo.menu',
1237 text : "All Transactions (Selected Financial Year)",
1241 click : function (_self, e)
1243 var s = _this.wgrid.getSelectionModel().getSelected();
1246 Roo.MessageBox.alert("Error", "Please select a account");
1250 var dt = _this.dateSel.getValue();
1253 Roo.MessageBox.alert("Error", "Please select a date on the right");
1258 url : baseURL + '/Roo/Gltrans.php',
1261 gltrans_accnt_id : s.data.accnt_id,
1262 _as_of : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
1267 Roo.MessageBox.alert("Notice", "Financial Year Report for " + s.data.accnt_descrip + " will download shortly");
1272 '|xns' : 'Roo.menu',
1273 text : "All Transactions / All Accounts (Selected Financial Year)",
1277 click : function (_self, e)
1279 var dt = _this.dateSel.getValue();
1282 Roo.MessageBox.alert("Error", "Please select a date on the right");
1287 url : baseURL + '/Roo/Gltrans.php',
1291 _as_of : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
1296 Roo.MessageBox.alert("Notice", "Financial Year Report for all accounts will download shortly! it might take several minutes");
1303 '|xns' : 'Roo.Toolbar',
1306 cls : 'x-btn-text-icon',
1307 icon : rootURL + '/Pman/templates/images/spreadsheet.gif',
1319 '|xns' : 'Roo.data',
1320 url : baseURL + '/Roo/Metasql.php',
1322 xtype : 'HttpProxy',
1327 '|xns' : 'Roo.data',
1330 xtype : 'JsonReader',
1333 'name': 'gltrans_id',
1337 'name': 'gltrans_accnt_id',
1341 'name': 'gltrans_source',
1345 'name': 'gltrans_amount',
1349 'name': 'gltrans_notes',
1354 totalProperty : 'total'
1356 '|xns' : 'Roo.data',
1361 beforeload : function (_self, options)
1363 options.params = options.params || {};
1365 var s = _this.wgrid.getSelectionModel().getSelected();
1371 var dt = _this.dateSel.getValue();
1372 var g = _this.gltransBox.getValue();
1377 'accnt_id:number' : s.data.accnt_id,
1378 'endDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d')
1381 // can not do source + search..
1382 var source = _this.sourceCombo.getValue();
1383 if (source != 'ALL') {
1384 params['search:text'] = source;
1388 params['search:text'] = g;
1391 Roo.apply(options.params,params);
1393 var cm = _this.grid.getColumnModel();
1394 var hide = (g.length) ? true : false;
1396 cm.setHidden(cm.getIndexByDataIndex('gltrans_balance'), hide);
1409 xtype : 'PagingToolbar',
1413 '|xns' : 'Roo.Toolbar',
1414 text : "Double Click To Edit",
1421 '|xns' : 'Roo.grid',
1422 autoExpandColumn : 'gltrans_notes',
1423 xtype : 'EditorGrid',
1429 '|xns' : 'Roo.grid',
1430 xtype : 'ColumnModel',
1434 renderer : function(v,x,r) {
1435 return String.format('{0}<br/><i style="color:#ccc;">{1}</i>',
1436 v ? v : '', r.data.gltrans_sequence
1440 dataIndex : 'gltrans_date'
1443 '|xns' : 'Roo.grid',
1445 xtype : 'ColumnModel',
1449 renderer : function(v,x,r) {
1450 return String.format('{0}', v);
1453 dataIndex : 'gltrans_created'
1456 '|xns' : 'Roo.grid',
1457 xtype : 'ColumnModel',
1459 header : 'Source / Who',
1461 renderer : function(v,x,r) {
1462 return String.format('{0} - {1}<br/>{2} <i style="color:#ccc;">{3}</i>',
1464 v,r.data.gltrans_doctype,
1465 r.data.gltrans_username,
1466 r.data.gltrans_created);
1469 dataIndex : 'gltrans_source'
1472 '|xns' : 'Roo.grid',
1474 xtype : 'ColumnModel',
1476 header : 'Doc Number',
1479 dataIndex : 'gltrans_docnumber'
1484 '|xns' : 'Roo.form',
1488 '|xns' : 'Roo.grid',
1489 xtype : 'GridEditor',
1496 '|xns' : 'Roo.grid',
1497 xtype : 'ColumnModel',
1498 header : 'Account / Notes',
1500 renderer : function(v,x,r)
1502 return String.format(
1503 '<u class="dragon-ref-accounts">{3}</u> - <span qtip="{2}"><b>{0}</b>' + "\n" + '{1}',
1504 r.data.gltrans_docnumber,
1506 v.split('\n').join('<br/>'),
1507 r.data.related_accounts
1509 ).split('\n').join('<br/>');
1513 dataIndex : 'gltrans_notes',
1520 '|xns' : 'Roo.grid',
1522 xtype : 'ColumnModel',
1524 header : 'Currency',
1526 renderer : function(v) {
1527 return String.format('{0}', v);
1530 dataIndex : 'gltrans_base_curr'
1533 '|xns' : 'Roo.grid',
1535 xtype : 'ColumnModel',
1539 renderer : function(v,x,r) {
1540 return String.format('{0}', v ? Roo.util.Format.number(v*1,2) : '' );
1543 dataIndex : 'gltrans_credit_amount'
1546 '|xns' : 'Roo.grid',
1548 xtype : 'ColumnModel',
1552 renderer : function(v,x,r) {
1553 return String.format('{0}', v ? Roo.util.Format.number(v*1,2) : '' );
1556 dataIndex : 'gltrans_debit_amount'
1559 '|xns' : 'Roo.grid',
1561 xtype : 'ColumnModel',
1565 renderer : function(v) {
1566 var c =v >= 0.0 ? 'black' : 'red';
1568 return String.format('<span style="color:' + c + ';">{0}</span>',
\r
1569 Roo.util.Format.number(v,2) );
1572 dataIndex : 'gltrans_balance'
1579 //_this.dialog = Pman.Dialog.FILL_IN
1580 /* if (_this.panel.active) {
1584 celldblclick : function (_self, rowIndex, columnIndex, e)
1586 var cm = this.colModel.config[columnIndex].dataIndex;
1587 var r = this.ds.getAt(rowIndex);
1588 if (cm != 'gltrans_date') {
1592 url : baseURL+ '/Roo/Metasql',
1597 'gltrans_sequence:number' : r.data.gltrans_sequence,
1603 cellclick : function (_self, rowIndex, columnIndex, e)
1605 if (!Roo.get(e.getTarget()).hasClass('dragon-ref-accounts')) {
1608 var r = this.ds.getAt(rowIndex);
1609 Pman.Dialog.XtupleJournalEntry.show({
1610 gltrans_id : r.data.gltrans_id
1613 // no need to refresh as it's viewed only?
1618 rowclass : function (gridview, rowcfg)
1620 rowcfg.rowClass = 'dragon-gl-fixedheight';
1622 afteredit : function (e)
1624 var r = _this.grid.ds.getAt(e.row);
1626 if(e.value == e.originalValue || !r){
1631 url : baseURL + '/Roo/Gltrans.php',
1634 gltrans_id : r.data.gltrans_id,
1635 gltrans_notes : e.value,
1639 success : function() {
1641 _this.grid.footer.onClick('refresh');
1657 title : "Transactions",
1658 xtype : 'GridPanel',
1659 fitContainer : true,
1661 tableName : 'gltrans',
1663 activate : function() {
1665 /* if (_this.grid) {
1666 _this.grid.ds.load({});
1682 title : "General Ledger",
1683 xtype : 'NestedLayoutPanel',
1684 fitContainer : true,