本文整理汇总了PHP中to_currency_no_money函数的典型用法代码示例。如果您正苦于以下问题:PHP to_currency_no_money函数的具体用法?PHP to_currency_no_money怎么用?PHP to_currency_no_money使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了to_currency_no_money函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getSummaryData
public function getSummaryData()
{
$this->db->select('sum(amount) as amount,
sum(paid_princ) as paid_princ,
(sum(paid_princ)-sum(amount)) as amount_due,
sum(pay_rate) as rate,
sum(paid_rate) as paid_rate,
sum(pay_fine) as pay_fine,
sum(profit) as profit', false);
$this->db->from('pawns_temp');
$this->db->where('deleted', 0);
$this->db->group_by('pawn_id');
$return = array('amount' => 0, 'paid_princ' => 0, 'amount_due' => 0, 'rate' => 0, 'paid_rate' => 0, 'pay_fine' => 0, 'profit' => 0);
foreach ($this->db->get()->result_array() as $row) {
$return['amount'] += to_currency_no_money($row['amount'], 2);
$return['paid_princ'] += to_currency_no_money($row['paid_princ'], 2);
$return['amount_due'] += to_currency_no_money($row['amount_due'], 2);
//$return['deposit'] += to_currency_no_money($row['deposit'], 2);
$return['rate'] += to_currency_no_money($row['rate'], 2);
$return['paid_rate'] += to_currency_no_money($row['paid_rate'], 2);
//$return['late'] += $row['late'];
$return['pay_fine'] += to_currency_no_money($row['pay_fine'], 2);
$return['profit'] += to_currency_no_money($row['profit'], 2);
}
if (!$this->Employee->has_module_action_permission('reports', 'show_profit', $this->Employee->get_logged_in_employee_info()->person_id)) {
unset($return['profit']);
}
return $return;
}
开发者ID:ekchanthorn,项目名称:demo_loan,代码行数:29,代码来源:summary_pawns.php
示例2: getSummaryData
public function getSummaryData()
{
$this->db->select('sum(subtotal) as subtotal, sum(total) as total, sum(tax) as tax,sum(profit) as profit', false);
$this->db->from('sales_items_temp');
if ($this->params['sale_type'] == 'sales') {
$this->db->where('quantity_purchased > 0');
} elseif ($this->params['sale_type'] == 'returns') {
$this->db->where('quantity_purchased < 0');
}
$this->db->where($this->db->dbprefix('sales_items_temp') . '.deleted', 0);
if ($this->config->item('hide_store_account_payments_from_report_totals')) {
$this->db->where('store_account_payment', 0);
}
$this->db->group_by('sale_id');
$return = array('subtotal' => 0, 'total' => 0, 'tax' => 0, 'profit' => 0);
foreach ($this->db->get()->result_array() as $row) {
$return['subtotal'] += to_currency_no_money($row['subtotal'], 2);
$return['total'] += to_currency_no_money($row['total'], 2);
$return['tax'] += to_currency_no_money($row['tax'], 2);
$return['profit'] += to_currency_no_money($row['profit'], 2);
}
if (!$this->Employee->has_module_action_permission('reports', 'show_profit', $this->Employee->get_logged_in_employee_info()->person_id)) {
unset($return['profit']);
}
return $return;
}
开发者ID:ekchanthorn,项目名称:demo_loan,代码行数:26,代码来源:summary_discounts.php
示例3: getSummaryData
public function getSummaryData()
{
$employee_column = $this->params['employee_type'] == 'logged_in_employee' ? 'employee_id' : 'sold_by_employee_id';
$this->db->select('sum(subtotal) as subtotal, sum(total) as total, sum(tax) as tax, sum(profit) as profit,sum(commission) as commission', false);
$this->db->from('sales_items_temp');
$this->db->join('employees', 'employees.person_id = sales_items_temp.' . $employee_column);
$this->db->join('people', 'employees.person_id = people.person_id');
if ($this->params['sale_type'] == 'sales') {
$this->db->where('quantity_purchased > 0');
} elseif ($this->params['sale_type'] == 'returns') {
$this->db->where('quantity_purchased < 0');
}
$this->db->where($this->db->dbprefix('sales_items_temp') . '.deleted', 0);
$this->db->group_by('sale_id');
$return = array('subtotal' => 0, 'total' => 0, 'tax' => 0, 'profit' => 0, 'commission' => 0);
foreach ($this->db->get()->result_array() as $row) {
$return['subtotal'] += to_currency_no_money($row['subtotal'], 2);
$return['total'] += to_currency_no_money($row['total'], 2);
$return['tax'] += to_currency_no_money($row['tax'], 2);
$return['profit'] += to_currency_no_money($row['profit'], 2);
$return['commission'] += to_currency_no_money($row['commission'], 2);
}
if (!$this->Employee->has_module_action_permission('reports', 'show_profit', $this->Employee->get_logged_in_employee_info()->person_id)) {
unset($return['profit']);
}
return $return;
}
开发者ID:ekchanthorn,项目名称:demo_loan,代码行数:27,代码来源:summary_commissions.php
示例4: getSummaryData
public function getSummaryData()
{
$logged_in_location_id = $this->Employee->get_logged_in_employee_current_location_id();
$sales_totals = array();
$this->db->select('sale_id, SUM(total) as total', false);
$this->db->from('sales_items_temp');
$this->db->where('deleted', 0);
$this->db->group_by('sale_id');
foreach ($this->db->get()->result_array() as $sale_total_row) {
$sales_totals[$sale_total_row['sale_id']] = to_currency_no_money($sale_total_row['total'], 2);
}
$this->db->select('sales_payments.sale_id, sales_payments.payment_type, payment_amount, payment_id', false);
$this->db->from('sales_payments');
$this->db->join('sales', 'sales.sale_id=sales_payments.sale_id');
$this->db->where('payment_date BETWEEN ' . $this->db->escape($this->params['start_date']) . ' and ' . $this->db->escape($this->params['end_date']) . ' and location_id = ' . $this->db->escape($logged_in_location_id));
if ($this->config->item('hide_store_account_payments_in_reports')) {
$this->db->where('store_account_payment', 0);
}
if ($this->params['sale_type'] == 'sales') {
$this->db->where('payment_amount > 0');
} elseif ($this->params['sale_type'] == 'returns') {
$this->db->where('payment_amount < 0');
}
$this->db->where($this->db->dbprefix('sales') . '.deleted', 0);
$this->db->order_by('sale_id, payment_type');
$sales_payments = $this->db->get()->result_array();
$payments_by_sale = array();
foreach ($sales_payments as $row) {
$payments_by_sale[$row['sale_id']][] = $row;
}
$payment_data = $this->Sale->get_payment_data($payments_by_sale, $sales_totals);
$return = array('total' => 0);
foreach ($payment_data as $payment) {
$return['total'] += $payment['payment_amount'];
}
return $return;
}
开发者ID:ekchanthorn,项目名称:demo_loan,代码行数:37,代码来源:summary_payments.php
示例5: excel_export
function excel_export()
{
$data = $this->Item->get_all($this->Item->count_all())->result_object();
$this->load->helper('report');
$header_row = $this->_excel_get_header_row();
$header_row[] = lang('items_item_id');
$rows[] = $header_row;
foreach ($data as $r) {
$row = array();
$row[] = $r->item_number;
$row[] = $r->product_id;
$row[] = $r->name;
$row[] = $r->category;
$row[] = $r->supplier_id;
$row[] = to_currency_no_money($r->cost_price, 10);
$row[] = to_currency_no_money($r->unit_price);
foreach ($this->Tier->get_all()->result() as $tier) {
$tier_id = $tier->id;
$tier_row = $this->Item->get_tier_price_row($tier_id, $r->item_id);
$value = '';
if (is_object($tier_row) && property_exists($tier_row, 'tier_id')) {
$value = $tier_row->unit_price !== NULL ? to_currency_no_money($tier_row->unit_price) : $tier_row->percent_off . '%';
}
$row[] = $value;
}
$row[] = $r->tax_included ? 'y' : '';
$row[] = $r->is_service ? 'y' : '';
$row[] = to_quantity($r->quantity, FALSE);
$row[] = to_quantity($r->reorder_level, fALSE);
$row[] = $r->description;
$row[] = $r->allow_alt_description ? 'y' : '';
$row[] = $r->is_serialized ? 'y' : '';
$row[] = $r->size;
$commission = '';
if ($r->commission_fixed) {
$commission = to_currency_no_money($r->commission_fixed);
} elseif ($r->commission_percent) {
$commission = to_currency_no_money($r->commission_percent) . '%';
}
$row[] = $commission;
$row[] = $r->item_id;
$rows[] = $row;
}
$content = array_to_spreadsheet($rows);
force_download('items_export.' . ($this->config->item('spreadsheet_format') == 'XLSX' ? 'xlsx' : 'csv'), $content);
exit;
}
开发者ID:ekchanthorn,项目名称:demo_loan,代码行数:47,代码来源:items.php
示例6: form_dropdown
</td>
<td>
<?php
echo form_dropdown('payment_type', $payment_options, array(), 'id="payment_types"');
?>
</td>
</tr>
<tr>
<td><span id="amount_tendered_label"><?php
echo $this->lang->line('sales_amount_tendered') . ': ';
?>
</span>
</td>
<td>
<?php
echo form_input(array('name' => 'amount_tendered', 'id' => 'amount_tendered', 'value' => to_currency_no_money($amount_due), 'size' => '10'));
?>
</td>
</tr>
</table>
<div class='small_button' id='add_payment_button'
style='float: left; margin-top: 5px;'>
<span><?php
echo $this->lang->line('sales_add_payment');
?>
</span>
</div>
</form>
</div>
<?php
开发者ID:zerubbabel,项目名称:pos,代码行数:31,代码来源:register.php
示例7: save
//.........这里部分代码省略.........
$this->Giftcard->update_giftcard_value($splitpayment[1], $cur_giftcard_value - $payment['payment_amount']);
$total_giftcard_payments += $payment['payment_amount'];
}
}
$sales_payments_data = array('sale_id' => $sale_id, 'payment_type' => $payment['payment_type'], 'payment_amount' => $payment['payment_amount'], 'payment_date' => $payment['payment_date'], 'truncated_card' => $payment['truncated_card'], 'card_issuer' => $payment['card_issuer']);
if (!$this->db->insert('sales_payments', $sales_payments_data)) {
$this->db->query("ROLLBACK");
$this->db->query('UNLOCK TABLES');
return -1;
}
}
$has_added_giftcard_value_to_cost_price = $total_giftcard_payments > 0 ? false : true;
$store_account_item_id = $this->Item->get_store_account_item_id();
foreach ($items as $line => $item) {
if (isset($item['item_id'])) {
$cur_item_info = $this->Item->get_info($item['item_id']);
$cur_item_location_info = $this->Item_location->get_info($item['item_id']);
if ($item['item_id'] != $store_account_item_id) {
$cost_price = $cur_item_location_info && $cur_item_location_info->cost_price ? $cur_item_location_info->cost_price : $cur_item_info->cost_price;
} else {
$cost_price = $item['price'];
}
if (!$this->config->item('disable_subtraction_of_giftcard_amount_from_sales')) {
//Add to the cost price if we are using a giftcard as we have already recorded profit for sale of giftcard
if (!$has_added_giftcard_value_to_cost_price) {
$cost_price += $total_giftcard_payments / $item['quantity'];
$has_added_giftcard_value_to_cost_price = true;
}
}
$reorder_level = $cur_item_location_info && $cur_item_location_info->reorder_level ? $cur_item_location_info->reorder_level : $cur_item_info->reorder_level;
if ($cur_item_info->tax_included) {
$item['price'] = get_price_for_item_excluding_taxes($item['item_id'], $item['price']);
}
$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' => to_currency_no_money($cost_price, 10), 'item_unit_price' => $item['price'], 'commission' => get_commission_for_item($item['item_id'], $item['price'], $item['quantity'], $item['discount']));
if (!$this->db->insert('sales_items', $sales_items_data)) {
$this->db->query("ROLLBACK");
$this->db->query('UNLOCK TABLES');
return -1;
}
//Only update giftcard payments if we are NOT an estimate (suspended = 2)
if ($suspended != 2) {
//create giftcard from sales
if ($item['name'] == lang('sales_giftcard') && !$this->Giftcard->get_giftcard_id($item['description'])) {
$giftcard_data = array('giftcard_number' => $item['description'], 'value' => $item['price'], 'customer_id' => $customer_id > 0 ? $customer_id : null);
if (!$this->Giftcard->save($giftcard_data)) {
$this->db->query("ROLLBACK");
$this->db->query('UNLOCK TABLES');
return -1;
}
}
}
//Only do stock check + inventory update if we are NOT an estimate
if ($suspended != 2) {
$stock_recorder_check = false;
$out_of_stock_check = false;
$email = false;
$message = '';
//checks if the quantity is greater than reorder level
if (!$cur_item_info->is_service && $cur_item_location_info->quantity > $reorder_level) {
$stock_recorder_check = true;
}
//checks if the quantity is greater than 0
if (!$cur_item_info->is_service && $cur_item_location_info->quantity > 0) {
$out_of_stock_check = true;
}
//Update stock quantity IF not a service
开发者ID:ekchanthorn,项目名称:demo_loan,代码行数:67,代码来源:sale.php
示例8: get_total
function get_total()
{
$total = 0;
foreach ($this->get_cart() as $item) {
$total += $item['price'] * $item['quantity'] - $item['price'] * $item['quantity'] * $item['discount'] / 100;
}
foreach ($this->get_taxes() as $tax) {
$total += $tax;
}
return to_currency_no_money($total);
}
开发者ID:ClementeFlores,项目名称:Opensource-Point-of-Sale,代码行数:11,代码来源:Sale_lib.php
示例9: get_total
function get_total($sale_id = false)
{
$total = 0;
foreach ($this->get_cart() as $item) {
$price_to_use = $this->_get_price_for_item_in_cart($item, $sale_id);
$total += $price_to_use * $item['quantity'] - $price_to_use * $item['quantity'] * $item['discount'] / 100;
}
foreach ($this->get_taxes($sale_id) as $tax) {
$total += $tax;
}
$total = $this->CI->config->item('round_cash_on_sales') && $this->is_sale_cash_payment() ? round_to_nearest_05($total) : $total;
return to_currency_no_money($total);
}
开发者ID:ekchanthorn,项目名称:demo_loan,代码行数:13,代码来源:Sale_lib.php
示例10: get_total
public function get_total()
{
$total = 0;
foreach ($this->get_cart() as $item) {
$total += $item['price'] * $item['quantity'] - $item['price'] * $item['quantity'] * $item['discount'] / 100;
}
$discount = 0;
if ($this->CI->session->userdata('discounting') == 'checked') {
$discount = $this->get_discount();
if ($discount > 0) {
$discount = $total * $discount / 100;
}
}
if ($this->get_taxing()) {
foreach ($this->get_taxes() as $tax) {
$total += $tax;
}
}
return to_currency_no_money($total - $discount);
}
开发者ID:gocanto,项目名称:gocanto-pos,代码行数:20,代码来源:Sale_lib.php
示例11: form_dropdown
echo form_dropdown('locations[' . $location->location_id . '][tier_type][' . $tier->id . ']', $tier_type_options, $location_tier_prices[$location->location_id][$tier->id] !== FALSE && $location_tier_prices[$location->location_id][$tier->id]->unit_price === NULL ? 'percent_off' : 'unit_price');
?>
</div>
</div>
<?php
}
?>
<div class="form-group">
<?php
echo form_label(lang('items_promo_price') . ':', '', array('class' => 'col-sm-3 col-md-3 col-lg-2 control-label wide'));
?>
<div class="col-sm-9 col-md-9 col-lg-10">
<?php
echo form_input(array('name' => 'locations[' . $location->location_id . '][promo_price]', 'size' => '8', 'class' => 'form-control form-inps', 'value' => $location_items[$location->location_id]->item_id !== '' && $location_items[$location->location_id]->promo_price ? to_currency_no_money($location_items[$location->location_id]->promo_price, 10) : ''));
?>
</div>
</div>
<div class="form-group offset1">
<?php
echo form_label(lang('items_promo_start_date') . ':', '', array('class' => 'col-sm-3 col-md-3 col-lg-2 control-label text-info wide'));
?>
<div class="col-sm-9 col-md-9 col-lg-10">
<div class="input-group date datepicker" data-date="<?php
echo $location_items[$location->location_id]->item_id !== '' && $location_items[$location->location_id]->start_date ? date(get_date_format(), strtotime($location_items[$location->location_id]->start_date)) : '';
?>
" data-date-format=<?php
echo json_encode(get_js_date_format());
开发者ID:ekchanthorn,项目名称:demo_loan,代码行数:31,代码来源:form.php
示例12: finish_cc_processing
public function finish_cc_processing()
{
$return_code = $this->sales_controller->input->get("ReturnCode");
//TODO
//Check return code 0
//Check return code 101: Decline
//Only make verify payment call with the above return codes
$service_url = (!defined("ENVIRONMENT") or ENVIRONMENT == 'development') ? 'https://hc.mercurydev.net/hcws/hcservice.asmx?WSDL' : 'https://hc.mercurypay.com/hcws/hcservice.asmx?WSDL';
$parameters = array('request' => array('MerchantID' => $this->sales_controller->Location->get_info_for_key('merchant_id'), 'PaymentID' => $this->sales_controller->input->get('PaymentID'), 'Password' => $this->sales_controller->Location->get_info_for_key('merchant_password')));
$client = new SoapClient($service_url, array('trace' => TRUE));
$result = $client->VerifyPayment($parameters);
$response_code = $result->VerifyPaymentResult->ResponseCode;
$status = $result->VerifyPaymentResult->Status;
$total_amount = $result->VerifyPaymentResult->Amount;
$auth_amount = $result->VerifyPaymentResult->AuthAmount;
$auth_code = $result->VerifyPaymentResult->AuthCode;
$acq_ref_data = $result->VerifyPaymentResult->AcqRefData;
$ref_no = $result->VerifyPaymentResult->RefNo;
$token = $result->VerifyPaymentResult->Token;
$masked_account = $result->VerifyPaymentResult->MaskedAccount;
$process_data = $result->VerifyPaymentResult->ProcessData;
$card_issuer = $result->VerifyPaymentResult->CardType;
if ($response_code == 0 && $status == 'Approved') {
$result = $client->AcknowledgePayment($parameters);
$response_code = $result->AcknowledgePaymentResult;
$this->sales_controller->session->set_userdata('ref_no', $ref_no);
$this->sales_controller->session->set_userdata('auth_code', $auth_code);
if ($response_code == 0 && $auth_amount == $total_amount) {
$this->sales_controller->session->set_userdata('masked_account', $masked_account);
$this->sales_controller->session->set_userdata('card_issuer', $card_issuer);
$info = $this->sales_controller->Customer->get_info($this->sales_controller->sale_lib->get_customer());
//We want to save/update card:
//1. User decides to save credit card info
//2. We already have a saved credit and need to update
if (($this->sales_controller->sale_lib->get_save_credit_card_info() or $info->cc_token && $info->cc_preview) && $this->sales_controller->sale_lib->get_customer() != -1) {
$person_info = array('person_id' => $this->sales_controller->sale_lib->get_customer());
$customer_info = array('cc_token' => $token, 'cc_preview' => $masked_account, 'card_issuer' => $card_issuer);
$this->sales_controller->Customer->save($person_info, $customer_info, $this->sales_controller->sale_lib->get_customer());
}
//If the sale payments cover the total, redirect to complete (receipt)
if ($this->sales_controller->_payments_cover_total()) {
redirect(site_url('sales/complete'));
} else {
$invoice_number = substr(date('mdy') . (time() - strtotime("today")) . $this->sales_controller->Employee->get_logged_in_employee_info()->person_id, 0, 16);
$credit_card_amount = to_currency_no_money($this->sales_controller->sale_lib->get_payment_amount(lang('sales_credit')));
$partial_transaction = array('AuthCode' => $auth_code, 'Frequency' => 'OneTime', 'Memo' => 'PHP POS ' . APPLICATION_VERSION, 'Invoice' => $invoice_number, 'MerchantID' => $this->sales_controller->Location->get_info_for_key('merchant_id'), 'OperatorID' => (!defined("ENVIRONMENT") or ENVIRONMENT == 'development') ? 'test' : $this->sales_controller->Employee->get_logged_in_employee_info()->person_id, 'PurchaseAmount' => $credit_card_amount, 'RefNo' => $ref_no, 'Token' => $token, 'AcqRefData' => $acq_ref_data, 'ProcessData' => $process_data);
$this->sales_controller->sale_lib->delete_payment($this->sales_controller->sale_lib->get_payment_ids(lang('sales_credit')));
$this->sales_controller->sale_lib->add_payment(lang('sales_partial_credit'), $credit_card_amount, FALSE, $masked_account, $card_issuer);
$this->sales_controller->sale_lib->add_partial_transaction($partial_transaction);
$this->sales_controller->_reload(array('warning' => lang('sales_credit_card_partially_charged_please_complete_sale_with_another_payment_method')), false);
}
} elseif ($response_code == 0 && $auth_amount < $total_amount) {
$invoice_number = substr(date('mdy') . (time() - strtotime("today")) . $this->sales_controller->Employee->get_logged_in_employee_info()->person_id, 0, 16);
$partial_transaction = array('AuthCode' => $auth_code, 'Frequency' => 'OneTime', 'Memo' => 'PHP POS ' . APPLICATION_VERSION, 'Invoice' => $invoice_number, 'MerchantID' => $this->sales_controller->Location->get_info_for_key('merchant_id'), 'OperatorID' => (!defined("ENVIRONMENT") or ENVIRONMENT == 'development') ? 'test' : $this->sales_controller->Employee->get_logged_in_employee_info()->person_id, 'PurchaseAmount' => $auth_amount, 'RefNo' => $ref_no, 'Token' => $token, 'AcqRefData' => $acq_ref_data, 'ProcessData' => $process_data);
$this->sales_controller->sale_lib->delete_payment($this->sales_controller->sale_lib->get_payment_ids(lang('sales_credit')));
$this->sales_controller->sale_lib->add_payment(lang('sales_partial_credit'), $auth_amount, FALSE, $masked_account, $card_issuer);
$this->sales_controller->sale_lib->add_partial_transaction($partial_transaction);
$this->sales_controller->_reload(array('warning' => lang('sales_credit_card_partially_charged_please_complete_sale_with_another_payment_method')), false);
} else {
$this->sales_controller->_reload(array('error' => lang('sales_acknowledge_payment_failed_please_contact_support')), false);
}
} else {
$client->AcknowledgePayment($parameters);
$this->sales_controller->_reload(array('error' => $result->VerifyPaymentResult->StatusMessage . ': ' . $result->VerifyPaymentResult->DisplayMessage), false);
}
}
开发者ID:ekchanthorn,项目名称:demo_loan,代码行数:66,代码来源:MercuryProcessor.php
示例13: calculate_and_update_average_cost_price_for_item
function calculate_and_update_average_cost_price_for_item($item_id, $current_receivings_items_data)
{
//Dont calculate averages unless we receive quanitity > 0
if ($current_receivings_items_data['quantity_purchased'] > 0) {
$cost_price_avg = false;
$averaging_method = $this->config->item('averaging_method');
$cur_item_info = $this->Item->get_info($item_id);
$cur_item_location_info = $this->Item_location->get_info($item_id);
if ($averaging_method == 'moving_average') {
$current_cost_price = $cur_item_location_info && $cur_item_location_info->cost_price ? $cur_item_location_info->cost_price : $cur_item_info->cost_price;
$current_quantity = $cur_item_location_info->quantity;
$current_inventory_value = $current_cost_price * $current_quantity;
$received_cost_price = $current_receivings_items_data['item_unit_price'] * (1 - $current_receivings_items_data['discount_percent'] / 100);
$received_quantity = $current_receivings_items_data['quantity_purchased'];
$new_inventory_value = $received_cost_price * $received_quantity;
$cost_price_avg = ($current_inventory_value + $new_inventory_value) / ($current_quantity + $received_quantity);
} elseif ($averaging_method == 'historical_average') {
if ($cur_item_location_info && $cur_item_location_info->cost_price) {
$location_id = $this->Employee->get_logged_in_employee_current_location_id();
$result = $this->db->query("SELECT ROUND((SUM(item_unit_price*quantity_purchased-item_unit_price*quantity_purchased*discount_percent/100)) / SUM(quantity_purchased),10) as cost_price_average \n\t\t\t\t\tFROM " . $this->db->dbprefix('receivings_items') . ' ' . 'JOIN ' . $this->db->dbprefix('receivings') . ' ON ' . $this->db->dbprefix('receivings') . '.receiving_id = ' . $this->db->dbprefix('receivings_items') . '.receiving_id ' . 'WHERE quantity_purchased > 0 and item_id=' . $this->db->escape($item_id) . ' and location_id = ' . $this->db->escape($location_id))->result();
} else {
$result = $this->db->query("SELECT ROUND((SUM(item_unit_price*quantity_purchased-item_unit_price*quantity_purchased*discount_percent/100)) / SUM(quantity_purchased),10) as cost_price_average \n\t\t\t\t\tFROM " . $this->db->dbprefix('receivings_items') . '
WHERE quantity_purchased > 0 and item_id=' . $this->db->escape($item_id))->result();
}
$cost_price_avg = $result[0]->cost_price_average;
}
if ($cost_price_avg !== FALSE) {
$cost_price_avg = to_currency_no_money($cost_price_avg, 10);
//If we have a location cost price, update that value
if ($cur_item_location_info && $cur_item_location_info->cost_price) {
$item_location_data = array('cost_price' => $cost_price_avg);
$this->Item_location->save($item_location_data, $item_id);
} else {
//Update cost price
$item_data = array('cost_price' => $cost_price_avg);
$this->Item->save($item_data, $item_id);
}
}
}
}
开发者ID:ekchanthorn,项目名称:demo_loan,代码行数:40,代码来源:receiving.php
示例14: form_label
echo form_label($this->lang->line('items_unit_price'), 'unit_price', array('class' => 'required control-label col-xs-3'));
?>
<div class='col-xs-4'>
<div class="input-group input-group-sm">
<?php
if (!currency_side()) {
?>
<span class="input-group-addon input-sm"><b><?php
echo $this->config->item('currency_symbol');
?>
</b></span>
<?php
}
?>
<?php
echo form_input(array('name' => 'unit_price', 'id' => 'unit_price', 'class' => 'form-control input-sm', 'value' => to_currency_no_money($item_info->unit_price)));
?>
<?php
if (currency_side()) {
?>
<span class="input-group-addon input-sm"><b><?php
echo $this->config->item('currency_symbol');
?>
</b></span>
<?php
}
?>
</div>
</div>
</div>
开发者ID:mnapier,项目名称:opensourcepos,代码行数:30,代码来源:form.php
示例15: lang
<label accesskey="y" for="payment_types"><?php
echo lang('sales_add_payment');
?>
:</label>
</td>
<td>
<?php
echo form_dropdown('payment_type', $payment_options, $this->config->item('default_payment_type'), 'id="payment_types" class="input-medium"');
?>
</td>
</tr>
<tr id="mpt_bottom" >
<td id="tender" colspan="2">
<div class="input-append">
<?php
echo form_input(array('name' => 'amount_tendered', 'id' => 'amount_tendered', 'value' => to_currency_no_money($amount_due), 'class' => 'input-medium input_mediums', 'accesskey' => 'p'));
?>
<input type="button" class="btn btn-primary" id="add_payment_button" value="<?php
echo lang('sales_add_payment');
?>
" />
</div>
</td>
</tr>
</table>
</form>
</div>
<?php
}
开发者ID:ekchanthorn,项目名称:demo_loan,代码行数:31,代码来源:register.php
示例16: get_total
function get_total()
{
$total = $this->calculate_subtotal();
foreach ($this->get_taxes() as $tax) {
$total = bcadd($total, $tax, 4);
}
return to_currency_no_money($total);
}
开发者ID:SofyanHadiA,项目名称:rinjani-framework,代码行数:8,代码来源:Sale_lib.php
示例17: form_input
<label class='col-sm-4 text-left'><?php
echo $this->lang->line('sales_nomerkartu');
?>
</label>
<div class='col-sm-8'>
<input id="nomorkartu" class="form-control ac_input" type="text" size="15" value="" name="nomorkartu" autocomplete="off">
</div>
</div>
<div class="form-group">
<label class='col-sm-4 text-left'><?php
echo $this->lang->line('sales_amount_tendered');
?>
</label>
<div class='col-sm-8'>
<?php
echo form_input(array('name' => 'amount_tendered', 'id' => 'amount_tendered', 'value' => to_currency_no_money($amount_due), 'class' => 'form-control', 'tabindex' => 4));
?>
<br><div id='add_payment_button' >
<button class='btn btn-block btn-success btn-sm'><?php
echo $this->lang->line('sales_add_payment');
?>
</button>
</div>
</div>
</div>
<div class="form-group">
<label class='col-sm-4 text-left'><?php
echo $this->lang->line('sales_payments_total');
?>
</label>
<div class='col-sm-8'>
开发者ID:iwaphei,项目名称:bengkelpos,代码行数:31,代码来源:register.php
示例18: get_commission_for_item_kit
function get_commission_for_item_kit($item_kit_id, $price, $quantity, $discount)
{
$CI =& get_instance();
$CI->load->library('sale_lib');
$employee_id = $CI->sale_lib->get_sold_by_employee_id();
$sales_person_info = $CI->Employee->get_info($employee_id);
$employee_id = $CI->Employee->get_logged_in_employee_info()->person_id;
$logged_in_employee_info = $CI->Employee->get_info($employee_id);
$item_kit_info = $CI->Item_kit->get_info($item_kit_id);
if ($item_kit_info->commission_fixed > 0) {
return $quantity * $item_kit_info->commission_fixed;
} elseif ($item_kit_info->commission_percent > 0) {
return to_currency_no_money(($price * $quantity - $price * $quantity * $discount / 100) * ($item_kit_info->commission_percent / 100));
} elseif ($CI->config->item('select_sales_person_during_sale')) {
if ($sales_person_info->commission_percent > 0) {
return to_currency_no_money(($price * $quantity - $price * $quantity * $discount / 100) * ((double) $sales_person_info->commission_percent / 100));
}
return to_currency_no_money(($price * $quantity - $price * $quantity * $discount / 100) * ((double) $CI->config->item('commission_default_rate') / 100));
} elseif ($logged_in_employee_info->commission_percent > 0) {
return to_currency_no_money(($price * $quantity - $price * $quantity * $discount / 100) * ((double) $logged_in_employee_info->commission_percent / 100));
} else {
return to_currency_no_money(($price * $quantity - $price * $quantity * $discount / 100) * ((double) $CI->config->item('commission_default_rate') / 100));
}
}
开发者ID:ekchanthorn,项目名称:demo_loan,代码行数:24,代码来源:item_kits_helper.php
示例19: check_payment_type_giftcard
function check_payment_type_giftcard()
{
if ($("#payment_types").val() == "<?php
echo $this->lang->line('sales_giftcard');
?>
")
{
$("#amount_tendered_label").html("<?php
echo $this->lang->line('sales_giftcard_number');
?>
");
$("#amount_tendered:enabled").val('').focus();
}
else
{
$("#amount_tendered_label").html("<?php
echo $this->lang->line('sales_amount_tendered');
?>
");
$("#amount_tendered:enabled").val('<?php
echo to_currency_no_money($amount_due);
?>
');
}
}
</script>
<?php
$this->load->view("partial/footer");
开发者ID:mnapier,项目名称:opensourcepos,代码行数:30,代码来源:register.php
示例20: getSummaryData
public function getSummaryData()
{
if ($this->params['matched_items_only']) {
$this->db->select('sales_items_temp.sale_id, sum(subtotal) as subtotal, sum(total) as total, sum(tax) as tax, sum(profit) as profit,sum(quantity_purchased) as items_purchased', false);
$this->db->from('sales_items_temp');
$this->db->where('sales_items_temp.deleted', 0);
$this->_searchSalesQueryParams();
$this->db->group_by('sale_id');
if ($this->config->item('hide_store_account_payments_from_report_totals')) {
$this->db->where('store_account_payment', 0);
}
$result = $this->db->get()->result_array();
$return = array('subtotal' => 0, 'total' => 0, 'tax' => 0, 'profit' => 0);
foreach ($result as $row) {
$return['subtotal'] += to_currency_no_money($row['subtotal'], 2);
$return['total'] += to_currency_no_money($row['total'], 2);
$return['tax'] += to_currency_no_money($row['tax'], 2);
$return['profit'] += to_currency_no_money($row['profit'], 2);
}
if (!$this->Employee->has_module_action_permission('reports', 'show_profit', $this->Employee->get_logged_in_employee_info()->person_id)) {
unset($return['profit']);
}
return $return;
} else {
$sale_ids = $this->_getMatchingSaleIds();
$this->db->select('sum(subtotal) as subtotal, sum(total) as total, sum(tax) as tax, sum(profit) as profit', false);
$this->db->from('sales_items_temp');
$this->db->group_by('sale_id');
if
|
请发表评论