updates on the profitability page and added the new page of this one

This commit is contained in:
2026-06-16 19:49:57 +05:30
parent ffcd9440e6
commit b0bb2d63cf
5 changed files with 796 additions and 5 deletions

View File

@@ -49,7 +49,7 @@ function getStatusConfig(raw) {
}
function orderRevenue(order) {
const km = parseFloat(order.kms ?? order.actualkms ?? 0);
const km = parseFloat(order.kms || order.actualkms || 0);
return km <= BASE_KM_LIMIT ? BASE_REVENUE : BASE_REVENUE + (km - BASE_KM_LIMIT) * EXTRA_RATE_KM;
}
@@ -60,7 +60,7 @@ function calcRiderMetrics(rider) {
for (const o of orders) {
revenue += orderRevenue(o);
kms += parseFloat(o.kms ?? o.actualkms ?? 0);
kms += parseFloat(o.kms || o.actualkms || 0);
}
const varCost = kms * VARIABLE_RATE_KM;
@@ -472,8 +472,13 @@ export default function ProfitabilitySection({ riders = [], totalDailyProfit = 0
{slotIsProfit ? '+' : ''}
{rupees(slotNet)}
</span>
<span className={`profitability-summary-detail ${slotRevenue > 0 ? (slotNet / slotRevenue >= 0 ? 'margin-positive' : 'margin-negative') : ''}`}>
{slotRevenue > 0 ? `${slotNet / slotRevenue >= 0 ? '+' : ''}${((slotNet / slotRevenue) * 100).toFixed(0)}% margin` : '0% margin'}
<span
className={`profitability-summary-detail ${slotRevenue > 0 ? (slotNet / slotRevenue >= 0 ? 'margin-positive' : 'margin-negative') : ''
}`}
>
{slotRevenue > 0
? `${slotNet / slotRevenue >= 0 ? '+' : ''}${((slotNet / slotRevenue) * 100).toFixed(0)}% margin`
: '0% margin'}
</span>
</div>
</div>