mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-08 23:52:57 +00:00
Sourced wnframework-modules from Google Code as erpnext
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
report.customize_filters = function() {
|
||||
this.add_filter({fieldname:'from_date', label:'From date', fieldtype:'date', options:'',ignore : 1, parent:'Leave Transaction'});
|
||||
this.add_filter({fieldname:'to_date', label:'To date', fieldtype:'date', options:'',ignore : 1, parent:'Leave Transaction'});
|
||||
this.filter_fields_dict['Leave Transaction'+FILTER_SEP +'From date'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['Leave Transaction'+FILTER_SEP +'To date'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['Leave Transaction'+FILTER_SEP +'From date'].df['report_default'] = sys_defaults.year_start_date;
|
||||
this.filter_fields_dict['Leave Transaction'+FILTER_SEP +'To date'].df['report_default'] = dateutil.obj_to_str(new Date());
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
leave_type_lst = sql("select name from `tabLeave Type` where is_active = 'Yes'")
|
||||
|
||||
li=['Total Opening']
|
||||
if leave_type_lst:
|
||||
for lst in leave_type_lst:
|
||||
|
||||
li.append(lst[0])
|
||||
|
||||
li.append('Total Closing')
|
||||
|
||||
|
||||
|
||||
for d in li:
|
||||
colnames.append(d)
|
||||
colwidths.append("100px")
|
||||
coltypes.append("Currency")
|
||||
coloptions.append("")
|
||||
col_idx[d] = len(colnames)-1
|
||||
for r in res:
|
||||
|
||||
r.append("0")
|
||||
|
||||
|
||||
for r in res:
|
||||
for d1 in li:
|
||||
d2 = '%s'%d1
|
||||
if d2 == 'Total Opening':
|
||||
ret_all = sql("select sum(total_leave) from `tabLeave Transaction` where leave_transaction_type = 'Allocation' and employee = '%s' and %s <= to_date and docstatus = 1 and fiscal_year = '2010-2011'" %(r[col_idx['Employee']],filter_values['from_date']))
|
||||
|
||||
#query = "(SUM(CASE WHEN leave_transaction_type = 'Allocation' THEN total_leave ELSE 0 END)-SUM(CASE WHEN leave_transaction_type = 'Deduction' AND leave_type != 'Leave Without Pay' THEN total_leave ELSE 0 END))"
|
||||
#query1 = "select " + query + " from `tabLeave Transaction` where employee = '%s' and %s <= to_date and docstatus = 1"
|
||||
#sum_total_leave = sql(query1%(r[col_idx['Employee']],filter_values['from_date']))
|
||||
#r[col_idx[d2]] = flt(sum_total_leave[0][0]) or 0
|
||||
|
||||
elif d2 == 'Total Closing':
|
||||
query = "(SUM(CASE WHEN leave_transaction_type = 'Allocation' AND leave_type != 'Leave Without Pay' AND leave_type != 'Compensatory Off' THEN total_leave ELSE 0 END)-SUM(CASE WHEN leave_transaction_type = 'Deduction' AND leave_type != 'Leave Without Pay' THEN total_leave ELSE 0 END))"
|
||||
query1 = "select " + query + " from `tabLeave Transaction` where employee = '%s' and %s <= to_date and docstatus = 1"
|
||||
sum_total_leave = sql(query1%(r[col_idx['Employee']],filter_values['to_date']))
|
||||
r[col_idx[d2]] = flt(sum_total_leave[0][0]) or 0
|
||||
|
||||
elif leave_type_lst:
|
||||
query = "SUM(CASE WHEN leave_transaction_type = 'Deduction' THEN total_leave ELSE 0 END)"
|
||||
query1 = "select " + query + " from `tabLeave Transaction` where leave_type = '%s' and employee = '%s' and (from_date <= %s <= to_date or from_date <= %s <= to_date) and docstatus = 1"
|
||||
sum_total_leave = sql(query1%(d1,r[col_idx['Employee']],filter_values['from_date'],filter_values['to_date']))
|
||||
r[col_idx[d2]] = flt(sum_total_leave[0][0]) or 0
|
||||
@@ -0,0 +1,37 @@
|
||||
[
|
||||
{
|
||||
'add_col': None,
|
||||
'add_cond': None,
|
||||
'add_tab': None,
|
||||
'columns': 'Leave Transaction\x01Employee',
|
||||
'creation': '2010-08-08 17:09:32',
|
||||
'criteria_name': 'Datewise Leave Report',
|
||||
'custom_query': '',
|
||||
'description': None,
|
||||
'dis_filters': None,
|
||||
'disabled': 1,
|
||||
'doc_type': 'Leave Transaction',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Search Criteria',
|
||||
'filters': "{'Leave Transaction\x01Saved':1,'Leave Transaction\x01Submitted':1,'Leave Transaction\x01Fiscal Year':'','Leave Transaction\x01Leave Type':'','Leave Transaction\x01Leave Transaction Type':'','Leave Transaction\x01Allocation Type':'','Leave Transaction\x01Deduction Type':''}",
|
||||
'graph_series': None,
|
||||
'graph_values': None,
|
||||
'group_by': '`tabLeave Transaction`.employee',
|
||||
'idx': None,
|
||||
'modified': '2010-04-01 14:45:55',
|
||||
'modified_by': 'Administrator',
|
||||
'module': 'Payroll',
|
||||
'name': 'datewise_leave_report2',
|
||||
'owner': 'Administrator',
|
||||
'page_len': 50,
|
||||
'parent': None,
|
||||
'parent_doc_type': None,
|
||||
'parentfield': None,
|
||||
'parenttype': None,
|
||||
'report_script': '',
|
||||
'server_script': None,
|
||||
'sort_by': 'ID',
|
||||
'sort_order': 'DESC',
|
||||
'standard': 'Yes'
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user