def get_data(filters):

	data = []

	fields = ["employee", "branch", "bank_name", "bank_ac_no", "salary_mode"]
	if erpbee.get_region() == "India":
		fields += ["ifsc_code", "micr_code"]


	employee_details = frappe.get_list("Employee", fields = fields)
	employee_data_dict = {}

	for d in employee_details:
		employee_data_dict.setdefault(
			d.employee,{
				"bank_ac_no" : d.bank_ac_no,
				"ifsc_code" : d.ifsc_code or None,
				"micr_code" : d.micr_code or  None,
				"branch" : d.branch,
				"salary_mode" : d.salary_mode,
				"bank_name": d.bank_name
			}
		)

	conditions = get_conditions(filters)

	entry = frappe.db.sql(""" select employee, employee_name, gross_pay
		from `tabSalary Slip`
		where docstatus = 1 %s """
		%(conditions), as_dict =1)

	for d in entry:

		employee = {
			"branch" : employee_data_dict.get(d.employee).get("branch"),
			"employee_name" : d.employee_name,
			"employee" : d.employee,
			"gross_pay" : d.gross_pay,
		}

		if employee_data_dict.get(d.employee).get("salary_mode") == "Bank":
			employee["bank"] = employee_data_dict.get(d.employee).get("bank_name")
			employee["account_no"] = employee_data_dict.get(d.employee).get("bank_ac_no")
			if erpbee.get_region() == "India":
				employee["ifsc"] = employee_data_dict.get(d.employee).get("ifsc_code")
				employee["micr"] = employee_data_dict.get(d.employee).get("micr_code")
		else:
			employee["account_no"] = employee_data_dict.get(d.employee).get("salary_mode")

		if filters.get("type") and employee_data_dict.get(d.employee).get("salary_mode") == filters.get("type"):
			data.append(employee)
		elif not filters.get("type"):
			data.append(employee)

	return data
Esempio n. 2
0
def get_data(filters):

    data = []

    if erpbee.get_region() == "India":
        employee_pan_dict = frappe._dict(
            frappe.db.sql(
                """ select employee, pan_number from `tabEmployee`"""))

    component_types = frappe.db.sql(""" select name from `tabSalary Component`
		where is_income_tax_component = 1 """)

    component_types = [comp_type[0] for comp_type in component_types]

    if not len(component_types):
        return []

    conditions = get_conditions(filters)

    entry = frappe.db.sql(
        """ select sal.employee, sal.employee_name, sal.posting_date, ded.salary_component, ded.amount,sal.gross_pay
		from `tabSalary Slip` sal, `tabSalary Detail` ded
		where sal.name = ded.parent
		and ded.parentfield = 'deductions'
		and ded.parenttype = 'Salary Slip'
		and sal.docstatus = 1 %s
		and ded.salary_component in (%s)
	""" % (conditions, ", ".join(['%s'] * len(component_types))),
        tuple(component_types),
        as_dict=1)

    for d in entry:

        employee = {
            "employee": d.employee,
            "employee_name": d.employee_name,
            "it_comp": d.salary_component,
            "posting_date": d.posting_date,
            # "pan_number": employee_pan_dict.get(d.employee),
            "it_amount": d.amount,
            "gross_pay": d.gross_pay
        }

        if erpbee.get_region() == "India":
            employee["pan_number"] = employee_pan_dict.get(d.employee)

        data.append(employee)

    return data
def get_columns(filters):
	columns = [
		{
			"label": _("Branch"),
			"options": "Branch",
			"fieldname": "branch",
			"fieldtype": "Link",
			"width": 200
		},
		{
			"label": _("Employee Name"),
			"options": "Employee",
			"fieldname": "employee_name",
			"fieldtype": "Link",
			"width": 160
		},
		{
			"label": _("Employee"),
			"options":"Employee",
			"fieldname": "employee",
			"fieldtype": "Link",
			"width": 140
		},
		{
			"label": _("Gross Pay"),
			"fieldname": "gross_pay",
			"fieldtype": "Currency",
			"options": "currency",
			"width": 140
		},
		{
			"label": _("Bank"),
			"fieldname": "bank",
			"fieldtype": "Data",
			"width": 140
		},
		{
			"label": _("Account No"),
			"fieldname": "account_no",
			"fieldtype": "Data",
			"width": 140
		},
	]
	if erpbee.get_region() == "India":
		columns += [
			{
				"label": _("IFSC"),
				"fieldname": "ifsc",
				"fieldtype": "Data",
				"width": 140
			},
			{
				"label": _("MICR"),
				"fieldname": "micr",
				"fieldtype": "Data",
				"width": 140
			}
		]

	return columns
Esempio n. 4
0
def execute():

    doctypes = [
        'salary_component', 'Employee Tax Exemption Declaration',
        'Employee Tax Exemption Proof Submission',
        'Employee Tax Exemption Declaration Category',
        'Employee Tax Exemption Proof Submission Detail'
    ]

    for doctype in doctypes:
        frappe.reload_doc('Payroll', 'doctype', doctype)

    reports = ['Professional Tax Deductions', 'Provident Fund Deductions']
    for report in reports:
        frappe.reload_doc('Regional', 'Report', report)
        frappe.reload_doc('Regional', 'Report', report)

    if erpbee.get_region() == "India":
        setup(patch=True)

    if frappe.db.exists("Salary Component", "Income Tax"):
        frappe.db.set_value("Salary Component", "Income Tax",
                            "is_income_tax_component", 1)
    if frappe.db.exists("Salary Component", "TDS"):
        frappe.db.set_value("Salary Component", "TDS",
                            "is_income_tax_component", 1)

    components = frappe.db.sql(
        "select name from `tabSalary Component` where variable_based_on_taxable_salary = 1",
        as_dict=1)
    for component in components:
        frappe.db.set_value("Salary Component", component.name,
                            "is_income_tax_component", 1)

    if erpbee.get_region() == "India":
        if frappe.db.exists("Salary Component", "Provident Fund"):
            frappe.db.set_value("Salary Component", "Provident Fund",
                                "component_type", "Provident Fund")
        if frappe.db.exists("Salary Component", "Professional Tax"):
            frappe.db.set_value("Salary Component", "Professional Tax",
                                "component_type", "Professional Tax")
Esempio n. 5
0
def get_columns(filters):
    columns = [{
        "label": _("Employee"),
        "options": "Employee",
        "fieldname": "employee",
        "fieldtype": "Link",
        "width": 200
    }, {
        "label": _("Employee Name"),
        "options": "Employee",
        "fieldname": "employee_name",
        "fieldtype": "Link",
        "width": 160
    }]

    if erpbee.get_region() == "India":
        columns.append({
            "label": _("PAN Number"),
            "fieldname": "pan_number",
            "fieldtype": "Data",
            "width": 140
        })

    columns += [{
        "label": _("Income Tax Component"),
        "fieldname": "it_comp",
        "fieldtype": "Data",
        "width": 170
    }, {
        "label": _("Income Tax Amount"),
        "fieldname": "it_amount",
        "fieldtype": "Currency",
        "options": "currency",
        "width": 140
    }, {
        "label": _("Gross Pay"),
        "fieldname": "gross_pay",
        "fieldtype": "Currency",
        "options": "currency",
        "width": 140
    }, {
        "label": _("Posting Date"),
        "fieldname": "posting_date",
        "fieldtype": "Date",
        "width": 140
    }]

    return columns
Esempio n. 6
0
def create_transaction_log(doc, method):
    """
	Appends the transaction to a chain of hashed logs for legal resons.
	Called on submit of Sales Invoice and Payment Entry.
	"""
    region = get_region()
    if region not in ["France", "Germany"]:
        return

    data = str(doc.as_dict())

    frappe.get_doc({
        "doctype": "Transaction Log",
        "reference_doctype": doc.doctype,
        "document_name": doc.name,
        "data": data
    }).insert(ignore_permissions=True)
Esempio n. 7
0
def check_deletion_permission(doc, method):
    region = get_region(doc.company)
    if region in ["Nepal", "France"] and doc.docstatus != 0:
        frappe.throw(
            _("Deletion is not permitted for country {0}").format(region))