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

4
projects/__init__.py Normal file
View File

@@ -0,0 +1,4 @@
from __future__ import unicode_literals
install_docs = [
{"doctype":"Role", "role_name":"Projects User", "name":"Projects User"},
]

View File

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

View File

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

View File

@@ -0,0 +1,5 @@
You can use projects to:
1. Track budgets (Purchase Orders, Invoices).
2. Track material consumption.
3. Create and assign tasks (and view them on a Gantt Chart).

View File

@@ -0,0 +1,29 @@
// 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/>.
// show tasks
cur_frm.cscript.refresh = function(doc) {
if(!doc.__islocal) {
// refresh gantt chart
wn.require('erpnext/projects/gantt_task.js');
if(!cur_frm.gantt_area)
cur_frm.gantt_area = $('<div>')
.appendTo(cur_frm.fields_dict.project_tasks.wrapper);
cur_frm.gantt_area.empty();
erpnext.show_task_gantt(cur_frm.gantt_area, cur_frm.docname);
}
}

View File

@@ -0,0 +1,112 @@
# 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/>.
# Please edit this list and import only required elements
from __future__ import unicode_literals
import webnotes
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
from webnotes.model import db_exists
from webnotes.model.doc import Document, addchild, getchildren, make_autoname
from webnotes.model.doclist import getlist, copy_doclist
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
from webnotes import session, form, is_testing, msgprint, errprint
set = webnotes.conn.set
sql = webnotes.conn.sql
get_value = webnotes.conn.get_value
in_transaction = webnotes.conn.in_transaction
convert_to_lists = webnotes.conn.convert_to_lists
# -----------------------------------------------------------------------------------------
class DocType:
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
# Get Customer Details along with its primary contact details
# ==============================================================
def get_customer_details(self):
details =sql("select address, territory, customer_group,customer_name from `tabCustomer` where name=%s and docstatus!=2",(self.doc.customer),as_dict=1)
if details:
ret = {
'customer_address' : details and details[0]['address'] or '',
'territory' : details and details[0]['territory'] or '',
'customer_group' : details and details[0]['customer_group'] or '',
'customer_name' : details and details[0]['customer_name'] or ''
}
#get primary contact details(this is done separately coz. , if join query used & no primary contact thn it would not be able to fetch customer details)
contact_det = sql("select contact_name, phone, email_id from `tabContact` where customer_name='%s' and is_customer=1 and is_primary_contact=1 and docstatus!=2" %(self.doc.customer), as_dict = 1)
ret['contact_person'] = contact_det and contact_det[0]['contact_name'] or ''
ret['contact_no'] = contact_det and contact_det[0]['phone'] or ''
ret['email_id'] = contact_det and contact_det[0]['email_id'] or ''
return ret
else:
msgprint("Customer : %s does not exist in system." % (self.doc.customer))
raise Exception
# Get customer's contact person details
# ==============================================================
def get_contact_details(self):
contact = sql("select contact_no, email_id from `tabContact` where contact_name = '%s' and customer_name = '%s' and docstatus != 2" %(self.doc,contact_person,self.doc.customer), as_dict=1)
if contact:
ret = {
'contact_no' : contact and contact[0]['contact_no'] or '',
'email_id' : contact and contact[0]['email_id'] or ''
}
return ret
else:
msgprint("Contact Person : %s does not exist in the system." % (self.doc,contact_person))
raise Exception
#calculate gross profit
#=============================================
def get_gross_profit(self):
pft, per_pft =0, 0
pft = flt(self.doc.project_value) - flt(self.doc.est_material_cost)
#if pft > 0:
per_pft = (flt(pft) / flt(self.doc.project_value)) * 100
ret = {'gross_margin_value': pft, 'per_gross_margin': per_pft}
return ret
# validate
#================================================
def validate(self):
if self.doc.project_start_date and self.doc.completion_date:
if getdate(self.doc.completion_date) < getdate(self.doc.project_start_date):
msgprint("Expected Completion Date can not be less than Project Start Date")
raise Exception
def on_update(self):
# update milestones
webnotes.conn.sql("""delete from tabEvent where ref_type='Project' and ref_name=%s""",
self.doc.name)
for d in self.doclist:
if d.doctype=='Project Milestone' and d.docstatus!=2:
self.add_calendar_event(d.milestone, d.milestone_date)
def add_calendar_event(self, milestone, date):
""" Add calendar event for task in calendar of Allocated person"""
event = Document('Event')
event.description = milestone + ' for ' + self.doc.name
event.event_date = date
event.event_hour = '10:00'
event.event_type = 'Public'
event.ref_type = 'Project'
event.ref_name = self.doc.name
event.save(1)

View File

@@ -0,0 +1,524 @@
# DocType, Project
[
# These values are common in all dictionaries
{
'creation': '2012-08-08 13:25:19',
'docstatus': 0,
'modified': '2012-08-08 13:55:01',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'_last_update': u'1305714062',
'allow_attach': 1,
'allow_trash': 1,
'autoname': u'field:project_name',
'colour': u'White:FFF',
'default_print_format': u'Standard',
'doctype': 'DocType',
'document_type': u'Master',
'max_attachments': 4,
'module': u'Projects',
'name': '__common__',
'search_fields': u'customer, status, priority, is_active',
'section_style': u'Tabbed',
'server_code_error': u' ',
'show_in_menu': 0,
'subject': u' ',
'tag_fields': u'status',
'version': 1
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'Project',
'parentfield': u'fields',
'parenttype': u'DocType'
},
# These values are common for all DocPerm
{
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'name': '__common__',
'parent': u'Project',
'parentfield': u'permissions',
'parenttype': u'DocType',
'permlevel': 0,
'read': 1,
'role': u'Projects User',
'write': 1
},
# DocType, Project
{
'doctype': 'DocType',
'name': u'Project'
},
# DocPerm
{
'doctype': u'DocPerm'
},
# DocField
{
'colour': u'White:FFF',
'description': u'Helps you keep track of your projects and links to Tasks. You can tag a task to a project to track its progress',
'doctype': u'DocField',
'fieldname': u'basic_info',
'fieldtype': u'Section Break',
'label': u'Basic Info',
'oldfieldtype': u'Section Break',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'cb_project_status',
'fieldtype': u'Column Break',
'label': u'Status',
'permlevel': 0
},
# DocField
{
'description': u'Project will get saved and will be searchable with project name given',
'doctype': u'DocField',
'fieldname': u'project_name',
'fieldtype': u'Data',
'label': u'Project Name',
'no_copy': 0,
'oldfieldname': u'project_name',
'oldfieldtype': u'Data',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'colour': u'White:FFF',
'default': u'Open',
'doctype': u'DocField',
'fieldname': u'status',
'fieldtype': u'Select',
'in_filter': 1,
'label': u'Status',
'no_copy': 1,
'oldfieldname': u'status',
'oldfieldtype': u'Select',
'options': u'Open\nCompleted\nCancelled',
'permlevel': 0,
'reqd': 1,
'search_index': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'is_active',
'fieldtype': u'Select',
'label': u'Is Active',
'no_copy': 0,
'oldfieldname': u'is_active',
'oldfieldtype': u'Select',
'options': u'Yes\nNo',
'permlevel': 0,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'priority',
'fieldtype': u'Select',
'label': u'Priority',
'no_copy': 0,
'oldfieldname': u'priority',
'oldfieldtype': u'Select',
'options': u'Medium\nLow\nHigh',
'permlevel': 0,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'cb_project_dates',
'fieldtype': u'Column Break',
'label': u'Dates',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'project_start_date',
'fieldtype': u'Date',
'in_filter': 1,
'label': u'Project Start Date',
'no_copy': 0,
'oldfieldname': u'project_start_date',
'oldfieldtype': u'Date',
'permlevel': 0,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'completion_date',
'fieldtype': u'Date',
'label': u'Completion Date',
'no_copy': 0,
'oldfieldname': u'completion_date',
'oldfieldtype': u'Date',
'permlevel': 0,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'act_completion_date',
'fieldtype': u'Date',
'label': u'Actual Completion Date',
'no_copy': 0,
'oldfieldname': u'act_completion_date',
'oldfieldtype': u'Date',
'permlevel': 0,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'project_type',
'fieldtype': u'Select',
'label': u'Project Type',
'no_copy': 0,
'oldfieldname': u'project_type',
'oldfieldtype': u'Data',
'options': u'Internal\nExternal\nOther',
'permlevel': 0,
'search_index': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'Important dates and commitments in your project life cycle',
'doctype': u'DocField',
'fieldname': u'sb_milestones',
'fieldtype': u'Section Break',
'label': u'Milestones',
'oldfieldtype': u'Section Break',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'Milestones will be added as Events in the Calendar',
'doctype': u'DocField',
'fieldname': u'project_milestones',
'fieldtype': u'Table',
'label': u'Project Milestones',
'no_copy': 0,
'oldfieldname': u'project_milestones',
'oldfieldtype': u'Table',
'options': u'Project Milestone',
'permlevel': 0,
'search_index': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'Tasks belonging to this Project.',
'doctype': u'DocField',
'fieldname': u'sb_tasks',
'fieldtype': u'Section Break',
'label': u'Tasks',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'project_tasks',
'fieldtype': u'HTML',
'label': u'Project Tasks',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'section_break0',
'fieldtype': u'Section Break',
'label': u'Project Details',
'oldfieldtype': u'Section Break',
'options': u'Simple',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'notes',
'fieldtype': u'Text Editor',
'label': u'Notes',
'no_copy': 0,
'oldfieldname': u'notes',
'oldfieldtype': u'Text Editor',
'permlevel': 0,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'project_details',
'fieldtype': u'Section Break',
'label': u'Project Costing',
'oldfieldtype': u'Section Break',
'options': u'Simple',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'project_value',
'fieldtype': u'Currency',
'label': u'Project Value',
'no_copy': 0,
'oldfieldname': u'project_value',
'oldfieldtype': u'Currency',
'permlevel': 0,
'reqd': 0,
'search_index': 0,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'est_material_cost',
'fieldtype': u'Currency',
'label': u'Estimated Material Cost',
'no_copy': 0,
'oldfieldname': u'est_material_cost',
'oldfieldtype': u'Currency',
'permlevel': 0,
'search_index': 0,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'column_break0',
'fieldtype': u'Column Break',
'label': u'Margin',
'oldfieldtype': u'Column Break',
'permlevel': 0,
'width': u'50%'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'gross_margin_value',
'fieldtype': u'Currency',
'label': u'Gross Margin Value',
'no_copy': 0,
'oldfieldname': u'gross_margin_value',
'oldfieldtype': u'Currency',
'permlevel': 0,
'reqd': 0,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'per_gross_margin',
'fieldtype': u'Currency',
'label': u'Gross Margin %',
'no_copy': 0,
'oldfieldname': u'per_gross_margin',
'oldfieldtype': u'Currency',
'permlevel': 0,
'reqd': 0,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'customer_details',
'fieldtype': u'Section Break',
'label': u'Customer Details',
'oldfieldtype': u'Section Break',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'Select name of Customer to whom project belongs',
'doctype': u'DocField',
'fieldname': u'customer',
'fieldtype': u'Link',
'in_filter': 1,
'label': u'Customer',
'no_copy': 0,
'oldfieldname': u'customer',
'oldfieldtype': u'Link',
'options': u'Customer',
'permlevel': 0,
'print_hide': 1,
'reqd': 0,
'search_index': 1,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'customer_name',
'fieldtype': u'Data',
'in_filter': 1,
'label': u'Customer Name',
'no_copy': 0,
'oldfieldname': u'customer_name',
'oldfieldtype': u'Data',
'permlevel': 1,
'search_index': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'customer_address',
'fieldtype': u'Small Text',
'label': u'Customer Address',
'no_copy': 0,
'oldfieldname': u'customer_address',
'oldfieldtype': u'Small Text',
'permlevel': 1,
'search_index': 0
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'contact_person',
'fieldtype': u'Link',
'in_filter': 1,
'label': u'Contact Person',
'no_copy': 0,
'oldfieldname': u'contact_person',
'oldfieldtype': u'Link',
'permlevel': 0,
'reqd': 0,
'search_index': 0,
'trigger': u'Client'
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'territory',
'fieldtype': u'Link',
'in_filter': 1,
'label': u'Territory',
'oldfieldname': u'territory',
'oldfieldtype': u'Link',
'options': u'Territory',
'permlevel': 0,
'reqd': 0,
'search_index': 0,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'contact_no',
'fieldtype': u'Data',
'label': u'Contact No',
'no_copy': 0,
'oldfieldname': u'contact_no',
'oldfieldtype': u'Data',
'permlevel': 1,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'email_id',
'fieldtype': u'Data',
'label': u'Email Id',
'no_copy': 0,
'oldfieldname': u'email_id',
'oldfieldtype': u'Data',
'permlevel': 1,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'customer_group',
'fieldtype': u'Link',
'label': u'Customer Group',
'no_copy': 0,
'oldfieldname': u'customer_group',
'oldfieldtype': u'Link',
'options': u'Customer Group',
'permlevel': 1,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'trash_reason',
'fieldtype': u'Small Text',
'hidden': 1,
'label': u'Trash Reason',
'no_copy': 0,
'oldfieldname': u'trash_reason',
'oldfieldtype': u'Small Text',
'permlevel': 0,
'print_hide': 1,
'search_index': 0
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'file_list',
'fieldtype': u'Small Text',
'hidden': 1,
'label': u'File List',
'no_copy': 1,
'permlevel': 0,
'print_hide': 1,
'search_index': 0
}
]

View File

@@ -0,0 +1,53 @@
// render
wn.doclistviews['Project'] = wn.views.ListView.extend({
init: function(d) {
this._super(d);
this.fields = this.fields.concat([
'`tabProject`.project_name',
'`tabProject`.status',
'`tabProject`.is_active',
'`tabProject`.priority',
'IFNULL(`tabProject`.project_value, 0) as project_value',
'IFNULL(`tabProject`.per_gross_margin, 0) as per_gross_margin',
'`tabProject`.creation',
]);
//this.stats = this.stats.concat(['company']);
},
prepare_data: function(data) {
this._super(data);
data.completion_date = wn.datetime.str_to_user(data.completion_date);
},
columns: [
{width: '3%', content: 'check'},
{width: '3%', content: 'docstatus'},
{width: '15%', content: 'name'},
{width: '22%', content: 'project_name+tags'},
{
width: '20%',
content: function(parent, data) {
$(parent).html(data.status + " [" + data.priority + "] "
+ (data.is_active=='No'?" [Inactive]":""));
},
},
{
width: '15%',
content: function(parent, data) {
$(parent).html(sys_defaults.currency + " "
+ fmt_money(data.project_value));
},
css: {'text-align': 'right'},
},
{
width: '10%',
content: function(parent, data) {
$(parent).html(fmt_money(data.per_gross_margin) + " %");
},
css: {'text-align': 'right'},
},
{
width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}
},
]
});

View File

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

View File

@@ -0,0 +1,161 @@
# 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/>.
# Please edit this list and import only required elements
from __future__ import unicode_literals
import webnotes
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, set_default, str_esc_quote, user_format, validate_email_add, add_days
from webnotes.model import db_exists
from webnotes.model.doc import Document, addchild, getchildren, make_autoname
from webnotes.model.doclist import getlist, copy_doclist
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
from webnotes import session, form, is_testing, msgprint, errprint
from webnotes.utils.email_lib import sendmail
set = webnotes.conn.set
sql = webnotes.conn.sql
get_value = webnotes.conn.get_value
in_transaction = webnotes.conn.in_transaction
convert_to_lists = webnotes.conn.convert_to_lists
# -----------------------------------------------------------------------------------------
class DocType:
def __init__(self,d,dl):
self.doc, self.doclist = d,dl
def get_projects(self, arg):
# project list
pl=[]
status={}
if arg == 'Open':
pl = [p[0] for p in sql("select name from `tabProject` where status = 'Open' order by creation desc limit 20")]
for p1 in pl:
status[p1] = 'Open'
elif arg == 'Completed':
pl = [p[0] for p in sql("select name from `tabProject` where status = 'Completed' order by creation desc limit 20")]
for p2 in pl:
status[p2] = 'Completed'
elif arg == 'Cancelled':
pl = [p[0] for p in sql("select name from `tabProject` where status = 'Cancelled' order by creation desc limit 20")]
for p3 in pl:
status[p3] = 'Cancelled'
else:
#pl = [p[0] for p in sql("select name from `tabProject` order by creation desc limit 20")]
pl1 = sql("select name, status from `tabProject` order by creation desc limit 20", as_dict=1)
for p4 in pl1:
status[p4['name']] = p4['status']
pl.append(p4['name'])
# milestones in the next 7 days for active projects
ml = convert_to_lists(sql("select t1.milestone_date, t1.milestone, t1.parent from `tabProject Milestone` t1, tabProject t2 where t1.parent = t2.name and t2.status='Open' and DATEDIFF(t1.milestone_date, CURDATE()) BETWEEN 0 AND 7 ORDER BY t1.milestone_date ASC"))
# percent of activity completed per project
comp = {}
n_tasks = {}
for p in pl:
t1 = sql('select count(*) from tabTask where project=%s and docstatus!=2', p)[0][0]
n_tasks[p] = t1 or 0
if t1:
t2 = sql('select count(*) from tabTask where project=%s and docstatus!=2 and status="Closed"', p)[0][0]
comp[p] = cint(flt(t2)*100/t1)
return {'pl':pl, 'ml':ml, 'comp':comp, 'n_tasks':n_tasks, 'status':status}
def get_resources(self):
ret = {}
# resource list
rl = sql("select distinct allocated_to, assignee_email from tabTask")
# get open & closed tickets
for r in rl:
if r[0]:
ret[r[1]] = {}
ret[r[1]]['id'] = r[0]
ret[r[1]]['Total'] = sql("select count(*) from tabTask where allocated_to=%s and docstatus!=2", r[0])[0][0]
ret[r[1]]['Closed'] = sql("select count(*) from tabTask where allocated_to=%s and status='Closed' and docstatus!=2", r[0])[0][0]
ret[r[1]]['percent'] = cint(flt(ret[r[1]]['Closed']) * 100 / ret[r[1]]['Total'])
return ret
# --------------------------------------------------------------
# for Gantt Chart
def get_init_data(self, arg=''):
pl = [p[0] for p in sql('select name from tabProject where docstatus != 2')]
rl = [p[0] for p in sql('select distinct allocated_to from tabTask where docstatus != 2 and ifnull(allocated_to,"") != ""')]
return {'pl':pl, 'rl':rl}
def get_tasks(self, arg):
start_date, end_date, project, resource = arg.split('~~~')
cl = ''
if project and project != 'All':
cl = " and ifnull(project,'') = '%s'" % project
if resource and resource != 'All':
cl = " and ifnull(allocated_to,'') = '%s'" % resource
tl = sql("""
select subject, allocated_to, project, exp_start_date, exp_end_date, priority, status, name
from tabTask
where
((exp_start_date between '%(st)s' and '%(end)s') or
(exp_end_date between '%(st)s' and '%(end)s') or
(exp_start_date < '%(st)s' and exp_end_date > '%(end)s')) %(cond)s order by exp_start_date limit 100""" % {'st': start_date, 'end': end_date, 'cond':cl})
return convert_to_lists(tl)
def declare_proj_completed(self, arg):
chk = sql("select name from `tabTask` where project=%s and status='Open'", arg)
if chk:
chk_lst = [x[0] for x in chk]
msgprint("Task(s) "+','.join(chk_lst)+" has staus 'Open'. Please submit all tasks against this project before closing the project.")
return cstr('false')
else:
sql("update `tabProject` set status = 'Completed' where name = %s", arg)
return cstr('true')
def sent_reminder_task():
task_list = sql("""
select subject, allocated_to, project, exp_start_date, exp_end_date,
priority, status, name, senders_name, opening_date, review_date, description
from tabTask
where task_email_notify=1
and sent_reminder=0
and status='Open'
and exp_start_date is not null""",as_dict=1)
for i in task_list:
if date_diff(i['exp_start_date'],nowdate()) ==2:
msg2="""<h2>Two days to complete: %(name)s</h2>
<p>This is a reminder for the task %(name)s has been assigned to you
by %(senders_name)s on %(opening_date)s</p>
<p><b>Subject:</b> %(subject)s </p>
<p><b>Project:</b> %(project)s</p>
<p><b>Expected Start Date:</b> %(exp_start_date)s</p>
<p><b>Expected End Date:</b> %(exp_end_date)s</p>
<p><b>Review Date:</b> %(review_date)s</p>
<p><b>Details:</b> %(description)s</p>
<p>If you have already completed this task, please update the system</p>
<p>Good Luck!</p>
<p>(This notification is autogenerated)</p>""" % i
sendmail(i['allocated_to'], msg=msg2, subject='A task has been assigned')
sql("update `tabTask` set sent_reminder='1' where name='%(name)s' and allocated_to= '%(allocated_to)s'" % i)

View File

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

View File

@@ -0,0 +1,74 @@
# DocType, Project Milestone
[
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:36:06',
'docstatus': 0,
'modified': '2012-03-27 14:36:06',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'colour': u'White:FFF',
'default_print_format': u'Standard',
'doctype': 'DocType',
'istable': 1,
'module': u'Projects',
'name': '__common__',
'section_style': u'Simple',
'server_code_error': u' ',
'version': 4
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'Project Milestone',
'parentfield': u'fields',
'parenttype': u'DocType',
'permlevel': 0
},
# DocType, Project Milestone
{
'doctype': 'DocType',
'name': u'Project Milestone'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'milestone_date',
'fieldtype': u'Date',
'label': u'Milestone Date',
'oldfieldname': u'milestone_date',
'oldfieldtype': u'Date'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'milestone',
'fieldtype': u'Text',
'label': u'Milestone',
'oldfieldname': u'milestone',
'oldfieldtype': u'Text',
'width': u'300px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'status',
'fieldtype': u'Select',
'label': u'Status',
'no_copy': 1,
'oldfieldname': u'status',
'oldfieldtype': u'Select',
'options': u'Pending\nCompleted'
}
]

View File

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

View File

@@ -0,0 +1,39 @@
// 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/>.
cur_frm.fields_dict['project'].get_query = function(doc,cdt,cdn){
var cond='';
if(doc.customer) cond = 'ifnull(`tabProject`.customer, "") = "'+doc.customer+'" AND';
return repl('SELECT distinct `tabProject`.`name` FROM `tabProject` WHERE %(cond)s `tabProject`.`name` LIKE "%s" ORDER BY `tabProject`.`name` ASC LIMIT 50', {cond:cond});
}
cur_frm.cscript.project = function(doc, cdt, cdn){
if(doc.project) get_server_fields('get_project_details', '','', doc, cdt, cdn, 1);
}
cur_frm.fields_dict['customer'].get_query = function(doc,cdt,cdn){
var cond='';
if(doc.project) cond = 'ifnull(`tabProject`.customer, "") = `tabCustomer`.name AND ifnull(`tabProject`.name, "") = "'+doc.project+'" AND';
return repl('SELECT distinct `tabCustomer`.`name` FROM `tabCustomer`, `tabProject` WHERE %(cond)s `tabCustomer`.`name` LIKE "%s" ORDER BY `tabCustomer`.`name` ASC LIMIT 50', {cond:cond});
}
cur_frm.cscript.customer = function(doc, cdt, cdn){
if(doc.customer) get_server_fields('get_customer_details', '','', doc, cdt, cdn, 1);
else doc.customer_name ='';
}

View File

@@ -0,0 +1,59 @@
# 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/>.
# Please edit this list and import only required elements
from __future__ import unicode_literals
import webnotes
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, set_default, str_esc_quote, user_format, validate_email_add
from webnotes.utils.email_lib import sendmail
from webnotes.model import db_exists
from webnotes.model.doc import Document, addchild, getchildren, make_autoname
from webnotes.model.doclist import getlist, copy_doclist
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
from webnotes import session, form, is_testing, msgprint, errprint
sql = webnotes.conn.sql
# -----------------------------------------------------------------------------------------
class DocType:
def __init__(self,doc,doclist=[]):
self.doc = doc
self.doclist = doclist
def get_project_details(self):
cust = sql("select customer, customer_name from `tabProject` where name = %s", self.doc.project)
if cust:
ret = {'customer': cust and cust[0][0] or '', 'customer_name': cust and cust[0][1] or ''}
return ret
def get_customer_details(self):
cust = sql("select customer_name from `tabCustomer` where name=%s", self.doc.customer)
if cust:
ret = {'customer_name': cust and cust[0][0] or ''}
return ret
def validate(self):
if self.doc.exp_start_date and self.doc.exp_end_date and getdate(self.doc.exp_start_date) > getdate(self.doc.exp_end_date):
msgprint("'Expected Start Date' can not be greater than 'Expected End Date'")
raise Exception
if self.doc.act_start_date and self.doc.act_end_date and getdate(self.doc.act_start_date) > getdate(self.doc.act_end_date):
msgprint("'Actual Start Date' can not be greater than 'Actual End Date'")
raise Exception

View File

@@ -0,0 +1,315 @@
# DocType, Task
[
# These values are common in all dictionaries
{
u'creation': '2012-08-08 15:39:55',
u'docstatus': 0,
u'modified': '2012-09-17 10:58:32',
u'modified_by': u'Administrator',
u'owner': u'Administrator'
},
# These values are common for all DocType
{
'_last_update': u'1324880734',
'allow_trash': 1,
'autoname': u'TASK.#####',
'colour': u'White:FFF',
'default_print_format': u'Standard',
u'doctype': u'DocType',
'document_type': u'Master',
'module': u'Projects',
u'name': u'__common__',
'section_style': u'Tray',
'server_code_error': u' ',
'show_in_menu': 0,
'subject': u'%(subject)s',
'tag_fields': u'status',
'version': 1
},
# These values are common for all DocField
{
u'doctype': u'DocField',
u'name': u'__common__',
'parent': u'Task',
'parentfield': u'fields',
'parenttype': u'DocType',
'permlevel': 0
},
# These values are common for all DocPerm
{
u'doctype': u'DocPerm',
u'name': u'__common__',
'parent': u'Task',
'parentfield': u'permissions',
'parenttype': u'DocType',
'read': 1,
'role': u'Projects User'
},
# DocType, Task
{
u'doctype': u'DocType',
u'name': u'Task'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'task_details',
'fieldtype': u'Section Break',
'label': u'Task Details',
'oldfieldtype': u'Section Break',
'search_index': 0,
'width': u'50%'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'subject',
'fieldtype': u'Data',
'in_filter': 1,
'label': u'Subject',
'oldfieldname': u'subject',
'oldfieldtype': u'Data',
'reqd': 1
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'exp_start_date',
'fieldtype': u'Date',
'label': u'Expected Start Date',
'oldfieldname': u'exp_start_date',
'oldfieldtype': u'Date',
'reqd': 0
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'exp_end_date',
'fieldtype': u'Date',
'in_filter': 1,
'label': u'Expected End Date',
'oldfieldname': u'exp_end_date',
'oldfieldtype': u'Date',
'reqd': 0,
'search_index': 1
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'column_break0',
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
'width': u'50%'
},
# DocField
{
'colour': u'White:FFF',
u'doctype': u'DocField',
'fieldname': u'project',
'fieldtype': u'Link',
'label': u'Project',
'oldfieldname': u'project',
'oldfieldtype': u'Link',
'options': u'Project',
'trigger': u'Client'
},
# DocField
{
'colour': u'White:FFF',
u'doctype': u'DocField',
'fieldname': u'status',
'fieldtype': u'Select',
'label': u'Status',
'no_copy': 1,
'oldfieldname': u'status',
'oldfieldtype': u'Select',
'options': u'Open\nWorking\nPending Review\nClosed\nCancelled',
'trigger': u'Client'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'priority',
'fieldtype': u'Select',
'in_filter': 1,
'label': u'Priority',
'oldfieldname': u'priority',
'oldfieldtype': u'Select',
'options': u'Low\nMedium\nHigh\nUrgent',
'reqd': 0,
'search_index': 1
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'section_break0',
'fieldtype': u'Section Break',
'oldfieldtype': u'Section Break',
'options': u'Simple'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'description',
'fieldtype': u'Text Editor',
'label': u'Details',
'oldfieldname': u'description',
'oldfieldtype': u'Text Editor',
'reqd': 0,
'width': u'300px'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'time_and_budget',
'fieldtype': u'Section Break',
'label': u'Time and Budget',
'oldfieldtype': u'Section Break'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'expected',
'fieldtype': u'Column Break',
'label': u'Expected',
'oldfieldtype': u'Column Break',
'width': u'50%'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'exp_total_hrs',
'fieldtype': u'Data',
'label': u'Total Hours (Expected)',
'oldfieldname': u'exp_total_hrs',
'oldfieldtype': u'Data',
'reqd': 0
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'allocated_budget',
'fieldtype': u'Currency',
'label': u'Allocated Budget',
'oldfieldname': u'allocated_budget',
'oldfieldtype': u'Currency'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'actual',
'fieldtype': u'Column Break',
'label': u'Actual',
'oldfieldtype': u'Column Break',
'width': u'50%'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'act_start_date',
'fieldtype': u'Date',
'label': u'Actual Start Date',
'oldfieldname': u'act_start_date',
'oldfieldtype': u'Date'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'act_end_date',
'fieldtype': u'Date',
'label': u'Actual End Date',
'oldfieldname': u'act_end_date',
'oldfieldtype': u'Date'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'act_total_hrs',
'fieldtype': u'Data',
'label': u'Total Hours (Actual)',
'oldfieldname': u'act_total_hrs',
'oldfieldtype': u'Data'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'actual_budget',
'fieldtype': u'Currency',
'label': u'Actual Budget',
'oldfieldname': u'actual_budget',
'oldfieldtype': u'Currency'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'more_details',
'fieldtype': u'Section Break',
'label': u'More Details'
},
# DocField
{
'colour': u'White:FFF',
'depends_on': u'eval:doc.status == "Closed" || doc.status == "Pending Review"',
u'doctype': u'DocField',
'fieldname': u'review_date',
'fieldtype': u'Date',
'hidden': 1,
'label': u'Review Date',
'oldfieldname': u'review_date',
'oldfieldtype': u'Date'
},
# DocField
{
'colour': u'White:FFF',
'depends_on': u'eval:doc.status == "Closed"',
u'doctype': u'DocField',
'fieldname': u'closing_date',
'fieldtype': u'Date',
'hidden': 1,
'label': u'Closing Date',
'oldfieldname': u'closing_date',
'oldfieldtype': u'Date'
},
# DocPerm
{
'cancel': 1,
'create': 1,
u'doctype': u'DocPerm',
'permlevel': 0,
'write': 1
},
# DocPerm
{
u'doctype': u'DocPerm',
'permlevel': 1
}
]

View File

@@ -0,0 +1,38 @@
// render
wn.doclistviews['Task'] = wn.views.ListView.extend({
init: function(d) {
this._super(d);
this.fields = this.fields.concat([
'`tabTask`.subject',
'`tabTask`.status',
'`tabTask`.opening_date',
'`tabTask`.priority',
'`tabTask`.allocated_to',
]);
},
prepare_data: function(data) {
this._super(data);
data.opening_date = wn.datetime.str_to_user(data.opening_date);
},
columns: [
{width: '3%', content: 'check'},
{width: '5%', content: 'avatar'},
{width: '3%', content: 'docstatus'},
{width: '12%', content: 'name'},
{width: '30%', content: 'subject+tags'},
{
width: '15%',
content: function(parent, data) {
$(parent).html(data.status +
(data.priority ? " [" + data.priority + "]" : "")
);
},
},
{width: '20%', content: 'allocated_to'},
{width: '12%', content:'opening_date', css: {
'text-align': 'right', 'color':'#777'
}},
]
});

View File

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

View File

@@ -0,0 +1,47 @@
// 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/>.
// ======================= OnLoad =============================================
cur_frm.cscript.onload = function(doc,cdt,cdn){
if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
if(!doc.timesheet_date) set_multiple(cdt,cdn,{timesheet_date:get_today()});
}
cur_frm.cscript.refresh = function(doc,cdt,cdn){}
cur_frm.fields_dict['timesheet_details'].grid.get_field("project_name").get_query = function(doc,cdt,cdn){
var cond=cond1='';
var d = locals[cdt][cdn];
//if(d.customer_name) cond = 'ifnull(`tabProject`.customer_name, "") = "'+d.customer_name+'" AND';
if(d.task_id) cond1 = 'ifnull(`tabTask`.project, "") = `tabProject`.name AND `tabTask`.name = "'+d.task_id+'" AND';
return repl('SELECT distinct `tabProject`.`name` FROM `tabProject`, `tabTask` WHERE %(cond1)s `tabProject`.`name` LIKE "%s" ORDER BY `tabProject`.`name` ASC LIMIT 50', {cond1:cond1});
}
cur_frm.cscript.task_name = function(doc, cdt, cdn){
var d = locals[cdt][cdn];
if(d.task_name) get_server_fields('get_task_details', d.task_name, 'timesheet_details', doc, cdt, cdn, 1);
}
cur_frm.fields_dict['timesheet_details'].grid.get_field("task_name").get_query = function(doc,cdt,cdn){
var cond='';
var d = locals[cdt][cdn];
if(d.project_name) cond = 'ifnull(`tabTask`.project, "") = "'+d.project_name+'" AND';
return repl('SELECT distinct `tabTask`.`subject` FROM `tabTask` WHERE %(cond)s `tabTask`.`subject` LIKE "%s" ORDER BY `tabTask`.`subject` ASC LIMIT 50', {cond:cond});
}

View File

@@ -0,0 +1,98 @@
# 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/>.
# Please edit this list and import only required elements
from __future__ import unicode_literals
import webnotes
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
from webnotes.model import db_exists
from webnotes.model.doc import Document, addchild, getchildren, make_autoname
from webnotes.model.doclist import getlist, copy_doclist
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
from webnotes import session, form, is_testing, msgprint, errprint
set = webnotes.conn.set
sql = webnotes.conn.sql
get_value = webnotes.conn.get_value
in_transaction = webnotes.conn.in_transaction
convert_to_lists = webnotes.conn.convert_to_lists
# -----------------------------------------------------------------------------------------
class DocType:
def __init__(self,doc,doclist=[]):
self.doc = doc
self.doclist = doclist
def get_customer_details(self, project_name):
cust = sql("select customer, customer_name from `tabProject` where name = %s", project_name)
if cust:
ret = {'customer': cust and cust[0][0] or '', 'customer_name': cust and cust[0][1] or ''}
return (ret)
def get_task_details(self, task_sub):
tsk = sql("select name, project, customer, customer_name from `tabTask` where subject = %s", task_sub)
if tsk:
ret = {'task_id': tsk and tsk[0][0] or '', 'project_name': tsk and tsk[0][1] or '', 'customer_name': tsk and tsk[0][3] or ''}
return ret
def validate(self):
if getdate(self.doc.timesheet_date) > getdate(nowdate()):
msgprint("You can not prepare timesheet for future date")
raise Exception
chk = sql("select name from `tabTimesheet` where timesheet_date=%s and owner=%s and status!='Cancelled' and name!=%s", (self.doc.timesheet_date, self.doc.owner, self.doc.name))
if chk:
msgprint("You have already created timesheet "+ cstr(chk and chk[0][0] or '')+" for this date.")
raise Exception
import time
for d in getlist(self.doclist, 'timesheet_details'):
if d.act_start_time and d.act_end_time:
d1 = time.strptime(d.act_start_time, "%H:%M")
d2 = time.strptime(d.act_end_time, "%H:%M")
if d1 > d2:
msgprint("Start time can not be greater than end time. Check for Task Id : "+cstr(d.task_id))
raise Exception
elif d1 == d2:
msgprint("Start time and end time can not be same. Check for Task Id : "+cstr(d.task_id))
raise Exception
def calculate_total_hr(self):
import datetime
import time
for d in getlist(self.doclist, 'timesheet_details'):
x1 = d.act_start_time.split(":")
x2 = d.act_end_time.split(":")
d1 = datetime.timedelta(minutes=cint(x1[1]), hours=cint(x1[0]))
d2 = datetime.timedelta(minutes=cint(x2[1]), hours=cint(x2[0]))
d3 = (d2 - d1).seconds
d.act_total_hrs = time.strftime("%H:%M", time.gmtime(d3))
sql("update `tabTimesheet Detail` set act_total_hrs = %s where parent=%s and name=%s", (d.act_total_hrs,self.doc.name,d.name))
def on_update(self):
self.calculate_total_hr()
set(self.doc, 'status', 'Draft')
def on_submit(self):
set(self.doc, 'status', 'Submitted')
def on_cancel(self):
set(self.doc, 'status', 'Cancelled')

View File

@@ -0,0 +1,212 @@
# DocType, Timesheet
[
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:36:07',
'docstatus': 0,
'modified': '2012-03-27 18:47:10',
'modified_by': u'Administrator',
'owner': u'ashwini@webnotestech.com'
},
# These values are common for all DocType
{
'autoname': u'TimeSheet.#####',
'colour': u'White:FFF',
'doctype': 'DocType',
'is_submittable': 1,
'module': u'Projects',
'name': '__common__',
'search_fields': u'status, owner, timesheet_date',
'section_style': u'Simple',
'server_code_error': u' ',
'show_in_menu': 0,
'subject': u'%(owner)s',
'version': 69
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'Timesheet',
'parentfield': u'fields',
'parenttype': u'DocType'
},
# These values are common for all DocPerm
{
'doctype': u'DocPerm',
'name': '__common__',
'parent': u'Timesheet',
'parentfield': u'permissions',
'parenttype': u'DocType',
'read': 1
},
# DocType, Timesheet
{
'doctype': 'DocType',
'name': u'Timesheet'
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Projects User',
'submit': 1,
'write': 1
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Projects User'
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'System Manager',
'submit': 1,
'write': 1
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'System Manager'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'timesheet_details_section_break',
'fieldtype': u'Section Break',
'label': u'Timesheet Details',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'default': u'Draft',
'doctype': u'DocField',
'fieldname': u'status',
'fieldtype': u'Select',
'in_filter': 0,
'label': u'Status',
'oldfieldname': u'status',
'oldfieldtype': u'Select',
'options': u'\nDraft\nSubmitted\nCancelled',
'permlevel': 1,
'reqd': 1,
'search_index': 1
},
# DocField
{
'colour': u'White:FFF',
'default': u'Today',
'doctype': u'DocField',
'fieldname': u'timesheet_date',
'fieldtype': u'Date',
'in_filter': 1,
'label': u'Timesheet Date',
'oldfieldname': u'timesheet_date',
'oldfieldtype': u'Date',
'permlevel': 0,
'reqd': 1,
'search_index': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'owner',
'fieldtype': u'Link',
'in_filter': 1,
'label': u'Timesheet By',
'oldfieldname': u'owner',
'oldfieldtype': u'Link',
'options': u'Profile',
'permlevel': 0,
'reqd': 1,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'amended_from',
'fieldtype': u'Data',
'hidden': 1,
'label': u'Amended From',
'oldfieldname': u'amended_from',
'oldfieldtype': u'Data',
'permlevel': 1,
'print_hide': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'amendment_date',
'fieldtype': u'Date',
'hidden': 1,
'label': u'Amendment Date',
'oldfieldname': u'amendment_date',
'oldfieldtype': u'Date',
'permlevel': 1,
'print_hide': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'column_break0',
'fieldtype': u'Column Break',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'notes',
'fieldtype': u'Text',
'label': u'Notes',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'section_break0',
'fieldtype': u'Section Break',
'options': u'Simple',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'timesheet_details',
'fieldtype': u'Table',
'label': u'Timesheet Details',
'oldfieldname': u'timesheet_details',
'oldfieldtype': u'Table',
'options': u'Timesheet Detail',
'permlevel': 0
}
]

View File

@@ -0,0 +1,35 @@
// render
wn.doclistviews['Timesheet'] = wn.views.ListView.extend({
init: function(d) {
this._super(d);
this.fields = this.fields.concat([
'`tabTimesheet`.status',
'`tabTimesheet`.timesheet_date',
'`tabTimesheet`.owner',
'`tabTimesheet`.notes',
]);
},
prepare_data: function(data) {
this._super(data);
data.timesheet_date = wn.datetime.str_to_user(data.timesheet_date);
if(data.notes && data.notes.length > 50) {
data.notes = '<span title="'+data.notes+'">' +
data.notes.substr(0,50) + '...</span>';
}
},
columns: [
{width: '3%', content: 'check'},
{width: '5%', content: 'avatar'},
{width: '3%', content: 'docstatus'},
{width: '18%', content: 'name'},
{width: '12%', content: 'status'},
{width: '27%', content: 'notes+tags', css: {'color': '#777'}},
{width: '20%', content: 'owner'},
{width: '12%', content:'timesheet_date', css: {
'text-align': 'right', 'color':'#777'
}},
]
});

View File

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

View File

@@ -0,0 +1,160 @@
# DocType, Timesheet Detail
[
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:36:07',
'docstatus': 0,
'modified': '2012-03-27 14:36:07',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'autoname': u'TSD.#####',
'colour': u'White:FFF',
'doctype': 'DocType',
'module': u'Projects',
'name': '__common__',
'section_style': u'Simple',
'server_code_error': u' ',
'version': 15
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'Timesheet Detail',
'parentfield': u'fields',
'parenttype': u'DocType'
},
# DocType, Timesheet Detail
{
'doctype': 'DocType',
'name': u'Timesheet Detail'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'act_start_time',
'fieldtype': u'Time',
'label': u'Actual Start Time',
'oldfieldname': u'act_start_time',
'oldfieldtype': u'Time',
'permlevel': 0,
'reqd': 1,
'width': u'160px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'act_end_time',
'fieldtype': u'Time',
'label': u'Actual End Time',
'oldfieldname': u'act_end_time',
'oldfieldtype': u'Time',
'permlevel': 0,
'reqd': 1,
'width': u'160px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'activity_type',
'fieldtype': u'Link',
'label': u'Activity Type',
'options': u'Activity Type',
'permlevel': 0,
'reqd': 1,
'search_index': 0,
'width': u'200px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'other_details',
'fieldtype': u'Text',
'label': u'Additional Info',
'oldfieldname': u'other_details',
'oldfieldtype': u'Text',
'permlevel': 0,
'width': u'200px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'act_total_hrs',
'fieldtype': u'Data',
'label': u'Total Hours (Actual)',
'oldfieldname': u'act_total_hrs',
'oldfieldtype': u'Data',
'permlevel': 1,
'width': u'100px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'customer_name',
'fieldtype': u'Link',
'label': u'Customer Name',
'oldfieldname': u'customer_name',
'oldfieldtype': u'Data',
'options': u'Customer',
'permlevel': 0,
'width': u'150px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'project_name',
'fieldtype': u'Link',
'in_filter': 1,
'label': u'Project',
'oldfieldname': u'project_name',
'oldfieldtype': u'Link',
'options': u'Project',
'permlevel': 0,
'reqd': 0,
'search_index': 1,
'width': u'150px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'task_id',
'fieldtype': u'Link',
'in_filter': 1,
'label': u'Task Id',
'oldfieldname': u'task_id',
'oldfieldtype': u'Link',
'options': u'Task',
'permlevel': 0,
'search_index': 1,
'width': u'150px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'task_name',
'fieldtype': u'Link',
'label': u'Task Name',
'oldfieldname': u'task_name',
'oldfieldtype': u'Link',
'permlevel': 0,
'reqd': 0,
'search_index': 0,
'width': u'250px'
}
]

View File

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

View File

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

View File

@@ -0,0 +1,6 @@
.gantt {
-moz-box-sizing: border-box;
border: 14px solid #DDDDDD;
border-radius: 6px 6px 6px 6px;
margin: 20px auto;
}

View File

View File

@@ -0,0 +1,24 @@
// 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/>.
pscript.onload_Projects = function(wrapper) {
wn.ui.make_app_page({parent:wrapper, title:'Gantt Chart: All Tasks', single_column:true});
if(!erpnext.show_task_gantt)
wn.require('app/js/gantt_task.js');
var gantt_area = $('<div>').appendTo($(wrapper).find('.layout-main'));
erpnext.show_task_gantt(gantt_area);
}

View File

@@ -0,0 +1,29 @@
# 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/>.
from __future__ import unicode_literals
import webnotes
@webnotes.whitelist()
def get_tasks():
cond = ''
if webnotes.form_dict.get('project'):
cond = ' and project="%s"' % webnotes.form_dict.get('project')
return webnotes.conn.sql("""select name, project, subject, exp_start_date, exp_end_date,
description, status from tabTask where
project is not null
and exp_start_date is not null
and exp_end_date is not null %s""" % cond, as_dict=True)

View File

@@ -0,0 +1,27 @@
# Page, Projects
[
# These values are common in all dictionaries
{
'creation': '2010-12-14 10:23:31',
'docstatus': 0,
'modified': '2010-12-30 14:43:47',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all Page
{
'doctype': 'Page',
'module': 'Projects',
'name': '__common__',
'page_name': 'Projects',
'standard': 'Yes'
},
# Page, Projects
{
'doctype': 'Page',
'name': 'Projects'
}
]

View File

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

View File

@@ -0,0 +1,38 @@
<div class="layout-wrapper layout-wrapper-background">
<div class="appframe-area"></div>
<div class="layout-main-section">
<div style="width: 48%; float: left;">
<h4><a href="#!List/Task">Task</a></h4>
<p class="help">Project activity / task</p>
<br>
<h4><a href="#!List/Project">Project</a></h4>
<p class="help">Project master</p>
<br>
<h4><a href="#!List/Timesheet">Timesheet</a></h4>
<p class="help">Timesheet for tasks</p>
</div>
<div style="width: 48%; float: right;">
<h4><a href="#!Projects">Gantt Chart</a></h4>
<p class="help">Gantt chart of all tasks</p>
</div>
<div style="clear: both"></div>
<hr>
<h3>Reports</h3>
<div class="reports-list"></div>
</div>
<div class="layout-side-section">
<div class="psidebar">
<div class="section">
<div class="section-head">Setup</div>
<div class="section-body">
<div class="section-item">
<a class="section-link"
title = "Types of activities for Time Sheets"
href="#!List/Activity Type">Activity Type</a>
</div>
</div>
</div>
</div>
</div>
<div style="clear: both;"></div>
</div>

View File

@@ -0,0 +1,20 @@
// 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/>.
pscript['onload_projects-home'] = function(wrapper) {
wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'), 'Projects');
erpnext.module_page.setup_page('Projects', wrapper);
}

View File

@@ -0,0 +1,28 @@
# Page, projects-home
[
# These values are common in all dictionaries
{
'creation': '2012-02-21 13:24:22',
'docstatus': 0,
'modified': '2012-02-21 13:24:22',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all Page
{
'doctype': 'Page',
'module': u'Projects',
'name': '__common__',
'page_name': u'projects-home',
'standard': u'Yes',
'title': u'Projects Home'
},
# Page, projects-home
{
'doctype': 'Page',
'name': u'projects-home'
}
]

View File

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

View File

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

View File

@@ -0,0 +1,32 @@
// 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/>.
report.customize_filters = function() {
this.hide_all_filters();
//this.add_filter({fieldname:'item_code', label:'Item Code', fieldtype:'Link', options:'Item',ignore : 1,parent:'Delivery Note Item'});
this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Project Name'].df.filter_hide = 0;
this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Company'].df.filter_hide = 0;
this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;
this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Customer'].df.filter_hide = 0;
this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Customer Name'].df.filter_hide = 0;
this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Project Name'].df.in_first_page = 1;
this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
}

View File

@@ -0,0 +1,35 @@
# Search Criteria, projectwise_delivered_qty_and_costs
[
# These values are common in all dictionaries
{
'creation': '2012-04-03 12:49:52',
'docstatus': 0,
'modified': '2012-04-03 12:49:52',
'modified_by': u'Administrator',
'owner': u'harshada@webnotestech.com'
},
# These values are common for all Search Criteria
{
'add_cond': u'IFNULL(`tabDelivery Note`.`project_name`,"")!=""',
'columns': u'Delivery Note\x01ID,Delivery Note\x01Project Name,Delivery Note\x01Customer,Delivery Note\x01Customer Name,Delivery Note Item\x01Item Code,Delivery Note Item\x01Item Name,Delivery Note Item\x01Quantity,Delivery Note\x01Posting Date,Delivery Note\x01% Billed,Delivery Note Item\x01Amount*',
'criteria_name': u'Projectwise Delivered Qty and Costs',
'doc_type': u'Delivery Note Item',
'doctype': 'Search Criteria',
'filters': u"{'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'Submitted','Delivery Note\x01Fiscal Year':''}",
'module': u'Projects',
'name': '__common__',
'page_len': 50,
'parent_doc_type': u'Delivery Note',
'sort_by': u'`tabDelivery Note`.`name`',
'sort_order': u'DESC',
'standard': u'Yes'
},
# Search Criteria, projectwise_delivered_qty_and_costs
{
'doctype': 'Search Criteria',
'name': u'projectwise_delivered_qty_and_costs'
}
]

View File

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

View File

@@ -0,0 +1,31 @@
// 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/>.
report.customize_filters = function() {
this.hide_all_filters();
//this.add_filter({fieldname:'item_code', label:'Item Code', fieldtype:'Link', options:'Item',ignore : 1,parent:'Sales Order Item'});
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Project Name'].df.filter_hide = 0;
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df.filter_hide = 0;
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Customer'].df.filter_hide = 0;
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Customer Name'].df.filter_hide = 0;
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Project Name'].df.in_first_page = 1;
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
}

View File

@@ -0,0 +1,36 @@
# Search Criteria, projectwise_pending_qty_and_costs
[
# These values are common in all dictionaries
{
'creation': '2012-04-03 12:49:52',
'docstatus': 0,
'modified': '2012-04-03 12:49:52',
'modified_by': u'Administrator',
'owner': u'ashwini@webnotestech.com'
},
# These values are common for all Search Criteria
{
'add_col': u"SUM(`tabSales Order Item`.`qty` - `tabSales Order Item`.`delivered_qty`) AS 'Pending Qty'\nSUM((`tabSales Order Item`.`qty` - `tabSales Order Item`.`delivered_qty`)* `tabSales Order Item`.basic_rate) AS 'Pending Amount'",
'add_cond': u'`tabSales Order Item`.`qty` > `tabSales Order Item`.`delivered_qty`\nIFNULL(`tabSales Order`.`project_name`,"")!=""\n`tabSales Order`.order_type = \'Sales\'',
'columns': u'Sales Order\x01ID,Sales Order\x01Project Name,Sales Order\x01Customer,Sales Order\x01Customer Name,Sales Order Item\x01Item Code,Sales Order Item\x01Item Name,Sales Order\x01% Delivered,Sales Order\x01% Billed,Sales Order\x01Sales Order Date,Sales Order\x01Expected Delivery Date',
'criteria_name': u'Projectwise Pending Qty and Costs',
'doc_type': u'Sales Order Item',
'doctype': 'Search Criteria',
'filters': u"{'Sales Order\x01Submitted':1,'Sales Order\x01Status':'Submitted','Sales Order\x01Fiscal Year':''}",
'module': u'Projects',
'name': '__common__',
'page_len': 50,
'parent_doc_type': u'Sales Order',
'sort_by': u'`tabSales Order`.`name`',
'sort_order': u'DESC',
'standard': u'Yes'
},
# Search Criteria, projectwise_pending_qty_and_costs
{
'doctype': 'Search Criteria',
'name': u'projectwise_pending_qty_and_costs'
}
]

View File

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

View File

@@ -0,0 +1,108 @@
// 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/>.
report.customize_filters = function() {
//hide all filters
//------------------------------------------------
this.hide_all_filters();
//add filters
//------------------------------------------------
this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Purchase Order'+NEWLINE+'Purchase Invoice'+NEWLINE+'Purchase Receipt',report_default:'Purchase Order',ignore : 1,parent:'Purchase Order', single_select:1});
this.add_filter({fieldname:'purchase_order', label:'Purchase Order', fieldtype:'Link', options:'Purchase Order', ignore : 1, parent:'Purchase Order'});
this.add_filter({fieldname:'purchase_receipt', label:'Purchase Receipt',fieldtype:'Link', options:'Purchase Receipt',ignore : 1, parent:'Purchase Order'});
this.add_filter({fieldname:'purchase_invoice', label:'Purchase Invoice',fieldtype:'Link', options:'Purchase Invoice',ignore : 1, parent:'Purchase Order'});
//unhide filters
//------------------------------------------------
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Project Name'].df.filter_hide = 0;
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Company'].df.filter_hide = 0;
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;
//move filter field in first page
//------------------------------------------------
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Based On'].df.in_first_page = 1;
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Project Name'].df.in_first_page = 1;
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Purchase Order'].df.in_first_page = 1;
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Purchase Invoice'].df.in_first_page = 1;
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Purchase Receipt'].df.in_first_page = 1;
// default values
//------------------------------------------------
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
}
//hide select columns field
//------------------------------------------------
this.mytabs.items['Select Columns'].hide();
report.get_query = function() {
//get filter values
based_on = this.filter_fields_dict['Purchase Order'+FILTER_SEP+'Based On'].get_value();
purchase_order = this.filter_fields_dict['Purchase Order'+FILTER_SEP+'Purchase Order'].get_value();
purchase_invoice = this.filter_fields_dict['Purchase Order'+FILTER_SEP+'Purchase Invoice'].get_value();
purchase_receipt = this.filter_fields_dict['Purchase Order'+FILTER_SEP+'Purchase Receipt'].get_value();
project_name = this.filter_fields_dict['Purchase Order'+FILTER_SEP+'Project Name'].get_value();
company = this.filter_fields_dict['Purchase Order'+FILTER_SEP+'Company'].get_value();
fy = this.filter_fields_dict['Purchase Order'+FILTER_SEP+'Fiscal Year'].get_value();
// make query based on transaction
//-------------------------------------------------------------------------------------------
var cond = '';
//for purchase order
if(based_on == 'Purchase Order'){
if(purchase_order) cond += ' AND `tabPurchase Order`.name = "'+purchase_order+'"';
if(project_name) cond += ' AND `tabPurchase Order`.project_name = "'+project_name+'"';
if(company) cond += ' AND `tabPurchase Order`.company = "'+company+'"';
if(fy !='') cond += ' AND `tabPurchase Order`.fiscal_year = "'+fy+'"';
var q = 'SELECT DISTINCT `tabPurchase Order`.name, `tabPurchase Order`.status, `tabPurchase Order`.project_name, `tabPurchase Order`.supplier,`tabPurchase Order`.supplier_name,`tabPurchase Order`.per_received, `tabPurchase Order`.per_billed, `tabPurchase Order`.grand_total FROM `tabPurchase Order` WHERE IFNULL(`tabPurchase Order`.project_name,"") != ""'+cond+' AND `tabPurchase Order`.docstatus != 2';
return q;
}
//for purchase receipt
else if(based_on == 'Purchase Receipt'){
if(purchase_order) cond += ' t2.purchase_order = "'+purchase_order+'" AND ';
if(purchase_receipt) cond += ' t1.name = "'+purchase_receipt+'" AND ';
if(project_name) cond += ' t1.project_name = "'+project_name+'" AND ';
if(company) cond += ' t1.company = "'+company+'" AND ';
if(fy !='') cond += ' t1.fiscal_year = "'+fy+'" AND ';
var q = 'SELECT DISTINCT t1.name, t1.status, t1.project_name, t1.supplier, t1.supplier_name,t1.grand_total FROM `tabPurchase Receipt` t1, `tabPurchase Receipt Item` t2 WHERE '+cond +'IFNULL(t1.project_name,"") !="" AND t1.docstatus != 2 AND t1.name = t2.parent';
return q;
}
//for purchase invoice
else if(based_on == 'Purchase Invoice'){
if(purchase_order) cond += ' t2.purchase_order = "'+purchase_order+'" AND ';
if(purchase_receipt) cond += ' t2.purchase_receipt = "'+purchase_receipt+'" AND';
if(purchase_invoice) cond += ' t1.name = "'+purchase_invoice+'" AND';
if(project_name) cond += ' t1.project_name = "'+project_name+'" AND ';
if(company) cond += ' t1.company = "'+company+'" AND ';
if(fy !='') cond += ' t1.fiscal_year = "'+fy+'" AND ';
var q = 'SELECT DISTINCT t1.name , t1.credit_to , t1.project_name, t1.supplier, t1.supplier_name , t1.grand_total FROM `tabPurchase Invoice` t1, `tabPurchase Invoice Item` t2 WHERE '+cond +'IFNULL(t1.project_name,"") !="" AND t1.docstatus != 2 AND t1.name = t2.parent';
return q;
}
}

View File

@@ -0,0 +1,40 @@
# 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/>.
from __future__ import unicode_literals
based_on = filter_values.get('based_on')
# make default columns
#for r in res:
col = []
if based_on == 'Purchase Order':
col = [['Purchase Order ID','Link','Purchase Order'],['Status','Data',''],['Project Name','Link','Project'],['Supplier','Link','Supplier'],['Supplier Name','Data',''],['% Received','Data',''],['% Billed','Data',''],['Grand Total','Currency','']]
elif based_on == 'Purchase Invoice':
col = [['Purchase Receipt ID','Link','Purchase Invoice'],['Status','Data',''],['Project Name','Link','Project'],['Supplier','Link','Supplier'],['Supplier Name','Data',''],['Grand Total','Currency','']]
elif based_on == 'Purchase Receipt':
col = [['Purchase Invoice ID','Link','Purchase Receipt'],['Credit To','Data',''],['Project Name','Link','Project'],['Supplier','Link','Supplier'],['Supplier Name','Data',''],['Grand Total','Currency','']]
for c in col:
colnames.append(c[0])
coltypes.append(c[1])
coloptions.append(c[2])
l = (len(c[0])*9)
if l < 150 : col_width = '150px'
else: col_width = '%spx'%(l)
colwidths.append(col_width)
col_idx[c[0]] = len(colnames)-1

View File

@@ -0,0 +1,31 @@
# Search Criteria, projectwise_purchase_details
[
# These values are common in all dictionaries
{
'creation': '2012-04-03 12:49:52',
'docstatus': 0,
'modified': '2012-04-03 12:49:52',
'modified_by': u'Administrator',
'owner': u'ashwini@webnotestech.com'
},
# These values are common for all Search Criteria
{
'criteria_name': u'Projectwise Purchase Details',
'doc_type': u'Purchase Order',
'doctype': 'Search Criteria',
'filters': u"{'Purchase Order\x01Status':'','Purchase Order\x01Fiscal Year':''}",
'module': u'Projects',
'name': '__common__',
'page_len': 50,
'sort_order': u'DESC',
'standard': u'Yes'
},
# Search Criteria, projectwise_purchase_details
{
'doctype': 'Search Criteria',
'name': u'projectwise_purchase_details'
}
]

View File

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

View File

@@ -0,0 +1,112 @@
// 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/>.
report.customize_filters = function() {
//hide all filters
//------------------------------------------------
this.hide_all_filters();
//add filters
//------------------------------------------------
this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Sales Invoice',report_default:'Sales Order',ignore : 1,parent:'Sales Order', single_select:1});
this.add_filter({fieldname:'sales_order', label:'Sales Order', fieldtype:'Link', options:'Sales Order', ignore : 1, parent:'Sales Order'});
this.add_filter({fieldname:'delivery_note', label:'Delivery Note', fieldtype:'Link', options:'Delivery Note',ignore : 1, parent:'Sales Order'});
this.add_filter({fieldname:'sales_invoice', label:'Sales Invoice',fieldtype:'Link', options:'Sales Invoice',ignore : 1, parent:'Sales Order'});
//unhide filters
//------------------------------------------------
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Project Name'].df.filter_hide = 0;
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df.filter_hide = 0;
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Customer'].df.filter_hide = 0;
//move filter field in first page
//------------------------------------------------
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Based On'].df.in_first_page = 1;
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Project Name'].df.in_first_page = 1;
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Sales Order'].df.in_first_page = 1;
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Delivery Note'].df.in_first_page = 1;
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Sales Invoice'].df.in_first_page = 1;
// default values
//------------------------------------------------
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
}
//hide select columns field
//------------------------------------------------
//this.mytabs.items['Select Columns'].hide();
report.get_query = function() {
//get filter values
based_on = this.filter_fields_dict['Sales Order'+FILTER_SEP+'Based On'].get_value();
sales_order = this.filter_fields_dict['Sales Order'+FILTER_SEP+'Sales Order'].get_value();
delivery_note = this.filter_fields_dict['Sales Order'+FILTER_SEP+'Delivery Note'].get_value();
sales_invoice = this.filter_fields_dict['Sales Order'+FILTER_SEP+'Sales Invoice'].get_value();
project_name = this.filter_fields_dict['Sales Order'+FILTER_SEP+'Project Name'].get_value();
company = this.filter_fields_dict['Sales Order'+FILTER_SEP+'Company'].get_value();
fy = this.filter_fields_dict['Sales Order'+FILTER_SEP+'Fiscal Year'].get_value();
// make query based on transaction
//-------------------------------------------------------------------------------------------
var cond = '';
//for sales order
if(based_on == 'Sales Order'){
if(sales_order) cond += ' AND `tabSales Order`.name = "'+sales_order+'"';
if(project_name) cond += ' AND `tabSales Order`.project_name = "'+project_name+'"';
if(company) cond += ' AND `tabSales Order`.company = "'+company+'"';
if(fy) cond += ' AND `tabSales Order`.fiscal_year = "'+fy+'"';
var q = 'SELECT DISTINCT `tabSales Order`.name, `tabSales Order`.order_type, `tabSales Order`.status, `tabSales Order`.project_name, `tabSales Order`.customer,`tabSales Order`.customer_name,`tabSales Order`.per_delivered, `tabSales Order`.per_billed, `tabSales Order`.grand_total FROM `tabSales Order` WHERE IFNULL(`tabSales Order`.project_name,"") != ""'+cond+' AND `tabSales Order`.docstatus != 2';
return q;
}
//for delivery note
else if(based_on == 'Delivery Note'){
if(sales_order) cond += ' t1.name = t2.parent AND t2.prevdoc_docname = "'+sales_order+'" AND ';
if(delivery_note) cond += ' t1.name = "'+delivery_note+'" AND ';
if(project_name) cond += ' t1.project_name = "'+project_name+'" AND ';
if(company) cond += ' t1.company = "'+company+'" AND ';
if(fy) cond += ' t1.fiscal_year = "'+fy+'" AND ';
var q = 'SELECT DISTINCT t1.name, t1.status, t1.project_name, t1.customer, t1.customer_name, t1.per_billed, t1.per_installed, t1.grand_total FROM `tabDelivery Note` t1, `tabDelivery Note Item` t2 WHERE '+cond+' IFNULL(t1.project_name,"") !="" AND t1.docstatus != 2';
return q;
}
//for sales invoice
else if(based_on == 'Sales Invoice'){
if(sales_order) cond += ' t2.sales_order = "'+sales_order+'" AND ';
if(delivery_note) cond += ' t2.delivery_note = "'+delivery_note+'" AND ';
if(sales_invoice) cond += ' t1.name = "'+sales_invoice+'" AND ';
if(project_name) cond += ' t1.project_name = "'+project_name+'" AND ';
if(company) cond += ' t1.company = "'+company+'" AND ';
if(fy) cond += ' t1.fiscal_year = "'+fy+'" AND ';
var q = 'SELECT DISTINCT t1.name , t1.debit_to , t1.project_name , t1.customer , t1.customer_name , t1.grand_total FROM `tabSales Invoice` t1, `tabSales Invoice Item` t2 WHERE '+cond +'IFNULL(t1.project_name,"") !="" AND t1.docstatus != 2 AND t1.name = t2.parent';
return q;
}
}

View File

@@ -0,0 +1,37 @@
# 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/>.
from __future__ import unicode_literals
based_on = filter_values.get('based_on')
cols=[]
if based_on == 'Sales Order':
cols = [['Sales Order No','Link','150px','Sales Order'], ['Order Type','Data','100px',''], ['Status','Data','100px',''], ['Project Name','Link','150px','Project'], ['Customer','Link','150px','Customer'], ['Customer Name','Data','200px',''], ['% Delivered','Currency','100px',''], ['% Billed','Currency','100px',''], ['Grand Total','Currency','150px','']]
elif based_on == 'Delivery Note':
cols = [['Delivery Note No','Link','150px','Delivery Note'], ['Status','Data','100px',''], ['Project Name','Link','200px','Project'], ['Customer','Link','150px','Customer'], ['Customer Name','Data','200px',''], ['% Installed','Currency','100px',''], ['% Billed','Currency','100px',''], ['Grand Total','Currency','150px','']]
elif based_on == 'Sales Invoice':
cols = [['Sales Invoice No','Link','150px','Sales Invoice'], ['Debit To','Data','150px',''], ['Project Name','Link','200px','Project'], ['Customer','Link','150px','Customer'], ['Customer Name','Data','200px',''], ['Grand Total','Currency','150px','']]
for c in cols:
colnames.append(c[0])
coltypes.append(c[1])
colwidths.append(c[2])
coloptions.append(c[3])
col_idx[c[0]] = len(colnames)-1

View File

@@ -0,0 +1,31 @@
# Search Criteria, projectwise_sales_details
[
# These values are common in all dictionaries
{
'creation': '2012-04-03 12:49:52',
'docstatus': 0,
'modified': '2012-04-03 12:49:52',
'modified_by': u'Administrator',
'owner': u'harshada@webnotestech.com'
},
# These values are common for all Search Criteria
{
'criteria_name': u'Projectwise Sales Details',
'doc_type': u'Sales Order',
'doctype': 'Search Criteria',
'filters': u"{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Status':''}",
'module': u'Projects',
'name': '__common__',
'page_len': 50,
'sort_order': u'DESC',
'standard': u'Yes'
},
# Search Criteria, projectwise_sales_details
{
'doctype': 'Search Criteria',
'name': u'projectwise_sales_details'
}
]

View File

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

View File

@@ -0,0 +1,34 @@
# Search Criteria, projectwise_sales_orders
[
# These values are common in all dictionaries
{
'creation': '2012-04-03 12:49:52',
'docstatus': 0,
'modified': '2012-04-03 12:49:52',
'modified_by': u'Administrator',
'owner': u'harshada@webnotestech.com'
},
# These values are common for all Search Criteria
{
'add_cond': u"ifnull(`tabSales Order`.project_name ,'') != ''",
'columns': u'Sales Order\x01ID,Sales Order\x01Status,Sales Order\x01Project Name,Sales Order\x01Customer,Sales Order\x01Sales Order Date,Sales Order\x01Expected Delivery Date,Sales Order\x01Quotation No,Sales Order\x01% Delivered,Sales Order\x01% Billed,Sales Order\x01Grand Total*',
'criteria_name': u'Projectwise Sales Orders',
'doc_type': u'Sales Order',
'doctype': 'Search Criteria',
'filters': u"{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Status':'','Sales Order\x01Fiscal Year':''}",
'module': u'Projects',
'name': '__common__',
'page_len': 50,
'sort_by': u'`tabSales Order`.`name`',
'sort_order': u'DESC',
'standard': u'Yes'
},
# Search Criteria, projectwise_sales_orders
{
'doctype': 'Search Criteria',
'name': u'projectwise_sales_orders'
}
]

View File

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

View File

@@ -0,0 +1,23 @@
// 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/>.
report.customize_filters = function() {
this.filter_fields_dict['Timesheet Detail'+FILTER_SEP +'Project Name'].df.in_first_page = 1;
this.filter_fields_dict['Timesheet Detail'+FILTER_SEP +'Task Id'].df.in_first_page = 1;
this.filter_fields_dict['Timesheet'+FILTER_SEP +'Timesheet by'].df.filter_hide = 1;
}
//this.mytabs.items['Select Columns'].hide()

View File

@@ -0,0 +1,34 @@
# Search Criteria, timesheet_report
[
# These values are common in all dictionaries
{
'creation': '2012-04-03 12:49:53',
'docstatus': 0,
'modified': '2012-04-03 12:49:53',
'modified_by': u'Administrator',
'owner': u'ashwini@webnotestech.com'
},
# These values are common for all Search Criteria
{
'columns': u'Timesheet\x01ID,Timesheet\x01Timesheet Date,Timesheet\x01Timesheet by,Timesheet Detail\x01Project Name,Timesheet Detail\x01Task Id,Timesheet Detail\x01Task Name,Timesheet Detail\x01Actual Start Time,Timesheet Detail\x01Actual End Time,Timesheet Detail\x01Total Hours (Actual)',
'criteria_name': u'Timesheet Report',
'doc_type': u'Timesheet Detail',
'doctype': 'Search Criteria',
'filters': u"{'Timesheet\x01Saved':1,'Timesheet\x01Submitted':1}",
'module': u'Projects',
'name': '__common__',
'page_len': 50,
'parent_doc_type': u'Timesheet',
'sort_by': u'`tabTimesheet`.`name`',
'sort_order': u'DESC',
'standard': u'Yes'
},
# Search Criteria, timesheet_report
{
'doctype': 'Search Criteria',
'name': u'timesheet_report'
}
]