You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

97 line
2.1 KiB

  1. // Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors
  2. // For license information, please see license.txt
  3. /* eslint-disable */
  4. function get_filters() {
  5. let filters = [
  6. {
  7. "fieldname":"company",
  8. "label": __("Company"),
  9. "fieldtype": "Link",
  10. "options": "Company",
  11. "default": frappe.defaults.get_user_default("Company"),
  12. "reqd": 1
  13. },
  14. {
  15. "fieldname":"period_start_date",
  16. "label": __("Start Date"),
  17. "fieldtype": "Date",
  18. "reqd": 1,
  19. "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1)
  20. },
  21. {
  22. "fieldname":"period_end_date",
  23. "label": __("End Date"),
  24. "fieldtype": "Date",
  25. "reqd": 1,
  26. "default": frappe.datetime.get_today()
  27. },
  28. {
  29. "fieldname":"account",
  30. "label": __("Account"),
  31. "fieldtype": "MultiSelectList",
  32. "options": "Account",
  33. get_data: function(txt) {
  34. return frappe.db.get_link_options('Account', txt, {
  35. company: frappe.query_report.get_filter_value("company")
  36. });
  37. }
  38. },
  39. {
  40. "fieldname":"party_type",
  41. "label": __("Party Type"),
  42. "fieldtype": "Link",
  43. "options": "Party Type",
  44. "default": "",
  45. on_change: function() {
  46. frappe.query_report.set_filter_value('party', "");
  47. }
  48. },
  49. {
  50. "fieldname":"party",
  51. "label": __("Party"),
  52. "fieldtype": "MultiSelectList",
  53. get_data: function(txt) {
  54. if (!frappe.query_report.filters) return;
  55. let party_type = frappe.query_report.get_filter_value('party_type');
  56. if (!party_type) return;
  57. return frappe.db.get_link_options(party_type, txt);
  58. },
  59. },
  60. {
  61. "fieldname":"voucher_no",
  62. "label": __("Voucher No"),
  63. "fieldtype": "Data",
  64. "width": 100,
  65. },
  66. {
  67. "fieldname":"against_voucher_no",
  68. "label": __("Against Voucher No"),
  69. "fieldtype": "Data",
  70. "width": 100,
  71. },
  72. {
  73. "fieldname":"include_account_currency",
  74. "label": __("Include Account Currency"),
  75. "fieldtype": "Check",
  76. "width": 100,
  77. },
  78. {
  79. "fieldname":"group_party",
  80. "label": __("Group by Party"),
  81. "fieldtype": "Check",
  82. "width": 100,
  83. },
  84. ]
  85. return filters;
  86. }
  87. frappe.query_reports["Payment Ledger"] = {
  88. "filters": get_filters()
  89. };