feat: create procurement tracker report
This commit is contained in:
parent
4fcefda6c7
commit
69909c0f51
@ -0,0 +1,9 @@
|
|||||||
|
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
|
// For license information, please see license.txt
|
||||||
|
/* eslint-disable */
|
||||||
|
|
||||||
|
frappe.query_reports["Procurement Tracker"] = {
|
||||||
|
"filters": [
|
||||||
|
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"add_total_row": 1,
|
||||||
|
"creation": "2019-03-29 17:05:45.196949",
|
||||||
|
"disable_prepared_report": 0,
|
||||||
|
"disabled": 0,
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Report",
|
||||||
|
"idx": 0,
|
||||||
|
"is_standard": "Yes",
|
||||||
|
"modified": "2019-03-29 17:18:06.678728",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "Buying",
|
||||||
|
"name": "Procurement Tracker",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"prepared_report": 0,
|
||||||
|
"ref_doctype": "Purchase Order",
|
||||||
|
"report_name": "Procurement Tracker",
|
||||||
|
"report_type": "Script Report",
|
||||||
|
"roles": []
|
||||||
|
}
|
167
erpnext/buying/report/procurement_tracker/procurement_tracker.py
Normal file
167
erpnext/buying/report/procurement_tracker/procurement_tracker.py
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
|
# For license information, please see license.txt
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
import frappe
|
||||||
|
from frappe import _
|
||||||
|
from frappe.utils import cint,cstr
|
||||||
|
|
||||||
|
def execute(filters=None):
|
||||||
|
columns = get_columns()
|
||||||
|
data = get_data()
|
||||||
|
return columns, data
|
||||||
|
|
||||||
|
def get_columns():
|
||||||
|
columns = [
|
||||||
|
{
|
||||||
|
"label": _("Date Requisition Received in Procurement "),
|
||||||
|
"fieldname": "date_requisition_received_in_procurement",
|
||||||
|
"fieldtype": "Date",
|
||||||
|
"width": 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": _("Date Requisition was Raised"),
|
||||||
|
"fieldname": "date_requisition_was_raised",
|
||||||
|
"fieldtype": "Date",
|
||||||
|
"width": 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": _("Sector/Project"),
|
||||||
|
"options": "Cost Center",
|
||||||
|
"fieldname": "sector/project",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"width": 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": _("Requesting Site"),
|
||||||
|
"options": "Warehouse",
|
||||||
|
"fieldname": "requesting_site",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"width": 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": _("Requestor"),
|
||||||
|
"options": "Employee",
|
||||||
|
"fieldname": "requestor",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"width": 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": _("Budget Code"),
|
||||||
|
"options": "Budget",
|
||||||
|
"fieldname": "budget_code",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"width": 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": _("Requisition Line"),
|
||||||
|
"options": "Item",
|
||||||
|
"fieldname": "requisition_line",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"width": 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": _("Description"),
|
||||||
|
"fieldname": "description",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"width": 200
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": _("Quantity"),
|
||||||
|
"fieldname": "quantity",
|
||||||
|
"fieldtype": "Int",
|
||||||
|
"width": 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": _("Unit of Measure"),
|
||||||
|
"options": "UOM",
|
||||||
|
"fieldname": "unit_of_measurement",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"width": 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": _("Status"),
|
||||||
|
"fieldname": "status",
|
||||||
|
"fieldtype": "data",
|
||||||
|
"width": 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": _("Purchase Order Date"),
|
||||||
|
"fieldname": "purchase_order_date",
|
||||||
|
"fieldtype": "Date",
|
||||||
|
"width": 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": _("Purchase Order"),
|
||||||
|
"options": "Purchase Order",
|
||||||
|
"fieldname": "purchase_order",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"width": 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": _("Supplier"),
|
||||||
|
"options": "Supplier",
|
||||||
|
"fieldname": "supplier",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"width": 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": _("Estimated Cost"),
|
||||||
|
"fieldname": "estimated_cost",
|
||||||
|
"fieldtype": "Float",
|
||||||
|
"width": 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": _("Actual Cost"),
|
||||||
|
"fieldname": "actual_cost",
|
||||||
|
"fieldtype": "Float",
|
||||||
|
"width": 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": _("Purchase Order Amount"),
|
||||||
|
"fieldname": "purchase_order_amount",
|
||||||
|
"fieldtype": "Float",
|
||||||
|
"width": 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": _("Purchase Order Amount(USD)"),
|
||||||
|
"fieldname": "purchase_order_amount_usd",
|
||||||
|
"fieldtype": "Float",
|
||||||
|
"width": 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": _("Expected Delivery Date"),
|
||||||
|
"fieldname": "expected_delivery_date",
|
||||||
|
"fieldtype": "Date",
|
||||||
|
"width": 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": _("Actual Delivery Date"),
|
||||||
|
"fieldname": "actual_delivery_date",
|
||||||
|
"fieldtype": "Date",
|
||||||
|
"width": 140
|
||||||
|
},
|
||||||
|
]
|
||||||
|
return columns
|
||||||
|
|
||||||
|
def get_data():
|
||||||
|
purchase_order_entry = frappe.db.sql("""
|
||||||
|
SELECT
|
||||||
|
po_item.item_code,
|
||||||
|
po_item.item_name,
|
||||||
|
po_item.description,
|
||||||
|
po.name,
|
||||||
|
po.transaction_date,
|
||||||
|
po.customer,
|
||||||
|
po.territory,
|
||||||
|
sum(po_item.qty) as net_qty,
|
||||||
|
po.company
|
||||||
|
FROM `tabPurchase Order` po, `tabPurchase Order Item` po_item
|
||||||
|
WHERE
|
||||||
|
po.docstatus = 1
|
||||||
|
and po.name = po_item.parent
|
||||||
|
and po.status not in ("Closed","Completed","Cancelled")
|
||||||
|
GROUP BY
|
||||||
|
po.name,po_item.item_code
|
||||||
|
""", as_dict = 1)
|
||||||
|
return data
|
Loading…
Reference in New Issue
Block a user