Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
210 changes: 210 additions & 0 deletions beams/beams/doctype/bureau_trip_details/bureau_trip_details.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
{
"actions": [],
"allow_rename": 1,
"creation": "2025-06-19 10:01:52.888802",
"default_view": "List",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"origin",
"destination",
"distance_travelled_km",
"number_of_days",
"batta_type",
"column_break_aerg",
"from_date_and_time",
"to_date_and_time",
"on_air_date",
"section_break_ikdi",
"breakfast",
"column_break_vnsw",
"lunch",
"column_break_atwg",
"dinner",
"column_break_gaok",
"total_food_allowance",
"section_break_wigg",
"daily_batta",
"column_break_uihk",
"ot_batta",
"column_break_cjsx",
"total_batta",
"section_break_elqj",
"purpose",
"total_hours",
"ot_hours"
],
"fields": [
{
"fieldname": "origin",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Origin",
"options": "Location"
},
{
"fieldname": "destination",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Destination ",
"options": "Location"
},
{
"fieldname": "distance_travelled_km",
"fieldtype": "Float",
"in_list_view": 1,
"label": "Distance Travelled(km) "
},
{
"fieldname": "number_of_days",
"fieldtype": "Int",
"in_list_view": 1,
"label": "Number of Days",
"read_only": 1
},
{
"fieldname": "batta_type",
"fieldtype": "Select",
"hidden": 1,
"in_list_view": 1,
"label": "Batta Type",
"options": "External\nInternal",
"read_only": 1
},
{
"fieldname": "column_break_aerg",
"fieldtype": "Column Break"
},
{
"fieldname": "from_date_and_time",
"fieldtype": "Datetime",
"in_list_view": 1,
"label": "Start Date and Time"
},
{
"fieldname": "to_date_and_time",
"fieldtype": "Datetime",
"in_list_view": 1,
"label": "End Date and Time"
},
{
"fieldname": "on_air_date",
"fieldtype": "Date",
"in_list_view": 1,
"label": "On Air date"
},
{
"fieldname": "section_break_ikdi",
"fieldtype": "Section Break"
},
{
"fieldname": "breakfast",
"fieldtype": "Currency",
"label": "BreakFast",
"precision": "2"
},
{
"fieldname": "column_break_vnsw",
"fieldtype": "Column Break"
},
{
"fieldname": "lunch",
"fieldtype": "Currency",
"label": "Lunch",
"precision": "2"
},
{
"fieldname": "column_break_atwg",
"fieldtype": "Column Break"
},
{
"fieldname": "dinner",
"fieldtype": "Currency",
"label": "Dinner",
"precision": "2"
},
{
"fieldname": "column_break_gaok",
"fieldtype": "Column Break",
"read_only": 1
},
{
"fieldname": "total_food_allowance",
"fieldtype": "Currency",
"label": "Total Food Allowance",
"precision": "2"
},
{
"fieldname": "section_break_wigg",
"fieldtype": "Section Break"
},
{
"description": "Daily Batta Without Food Allowance",
"fieldname": "daily_batta",
"fieldtype": "Currency",
"in_list_view": 1,
"label": " Batta",
"read_only": 1
},
{
"fieldname": "column_break_uihk",
"fieldtype": "Column Break"
},
{
"depends_on": "eval:doc.batta_type == 'External'",
"fieldname": "ot_batta",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "OT Batta",
"read_only": 1
},
{
"fieldname": "column_break_cjsx",
"fieldtype": "Column Break"
},
{
"fieldname": "total_batta",
"fieldtype": "Currency",
"label": "Total Batta",
"precision": "2",
"read_only": 1
},
{
"fieldname": "section_break_elqj",
"fieldtype": "Section Break"
},
{
"fieldname": "purpose",
"fieldtype": "Small Text",
"label": "Purpose"
},
{
"fieldname": "total_hours",
"fieldtype": "Float",
"in_list_view": 1,
"label": "Total Hours",
"read_only": 1
},
{
"depends_on": "eval:doc.batta_type == 'External'",
"fieldname": "ot_hours",
"fieldtype": "Float",
"in_list_view": 1,
"label": "OT Hours",
"read_only": 1
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2025-06-19 10:36:52.888802",
"modified_by": "Administrator",
"module": "BEAMS",
"name": "Bureau Trip Details",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC",
"states": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2025, efeone and contributors
# For license information, please see license.txt

# import frappe
from frappe.model.document import Document


class BureauTripDetails(Document):
pass
8 changes: 4 additions & 4 deletions beams/beams/doctype/bureau_trip_sheet/bureau_trip_sheet.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2024, efeone and contributors
// For license information, please see license.txt

frappe.ui.form.on('Trip Details', {
frappe.ui.form.on('Bureau Trip Details', {
from_date_and_time: function (frm, cdt, cdn) {
calculate_hours_and_days(frm, cdt, cdn);
setTimeout(() => {
Expand Down Expand Up @@ -46,7 +46,7 @@ frappe.ui.form.on('Trip Details', {
dinner: function (frm, cdt, cdn) {
calculate_total_food_allowance(frm, cdt, cdn);
},
total_distance_travelled_km: function(frm, cdt, cdn) {
distance_travelled_km: function(frm, cdt, cdn) {
calculate_total_distance_travelled(frm, cdt, cdn);
setTimeout(() => {
set_batta_for_food_allowance(frm, cdt, cdn);
Expand Down Expand Up @@ -303,7 +303,7 @@ function calculate_total_food_allowance(frm, cdt, cdn) {
function calculate_total_distance_travelled(frm) {
let total_distance = 0;
frm.doc.work_details.forEach(row => {
total_distance += row.distance_traveled || 0;
total_distance += row.distance_travelled_km || 0;
});
frm.set_value('total_distance_travelled_km', total_distance);
frm.refresh_field("total_distance_travelled_km");
Expand Down Expand Up @@ -357,7 +357,7 @@ function set_batta_for_food_allowance(frm, cdt, cdn) {
let is_overnight_stay = frm.doc.is_overnight_stay;

let is_eligible = false;
if (child.distance_traveled >= 50 && child.distance_traveled <= 100 && child.total_hours > 6) {
if (child.distance_travelled_km >= 50 && child.distance_travelled_km <= 100 && child.total_hours > 6) {
is_eligible = true;
}

Expand Down
6 changes: 3 additions & 3 deletions beams/beams/doctype/bureau_trip_sheet/bureau_trip_sheet.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
"fieldname": "work_details",
"fieldtype": "Table",
"label": "Work Details",
"options": "Trip Details"
"options": "Bureau Trip Details"
},
{
"fieldname": "trip_details_section",
Expand Down Expand Up @@ -221,7 +221,7 @@
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2025-03-26 12:37:56.781474",
"modified": "2025-06-19 10:05:11.106938",
"modified_by": "Administrator",
"module": "BEAMS",
"name": "Bureau Trip Sheet",
Expand All @@ -245,4 +245,4 @@
"sort_field": "modified",
"sort_order": "DESC",
"states": []
}
}
4 changes: 2 additions & 2 deletions beams/beams/doctype/bureau_trip_sheet/bureau_trip_sheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def calculate_total_distance_travelled(self):

if self.work_details:
for row in self.work_details:
if row.distance_traveled:
total_distance += row.distance_traveled
if row.distance_travelled_km:
total_distance += row.distance_travelled_km

# Set the 'total_distance_travelled_km' field with the calculated sum
self.total_distance_travelled_km = total_distance
Expand Down