task and project- billing amount and actual amount added
diff --git a/erpnext/projects/doctype/project/project.json b/erpnext/projects/doctype/project/project.json
index 62210b8..ef6140a 100644
--- a/erpnext/projects/doctype/project/project.json
+++ b/erpnext/projects/doctype/project/project.json
@@ -15,12 +15,6 @@
"permlevel": 0
},
{
- "fieldname": "cb_project_status",
- "fieldtype": "Column Break",
- "label": "Status",
- "permlevel": 0
- },
- {
"description": "",
"fieldname": "project_name",
"fieldtype": "Data",
@@ -46,6 +40,23 @@
"search_index": 1
},
{
+ "fieldname": "project_type",
+ "fieldtype": "Select",
+ "label": "Project Type",
+ "no_copy": 0,
+ "oldfieldname": "project_type",
+ "oldfieldtype": "Data",
+ "options": "Internal\nExternal\nOther",
+ "permlevel": 0,
+ "search_index": 0
+ },
+ {
+ "fieldname": "column_break_5",
+ "fieldtype": "Column Break",
+ "permlevel": 0,
+ "precision": ""
+ },
+ {
"fieldname": "is_active",
"fieldtype": "Select",
"label": "Is Active",
@@ -69,16 +80,16 @@
"search_index": 0
},
{
- "fieldname": "cb_project_dates",
- "fieldtype": "Column Break",
- "label": "Dates",
- "permlevel": 0
+ "fieldname": "section_break_12",
+ "fieldtype": "Section Break",
+ "permlevel": 0,
+ "precision": ""
},
{
- "fieldname": "project_start_date",
+ "fieldname": "expected_start_date",
"fieldtype": "Date",
"in_filter": 1,
- "label": "Project Start Date",
+ "label": "Expected Start Date",
"no_copy": 0,
"oldfieldname": "project_start_date",
"oldfieldtype": "Date",
@@ -86,9 +97,15 @@
"search_index": 0
},
{
- "fieldname": "completion_date",
+ "fieldname": "column_break_11",
+ "fieldtype": "Column Break",
+ "permlevel": 0,
+ "precision": ""
+ },
+ {
+ "fieldname": "expected_end_date",
"fieldtype": "Date",
- "label": "Completion Date",
+ "label": "Expected End Date",
"no_copy": 0,
"oldfieldname": "completion_date",
"oldfieldtype": "Date",
@@ -96,27 +113,6 @@
"search_index": 0
},
{
- "fieldname": "act_completion_date",
- "fieldtype": "Date",
- "label": "Actual Completion Date",
- "no_copy": 0,
- "oldfieldname": "act_completion_date",
- "oldfieldtype": "Date",
- "permlevel": 0,
- "search_index": 0
- },
- {
- "fieldname": "project_type",
- "fieldtype": "Select",
- "label": "Project Type",
- "no_copy": 0,
- "oldfieldname": "project_type",
- "oldfieldtype": "Data",
- "options": "Internal\nExternal\nOther",
- "permlevel": 0,
- "search_index": 0
- },
- {
"fieldname": "sb_milestones",
"fieldtype": "Section Break",
"label": "Tasks",
@@ -131,7 +127,7 @@
"options": "Project Task",
"permlevel": 0,
"precision": "",
- "reqd": 1
+ "reqd": 0
},
{
"fieldname": "percent_complete",
@@ -167,6 +163,45 @@
"permlevel": 0
},
{
+ "fieldname": "section_break_18",
+ "fieldtype": "Section Break",
+ "permlevel": 0,
+ "precision": ""
+ },
+ {
+ "fieldname": "actual_start_date",
+ "fieldtype": "Data",
+ "label": "Actual Start Date",
+ "permlevel": 0,
+ "precision": "",
+ "read_only": 1
+ },
+ {
+ "fieldname": "actual_time",
+ "fieldtype": "Float",
+ "label": "Actual Time",
+ "permlevel": 0,
+ "precision": "",
+ "read_only": 1
+ },
+ {
+ "fieldname": "column_break_20",
+ "fieldtype": "Column Break",
+ "permlevel": 0,
+ "precision": ""
+ },
+ {
+ "fieldname": "actual_end_date",
+ "fieldtype": "Date",
+ "label": "Actual End Date",
+ "no_copy": 0,
+ "oldfieldname": "act_completion_date",
+ "oldfieldtype": "Date",
+ "permlevel": 0,
+ "read_only": 1,
+ "search_index": 0
+ },
+ {
"fieldname": "project_details",
"fieldtype": "Section Break",
"label": "Project Costing",
@@ -188,20 +223,9 @@
"search_index": 0
},
{
- "fieldname": "est_material_cost",
+ "fieldname": "total_costing_amount",
"fieldtype": "Currency",
- "label": "Estimated Material Cost",
- "no_copy": 0,
- "oldfieldname": "est_material_cost",
- "oldfieldtype": "Currency",
- "options": "Company:company:default_currency",
- "permlevel": 0,
- "search_index": 0
- },
- {
- "fieldname": "total_activity_cost",
- "fieldtype": "Currency",
- "label": "Total Activity Cost",
+ "label": "Total Costing Amount",
"permlevel": 0,
"precision": "",
"read_only": 1
@@ -215,6 +239,31 @@
"read_only": 1
},
{
+ "fieldname": "column_break_22",
+ "fieldtype": "Column Break",
+ "permlevel": 0,
+ "precision": ""
+ },
+ {
+ "fieldname": "est_material_cost",
+ "fieldtype": "Currency",
+ "label": "Estimated Material Cost",
+ "no_copy": 0,
+ "oldfieldname": "est_material_cost",
+ "oldfieldtype": "Currency",
+ "options": "Company:company:default_currency",
+ "permlevel": 0,
+ "search_index": 0
+ },
+ {
+ "fieldname": "total_billing_amount",
+ "fieldtype": "Currency",
+ "label": "Total Billing Amount",
+ "permlevel": 0,
+ "precision": "",
+ "read_only": 1
+ },
+ {
"fieldname": "cost_center",
"fieldtype": "Link",
"label": "Default Cost Center",
@@ -222,8 +271,8 @@
"permlevel": 0
},
{
- "fieldname": "column_break0",
- "fieldtype": "Column Break",
+ "fieldname": "margin",
+ "fieldtype": "Section Break",
"label": "Margin",
"oldfieldtype": "Column Break",
"permlevel": 0,
@@ -242,6 +291,12 @@
"search_index": 0
},
{
+ "fieldname": "column_break_28",
+ "fieldtype": "Column Break",
+ "permlevel": 0,
+ "precision": ""
+ },
+ {
"fieldname": "per_gross_margin",
"fieldtype": "Currency",
"label": "Gross Margin %",
@@ -279,7 +334,7 @@
"icon": "icon-puzzle-piece",
"idx": 1,
"max_attachments": 4,
- "modified": "2015-04-10 05:11:18.849171",
+ "modified": "2015-04-13 07:13:06.962942",
"modified_by": "Administrator",
"module": "Projects",
"name": "Project",
diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py
index b481ee4..0b45e4d 100644
--- a/erpnext/projects/doctype/project/project.py
+++ b/erpnext/projects/doctype/project/project.py
@@ -38,9 +38,9 @@
self.sync_tasks()
def validate_dates(self):
- if self.project_start_date and self.completion_date:
- if getdate(self.completion_date) < getdate(self.project_start_date):
- frappe.throw(_("Expected Completion Date can not be less than Project Start Date"))
+ if self.expected_start_date and self.expected_end_date:
+ if getdate(self.expected_end_date) < getdate(self.expected_start_date):
+ frappe.throw(_("Expected End Date can not be less than Expected Start Date"))
def sync_tasks(self):
"""sync tasks and remove table"""
@@ -68,6 +68,8 @@
# delete
for t in frappe.get_all("Task", ["name"], {"project": self.name, "name": ("not in", task_names)}):
frappe.delete_doc("Task", t.name)
+
+ self.tasks = []
def update_percent_complete(self):
total = frappe.db.sql("""select count(*) from tabTask where project=%s""",
diff --git a/erpnext/projects/doctype/project_task/project_task.json b/erpnext/projects/doctype/project_task/project_task.json
index 11d5b55..f3d2c66 100644
--- a/erpnext/projects/doctype/project_task/project_task.json
+++ b/erpnext/projects/doctype/project_task/project_task.json
@@ -37,7 +37,7 @@
"in_filter": 0,
"in_list_view": 1,
"label": "Status",
- "no_copy": 0,
+ "no_copy": 1,
"options": "Open\nWorking\nPending Review\nClosed\nCancelled",
"permlevel": 0,
"precision": "",
@@ -128,7 +128,7 @@
{
"fieldname": "task_id",
"fieldtype": "Link",
- "hidden": 0,
+ "hidden": 1,
"label": "Task ID",
"no_copy": 1,
"options": "Task",
@@ -143,7 +143,7 @@
"is_submittable": 0,
"issingle": 0,
"istable": 1,
- "modified": "2015-04-06 09:41:50.911955",
+ "modified": "2015-04-13 04:56:18.766659",
"modified_by": "Administrator",
"module": "Projects",
"name": "Project Task",
diff --git a/erpnext/projects/doctype/task/task.json b/erpnext/projects/doctype/task/task.json
index b46fe21..6642100 100644
--- a/erpnext/projects/doctype/task/task.json
+++ b/erpnext/projects/doctype/task/task.json
@@ -149,6 +149,17 @@
"read_only": 1
},
{
+ "default": "",
+ "description": "in Hours",
+ "fieldname": "actual_time",
+ "fieldtype": "Float",
+ "label": "Actual Time",
+ "options": "",
+ "permlevel": 0,
+ "precision": "",
+ "read_only": 1
+ },
+ {
"fieldname": "column_break_15",
"fieldtype": "Column Break",
"permlevel": 0,
@@ -170,26 +181,9 @@
"precision": ""
},
{
- "default": "0",
- "description": "in Hours",
- "fieldname": "actual_time",
- "fieldtype": "Float",
- "label": "Actual Time",
- "options": "",
- "permlevel": 0,
- "precision": "",
- "read_only": 1
- },
- {
- "fieldname": "column_break_20",
- "fieldtype": "Column Break",
- "permlevel": 0,
- "precision": ""
- },
- {
- "fieldname": "actual_cost",
+ "fieldname": "total_costing_amount",
"fieldtype": "Currency",
- "label": "Actual Cost",
+ "label": "Total Costing Amount",
"oldfieldname": "actual_budget",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
@@ -206,6 +200,21 @@
"read_only": 1
},
{
+ "fieldname": "column_break_20",
+ "fieldtype": "Column Break",
+ "permlevel": 0,
+ "precision": ""
+ },
+ {
+ "fieldname": "total_billing_amount",
+ "fieldtype": "Currency",
+ "hidden": 0,
+ "label": "Total Billing Amount",
+ "permlevel": 0,
+ "precision": "",
+ "read_only": 1
+ },
+ {
"fieldname": "more_details",
"fieldtype": "Section Break",
"label": "",
@@ -248,7 +257,7 @@
"idx": 1,
"istable": 0,
"max_attachments": 5,
- "modified": "2015-03-31 03:31:13.055284",
+ "modified": "2015-04-13 05:36:33.544083",
"modified_by": "Administrator",
"module": "Projects",
"name": "Task",
diff --git a/erpnext/projects/doctype/task/task.py b/erpnext/projects/doctype/task/task.py
index 6178099..8c74edb 100644
--- a/erpnext/projects/doctype/task/task.py
+++ b/erpnext/projects/doctype/task/task.py
@@ -49,23 +49,33 @@
self.total_expense_claim = frappe.db.sql("""select sum(total_sanctioned_amount) from `tabExpense Claim`
where project = %s and task = %s and approval_status = "Approved" and docstatus=1""",(self.project, self.name))
- def update_actual_time_and_costing(self):
- tl = frappe.db.sql("""select min(from_time) as start_date, max(to_time) as
- end_date, sum(billing_amount) as cost, sum(hours) as time from `tabTime Log` where
- project = %s and task = %s and docstatus=1""",(self.project, self.name),as_dict=1)[0]
+ def update_time_and_costing(self):
+ tl = frappe.db.sql("""select min(from_time) as start_date, max(to_time) as end_date,
+ sum(billing_amount) as total_billing_amount, sum(costing_amount) as total_costing_amount,
+ sum(hours) as time from `tabTime Log` where project = %s and task = %s and docstatus=1""",
+ (self.project, self.name),as_dict=1)[0]
if self.status == "Open":
self.status = "Working"
- self.actual_cost= tl.cost
+ self.total_costing_amount= tl.total_costing_amount
+ self.total_billing_amount= tl.total_billing_amount
self.actual_time= tl.time
self.act_start_date= tl.start_date
self.act_end_date= tl.end_date
def update_project(self):
if self.project and frappe.db.exists("Project", self.project):
- total_cost = frappe.db.sql("""select sum(actual_cost) as actual_cost, sum(total_expense_claim) as expense_claim
+ total_cost = frappe.db.sql("""select sum(total_costing_amount) as costing_amount,
+ sum(total_billing_amount) as billing_amount, sum(total_expense_claim) as expense_claim,
+ min(act_start_date) as start_date, max(act_end_date) as end_date, sum(actual_time) as time
from `tabTask` where project = %s""", self.project, as_dict=1)[0]
- frappe.db.set_value("Project", self.project, "total_activity_cost", total_cost.actual_cost)
- frappe.db.set_value("Project", self.project, "total_expense_claim", total_cost.expense_claim)
+ frappe.db.set_values("Project", self.project, {
+ "total_costing_amount": total_cost.costing_amount,
+ "total_billing_amount": total_cost.billing_amount,
+ "total_expense_claim": total_cost.expense_claim,
+ "actual_start_date": total_cost.start_date,
+ "actual_end_date": total_cost.end_date,
+ "actual_time": total_cost.time
+ })
@frappe.whitelist()
def get_events(start, end, filters=None):
diff --git a/erpnext/projects/doctype/time_log/time_log.json b/erpnext/projects/doctype/time_log/time_log.json
index a2852ae..09c4e87 100644
--- a/erpnext/projects/doctype/time_log/time_log.json
+++ b/erpnext/projects/doctype/time_log/time_log.json
@@ -17,6 +17,28 @@
"reqd": 1
},
{
+ "fieldname": "column_break_2",
+ "fieldtype": "Column Break",
+ "permlevel": 0,
+ "precision": ""
+ },
+ {
+ "fieldname": "status",
+ "fieldtype": "Select",
+ "in_list_view": 0,
+ "label": "Status",
+ "options": "Draft\nSubmitted\nBatched for Billing\nBilled\nCancelled",
+ "permlevel": 0,
+ "read_only": 1,
+ "reqd": 0
+ },
+ {
+ "fieldname": "section_break_4",
+ "fieldtype": "Section Break",
+ "permlevel": 0,
+ "precision": ""
+ },
+ {
"fieldname": "from_time",
"fieldtype": "Datetime",
"in_list_view": 0,
@@ -26,15 +48,6 @@
"reqd": 1
},
{
- "fieldname": "to_time",
- "fieldtype": "Datetime",
- "in_list_view": 0,
- "label": "To Time",
- "permlevel": 0,
- "read_only": 0,
- "reqd": 1
- },
- {
"default": "0",
"fieldname": "hours",
"fieldtype": "Float",
@@ -44,52 +57,19 @@
"read_only": 0
},
{
- "fieldname": "user",
- "fieldtype": "Link",
- "label": "User",
- "options": "User",
+ "fieldname": "to_time",
+ "fieldtype": "Datetime",
+ "in_list_view": 0,
+ "label": "To Time",
"permlevel": 0,
- "precision": ""
+ "read_only": 0,
+ "reqd": 1
},
{
- "fieldname": "employee",
- "fieldtype": "Link",
- "label": "Employee",
- "options": "Employee",
- "permlevel": 0,
- "precision": ""
- },
- {
- "fieldname": "column_break_3",
+ "fieldname": "column_break_8",
"fieldtype": "Column Break",
"permlevel": 0,
- "read_only": 0
- },
- {
- "fieldname": "status",
- "fieldtype": "Select",
- "in_list_view": 0,
- "label": "Status",
- "options": "Draft\nSubmitted\nBatched for Billing\nBilled\nCancelled",
- "permlevel": 0,
- "read_only": 1,
- "reqd": 0
- },
- {
- "fieldname": "billable",
- "fieldtype": "Check",
- "in_list_view": 0,
- "label": "Billable",
- "permlevel": 0,
- "read_only": 0
- },
- {
- "fieldname": "for_manufacturing",
- "fieldtype": "Check",
- "label": "For Manufacturing",
- "permlevel": 0,
- "precision": "",
- "read_only": 1
+ "precision": ""
},
{
"depends_on": "",
@@ -122,6 +102,51 @@
"reqd": 0
},
{
+ "fieldname": "section_break_12",
+ "fieldtype": "Section Break",
+ "permlevel": 0,
+ "precision": ""
+ },
+ {
+ "fieldname": "user",
+ "fieldtype": "Link",
+ "label": "User",
+ "options": "User",
+ "permlevel": 0,
+ "precision": ""
+ },
+ {
+ "fieldname": "employee",
+ "fieldtype": "Link",
+ "label": "Employee",
+ "options": "Employee",
+ "permlevel": 0,
+ "precision": ""
+ },
+ {
+ "fieldname": "column_break_3",
+ "fieldtype": "Column Break",
+ "permlevel": 0,
+ "read_only": 0
+ },
+ {
+ "fieldname": "for_manufacturing",
+ "fieldtype": "Check",
+ "hidden": 1,
+ "label": "For Manufacturing",
+ "permlevel": 0,
+ "precision": "",
+ "read_only": 1
+ },
+ {
+ "fieldname": "billable",
+ "fieldtype": "Check",
+ "in_list_view": 0,
+ "label": "Billable",
+ "permlevel": 0,
+ "read_only": 0
+ },
+ {
"depends_on": "eval:doc.for_manufacturing",
"fieldname": "section_break_11",
"fieldtype": "Section Break",
@@ -298,10 +323,14 @@
"idx": 1,
"is_submittable": 1,
<<<<<<< HEAD
+<<<<<<< HEAD
"modified": "2015-04-06 02:47:16.187046",
=======
"modified": "2015-04-09 08:29:34.464429",
>>>>>>> Fixes in time_log
+=======
+ "modified": "2015-04-13 04:31:20.855439",
+>>>>>>> task and project- billing amount and actual amount added
"modified_by": "Administrator",
"module": "Projects",
"name": "Time Log",
diff --git a/erpnext/projects/doctype/time_log/time_log.py b/erpnext/projects/doctype/time_log/time_log.py
index 34b244f..2018425 100644
--- a/erpnext/projects/doctype/time_log/time_log.py
+++ b/erpnext/projects/doctype/time_log/time_log.py
@@ -232,7 +232,7 @@
def update_task(self):
task = frappe.get_doc("Task", self.task)
- task.update_actual_time_and_costing()
+ task.update_time_and_costing()
task.save()
@frappe.whitelist()