選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 
 

63 行
2.2 KiB

  1. // Copyright (c) 2012 Web Notes Technologies Pvt Ltd (http://erpnext.com)
  2. //
  3. // MIT License (MIT)
  4. //
  5. // Permission is hereby granted, free of charge, to any person obtaining a
  6. // copy of this software and associated documentation files (the "Software"),
  7. // to deal in the Software without restriction, including without limitation
  8. // the rights to use, copy, modify, merge, publish, distribute, sublicense,
  9. // and/or sell copies of the Software, and to permit persons to whom the
  10. // Software is furnished to do so, subject to the following conditions:
  11. //
  12. // The above copyright notice and this permission notice shall be included in
  13. // all copies or substantial portions of the Software.
  14. //
  15. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  16. // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  17. // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  18. // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
  19. // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
  20. // OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21. //
  22. var export_dialog;
  23. function export_query(query, callback) {
  24. if(!export_dialog) {
  25. var d = new Dialog(400, 300, "Export...");
  26. d.make_body([
  27. ['Data', 'Max rows', 'Blank to export all rows'],
  28. ['Button', 'Go'],
  29. ]);
  30. d.widgets['Go'].onclick = function() {
  31. export_dialog.hide();
  32. n = export_dialog.widgets['Max rows'].value;
  33. if(cint(n))
  34. export_dialog.query += ' LIMIT 0,' + cint(n);
  35. callback(export_dialog.query);
  36. }
  37. d.onshow = function() {
  38. this.widgets['Max rows'].value = '500';
  39. }
  40. export_dialog = d;
  41. }
  42. export_dialog.query = query;
  43. export_dialog.show();
  44. }
  45. function export_csv(q, report_name, sc_id, is_simple, filter_values, colnames) {
  46. var args = {}
  47. args.cmd = 'webnotes.widgets.query_builder.runquery_csv';
  48. if(is_simple)
  49. args.simple_query = q;
  50. else
  51. args.query = q;
  52. args.sc_id = sc_id ? sc_id : '';
  53. args.filter_values = filter_values ? filter_values: '';
  54. if(colnames)
  55. args.colnames = colnames.join(',');
  56. args.report_name = report_name ? report_name : '';
  57. open_url_post(webnotes.request.url, args);
  58. }