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 : '100-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/Metasql',
208 Roo.MessageBox.alert("Notice", "Downloading");
211 text : "Export Account Details"
217 click : function (_self, e)
221 url : baseURL + '/Roo/accnt.php',
226 _with_xt_balances : 1,
227 'csvTitles[0]' : 'Name', 'csvCols[0]' : 'accnt_name',
228 'csvTitles[1]' : 'Description', 'csvCols[1]' : 'accnt_descrip',
229 'csvTitles[2]' : 'Alternative Code', 'csvCols[2]' : 'accnt_code_alt',
230 'csvTitles[3]' : 'Alternative Description', 'csvCols[3]' : 'accnt_code_descrip',
231 'csvTitles[4]' : 'ADJUST', 'csvCols[4]' : 'balance_base'
237 text : "Download Balances"
247 click : function (_self, e)
249 Pman.Dialog.XtupleUploadBalances.show( {} , function(res) {
250 Pman.Dialog.Image.show({
251 _url : baseURL + '/Xtuple/Import/JournalEntry?' + Roo.urlEncode(res)
253 _this.wgrid.ds.load({});
258 text : "Upload JE adjustment"
264 click : function (_self, e)
266 Pman.Dialog.Image.show(
268 _url : baseURL+'/Xtuple/Import/Accounts',
273 Roo.MessageBox.alert("Notice", data);
274 _this.grid.footer.onClick('first');
280 text : "Upload Account Details"
290 click : function (_self, e)
294 url : baseURL + '/Roo/Metasql',
307 Roo.MessageBox.alert("Notice", "This may take some time to calculate");
310 text : "Download AP - Day by Day Comparison"
316 click : function (_self, e)
320 url : baseURL + '/Roo/Metasql',
325 _name : 'bydatesummary',
332 Roo.MessageBox.alert("Notice", "This may take some time to calculate");
335 text : "Download AP open vs GL - summary of bad days"
341 click : function (_self, e)
345 url : baseURL + '/Roo/Metasql',
349 'startDate:text' : _this.dateSel.getValue().format('Y-m-d'),
350 'endDate:text' : _this.dateSel.getValue().add(Date.DAY,1).format('Y-m-d'),
360 Roo.MessageBox.alert("Notice", "This may take some time to calculate");
363 text : "Download AP - Transactions on a single day"
369 click : function (_self, e)
373 url : baseURL + '/Roo/Metasql',
378 'relDate:text' : _this.dateSel.getValue().format('Y-m-d'),
379 'useDocDate:text' : 'FALSE',
389 Roo.MessageBox.alert("Notice", "This may take some time to calculate");
392 text : "Download AP Aging at this date"
398 click : function (_self, e)
402 url : baseURL + '/Roo/Metasql',
406 'relDate:text' : _this.dateSel.getValue().format('Y-m-d'),
416 Roo.MessageBox.alert("Notice", "This may take some time to calculate");
419 text : "Download AP Aging Comparison back from this date"
429 click : function (_self, e)
433 url : baseURL + '/Roo/Metasql',
438 'startDate:text' : _this.dateSel.getValue().format('Y-m-d'),
439 'endDate:text' : _this.dateSel.getValue().add(Date.DAY,1).format('Y-m-d'),
448 text : "Download AR - Transactions on a day"
454 click : function (_self, e)
458 url : baseURL + '/Roo/Metasql',
471 text : "Download AR - Day by Day Comparison"
480 text : "Gltrans vs Stock (COHEAD)",
489 click : function (_self, e)
493 url : baseURL + '/Roo/Metasql',
497 _group : 'gltrans_stock',
506 text : "Download Gltrans vs Stock By Date"
512 click : function (_self, e)
516 url : baseURL + '/Roo/Metasql',
520 _group : 'gltrans_stock',
529 text : "Download Gltrans vs Sales Order"
535 click : function (_self, e)
537 var dt = _this.dateSel.getValue();
539 url : baseURL + '/Roo/Metasql',
542 _group : 'gltrans_stock',
544 '_as_of:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
552 text : "Download Gltrans"
558 click : function (_self, e)
560 var dt = _this.dateSel.getValue();
562 url : baseURL + '/Roo/Metasql',
565 _group : 'gltrans_stock',
567 '_as_of:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
575 text : "Download Stock"
587 text : "Gltrans vs Stock (PO)",
596 click : function (_self, e)
600 url : baseURL + '/Roo/Metasql',
604 _group : 'gltrans_stock',
613 text : "Download Gltrans vs Stock By PO"
619 click : function (_self, e)
621 var ord = _this.orderBox.getValue();
624 Roo.MessageBox.alert('Error','Please enter a PO number');
630 url : baseURL + '/Roo/Metasql',
633 _group : 'gltrans_stock',
634 _name : 'byordergltrans',
635 'docnumber:text' : ord,
643 text : "Download Gltrans"
649 click : function (_self, e)
651 var ord = _this.orderBox.getValue();
654 Roo.MessageBox.alert('Error','Please enter a PO number');
660 url : baseURL + '/Roo/Metasql',
663 _group : 'gltrans_stock',
664 _name : 'byorderstock',
665 'docnumber:text' : ord,
673 text : "Download Stock"
694 click : function (_self, e)
698 url : baseURL+'/Xtuple/Kingdee/Currency',
702 Roo.MessageBox.alert("Notice", "Report will download shortly");
711 click : function (_self, e)
715 url : baseURL+'/Xtuple/Kingdee/Rate',
719 Roo.MessageBox.alert("Notice", "Report will download shortly");
722 text : "Exchange Rate"
728 click : function (_self, e)
732 url : baseURL+'/Xtuple/Kingdee/Account',
736 Roo.MessageBox.alert("Notice", "Report will download shortly");
745 click : function (_self, e)
748 url : baseURL+'/Xtuple/Kingdee/VoucherGroup',
752 Roo.MessageBox.alert("Notice", "Report will download shortly");
755 text : "Voucher Category"
761 click : function (_self, e)
763 var dt = _this.dateSel.getValue();
765 url : baseURL+'/Xtuple/Kingdee/Voucher',
769 _as_of : (typeof(dt) == 'string') ? dt : dt.format('Y-m-d')
772 Roo.MessageBox.alert("Notice", "Report will download shortly - If you wanna import again, please delete all the exist!");
775 text : "Transactions"
789 beforeload : function (_self, options)
791 options.params = options.params || {};
793 options.params.limit = 9999;
795 options.params._general_ledger = 1;
797 options.params['search[name]'] = _this.searchBox.getValue();
799 if (_this.active) {
\r
800 options.params.accnt_active = 1;
801 options.params._with_balances = 1;
\r
805 \r var dt = _this.dateSel.getValue();
\r
806 options.params._as_of = typeof(dt) == 'string' ? dt : dt.format('Y-m-d');
812 sortInfo : { field : 'accnt_name', direction: 'ASC' },
817 loadexception : function (This, o, arg, e)
823 url : baseURL + '/Roo/accnt.php'
830 totalProperty : 'total',
837 'name': 'accnt_name',
841 'name': 'accnt_descrip',
845 'name': 'accnt_type',
849 'name': 'accnt_subaccnttype_code',
853 'name': 'accnt_curr_id_curr_name',
857 'name': 'accnt_curr_id_curr_id',
865 xtype: 'ColumnModel',
867 dataIndex : 'accnt_name',
871 renderer : function(v) { return String.format('{0}', v); }
874 xtype: 'ColumnModel',
876 dataIndex : 'accnt_code_alt',
877 header : 'Alternative Code',
881 renderer : function(v) { return String.format('{0}', v); }
884 xtype: 'ColumnModel',
886 dataIndex : 'accnt_descrip_alt',
887 header : 'Alternative Description',
891 renderer : function(v) { return String.format('{0}', v); }
894 xtype: 'ColumnModel',
896 dataIndex : 'accnt_type',
900 renderer : function(v,x,r) {
901 return String.format('{0}-{1}', v,r.data.accnt_subaccnttype_code);
905 xtype: 'ColumnModel',
907 dataIndex : 'accnt_descrip',
908 header : 'Description',
911 renderer : function(v,x,r)
913 if(r.data.accnt_descrip_alt){
914 return String.format('{0} ({1})', v, r.data.accnt_descrip_alt);
917 return String.format('{0}', v);
921 xtype: 'ColumnModel',
924 dataIndex : 'accnt_curr_id_curr_name',
928 renderer : function(v) {
929 var base = baseURL.match(/sg\.php$/) ? 'SGD' : 'HKD';
931 return String.format('<span style="color:green">{0}</span>', v);
934 return String.format('{0}', v);
938 xtype: 'ColumnModel',
940 dataIndex : 'balance',
944 renderer : function(v) {
\r
945 return String.format('<span style="color:blue;text-decoration:underline;">{0}</span>',
\r
946 Roo.util.Format.usMoney(v) );
956 activate : function() {
959 _this.grid.ds.load({});
967 tableName : 'gltrans',
968 title : "Transactions",
976 //_this.dialog = Pman.Dialog.FILL_IN
977 /* if (_this.panel.active) {
981 afteredit : function (e)
983 var r = _this.grid.ds.getAt(e.row);
985 if(e.value == e.originalValue || !r){
990 url : baseURL + '/Roo/Gltrans.php',
993 gltrans_id : r.data.gltrans_id,
994 gltrans_notes : e.value,
998 success : function() {
1000 _this.grid.footer.onClick('refresh');
1006 rowclass : function (gridview, rowcfg)
1008 rowcfg.rowClass = 'dragon-gl-fixedheight';
1010 celldblclick : function (_self, rowIndex, columnIndex, e)
1012 var cm = this.colModel.config[columnIndex].dataIndex;
1013 var r = this.ds.getAt(rowIndex);
1014 if (cm != 'gltrans_date') {
1018 url : baseURL+ '/Roo/Metasql',
1023 'gltrans_sequence:number' : r.data.gltrans_sequence,
1030 autoExpandColumn : 'gltrans_notes',
1041 specialkey : function (_self, e)
1043 _this.grid.footer.onClick('first');
1045 render : function (_self)
1047 _this.gltransBox = _self;
1055 click : function (_self, e)
1057 _this.grid.footer.onClick('first');
1061 icon : rootURL + '/Pman/templates/images/search.gif'
1067 click : function (_self, e)
1069 _this.gltransBox.setValue('');
\r
1070 _this.grid.footer.onClick('first');
\r
1074 icon : rootURL + '/Pman/templates/images/edit-clear.gif'
1083 cls : 'x-btn-text-icon',
1085 icon : rootURL + '/Pman/templates/images/spreadsheet.gif',
1094 click : function (_self, e)
1096 var s = _this.wgrid.getSelectionModel().getSelected();
1099 Roo.MessageBox.alert("Error", "Please select a account");
1103 var dt = _this.dateSel.getValue();
1106 Roo.MessageBox.alert("Error", "Please select a date on the right");
1110 var g = _this.gltransBox.getValue();
1113 '_group' : 'account',
1114 '_name' : 'summary',
1116 'accnt_id:number' : s.data.accnt_id,
1117 'endDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
1123 params['search:text'] = g;
1127 url : baseURL + '/Roo/Metasql',
1132 Roo.MessageBox.alert("Notice", "All Transactions Report for " + s.data.accnt_descrip + " will download shortly");
1135 text : "Download All Transactions"
1141 click : function (_self, e)
1143 var s = _this.wgrid.getSelectionModel().getSelected();
1146 Roo.MessageBox.alert("Error", "Please select a account");
1150 var dt = _this.dateSel.getValue();
1153 Roo.MessageBox.alert("Error", "Please select a date on the right");
1158 url : baseURL + '/Roo/Gltrans.php',
1161 gltrans_accnt_id : s.data.accnt_id,
1162 _as_of : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
1167 Roo.MessageBox.alert("Notice", "Financial Year Report for " + s.data.accnt_descrip + " will download shortly");
1170 text : "Download All Transactions (Selected Financial Year)"
1176 click : function (_self, e)
1178 var dt = _this.dateSel.getValue();
1181 Roo.MessageBox.alert("Error", "Please select a date on the right");
1186 url : baseURL + '/Roo/Gltrans.php',
1190 _as_of : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
1195 Roo.MessageBox.alert("Notice", "Financial Year Report for all accounts will download shortly! it might take several minutes");
1198 text : "Download All Transactions / All Accounts (Selected Financial Year)"
1209 beforeload : function (_self, options)
1211 options.params = options.params || {};
1213 var s = _this.wgrid.getSelectionModel().getSelected();
1219 var dt = _this.dateSel.getValue();
1220 var g = _this.gltransBox.getValue();
1225 'accnt_id:number' : s.data.accnt_id,
1226 'endDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d')
1230 params['search:text'] = g;
1233 Roo.apply(options.params,params);
1235 var cm = _this.grid.getColumnModel();
1236 var hide = (g.length) ? true : false;
1238 cm.setHidden(cm.getIndexByDataIndex('gltrans_balance'), hide);
1249 url : baseURL + '/Roo/Metasql.php'
1252 xtype: 'JsonReader',
1256 totalProperty : 'total',
1259 'name': 'gltrans_id',
1263 'name': 'gltrans_accnt_id',
1267 'name': 'gltrans_source',
1271 'name': 'gltrans_amount',
1275 'name': 'gltrans_notes',
1282 xtype: 'PagingToolbar',
1289 text : "Double Click To Edit"
1295 xtype: 'ColumnModel',
1297 dataIndex : 'gltrans_date',
1301 renderer : function(v,x,r) {
1302 return String.format('{0}<br/><i style="color:#ccc;">{1}</i>',
1303 v ? v : '', r.data.gltrans_sequence
1308 xtype: 'ColumnModel',
1310 dataIndex : 'gltrans_source',
1311 header : 'Source / Who',
1314 renderer : function(v,x,r) {
1315 return String.format('{0} - {1}<br/>{2}', v,r.data.gltrans_doctype, r.data.gltrans_username);
1319 xtype: 'ColumnModel',
1321 dataIndex : 'gltrans_docnumber',
1322 header : 'Doc Number',
1328 xtype: 'ColumnModel',
1330 dataIndex : 'gltrans_notes',
1333 renderer : function(v,x,r)
1335 return String.format(
1336 '<u class="dragon-ref-accounts">{3}</u> - <span qtip="{2}"><b>{0}</b>' + "\n" + '{1}',
1337 r.data.gltrans_docnumber,
1339 v.split('\n').join('<br/>'),
1340 r.data.related_accounts
1342 ).split('\n').join('<br/>');
1346 xtype: 'GridEditor',
1355 xtype: 'ColumnModel',
1358 dataIndex : 'gltrans_base_curr',
1359 header : 'Currency',
1362 renderer : function(v) {
1363 return String.format('{0}', v);
1367 xtype: 'ColumnModel',
1370 dataIndex : 'gltrans_credit_amount',
1374 renderer : function(v,x,r) {
1375 return String.format('{0}', v ? Roo.util.Format.number(v*1,2) : '' );
1379 xtype: 'ColumnModel',
1382 dataIndex : 'gltrans_debit_amount',
1386 renderer : function(v,x,r) {
1387 return String.format('{0}', v ? Roo.util.Format.number(v*1,2) : '' );
1391 xtype: 'ColumnModel',
1394 dataIndex : 'gltrans_balance',
1398 renderer : function(v) {
1399 var c =v >= 0.0 ? 'black' : 'red';
1401 return String.format('<span style="color:' + c + ';">{0}</span>',
\r
1402 Roo.util.Format.number(v,2) );
1410 xtype: 'LayoutRegion',
1415 xtype: 'LayoutRegion',
1418 tabPosition : 'top',