Fix batch Payment Entry (paidAmountCents was 0), fix CTA button JS syntax error

- Batch invoice creation now calculates actual total from line items
- Fixed JS syntax error: `className = "..." style="..."` was invalid JS
  (style= outside string literal caused Unexpected identifier 'style')
- Portal menu: set hide_standard_menu=1 to remove duplicate sidebar items

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
justin 2026-04-28 04:20:05 -05:00
parent aa367ecd0a
commit e76f54b11f

View file

@ -1279,12 +1279,16 @@ export async function handlePaymentComplete(
// Create Sales Invoice
try {
// Calculate batch total (sum of all line items minus discounts)
const batchTotalCents = (batchRows.rows as any[]).reduce((sum, bo) => {
return sum + (bo.service_fee_cents || 0) + (bo.gov_fee_cents || 0) - (bo.discount_cents || 0);
}, 0);
const invName = await createInvoiceFromSalesOrder({
salesOrderName: soName,
paymentGateway: paymentMethod,
surchargePercent: (order.surcharge_pct as number) || 0,
paymentReference: session_id,
paidAmountCents: 0,
paidAmountCents: batchTotalCents,
externalOrderId: batchId,
});
if (invName) {