mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-13 10:11:20 +00:00
Created multiple reports and linked them to email digest
This commit is contained in:
0
erpnext/accounts/report/account_balance/__init__.py
Normal file
0
erpnext/accounts/report/account_balance/__init__.py
Normal file
64
erpnext/accounts/report/account_balance/account_balance.js
Normal file
64
erpnext/accounts/report/account_balance/account_balance.js
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
|
// For license information, please see license.txt
|
||||||
|
/* eslint-disable */
|
||||||
|
|
||||||
|
frappe.query_reports["Account Balance"] = {
|
||||||
|
"filters": [
|
||||||
|
{
|
||||||
|
fieldname:"company",
|
||||||
|
label: __("Company"),
|
||||||
|
fieldtype: "Link",
|
||||||
|
options: "Company",
|
||||||
|
default: frappe.defaults.get_user_default("Company")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldname:"report_date",
|
||||||
|
label: __("Date"),
|
||||||
|
fieldtype: "Date",
|
||||||
|
default: frappe.datetime.get_today(),
|
||||||
|
reqd: 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldname: "root_type",
|
||||||
|
label: __("Root Type"),
|
||||||
|
fieldtype: "Select",
|
||||||
|
options: [
|
||||||
|
{ "value": "Asset", "label": __("Asset") },
|
||||||
|
{ "value": "Liability", "label": __("Liability") },
|
||||||
|
{ "value": "Income", "label": __("Income") },
|
||||||
|
{ "value": "Expense", "label": __("Expense") },
|
||||||
|
{ "value": "Equity", "label": __("Equity") }
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldname: "account_type",
|
||||||
|
label: __("Account Type"),
|
||||||
|
fieldtype: "Select",
|
||||||
|
options: [
|
||||||
|
{ "value": "Accumulated Depreciation", "label": __("Accumulated Depreciation") },
|
||||||
|
{ "value": "Asset Received But Not Billed", "label": __("Asset Received But Not Billed") },
|
||||||
|
{ "value": "Bank", "label": __("Bank") },
|
||||||
|
{ "value": "Cash", "label": __("Cash") },
|
||||||
|
{ "value": "Chargeble", "label": __("Chargeble") },
|
||||||
|
{ "value": "Capital Work in Progress", "label": __("Capital Work in Progress") },
|
||||||
|
{ "value": "Cost of Goods Sold", "label": __("Cost of Goods Sold") },
|
||||||
|
{ "value": "Depreciation", "label": __("Depreciation") },
|
||||||
|
{ "value": "Equity", "label": __("Equity") },
|
||||||
|
{ "value": "Expense Account", "label": __("MonExpense Accountthly") },
|
||||||
|
{ "value": "Expenses Included In Asset Valuation", "label": __("Expenses Included In Asset Valuation") },
|
||||||
|
{ "value": "Expenses Included In Valuation", "label": __("Expenses Included In Valuation") },
|
||||||
|
{ "value": "Fixed Asset", "label": __("Fixed Asset") },
|
||||||
|
{ "value": "Income Account", "label": __("Income Account") },
|
||||||
|
{ "value": "Payable", "label": __("Payable") },
|
||||||
|
{ "value": "Receivable", "label": __("Receivable") },
|
||||||
|
{ "value": "Round Off", "label": __("Round Off") },
|
||||||
|
{ "value": "Stock", "label": __("Stock") },
|
||||||
|
{ "value": "Stock Adjustment", "label": __("Stock Adjustment") },
|
||||||
|
{ "value": "Stock Received But Not Billed", "label": __("Stock Received But Not Billed") },
|
||||||
|
{ "value": "Tax", "label": __("Tax") },
|
||||||
|
{ "value": "Temporary", "label": __("Temporary") },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
]
|
||||||
|
}
|
||||||
19
erpnext/accounts/report/account_balance/account_balance.json
Normal file
19
erpnext/accounts/report/account_balance/account_balance.json
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"add_total_row": 0,
|
||||||
|
"creation": "2019-01-02 18:01:46.691685",
|
||||||
|
"disabled": 0,
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Report",
|
||||||
|
"idx": 0,
|
||||||
|
"is_standard": "Yes",
|
||||||
|
"modified": "2019-01-02 18:01:46.691685",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "Accounts",
|
||||||
|
"name": "Account Balance",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"prepared_report": 0,
|
||||||
|
"ref_doctype": "Bank Account",
|
||||||
|
"report_name": "Account Balance",
|
||||||
|
"report_type": "Script Report",
|
||||||
|
"roles": []
|
||||||
|
}
|
||||||
73
erpnext/accounts/report/account_balance/account_balance.py
Normal file
73
erpnext/accounts/report/account_balance/account_balance.py
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
# 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.utils import get_balance_on
|
||||||
|
|
||||||
|
def execute(filters=None):
|
||||||
|
filters = frappe._dict(filters or {})
|
||||||
|
columns = get_columns(filters)
|
||||||
|
data = get_data(filters)
|
||||||
|
return columns, data
|
||||||
|
|
||||||
|
def get_columns(filters):
|
||||||
|
columns = [
|
||||||
|
{
|
||||||
|
"label": _("Account"),
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"fieldname": "account",
|
||||||
|
"options": "Account",
|
||||||
|
"width": 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": _("Currency"),
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"fieldname": "currency",
|
||||||
|
"options": "Currency",
|
||||||
|
"hidden": 1,
|
||||||
|
"width": 50
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": _("Balance"),
|
||||||
|
"fieldtype": "Currency",
|
||||||
|
"fieldname": "balance",
|
||||||
|
"options": "currency",
|
||||||
|
"width": 100
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
return columns
|
||||||
|
|
||||||
|
def get_conditions(filters):
|
||||||
|
conditions = {}
|
||||||
|
|
||||||
|
if filters.account_type:
|
||||||
|
conditions["account_type"] = filters.account_type
|
||||||
|
return conditions
|
||||||
|
|
||||||
|
if filters.company:
|
||||||
|
conditions["company"] = filters.company
|
||||||
|
|
||||||
|
if filters.root_type:
|
||||||
|
conditions["root_type"] = filters.root_type
|
||||||
|
|
||||||
|
return conditions
|
||||||
|
|
||||||
|
def get_data(filters):
|
||||||
|
|
||||||
|
data = []
|
||||||
|
|
||||||
|
conditions = get_conditions(filters)
|
||||||
|
|
||||||
|
accounts = frappe.db.get_all("Account", fields=["name", "account_currency"],
|
||||||
|
filters=conditions)
|
||||||
|
|
||||||
|
for d in accounts:
|
||||||
|
balance = get_balance_on(d.name, date=filters.report_date)
|
||||||
|
row = {"account": d.name, "balance": balance, "currency": d.account_currency}
|
||||||
|
|
||||||
|
data.append(row)
|
||||||
|
|
||||||
|
return data
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"add_total_row": 0,
|
||||||
|
"creation": "2019-01-03 17:16:44.566899",
|
||||||
|
"disabled": 0,
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Report",
|
||||||
|
"idx": 0,
|
||||||
|
"is_standard": "Yes",
|
||||||
|
"json": "{\"order_by\": \"`tabPurchase Order`.`modified` desc\", \"filters\": [[\"Purchase Order\", \"status\", \"!=\", \"Closed\", false], [\"Purchase Order\", \"status\", \"!=\", \"Cancelled\", false], [\"Purchase Order\", \"status\", \"!=\", \"Completed\", false]], \"fields\": [[\"name\", \"Purchase Order\"], [\"docstatus\", \"Purchase Order\"], [\"title\", \"Purchase Order\"], [\"supplier\", \"Purchase Order\"], [\"company\", \"Purchase Order\"], [\"transaction_date\", \"Purchase Order\"], [\"is_subcontracted\", \"Purchase Order\"], [\"grand_total\", \"Purchase Order\"], [\"status\", \"Purchase Order\"], [\"per_received\", \"Purchase Order\"], [\"per_billed\", \"Purchase Order\"], [\"currency\", \"Purchase Order\"], [\"base_grand_total\", \"Purchase Order\"], [\"supplier_name\", \"Purchase Order\"]], \"add_totals_row\": 0, \"add_total_row\": 0, \"page_length\": 20}",
|
||||||
|
"modified": "2019-01-03 17:17:01.743154",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "Buying",
|
||||||
|
"name": "Pending Purchase Order",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"prepared_report": 0,
|
||||||
|
"ref_doctype": "Purchase Order",
|
||||||
|
"report_name": "Pending Purchase Order",
|
||||||
|
"report_type": "Report Builder",
|
||||||
|
"roles": [
|
||||||
|
{
|
||||||
|
"role": "Stock User"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "Purchase Manager"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "Purchase User"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
0
erpnext/buying/report/purchase_order/__init__.py
Normal file
0
erpnext/buying/report/purchase_order/__init__.py
Normal file
30
erpnext/buying/report/purchase_order/purchase_order.json
Normal file
30
erpnext/buying/report/purchase_order/purchase_order.json
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"add_total_row": 0,
|
||||||
|
"creation": "2019-01-03 16:38:31.599513",
|
||||||
|
"disabled": 0,
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Report",
|
||||||
|
"idx": 0,
|
||||||
|
"is_standard": "Yes",
|
||||||
|
"json": "{\"order_by\": \"`tabPurchase Order`.`modified` desc\", \"filters\": [], \"fields\": [[\"name\", \"Purchase Order\"], [\"docstatus\", \"Purchase Order\"], [\"title\", \"Purchase Order\"], [\"supplier\", \"Purchase Order\"], [\"company\", \"Purchase Order\"], [\"transaction_date\", \"Purchase Order\"], [\"is_subcontracted\", \"Purchase Order\"], [\"grand_total\", \"Purchase Order\"], [\"status\", \"Purchase Order\"], [\"per_received\", \"Purchase Order\"], [\"per_billed\", \"Purchase Order\"], [\"currency\", \"Purchase Order\"], [\"base_grand_total\", \"Purchase Order\"], [\"supplier_name\", \"Purchase Order\"]], \"add_totals_row\": 0, \"add_total_row\": 0, \"page_length\": 20}",
|
||||||
|
"modified": "2019-01-03 16:39:06.391403",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "Buying",
|
||||||
|
"name": "Purchase Order",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"prepared_report": 0,
|
||||||
|
"ref_doctype": "Purchase Order",
|
||||||
|
"report_name": "Purchase Order",
|
||||||
|
"report_type": "Report Builder",
|
||||||
|
"roles": [
|
||||||
|
{
|
||||||
|
"role": "Stock User"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "Purchase Manager"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "Purchase User"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"add_total_row": 0,
|
||||||
|
"creation": "2019-01-03 18:15:59.883138",
|
||||||
|
"disabled": 0,
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Report",
|
||||||
|
"idx": 0,
|
||||||
|
"is_standard": "Yes",
|
||||||
|
"json": "{\"order_by\": \"`tabQuotation`.`modified` desc\", \"filters\": [[\"Quotation\", \"status\", \"!=\", \"Ordered\", false], [\"Quotation\", \"status\", \"!=\", \"Cancelled\", false], [\"Quotation\", \"status\", \"!=\", \"Lost\", false]], \"fields\": [[\"name\", \"Quotation\"], [\"docstatus\", \"Quotation\"], [\"title\", \"Quotation\"], [\"customer\", \"Quotation\"], [\"lead\", \"Quotation\"], [\"transaction_date\", \"Quotation\"], [\"order_type\", \"Quotation\"], [\"grand_total\", \"Quotation\"], [\"status\", \"Quotation\"], [\"currency\", \"Quotation\"], [\"customer_name\", \"Quotation\"], [\"base_grand_total\", \"Quotation\"], [\"company\", \"Quotation\"], [\"valid_till\", \"Quotation\"]], \"add_totals_row\": 0, \"add_total_row\": 0, \"page_length\": 20}",
|
||||||
|
"modified": "2019-01-03 18:16:59.387310",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "Selling",
|
||||||
|
"name": "Pending Quotation",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"prepared_report": 0,
|
||||||
|
"ref_doctype": "Quotation",
|
||||||
|
"report_name": "Pending Quotation",
|
||||||
|
"report_type": "Report Builder",
|
||||||
|
"roles": [
|
||||||
|
{
|
||||||
|
"role": "Sales User"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "Sales Manager"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "Maintenance Manager"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "Maintenance User"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"add_total_row": 0,
|
||||||
|
"creation": "2019-01-03 17:14:52.306383",
|
||||||
|
"disabled": 0,
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Report",
|
||||||
|
"idx": 0,
|
||||||
|
"is_standard": "Yes",
|
||||||
|
"json": "{\"order_by\": \"`tabSales Order`.`modified` desc\", \"filters\": [[\"Sales Order\", \"status\", \"!=\", \"Closed\", false], [\"Sales Order\", \"status\", \"!=\", \"Cancelled\", false], [\"Sales Order\", \"status\", \"!=\", \"Completed\", false]], \"fields\": [[\"name\", \"Sales Order\"], [\"docstatus\", \"Sales Order\"], [\"title\", \"Sales Order\"], [\"customer\", \"Sales Order\"], [\"company\", \"Sales Order\"], [\"delivery_date\", \"Sales Order\"], [\"grand_total\", \"Sales Order\"], [\"status\", \"Sales Order\"], [\"delivery_status\", \"Sales Order\"], [\"per_delivered\", \"Sales Order\"], [\"per_billed\", \"Sales Order\"], [\"billing_status\", \"Sales Order\"], [\"currency\", \"Sales Order\"]], \"add_totals_row\": 0, \"add_total_row\": 0, \"page_length\": 20}",
|
||||||
|
"modified": "2019-01-03 17:15:10.048190",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "Selling",
|
||||||
|
"name": "Pending Sales Order",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"prepared_report": 0,
|
||||||
|
"ref_doctype": "Sales Order",
|
||||||
|
"report_name": "Pending Sales Order",
|
||||||
|
"report_type": "Report Builder",
|
||||||
|
"roles": [
|
||||||
|
{
|
||||||
|
"role": "Sales User"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "Sales Manager"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "Maintenance User"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "Accounts User"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "Stock User"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
0
erpnext/selling/report/quotation/__init__.py
Normal file
0
erpnext/selling/report/quotation/__init__.py
Normal file
33
erpnext/selling/report/quotation/quotation.json
Normal file
33
erpnext/selling/report/quotation/quotation.json
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"add_total_row": 0,
|
||||||
|
"creation": "2019-01-03 16:56:31.471743",
|
||||||
|
"disabled": 0,
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Report",
|
||||||
|
"idx": 0,
|
||||||
|
"is_standard": "Yes",
|
||||||
|
"json": "{\"order_by\": \"`tabQuotation`.`modified` desc\", \"filters\": [], \"fields\": [[\"name\", \"Quotation\"], [\"docstatus\", \"Quotation\"], [\"title\", \"Quotation\"], [\"customer\", \"Quotation\"], [\"lead\", \"Quotation\"], [\"transaction_date\", \"Quotation\"], [\"order_type\", \"Quotation\"], [\"grand_total\", \"Quotation\"], [\"status\", \"Quotation\"], [\"currency\", \"Quotation\"], [\"customer_name\", \"Quotation\"], [\"base_grand_total\", \"Quotation\"], [\"company\", \"Quotation\"], [\"valid_till\", \"Quotation\"]], \"add_totals_row\": 0, \"add_total_row\": 0, \"page_length\": 20}",
|
||||||
|
"modified": "2019-01-03 16:56:47.332060",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "Selling",
|
||||||
|
"name": "Quotation",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"prepared_report": 0,
|
||||||
|
"ref_doctype": "Quotation",
|
||||||
|
"report_name": "Quotation",
|
||||||
|
"report_type": "Report Builder",
|
||||||
|
"roles": [
|
||||||
|
{
|
||||||
|
"role": "Sales User"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "Sales Manager"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "Maintenance Manager"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "Maintenance User"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
0
erpnext/selling/report/sales_order/__init__.py
Normal file
0
erpnext/selling/report/sales_order/__init__.py
Normal file
36
erpnext/selling/report/sales_order/sales_order.json
Normal file
36
erpnext/selling/report/sales_order/sales_order.json
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"add_total_row": 0,
|
||||||
|
"creation": "2019-01-03 16:36:17.286638",
|
||||||
|
"disabled": 0,
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Report",
|
||||||
|
"idx": 0,
|
||||||
|
"is_standard": "Yes",
|
||||||
|
"json": "{\"order_by\": \"`tabSales Order`.`modified` desc\", \"filters\": [], \"fields\": [[\"name\", \"Sales Order\"], [\"docstatus\", \"Sales Order\"], [\"title\", \"Sales Order\"], [\"customer\", \"Sales Order\"], [\"company\", \"Sales Order\"], [\"delivery_date\", \"Sales Order\"], [\"grand_total\", \"Sales Order\"], [\"status\", \"Sales Order\"], [\"delivery_status\", \"Sales Order\"], [\"per_delivered\", \"Sales Order\"], [\"per_billed\", \"Sales Order\"], [\"billing_status\", \"Sales Order\"], [\"currency\", \"Sales Order\"]], \"add_totals_row\": 0, \"add_total_row\": 0, \"page_length\": 20}",
|
||||||
|
"modified": "2019-01-03 16:37:52.075587",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "Selling",
|
||||||
|
"name": "Sales Order",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"prepared_report": 0,
|
||||||
|
"ref_doctype": "Sales Order",
|
||||||
|
"report_name": "Sales Order",
|
||||||
|
"report_type": "Report Builder",
|
||||||
|
"roles": [
|
||||||
|
{
|
||||||
|
"role": "Sales User"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "Sales Manager"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "Maintenance User"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "Accounts User"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "Stock User"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -288,8 +288,9 @@ class EmailDigest(Document):
|
|||||||
"""Get income for given period"""
|
"""Get income for given period"""
|
||||||
income, past_income, count = self.get_period_amounts(self.get_roots("income"),'income')
|
income, past_income, count = self.get_period_amounts(self.get_roots("income"),'income')
|
||||||
|
|
||||||
|
label = get_link_to_report("Sales Register",self.meta.get_label("income"),filters={"company":self.company})
|
||||||
return {
|
return {
|
||||||
"label": get_link_to_report("Sales Register",self.meta.get_label("income")),
|
"label": label,
|
||||||
"value": income,
|
"value": income,
|
||||||
"last_value": past_income,
|
"last_value": past_income,
|
||||||
"count": count
|
"count": count
|
||||||
@@ -312,8 +313,20 @@ class EmailDigest(Document):
|
|||||||
balance += get_balance_on(account, date = self.future_to_date)
|
balance += get_balance_on(account, date = self.future_to_date)
|
||||||
count += get_count_on(account, fieldname, date = self.future_to_date)
|
count += get_count_on(account, fieldname, date = self.future_to_date)
|
||||||
|
|
||||||
|
if fieldname == 'income':
|
||||||
|
filters = {
|
||||||
|
"root_type": "Income",
|
||||||
|
}
|
||||||
|
label = get_link_to_report('Account Balance', label=self.meta.get_label(root_type + "_year_to_date"), filters=filters)
|
||||||
|
|
||||||
|
elif fieldname == 'expenses_booked':
|
||||||
|
filters = {
|
||||||
|
"root_type": "Expense",
|
||||||
|
}
|
||||||
|
label = get_link_to_report('Account Balance', label=self.meta.get_label(root_type + "_year_to_date"), filters=filters)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"label": self.meta.get_label(root_type + "_year_to_date"),
|
"label": label,
|
||||||
"value": balance,
|
"value": balance,
|
||||||
"count": count
|
"count": count
|
||||||
}
|
}
|
||||||
@@ -335,8 +348,10 @@ class EmailDigest(Document):
|
|||||||
def get_expenses_booked(self):
|
def get_expenses_booked(self):
|
||||||
expenses, past_expenses, count = self.get_period_amounts(self.get_roots("expense"), 'expenses_booked')
|
expenses, past_expenses, count = self.get_period_amounts(self.get_roots("expense"), 'expenses_booked')
|
||||||
|
|
||||||
|
label = get_link_to_report("Purchase Register",self.meta.get_label("expenses_booked"),
|
||||||
|
filters={"company": self.company})
|
||||||
return {
|
return {
|
||||||
"label": get_link_to_report("Purchase Register",self.meta.get_label("expenses_booked")),
|
"label": label,
|
||||||
"value": expenses,
|
"value": expenses,
|
||||||
"last_value": past_expenses,
|
"last_value": past_expenses,
|
||||||
"count": count
|
"count": count
|
||||||
@@ -375,8 +390,11 @@ class EmailDigest(Document):
|
|||||||
where (transaction_date <= %(to_date)s) and delivery_status != "Fully Delivered"
|
where (transaction_date <= %(to_date)s) and delivery_status != "Fully Delivered"
|
||||||
and status not in ('Closed','Cancelled', 'Completed') """, {"to_date": self.future_to_date})[0]
|
and status not in ('Closed','Cancelled', 'Completed') """, {"to_date": self.future_to_date})[0]
|
||||||
|
|
||||||
|
label = get_link_to_report("Pending Sales Order", label=self.meta.get_label("sales_orders_to_deliver"),
|
||||||
|
report_type="Report Builder", doctype="Sales Order")
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"label": self.meta.get_label("sales_orders_to_deliver"),
|
"label": label,
|
||||||
"value": value,
|
"value": value,
|
||||||
"count": count
|
"count": count
|
||||||
}
|
}
|
||||||
@@ -389,8 +407,11 @@ class EmailDigest(Document):
|
|||||||
where (transaction_date <= %(to_date)s) and per_received < 100
|
where (transaction_date <= %(to_date)s) and per_received < 100
|
||||||
and status not in ('Closed','Cancelled', 'Completed') """, {"to_date": self.future_to_date})[0]
|
and status not in ('Closed','Cancelled', 'Completed') """, {"to_date": self.future_to_date})[0]
|
||||||
|
|
||||||
|
label = get_link_to_report("Pending Purchase Order", label=self.meta.get_label("purchase_orders_to_receive"),
|
||||||
|
report_type="Report Builder", doctype="Purchase Order")
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"label": self.meta.get_label("purchase_orders_to_receive"),
|
"label": label,
|
||||||
"value": value,
|
"value": value,
|
||||||
"count": count
|
"count": count
|
||||||
}
|
}
|
||||||
@@ -428,15 +449,28 @@ class EmailDigest(Document):
|
|||||||
prev_balance += get_balance_on(account, date=self.past_to_date, in_account_currency=False)
|
prev_balance += get_balance_on(account, date=self.past_to_date, in_account_currency=False)
|
||||||
|
|
||||||
if fieldname in ("bank_balance","credit_balance"):
|
if fieldname in ("bank_balance","credit_balance"):
|
||||||
|
label = ""
|
||||||
|
if fieldname == "bank_balance":
|
||||||
|
filters = {
|
||||||
|
"root_type": "Asset",
|
||||||
|
}
|
||||||
|
label = get_link_to_report('Account Balance', label=self.meta.get_label(fieldname), filters=filters)
|
||||||
|
else:
|
||||||
|
filters = {
|
||||||
|
"root_type": "Liability",
|
||||||
|
}
|
||||||
|
label = get_link_to_report('Account Balance', label=self.meta.get_label(fieldname), filters=filters)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'label': self.meta.get_label(fieldname),
|
'label': label,
|
||||||
'value': balance,
|
'value': balance,
|
||||||
'last_value': prev_balance }
|
'last_value': prev_balance
|
||||||
|
}
|
||||||
else:
|
else:
|
||||||
if account_type == 'Payable':
|
if account_type == 'Payable':
|
||||||
label = get_link_to_report('Accounts Payable', self.meta.get_label(fieldname))
|
label = get_link_to_report('Accounts Payable', label=self.meta.get_label(fieldname))
|
||||||
elif account_type == 'Receivable':
|
elif account_type == 'Receivable':
|
||||||
label = get_link_to_report('Accounts Receivable', self.meta.get_label(fieldname))
|
label = get_link_to_report('Accounts Receivable', label=self.meta.get_label(fieldname))
|
||||||
else:
|
else:
|
||||||
label = self.meta.get_label(fieldname)
|
label = self.meta.get_label(fieldname)
|
||||||
|
|
||||||
@@ -494,10 +528,10 @@ class EmailDigest(Document):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
"label": self.meta.get_label(fieldname),
|
"label": self.meta.get_label(fieldname),
|
||||||
"value": value,
|
"value": value,
|
||||||
"billed_value": billed_value,
|
"billed_value": billed_value,
|
||||||
"delivered_value": delivered_value,
|
"delivered_value": delivered_value,
|
||||||
"count": count
|
"count": count
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_summary_of_pending_quotations(self, fieldname):
|
def get_summary_of_pending_quotations(self, fieldname):
|
||||||
@@ -512,11 +546,14 @@ class EmailDigest(Document):
|
|||||||
and company = %(company)s
|
and company = %(company)s
|
||||||
and status not in ('Ordered','Cancelled', 'Lost') """,{"to_date": self.past_to_date, "company": self.company})[0][0]
|
and status not in ('Ordered','Cancelled', 'Lost') """,{"to_date": self.past_to_date, "company": self.company})[0][0]
|
||||||
|
|
||||||
|
label = get_link_to_report("Pending Quotation", label=self.meta.get_label(fieldname),
|
||||||
|
report_type="Report Builder", doctype="Quotation")
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"label": self.meta.get_label(fieldname),
|
"label": label,
|
||||||
"value": value,
|
"value": value,
|
||||||
"last_value": last_value,
|
"last_value": last_value,
|
||||||
"count": count
|
"count": count
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_summary_of_doc(self, doc_type, fieldname):
|
def get_summary_of_doc(self, doc_type, fieldname):
|
||||||
@@ -526,10 +563,16 @@ class EmailDigest(Document):
|
|||||||
|
|
||||||
last_value =self.get_total_on(doc_type, self.past_from_date, self.past_to_date)[0]
|
last_value =self.get_total_on(doc_type, self.past_from_date, self.past_to_date)[0]
|
||||||
|
|
||||||
|
filters = {
|
||||||
|
"transaction_date": getdate()
|
||||||
|
}
|
||||||
|
label = get_link_to_report(doc_type,label=self.meta.get_label(fieldname),
|
||||||
|
report_type="Report Builder", filters=filters, doctype=doc_type)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"label": self.meta.get_label(fieldname),
|
"label": label,
|
||||||
"value": value,
|
"value": value,
|
||||||
"last_value": last_value,
|
"last_value": last_value,
|
||||||
"count": count
|
"count": count
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user