def METHOD_NAME(from_date, to_date, company):
	validate_filters(from_date, to_date, company)
	opportunities = frappe.get_all(
		"Opportunity",
		filters=[
			["status", "in", ["Open", "Quotation", "Replied"]],
			["company", "=", company],
			["transaction_date", "Between", [from_date, to_date]],
		],
		fields=["currency", "sales_stage", "opportunity_amount", "probability", "source"],
	)
	if opportunities:
		default_currency = frappe.get_cached_value("Global Defaults", "None", "default_currency")
		cp_opportunities = [
			dict(
				x,
				**{
					"compound_amount": (
						convert(x["opportunity_amount"], x["currency"], default_currency, to_date)
						* x["probability"]
						/ 100
					)
				}
			)
			for x in opportunities
		]
		summary = {}
		sales_stages = set()
		group_key = lambda o: (o["source"], o["sales_stage"])  # noqa
		for (source, sales_stage), rows in groupby(cp_opportunities, group_key):
			summary.setdefault(source, {})[sales_stage] = sum(r["compound_amount"] for r in rows)
			sales_stages.add(sales_stage)
		pivot_table = []
		for sales_stage in sales_stages:
			row = []
			for source, sales_stage_values in summary.items():
				row.append(flt(sales_stage_values.get(sales_stage)))
			pivot_table.append({"chartType": "bar", "name": sales_stage, "values": row})
		result = {"datasets": pivot_table, "labels": list(summary.keys())}
		return result
	else:
		return "empty"