diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index 75b8434ac48..d77f4a87171 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -909,6 +909,7 @@ frappe.ui.form.on("Sales Invoice", { } }, +<<<<<<< HEAD async add_timesheet_data(frm, kwargs) { if (kwargs === "Sales Invoice") { // called via frm.trigger() @@ -921,6 +922,19 @@ frappe.ui.form.on("Sales Invoice", { const timesheets = await frm.events.get_timesheet_data(frm, kwargs); return frm.events.set_timesheet_data(frm, timesheets); +======= + add_timesheet_row: function(frm, row, exchange_rate) { + frm.add_child('timesheets', { + 'activity_type': row.activity_type, + 'description': row.description, + 'time_sheet': row.parent, + 'billing_hours': row.billing_hours, + 'billing_amount': flt(row.billing_amount) * flt(exchange_rate), + 'timesheet_detail': row.name + }); + frm.refresh_field('timesheets'); + frm.trigger("calculate_timesheet_totals"); +>>>>>>> b57521a337 (feat: add `total_billing_hours` to Sales Invoice) }, async get_timesheet_data(frm, kwargs) { @@ -1082,7 +1096,58 @@ var set_timesheet_detail_rate = function (cdt, cdn, currency, timelog) { }); }; +<<<<<<< HEAD var select_loyalty_program = function (frm, loyalty_programs) { +======= + create_invoice_discounting: function(frm) { + frappe.model.open_mapped_doc({ + method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.create_invoice_discounting", + frm: frm + }); + }, + + create_dunning: function(frm) { + frappe.model.open_mapped_doc({ + method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.create_dunning", + frm: frm + }); + }, + + calculate_timesheet_totals: function(frm) { + frm.set_value("total_billing_amount", + frm.doc.timesheets.reduce((a, b) => a + (b["billing_amount"] || 0.0), 0.0)); + frm.set_value("total_billing_hours", + frm.doc.timesheets.reduce((a, b) => a + (b["billing_hours"] || 0.0), 0.0)); + } +}); + + +frappe.ui.form.on("Sales Invoice Timesheet", { + time_sheet: function(frm, cdt, cdn){ + var d = locals[cdt][cdn]; + if(d.time_sheet) { + frappe.call({ + method: "erpnext.projects.doctype.timesheet.timesheet.get_timesheet_data", + args: { + "name": d.time_sheet, + "project": frm.doc.project || null + }, + callback: function(r) { + if(r.message) { + frappe.model.set_value(cdt, cdn, "billing_hours", r.message.billing_hours); + frappe.model.set_value(cdt, cdn, "billing_amount", r.message.billing_amount); + frappe.model.set_value(cdt, cdn, "timesheet_detail", r.message.timesheet_detail); + frm.trigger("calculate_timesheet_totals"); + } + } + }); + } + } +}); + + +var select_loyalty_program = function(frm, loyalty_programs) { +>>>>>>> b57521a337 (feat: add `total_billing_hours` to Sales Invoice) var dialog = new frappe.ui.Dialog({ title: __("Select Loyalty Program"), fields: [ diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json index 6f32571c25f..5cf4ad362aa 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json @@ -49,6 +49,18 @@ "set_target_warehouse", "section_break_42", "items", +<<<<<<< HEAD +======= + "pricing_rule_details", + "pricing_rules", + "packing_list", + "packed_items", + "product_bundle_help", + "time_sheet_list", + "timesheets", + "total_billing_amount", + "total_billing_hours", +>>>>>>> b57521a337 (feat: add `total_billing_hours` to Sales Invoice) "section_break_30", "total_qty", "total_net_weight", @@ -1977,6 +1989,7 @@ "read_only": 1 }, { +<<<<<<< HEAD "default": "0", "fieldname": "ignore_default_payment_terms_template", "fieldtype": "Check", @@ -1985,11 +1998,14 @@ "read_only": 1 }, { +======= +>>>>>>> b57521a337 (feat: add `total_billing_hours` to Sales Invoice) "fieldname": "total_billing_hours", "fieldtype": "Float", "label": "Total Billing Hours", "print_hide": 1, "read_only": 1 +<<<<<<< HEAD }, { "fieldname": "amount_eligible_for_commission", @@ -2199,6 +2215,8 @@ "label": "Company Contact Person", "options": "Contact", "print_hide": 1 +======= +>>>>>>> b57521a337 (feat: add `total_billing_hours` to Sales Invoice) } ], "icon": "fa fa-file-text", @@ -2211,7 +2229,11 @@ "link_fieldname": "consolidated_invoice" } ], +<<<<<<< HEAD "modified": "2025-02-06 15:59:54.636202", +======= + "modified": "2021-08-02 18:36:51.978581", +>>>>>>> b57521a337 (feat: add `total_billing_hours` to Sales Invoice) "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice",