diff options
Diffstat (limited to 'UI')
-rw-r--r-- | UI/lib/elements.html | 2 | ||||
-rw-r--r-- | UI/payments/payments_detail.html | 54 |
2 files changed, 50 insertions, 6 deletions
diff --git a/UI/lib/elements.html b/UI/lib/elements.html index e22bd026..f42aaf5d 100644 --- a/UI/lib/elements.html +++ b/UI/lib/elements.html @@ -220,7 +220,7 @@ ?> <?lsmb FOREACH element_attribute IN all_keys # Loop through each allowed attribute. ?> <?lsmb - IF attribute_data.defined(element_attribute); # Add the attribute to the element if it's been set. + IF attribute_data.defined(element_attribute) and (attribute_data.${element_attribute} != ""); # Add the attribute to the element if it's been set. all_attributes = all_attributes _ " " _ element_attribute _ '="' _ attribute_data.${element_attribute} _ '"'; ELSIF attribute_defaults.defined(element_attribute); # Fall back to default value if one is supplied. all_attributes = all_attributes _ " " _ element_attribute _ '="' _ attribute_defaults.${element_attribute} _ '"'; diff --git a/UI/payments/payments_detail.html b/UI/payments/payments_detail.html index b028a0d1..206d0d59 100644 --- a/UI/payments/payments_detail.html +++ b/UI/payments/payments_detail.html @@ -168,8 +168,9 @@ <th class="payment"><?lsmb text('Payment') ?></th> <th class="payment"><?lsmb text('Details') ?></th> </tr> - <?lsmb rc = 1 ?><?lsmb count = 0 ?> + <?lsmb rc = 1 ?><?lsmb count = 0 ?><?lsmb grand_total = 0 ?> <?lsmb FOREACH r = contact_invoices ?> + <?lsmb contact_total = 0 ?> <?lsmb rc = (rc + 1) % 2; count = count + 1 ?> <tr class="listrow<?lsmb rc ?>"> <td class="account_number" rowspan="2" > @@ -178,11 +179,16 @@ name = "contact_$count" value = r.contact_id } ?> + <?lsmb IF action == "update_payments" -?> + <?lsmb IF !${"id_$r.contact_id"} -?> + <?lsmb r.unselected = 1 -?> + <?lsmb END # IF !${"id_$r.contact_id"} -?> + <?lsmb END # IF action ... -?> <?lsmb INCLUDE input element_data = { type = "checkbox" name = "id_$r.contact_id" value = r.contact_id - checked = (r.unselected) ? "" : "checked" + checked = (r.unselected) ? undef : "checked" } ?> <?lsmb r.account_number ?> @@ -198,20 +204,20 @@ name = "paid_$r.contact_id" value = "some" label = text('Some') - checked = ("${paid_$r.contact_id}" == 'some') ? checked : "" + checked = (${"paid_$r.contact_id"} == 'some') ? "checked" : "" type = "radio" } ?> <?lsmb INCLUDE input element_data = { name = "paid_$r.contact_id" value = "all" label = text('All') - checked = ("${paid_$r.contact_id}" != 'some') ? checked : "" + checked = (${"paid_$r.contact_id"} != 'some') ? "checked" : "" type = "radio" } ?> </td> <td rowspan = 2><?lsmb INCLUDE input element_data = { name = "source_$r.contact_id" - value = r.source + value = (${"source_$r.contact_id"}) ? ${"source_$r.contact_id"} : r.source type = "text" size = "20" label = text('Source') @@ -267,6 +273,7 @@ type = "text" class = "monetary" } ?> + <?lsmb contact_total = contact_total + ${"payment_$r.contact_id_$i.0"} ?> <?lsmb INCLUDE input element_data = { type = "hidden" name = "invoice_${r.contact_id}_$icount" @@ -285,9 +292,40 @@ name = "invoice_count_${r.contact_id}" value = icount } ?> + <?lsmb IF !r.unselected; + IF (${"paid_$r.contact_id"} == 'all'); + grand_total = grand_total + r.total_due; + ELSIF (${"paid_$r.contact_id"} == 'some'); + grand_total = grand_total + contact_total; + ELSE; + contact_total = 'error'; + END; # IF (paid...) + END # IF !r.unselected) ?> + <tr class="subtotal"> + <td colspan="5" class="total_label"> + <?lsmb text('Contact Total (if paying "some")') ?> + </td> + <td><span id='<?lsmb ${"contact_total_$r.id"} ?>'> + <?lsmb INCLUDE format_money number= contact_total ?> + </span><span class="currency"> + <?lsmb currency ?></span> + </td> + </tr> </table> </tr> <?lsmb END # foreach r ?> + <tr class="subtotal"> + <td> </td> + <td class="total_label"><?lsmb text('Grand Total') ?></td> + <td> + <span id="grand_total"> + <?lsmb INCLUDE format_money number = grand_total ?> + </span> + <span class="currency"> + <?lsmb currency ?> + </span> + </td> + </tr> </table> <?lsmb INCLUDE input element_data = { type = "hidden" @@ -300,6 +338,12 @@ value = '1' } ?> <?lsmb INCLUDE button element_data = { + text = text('Update'), + value = 'update_payments' + class = "submit" + name = 'action' + } ?> + <?lsmb INCLUDE button element_data = { text = text((batch_id) ? 'Save' : 'Post'), value = 'post_payments_bulk' class = "submit" |