moved directory structure

This commit is contained in:
Rushabh Mehta
2012-09-24 19:13:42 +05:30
parent e47a6779e9
commit 2fa2f7178d
1637 changed files with 47 additions and 11450 deletions

View File

@@ -0,0 +1 @@
from __future__ import unicode_literals

View File

@@ -0,0 +1,45 @@
// ERPNext - web based ERP (http://erpnext.com)
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
var get_month = function(){
var dict = {0:'Jan', 1:'Feb',2:'Mar',3:'Apr',4:'May',5:'June',6:'July',7:'Aug',8:'Sept',9:'Oct',10:'Nov',11:'Dec'}
var d = new Date();
return dict[d.getMonth()]
}
report.customize_filters = function() {
this.hide_all_filters();
this.add_filter({fieldname:'month', label:'Month', fieldtype:'Select', options:'Jan'+NEWLINE+'Feb'+NEWLINE+'Mar'+NEWLINE+'Apr'+NEWLINE+'May'+NEWLINE+'June'+NEWLINE+'July'+NEWLINE+'Aug'+NEWLINE+'Sept'+NEWLINE+'Oct'+NEWLINE+'Nov'+NEWLINE+'Dec',ignore : 1,parent:'Attendance', single_select:1});
this.filter_fields_dict['Attendance'+FILTER_SEP +'Employee'].df.filter_hide = 0;
this.filter_fields_dict['Attendance'+FILTER_SEP +'Month'].df.filter_hide = 0;
this.filter_fields_dict['Attendance'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;
this.filter_fields_dict['Attendance'+FILTER_SEP +'Company'].df.filter_hide = 0;
this.filter_fields_dict['Attendance'+FILTER_SEP +'Employee'].df.in_first_page = 1;
this.filter_fields_dict['Attendance'+FILTER_SEP +'Month'].df.in_first_page = 1;
this.filter_fields_dict['Attendance'+FILTER_SEP +'Fiscal Year'].df.in_first_page = 1;
this.filter_fields_dict['Attendance'+FILTER_SEP +'Company'].df.in_first_page = 1;
this.filter_fields_dict['Attendance'+FILTER_SEP +'Month'].df['report_default'] = get_month();
this.filter_fields_dict['Attendance'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
this.filter_fields_dict['Attendance'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
this.get_filter('Attendance', 'Fiscal Year').set_as_single();
}
this.mytabs.items['More Filters'].hide();
this.mytabs.items['Select Columns'].hide();

View File

@@ -0,0 +1,93 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#add column employee, employee name
#--------------------------------------------------------------------------------------
from __future__ import unicode_literals
col =[['Employee','Link','155px','Employee'],['Employee Name','Data','150px','']]
for c in col:
colnames.append(c[0])
coltypes.append(c[1])
colwidths.append(c[2])
coloptions.append(c[3])
col_idx[c[0]] = len(colnames)-1
#get feb months last day
#--------------------------------------------------------------------------------------
fy = filter_values.get('fiscal_year')
month = filter_values.get('month')
mdict = {'Jan':'01', 'Feb':'02','Mar':'03','Apr':'04','May':'05','June':'06','July':'07','Aug':'08','Sept':'09','Oct':'10','Nov':'11','Dec':'12'}
import webnotes.utils
from dateutil.relativedelta import relativedelta
ysd = sql("select year_start_date from `tabFiscal Year` where name = '%s' and docstatus !=2"%fy)[0][0]
last_date = webnotes.utils.get_last_day(ysd + relativedelta(months = (cint(ysd.strftime('%m'))>cint(mdict[month]) and (12-cint(ysd.strftime('%m'))+cint(mdict[month])) or (cint(mdict[month]) - cint(ysd.strftime('%m'))))))
feb = last_date.strftime('%d')
#get last day and add columns
#--------------------------------------------------------------------------------------
dict = {'Jan': 31,'Feb':cint(feb), 'Mar':31,'Apr':30,'May':31,'June':30,'July':31,'Aug':31,'Sept':30,'Oct':31,'Nov':30,'Dec':31}
for i in range(0,dict[month]):
colnames.append(i+1)
coltypes.append('Data')
colwidths.append('25px')
col_idx[c[0]] = len(colnames)-1
#add total present, absent days
#--------------------------------------------------------------------------------------
tot_col =[['Total Present Days','Data','120px'],['Total Absent Days','Data','120px']]
for c in tot_col:
colnames.append(c[0])
coltypes.append(c[1])
colwidths.append(c[2])
col_idx[c[0]] = len(colnames)-1
#get data
#--------------------------------------------------------------------------------------
year = last_date.strftime('%Y')
out = []
for r in res:
p_cnt = a_cnt = 0
for i in range(0,dict[month]):
new_date = str(year)+'-'+mdict[month]+'-'+((i>=9) and str(i+1) or ('0'+str(i+1)))
chk = sql("select status from `tabAttendance` where employee='%s' and att_date = '%s' and docstatus=1"%(r[0],new_date))
chk = chk and chk[0][0][0] or '-'
if chk=='P':
p_cnt +=1
elif chk=='A':
a_cnt +=1
r.append(chk)
r.append(p_cnt)
r.append(a_cnt)
if p_cnt or a_cnt:
out.append(r)

View File

@@ -0,0 +1 @@
SELECT DISTINCT `tabAttendance`.employee, `tabAttendance`.employee_name FROM `tabAttendance` WHERE `tabAttendance`.fiscal_year like '%(fiscal_year)s%%' AND `tabAttendance`.`company` like '%(company)s%%' AND `tabAttendance`.`employee` like '%(employee)s%%'

View File

@@ -0,0 +1,33 @@
# Search Criteria, monthly_attendance_details
[
# These values are common in all dictionaries
{
'creation': '2012-04-03 12:49:51',
'docstatus': 0,
'modified': '2012-04-03 12:49:51',
'modified_by': u'Administrator',
'owner': u'harshada@webnotestech.com'
},
# These values are common for all Search Criteria
{
'columns': u'Attendance\x01Employee',
'criteria_name': u'Monthly Attendance Details',
'doc_type': u'Attendance',
'doctype': 'Search Criteria',
'filters': u"{'Attendance\x01Status':'','Attendance\x01Fiscal Year':''}",
'module': u'HR',
'name': '__common__',
'page_len': 50,
'sort_by': u'`tabAttendance`.`employee`',
'sort_order': u'DESC',
'standard': u'Yes'
},
# Search Criteria, monthly_attendance_details
{
'doctype': 'Search Criteria',
'name': u'monthly_attendance_details'
}
]