public function form($id = NULL) { if ($this->input->post('btn_cancel')) { redirect('payments'); } if ($this->mdl_payments->run_validation()) { $id = $this->mdl_payments->save($id); redirect('payments'); } if (!$this->input->post('btn_submit')) { $prep_form = $this->mdl_payments->prep_form($id); if ($id and !$prep_form) { show_404(); } } $this->load->model('invoices/mdl_invoices'); $this->load->model('payment_methods/mdl_payment_methods'); $open_invoices = $this->mdl_invoices->where('ip_invoice_amounts.invoice_balance >', 0)->get()->result(); $amounts = array(); $invoice_payment_methods = array(); foreach ($open_invoices as $open_invoice) { $amounts['invoice' . $open_invoice->invoice_id] = format_amount($open_invoice->invoice_balance); $invoice_payment_methods['invoice' . $open_invoice->invoice_id] = $open_invoice->payment_method; } $this->layout->set(array('payment_id' => $id, 'payment_methods' => $this->mdl_payment_methods->get()->result(), 'open_invoices' => $open_invoices, 'amounts' => json_encode($amounts), 'invoice_payment_methods' => json_encode($invoice_payment_methods))); if ($id) { $this->layout->set('payment', $this->mdl_payments->where('ip_payments.payment_id', $id)->get()->row()); } $this->layout->buffer('content', 'payments/form'); $this->layout->render(); }
private function get_total_amount_of($type, $date) { $mysqli = Connector::get_connection(); $query_result = $mysqli->query("SELECT sum(amount) FROM {$type}s WHERE date = '{$date}' AND user_id = {$_SESSION['id_user']}"); $result = $query_result->fetch_assoc(); return format_amount($result['sum(amount)']); $mysqli->close(); }
public function testFormatAmount() { $this->assertEquals(format_amount(123.45), '123,45', 'pos: 1'); $this->assertEquals(format_amount(123), '123,00', 'pos: 2'); $this->assertEquals(format_amount(5678), '5 678,00', 'pos: 3'); $this->assertEquals(format_amount(-123.1), '-123,10', 'pos: 4'); $this->assertEquals(format_amount('3456.1'), '3 456,10', 'pos: 5'); }
public function process_item_selections() { $this->load->model('mdl_item_lookups'); $items = $this->mdl_item_lookups->where_in('item_lookup_id', $this->input->post('item_lookup_ids'))->get()->result(); foreach ($items as $item) { $item->item_price = format_amount($item->item_price); } echo json_encode($items); }
public function process_product_selections() { $this->load->model('mdl_products'); $products = $this->mdl_products->where_in('product_id', $this->input->post('product_ids'))->get()->result(); foreach ($products as $product) { $product->product_price = format_amount($product->product_price); } echo json_encode($products); }
public function prep_form($id = NULL) { $return = FALSE; if ($id) { $return = parent::prep_form($id); $this->set_form_value('item_price', format_amount($this->form_value('item_price'))); } return $return; }
public function form($id = null) { if ($this->input->post('btn_cancel')) { redirect('payments'); } if ($this->mdl_payments->run_validation()) { $id = $this->mdl_payments->save($id); $this->load->model('custom_fields/mdl_payment_custom'); $this->mdl_payment_custom->save_custom($id, $this->input->post('custom')); redirect('payments'); } if (!$this->input->post('btn_submit')) { $prep_form = $this->mdl_payments->prep_form($id); if ($id and !$prep_form) { show_404(); } $this->load->model('custom_fields/mdl_payment_custom'); $payment_custom = $this->mdl_payment_custom->where('payment_id', $id)->get(); if ($payment_custom->num_rows()) { $payment_custom = $payment_custom->row(); unset($payment_custom->payment_id, $payment_custom->payment_custom_id); foreach ($payment_custom as $key => $val) { $this->mdl_payments->set_form_value('custom[' . $key . ']', $val); } } } else { if ($this->input->post('custom')) { foreach ($this->input->post('custom') as $key => $val) { $this->mdl_payments->set_form_value('custom[' . $key . ']', $val); } } } $this->load->model('invoices/mdl_invoices'); $this->load->model('payment_methods/mdl_payment_methods'); $this->load->model('custom_fields/mdl_custom_fields'); $open_invoices = $this->mdl_invoices->where('ip_invoice_amounts.invoice_balance >', 0)->get()->result(); $amounts = array(); $invoice_payment_methods = array(); foreach ($open_invoices as $open_invoice) { $amounts['invoice' . $open_invoice->invoice_id] = format_amount($open_invoice->invoice_balance); $invoice_payment_methods['invoice' . $open_invoice->invoice_id] = $open_invoice->payment_method; } $this->layout->set(array('payment_id' => $id, 'payment_methods' => $this->mdl_payment_methods->get()->result(), 'open_invoices' => $open_invoices, 'custom_fields' => $this->mdl_custom_fields->by_table('ip_payment_custom')->get()->result(), 'amounts' => json_encode($amounts), 'invoice_payment_methods' => json_encode($invoice_payment_methods))); if ($id) { $this->layout->set('payment', $this->mdl_payments->where('ip_payments.payment_id', $id)->get()->row()); } $this->layout->buffer('content', 'payments/form'); $this->layout->render(); }
function affichage_histo($user) { $histo = get_histo($user); $return = "<table id='historique' class='table table-striped'>"; foreach ($histo as $elt) { $return .= '<tr>'; if ($elt['type'] == "DEPENSE") { $return .= '<td>' . date('d/m/y H:i', $elt[0]) . '</td><td>' . $elt[1] . ' (' . $elt[4] . ')</td><td><span class="label label-important"> <i class="icon-minus icon-white"></i> ' . format_amount($elt[6]) . ' €</span></td>'; } else { $return .= '<td>' . date('d/m/y H:i', $elt[0]) . '</td><td>Rechargement</td><td><span class="label label-success"> <i class="icon-plus icon-white"></i> ' . format_amount($elt[5]) . ' €</span></td>'; } $return .= "</tr>"; } $return .= "</table>"; $return .= '<div class="pagination pagination-centered"><ul id="paging"></ul></div>'; return $return; }
<input type="text" name="payment_date" id="payment_date" value="<?php echo date_from_mysql($this->mdl_payments->form_value('payment_date')); ?> " readonly> <span class="add-on"><i class="icon-th"></i></span> </div> </div> <div class="control-group"> <label class="control-label"><?php echo lang('amount'); ?> : </label> <div class="controls"> <input type="text" name="payment_amount" id="payment_amount" value="<?php echo format_amount($this->mdl_payments->form_value('payment_amount')); ?> "> </div> </div> <div class="control-group"> <label class="control-label"><?php echo lang('payment_method'); ?> : </label> <div class="controls"> <select name="payment_method_id"> <option value="0"></option> <?php
echo format_date($invoice['invoice_date_created']); ?> </td> <td><a href="<?php echo site_url('clients/editclient/' . $invoice['client_id']); ?> "><?php echo ucwords($invoice['client_name']); ?> </a></td> <td class="text-right invoice_amt"><?php echo format_amount($invoice['invoice_amount']); ?> </td> <td class="text-right amt_paid"><?php echo format_amount($invoice['total_paid']); ?> </td> <td style="width:32%"> <a href="<?php echo site_url('invoices/edit/' . $invoice['invoice_id']); ?> " class="btn btn-xs btn-primary"><i class="fa fa-check"> Edit </i></a> <a href="javascript:;" onclick="enterPayment('<?php echo $invoice['invoice_id']; ?> ')" class="btn btn-success btn-xs"><i class="fa fa-usd"> Enter Payment </i></a> <a href="javascript:;" class="btn btn-info btn-xs" onclick="viewInvoice('<?php echo $invoice['invoice_id']; ?> ')"><i class="fa fa-search"> Preview </i></a>
?> </td> <td class="text-right"><?php echo format_amount($payment['payment_amount']); ?> </td> </tr> <?php $total = $total + $payment['payment_amount']; } ?> <tr class="table_header"> <td>TOTAL </td> <td></td> <td></td> <td class="text-right"><?php echo format_amount($total); ?> </td> </tr> <?php } else { ?> <tr class="no-cell-border transaction-row"> <td colspan="7"> There are no records to display at the moment.</td> </tr> <?php } ?> </tbody> </table>
$items_array = array(); if ($row['invoiceId'] != '0') { $fromInvoice = 'Yes'; } else { $fromInvoice = 'No'; } if ($row['paymentAmount'] != '') { $paymentAmount = $curSym . format_amount($row['paymentAmount'], 2); } else { $paymentAmount = ''; } if ($row['additionalFee'] != '') { $additionalFee = $curSym . format_amount($row['additionalFee'], 2); } else { $additionalFee = ''; } $lineTotal = $curSym . format_amount($row['paymentAmount'] + $row['additionalFee'], 2); $items_array[] = clean($row['projectName']); $items_array[] = clean($row['theClient']); $items_array[] = clean($row['theAdmin']); $items_array[] = $row['paymentDate']; $items_array[] = clean($row['paymentFor']); $items_array[] = clean($row['paidBy']); $items_array[] = $fromInvoice; $items_array[] = $paymentAmount; $items_array[] = $additionalFee; $items_array[] = $lineTotal; $items_array[] = clean($row['paymentNotes']); // Output the Data to the CSV fputcsv($output, $items_array); }
<th><?php echo $dateCreatedTableHead; ?> </th> <th><?php echo $dateDueText; ?> </th> <th><?php echo $statusText; ?> </th> </tr> <?php while ($row = mysqli_fetch_assoc($res)) { $projectFee = $curSym . format_amount($row['projectFee'], 2); if ($row['archiveProj'] == '1') { $archived = '<strong class="text-danger">' . $closedArchivedText . '</strong>'; } else { $archived = $activeProjectText; } ?> <tr> <td data-th="<?php echo $projectText; ?> "> <span data-toggle="tooltip" data-placement="right" title="<?php echo $viewProject; ?> ">
$clientAddress = ''; } if ($row['clientPhone'] != '') { $clientPhone = decryptIt($row['clientPhone']); } else { $clientPhone = ''; } // Format the Amounts $paymentAmount = $curSym . format_amount($row['paymentAmount'], 2); if ($row['additionalFee'] != '') { $additionalFee = $curSym . format_amount($row['additionalFee'], 2); } else { $additionalFee = $noneText; } $total = $row['paymentAmount'] + $row['additionalFee']; $totalPaid = $curSym . format_amount($total, 2); // Get Site Alert Data $alert = "SELECT\n isActive,\n invoicePrint,\n alertText,\n\t\t\t\t\tUNIX_TIMESTAMP(alertDate) AS orderDate,\n\t\t\t\t\talertExpires\n FROM\n sitealerts\n WHERE\n\t\t\t\t\tinvoicePrint = 1\n\t\t\t\tORDER BY\n\t\t\t\t\torderDate DESC"; $alertres = mysqli_query($mysqli, $alert) or die('-2' . mysqli_error()); include 'includes/navigation.php'; if ($row['clientId'] != $clientId) { ?> <div class="content"> <h3><?php echo $accessErrorHeader; ?> </h3> <div class="alertMsg danger"> <i class="fa fa-warning"></i> <?php echo $permissionDenied; ?>
// Get the Invoice Total $x = "SELECT\n\t\t\t\t\t\t\t\t\titemAmount,\n\t\t\t\t\t\t\t\t\titemqty\n\t\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\t\tinvitems\n\t\t\t\t\t\t\t\tWHERE invoiceId = " . $row['invoiceId']; $y = mysqli_query($mysqli, $x) or die('-3' . mysqli_error()); $lineTotal = 0; while ($z = mysqli_fetch_assoc($y)) { $lineItem = $z['itemAmount'] * $z['itemqty']; $lineTotal += $lineItem; } $lineTotal = $curSym . format_amount($lineTotal, 2); // Get the Payment data $paid = "SELECT\n\t\t\t\t\t\t\t\t\tinvoiceId,\n\t\t\t\t\t\t\t\t\tpaymentAmount,\n\t\t\t\t\t\t\t\t\tadditionalFee\n\t\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\t\tprojectpayments\n\t\t\t\t\t\t\t\tWHERE invoiceId = " . $row['invoiceId']; $results = mysqli_query($mysqli, $paid) or die('-2' . mysqli_error()); $cols = mysqli_fetch_assoc($results); $invAmountPaid = $curSym . format_amount($cols['paymentAmount'] + $cols['additionalFee'], 2); if ($cols['additionalFee'] != '') { $additionalFee = $curSym . format_amount($cols['additionalFee'], 2); } else { $additionalFee = ''; } ?> <tr> <td data-th="<?php echo $invoiceTableHead; ?> "> <span data-toggle="tooltip" data-placement="right" title="View Invoice"> <a href="index.php?action=viewInvoice&invoiceId=<?php echo $row['invoiceId']; ?> "><?php echo clean($row['invoiceTitle']);
if ($invoice->is_read_only == 1) { echo 'disabled="disabled"'; } ?> > </div> </td> <td class="td-amount "> <div class="input-group"> <span class="input-group-addon"><?php echo lang('item_discount'); ?> </span> <input type="text" name="item_discount_amount" class="input-sm form-control amount" value="<?php echo format_amount($item->item_discount_amount); ?> " data-toggle="tooltip" data-placement="bottom" title="<?php echo $this->mdl_settings->setting('currency_symbol') . ' ' . lang('per_item'); ?> " <?php if ($invoice->is_read_only == 1) { echo 'disabled="disabled"'; } ?> > </div> </td>
/** * pZ: format_round_amount * * @param $amount * * @return float|null */ function format_round_amount($amount) { $amount_round = floor($amount); if ($amount_round == $amount) { return $amount_round; } return format_amount($amount); }
echo date('d/m/Y', strtotime($quote['date_created'])); ?> </td> <td><?php echo date('d/m/Y', strtotime($quote['valid_until'])); ?> </td> <td><a href="<?php echo site_url('clients/editclient/' . $quote['client_id']); ?> "><?php echo ucwords($quote['client_name']); ?> </a></td> <td class="text-right"><?php echo format_amount($quote['quote_amount']); ?> </td> <td style="width:25%"> <a href="<?php echo site_url('quotes/edit/' . $quote['quote_id']); ?> " class="btn btn-xs btn-primary"><i class="fa fa-check"> Edit </i></a> <a href="javascript:;" class="btn btn-info btn-xs" onclick="viewQuote('<?php echo $quote['quote_id']; ?> ')"><i class="fa fa-search"> Preview </i></a> <a href="<?php echo site_url('quotes/viewpdf/' . $quote['quote_id']); ?> " class="btn btn-warning btn-xs">Download pdf </a>
?> </label></td></tr> <tr><td colspan="6" class="text-right no-border">INVOICE DISCOUNT : </td><td class="text-right no-border"><label><?php echo format_amount($invoice_details['invoice_details']->invoice_discount); ?> </label></td></tr> <tr><td colspan="6" class="text-right no-border">NEW SUB TOTAL : </td><td class="text-right"><label><?php echo format_amount($invoice_details['invoice_totals']['sub_total'] - $invoice_details['invoice_details']->invoice_discount); ?> </label></td></tr> <tr><td colspan="6" class="text-right no-border">AMOUNT PAID : </td><td class="text-right no-border invoice_amount_paid"><label><?php echo format_amount($invoice_details['invoice_totals']['amount_paid']); ?> </label></td></tr> <tr><td colspan="6" class="text-right no-border">AMOUNT DUE : </td><td class="text-right invoice_amount_due"><label><?php echo format_amount($invoice_details['invoice_totals']['amount_due']); ?> </label></td> </tr> <tr class="table_header"><td colspan="7"></td></tr> <tr><td colspan="7"> <h4>Invoice Terms </h4> <?php echo $invoice_details['invoice_details']->invoice_terms; ?> <hr/> </td></tr> </div> </div> </div> </div>
<?php // First loop through data: calculate totals $defaultTotal = 0.0; $budgetTotal = 0.0; // Need the abs_total to calculate row percentages foreach ($budget_list as $account_data) { // account_list (account_name, account_total, account_id) $defaultTotal += $account_data[1]; $budgetTotal += $account_data[2]; } // Second loop: display data // foreach ($account_list as $account_data) foreach ($budget_list as $account_id => $budget_data) { $accountName = htmlspecialchars($budget_data[0]); $defaultBudget = format_amount($budget_data[1]); $budgetAmount = format_amount($budget_data[2]); $budgetStyle = ''; if ($defaultBudget != $budgetAmount) { // This month's budget is not the default $budgetStyle = 'color: red;"'; } $budgetId = $budget_data[3]; $accountDescr = htmlspecialchars($budget_data[4]); $budgetComment = htmlspecialchars($budget_data[5]); $newBudget = $budgetAmount; if ($budgetAmount == null) { // Apply default to budget when undefined $newBudget = $defaultBudget; } echo "\t<tr> \n" . "\t\t<input type='hidden' name='accountIds[]' value='{$account_id}' />" . "\t\t<input type='hidden' name='budgetIds[]' value='{$budgetId}' />" . "\t\t<td title=\"{$accountDescr}\">{$accountName}</td> \n" . "\t\t<td><input type='text' name='defaultBudgets[]' " . "maxlength='9' value='{$defaultBudget}' size='10' /></td> \n" . "\t\t<td style='text-align: right; {$budgetStyle}'>{$budgetAmount}</td> \n" . "\t\t<td><input type='text' name='budgetAmounts[]' " . "maxlength='9' value='{$newBudget}' size='10' /></td> \n" . "\t\t<td><input style='text-align: left;' type='text' name='budgetComments[]' " . "maxlength='100' size='50' value=\"{$budgetComment}\" /></td> \n" . "\t</tr> \n\n"; }
echo format_amount(0); ?> </span></label></td> </tr> <tr class="text-right"> <td colspan="4" class="no-border">Total Tax :</td> <td><label><span id="quote_total_tax"><?php echo format_amount(0); ?> </span></label></td> </tr> <tr class="text-right"> <td colspan="4" class="no-border"> Total Amount Due : </td> <td class="invoice_amount_due"><label><span id="quote_amount_due"><?php echo format_amount(0); ?> </span></label></td> </tr> </tbody> </table> <div class="form-group"> <label> Quote Terms </label> <textarea name="quote_terms" class="form-control" id="quote_terms"></textarea> </div> </div> </div> </div> </div>
</td> <td style="text-align:right;" class="td-amount td-vert-middle"> <span name="unit_profit" class="amount"> <?php #echo format_currency($item->item_subtotal); ?> </span> </td> <td style="text-align:right;" class="td-amount td-vert-middle"> <span name="line_profit" class="amount"> <?php #echo format_currency($item->item_subtotal); ?> </span> </td> <td style="display: none;" class="td-amount "> <div class="input-group"> <span class="input-group-addon"><?php echo lang('item_discount'); ?></span> <input type="text" name="item_discount_amount" class="input-sm form-control amount" value="<?php echo format_amount($item->item_discount_amount); ?>" data-toggle="tooltip" data-placement="bottom" title="<?php echo $this->mdl_settings->setting('currency_symbol') . ' ' . lang('per_item'); ?>"> </div> </td> <td style="display: none;" class="td-amount"> <div class="input-group"> <select name="item_tax_rate_id" name="item_tax_rate_id" class="form-control input-sm"> <option value="1"><?php echo "20%"; ?></option> </select> </div> </td> <td style="display: none;" class="td-amount td-vert-middle"> <span><?php echo lang('discount'); ?></span><br/> <span name="item_discount_total" class="amount">
?> </th> </tr> </thead> <tbody> <?php foreach ($tax_rates as $tax_rate) { ?> <tr> <td><?php echo $tax_rate->tax_rate_name; ?> </td> <td><?php echo format_amount($tax_rate->tax_rate_percent); ?> %</td> <td> <div class="options btn-group"> <a class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown" href="#"> <i class="fa fa-cog"></i> <?php echo lang('options'); ?> </a> <ul class="dropdown-menu"> <li> <a href="<?php echo site_url('tax_rates/form/' . $tax_rate->tax_rate_id); ?> ">
<tbody> <?php if (isset($invoice_payments) && $invoice_payments->num_rows() > 0) { foreach ($invoice_payments->result_array() as $count => $payment) { ?> <tr> <td><?php echo format_date($payment['payment_date']); ?> </td> <td><?php echo $payment['payment_method_name']; ?> </td> <td><?php echo format_amount($payment['payment_amount']); ?> </td> <td><?php echo $payment['payment_note']; ?> </td> </tr> <?php } } else { ?> <tr> <td colspan="4">No payment has been made for this invoice.</td> </tr> <?php
if ($amtDue == '0.00') { $due = $paidInFullText; $highlight = ''; } else { $due = $totalDue; $highlight = 'text-danger'; } if ($fromInvoice != '') { $qry = "SELECT\n\t\t\t\t\titemAmount,\n\t\t\t\t\titemqty\n\t\t\t\tFROM\n\t\t\t\t\tinvitems\n\t\t\t\tWHERE invoiceId = " . $invId; $result = mysqli_query($mysqli, $qry) or die('-4' . mysqli_error()); $lineTotal = 0; while ($col = mysqli_fetch_assoc($result)) { $lineItem = $col['itemAmount'] * $col['itemqty']; $lineTotal += $lineItem; } $lineTotal = $curSym . format_amount($lineTotal, 2); } include 'includes/navigation.php'; if ($row['clientId'] != $clientId) { ?> <div class="content"> <h3><?php echo $accessErrorHeader; ?> </h3> <div class="alertMsg danger"> <i class="fa fa-warning"></i> <?php echo $permissionDenied; ?> </div> </div>
?> </th> <th><?php echo $dateReqText; ?> </th> <th><?php echo $statusText; ?> </th> <th></th> </tr> <?php while ($row = mysqli_fetch_assoc($res)) { if (!empty($row['requestBudget'])) { $requestBudget = $curSym . format_amount($row['requestBudget'], 2); } else { $requestBudget = ''; } if ($row['requestAccepted'] == '0') { $requestAccepted = 'Open'; } else { if ($row['requestAccepted'] == '1') { $requestAccepted = '<strong class="text-success">Accepted</strong>'; } else { $requestAccepted = '<strong class="text-danger">Declined</strong>'; } } ?> <tr> <td data-th="<?php
<?php } ?> <tr> <td class="no-bottom-border" colspan="4"></td> <td class="text-right"><?php echo trans('discount'); ?> :</td> <td class="amount"> <?php if ($invoice->invoice_discount_percent > 0) { echo format_amount($invoice->invoice_discount_percent) . ' %'; } else { echo format_amount($invoice->invoice_discount_amount); } ?> </td> </tr> <tr> <td class="no-bottom-border" colspan="4"></td> <td class="text-right"><?php echo trans('total'); ?> :</td> <td class="amount"><?php echo format_currency($invoice->invoice_total); ?> </td>
<form > <input type="hidden" name="invoice_id" id="invoice_id" value="<?php echo $invoice_id; ?> "> <div class="form-group"> <label for="payment_amount"><?php echo lang('amount'); ?> </label> <div class="controls"> <input type="text" name="payment_amount" id="payment_amount" class="form-control" value="<?php echo format_amount($invoice_balance); ?> "> </div> </div> <div class="form-group has-feedback"> <label class="payment_date"><?php echo lang('payment_date'); ?> </label> <div class="date datepicker"> <input size="16" type="text" name="payment_date" id="payment_date" value="<?php
?> <tr class="border-bottom-n <?php echo $linecounter % 2 ? 'background-l' : ''; ?> "> <td><?php echo $item->item_name; ?> </td> <td><?php echo nl2br($item->item_description); ?> </td> <td class="text-right"> <?php echo format_amount($item->item_quantity); ?> </td> <td class="text-right"> <?php echo format_currency($item->item_price); ?> </td> <td class="text-right"> <?php echo format_currency($item->item_subtotal); ?> </td> </tr> <?php $linecounter++;
<span class="pull-left"><?php echo lang('price'); ?> </span> <span class="pull-right amount"><?php format_amount($item->item_price); ?> </span> </td> <td> <span class="pull-left"><?php echo lang('tax'); ?> </span> <span class="pull-right amount"><?php echo format_amount($item->item_tax_total); ?> </span> </td> <td> <span class="pull-left"><?php echo lang('total'); ?> </span> <span class="pull-right amount"><?php echo format_currency($item->item_total); ?> </span> </td> </tr> </tbody>