Mode of Payment columns and filters added in sales/purchase register
This commit is contained in:
parent
80c02640a1
commit
3323d06be0
@ -34,6 +34,12 @@ frappe.query_reports["Item-wise Purchase Register"] = {
|
|||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"options": "Company",
|
"options": "Company",
|
||||||
"default": frappe.defaults.get_user_default("Company")
|
"default": frappe.defaults.get_user_default("Company")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname":"mode_of_payment",
|
||||||
|
"label": __("Mode of Payment"),
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"options": "Mode of Payment"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ def execute(filters=None):
|
|||||||
|
|
||||||
expense_account = d.expense_account or aii_account_map.get(d.company)
|
expense_account = d.expense_account or aii_account_map.get(d.company)
|
||||||
row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date, d.supplier,
|
row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date, d.supplier,
|
||||||
d.supplier_name, d.credit_to, d.project, d.company, d.purchase_order,
|
d.supplier_name, d.credit_to, d.mode_of_payment, d.project, d.company, d.purchase_order,
|
||||||
purchase_receipt, expense_account, d.qty, d.base_net_rate, d.base_net_amount]
|
purchase_receipt, expense_account, d.qty, d.base_net_rate, d.base_net_amount]
|
||||||
|
|
||||||
for tax in tax_accounts:
|
for tax in tax_accounts:
|
||||||
@ -53,7 +53,8 @@ def get_columns():
|
|||||||
return [_("Item Code") + ":Link/Item:120", _("Item Name") + "::120",
|
return [_("Item Code") + ":Link/Item:120", _("Item Name") + "::120",
|
||||||
_("Item Group") + ":Link/Item Group:100", _("Invoice") + ":Link/Purchase Invoice:120",
|
_("Item Group") + ":Link/Item Group:100", _("Invoice") + ":Link/Purchase Invoice:120",
|
||||||
_("Posting Date") + ":Date:80", _("Supplier") + ":Link/Supplier:120",
|
_("Posting Date") + ":Date:80", _("Supplier") + ":Link/Supplier:120",
|
||||||
"Supplier Name::120", "Payable Account:Link/Account:120", _("Project") + ":Link/Project:80",
|
"Supplier Name::120", "Payable Account:Link/Account:120",
|
||||||
|
_("Mode of Payment") + ":Link/Mode of Payment:80", _("Project") + ":Link/Project:80",
|
||||||
_("Company") + ":Link/Company:100", _("Purchase Order") + ":Link/Purchase Order:100",
|
_("Company") + ":Link/Company:100", _("Purchase Order") + ":Link/Purchase Order:100",
|
||||||
_("Purchase Receipt") + ":Link/Purchase Receipt:100", _("Expense Account") + ":Link/Account:140",
|
_("Purchase Receipt") + ":Link/Purchase Receipt:100", _("Expense Account") + ":Link/Account:140",
|
||||||
_("Qty") + ":Float:120", _("Rate") + ":Currency/currency:120", _("Amount") + ":Currency/currency:120"
|
_("Qty") + ":Float:120", _("Rate") + ":Currency/currency:120", _("Amount") + ":Currency/currency:120"
|
||||||
@ -66,7 +67,8 @@ def get_conditions(filters):
|
|||||||
("supplier", " and pi.supplier = %(supplier)s"),
|
("supplier", " and pi.supplier = %(supplier)s"),
|
||||||
("item_code", " and pi_item.item_code = %(item_code)s"),
|
("item_code", " and pi_item.item_code = %(item_code)s"),
|
||||||
("from_date", " and pi.posting_date>=%(from_date)s"),
|
("from_date", " and pi.posting_date>=%(from_date)s"),
|
||||||
("to_date", " and pi.posting_date<=%(to_date)s")):
|
("to_date", " and pi.posting_date<=%(to_date)s"),
|
||||||
|
("mode_of_payment", " and ifnull(mode_of_payment, '') = %(mode_of_payment)s")):
|
||||||
if filters.get(opts[0]):
|
if filters.get(opts[0]):
|
||||||
conditions += opts[1]
|
conditions += opts[1]
|
||||||
|
|
||||||
@ -82,7 +84,7 @@ def get_items(filters):
|
|||||||
pi.supplier, pi.remarks, pi.base_net_total, pi_item.item_code, pi_item.item_name,
|
pi.supplier, pi.remarks, pi.base_net_total, pi_item.item_code, pi_item.item_name,
|
||||||
pi_item.item_group, pi_item.project, pi_item.purchase_order, pi_item.purchase_receipt,
|
pi_item.item_group, pi_item.project, pi_item.purchase_order, pi_item.purchase_receipt,
|
||||||
pi_item.po_detail, pi_item.expense_account, pi_item.qty, pi_item.base_net_rate,
|
pi_item.po_detail, pi_item.expense_account, pi_item.qty, pi_item.base_net_rate,
|
||||||
pi_item.base_net_amount, pi.supplier_name
|
pi_item.base_net_amount, pi.supplier_name, pi.mode_of_payment
|
||||||
from `tabPurchase Invoice` pi, `tabPurchase Invoice Item` pi_item
|
from `tabPurchase Invoice` pi, `tabPurchase Invoice Item` pi_item
|
||||||
where pi.name = pi_item.parent and pi.docstatus = 1 %s %s
|
where pi.name = pi_item.parent and pi.docstatus = 1 %s %s
|
||||||
order by pi.posting_date desc, pi_item.item_code desc
|
order by pi.posting_date desc, pi_item.item_code desc
|
||||||
|
@ -28,6 +28,12 @@ frappe.query_reports["Item-wise Sales Register"] = frappe.query_reports["Sales R
|
|||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"options": "Company",
|
"options": "Company",
|
||||||
"default": frappe.defaults.get_user_default("Company")
|
"default": frappe.defaults.get_user_default("Company")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname":"mode_of_payment",
|
||||||
|
"label": __("Mode of Payment"),
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"options": "Mode of Payment"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ def execute(filters=None):
|
|||||||
from `tabDelivery Note Item` where docstatus=1 and so_detail=%s""", d.so_detail))
|
from `tabDelivery Note Item` where docstatus=1 and so_detail=%s""", d.so_detail))
|
||||||
|
|
||||||
row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date, d.customer, d.customer_name,
|
row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date, d.customer, d.customer_name,
|
||||||
d.customer_group, d.debit_to, d.territory, d.project, d.company, d.sales_order,
|
d.customer_group, d.debit_to, d.mode_of_payment, d.territory, d.project, d.company, d.sales_order,
|
||||||
delivery_note, d.income_account, d.qty, d.base_net_rate, d.base_net_amount]
|
delivery_note, d.income_account, d.qty, d.base_net_rate, d.base_net_amount]
|
||||||
|
|
||||||
for tax in tax_accounts:
|
for tax in tax_accounts:
|
||||||
@ -51,7 +51,8 @@ def get_columns():
|
|||||||
_("Item Group") + ":Link/Item Group:100", _("Invoice") + ":Link/Sales Invoice:120",
|
_("Item Group") + ":Link/Item Group:100", _("Invoice") + ":Link/Sales Invoice:120",
|
||||||
_("Posting Date") + ":Date:80", _("Customer") + ":Link/Customer:120",
|
_("Posting Date") + ":Date:80", _("Customer") + ":Link/Customer:120",
|
||||||
_("Customer Name") + "::120", _("Customer Group") + ":Link/Customer Group:120",
|
_("Customer Name") + "::120", _("Customer Group") + ":Link/Customer Group:120",
|
||||||
_("Receivable Account") + ":Link/Account:120", _("Territory") + ":Link/Territory:80",
|
_("Receivable Account") + ":Link/Account:120",
|
||||||
|
_("Mode of Payment") + ":Link/Mode of Payment:80", _("Territory") + ":Link/Territory:80",
|
||||||
_("Project") + ":Link/Project:80", _("Company") + ":Link/Company:100",
|
_("Project") + ":Link/Project:80", _("Company") + ":Link/Company:100",
|
||||||
_("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100",
|
_("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100",
|
||||||
_("Income Account") + ":Link/Account:140", _("Qty") + ":Float:120",
|
_("Income Account") + ":Link/Account:140", _("Qty") + ":Float:120",
|
||||||
@ -65,7 +66,8 @@ def get_conditions(filters):
|
|||||||
("customer", " and si.customer = %(customer)s"),
|
("customer", " and si.customer = %(customer)s"),
|
||||||
("item_code", " and si_item.item_code = %(item_code)s"),
|
("item_code", " and si_item.item_code = %(item_code)s"),
|
||||||
("from_date", " and si.posting_date>=%(from_date)s"),
|
("from_date", " and si.posting_date>=%(from_date)s"),
|
||||||
("to_date", " and si.posting_date<=%(to_date)s")):
|
("to_date", " and si.posting_date<=%(to_date)s"),
|
||||||
|
("mode_of_payment", " and ifnull(mode_of_payment, '') = %(mode_of_payment)s")):
|
||||||
if filters.get(opts[0]):
|
if filters.get(opts[0]):
|
||||||
conditions += opts[1]
|
conditions += opts[1]
|
||||||
|
|
||||||
@ -80,7 +82,7 @@ def get_items(filters):
|
|||||||
si_item.item_code, si_item.item_name, si_item.item_group, si_item.sales_order,
|
si_item.item_code, si_item.item_name, si_item.item_group, si_item.sales_order,
|
||||||
si_item.delivery_note, si_item.income_account, si_item.qty,
|
si_item.delivery_note, si_item.income_account, si_item.qty,
|
||||||
si_item.base_net_rate, si_item.base_net_amount, si.customer_name,
|
si_item.base_net_rate, si_item.base_net_amount, si.customer_name,
|
||||||
si.customer_group, si_item.so_detail
|
si.customer_group, si_item.so_detail, si.mode_of_payment
|
||||||
from `tabSales Invoice` si, `tabSales Invoice Item` si_item
|
from `tabSales Invoice` si, `tabSales Invoice Item` si_item
|
||||||
where si.name = si_item.parent and si.docstatus = 1 %s
|
where si.name = si_item.parent and si.docstatus = 1 %s
|
||||||
order by si.posting_date desc, si_item.item_code desc""" % conditions, filters, as_dict=1)
|
order by si.posting_date desc, si_item.item_code desc""" % conditions, filters, as_dict=1)
|
||||||
|
@ -28,6 +28,12 @@ frappe.query_reports["Purchase Register"] = {
|
|||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"options": "Company",
|
"options": "Company",
|
||||||
"default": frappe.defaults.get_user_default("Company")
|
"default": frappe.defaults.get_user_default("Company")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname":"mode_of_payment",
|
||||||
|
"label": __("Mode of Payment"),
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"options": "Mode of Payment"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ def execute(filters=None):
|
|||||||
|
|
||||||
row = [inv.name, inv.posting_date, inv.supplier, inv.supplier_name,
|
row = [inv.name, inv.posting_date, inv.supplier, inv.supplier_name,
|
||||||
supplier_details.get(inv.supplier),
|
supplier_details.get(inv.supplier),
|
||||||
inv.credit_to, ", ".join(project), inv.bill_no, inv.bill_date, inv.remarks,
|
inv.credit_to, inv.mode_of_payment, ", ".join(project), inv.bill_no, inv.bill_date, inv.remarks,
|
||||||
", ".join(purchase_order), ", ".join(purchase_receipt), company_currency]
|
", ".join(purchase_order), ", ".join(purchase_receipt), company_currency]
|
||||||
|
|
||||||
# map expense values
|
# map expense values
|
||||||
@ -64,10 +64,10 @@ def execute(filters=None):
|
|||||||
def get_columns(invoice_list):
|
def get_columns(invoice_list):
|
||||||
"""return columns based on filters"""
|
"""return columns based on filters"""
|
||||||
columns = [
|
columns = [
|
||||||
_("Invoice") + ":Link/Purchase Invoice:120",
|
_("Invoice") + ":Link/Purchase Invoice:120", _("Posting Date") + ":Date:80",
|
||||||
_("Posting Date") + ":Date:80", _("Supplier Id") + "::120",
|
_("Supplier Id") + "::120", _("Supplier Name") + "::120",
|
||||||
_("Supplier Name") + "::120", _("Supplier Type") + ":Link/Supplier Type:120",
|
_("Supplier Type") + ":Link/Supplier Type:120", _("Payable Account") + ":Link/Account:120",
|
||||||
_("Payable Account") + ":Link/Account:120", _("Project") + ":Link/Project:80",
|
_("Mode of Payment") + ":Link/Mode of Payment:80", _("Project") + ":Link/Project:80",
|
||||||
_("Bill No") + "::120", _("Bill Date") + ":Date:80", _("Remarks") + "::150",
|
_("Bill No") + "::120", _("Bill Date") + ":Date:80", _("Remarks") + "::150",
|
||||||
_("Purchase Order") + ":Link/Purchase Order:100",
|
_("Purchase Order") + ":Link/Purchase Order:100",
|
||||||
_("Purchase Receipt") + ":Link/Purchase Receipt:100",
|
_("Purchase Receipt") + ":Link/Purchase Receipt:100",
|
||||||
@ -114,6 +114,8 @@ def get_conditions(filters):
|
|||||||
|
|
||||||
if filters.get("from_date"): conditions += " and posting_date>=%(from_date)s"
|
if filters.get("from_date"): conditions += " and posting_date>=%(from_date)s"
|
||||||
if filters.get("to_date"): conditions += " and posting_date<=%(to_date)s"
|
if filters.get("to_date"): conditions += " and posting_date<=%(to_date)s"
|
||||||
|
|
||||||
|
if filters.get("mode_of_payment"): conditions += " and ifnull(mode_of_payment, '') = %(mode_of_payment)s"
|
||||||
|
|
||||||
return conditions
|
return conditions
|
||||||
|
|
||||||
@ -121,8 +123,8 @@ def get_invoices(filters):
|
|||||||
conditions = get_conditions(filters)
|
conditions = get_conditions(filters)
|
||||||
return frappe.db.sql("""
|
return frappe.db.sql("""
|
||||||
select
|
select
|
||||||
name, posting_date, credit_to, supplier, supplier_name,
|
name, posting_date, credit_to, supplier, supplier_name, bill_no, bill_date, remarks,
|
||||||
bill_no, bill_date, remarks, base_net_total, base_grand_total, outstanding_amount
|
base_net_total, base_grand_total, outstanding_amount, mode_of_payment
|
||||||
from `tabPurchase Invoice`
|
from `tabPurchase Invoice`
|
||||||
where docstatus = 1 %s
|
where docstatus = 1 %s
|
||||||
order by posting_date desc, name desc""" % conditions, filters, as_dict=1)
|
order by posting_date desc, name desc""" % conditions, filters, as_dict=1)
|
||||||
|
@ -28,6 +28,12 @@ frappe.query_reports["Sales Register"] = {
|
|||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"options": "Company",
|
"options": "Company",
|
||||||
"default": frappe.defaults.get_user_default("Company")
|
"default": frappe.defaults.get_user_default("Company")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname":"mode_of_payment",
|
||||||
|
"label": __("Mode of Payment"),
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"options": "Mode of Payment"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ def execute(filters=None):
|
|||||||
row = [inv.name, inv.posting_date, inv.customer, inv.customer_name,
|
row = [inv.name, inv.posting_date, inv.customer, inv.customer_name,
|
||||||
customer_map.get(inv.customer, {}).get("customer_group"),
|
customer_map.get(inv.customer, {}).get("customer_group"),
|
||||||
customer_map.get(inv.customer, {}).get("territory"),
|
customer_map.get(inv.customer, {}).get("territory"),
|
||||||
inv.debit_to, inv.project, inv.remarks,
|
inv.debit_to, inv.mode_of_payment, inv.project, inv.remarks,
|
||||||
", ".join(sales_order), ", ".join(delivery_note), company_currency]
|
", ".join(sales_order), ", ".join(delivery_note), company_currency]
|
||||||
|
|
||||||
# map income values
|
# map income values
|
||||||
@ -65,9 +65,11 @@ def execute(filters=None):
|
|||||||
def get_columns(invoice_list):
|
def get_columns(invoice_list):
|
||||||
"""return columns based on filters"""
|
"""return columns based on filters"""
|
||||||
columns = [
|
columns = [
|
||||||
_("Invoice") + ":Link/Sales Invoice:120", _("Posting Date") + ":Date:80", _("Customer Id") + "::120",
|
_("Invoice") + ":Link/Sales Invoice:120", _("Posting Date") + ":Date:80",
|
||||||
_("Customer Name") + "::120", _("Customer Group") + ":Link/Customer Group:120", _("Territory") + ":Link/Territory:80",
|
_("Customer Id") + "::120", _("Customer Name") + "::120",
|
||||||
_("Receivable Account") + ":Link/Account:120", _("Project") +":Link/Project:80", _("Remarks") + "::150",
|
_("Customer Group") + ":Link/Customer Group:120", _("Territory") + ":Link/Territory:80",
|
||||||
|
_("Receivable Account") + ":Link/Account:120", _("Mode of Payment") + ":Link/Mode of Payment:80",
|
||||||
|
_("Project") +":Link/Project:80", _("Remarks") + "::150",
|
||||||
_("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100",
|
_("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100",
|
||||||
{
|
{
|
||||||
"fieldname": "currency",
|
"fieldname": "currency",
|
||||||
@ -110,13 +112,15 @@ def get_conditions(filters):
|
|||||||
|
|
||||||
if filters.get("from_date"): conditions += " and posting_date >= %(from_date)s"
|
if filters.get("from_date"): conditions += " and posting_date >= %(from_date)s"
|
||||||
if filters.get("to_date"): conditions += " and posting_date <= %(to_date)s"
|
if filters.get("to_date"): conditions += " and posting_date <= %(to_date)s"
|
||||||
|
|
||||||
|
if filters.get("mode_of_payment"): conditions += " and ifnull(mode_of_payment, '') = %(mode_of_payment)s"
|
||||||
|
|
||||||
return conditions
|
return conditions
|
||||||
|
|
||||||
def get_invoices(filters):
|
def get_invoices(filters):
|
||||||
conditions = get_conditions(filters)
|
conditions = get_conditions(filters)
|
||||||
return frappe.db.sql("""select name, posting_date, debit_to, project, customer,
|
return frappe.db.sql("""select name, posting_date, debit_to, project, customer, customer_name, remarks,
|
||||||
customer_name, remarks, base_net_total, base_grand_total, base_rounded_total, outstanding_amount
|
base_net_total, base_grand_total, base_rounded_total, outstanding_amount, mode_of_payment
|
||||||
from `tabSales Invoice`
|
from `tabSales Invoice`
|
||||||
where docstatus = 1 %s order by posting_date desc, name desc""" %
|
where docstatus = 1 %s order by posting_date desc, name desc""" %
|
||||||
conditions, filters, as_dict=1)
|
conditions, filters, as_dict=1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user