Sourced wnframework-modules from Google Code as erpnext

This commit is contained in:
Pratik Vyas
2011-06-08 14:37:15 +05:30
commit c1e6e4c752
1680 changed files with 162635 additions and 0 deletions

View File

@@ -0,0 +1,141 @@
[
{
'_last_update': '1300959287',
'creation': '2010-11-30 17:31:44',
'disabled': 'No',
'docstatus': 0,
'doctype': u'Module Def',
'doctype_list': None,
'file_list': 'undefined,undefined',
'idx': None,
'is_hidden': 'No',
'last_updated_date': '2011-03-10 15:57:47',
'modified': '2011-03-24 15:07:53',
'modified_by': 'Administrator',
'module_desc': '<div id="projects_div"></div>',
'module_icon': 'puzzle.png',
'module_label': 'Projects',
'module_name': 'Projects',
'module_page': None,
'module_seq': 2,
'name': 'Projects',
'owner': 'Administrator',
'parent': None,
'parentfield': None,
'parenttype': None,
'trash_reason': None,
'widget_code': None
},
{
'click_function': None,
'creation': '2010-11-30 17:31:44',
'description': None,
'display_name': 'Project',
'doc_name': 'Project',
'doc_type': 'Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 1,
'modified': '2011-03-24 15:07:53',
'modified_by': 'Administrator',
'name': 'MDI00099',
'owner': 'Administrator',
'parent': 'Projects',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': None,
'description': None,
'display_name': 'Task',
'doc_name': 'Ticket',
'doc_type': 'Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 2,
'modified': '2011-03-24 15:07:53',
'modified_by': 'Administrator',
'name': 'MDI00285',
'owner': None,
'parent': 'Projects',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': None,
'description': None,
'display_name': 'Gantt Chart',
'doc_name': 'Projects',
'doc_type': 'Pages',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 3,
'modified': '2011-03-24 15:07:53',
'modified_by': 'Administrator',
'name': 'MDI00286',
'owner': None,
'parent': 'Projects',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': None,
'description': None,
'display_name': 'Timesheet',
'doc_name': 'Timesheet',
'doc_type': 'Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 4,
'modified': '2011-03-24 15:07:53',
'modified_by': 'Administrator',
'name': 'MDI00287',
'owner': None,
'parent': 'Projects',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'creation': '2010-11-30 17:31:44',
'docstatus': 0,
'doctype': 'Module Def Role',
'idx': 1,
'modified': '2011-03-24 15:07:53',
'modified_by': 'Administrator',
'name': 'MDR00012',
'owner': 'Administrator',
'parent': 'Projects',
'parentfield': 'roles',
'parenttype': 'Module Def',
'role': 'Projects User'
},
{
'creation': '2010-11-30 17:31:44',
'docstatus': 0,
'doctype': 'Module Def Role',
'idx': 2,
'modified': '2011-03-24 15:07:53',
'modified_by': 'Administrator',
'name': 'MDR00013',
'owner': 'Administrator',
'parent': 'Projects',
'parentfield': 'roles',
'parenttype': 'Module Def',
'role': 'System Manager'
}
]

0
projects/__init__.py Normal file
View File

View File

View File

@@ -0,0 +1,136 @@
[
{
'allow_attach': None,
'allow_copy': None,
'allow_email': None,
'allow_print': None,
'allow_rename': None,
'allow_trash': None,
'autoname': 'field:activity_type',
'change_log': None,
'client_script': None,
'client_script_core': None,
'client_string': None,
'colour': 'White:FFF',
'creation': '2011-02-21 15:43:40',
'description': None,
'docstatus': 0,
'doctype': 'DocType',
'document_type': None,
'dt_template': None,
'hide_heading': None,
'hide_toolbar': None,
'idx': None,
'in_create': None,
'in_dialog': 1,
'is_transaction_doc': None,
'issingle': None,
'istable': None,
'max_attachments': None,
'menu_index': None,
'modified': '2011-02-21 15:43:40',
'modified_by': 'Administrator',
'module': 'Projects',
'name': 'Activity Type',
'name_case': None,
'owner': 'Administrator',
'parent': None,
'parent_node': None,
'parentfield': None,
'parenttype': None,
'print_outline': None,
'read_only': None,
'read_only_onload': None,
'search_fields': None,
'section_style': 'Simple',
'server_code': None,
'server_code_compiled': None,
'server_code_core': None,
'server_code_error': ' ',
'show_in_menu': None,
'smallicon': None,
'use_template': None,
'version': 12
},
{
'amend': None,
'cancel': None,
'create': 1,
'creation': '2011-02-21 15:43:40',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 1,
'match': None,
'modified': '2011-02-21 15:43:40',
'modified_by': 'Administrator',
'name': 'PERM00739',
'owner': 'Administrator',
'parent': 'Activity Type',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'System Manager',
'submit': None,
'write': 1
},
{
'amend': None,
'cancel': None,
'create': 1,
'creation': '2011-02-21 15:43:40',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 2,
'match': None,
'modified': '2011-02-21 15:43:40',
'modified_by': 'Administrator',
'name': 'PERM00740',
'owner': 'Administrator',
'parent': 'Activity Type',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'Projects User',
'submit': None,
'write': 1
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-02-21 15:43:40',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'activity_type',
'fieldtype': 'Data',
'hidden': None,
'icon': None,
'idx': 1,
'in_filter': None,
'label': 'Activity Type',
'modified': '2011-02-21 15:43:40',
'modified_by': 'Administrator',
'name': 'FL04231',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Activity Type',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': None,
'trigger': None,
'width': None
}
]

View File

View File

@@ -0,0 +1,39 @@
//-------------------------- Onload ---------------------------
cur_frm.cscript.onload = function(doc, cdt, cdn) {
if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
}
//------------------- Get Contact Person based on customer selected ---------------------------
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
if(doc.customer)
return 'SELECT `tabContact`.contact_name FROM `tabContact` WHERE (`tabContact`.is_customer = 1 AND `tabContact`.customer_name = "'+ doc.customer+'") AND `tabContact`.docstatus != 2 AND `tabContact`.contact_name LIKE "%s" ORDER BY `tabContact`.contact_name ASC LIMIT 50';
else
msgprint("Please select Customer first")
}
//-------------------------------- get query select Territory ------------------------------------------
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';
}
//------------------------ Customer and its primary contact Details ------------------------------------
cur_frm.cscript.customer = function(doc, cdt, cdn) {
if(doc.customer) get_server_fields('get_customer_details', '','', doc, cdt, cdn, 1);
}
//--------------------- Customer's Contact Person Details --------------------------------------------
cur_frm.cscript.contact_person = function(doc, cdt, cdn) {
if(doc.contact_person) {
get_server_fields('get_contact_details','','',doc, cdt, cdn, 1);
}
}
//--------- calculate gross profit --------------------------------
cur_frm.cscript.project_value = function(doc, cdt, cdn){
get_server_fields('get_gross_profit','','',doc, cdt, cdn, 1);
}
//--------- calculate gross profit --------------------------------
cur_frm.cscript.est_material_cost = function(doc, cdt, cdn){
get_server_fields('get_gross_profit','','',doc, cdt, cdn, 1);
}

View File

@@ -0,0 +1,76 @@
# Please edit this list and import only required elements
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, removechild, getchildren, make_autoname, SuperDocType
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, contact_no, email_id from `tabContact` where customer_name='%s' and is_customer=1 and is_primary_contact='Yes' 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]['contact_no'] or ''
ret['email_id'] = contact_det and contact_det[0]['email_id'] or ''
return cstr(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 str(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 cstr(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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,83 @@
cur_frm.cscript.onload = function(doc, dt, dn) {
// created?
if(cur_frm.mylist) {
cur_frm.mylist.run();
return;
} else {
// create a new listing
var lst = new Listing('Activities Updates');
lst.colwidths = ['5%','30%','40%','25%'];
// define options
var opts = {};
opts.head_main_style = {};
opts.cell_style = { padding:'3px 2px', borderRight : '0px', borderBottom : '1px solid #AAA', verticalAlign: 'top'}
opts.head_style = { padding:'3px 2px', borderBottom : '1px solid #AAA'}
opts.alt_cell_style = {};
opts.hide_print = 1;
opts.no_border = 1;
opts.hide_export = 1;
opts.hide_print = 1;
opts.hide_rec_label = 1;
lst.opts = opts;
// query
lst.get_query = function() {
var doc = cur_frm.doc;
this.query = "select owner,creation,`update`, hours from `tabProject Activity Update` where parent = '"+doc.name+"'";
this.query_max = "select count(*) from `tabProject Activity Update` where parent = '"+doc.name+"'";
}
lst.show_cell = function(cell,ri,ci,d){
// owner and date
if (ci==0){
var d1 = $a(cell,'div');
var img = $a(cell,'img','',{width:'40px'});
set_user_img(img,d[ri][0])
var d2 = $a(cell,'div');
d2.innerHTML = d[ri][0] + ' on: ' + date.str_to_user(d[ri][1]);
}
// update
if(ci==1) {
cell.innerHTML = replace_newlines(d[ri][2]);
}
// Hours
if (ci==2) {
cell.innerHTML = d[ri][3] + ' hrs';
}
}
lst.make(cur_frm.fields_dict['Updates HTML'].wrapper);
cur_frm.mylist = lst;
lst.run();
}
}
cur_frm.cscript.refresh = function(doc, dt, dn) {
// show activities only after project is saved
var fl = ['new_update','Add','hours','Updates HTML'];
if(doc.__islocal) {
hide_field(fl);}
else {
unhide_field(fl); }
}
cur_frm.cscript['Add'] = function(doc, dt, dn) {
var callback = function(r,rt) {
// refresh listing
cur_frm.mylist.run();
}
$c_obj([doc],'add_update','',callback);
}

View File

@@ -0,0 +1,32 @@
# Please edit this list and import only required elements
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, removechild, getchildren, make_autoname, SuperDocType
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,d,dl):
self.doc, self.doclist = d, dl
def add_update(self):
d = Document('Project Activity Update')
d.parent = self.doc.name
d.update = self.doc.new_update
d.hours = self.doc.hours
d.save(1)
self.doc.new_update = ''
self.doc.hours = ''

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-20 13:32:19', 'search_fields': None, 'module': 'Projects', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 1, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Project Activity Update', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2010-04-20 13:32:19', 'doctype': 'DocField', 'oldfieldname': 'update', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Update', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Project Activity Update', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04817', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-04-20 13:32:19', 'parenttype': 'DocType', 'fieldname': 'update', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Float', 'creation': '2010-04-20 13:32:19', 'doctype': 'DocField', 'oldfieldname': 'hours', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Hours', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'e.g. 0.5, 2.5 etc', 'parent': 'Project Activity Update', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04818', 'idx': 2, 'default': None, 'colour': 'White:FFF', 'modified': '2010-04-20 13:32:19', 'parenttype': 'DocType', 'fieldname': 'hours', 'fieldtype': 'Float', 'options': '', 'report_hide': None, 'parentfield': 'fields'}]

View File

@@ -0,0 +1,116 @@
# Please edit this list and import only required elements
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, removechild, getchildren, make_autoname, SuperDocType
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,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 tabTicket where project=%s and docstatus!=2', p)[0][0]
n_tasks[p] = t1 or 0
if t1:
t2 = sql('select count(*) from tabTicket 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 tabTicket")
# 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 tabTicket where allocated_to=%s and docstatus!=2", r[0])[0][0]
ret[r[1]]['Closed'] = sql("select count(*) from tabTicket 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 tabTicket 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 tabTicket
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 `tabTicket` 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')

View File

@@ -0,0 +1 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-20 15:42:00', 'search_fields': None, 'module': 'Projects', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'harshada@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 43, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': '', 'name': 'Project Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-11-02 10:10:37', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]

View File

@@ -0,0 +1 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-20 13:27:02', 'search_fields': None, 'module': 'Projects', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 1, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Project Milestone', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-04-20 13:27:02', 'doctype': 'DocField', 'oldfieldname': 'milestone_date', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Milestone Date', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Project Milestone', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04807', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-04-20 13:27:02', 'parenttype': 'DocType', 'fieldname': 'milestone_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2010-04-20 13:27:02', 'doctype': 'DocField', 'oldfieldname': 'milestone', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Milestone', 'width': '300px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Project Milestone', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04808', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-04-20 13:27:02', 'parenttype': 'DocType', 'fieldname': 'milestone', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-20 13:27:02', 'doctype': 'DocField', 'oldfieldname': 'status', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Status', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Project Milestone', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04809', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-04-20 13:27:02', 'parenttype': 'DocType', 'fieldname': 'status', 'fieldtype': 'Select', 'options': 'Pending\nCompleted', 'report_hide': None, 'parentfield': 'fields'}]

View File

View File

@@ -0,0 +1,16 @@
cur_frm.cscript.onload=function(doc,cdt,cdn){if(!doc.senders_name){doc.senders_name=user_fullname;doc.senders_email=user;refresh_many(['senders_name','senders_email']);}
if(doc.__islocal){doc.status='Open';doc.opening_date=get_today();refresh_many(['status','opening_date']);}
else{if(!doc.opening_date){doc.opening_date=dateutil.str_to_user(only_date(doc.creation));refresh_field('opening_date');}}
if(doc.status=='Open')doc.review_date=doc.closing_date='';else if(doc.status=='Pending Review')doc.closing_date='';refresh_many(['closing_date','review_date']);if(doc.project)cur_frm.cscript.project(doc,cdt,cdn);}
cur_frm.cscript.refresh=function(doc,cdt,cdn){cur_frm.clear_custom_buttons();if(doc.status=='Pending Review'&&(doc.senders_name==user_fullname||doc.senders_email==user)){cur_frm.add_custom_button('Declare Completed',cur_frm.cscript['Declare Completed']);cur_frm.add_custom_button('Reopen Task',cur_frm.cscript['Reopen Task']);}
if(doc.status=='Open'&&!doc.__islocal){cur_frm.add_custom_button('Cancel Task',cur_frm.cscript['Cancel Task']);if(doc.allocated_to==user)cur_frm.add_custom_button('Get Approval',cur_frm.cscript['Get Approval']);}}
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='';}
cur_frm.cscript.allocated_to=function(doc,cdt,cdn){get_server_fields('get_allocated_to_name','','',doc,cdt,cdn,1);}
cur_frm.cscript['Get Approval']=function(){$c_obj(make_doclist(cur_frm.doc.doctype,cur_frm.doc.name),'set_for_review','',function(r,rt){if(r.message=='true'){doc.status='Pending Review';refresh_many(['review_date','status']);cur_frm.cscript.refresh(cur_frm.doc,cur_frm.doc.doctype,cur_frm.doc.name);}});}
cur_frm.cscript['Reopen Task']=function(){$c_obj(make_doclist(cur_frm.doc.doctype,cur_frm.doc.name),'reopen_task','',function(r,rt){if(r.message=='true'){doc.status='Open';refresh_many(['status']);cur_frm.cscript.refresh(cur_frm.doc,cur_frm.doc.doctype,cur_frm.doc.name);}});}
cur_frm.cscript['Cancel Task']=function(){$c_obj(make_doclist(cur_frm.doc.doctype,cur_frm.doc.name),'cancel_task','',function(r,rt){if(r.message=='true'){doc.status='Cancelled';refresh_many(['status']);cur_frm.cscript.refresh(cur_frm.doc,cur_frm.doc.doctype,cur_frm.doc.name);}});}
cur_frm.cscript['Declare Completed']=function(){$c_obj(make_doclist(cur_frm.doc.doctype,cur_frm.doc.name),'declare_completed','',function(r,rt){if(r.message=='true'){doc.status='Closed';refresh_many(['review_date','closing_date','status']);cur_frm.cscript.refresh(cur_frm.doc,cur_frm.doc.doctype,cur_frm.doc.name);}});}

View File

@@ -0,0 +1,106 @@
cur_frm.cscript.onload = function(doc,cdt,cdn){
if(!doc.senders_name) {
doc.senders_name = user_fullname;
doc.senders_email = user;
refresh_many(['senders_name', 'senders_email']);
}
if(doc.__islocal) {
doc.status = 'Open';
doc.opening_date = get_today();
refresh_many(['status', 'opening_date']);
}
else{
if(!doc.opening_date){
doc.opening_date = dateutil.str_to_user(only_date(doc.creation));
refresh_field('opening_date');
}
}
//hide unhide field depends on status
if(doc.status == 'Open') doc.review_date = doc.closing_date = '';
else if(doc.status == 'Pending Review') doc.closing_date = '';
refresh_many(['closing_date','review_date']);
if(doc.project) cur_frm.cscript.project(doc, cdt, cdn);
}
cur_frm.cscript.refresh = function(doc,cdt,cdn) {
cur_frm.clear_custom_buttons();
if(doc.status == 'Pending Review' && (doc.senders_name == user_fullname || doc.senders_email == user)) {
cur_frm.add_custom_button('Declare Completed', cur_frm.cscript['Declare Completed']);
cur_frm.add_custom_button('Reopen Task', cur_frm.cscript['Reopen Task']);
}
if(doc.status == 'Open' && !doc.__islocal) {
cur_frm.add_custom_button('Cancel Task', cur_frm.cscript['Cancel Task']);
if(doc.allocated_to == user) cur_frm.add_custom_button('Get Approval', cur_frm.cscript['Get Approval']);
}
}
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 ='';
}
cur_frm.cscript.allocated_to = function(doc,cdt,cdn){
get_server_fields('get_allocated_to_name','','',doc,cdt,cdn,1);
}
cur_frm.cscript['Get Approval'] = function(){
$c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name), 'set_for_review', '',function(r, rt) {
if(r.message == 'true'){
doc.status = 'Pending Review'; //for refresh
refresh_many(['review_date','status']);
cur_frm.cscript.refresh(cur_frm.doc, cur_frm.doc.doctype, cur_frm.doc.name);
}
});
}
cur_frm.cscript['Reopen Task'] = function(){
$c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name), 'reopen_task', '',function(r, rt) {
if(r.message == 'true'){
doc.status = 'Open'; //for refresh
refresh_many(['status']);
cur_frm.cscript.refresh(cur_frm.doc, cur_frm.doc.doctype, cur_frm.doc.name);
}
});
}
cur_frm.cscript['Cancel Task'] = function(){
$c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name), 'cancel_task', '',function(r, rt) {
if(r.message == 'true'){
doc.status = 'Cancelled'; //for refresh
refresh_many(['status']);
cur_frm.cscript.refresh(cur_frm.doc, cur_frm.doc.doctype, cur_frm.doc.name);
}
});
}
cur_frm.cscript['Declare Completed'] = function(){
$c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name),'declare_completed', '',function(r, rt) {
if(r.message == 'true'){
doc.status = 'Closed'; //for refresh
refresh_many(['review_date', 'closing_date', 'status']);
cur_frm.cscript.refresh(cur_frm.doc, cur_frm.doc.doctype, cur_frm.doc.name);
}
});
}

View File

@@ -0,0 +1,167 @@
# Please edit this list and import only required elements
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, removechild, getchildren, make_autoname, SuperDocType
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 cstr(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 cstr(ret)
def get_allocated_to_name(self):
as_em = sql("select first_name, last_name from `tabProfile` where name=%s",self.doc.allocated_to)
ret = { 'allocated_to_name' : as_em and (as_em[0][0] + ' ' + as_em[0][1]) or ''}
return cstr(ret)
# validate
#--------------------------------------------
def validate(self):
if not self.doc.opening_date:
msgprint("Please enter Opening Date.")
raise Exception
elif getdate(self.doc.opening_date) > getdate(nowdate()):
msgprint("Opening date can not be future date")
raise Exception
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
if self.doc.opening_date and self.doc.review_date and getdate(self.doc.opening_date) > getdate(self.doc.review_date):
msgprint("Review Date should be greater than or equal to Opening Date ")
raise Exception
if self.doc.closing_date and self.doc.review_date and getdate(self.doc.closing_date) < getdate(self.doc.review_date):
msgprint("Closing Date should be greater than or equal to Review Date ")
raise Exception
# on update
#--------------------------------------------
def on_update(self):
pass
#validate before sending for approval
def validate_for_pending_review(self):
if not self.doc.allocated_to:
msgprint("Please enter allocated_to.")
raise Exception
self.validate_with_timesheet_dates()
#validate before closing task
def validate_for_closed(self):
self.check_non_submitted_timesheets()
self.get_actual_total_hrs()
def check_non_submitted_timesheets(self):
chk = sql("select t1.name from `tabTimesheet` t1, `tabTimesheet Detail` t2 where t2.parent=t1.name and t2.task_id=%s and t1.status='Draft'", self.doc.name)
if chk:
chk_lst = [x[0] for x in chk]
msgprint("Please submit timesheet(s) : "+','.join(chk_lst)+" before declaring this task as completed. As details of this task present in timesheet(s)")
raise Exception
#calculate actual total hours taken to complete task from timesheets
def get_actual_total_hrs(self):
import datetime
import time
chk = sql("select t2.act_total_hrs from `tabTimesheet` t1, `tabTimesheet Detail` t2 where t2.parent = t1.name and t2.task_id = %s and t1.status = 'Submitted' and ifnull(t2.act_total_hrs, '')!='' order by t1.timesheet_date asc", self.doc.name)
if chk:
chk_lst = [x[0] for x in chk]
actual_total = total =0
for m in chk_lst:
m1, m2=[], 0
m1 = m.split(":")
m2 = (datetime.timedelta(minutes=cint(m1[1]), hours=cint(m1[0]))).seconds
total = total + m2
actual_total = time.strftime("%H:%M", time.gmtime(total))
set(self.doc, 'act_total_hrs', actual_total)
# validate and fetch actual start and end date
def validate_with_timesheet_dates(self):
chk = sql("select t1.name, t1.timesheet_date from `tabTimesheet` t1, `tabTimesheet Detail` t2 where t2.parent = t1.name and t2.task_id = %s and t1.status = 'Submitted' order by t1.timesheet_date asc", self.doc.name, as_dict=1)
if chk:
if self.doc.act_start_date:
if chk[0]['timesheet_date'] > getdate(self.doc.act_start_date) or chk[0]['timesheet_date'] < getdate(self.doc.act_start_date):
msgprint("Actual start date of this task is "+cstr(chk[0]['timesheet_date'])+" as per timesheet "+cstr(chk[0]['name']))
raise Exception
else:
self.doc.act_start_date = chk[0]['timesheet_date']
if self.doc.act_end_date:
if chk[len(chk)-1]['timesheet_date'] < getdate(self.doc.act_end_date) or chk[len(chk)-1]['timesheet_date'] > getdate(self.doc.act_end_date):
msgprint("Actual end date of this task is "+cstr(chk[len(chk)-1]['timesheet_date'])+" as per timesheet "+cstr(chk[len(chk)-1]['name']))
raise Exception
else:
self.doc.act_end_date = chk[len(chk)-1]['timesheet_date']
def set_for_review(self):
self.check_non_submitted_timesheets()
self.validate_for_pending_review()
self.get_actual_total_hrs()
self.doc.review_date = nowdate()
set(self.doc, 'status', 'Pending Review')
self.doc.save()
return cstr('true')
def reopen_task(self):
set(self.doc, 'status', 'Open')
self.doc.save()
return cstr('true')
def declare_completed(self):
if self.doc.status == 'Open':
self.validate_for_pending_review()
self.doc.review_date = nowdate()
else:
self.validate_with_timesheet_dates()
self.validate_for_closed()
self.doc.closing_date = nowdate()
set(self.doc, 'status', 'Closed')
set(self.doc, 'docstatus', 1)
self.doc.save()
return cstr('true')
def cancel_task(self):
chk = sql("select distinct t1.name from `tabTimesheet` t1, `tabTimesheet Detail` t2 where t2.parent = t1.name and t2.task_id = %s and t1.status!='Cancelled'", self.doc.name)
if chk:
chk_lst = [x[0] for x in chk]
msgprint("Timesheet(s) "+','.join(chk_lst)+" created against this task. Thus can not be cancelled")
raise Exception
else:
set(self.doc, 'status', 'Cancelled')
set(self.doc, 'docstatus', 2)
self.doc.save()
return cstr('true')
def on_cancel(self):
self.cancel_task()

File diff suppressed because it is too large Load Diff

View File

View File

@@ -0,0 +1,31 @@
// ======================= 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(`tabTicket`.project, "") = `tabProject`.name AND `tabTicket`.name = "'+d.task_id+'" AND';
return repl('SELECT distinct `tabProject`.`name` FROM `tabProject`, `tabTicket` 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(`tabTicket`.project, "") = "'+d.project_name+'" AND';
return repl('SELECT distinct `tabTicket`.`subject` FROM `tabTicket` WHERE %(cond)s `tabTicket`.`subject` LIKE "%s" ORDER BY `tabTicket`.`subject` ASC LIMIT 50', {cond:cond});
}

View File

@@ -0,0 +1,81 @@
# Please edit this list and import only required elements
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, removechild, getchildren, make_autoname, SuperDocType
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 `tabTicket` 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 cstr(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,510 @@
[
{
'_last_update': '1300962490',
'allow_attach': None,
'allow_copy': None,
'allow_email': None,
'allow_print': None,
'allow_rename': None,
'allow_trash': None,
'autoname': 'TimeSheet.#####',
'change_log': None,
'client_script': None,
'client_script_core': None,
'client_string': None,
'colour': 'White:FFF',
'creation': '2010-12-14 10:33:07',
'description': None,
'docstatus': 0,
'doctype': 'DocType',
'document_type': None,
'dt_template': None,
'hide_heading': None,
'hide_toolbar': None,
'idx': None,
'in_create': None,
'in_dialog': None,
'is_transaction_doc': None,
'issingle': None,
'istable': None,
'max_attachments': None,
'menu_index': None,
'modified': '2011-03-05 17:16:43',
'modified_by': 'Administrator',
'module': 'Projects',
'name': 'Timesheet',
'name_case': None,
'owner': 'ashwini@webnotestech.com',
'parent': None,
'parent_node': None,
'parentfield': None,
'parenttype': None,
'print_outline': None,
'read_only': None,
'read_only_onload': None,
'search_fields': 'status, owner, timesheet_date',
'section_style': 'Simple',
'server_code': None,
'server_code_compiled': None,
'server_code_core': None,
'server_code_error': ' ',
'show_in_menu': None,
'smallicon': None,
'subject': '%(owner)s',
'tag_fields': '',
'use_template': None,
'version': 68
},
{
'amend': 1,
'cancel': 1,
'create': 1,
'creation': '2010-12-23 11:48:49',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': None,
'match': None,
'modified': '2010-12-23 11:48:49',
'modified_by': 'Administrator',
'name': 'PERM00769',
'owner': 'Administrator',
'parent': 'Timesheet',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'Projects User',
'submit': 1,
'write': 1
},
{
'amend': None,
'cancel': None,
'create': None,
'creation': '2010-12-23 11:48:49',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': None,
'match': None,
'modified': '2010-12-23 11:48:49',
'modified_by': 'Administrator',
'name': 'PERM00770',
'owner': 'Administrator',
'parent': 'Timesheet',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 1,
'read': 1,
'role': 'Projects User',
'submit': None,
'write': None
},
{
'amend': 1,
'cancel': 1,
'create': 1,
'creation': '2010-12-14 10:33:07',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 1,
'match': None,
'modified': '2010-12-14 10:33:07',
'modified_by': 'Administrator',
'name': 'PERM00739',
'owner': 'ashwini@webnotestech.com',
'parent': 'Timesheet',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'Administrator',
'submit': 1,
'write': 1
},
{
'amend': None,
'cancel': None,
'create': None,
'creation': '2010-12-14 10:33:07',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 2,
'match': None,
'modified': '2010-12-14 10:33:07',
'modified_by': 'Administrator',
'name': 'PERM00740',
'owner': 'ashwini@webnotestech.com',
'parent': 'Timesheet',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 1,
'read': 1,
'role': 'Administrator',
'submit': None,
'write': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-03-05 17:16:42',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Section Break',
'hidden': None,
'icon': None,
'idx': 1,
'in_filter': None,
'label': 'Timesheet Details',
'modified': '2011-03-05 17:16:42',
'modified_by': 'Administrator',
'name': 'FL04673',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Timesheet',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2010-12-14 10:33:07',
'default': 'Draft',
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'status',
'fieldtype': 'Select',
'hidden': None,
'icon': None,
'idx': 2,
'in_filter': 0,
'label': 'Status',
'modified': '2010-12-14 10:33:07',
'modified_by': 'Administrator',
'name': 'FL04235',
'no_column': None,
'no_copy': None,
'oldfieldname': 'status',
'oldfieldtype': 'Select',
'options': '\nDraft\nSubmitted\nCancelled',
'owner': 'ashwini@webnotestech.com',
'parent': 'Timesheet',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 1,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': 1,
'trigger': '',
'width': None
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2010-12-14 10:33:07',
'default': 'Today',
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'timesheet_date',
'fieldtype': 'Date',
'hidden': None,
'icon': None,
'idx': 3,
'in_filter': 1,
'label': 'Timesheet Date',
'modified': '2010-12-14 10:33:07',
'modified_by': 'Administrator',
'name': 'FL04236',
'no_column': None,
'no_copy': None,
'oldfieldname': 'timesheet_date',
'oldfieldtype': 'Date',
'options': None,
'owner': 'ashwini@webnotestech.com',
'parent': 'Timesheet',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': 1,
'trigger': '',
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-12-14 10:33:07',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'owner',
'fieldtype': 'Link',
'hidden': None,
'icon': None,
'idx': 4,
'in_filter': 1,
'label': 'Timesheet By',
'modified': '2010-12-14 10:33:07',
'modified_by': 'Administrator',
'name': 'FL04237',
'no_column': None,
'no_copy': None,
'oldfieldname': 'owner',
'oldfieldtype': 'Link',
'options': 'Profile',
'owner': 'ashwini@webnotestech.com',
'parent': 'Timesheet',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-12-14 10:33:07',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'amended_from',
'fieldtype': 'Data',
'hidden': 1,
'icon': None,
'idx': 5,
'in_filter': None,
'label': 'Amended From',
'modified': '2010-12-14 10:33:07',
'modified_by': 'Administrator',
'name': 'FL04238',
'no_column': None,
'no_copy': None,
'oldfieldname': 'amended_from',
'oldfieldtype': 'Data',
'options': None,
'owner': 'ashwini@webnotestech.com',
'parent': 'Timesheet',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 1,
'print_hide': 1,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-12-14 10:33:07',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'amendment_date',
'fieldtype': 'Date',
'hidden': 1,
'icon': None,
'idx': 6,
'in_filter': None,
'label': 'Amendment Date',
'modified': '2010-12-14 10:33:07',
'modified_by': 'Administrator',
'name': 'FL04239',
'no_column': None,
'no_copy': None,
'oldfieldname': 'amendment_date',
'oldfieldtype': 'Date',
'options': None,
'owner': 'ashwini@webnotestech.com',
'parent': 'Timesheet',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 1,
'print_hide': 1,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-03-05 17:16:42',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Column Break',
'hidden': None,
'icon': None,
'idx': 7,
'in_filter': None,
'label': None,
'modified': '2011-03-05 17:16:42',
'modified_by': 'Administrator',
'name': 'FL04674',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Timesheet',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-03-05 17:16:42',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'notes',
'fieldtype': 'Text',
'hidden': None,
'icon': None,
'idx': 8,
'in_filter': None,
'label': 'Notes',
'modified': '2011-03-05 17:16:42',
'modified_by': 'Administrator',
'name': 'FL04672',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Timesheet',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-03-05 17:16:42',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Section Break',
'hidden': None,
'icon': None,
'idx': 9,
'in_filter': None,
'label': None,
'modified': '2011-03-05 17:16:42',
'modified_by': 'Administrator',
'name': 'FL04675',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': 'Simple',
'owner': 'Administrator',
'parent': 'Timesheet',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-12-14 10:33:07',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'timesheet_details',
'fieldtype': 'Table',
'hidden': None,
'icon': None,
'idx': 10,
'in_filter': None,
'label': 'Timesheet Details',
'modified': '2010-12-14 10:33:07',
'modified_by': 'Administrator',
'name': 'FL04240',
'no_column': None,
'no_copy': None,
'oldfieldname': 'timesheet_details',
'oldfieldtype': 'Table',
'options': 'Timesheet Detail',
'owner': 'ashwini@webnotestech.com',
'parent': 'Timesheet',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
}
]

View File

@@ -0,0 +1,370 @@
[
{
'allow_attach': None,
'allow_copy': None,
'allow_email': None,
'allow_print': None,
'allow_rename': None,
'allow_trash': None,
'autoname': 'TSD.#####',
'change_log': None,
'client_script': None,
'client_script_core': None,
'client_string': None,
'colour': 'White:FFF',
'creation': '2011-02-26 11:39:45',
'description': None,
'docstatus': 0,
'doctype': 'DocType',
'document_type': None,
'dt_template': None,
'hide_heading': None,
'hide_toolbar': None,
'idx': None,
'in_create': None,
'in_dialog': None,
'is_transaction_doc': None,
'issingle': None,
'istable': None,
'max_attachments': None,
'menu_index': None,
'modified': '2011-02-26 11:39:45',
'modified_by': 'Guest',
'module': 'Projects',
'name': 'Timesheet Detail',
'name_case': None,
'owner': 'Administrator',
'parent': None,
'parent_node': None,
'parentfield': None,
'parenttype': None,
'print_outline': None,
'read_only': None,
'read_only_onload': None,
'search_fields': None,
'section_style': 'Simple',
'server_code': None,
'server_code_compiled': None,
'server_code_core': None,
'server_code_error': ' ',
'show_in_menu': None,
'smallicon': None,
'use_template': None,
'version': 15
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-02-26 11:39:45',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'act_start_time',
'fieldtype': 'Time',
'hidden': None,
'icon': None,
'idx': 1,
'in_filter': None,
'label': 'Actual Start Time',
'modified': '2011-02-26 11:39:45',
'modified_by': 'Guest',
'name': 'FL04246',
'no_copy': None,
'oldfieldname': 'act_start_time',
'oldfieldtype': 'Time',
'options': None,
'owner': 'ashwini@webnotestech.com',
'parent': 'Timesheet Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': None,
'trigger': None,
'width': '160px'
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-02-26 11:39:45',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'act_end_time',
'fieldtype': 'Time',
'hidden': None,
'icon': None,
'idx': 2,
'in_filter': None,
'label': 'Actual End Time',
'modified': '2011-02-26 11:39:45',
'modified_by': 'Guest',
'name': 'FL04247',
'no_copy': None,
'oldfieldname': 'act_end_time',
'oldfieldtype': 'Time',
'options': None,
'owner': 'ashwini@webnotestech.com',
'parent': 'Timesheet Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': None,
'trigger': None,
'width': '160px'
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-02-26 11:39:45',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'activity_type',
'fieldtype': 'Link',
'hidden': None,
'icon': None,
'idx': 3,
'in_filter': None,
'label': 'Activity Type',
'modified': '2011-02-26 11:39:45',
'modified_by': 'Guest',
'name': 'FL04248',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': 'Activity Type',
'owner': 'Administrator',
'parent': 'Timesheet Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': None,
'trigger': None,
'width': '200px'
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-02-26 11:39:45',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'other_details',
'fieldtype': 'Text',
'hidden': None,
'icon': None,
'idx': 4,
'in_filter': None,
'label': 'Additional Info',
'modified': '2011-02-26 11:39:45',
'modified_by': 'Guest',
'name': 'FL04249',
'no_copy': None,
'oldfieldname': 'other_details',
'oldfieldtype': 'Text',
'options': None,
'owner': 'ashwini@webnotestech.com',
'parent': 'Timesheet Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': '200px'
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-02-26 11:39:45',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'act_total_hrs',
'fieldtype': 'Data',
'hidden': None,
'icon': None,
'idx': 5,
'in_filter': None,
'label': 'Total Hours (Actual)',
'modified': '2011-02-26 11:39:45',
'modified_by': 'Guest',
'name': 'FL04250',
'no_copy': None,
'oldfieldname': 'act_total_hrs',
'oldfieldtype': 'Data',
'options': None,
'owner': 'ashwini@webnotestech.com',
'parent': 'Timesheet Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 1,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': '100px'
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-02-26 11:39:45',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'customer_name',
'fieldtype': 'Link',
'hidden': None,
'icon': None,
'idx': 6,
'in_filter': None,
'label': 'Customer Name',
'modified': '2011-02-26 11:39:45',
'modified_by': 'Guest',
'name': 'FL04251',
'no_copy': None,
'oldfieldname': 'customer_name',
'oldfieldtype': 'Data',
'options': 'Customer',
'owner': 'ashwini@webnotestech.com',
'parent': 'Timesheet Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': '150px'
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-02-26 11:39:45',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'project_name',
'fieldtype': 'Link',
'hidden': None,
'icon': None,
'idx': 7,
'in_filter': 1,
'label': 'Project',
'modified': '2011-02-26 11:39:45',
'modified_by': 'Guest',
'name': 'FL04252',
'no_copy': None,
'oldfieldname': 'project_name',
'oldfieldtype': 'Link',
'options': 'Project',
'owner': 'ashwini@webnotestech.com',
'parent': 'Timesheet Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 0,
'search_index': 1,
'trigger': None,
'width': '150px'
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-02-26 11:39:45',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'task_id',
'fieldtype': 'Link',
'hidden': None,
'icon': None,
'idx': 8,
'in_filter': 1,
'label': 'Task Id',
'modified': '2011-02-26 11:39:45',
'modified_by': 'Guest',
'name': 'FL04253',
'no_copy': None,
'oldfieldname': 'task_id',
'oldfieldtype': 'Link',
'options': 'Ticket',
'owner': 'ashwini@webnotestech.com',
'parent': 'Timesheet Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': 1,
'trigger': None,
'width': '150px'
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-02-26 11:39:45',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'task_name',
'fieldtype': 'Link',
'hidden': None,
'icon': None,
'idx': 9,
'in_filter': None,
'label': 'Task Name',
'modified': '2011-02-26 11:39:45',
'modified_by': 'Guest',
'name': 'FL04254',
'no_copy': None,
'oldfieldname': 'task_name',
'oldfieldtype': 'Link',
'options': None,
'owner': 'ashwini@webnotestech.com',
'parent': 'Timesheet Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 0,
'search_index': 0,
'trigger': None,
'width': '250px'
}
]

View File

View File

View File

@@ -0,0 +1,29 @@
pscript.queries_bg_dict={'Urgent':'RED','High':'ORANGE','Low':'BLUE','Closed':'GREEN','Pending Review':'YELLOW'}
pscript.onload_Projects=function(){var d=$i('projects_div');new PageHeader(d,'Gantt Chart');new GanttChart($a(d,'div','',{margin:'16px'}));}
GanttChart=function(parent){this.wrapper=$a(parent,'div');this.toolbar_area=$a(this.wrapper,'div','',{padding:'16px',border:'1px solid #AAF',});$bg(this.toolbar_area,'#EEF');$br(this.toolbar_area,'3px');this.toolbar_tab=make_table(this.toolbar_area,1,4,'100%',['25%','25%','25%','25%']);this.grid_area=$a(this.wrapper,'div','',{margin:'16px 0px'});this.no_task_message=$a(this.wrapper,'div','help_box',{textAign:'center',fontSize:'14px'},'Select your criteria and click on "Make" to show the Gantt Chart')
this.get_init_data();}
GanttChart.prototype.get_init_data=function(){var me=this;var callback=function(r,rt){me.pl=r.message.pl.sort();me.rl=r.message.rl.sort();me.make_toolbar();}
$c_obj('Project Control','get_init_data','',callback);}
GanttChart.prototype.make_filter=function(label,idx){var w=$a($td(this.toolbar_tab,0,idx),'div','',{marginBottom:'8px'});var l=$a(w,'div','',{fontSize:'11px'});l.innerHTML=label;return w;}
GanttChart.prototype.make_select=function(label,options,idx){var w=this.make_filter(label,idx);var s=$a(w,'select','',{width:'100px'});add_sel_options(s,add_lists(['All'],options));return s;}
GanttChart.prototype.make_date=function(label,idx){var w=this.make_filter(label,idx);var i=$a(w,'input');var user_fmt=locals['Control Panel']['Control Panel'].date_format;if(!this.user_fmt)this.user_fmt='dd-mm-yy';$(i).datepicker({dateFormat:user_fmt.replace('yyyy','yy'),altFormat:'yy-mm-dd',changeYear:true});return i;}
GanttChart.prototype.make_toolbar=function(){this.r_sel=this.make_select('Resource',this.rl,0);this.p_sel=this.make_select('Project',this.pl,1);this.s_date=this.make_date('Start Date',2);this.s_date.value=date.str_to_user(date.month_start());this.e_date=this.make_date('End Date',3);this.e_date.value=date.str_to_user(date.month_end());var me=this;$btn(this.toolbar_area,'Make',function(){me.refresh();},null,'green',1);this.print_btn=$btn(this.toolbar_area,'Print',function(){me.print();},{display:'none'},null);}
GanttChart.prototype.print=function(){$(this.grid_area).printElement();}
GanttChart.prototype.get_data=function(){var me=this;var callback=function(r,rt){me.tasks=r.message;if(me.tasks.length){$dh(me.no_task_message);$ds(me.grid_area);me.show_tasks();$di(me.print_btn);}else{$dh(me.grid_area);$ds(me.no_task_message);$dh(me.print_btn);me.no_task_message.innerHTML='Nothing allocated for the above criteria'}}
$c_obj('Project Control','get_tasks',[date.user_to_str(this.s_date.value),date.user_to_str(this.e_date.value),sel_val(this.p_sel),sel_val(this.r_sel)].join('~~~'),callback)}
GanttChart.prototype.make_grid=function(){this.grid_area.innerHTML='';this.grid=new GanttGrid(this,this.s_date.value,this.e_date.value);}
GanttChart.prototype.refresh=function(){this.get_data();}
GanttChart.prototype.show_tasks=function(){this.make_grid();for(var i=0;i<this.tasks.length;i++){new GanttTask(this.grid,this.tasks[i],i)}}
GanttGrid=function(chart,s_date,e_date){this.chart=chart;this.s_date=s_date;this.wrapper=$a(chart.grid_area,'div');this.start_date=date.str_to_obj(date.user_to_str(s_date));this.end_date=date.str_to_obj(date.user_to_str(e_date));this.n_days=date.get_diff(this.end_date,this.start_date)+1;this.g_width=100/this.n_days+'%';this.make();}
GanttGrid.prototype.make_grid=function(){var ht=this.chart.tasks.length*40+'px';this.grid=$a($td(this.body,0,1),'div','',{border:'2px solid #888',height:ht,position:'relative'});this.grid_tab=make_table(this.grid,1,this.n_days,'100%',[],{width:this.g_width,borderLeft:'1px solid #DDD',height:ht});$y(this.grid_tab,{tableLayout:'fixed'});this.task_area=$a(this.grid,'div','',{position:'absolute',height:ht,width:'100%',top:'0px'});}
GanttGrid.prototype.make_labels=function(){this.x_labels=$a($td(this.body,0,1),'div','',{marginTop:'8px'});this.x_lab_tab=make_table(this.x_labels,1,this.n_days,'100%',[],{width:this.g_width,fontSize:'10px'});$y(this.x_lab_tab,{tableLayout:'fixed'});var d=this.start_date;var today=new Date();for(var i=0;i<this.n_days;i++){if(d.getDay()==0){$td(this.x_lab_tab,0,i).innerHTML=d.getDate()+'-'+month_list[d.getMonth()];$y($td(this.grid_tab,0,i),{borderLeft:'1px solid RED'})}
if(d.getDate()==today.getDate()&&d.getMonth()==today.getMonth()&&d.getYear()==today.getYear()){$y($td(this.grid_tab,0,i),{borderLeft:'2px solid #000'})}
var d=date.add_days(this.start_date,1);}
this.start_date=date.str_to_obj(date.user_to_str(this.s_date));}
GanttGrid.prototype.make=function(){this.body=make_table(this.wrapper,1,2,'100%',['30%','70%']);this.make_grid();this.make_labels();this.y_labels=$a($td(this.body,0,0),'div','',{marginTop:'2px',position:'relative'});}
GanttGrid.prototype.get_x=function(dt){var d=date.str_to_obj(dt);return flt(date.get_diff(d,this.start_date)+1)/flt(date.get_diff(this.end_date,this.start_date)+1)*100;}
GanttTask=function(grid,data,idx){this.start_date=data[3];this.end_date=data[4];this.label=$a(grid.y_labels,'div','',{'top':(idx*40)+'px',overflow:'hidden',position:'absolute','width':'100%',height:'40px'});var l1=$a($a(this.label,'div'),'span','link_type');l1.innerHTML=data[0];l1.dn=data[7];l1.onclick=function(){loaddoc('Ticket',this.dn)};var l2=$a(this.label,'div','',{fontSize:'10px'});l2.innerHTML=data[1];var col=pscript.queries_bg_dict[data[5]];if(data[6]!='Open')col=pscript.queries_bg_dict[data[6]];if(!col)col='BLUE';this.body=$a(grid.task_area,'div','',{backgroundColor:col,height:'12px',position:'absolute'});this.body_info=$a(this.body,'div','',{backgroundColor:'#CCC',position:'absolute',zIndex:20});var x1=grid.get_x(this.start_date);var x2=grid.get_x(this.end_date);if(x1<=0)x1=0;else x1-=100/flt(date.get_diff(grid.end_date,grid.start_date)+1);if(x2>=100)x2=100;$y(this.body,{top:idx*40+14+'px',left:x1+'%',width:(x2-x1)+'%',zIndex:1,cursor:'pointer'})
if(idx){var d1=$a(grid.task_area,'div','',{borderBottom:'1px solid #AAA',position:'absolute',width:'100%',top:(idx*40)+'px'});var d2=$a(grid.y_labels,'div','',{borderBottom:'1px solid #AAA',position:'absolute',width:'100%',top:(idx*40)+'px'});}
this.make_tooltip(data);}
GanttTask.prototype.make_tooltip=function(d){var t='<div>';if(d[0])t+='<b>Task: </b>'+d[0];if(d[5])t+='<br><b>Priority: </b>'+d[5];if(d[6])t+='<br><b>Status: </b>'+d[6];if(d[1])t+='<br><b>Allocated To: </b>'+d[1];if(d[2])t+='<br><b>Project: </b>'+d[2];if(d[3])t+='<br><b>From: </b>'+date.str_to_user(d[3]);if(d[4])t+='<br><b>To: </b>'+date.str_to_user(d[4]);t+='</div>';$(this.body).qtip({content:t,position:{corner:{tooltip:'topMiddle',target:'bottomMiddle'}},style:{border:{width:5,radius:10},padding:10,tip:true,name:'green'}})}

View File

@@ -0,0 +1 @@
<div id="projects_div" class="layout_wrapper"></div>

View File

@@ -0,0 +1,276 @@
pscript.queries_bg_dict = {
'Urgent':'RED',
'High':'ORANGE',
'Low':'BLUE',
'Closed':'GREEN',
'Pending Review':'YELLOW'
}
pscript.onload_Projects = function() {
var d = $i('projects_div');
new PageHeader(d, 'Gantt Chart');
new GanttChart($a(d, 'div', '', { margin:'16px'}));
}
// Gantt Chart
// ==========================================================================
GanttChart = function(parent) {
this.wrapper = $a(parent, 'div');
//this.head = new PageHeader(this.wrapper, 'Gantt Chart');
this.toolbar_area = $a(this.wrapper, 'div','',{padding:'16px', border:'1px solid #AAF', }); $bg(this.toolbar_area, '#EEF'); $br(this.toolbar_area, '3px');
this.toolbar_tab = make_table(this.toolbar_area, 1, 4, '100%', ['25%', '25%','25%', '25%']);
this.grid_area = $a(this.wrapper, 'div', '', {margin: '16px 0px'});
this.no_task_message = $a(this.wrapper, 'div', 'help_box',
{textAign:'center', fontSize:'14px'}, 'Select your criteria and click on "Make" to show the Gantt Chart')
this.get_init_data();
//this.make_grid();
}
GanttChart.prototype.get_init_data = function() {
var me = this;
var callback = function(r,rt) {
me.pl = r.message.pl.sort();
me.rl = r.message.rl.sort();
me.make_toolbar();
}
$c_obj('Project Control','get_init_data','', callback);
}
GanttChart.prototype.make_filter = function(label, idx) {
var w = $a($td(this.toolbar_tab,0,idx), 'div','',{marginBottom:'8px'});
var l = $a(w, 'div','',{fontSize:'11px'}); l.innerHTML = label;
return w;
}
GanttChart.prototype.make_select = function(label, options,idx) {
var w = this.make_filter(label,idx);
var s = $a(w, 'select','',{width:'100px'}); add_sel_options(s, add_lists(['All'],options));
return s;
}
GanttChart.prototype.make_date = function(label,idx) {
var w = this.make_filter(label,idx);
var i = $a(w, 'input');
var user_fmt = locals['Control Panel']['Control Panel'].date_format;
if(!this.user_fmt)this.user_fmt = 'dd-mm-yy';
$(i).datepicker({
dateFormat: user_fmt.replace('yyyy','yy'),
altFormat:'yy-mm-dd',
changeYear: true
});
return i;
}
GanttChart.prototype.make_toolbar = function() {
// resource / project
this.r_sel = this.make_select('Resource', this.rl, 0);
this.p_sel = this.make_select('Project', this.pl, 1);
// start / end
this.s_date = this.make_date('Start Date', 2); this.s_date.value = date.str_to_user(date.month_start());
this.e_date = this.make_date('End Date', 3); this.e_date.value = date.str_to_user(date.month_end());
// button
var me = this;
$btn(this.toolbar_area, 'Make', function() { me.refresh(); }, null, 'green', 1);
this.print_btn = $btn(this.toolbar_area, 'Print', function() { me.print(); }, {display:'none'},null);
}
GanttChart.prototype.print = function() {
$(this.grid_area).printElement();
}
GanttChart.prototype.get_data = function() {
var me = this;
var callback = function(r, rt) {
me.tasks = r.message;
if(me.tasks.length) {
$dh(me.no_task_message);
$ds(me.grid_area);
me.show_tasks();
$di(me.print_btn);
} else {
// nothign to show
$dh(me.grid_area);
$ds(me.no_task_message);
$dh(me.print_btn);
me.no_task_message.innerHTML = 'Nothing allocated for the above criteria'
}
}
$c_obj('Project Control','get_tasks',
[date.user_to_str(this.s_date.value),
date.user_to_str(this.e_date.value),
sel_val(this.p_sel),
sel_val(this.r_sel)].join('~~~')
, callback)
}
GanttChart.prototype.make_grid = function() {
// clear earlier chart
this.grid_area.innerHTML = '';
this.grid = new GanttGrid(this, this.s_date.value, this.e_date.value);
}
GanttChart.prototype.refresh = function() {
this.get_data();
}
GanttChart.prototype.show_tasks = function() {
this.make_grid();
for(var i=0; i<this.tasks.length; i++) {
new GanttTask(this.grid, this.tasks[i], i)
}
}
// ==========================================================================
GanttGrid = function(chart, s_date, e_date) {
this.chart = chart;
this.s_date = s_date;
this.wrapper = $a(chart.grid_area, 'div');
this.start_date = date.str_to_obj(date.user_to_str(s_date));
this.end_date = date.str_to_obj(date.user_to_str(e_date));
this.n_days = date.get_diff(this.end_date, this.start_date) + 1;
this.g_width = 100 / this.n_days + '%';
this.make();
}
GanttGrid.prototype.make_grid = function() {
// grid -----------
var ht = this.chart.tasks.length * 40 + 'px';
this.grid = $a($td(this.body, 0, 1), 'div', '', {border:'2px solid #888', height: ht, position:'relative'});
this.grid_tab = make_table(this.grid, 1, this.n_days, '100%', [], {width:this.g_width, borderLeft:'1px solid #DDD', height: ht});
$y(this.grid_tab,{tableLayout:'fixed'});
this.task_area = $a(this.grid, 'div', '', {position:'absolute', height:ht, width: '100%', top:'0px'});
}
GanttGrid.prototype.make_labels = function() {
// labels ------------
this.x_labels = $a($td(this.body, 0, 1), 'div', '', {marginTop:'8px'});
this.x_lab_tab = make_table(this.x_labels, 1, this.n_days, '100%', [], {width:this.g_width, fontSize:'10px'});
$y(this.x_lab_tab,{tableLayout:'fixed'});
var d = this.start_date;
var today = new Date();
for(var i=0; i<this.n_days; i++) {
if(d.getDay()==0) {
$td(this.x_lab_tab,0,i).innerHTML = d.getDate() + '-' + month_list[d.getMonth()];
$y($td(this.grid_tab,0,i),{borderLeft:'1px solid RED'})
}
if(d.getDate()==today.getDate() && d.getMonth()==today.getMonth() && d.getYear() == today.getYear()) {
$y($td(this.grid_tab,0,i),{borderLeft:'2px solid #000'})
}
var d = date.add_days(this.start_date, 1);
}
this.start_date = date.str_to_obj(date.user_to_str(this.s_date));
}
GanttGrid.prototype.make = function() {
this.body = make_table(this.wrapper, 1, 2, '100%', ['30%','70%']);
this.make_grid();
this.make_labels();
this.y_labels = $a($td(this.body, 0, 0), 'div', '', {marginTop:'2px', position:'relative'});
}
GanttGrid.prototype.get_x = function(dt) {
var d = date.str_to_obj(dt); // convert to obj
return flt(date.get_diff(d, this.start_date)+1) / flt(date.get_diff(this.end_date, this.start_date)+1) * 100;
}
// ==========================================================================
GanttTask = function(grid, data, idx) {
// start_date, end_date, name, status
this.start_date = data[3];
this.end_date = data[4];
// label
this.label = $a(grid.y_labels, 'div', '', {'top':(idx*40) + 'px', overflow:'hidden', position:'absolute', 'width':'100%', height: '40px'});
var l1 = $a($a(this.label, 'div'), 'span', 'link_type'); l1.innerHTML = data[0]; l1.dn = data[7]; l1.onclick = function() { loaddoc('Ticket', this.dn) };
var l2 = $a(this.label, 'div', '', {fontSize:'10px'}); l2.innerHTML = data[1];
// bar
var col = pscript.queries_bg_dict[data[5]];
if(data[6]!='Open') col = pscript.queries_bg_dict[data[6]];
if(!col) col = 'BLUE';
this.body = $a(grid.task_area, 'div','',{backgroundColor:col, height:'12px', position:'absolute'});
//bar info
this.body_info = $a(this.body, 'div','',{backgroundColor:'#CCC', position:'absolute', zIndex:20});
var x1 = grid.get_x(this.start_date);
var x2 = grid.get_x(this.end_date);
if(x1<=0)x1=0;
else x1 -=100/flt(date.get_diff(grid.end_date, grid.start_date)+1);
if(x2>=100)x2=100;
// else x2+=100/flt(date.get_diff(grid.end_date, grid.start_date)+1);
$y(this.body, {
top: idx * 40 + 14 + 'px',
left: x1 + '%',
width: (x2-x1) + '%',
zIndex: 1,
cursor:'pointer'
})
// divider
if(idx) {
var d1 = $a(grid.task_area, 'div','',{borderBottom: '1px solid #AAA', position:'absolute', width:'100%', top:(idx*40) + 'px'});
var d2 = $a(grid.y_labels, 'div','',{borderBottom: '1px solid #AAA', position:'absolute', width:'100%', top:(idx*40) + 'px'});
}
this.make_tooltip(data);
}
GanttTask.prototype.make_tooltip = function(d) {
var t = '<div>';
if(d[0]) t += '<b>Task: </b>' + d[0];
if(d[5]) t += '<br><b>Priority: </b>' + d[5];
if(d[6]) t += '<br><b>Status: </b>' + d[6];
if(d[1]) t += '<br><b>Allocated To: </b>' + d[1];
if(d[2]) t += '<br><b>Project: </b>' + d[2];
if(d[3]) t += '<br><b>From: </b>' + date.str_to_user(d[3]);
if(d[4]) t += '<br><b>To: </b>' + date.str_to_user(d[4]);
t += '</div>';
$(this.body).qtip({
content:t,
position:{
corner:{
tooltip: 'topMiddle', // Use the corner...
target: 'bottomMiddle' // ...and opposite corner
}
},
style:{
border: {
width: 5,
radius: 10
},
padding: 10,
tip: true, // Give it a speech bubble tip with automatic corner detection
name: 'green' // Style it according to the preset 'cream' style
}
})
}

View File

@@ -0,0 +1 @@
[{'creation': '2010-07-13 14:54:32', 'module': 'Projects', 'doctype': 'Page', 'owner': 'Administrator', 'style': None, 'modified_by': 'ashwini@webnotestech.com', 'script': None, 'show_in_menu': None, 'content': None, 'page_name': 'Projects', 'menu_index': None, 'docstatus': 0, 'parent': None, 'standard': 'Yes', 'icon': None, 'name': 'Projects', 'idx': None, 'static_content': None, 'modified': '2010-11-26 09:46:09', 'parenttype': None, 'parent_node': None, 'parentfield': None}]

View File

@@ -0,0 +1 @@
Projects

View File

View File

@@ -0,0 +1,5 @@
report.customize_filters = function() {
this.mytabs.items['Select Columns'].hide()
//this.mytabs.items['More Filters'].hide()
//this.hide_all_filters();
}

View File

@@ -0,0 +1,37 @@
[
{
'add_col': None,
'add_cond': None,
'add_tab': None,
'columns': 'Delivery Note\x01ID,Delivery Note\x01Project Name,Delivery Note\x01Customer,Delivery Note\x01Customer Name,Delivery Note\x01Posting Date,Delivery Note Detail\x01Item Code,Delivery Note Detail\x01Item Name,Delivery Note Detail\x01Quantity,Delivery Note Detail\x01Amount*',
'creation': '2010-12-14 10:33:09',
'criteria_name': 'Dispatch Report',
'custom_query': '',
'description': None,
'dis_filters': None,
'disabled': None,
'doc_type': 'Delivery Note Detail',
'docstatus': 0,
'doctype': 'Search Criteria',
'filters': "{'Delivery Note\x01Saved':1,'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'Submitted','Delivery Note\x01Fiscal Year':''}",
'graph_series': None,
'graph_values': None,
'group_by': None,
'idx': None,
'modified': '2010-11-05 20:34:19',
'modified_by': 'Administrator',
'module': 'Projects',
'name': 'dispatch_report',
'owner': 'ashwini@webnotestech.com',
'page_len': 50,
'parent': None,
'parent_doc_type': 'Delivery Note',
'parentfield': None,
'parenttype': None,
'report_script': None,
'server_script': None,
'sort_by': '`tabDelivery Note`.`name`',
'sort_order': 'DESC',
'standard': 'Yes'
}
]

View File

@@ -0,0 +1,16 @@
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 Detail'});
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,37 @@
[
{
'add_col': None,
'add_cond': 'IFNULL(`tabDelivery Note`.`project_name`,"")!=""',
'add_tab': None,
'columns': 'Delivery Note\x01ID,Delivery Note\x01Project Name,Delivery Note\x01Customer,Delivery Note\x01Customer Name,Delivery Note\x01% Billed,Delivery Note\x01% Installed,Delivery Note Detail\x01Item Code,Delivery Note Detail\x01Item Name,Delivery Note Detail\x01Quantity,Delivery Note Detail\x01Amount*',
'creation': '2010-12-14 10:33:09',
'criteria_name': 'Projectwise Delivered Qty and Costs',
'custom_query': '',
'description': None,
'dis_filters': None,
'disabled': None,
'doc_type': 'Delivery Note Detail',
'docstatus': 0,
'doctype': 'Search Criteria',
'filters': "{'Delivery Note\x01Saved':1,'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'Submitted','Delivery Note\x01Fiscal Year':''}",
'graph_series': None,
'graph_values': None,
'group_by': None,
'idx': None,
'modified': '2010-11-05 20:33:28',
'modified_by': 'Administrator',
'module': 'Projects',
'name': 'projectwise_delivered_qty_and_costs',
'owner': 'ashwini@webnotestech.com',
'page_len': 50,
'parent': None,
'parent_doc_type': 'Delivery Note',
'parentfield': None,
'parenttype': None,
'report_script': None,
'server_script': None,
'sort_by': '`tabDelivery Note`.`name`',
'sort_order': 'DESC',
'standard': 'Yes'
}
]

View File

@@ -0,0 +1,16 @@
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 Detail'});
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,37 @@
[
{
'add_col': None,
'add_cond': 'IFNULL(`tabDelivery Note`.`project_name`,"")!=""',
'add_tab': None,
'columns': 'Delivery Note\x01ID,Delivery Note\x01Project Name,Delivery Note\x01Customer,Delivery Note\x01Customer Name,Delivery Note Detail\x01Item Code,Delivery Note Detail\x01Item Name,Delivery Note Detail\x01Quantity,Delivery Note\x01Posting Date,Delivery Note\x01% Billed,Delivery Note Detail\x01Amount*',
'creation': '2010-09-01 15:47:57',
'criteria_name': 'Projectwise Delivered Qty and Costs1',
'custom_query': '',
'description': None,
'dis_filters': None,
'disabled': None,
'doc_type': 'Delivery Note Detail',
'docstatus': 0,
'doctype': 'Search Criteria',
'filters': "{'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'Submitted','Delivery Note\x01Fiscal Year':''}",
'graph_series': None,
'graph_values': None,
'group_by': None,
'idx': None,
'modified': '2011-05-09 11:21:55',
'modified_by': 'Administrator',
'module': 'Projects',
'name': 'projectwise_delivered_qty_and_costs1',
'owner': 'harshada@webnotestech.com',
'page_len': 50,
'parent': None,
'parent_doc_type': 'Delivery Note',
'parentfield': None,
'parenttype': None,
'report_script': None,
'server_script': None,
'sort_by': '`tabDelivery Note`.`name`',
'sort_order': 'DESC',
'standard': 'Yes'
}
]

View File

@@ -0,0 +1,37 @@
[
{
'add_col': None,
'add_cond': 'IFNULL(`tabDelivery Note`.`project_name`,"")!=""',
'add_tab': None,
'columns': 'Delivery Note\x01ID,Delivery Note\x01Project Name,Delivery Note\x01Customer,Delivery Note\x01Customer Name,Delivery Note Detail\x01Item Code,Delivery Note Detail\x01Item Name,Delivery Note Detail\x01Quantity,Delivery Note\x01Posting Date,Delivery Note\x01% Billed,Delivery Note Detail\x01Amount*',
'creation': '2010-12-14 10:33:09',
'criteria_name': 'Projectwise Delivered Qty and Costs2',
'custom_query': '',
'description': None,
'dis_filters': None,
'disabled': None,
'doc_type': 'Delivery Note Detail',
'docstatus': 0,
'doctype': 'Search Criteria',
'filters': "{'Delivery Note\x01Submitted':1,'Delivery Note\x01Status':'Submitted','Delivery Note\x01Fiscal Year':''}",
'graph_series': None,
'graph_values': None,
'group_by': None,
'idx': None,
'modified': '2011-05-09 11:22:05',
'modified_by': 'Administrator',
'module': 'Projects',
'name': 'projectwise_delivered_qty_and_costs2',
'owner': 'harshada@webnotestech.com',
'page_len': 50,
'parent': None,
'parent_doc_type': 'Delivery Note',
'parentfield': None,
'parenttype': None,
'report_script': '',
'server_script': None,
'sort_by': '`tabDelivery Note`.`name`',
'sort_order': 'DESC',
'standard': 'Yes'
}
]

View File

@@ -0,0 +1,15 @@
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 Detail'});
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,37 @@
[
{
'add_col': "SUM(`tabSales Order Detail`.`qty` - `tabSales Order Detail`.`delivered_qty`) AS 'Pending Qty'\nSUM((`tabSales Order Detail`.`qty` - `tabSales Order Detail`.`delivered_qty`)* `tabSales Order Detail`.basic_rate) AS 'Pending Amount'",
'add_cond': '`tabSales Order Detail`.`qty` > `tabSales Order Detail`.`delivered_qty`\nIFNULL(`tabSales Order`.`project_name`,"")!=""\n`tabSales Order`.order_type = \'Sales\'',
'add_tab': None,
'columns': 'Sales Order\x01ID,Sales Order\x01Project Name,Sales Order\x01Customer,Sales Order\x01Customer Name,Sales Order Detail\x01Item Code,Sales Order Detail\x01Item Name,Sales Order\x01% Delivered,Sales Order\x01% Billed,Sales Order\x01Sales Order Date,Sales Order\x01Expected Delivery Date',
'creation': '2010-12-14 10:33:09',
'criteria_name': 'Projectwise Pending Qty and Costs',
'custom_query': '',
'description': None,
'dis_filters': None,
'disabled': None,
'doc_type': 'Sales Order Detail',
'docstatus': 0,
'doctype': 'Search Criteria',
'filters': "{'Sales Order\x01Submitted':1,'Sales Order\x01Status':'Submitted','Sales Order\x01Fiscal Year':''}",
'graph_series': None,
'graph_values': None,
'group_by': None,
'idx': None,
'modified': '2010-08-30 14:21:20',
'modified_by': 'Administrator',
'module': 'Projects',
'name': 'projectwise_pending_qty_and_costs',
'owner': 'ashwini@webnotestech.com',
'page_len': 50,
'parent': None,
'parent_doc_type': 'Sales Order',
'parentfield': None,
'parenttype': None,
'report_script': None,
'server_script': '',
'sort_by': '`tabSales Order`.`name`',
'sort_order': 'DESC',
'standard': 'Yes'
}
]

View File

@@ -0,0 +1,15 @@
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 Detail'});
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,37 @@
[
{
'add_col': "SUM(`tabSales Order Detail`.`qty` - `tabSales Order Detail`.`delivered_qty`) AS 'Pending Qty'\nSUM((`tabSales Order Detail`.`qty` - `tabSales Order Detail`.`delivered_qty`)* `tabSales Order Detail`.basic_rate) AS 'Pending Amount'",
'add_cond': '`tabSales Order Detail`.`qty` > `tabSales Order Detail`.`delivered_qty`\nIFNULL(`tabSales Order`.`project_name`,"")!=""\n`tabSales Order`.order_type = \'Sales\'',
'add_tab': None,
'columns': 'Sales Order\x01ID,Sales Order\x01Project Name,Sales Order\x01Customer,Sales Order\x01Customer Name,Sales Order Detail\x01Item Code,Sales Order Detail\x01Item Name,Sales Order\x01% Delivered,Sales Order\x01% Billed,Sales Order\x01Sales Order Date,Sales Order\x01Expected Delivery Date',
'creation': '2010-09-01 15:47:57',
'criteria_name': 'Projectwise Pending Qty and Costs1',
'custom_query': '',
'description': None,
'dis_filters': None,
'disabled': None,
'doc_type': 'Sales Order Detail',
'docstatus': 0,
'doctype': 'Search Criteria',
'filters': "{'Sales Order\x01Submitted':1,'Sales Order\x01Status':'Submitted','Sales Order\x01Fiscal Year':''}",
'graph_series': None,
'graph_values': None,
'group_by': None,
'idx': None,
'modified': '2011-05-09 11:20:54',
'modified_by': 'Administrator',
'module': 'Projects',
'name': 'projectwise_pending_qty_and_costs1',
'owner': 'ashwini@webnotestech.com',
'page_len': 50,
'parent': None,
'parent_doc_type': 'Sales Order',
'parentfield': None,
'parenttype': None,
'report_script': None,
'server_script': None,
'sort_by': '`tabSales Order`.`name`',
'sort_order': 'DESC',
'standard': 'Yes'
}
]

View File

@@ -0,0 +1,15 @@
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 Detail'});
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,37 @@
[
{
'add_col': "SUM(`tabSales Order Detail`.`qty` - `tabSales Order Detail`.`delivered_qty`) AS 'Pending Qty'\nSUM((`tabSales Order Detail`.`qty` - `tabSales Order Detail`.`delivered_qty`)* `tabSales Order Detail`.basic_rate) AS 'Pending Amount'",
'add_cond': '`tabSales Order Detail`.`qty` > `tabSales Order Detail`.`delivered_qty`\nIFNULL(`tabSales Order`.`project_name`,"")!=""\n`tabSales Order`.order_type = \'Sales\'',
'add_tab': None,
'columns': 'Sales Order\x01ID,Sales Order\x01Project Name,Sales Order\x01Customer,Sales Order\x01Customer Name,Sales Order Detail\x01Item Code,Sales Order Detail\x01Item Name,Sales Order\x01% Delivered,Sales Order\x01% Billed,Sales Order Detail\x01Quantity,Sales Order Detail\x01Amount*',
'creation': '2010-12-14 10:33:09',
'criteria_name': 'Projectwise Pending Qty and Costs2',
'custom_query': '',
'description': None,
'dis_filters': None,
'disabled': None,
'doc_type': 'Sales Order Detail',
'docstatus': 0,
'doctype': 'Search Criteria',
'filters': "{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Status':'Submitted','Sales Order\x01Company':'Alpha Company','Sales Order\x01Fiscal Year':'2010-2011'}",
'graph_series': None,
'graph_values': None,
'group_by': '`tabSales Order Detail`.`name`',
'idx': None,
'modified': '2011-05-09 11:21:04',
'modified_by': 'Administrator',
'module': 'Projects',
'name': 'projectwise_pending_qty_and_costs2',
'owner': 'ashwini@webnotestech.com',
'page_len': 50,
'parent': None,
'parent_doc_type': 'Sales Order',
'parentfield': None,
'parenttype': None,
'report_script': None,
'server_script': None,
'sort_by': '`tabSales Order`.`name`',
'sort_order': 'DESC',
'standard': 'Yes'
}
]

View File

@@ -0,0 +1,92 @@
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 Detail` 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 `tabPayable Voucher` t1, `tabPV Detail` t2 WHERE '+cond +'IFNULL(t1.project_name,"") !="" AND t1.docstatus != 2 AND t1.name = t2.parent';
return q;
}
}

View File

@@ -0,0 +1,23 @@
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','Payable Voucher'],['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,37 @@
[
{
'add_col': None,
'add_cond': None,
'add_tab': None,
'columns': '',
'creation': '2010-12-14 10:33:09',
'criteria_name': 'Projectwise Purchase Details',
'custom_query': '',
'description': None,
'dis_filters': None,
'disabled': None,
'doc_type': 'Purchase Order',
'docstatus': 0,
'doctype': 'Search Criteria',
'filters': "{'Purchase Order\x01Status':'','Purchase Order\x01Fiscal Year':''}",
'graph_series': None,
'graph_values': None,
'group_by': None,
'idx': None,
'modified': '2010-11-12 09:23:17',
'modified_by': 'Administrator',
'module': 'Projects',
'name': 'projectwise_purchase_details',
'owner': 'ashwini@webnotestech.com',
'page_len': 50,
'parent': None,
'parent_doc_type': None,
'parentfield': None,
'parenttype': None,
'report_script': None,
'server_script': None,
'sort_by': '',
'sort_order': 'DESC',
'standard': 'Yes'
}
]

View File

@@ -0,0 +1,96 @@
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 Detail` 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 `tabReceivable Voucher` t1, `tabRV Detail` t2 WHERE '+cond +'IFNULL(t1.project_name,"") !="" AND t1.docstatus != 2 AND t1.name = t2.parent';
return q;
}
}

View File

@@ -0,0 +1,20 @@
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','Receivable Voucher'], ['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,37 @@
[
{
'add_col': None,
'add_cond': None,
'add_tab': None,
'columns': '',
'creation': '2010-12-14 10:33:09',
'criteria_name': 'Projectwise Sales Details',
'custom_query': '',
'description': None,
'dis_filters': None,
'disabled': None,
'doc_type': 'Sales Order',
'docstatus': 0,
'doctype': 'Search Criteria',
'filters': "{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Status':''}",
'graph_series': None,
'graph_values': None,
'group_by': None,
'idx': None,
'modified': '2010-11-12 09:21:11',
'modified_by': 'Administrator',
'module': 'Projects',
'name': 'projectwise_sales_details',
'owner': 'harshada@webnotestech.com',
'page_len': 50,
'parent': None,
'parent_doc_type': None,
'parentfield': None,
'parenttype': None,
'report_script': None,
'server_script': None,
'sort_by': '',
'sort_order': 'DESC',
'standard': 'Yes'
}
]

View File

@@ -0,0 +1,37 @@
[
{
'add_col': None,
'add_cond': "ifnull(`tabSales Order`.project_name ,'') != ''",
'add_tab': None,
'columns': '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*',
'creation': '2010-09-01 15:47:57',
'criteria_name': 'Projectwise Sales Orders',
'custom_query': '',
'description': None,
'dis_filters': None,
'disabled': None,
'doc_type': 'Sales Order',
'docstatus': 0,
'doctype': 'Search Criteria',
'filters': "{'Sales Order\x01Saved':1,'Sales Order\x01Submitted':1,'Sales Order\x01Status':'','Sales Order\x01Fiscal Year':''}",
'graph_series': None,
'graph_values': None,
'group_by': None,
'idx': None,
'modified': '2010-08-30 14:21:59',
'modified_by': 'Administrator',
'module': 'Projects',
'name': 'projectwise_sales_orders',
'owner': 'harshada@webnotestech.com',
'page_len': 50,
'parent': None,
'parent_doc_type': None,
'parentfield': None,
'parenttype': None,
'report_script': '',
'server_script': None,
'sort_by': '`tabSales Order`.`name`',
'sort_order': 'DESC',
'standard': 'Yes'
}
]

View File

@@ -0,0 +1,7 @@
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,37 @@
[
{
'add_col': None,
'add_cond': None,
'add_tab': None,
'columns': '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)',
'creation': '2010-12-14 10:33:09',
'criteria_name': 'Timesheet Report',
'custom_query': '',
'description': None,
'dis_filters': None,
'disabled': None,
'doc_type': 'Timesheet Detail',
'docstatus': 0,
'doctype': 'Search Criteria',
'filters': "{'Timesheet\x01Saved':1,'Timesheet\x01Submitted':1}",
'graph_series': None,
'graph_values': None,
'group_by': None,
'idx': None,
'modified': '2010-11-05 20:44:03',
'modified_by': 'Administrator',
'module': 'Projects',
'name': 'timesheet_report',
'owner': 'ashwini@webnotestech.com',
'page_len': 50,
'parent': None,
'parent_doc_type': 'Timesheet',
'parentfield': None,
'parenttype': None,
'report_script': None,
'server_script': None,
'sort_by': '`tabTimesheet`.`name`',
'sort_order': 'DESC',
'standard': 'Yes'
}
]