Skip to content

Instantly share code, notes, and snippets.

@asbasawaraj
Created May 2, 2017 11:54
Show Gist options
  • Save asbasawaraj/7ee194f1c17e76cb6825ac317fc02325 to your computer and use it in GitHub Desktop.
Save asbasawaraj/7ee194f1c17e76cb6825ac317fc02325 to your computer and use it in GitHub Desktop.
# Copyright (c) 2013, Selco and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from erpnext.hr.doctype.process_payroll.process_payroll import get_month_details
from frappe import msgprint
import datetime
from datetime import timedelta
from frappe.utils import cint, flt, nowdate,getdate
from frappe import msgprint
def execute(filters=None):
columns, data = [], []
columns = get_columns()
data = get_lead_details(filters)
return columns, data
def get_lead_details(filters):
return_list = []
count = {}
default_count_list = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0]
ses_details = frappe.db.sql("""SELECT branch,parent_sales_person,name,contact_number,designation FROM `tabSales Person` WHERE show_in_daily_report = 1""",as_list = True )
for se in ses_details:
count[se[2]] = []
count[se[2]] = default_count_list
for se in ses_details:
se_list = se + count[se[2]]
return_list.append(se_list)
return return_list
def get_columns():
return [
_("Branch") + ":Link/Branch:100",
_("Senior Manger") + ":Link/Sales Person:100",
_("Name of SE") + ":Link/Sales Person:100",
_("SE Contact Number") + ":Data:130",
_("Designation") + ":Data:130",
_("1st") + ":Int:40",
_("2nd") + ":Int:40",
_("3rd") + ":Int:40",
_("4th") + ":Int:40",
_("5th") + ":Int:40",
_("6th") + ":Int:40",
_("7th") + ":Int:40",
_("8th") + ":Int:40",
_("9st") + ":Int:40",
_("10th") + ":Int:40",
_("11th") + ":Int:40",
_("12th") + ":Int:40",
_("13th") + ":Int:40",
_("14th") + ":Int:40",
_("15th") + ":Int:40",
_("16th") + ":Int:40",
_("17th") + ":Int:40",
_("18th") + ":Int:40",
_("19th") + ":Int:40",
_("20th") + ":Int:40",
_("21st") + ":Int:40",
_("22nd") + ":Int:40",
_("23rd") + ":Int:40",
_("24th") + ":Int:40",
_("25th") + ":Int:40",
_("26th") + ":Int:40",
_("27th") + ":Int:40",
_("28th") + ":Int:40",
_("29th") + ":Int:40",
_("30th") + ":Int:40",
_("31st") + ":Int:40"
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment