本文整理汇总了PHP中to_currency函数的典型用法代码示例。如果您正苦于以下问题:PHP to_currency函数的具体用法?PHP to_currency怎么用?PHP to_currency使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了to_currency函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rupiah
function rupiah($number)
{
if ($number == 0) {
return '-';
}
return to_currency($number);
}
示例2: get_items_barcode_data
function get_items_barcode_data($item_ids)
{
$CI =& get_instance();
$result = array();
$item_ids = explode('~', $item_ids);
foreach ($item_ids as $item_id) {
$item_info = $CI->Item->get_info($item_id);
$item_location_info = $CI->Item_location->get_info($item_id);
$today = strtotime(date('Y-m-d'));
$is_item_location_promo = $item_location_info->start_date !== NULL && $item_location_info->end_date !== NULL && (strtotime($item_location_info->start_date) <= $today && strtotime($item_location_info->end_date) >= $today);
$is_item_promo = $item_info->start_date !== NULL && $item_info->end_date !== NULL && (strtotime($item_info->start_date) <= $today && strtotime($item_info->end_date) >= $today);
$regular_item_price = $item_location_info->unit_price ? $item_location_info->unit_price : $item_info->unit_price;
if ($is_item_location_promo) {
$item_price = $item_location_info->promo_price;
} elseif ($is_item_promo) {
$item_price = $item_info->promo_price;
} else {
$item_price = $item_location_info->unit_price ? $item_location_info->unit_price : $item_info->unit_price;
}
if ($CI->config->item('barcode_price_include_tax')) {
if ($item_info->tax_included) {
$result[] = array('name' => ($is_item_location_promo || $is_item_promo ? '<span style="text-decoration: line-through;">' . to_currency($regular_item_price) . '</span> ' : ' ') . to_currency($item_price) . ': ' . $item_info->name, 'id' => number_pad($item_id, 10));
} else {
$result[] = array('name' => ($is_item_location_promo || $is_item_promo ? '<span style="text-decoration: line-through;">' . to_currency(get_price_for_item_including_taxes($item_id, $regular_item_price)) . '</span> ' : ' ') . to_currency(get_price_for_item_including_taxes($item_id, $item_price)) . ': ' . $item_info->name, 'id' => number_pad($item_id, 10));
}
} else {
if ($item_info->tax_included) {
$result[] = array('name' => ($is_item_location_promo || $is_item_promo ? '<span style="text-decoration: line-through;">' . to_currency(get_price_for_item_excluding_taxes($item_id, $regular_item_price)) . '</span> ' : ' ') . to_currency(get_price_for_item_excluding_taxes($item_id, $item_price)) . ': ' . $item_info->name, 'id' => number_pad($item_id, 10));
} else {
$result[] = array('name' => ($is_item_location_promo || $is_item_promo ? '<span style="text-decoration: line-through;">' . to_currency($regular_item_price) . '</span> ' : ' ') . to_currency($item_price) . ': ' . $item_info->name, 'id' => number_pad($item_id, 10));
}
}
}
return $result;
}
示例3: get_item_kits_barcode_data
function get_item_kits_barcode_data($item_kits_ids)
{
$CI =& get_instance();
$result = array();
$item_kit_ids = explode('~', $item_kits_ids);
foreach ($item_kit_ids as $item_kit_id) {
$item_kit_info = $CI->Item_kit->get_info($item_kit_id);
$item_kit_location_info = $CI->Item_kit_location->get_info($item_kit_id);
$item_kit_price = $item_kit_location_info->unit_price ? $item_kit_location_info->unit_price : $item_kit_info->unit_price;
if ($CI->config->item('barcode_price_include_tax')) {
if ($item_kit_info->tax_included) {
$result[] = array('name' => to_currency($item_kit_price) . ' ' . $item_kit_info->name, 'id' => 'KIT ' . number_pad($item_kit_id, 10));
} else {
$result[] = array('name' => to_currency(get_price_for_item_kit_including_taxes($item_kit_id, $item_kit_price)) . ': ' . $item_kit_info->name, 'id' => 'KIT ' . number_pad($item_kit_id, 10));
}
} else {
if ($item_kit_info->tax_included) {
$result[] = array('name' => to_currency(get_price_for_item_kit_excluding_taxes($item_kit_id, $item_kit_price)) . ': ' . $item_kit_info->name, 'id' => 'KIT ' . number_pad($item_kit_id, 10));
} else {
$result[] = array('name' => to_currency($item_kit_price) . ': ' . $item_kit_info->name, 'id' => 'KIT ' . number_pad($item_kit_id, 10));
}
}
}
return $result;
}
示例4: manage_display_layout
private function manage_display_layout($layout_type, $item, $barcode_config)
{
$result = '';
if ($layout_type == 'name') {
$result = $this->CI->lang->line('items_name') . " " . $item['name'];
} else {
if ($layout_type == 'category' && isset($item['category'])) {
$result = $this->CI->lang->line('items_category') . " " . $item['category'];
} else {
if ($layout_type == 'cost_price' && isset($item['cost_price'])) {
$result = $this->CI->lang->line('items_cost_price') . " " . to_currency($item['cost_price']);
} else {
if ($layout_type == 'unit_price' && isset($item['unit_price'])) {
$result = $this->CI->lang->line('items_unit_price') . " " . to_currency($item['unit_price']);
} else {
if ($layout_type == 'company_name') {
$result = $this->CI->Appconfig->get('company');
} else {
if ($layout_type == 'item_code') {
$result = $this->CI->Appconfig->get('barcode_content') !== "id" && isset($item['item_number']) ? $item['item_number'] : $item['item_id'];
}
}
}
}
}
}
return $result;
}
示例5: save
public function save($items, $customer_id, $employee_id, $comment, $payments, $sale_id = false)
{
if (count($items) == 0) {
return -1;
}
//Alain Multiple payments
//Build payment types string
$payment_types = '';
foreach ($payments as $payment_id => $payment) {
$payment_types = $payment_types . $payment['payment_type'] . ': ' . to_currency($payment['payment_amount']) . '<br />';
}
$transfer_data = ['sender' => $this->session->userdata('dblocation'), 'receiver' => $customer_id, 'date' => date('Y-m-d H:i:s'), 'payment_type' => $payment_types, 'comment' => $comment];
//Run these queries as a transaction, we want to make sure we do all or nothing
$this->con->trans_start();
$this->con->insert('transfers', $transfer_data);
$transfer_id = $this->con->insert_id();
foreach ($items as $line => $item) {
$cur_item_info = $this->Item->get_info($item['item_id']);
$sales_items_data = ['transfer_id' => $transfer_id, 'item_id' => $item['item_id'], 'quantity_purchased' => $item['quantity'], 'description' => $item['description'], 'serialnumber' => $item['serialnumber'], 'line' => $item['line'], 'item_cost_price' => $cur_item_info->cost_price, 'item_unit_price' => $item['price'], 'discount_percent' => $item['discount']];
$this->con->insert('transfer_items', $sales_items_data);
}
$this->con->trans_complete();
if ($this->con->trans_status() === false) {
return -1;
}
return $transfer_id;
}
示例6: save
function save($items, $customer_id, $employee_id, $comment, $payments, $sale_id = false)
{
if (count($items) == 0) {
return -1;
}
//Alain Multiple payments
//Build payment types string
$payment_types = '';
foreach ($payments as $payment_id => $payment) {
$payment_types = $payment_types . $payment['payment_type'] . ': ' . to_currency($payment['payment_amount']) . '<br />';
}
$sales_data = array('sale_time' => date('Y-m-d H:i:s'), 'customer_id' => $this->Customer->exists($customer_id) ? $customer_id : null, 'employee_id' => $employee_id, 'payment_type' => $payment_types, 'comment' => $comment);
//Run these queries as a transaction, we want to make sure we do all or nothing
$this->db->trans_start();
$this->db->insert('sales', $sales_data);
$sale_id = $this->db->insert_id();
foreach ($payments as $payment_id => $payment) {
if (substr($payment['payment_type'], 0, strlen($this->lang->line('sales_giftcard'))) == $this->lang->line('sales_giftcard')) {
/* We have a gift card and we have to deduct the used value from the total value of the card. */
$splitpayment = explode(':', $payment['payment_type']);
$cur_giftcard_value = $this->Giftcard->get_giftcard_value($splitpayment[1]);
$this->Giftcard->update_giftcard_value($splitpayment[1], $cur_giftcard_value - $payment['payment_amount']);
}
$sales_payments_data = array('sale_id' => $sale_id, 'payment_type' => $payment['payment_type'], 'payment_amount' => $payment['payment_amount']);
$this->db->insert('sales_payments', $sales_payments_data);
}
foreach ($items as $line => $item) {
$cur_item_info = $this->Item->get_info($item['item_id']);
$sales_items_data = array('sale_id' => $sale_id, 'item_id' => $item['item_id'], 'line' => $item['line'], 'description' => $item['description'], 'serialnumber' => $item['serialnumber'], 'quantity_purchased' => $item['quantity'], 'discount_percent' => $item['discount'], 'item_cost_price' => $cur_item_info->cost_price, 'item_unit_price' => $item['price']);
$this->db->insert('sales_items', $sales_items_data);
//Update stock quantity
$item_data = array('quantity' => $cur_item_info->quantity - $item['quantity']);
$this->Item->save($item_data, $item['item_id']);
//Ramel Inventory Tracking
//Inventory Count Details
$qty_buy = -$item['quantity'];
$sale_remarks = 'POS ' . $sale_id;
$inv_data = array('trans_date' => date('Y-m-d H:i:s'), 'trans_items' => $item['item_id'], 'trans_user' => $employee_id, 'trans_comment' => $sale_remarks, 'trans_inventory' => $qty_buy);
$this->Inventory->insert($inv_data);
//------------------------------------Ramel
$customer = $this->Customer->get_info($customer_id);
if ($customer_id == -1 or $customer->taxable) {
foreach ($this->Item_taxes->get_info($item['item_id']) as $row) {
$this->db->insert('sales_items_taxes', array('sale_id' => $sale_id, 'item_id' => $item['item_id'], 'line' => $item['line'], 'name' => $row['name'], 'percent' => $row['percent']));
}
}
}
$this->db->trans_complete();
if ($this->db->trans_status() === FALSE) {
return -1;
}
return $sale_id;
}
示例7: change
public function change($fastUserId = '')
{
$this->load->model('Caja');
$tabular_data = [];
$con = $this->load->database($this->session->userdata('dblocation'), true);
$this->Sale->create_sales_items_temp_table($con);
$this->Receiving->create_receivings_items_temp_table($con);
$this->Caja->con = $con;
$report_data = $this->Caja->getDetailsPayments();
foreach ($report_data as $row) {
$tabular_data[] = [$row['payment_type'], to_currency($row['payment_amount'])];
}
$data = ['data' => $tabular_data, 'headers' => $this->Caja->getDataColumns(), 'summary_data' => $this->Caja->getCierreDetails(), 'fastUser' => $fastUserId];
$this->load->view('caja/cierre_caja', $data);
}
示例8: save
function save($items, $customer_id, $employee_id, $comment, $payments, $sale_id = false)
{
if (count($items) == 0) {
return -1;
}
//Alain Multiple payments
//Build payment types string
$payment_types = '';
foreach ($payments as $payment_id => $payment) {
$payment_types = $payment_types . $payment['payment_type'] . ': ' . to_currency($payment['payment_amount']) . '<br />';
}
$sales_data = array('sale_time' => date('Y-m-d H:i:s'), 'customer_id' => $this->Customer->exists($customer_id) ? $customer_id : null, 'employee_id' => $employee_id, 'payment_type' => $payment_types, 'comment' => $comment);
//Run these queries as a transaction, we want to make sure we do all or nothing
$this->db->trans_start();
$this->db->insert('sales_suspended', $sales_data);
$sale_id = $this->db->insert_id();
foreach ($payments as $payment_id => $payment) {
$sales_payments_data = array('sale_id' => $sale_id, 'payment_type' => $payment['payment_type'], 'payment_amount' => $payment['payment_amount']);
$this->db->insert('sales_suspended_payments', $sales_payments_data);
}
foreach ($items as $line => $item) {
$cur_item_info = $this->Item->get_info($item['item_id']);
$sales_items_data = array('sale_id' => $sale_id, 'item_id' => $item['item_id'], 'line' => $item['line'], 'description' => $item['description'], 'serialnumber' => $item['serialnumber'], 'quantity_purchased' => $item['quantity'], 'discount_percent' => $item['discount'], 'item_cost_price' => $cur_item_info->cost_price, 'item_unit_price' => $item['price']);
$this->db->insert('sales_suspended_items', $sales_items_data);
$customer = $this->Customer->get_info($customer_id);
if ($customer_id == -1 or $customer->taxable) {
foreach ($this->Item_taxes->get_info($item['item_id']) as $row) {
$this->db->insert('sales_suspended_items_taxes', array('sale_id' => $sale_id, 'item_id' => $item['item_id'], 'line' => $item['line'], 'name' => $row['name'], 'percent' => $row['percent']));
}
}
}
$this->db->trans_complete();
if ($this->db->trans_status() === FALSE) {
return -1;
}
return $sale_id;
}
示例9: complete
function complete()
{
$data['cart'] = $this->receiving_lib->get_cart();
$data['total'] = $this->receiving_lib->get_total();
$data['receipt_title'] = $this->lang->line('recvs_receipt');
$data['transaction_time'] = date($this->config->item('dateformat') . ' ' . $this->config->item('timeformat'));
$data['mode'] = $this->receiving_lib->get_mode();
$data['show_stock_locations'] = $this->Stock_location->show_locations('receivings');
$supplier_id = $this->receiving_lib->get_supplier();
$employee_id = $this->Employee->get_logged_in_employee_info()->person_id;
$comment = $this->input->post('comment');
$emp_info = $this->Employee->get_info($employee_id);
$payment_type = $this->input->post('payment_type');
$data['stock_location'] = $this->receiving_lib->get_stock_source();
if ($this->input->post('amount_tendered')) {
$data['amount_tendered'] = $this->input->post('amount_tendered');
$data['amount_change'] = to_currency($data['amount_tendered'] - round($data['total'], 2));
}
$data['employee'] = $emp_info->first_name . ' ' . $emp_info->last_name;
$suppl_info = '';
if ($supplier_id != -1) {
$suppl_info = $this->Supplier->get_info($supplier_id);
$data['supplier'] = $suppl_info->company_name;
// first_name.' '.$suppl_info->last_name;
}
$invoice_number = $this->_substitute_invoice_number($suppl_info);
if ($this->receiving_lib->is_invoice_number_enabled() && $this->Receiving->invoice_number_exists($invoice_number)) {
$data['error'] = $this->lang->line('recvs_invoice_number_duplicate');
$this->_reload($data);
} else {
$invoice_number = $this->receiving_lib->is_invoice_number_enabled() ? $invoice_number : NULL;
$data['invoice_number'] = $invoice_number;
$data['payment_type'] = $this->input->post('payment_type');
//SAVE receiving to database
$data['receiving_id'] = 'RECV ' . $this->Receiving->save($data['cart'], $supplier_id, $employee_id, $comment, $invoice_number, $payment_type, $data['stock_location']);
if ($data['receiving_id'] == 'RECV -1') {
$data['error_message'] = $this->lang->line('receivings_transaction_failed');
}
$data['barcode'] = $this->barcode_lib->generate_receipt_barcode($data['receiving_id']);
$data['print_after_sale'] = $this->receiving_lib->is_print_after_sale();
$this->load->view("receivings/receipt", $data);
$this->receiving_lib->clear_all();
}
$this->_remove_duplicate_cookies();
}
示例10: str_replace
: <?php
echo $this->config->item('round_cash_on_sales') && $is_sale_cash_payment ? str_replace('‑', '-', to_currency(round_to_nearest_05($amount_change))) : str_replace('‑', '-', to_currency($amount_change));
} else {
echo lang('sales_amount_due');
?>
: <?php
echo $this->config->item('round_cash_on_sales') && $is_sale_cash_payment ? str_replace('‑', '-', to_currency(round_to_nearest_05($amount_change * -1))) : str_replace('‑', '-', to_currency($amount_change * -1));
}
if (isset($customer_balance_for_sale) && $customer_balance_for_sale !== FALSE) {
?>
<?php
echo lang('sales_customer_account_balance');
?>
: <?php
echo to_currency($customer_balance_for_sale);
}
if ($ref_no) {
?>
<?php
echo lang('sales_ref_no');
?>
: <?php
echo $ref_no;
}
if (isset($auth_code) && $auth_code) {
?>
<?php
echo lang('sales_auth_code');
示例11: get_giftcard_data_row
/** GARRISON MODIFIED 4/25/2013 **/
function get_giftcard_data_row($giftcard, $controller)
{
$CI =& get_instance();
$controller_name = strtolower(get_class($CI));
$width = $controller->get_form_width();
$table_data_row = '<tr>';
$table_data_row .= "<td width='3%'><input type='checkbox' id='giftcard_{$giftcard->giftcard_id}' value='" . $giftcard->giftcard_id . "'/></td>";
$table_data_row .= '<td width="15%">' . $giftcard->last_name . '</td>';
$table_data_row .= '<td width="15%">' . $giftcard->first_name . '</td>';
$table_data_row .= '<td width="15%">' . $giftcard->giftcard_number . '</td>';
$table_data_row .= '<td width="20%">' . to_currency($giftcard->value) . '</td>';
$table_data_row .= '<td width="5%">' . anchor($controller_name . "/view/{$giftcard->giftcard_id}/width:{$width}", $CI->lang->line('common_edit'), array('class' => 'thickbox', 'title' => $CI->lang->line($controller_name . '_update'))) . '</td>';
$table_data_row .= '</tr>';
return $table_data_row;
}
示例12: to_currency
?>
" value="<?php
echo $class[1];
?>
">
<tr class="<?php
echo $class[0];
?>
">
<td><input type="button" class="small_button" value="Delete"></td>
<td><?php
echo $tipe;
?>
</td>
<td style="text-align: right;"><?php
echo $mont ? $mont : to_currency($class[1]);
?>
</td>
</tr>
<?php
}
}
}
if ($default_service * 1 > 0) {
?>
<tr>
<td></td>
<td><?php
echo $this->lang->line('config_service_price');
?>
</td>
示例13: foreach
<?php
foreach ($payments as $payment_id => $payment) {
?>
<tr>
<td colspan="2" style="text-align:right;"><?php
echo $this->lang->line('sales_payment');
?>
</td>
<td colspan="2" style="text-align:right;"><?php
$splitpayment = explode(':', $payment['payment_type']);
echo $splitpayment[0];
?>
</td>
<td colspan="2" style="text-align:right"><?php
echo to_currency($payment['payment_amount'] * -1);
?>
</td>
</tr>
<?php
}
?>
<tr><td colspan="6"> </td></tr>
<tr>
<td colspan="4" style='text-align:right;'><?php
echo $this->lang->line('sales_change_due');
?>
</td>
<td colspan="2" style='text-align:right'><?php
示例14: suspend
function suspend()
{
$data['cart'] = $this->sale_lib->get_cart();
$data['subtotal'] = $this->sale_lib->get_subtotal();
$data['taxes'] = $this->sale_lib->get_taxes();
$data['total'] = $this->sale_lib->get_total();
$data['receipt_title'] = $this->lang->line('sales_receipt');
$data['transaction_time'] = date($this->config->item('dateformat') . ' ' . $this->config->item('timeformat'));
$customer_id = $this->sale_lib->get_customer();
$employee_id = $this->Employee->get_logged_in_employee_info()->person_id;
$comment = $this->input->post('comment');
$invoice_number = $this->sale_lib->get_invoice_number();
$emp_info = $this->Employee->get_info($employee_id);
$payment_type = $this->input->post('payment_type');
$data['payment_type'] = $this->input->post('payment_type');
//Alain Multiple payments
$data['payments'] = $this->sale_lib->get_payments();
$data['amount_change'] = to_currency($this->sale_lib->get_amount_due() * -1);
$data['employee'] = $emp_info->first_name . ' ' . $emp_info->last_name;
if ($this->Sale_suspended->invoice_number_exists($invoice_number)) {
$this->_reload(array('error' => $data['error'] = $this->lang->line('sales_invoice_number_duplicate')));
} else {
if ($customer_id != -1) {
$cust_info = $this->Customer->get_info($customer_id);
if (isset($cust_info->company_name)) {
$data['customer'] = $cust_info->company_name;
} else {
$data['customer'] = $cust_info->first_name . ' ' . $cust_info->last_name;
}
}
$total_payments = 0;
foreach ($data['payments'] as $payment) {
$total_payments = bcadd($total_payments, $payment['payment_amount'], PRECISION);
}
//SAVE sale to database
$data['sale_id'] = 'POS ' . $this->Sale_suspended->save($data['cart'], $customer_id, $employee_id, $comment, $invoice_number, $data['payments']);
if ($data['sale_id'] == 'POS -1') {
$data['error_message'] = $this->lang->line('sales_transaction_failed');
}
$this->sale_lib->clear_all();
$this->_reload(array('success' => $this->lang->line('sales_successfully_suspended_sale')));
}
}
示例15: anchor
<?php
echo anchor("suppliers/view/-1/width:350", "<div class='small_button' style='margin:0 auto;'><span>" . $this->lang->line('recvs_new_supplier') . "</span></div>", array('class' => 'thickbox none', 'title' => $this->lang->line('recvs_new_supplier')));
?>
</div>
<div class="clearfix"> </div>
<?php
}
?>
<div id='sale_details'>
<div class="float_left" style='width:55%;'><?php
echo $this->lang->line('sales_total');
?>
:</div>
<div class="float_left" style="width:45%;font-weight:bold;"><?php
echo to_currency($total);
?>
</div>
</div>
<?php
if (count($cart) > 0) {
?>
<div id="finish_sale">
<?php
echo form_open("receivings/complete", array('id' => 'finish_sale_form'));
?>
<br />
<label id="comment_label" for="comment"><?php
echo $this->lang->line('common_comments');
?>
:</label>