Added Number Cards for Opportunities

This commit is contained in:
Jeremy Rangel
2025-06-19 23:40:03 -07:00
parent 0b4f0f4a45
commit f44b3e8605
19 changed files with 288 additions and 4 deletions

View File

@ -0,0 +1,19 @@
{
"creation": "2025-06-18 20:11:15.922486",
"docstatus": 0,
"doctype": "Number Card",
"document_type": "Opportunity",
"method": "rangeldigital.rangel_digital.number_card.overdue_opportunities.overdue_opportunities.get_number_card_data",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"label": "Overdue Opportunities",
"modified": "2025-06-19 12:15:53.088837",
"modified_by": "Administrator",
"module": "CRM",
"name": "Overdue Opportunities",
"owner": "Administrator",
"show_percentage_stats": 0,
"stats_time_interval": "",
"type": "Custom"
}

View File

@ -0,0 +1,23 @@
import frappe
from frappe import _
from datetime import datetime
@frappe.whitelist()
def get_number_card_data():
# Get today's date in YYYY-MM-DD format
today = datetime.today().strftime('%Y-%m-%d')
# Fetch count of open opportunities closing before today
count = frappe.db.count(
"Opportunity",
filters={
"expected_closing": ["<", today],
"status": ["not in", ["Closed", "Lost"]]
}
)
return {
"value": count,
"fieldtype": "Int",
"label": _("Overdue Opportunities")
}