{invoice.customer?.name ?? 'Invoice'} - Invoices - Admin - Nexus
{invoice.status}
{#if invoice.status === 'DRAFT'} {:else if invoice.status === 'SENT'} {:else if invoice.status === 'OVERDUE'} {:else if invoice.status === 'PAID'} {:else if invoice.status === 'CANCELLED'} {/if} {#if invoice.status !== 'CANCELLED' && invoice.status !== 'PAID'} {/if}

Summary

Revenues

{invoice.revenueCount}

{formatCurrency(invoice.revenuesTotal)}

Projects

{invoice.projectCount}

{formatCurrency(invoice.projectsTotal)}

Total Amount

{formatCurrency(invoice.totalAmount)}

{#if invoice.status === 'DRAFT' && eligibleRevenues.length > 0} (showAddRevenuesModal = true)} /> {:else}

Revenues ({invoice.revenues.length})

{/if}
{#if invoice.revenues.length > 0}
{#each invoice.revenues as entry (entry.id)}

{entry.account?.name ?? 'Unknown Account'}

{entry.revenue?.startDate ? formatDate(entry.revenue.startDate) : ''} - {entry .revenue?.endDate ? formatDate(entry.revenue.endDate) : 'Ongoing'}

{#if entry.revenue?.waveServiceId} Wave Linked {:else if invoice.status === 'DRAFT'} {:else} Not Linked {/if}
{formatCurrency(entry.amount)} {#if invoice.status === 'DRAFT'} {/if}
{/each}
{:else}
{#if invoice.status === 'DRAFT'} {#if eligibleRevenues.length > 0} No revenues added yet. {:else}

No eligible revenues for this customer and invoice period.

Go to customer page to manage accounts {/if} {:else} No revenues in this invoice. {/if}
{/if}
{#if invoice.status === 'DRAFT' && eligibleProjects.length > 0} (showAddProjectsModal = true)} /> {:else}

Projects ({invoice.projects.length})

{/if}
{#if invoice.projects.length > 0}
{#each invoice.projects as entry (entry.id)}

{entry.project?.name ?? 'Unknown'}

{formatDate(entry.project?.date ?? '')} {#if entry.account?.name} · {entry.account.name} {/if}

{#if entry.project?.formattedAddress}

{entry.project.formattedAddress}

{/if}
{#if entry.project?.waveServiceId} Wave Linked {:else if invoice.status === 'DRAFT'} {:else} Not Linked {/if}
{formatCurrency(entry.amount)} {#if invoice.status === 'DRAFT'} {/if}
{/each}
{:else}
{#if invoice.status === 'DRAFT'} {#if eligibleProjects.length > 0} No projects added yet. {:else}

No eligible projects for this customer and invoice period.

View all projects {/if} {:else} No projects in this invoice. {/if}
{/if}

Wave Accounting

Integration
{#if invoice.waveInvoiceId}

Synced to Wave

{#if waveInvoice?.invoiceNumber} Wave #{waveInvoice.invoiceNumber} {:else} Loading... {/if}

{#if waveInvoice?.pdfUrl} Download PDF {/if}
{:else if invoice.status === 'CANCELLED'}

Not synced

Cancelled invoices cannot be synced to Wave

{:else if invoice.status !== 'DRAFT'}

Not synced

This invoice was not synced to Wave before being sent

{:else if waveError}

Wave Sync Failed

{waveError}

{:else if waveReadiness} {#if waveReadiness.ready}

Ready to sync

{waveReadiness.readyItemCount} items totaling {formatCurrency( parseFloat(waveReadiness.totalAmount) )}

{:else}

Not ready to sync

Please resolve the following issues:

    {#each waveReadiness.issues as issue}
  • {issue} {#if issue.includes('Customer is not linked')} {/if}
  • {/each}
{#if waveReadiness.readyItemCount > 0}

{waveReadiness.readyItemCount} of {waveReadiness.readyItemCount + waveReadiness.missingWaveLinkCount} items are linked to Wave products

{/if}
{/if} {/if}
(showAddRevenuesModal = false)} > {#if eligibleRevenues.length > 0}
{#each eligibleRevenues as revenue (revenue.revenueId)}

{revenue.accountName}

{formatCurrency(revenue.amount)}/month

{/each}
{:else}

No eligible revenues available for this invoice period.

Go to Customer Page
{/if} {#snippet footer()} {#if eligibleRevenues.length > 0}
{:else} {/if} {/snippet}
(showAddProjectsModal = false)} > {#if eligibleProjects.length > 0}
{#each eligibleProjects as project (project.projectId)}

{project.name}

{formatDate(project.date)} - {formatCurrency(project.amount)}

{/each}
{:else}

No eligible projects available for this invoice period.

View Projects
{/if} {#snippet footer()} {#if eligibleProjects.length > 0}
{:else} {/if} {/snippet}
{#if showDeleteConfirm}

Delete Invoice?

Are you sure you want to delete this invoice? This action cannot be undone.

{/if} (showLinkCustomerModal = false)} >

Select the Wave customer that corresponds to {invoice.customer?.name}:

{#snippet footer()}
{/snippet}
{ showWaveLinkDrawer = false; waveLinkTarget = null; }} > {#if waveLinkTarget}

Select a Wave product to link {waveLinkTarget.itemName} for invoicing:

{ showWaveLinkDrawer = false; waveLinkTarget = null; }} /> {/if}