<?php //Get default paidAmount try { $dataFees["gibbonFinanceInvoiceID"] = $row["gibbonFinanceInvoiceID"]; $sqlFees = "SELECT gibbonFinanceInvoiceFee.gibbonFinanceInvoiceFeeID, gibbonFinanceInvoiceFee.feeType, gibbonFinanceFeeCategory.name AS category, gibbonFinanceInvoiceFee.name AS name, gibbonFinanceInvoiceFee.fee, gibbonFinanceInvoiceFee.description AS description, NULL AS gibbonFinanceFeeID, gibbonFinanceInvoiceFee.gibbonFinanceFeeCategoryID AS gibbonFinanceFeeCategoryID, sequenceNumber FROM gibbonFinanceInvoiceFee JOIN gibbonFinanceFeeCategory ON (gibbonFinanceInvoiceFee.gibbonFinanceFeeCategoryID=gibbonFinanceFeeCategory.gibbonFinanceFeeCategoryID) WHERE gibbonFinanceInvoiceID=:gibbonFinanceInvoiceID ORDER BY sequenceNumber"; $resultFees = $connection2->prepare($sqlFees); $resultFees->execute($dataFees); } catch (PDOException $e) { } $paidAmountDefault = 0; while ($rowFees = $resultFees->fetch()) { $paidAmountDefault = $paidAmountDefault + $rowFees["fee"]; } //If some paid already, work out amount, and subtract it off if ($row["status"] == "Paid - Partial") { $alreadyPaid = getAmountPaid($connection2, $guid, "gibbonFinanceInvoice", $gibbonFinanceInvoiceID); $paidAmountDefault -= $alreadyPaid; } ?> <input name="paidAmount" id="paidAmount" maxlength=14 value="<?php print number_format($paidAmountDefault, 2, '.', ''); ?> " type="text" style="width: 300px"> <script type="text/javascript"> var paidAmount=new LiveValidation('paidAmount'); paidAmount.add( Validate.Format, { pattern: /^(?:\d*\.\d{1,2}|\d+)$/, failureMessage: "Invalid number format!" } ); paidAmount.add(Validate.Presence); </script> </td> </tr> <?php
?> " /></td> <td><?php echo $value['invoice_number']; ?> </td> <td><?php echo $value['status']; ?> </td> <td><?php echo $value['date_issued']; ?> </td> <td><?php $paid = getAmountPaid($value['invoice_number']); echo $paid[0]['paid']; ?> </td> <td><?php $bal = $value['amount'] - $paid[0]['paid']; echo $bal; ?> </td> <td><?php echo $value['amount']; ?> </td> <td><a href="<?php echo $link; ?>