Added Estimate dial API calls.

This commit is contained in:
rocketdebris 2026-01-24 17:05:30 -05:00
parent 91e4d47d48
commit 81f3489a24

View file

@ -481,6 +481,31 @@ def upsert_estimate(data):
print(f"DEBUG: Error in upsert_estimate: {str(e)}")
return build_error_response(str(e), 500)
@frappe.whitelist()
def get_unapproved_estimates_count(company):
"""Get the number of unapproved estimates."""
try:
draft_filters = {'status': "Draft", "company": company}
submitted_filters = {'status': "Submitted", "company": company}
draft_count = frappe.db.count("Quotation", filters=draft_filters)
submitted_count = frappe.db.count("Quotation", filters=submitted_filters)
return build_success_response([draft_count, submitted_count])
except Exception as e:
return build_error_response(str(e), 500)
@frappe.whitelist()
def get_estimates_half_down_count(company):
"""Get the number unpaid half-down estimates."""
try:
filters = {'requires_half_payment': True, 'company': company}
count = frappe.db.count("Quotation", filters=filters)
return build_success_response([count])
except Exception as e:
return build_error_response(str(e), 500)
def get_estimate_history(estimate_name):
"""Get the history of changes for a specific estimate."""
pass