diff --git a/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.js b/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.js new file mode 100644 index 0000000000..1454b2c73c --- /dev/null +++ b/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.js @@ -0,0 +1,8 @@ +// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors +// For license information, please see license.txt + +frappe.query_reports["Delivered Items To Be Billed"] = { + "filters": [ + + ] +} diff --git a/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.json b/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.json index 3432273230..f9d830bc94 100644 --- a/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.json +++ b/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.json @@ -7,7 +7,7 @@ "doctype": "Report", "idx": 1, "is_standard": "Yes", - "modified": "2016-08-18 14:29:50.680329", + "modified": "2017-01-02 16:13:27.369266", "modified_by": "Administrator", "module": "Accounts", "name": "Delivered Items To Be Billed", @@ -15,5 +15,5 @@ "query": "select\n `tabDelivery Note`.`name` as \"Delivery Note:Link/Delivery Note:120\",\n\t`tabDelivery Note`.`customer` as \"Customer:Link/Customer:120\",\n\t`tabDelivery Note`.`customer_name` as \"Customer Name::150\",\n\t`tabDelivery Note`.`posting_date` as \"Date:Date\",\n\t`tabDelivery Note`.`project` as \"Project\",\n\t`tabDelivery Note Item`.`item_code` as \"Item:Link/Item:120\",\n\t(`tabDelivery Note Item`.`base_amount` - `tabDelivery Note Item`.`billed_amt`*ifnull(`tabDelivery Note`.conversion_rate, 1)) as \"Pending Amount:Currency:110\",\n\t`tabDelivery Note Item`.`item_name` as \"Item Name::150\",\n\t`tabDelivery Note Item`.`description` as \"Description::200\",\n\t`tabDelivery Note`.`company` as \"Company:Link/Company:\"\nfrom `tabDelivery Note`, `tabDelivery Note Item`\nwhere \n `tabDelivery Note`.name = `tabDelivery Note Item`.parent \n and `tabDelivery Note`.docstatus = 1 \n and `tabDelivery Note`.`status` not in (\"Stopped\", \"Closed\") \n and `tabDelivery Note Item`.amount > 0\n and `tabDelivery Note Item`.billed_amt < `tabDelivery Note Item`.amount\norder by `tabDelivery Note`.`name` desc", "ref_doctype": "Sales Invoice", "report_name": "Delivered Items To Be Billed", - "report_type": "Query Report" + "report_type": "Script Report" } \ No newline at end of file diff --git a/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.py b/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.py new file mode 100644 index 0000000000..9bf851df41 --- /dev/null +++ b/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.py @@ -0,0 +1,26 @@ +# 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 erpnext.accounts.report.non_billed_report import get_ordered_to_be_billed_data + +def execute(filters=None): + columns = get_column() + args = get_args() + data = get_ordered_to_be_billed_data(args) + return columns, data + +def get_column(): + return [ + _("Delivery Note") + ":Link/Delivery Note:120", _("Date") + ":Date:100", + _("Suplier") + ":Link/Customer:120", _("Customer Name") + "::120", + _("Project") + ":Link/Project:120", _("Item Code") + ":Link/Item:120", + _("Amount") + ":Currency:100", _("Billed Amount") + ":Currency:100", _("Pending Amount") + ":Currency:100", + _("Item Name") + "::120", _("Description") + "::120", _("Company") + ":Link/Company:120", + ] + +def get_args(): + return {'doctype': 'Delivery Note', 'party': 'customer', + 'date': 'posting_date', 'order': 'name', 'order_by': 'desc'} \ No newline at end of file diff --git a/erpnext/accounts/report/non_billed_report.py b/erpnext/accounts/report/non_billed_report.py new file mode 100644 index 0000000000..41ec9b7466 --- /dev/null +++ b/erpnext/accounts/report/non_billed_report.py @@ -0,0 +1,38 @@ +# 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 erpnext import get_default_currency +from frappe.model.meta import get_field_precision + +def get_ordered_to_be_billed_data(args): + doctype, party = args.get('doctype'), args.get('party') + child_tab = doctype + " Item" + precision = get_field_precision(frappe.get_meta(child_tab).get_field("billed_amt"), + currency=get_default_currency()) or 2 + + project_field = get_project_field(doctype, party) + + return frappe.db.sql(""" + Select + `{parent_tab}`.name, `{parent_tab}`.{date_field}, `{parent_tab}`.{party}, `{parent_tab}`.{party}_name, + {project_field}, `{child_tab}`.item_code, `{child_tab}`.base_amount, + (`{child_tab}`.billed_amt * ifnull(`{parent_tab}`.conversion_rate, 1)), + (`{child_tab}`.base_amount - (`{child_tab}`.billed_amt * ifnull(`{parent_tab}`.conversion_rate, 1))), + `{child_tab}`.item_name, `{child_tab}`.description, `{parent_tab}`.company + from + `{parent_tab}`, `{child_tab}` + where + `{parent_tab}`.name = `{child_tab}`.parent and `{parent_tab}`.docstatus = 1 and `{parent_tab}`.status != 'Closed' + and `{child_tab}`.amount > 0 and round(`{child_tab}`.billed_amt * + ifnull(`{parent_tab}`.conversion_rate, 1), {precision}) < `{child_tab}`.base_amount + order by + `{parent_tab}`.{order} {order_by} + """.format(parent_tab = 'tab' + doctype, child_tab = 'tab' + child_tab, precision= precision, party = party, + date_field = args.get('date'), project_field = project_field, order= args.get('order'), order_by = args.get('order_by'))) + +def get_project_field(doctype, party): + if party == "supplier": doctype = doctype + ' Item' + return "`tab%s`.project"%(doctype) \ No newline at end of file diff --git a/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.js b/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.js new file mode 100644 index 0000000000..6e13d67766 --- /dev/null +++ b/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.js @@ -0,0 +1,8 @@ +// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors +// For license information, please see license.txt + +frappe.query_reports["Ordered Items To Be Billed"] = { + "filters": [ + + ] +} diff --git a/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.json b/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.json index 9091aa196f..96cf1a34f7 100644 --- a/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.json +++ b/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.json @@ -7,7 +7,7 @@ "doctype": "Report", "idx": 1, "is_standard": "Yes", - "modified": "2016-08-18 14:29:50.680329", + "modified": "2017-01-02 14:53:06.277319", "modified_by": "Administrator", "module": "Accounts", "name": "Ordered Items To Be Billed", @@ -15,5 +15,5 @@ "query": "select \n `tabSales Order`.`name` as \"Sales Order:Link/Sales Order:120\",\n `tabSales Order`.`customer` as \"Customer:Link/Customer:120\",\n `tabSales Order`.`customer_name` as \"Customer Name:150\",\n`tabSales Order`.`status` as \"Status\",\n `tabSales Order`.`transaction_date` as \"Date:Date\",\n `tabSales Order`.`project` as \"Project\",\n `tabSales Order Item`.item_code as \"Item:Link/Item:120\",\n `tabSales Order Item`.base_amount as \"Amount:Currency:110\",\n (`tabSales Order Item`.billed_amt * ifnull(`tabSales Order`.conversion_rate, 1)) as \"Billed Amount:Currency:110\",\n (`tabSales Order Item`.base_amount - (`tabSales Order Item`.billed_amt * ifnull(`tabSales Order`.conversion_rate, 1))) as \"Pending Amount:Currency:120\",\n `tabSales Order Item`.item_name as \"Item Name::150\",\n `tabSales Order Item`.description as \"Description::200\",\n `tabSales Order`.`company` as \"Company:Link/Company:\"\nfrom\n `tabSales Order`, `tabSales Order Item`\nwhere\n `tabSales Order Item`.`parent` = `tabSales Order`.`name`\n and `tabSales Order`.docstatus = 1\n and `tabSales Order`.status != \"Closed\"\n and `tabSales Order Item`.amount > 0\n and `tabSales Order Item`.billed_amt < `tabSales Order Item`.amount\norder by `tabSales Order`.transaction_date asc", "ref_doctype": "Sales Invoice", "report_name": "Ordered Items To Be Billed", - "report_type": "Query Report" + "report_type": "Script Report" } \ No newline at end of file diff --git a/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.py b/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.py new file mode 100644 index 0000000000..5765266f1c --- /dev/null +++ b/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.py @@ -0,0 +1,26 @@ +# 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 erpnext.accounts.report.non_billed_report import get_ordered_to_be_billed_data + +def execute(filters=None): + columns = get_column() + args = get_args() + data = get_ordered_to_be_billed_data(args) + return columns, data + +def get_column(): + return [ + _("Sales Order") + ":Link/Sales Order:120", _("Date") + ":Date:100", + _("Suplier") + ":Link/Customer:120", _("Customer Name") + "::120", + _("Project") + ":Link/Project:120", _("Item Code") + ":Link/Item:120", + _("Amount") + ":Currency:100", _("Billed Amount") + ":Currency:100", _("Pending Amount") + ":Currency:100", + _("Item Name") + "::120", _("Description") + "::120", _("Company") + ":Link/Company:120", + ] + +def get_args(): + return {'doctype': 'Sales Order', 'party': 'customer', + 'date': 'transaction_date', 'order': 'transaction_date', 'order_by': 'asc'} \ No newline at end of file diff --git a/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.js b/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.js new file mode 100644 index 0000000000..24c9592c24 --- /dev/null +++ b/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.js @@ -0,0 +1,8 @@ +// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors +// For license information, please see license.txt + +frappe.query_reports["Purchase Order Items To Be Billed"] = { + "filters": [ + + ] +} diff --git a/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.json b/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.json index 004c5a9223..16ed1bebbd 100644 --- a/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.json +++ b/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.json @@ -7,7 +7,7 @@ "doctype": "Report", "idx": 1, "is_standard": "Yes", - "modified": "2016-08-18 15:46:45.789536", + "modified": "2017-01-02 12:08:36.400900", "modified_by": "Administrator", "module": "Accounts", "name": "Purchase Order Items To Be Billed", @@ -15,5 +15,5 @@ "query": "select \n `tabPurchase Order`.`name` as \"Purchase Order:Link/Purchase Order:120\",\n `tabPurchase Order`.`transaction_date` as \"Date:Date:100\",\n\t`tabPurchase Order`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Order`.`supplier_name` as \"Supplier Name::150\",\n\t`tabPurchase Order Item`.`project` as \"Project\",\n\t`tabPurchase Order Item`.item_code as \"Item Code:Link/Item:120\",\n\t`tabPurchase Order Item`.base_amount as \"Amount:Currency:100\",\n\t(`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1)) as \"Billed Amount:Currency:100\", \n\t(`tabPurchase Order Item`.base_amount - (`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1))) as \"Amount to Bill:Currency:100\",\n\t`tabPurchase Order Item`.item_name as \"Item Name::150\",\n\t`tabPurchase Order Item`.description as \"Description::200\",\n\t`tabPurchase Order`.company as \"Company:Link/Company:\"\nfrom\n\t`tabPurchase Order`, `tabPurchase Order Item`\nwhere\n\t`tabPurchase Order Item`.`parent` = `tabPurchase Order`.`name`\n\tand `tabPurchase Order`.docstatus = 1\n\tand `tabPurchase Order`.status != \"Closed\"\n and `tabPurchase Order Item`.amount > 0\n\tand (`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1)) < `tabPurchase Order Item`.base_amount\norder by `tabPurchase Order`.transaction_date asc", "ref_doctype": "Purchase Invoice", "report_name": "Purchase Order Items To Be Billed", - "report_type": "Query Report" + "report_type": "Script Report" } \ No newline at end of file diff --git a/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.py b/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.py new file mode 100644 index 0000000000..5aed93d348 --- /dev/null +++ b/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.py @@ -0,0 +1,26 @@ +# 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 erpnext.accounts.report.non_billed_report import get_ordered_to_be_billed_data + +def execute(filters=None): + columns = get_column() + args = get_args() + data = get_ordered_to_be_billed_data(args) + return columns, data + +def get_column(): + return [ + _("Purchase Order") + ":Link/Purchase Order:120", _("Date") + ":Date:100", + _("Suplier") + ":Link/Supplier:120", _("Suplier Name") + "::120", + _("Project") + ":Link/Project:120", _("Item Code") + ":Link/Item:120", + _("Amount") + ":Currency:100", _("Billed Amount") + ":Currency:100", _("Amount to Bill") + ":Currency:100", + _("Item Name") + "::120", _("Description") + "::120", _("Company") + ":Link/Company:120", + ] + +def get_args(): + return {'doctype': 'Purchase Order', 'party': 'supplier', + 'date': 'transaction_date', 'order': 'transaction_date', 'order_by': 'asc'} diff --git a/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.js b/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.js new file mode 100644 index 0000000000..0ee3f57717 --- /dev/null +++ b/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.js @@ -0,0 +1,8 @@ +// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors +// For license information, please see license.txt + +frappe.query_reports["Received Items To Be Billed"] = { + "filters": [ + + ] +} diff --git a/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.json b/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.json index 00964c01b6..0379a5cdfd 100644 --- a/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.json +++ b/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.json @@ -7,7 +7,7 @@ "doctype": "Report", "idx": 1, "is_standard": "Yes", - "modified": "2016-08-18 14:32:20.965816", + "modified": "2017-01-02 16:05:01.929390", "modified_by": "Administrator", "module": "Accounts", "name": "Received Items To Be Billed", @@ -15,5 +15,5 @@ "query": "select\n `tabPurchase Receipt`.`name` as \"Purchase Receipt:Link/Purchase Receipt:120\",\n `tabPurchase Receipt`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Receipt`.`supplier_name` as \"Supplier Name::150\",\n\t`tabPurchase Receipt`.`posting_date` as \"Date:Date\",\n\t`tabPurchase Receipt Item`.`project` as \"Project\",\n\t`tabPurchase Receipt Item`.`item_code` as \"Item:Link/Item:120\",\n\t(`tabPurchase Receipt Item`.`base_amount` - `tabPurchase Receipt Item`.`billed_amt`*ifnull(`tabPurchase Receipt`.conversion_rate, 1)) as \"Pending Amount:Currency:110\",\n\t`tabPurchase Receipt Item`.`item_name` as \"Item Name::150\",\n\t`tabPurchase Receipt Item`.`description` as \"Description::200\",\n\t`tabPurchase Receipt`.`company` as \"Company:Link/Company:\"\nfrom `tabPurchase Receipt`, `tabPurchase Receipt Item`\nwhere\n `tabPurchase Receipt`.name = `tabPurchase Receipt Item`.parent \n and `tabPurchase Receipt`.docstatus = 1 \n and `tabPurchase Receipt`.status != \"Closed\" \n and `tabPurchase Receipt Item`.amount > 0\n and `tabPurchase Receipt Item`.billed_amt < `tabPurchase Receipt Item`.amount\norder by `tabPurchase Receipt`.`name` desc", "ref_doctype": "Purchase Invoice", "report_name": "Received Items To Be Billed", - "report_type": "Query Report" + "report_type": "Script Report" } \ No newline at end of file diff --git a/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.py b/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.py new file mode 100644 index 0000000000..2ab3053cf8 --- /dev/null +++ b/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.py @@ -0,0 +1,26 @@ +# 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 erpnext.accounts.report.non_billed_report import get_ordered_to_be_billed_data + +def execute(filters=None): + columns = get_column() + args = get_args() + data = get_ordered_to_be_billed_data(args) + return columns, data + +def get_column(): + return [ + _("Purchase Receipt") + ":Link/Purchase Receipt:120", _("Date") + ":Date:100", + _("Suplier") + ":Link/Supplier:120", _("Suplier Name") + "::120", + _("Project") + ":Link/Project:120", _("Item Code") + ":Link/Item:120", + _("Amount") + ":Currency:100", _("Billed Amount") + ":Currency:100", _("Amount to Bill") + ":Currency:100", + _("Item Name") + "::120", _("Description") + "::120", _("Company") + ":Link/Company:120", + ] + +def get_args(): + return {'doctype': 'Purchase Receipt', 'party': 'supplier', + 'date': 'posting_date', 'order': 'name', 'order_by': 'desc'} \ No newline at end of file