feat(Supplier Scorecard): added method for invoiced quantity in supplier scorecard (#37580)
feat(Supplier Scorecard): added method for invoiced quantity in supplier scorecard Co-authored-by: vishnu <vishnuviswambara2002@gmail.com>
This commit is contained in:
parent
35020a9423
commit
98cc7434d2
@ -334,6 +334,11 @@ def make_default_records():
|
|||||||
"variable_label": "Total Ordered",
|
"variable_label": "Total Ordered",
|
||||||
"path": "get_ordered_qty",
|
"path": "get_ordered_qty",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"param_name": "total_invoiced",
|
||||||
|
"variable_label": "Total Invoiced",
|
||||||
|
"path": "get_invoiced_qty",
|
||||||
|
},
|
||||||
]
|
]
|
||||||
install_standing_docs = [
|
install_standing_docs = [
|
||||||
{
|
{
|
||||||
|
@ -440,6 +440,23 @@ def get_ordered_qty(scorecard):
|
|||||||
).run(as_list=True)[0][0] or 0
|
).run(as_list=True)[0][0] or 0
|
||||||
|
|
||||||
|
|
||||||
|
def get_invoiced_qty(scorecard):
|
||||||
|
"""Returns the total number of invoiced quantity (based on Purchase Invoice)"""
|
||||||
|
|
||||||
|
pi = frappe.qb.DocType("Purchase Invoice")
|
||||||
|
|
||||||
|
return (
|
||||||
|
frappe.qb.from_(pi)
|
||||||
|
.select(Sum(pi.total_qty))
|
||||||
|
.where(
|
||||||
|
(pi.supplier == scorecard.supplier)
|
||||||
|
& (pi.docstatus == 1)
|
||||||
|
& (pi.posting_date >= scorecard.get("start_date"))
|
||||||
|
& (pi.posting_date <= scorecard.get("end_date"))
|
||||||
|
)
|
||||||
|
).run(as_list=True)[0][0] or 0
|
||||||
|
|
||||||
|
|
||||||
def get_rfq_total_number(scorecard):
|
def get_rfq_total_number(scorecard):
|
||||||
"""Gets the total number of RFQs sent to supplier"""
|
"""Gets the total number of RFQs sent to supplier"""
|
||||||
supplier = frappe.get_doc("Supplier", scorecard.supplier)
|
supplier = frappe.get_doc("Supplier", scorecard.supplier)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user