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,
1029 cellclick : function (_self, rowIndex, columnIndex, e)
1031 if (!Roo.get(e.getTarget()).hasClass('dragon-ref-accounts')) {
1034 var r = this.ds.getAt(rowIndex);
1035 Pman.Dialog.XtupleJournalEntry.show({
1036 gltrans_id : r.data.gltrans_id
1039 // no need to refresh as it's viewed only?
1045 autoExpandColumn : 'gltrans_notes',
1056 specialkey : function (_self, e)
1058 _this.grid.footer.onClick('first');
1060 render : function (_self)
1062 _this.gltransBox = _self;
1070 render : function (_self)
1072 _this.sourceCombo = _self;
1074 select : function (combo, record, index)
1077 _this.grid.footer.onClick('first');
1081 displayField : 'gltrans_source_name',
1083 hiddenName : 'gltrans_source',
1086 name : 'gltrans_source_name',
1087 tpl : '<div class="x-grid-cell-text x-btn button"><b>{gltrans_source_name}</b> </div>',
1088 triggerAction : 'all',
1090 valueField : 'gltrans_source',
1093 xtype: 'SimpleStore',
1096 [ 'ALL', "All Transactions"],
1097 [ 'S/R' , "Sales Return"],
1098 [ 'S/O', "Sales Orders"] ,
1099 [ 'A/P', "Accounts Payable"] ,
1100 [ 'A/R', "Accounts Recievable"] ,
1101 [ 'I/M', "Inventory "] ,
1102 [ 'G/L', "General Ledger "]
1106 fields : [ 'gltrans_source', 'gltrans_source_name']
1113 click : function (_self, e)
1115 _this.grid.footer.onClick('first');
1119 icon : rootURL + '/Pman/templates/images/search.gif'
1125 click : function (_self, e)
1127 _this.gltransBox.setValue('');
\r
1128 _this.grid.footer.onClick('first');
\r
1132 icon : rootURL + '/Pman/templates/images/edit-clear.gif'
1141 cls : 'x-btn-text-icon',
1143 icon : rootURL + '/Pman/templates/images/spreadsheet.gif',
1152 click : function (_self, e)
1162 Roo.MessageBox.alert("Notice", "Search Transactions Report for " + s.data.accnt_descrip + " will download shortly");
1165 text : "Transactions from search result"
1175 click : function (_self, e)
1177 var s = _this.wgrid.getSelectionModel().getSelected();
1180 Roo.MessageBox.alert("Error", "Please select a account");
1184 var dt = _this.dateSel.getValue();
1187 Roo.MessageBox.alert("Error", "Please select a date on the right");
1191 var g = _this.gltransBox.getValue();
1194 '_group' : 'account',
1195 '_name' : 'summary',
1197 'accnt_id:number' : s.data.accnt_id,
1198 'endDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
1204 params['search:text'] = g;
1208 url : baseURL + '/Roo/Metasql',
1213 Roo.MessageBox.alert("Notice", "All Transactions Report for " + s.data.accnt_descrip + " will download shortly");
1216 text : "All Transactions"
1222 click : function (_self, e)
1224 var s = _this.wgrid.getSelectionModel().getSelected();
1227 Roo.MessageBox.alert("Error", "Please select a account");
1231 var dt = _this.dateSel.getValue();
1234 Roo.MessageBox.alert("Error", "Please select a date on the right");
1239 url : baseURL + '/Roo/Gltrans.php',
1242 gltrans_accnt_id : s.data.accnt_id,
1243 _as_of : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
1248 Roo.MessageBox.alert("Notice", "Financial Year Report for " + s.data.accnt_descrip + " will download shortly");
1251 text : "All Transactions (Selected Financial Year)"
1257 click : function (_self, e)
1259 var dt = _this.dateSel.getValue();
1262 Roo.MessageBox.alert("Error", "Please select a date on the right");
1267 url : baseURL + '/Roo/Gltrans.php',
1271 _as_of : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
1276 Roo.MessageBox.alert("Notice", "Financial Year Report for all accounts will download shortly! it might take several minutes");
1279 text : "All Transactions / All Accounts (Selected Financial Year)"
1290 beforeload : function (_self, options)
1292 options.params = options.params || {};
1294 var s = _this.wgrid.getSelectionModel().getSelected();
1300 var dt = _this.dateSel.getValue();
1301 var g = _this.gltransBox.getValue();
1306 'accnt_id:number' : s.data.accnt_id,
1307 'endDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d')
1310 // can not do source + search..
1311 var source = _this.sourceCombo.getValue();
1312 if (source != 'ALL') {
1313 params['search:text'] = source;
1317 params['search:text'] = g;
1320 Roo.apply(options.params,params);
1322 var cm = _this.grid.getColumnModel();
1323 var hide = (g.length) ? true : false;
1325 cm.setHidden(cm.getIndexByDataIndex('gltrans_balance'), hide);
1336 url : baseURL + '/Roo/Metasql.php'
1339 xtype: 'JsonReader',
1343 totalProperty : 'total',
1346 'name': 'gltrans_id',
1350 'name': 'gltrans_accnt_id',
1354 'name': 'gltrans_source',
1358 'name': 'gltrans_amount',
1362 'name': 'gltrans_notes',
1369 xtype: 'PagingToolbar',
1376 text : "Double Click To Edit"
1382 xtype: 'ColumnModel',
1384 dataIndex : 'gltrans_date',
1388 renderer : function(v,x,r) {
1389 return String.format('{0}<br/><i style="color:#ccc;">{1}</i>',
1390 v ? v : '', r.data.gltrans_sequence
1395 xtype: 'ColumnModel',
1397 dataIndex : 'gltrans_created',
1402 renderer : function(v,x,r) {
1403 return String.format('{0}<br/><i style="color:#ccc;">{1}</i>',
1404 v ? v : '', r.data.gltrans_sequence
1409 xtype: 'ColumnModel',
1411 dataIndex : 'gltrans_source',
1412 header : 'Source / Who',
1415 renderer : function(v,x,r) {
1416 return String.format('{0} - {1}<br/>{2}', v,r.data.gltrans_doctype, r.data.gltrans_username);
1420 xtype: 'ColumnModel',
1422 dataIndex : 'gltrans_docnumber',
1423 header : 'Doc Number',
1429 xtype: 'ColumnModel',
1431 dataIndex : 'gltrans_notes',
1432 header : 'Account / Notes',
1434 renderer : function(v,x,r)
1436 return String.format(
1437 '<u class="dragon-ref-accounts">{3}</u> - <span qtip="{2}"><b>{0}</b>' + "\n" + '{1}',
1438 r.data.gltrans_docnumber,
1440 v.split('\n').join('<br/>'),
1441 r.data.related_accounts
1443 ).split('\n').join('<br/>');
1447 xtype: 'GridEditor',
1456 xtype: 'ColumnModel',
1459 dataIndex : 'gltrans_base_curr',
1460 header : 'Currency',
1463 renderer : function(v) {
1464 return String.format('{0}', v);
1468 xtype: 'ColumnModel',
1471 dataIndex : 'gltrans_credit_amount',
1475 renderer : function(v,x,r) {
1476 return String.format('{0}', v ? Roo.util.Format.number(v*1,2) : '' );
1480 xtype: 'ColumnModel',
1483 dataIndex : 'gltrans_debit_amount',
1487 renderer : function(v,x,r) {
1488 return String.format('{0}', v ? Roo.util.Format.number(v*1,2) : '' );
1492 xtype: 'ColumnModel',
1495 dataIndex : 'gltrans_balance',
1499 renderer : function(v) {
1500 var c =v >= 0.0 ? 'black' : 'red';
1502 return String.format('<span style="color:' + c + ';">{0}</span>',
\r
1503 Roo.util.Format.number(v,2) );
1511 xtype: 'LayoutRegion',
1516 xtype: 'LayoutRegion',
1519 tabPosition : 'top',