List of Invoices
This page uses a Hashtag List to show Invoice line item records.
The Table is styled using Bootstrap 3 default theme classes.
This demonstration provides many ways to alter and process records.
Processed this Hashtag Markup:
<# start list for invoices;
show 10 rows per page;
#>
<# start header #>
<table class="table table-striped table-hover table-condensed">
<thead>
<tr>
<th>Status</th>
<th>Qty</th>
<th class="text-right">Each</th>
<th class="text-right">Subtotal</th>
<th class="text-right">Tax</th>
<th class="text-right">Total</th>
<th>Action</th>
</tr>
</thead>
<# end header #>
<# start row #>
<tr>
<td><# status #></td>
<td><a href="form?edit=<# id #>"><# qty #></a></td>
<td class="text-right"><# each #></td>
<td class="text-right"><# subtotal #></td>
<td class="text-right"><# tax #></td>
<td class="text-right"><# total #></td>
<td><a href="process?id=<# id #>" class="label label-primary label-action">Process</a>
<a href="update?id=<# id #>" class="label label-primary label-action">Increase Qty</a>
<a href="clone?id=<# id #>" class="label label-primary label-action">Clone</a>
<a href="delete?id=<# id #>&index=<#[url.index as html]#>"
onclick="return confirm('Delete Invoice Record?')"
class="label label-primary label-action">Delete</a>
</td>
</tr>
<# end row #>
<# start footer #>
</table>
<# end footer #>
<# start no results #>
<h4 class="alert alert-warning text-center">No Invoice Records Found</h4>
<# end no results #>
<# end list #>
Hashtag Markup for
Process Action:
/invoices/process
<# update record for "invoices.<#[url.id]#>";
set subtotal to <# qty #> * <# each as number #>;
set tax to <# subtotal #> * .10;
set total to <# subtotal #> + <# tax #>;
round total to 2 decimals;
set status to "processed";
redirect to "/invoices/list?index=<#[url.id]#>";
#>
Hashtag Markup for
Increase Qty Action:
/invoices/update
<# update record for "invoices.<#[url.id]#>";
set status to "updated";
set qty to <# qty #> + 1;
set subtotal to "";
set tax to "";
set total to "";
redirect to "/invoices/list?index=<#[url.id]#>";
#>
Hashtag Markup for
Clone Action:
/invoices/clone
<# clone invoices.<#[url.id]#> as "new_invoice";
redirect to "/invoices/list?index=<#[url.id]#>";
#>
Hashtag Markup for
Delete Action:
/invoices/delete
<# delete record for invoices.<#[url.id]#> as "new_invoice";
redirect to "/invoices/list?index=<#[url.id]#>";
#>