本文整理汇总了PHP中format_amount函数的典型用法代码示例。如果您正苦于以下问题:PHP format_amount函数的具体用法?PHP format_amount怎么用?PHP format_amount使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了format_amount函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: form
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();
}
示例2: get_total_amount_of
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();
}
示例3: testFormatAmount
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');
}
示例4: process_item_selections
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);
}
示例5: process_product_selections
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);
}
示例6: prep_form
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;
}
示例7: form
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();
}
示例8: affichage_histo
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;
}
示例9: date_from_mysql
<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
示例10: format_date
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>
示例11: format_amount
?>
</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>
示例12: array
$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);
}
示例13: while
<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;
?>
">
示例14: decryptIt
$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;
?>
示例15: mysqli_query
// 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']);