<%= invoice?.user?.u_name || 'Customer' %>
Thanks for riding with <%= invoice?.company_name || invoice?.driver?.company_name || invoice?.company?.u_name || ADMIN_NAME || 'TaxiBay' %>!
Total
<%= invoice?.trip_currency || '$' %><%= invoice?.trip_pay_amount || '0.00' %>
Fare Breakdown
Meter Fare
<%= invoice?.trip_currency || '$' %><%= invoice?.trip_base_fare || '0.00' %>
Duration
<%= invoice?.trip_total_time || '0' %> min
<%
let extra = {};
try {
extra = typeof invoice.extra_charges === 'string' ? JSON.parse(invoice.extra_charges) : invoice.extra_charges || {};
} catch(e) {
extra = {};
}
// adjustAmt is passed from the route (parsed from est_data)
const _adjustAmt = typeof adjustAmt !== 'undefined' ? adjustAmt : 0;
%>
<%
let baseFareValEjs = parseFloat(invoice?.trip_base_fare || 0);
let payAmtValEjs = parseFloat(invoice?.trip_pay_amount || 0);
let computedExtraFeeEjs = Math.max(0, payAmtValEjs - baseFareValEjs);
let notesEjs = (invoice?.pickup_notes || invoice?.trip_add_details || "").toLowerCase();
let feeNameEjs = "Booking Fee";
if (notesEjs.includes("street-hail") || notesEjs.includes("single-ride")) {
feeNameEjs = "Digital Fee";
} else if (notesEjs.includes("others") || notesEjs.includes("other")) {
feeNameEjs = "Fee";
}
%>
<% if (computedExtraFeeEjs > 0) { %>
<%= feeNameEjs %>
<%= invoice?.trip_currency || '₱' %><%= computedExtraFeeEjs.toFixed(2) %>
<% } %>
<% if (parseFloat(extra?.WaitCharges) > 0) { %>
Waiting Charges
<%= invoice?.trip_currency || '$' %><%= extra?.WaitCharges || '0.00' %>
<% } %>
<% if (invoice?.trip_tip && parseFloat(invoice.trip_tip) > 0) { %>
Tip
<%= invoice?.trip_currency || '$' %><%= invoice?.trip_tip %>
<% } %>
<% if (invoice?.trip_promo_amt && parseFloat(invoice.trip_promo_amt) > 0) { %>
Promo Discount
-<%= invoice?.trip_currency || '$' %><%= invoice?.trip_promo_amt %>
<% } %>
<% if (_adjustAmt !== 0) { %>
Adjustment
<%= _adjustAmt < 0 ? '-' : '+' %><%= invoice?.trip_currency || '$' %><%= Math.abs(_adjustAmt).toFixed(2) %>
<% } %>
Payment Method
<%= invoice?.trip_pay_mode || 'Cash' %>
<%= invoice?.trip_currency || '$' %><%= invoice?.trip_pay_amount || '0.00' %>
Driver Details
<% if (invoice?.driver?.d_photo) { %>

<% } else { %>
<%= (invoice?.driver?.d_name || 'D').charAt(0) %>
<% } %>
<%= invoice?.driver?.d_name || 'N/A' %>
<%= invoice?.cat_name || 'N/A' %> • <%= invoice?.driver?.car?.car_reg_no || 'N/A' %>
<% if (invoice?.driver?.c_code) { %>+<%= invoice.driver.c_code %> <% } %><%= invoice?.driver?.d_phone || 'N/A' %>
Trip Details
Trip Date
<%
const _tzMs = (typeof tzOffset !== 'undefined' ? parseFloat(tzOffset) : 0) * 3600000;
const _raw = new Date(invoice.trip_date);
const _local = new Date(_raw.getTime() + _tzMs);
const _opts = { day: '2-digit', month: 'short', year: 'numeric' };
let _h = _local.getHours();
const _m = String(_local.getMinutes()).padStart(2, '0');
const _ap = _h >= 12 ? 'PM' : 'AM';
_h = _h % 12 || 12;
%>
<%= _local.toLocaleDateString('en-US', _opts) %> <%= _h %>:<%= _m %> <%= _ap %>
Distance
<%= invoice?.trip_distance || '0' %> <%= invoice?.trip_dunit || 'km' %>
Pickup
<%= invoice?.trip_from_loc || invoice?.actual_from_loc || 'N/A' %>
Drop-off
<%= invoice?.trip_to_loc || invoice?.actual_to_loc || 'N/A' %>
Driver
<%= invoice?.driver?.d_name || 'N/A' %>
Vehicle
<%= invoice?.cat_name || 'N/A' %> (<%= invoice?.driver?.car?.car_reg_no || 'N/A' %>)
Invoice No
<%= invoiceNo || 'N/A' %>
<%
const compPhone = invoice?.company_phone || invoice?.company?.u_phone || invoice?.company?.phone || invoice?.driver?.company_phone || '';
const compName = invoice?.company_name || invoice?.driver?.company_name || invoice?.company?.u_name || invoice?.company?.company_name || '';
%>
<% if (compName && compName.length > 0) { %>
<% } %>
<% if (compPhone && compPhone.length > 0) { %>
Company Phone
<%= compPhone %>
<% } %>
<% if (bt_visible == 1) { %>
<% } %>