function rupiah($number) { if ($number == 0) { return '-'; } return to_currency($number); }
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; }
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; }
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; }
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; }
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; }
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); }
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; }
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(); }
: <?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');
/** 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; }
?> " 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>
<?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
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'))); } }
<?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>
</td> <td><?php echo to_currency($items_info[$i]->cost_price * $items_info[$i]->quantity); ?> </td> </tr> <?php } ?> <tr> <td></td> <td></td> <td></td> <td></td> <td><strong>Total:</strong> <?php echo to_currency($total_general); ?> </td> </tr> </tbody> </table> </div> <a class="linkPrint" href="#"> <div class="big_button" style="float: left;"><span>Print</span></div> </a> <a class="linkBack" href="#"> <div class="big_button" style="float: left;"><span>Back</span></div> </a> <?php $this->load->view('partial/footer');
<div class="widget-title"> <span class="icon"> <i class="fa fa-align-justify"></i> </span> <h5><?php echo lang('sales_closing_amount_desc'); ?> </h5> </div> <div class="widget-content nopadding"> <ul class="text-error" id="error_message_box"></ul><?php echo form_open('sales/closeregister' . $continue, array('id' => 'closing_amount_form', 'class' => 'form-horizontal')); ?> <h3 class="text-left text-success text-center"><?php echo sprintf(lang('sales_closing_amount_approx'), to_currency($closeout)); ?> </h3> <br /> <div class="widget-content"> <div class="row"> <div class="col-md-6"> <div class="table-responsive"> <table class="table table-bordered text-center"> <tr> <th style="text-align: center;"><?php echo lang('sales_denomination'); ?> </th> <th style="text-align: center;"><?php
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('m/d/Y h:i:s a'); $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['payment_type'] = $this->input->post('payment_type'); 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; if ($supplier_id != -1) { $suppl_info = $this->Supplier->get_info($supplier_id); $data['supplier'] = $suppl_info->first_name . ' ' . $suppl_info->last_name; } //SAVE receiving to database $data['receiving_id'] = 'RECV ' . $this->Receiving->save($data['cart'], $supplier_id, $employee_id, $comment, $payment_type); if ($data['receiving_id'] == 'RECV -1') { $data['error_message'] = $this->lang->line('receivings_transaction_failed'); } $this->load->view("receivings/receipt", $data); $this->receiving_lib->clear_all(); }
function detailed_pawns($start_date, $end_date, $sale_type, $export_excel = 0, $offset = 0) { $this->check_action_permission('view_pawns'); $start_date = rawurldecode($start_date); $end_date = rawurldecode($end_date); $this->load->model('reports/Detailed_pawns'); $model = $this->Detailed_pawns; $model->setParams(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type, 'offset' => $offset, 'export_excel' => $export_excel)); $this->Pawn->create_pawns_temp_table(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type)); $config = array(); $config['base_url'] = site_url("reports/detailed_pawns/" . rawurlencode($start_date) . '/' . rawurlencode($end_date) . "/{$sale_type}/{$export_excel}"); $config['total_rows'] = $model->getTotalRows(); $config['per_page'] = $this->config->item('number_of_items_per_page') ? (int) $this->config->item('number_of_items_per_page') : 20; $config['uri_segment'] = 7; $this->pagination->initialize($config); $headers = $model->getDataColumns(); $report_data = $model->getData(); $summary_data = array(); $details_data = array(); $i = 1; foreach ($report_data['summary'] as $key => $row) { $summary_data_row = array(); $summary_data_row[] = array('data' => $i, 'align' => 'left'); $summary_data_row[] = array('data' => $row['borrower'], 'align' => 'left'); $summary_data_row[] = array('data' => to_currency($row['amount']), 'align' => 'left'); $summary_data_row[] = array('data' => to_currency($row['paid_princ']), 'align' => 'left'); $summary_data_row[] = array('data' => to_currency($row['amount_due']), 'align' => 'left'); //$summary_data_row[] = array('data'=>to_currency($row['deposit']), 'align'=>'left'); //$summary_data_row[] = array('data'=>to_currency($row['subtotal']), 'align'=>'right'); $summary_data_row[] = array('data' => to_currency($row['rate']), 'align' => 'right'); $summary_data_row[] = array('data' => to_currency($row['paid_rate']), 'align' => 'right'); if ($this->has_profit_permission) { $summary_data_row[] = array('data' => to_currency($row['profit']), 'align' => 'right'); } $summary_data[$key] = $summary_data_row; $j = 1; foreach ($report_data['details'][$key] as $drow) { $details_data_row = array(); $details_data_row[] = array('data' => $j, 'align' => 'left'); $details_data_row[] = array('data' => date(get_date_format(), strtotime($drow['start_date'])), 'align' => 'left'); $details_data_row[] = array('data' => to_currency($drow['amount']), 'align' => 'right'); $details_data_row[] = array('data' => to_currency($drow['paid_princ']), 'align' => 'right'); $details_data_row[] = array('data' => to_currency($drow['amount_due']), 'align' => 'right'); //$details_data_row[] = array('data'=>to_currency($drow['deposit']), 'align'=> 'right'); $details_data_row[] = array('data' => to_currency($drow['rate']), 'align' => 'right'); $details_data_row[] = array('data' => to_currency($drow['paid_rate']), 'align' => 'right'); $details_data_row[] = array('data' => $drow['late'] . ' ' . lang('common_day'), 'align' => 'right'); $details_data_row[] = array('data' => to_currency($drow['pay_fine']), 'align' => 'right'); if ($this->has_profit_permission) { $details_data_row[] = array('data' => to_currency($drow['profit']), 'align' => 'right'); } $details_data[$key][] = $details_data_row; $j++; } $i++; } $data = array("title" => lang('reports_detailed_pawns_report'), "subtitle" => date(get_date_format(), strtotime($start_date)) . '-' . date(get_date_format(), strtotime($end_date)), "headers" => $model->getDataColumns(), "summary_data" => $summary_data, "details_data" => $details_data, "overall_summary_data" => $model->getSummaryData(), "export_excel" => $export_excel, "pagination" => $this->pagination->create_links()); $this->load->view("reports/tabular_details", $data); }
echo $payment_type; ?> </div></td> </tr> <?php if (isset($amount_change)) { ?> <tr> <td colspan="3" style='text-align:right;'><?php echo $this->lang->line('sales_amount_tendered'); ?> </td> <td><div class="total-value"><?php echo to_currency($amount_tendered); ?> </div></td> </tr> <tr> <td colspan="3" style='text-align:right;'><?php echo $this->lang->line('sales_change_due'); ?> </td> <td><div class="total-value"><?php echo $amount_change; ?> </div></td> </tr> <?php
function save($items, $customer_id, $employee_id, $sold_by_employee_id, $comment, $show_comment_on_receipt, $payments, $sale_id = false, $suspended = 0, $cc_ref_no = '', $auth_code = '', $change_sale_date = false, $balance = 0, $store_account_payment = 0) { //we need to check the sale library for deleted taxes during sale $this->load->library('sale_lib'); if (count($items) == 0) { return -1; } $payment_types = ''; foreach ($payments as $payment_id => $payment) { $payment_types = $payment_types . $payment['payment_type'] . ': ' . to_currency($payment['payment_amount']) . '<br />'; } $tier_id = $this->sale_lib->get_selected_tier_id(); if (!$tier_id) { $tier_id = NULL; } $sales_data = array('customer_id' => $customer_id > 0 ? $customer_id : null, 'employee_id' => $employee_id, 'sold_by_employee_id' => $sold_by_employee_id, 'payment_type' => $payment_types, 'comment' => $comment, 'show_comment_on_receipt' => $show_comment_on_receipt ? $show_comment_on_receipt : 0, 'suspended' => $suspended, 'deleted' => 0, 'deleted_by' => NULL, 'cc_ref_no' => $cc_ref_no, 'auth_code' => $auth_code, 'location_id' => $this->Employee->get_logged_in_employee_current_location_id(), 'register_id' => $this->Employee->get_logged_in_employee_current_register_id(), 'store_account_payment' => $store_account_payment, 'tier_id' => $tier_id ? $tier_id : NULL); if ($sale_id) { $old_date = $this->get_info($sale_id)->row_array(); $sales_data['sale_time'] = $old_date['sale_time']; if ($change_sale_date) { $sale_time = strtotime($change_sale_date); if ($sale_time !== FALSE) { $sales_data['sale_time'] = date('Y-m-d H:i:s', strtotime($change_sale_date)); } } } else { $sales_data['sale_time'] = date('Y-m-d H:i:s'); } $this->db->query("SET autocommit=0"); //Lock tables invovled in sale transaction so we don't have deadlock $this->db->query('LOCK TABLES ' . $this->db->dbprefix('customers') . ' WRITE, ' . $this->db->dbprefix('sales') . ' WRITE, ' . $this->db->dbprefix('store_accounts') . ' WRITE, ' . $this->db->dbprefix('sales_payments') . ' WRITE, ' . $this->db->dbprefix('sales_items') . ' WRITE, ' . $this->db->dbprefix('giftcards') . ' WRITE, ' . $this->db->dbprefix('location_items') . ' WRITE, ' . $this->db->dbprefix('inventory') . ' WRITE, ' . $this->db->dbprefix('sales_items_taxes') . ' WRITE, ' . $this->db->dbprefix('sales_item_kits') . ' WRITE, ' . $this->db->dbprefix('sales_item_kits_taxes') . ' WRITE,' . $this->db->dbprefix('people') . ' READ,' . $this->db->dbprefix('items') . ' READ ,' . $this->db->dbprefix('employees_locations') . ' READ,' . $this->db->dbprefix('locations') . ' READ, ' . $this->db->dbprefix('items_tier_prices') . ' READ , ' . $this->db->dbprefix('location_items_tier_prices') . ' READ, ' . $this->db->dbprefix('items_taxes') . ' READ, ' . $this->db->dbprefix('item_kits') . ' READ , ' . $this->db->dbprefix('location_item_kits') . ' READ, ' . $this->db->dbprefix('item_kit_items') . ' READ, ' . $this->db->dbprefix('employees') . ' READ , ' . $this->db->dbprefix('item_kits_tier_prices') . ' READ , ' . $this->db->dbprefix('location_item_kits_tier_prices') . ' READ, ' . $this->db->dbprefix('location_items_taxes') . ' READ , ' . $this->db->dbprefix('location_item_kits_taxes') . ' READ, ' . $this->db->dbprefix('item_kits_taxes') . ' READ'); $store_account_payment_amount = 0; if ($store_account_payment) { $store_account_payment_amount = $this->sale_lib->get_total(); } //Only update balance + store account payments if we are NOT an estimate (suspended = 2) if ($suspended != 2) { //Update customer store account balance if ($customer_id > 0 && $balance) { $this->db->set('balance', 'balance+' . $balance, false); $this->db->where('person_id', $customer_id); if (!$this->db->update('customers')) { $this->db->query("ROLLBACK"); $this->db->query('UNLOCK TABLES'); return -1; } } //Update customer store account if payment made if ($customer_id > 0 && $store_account_payment_amount) { $this->db->set('balance', 'balance-' . $store_account_payment_amount, false); $this->db->where('person_id', $customer_id); if (!$this->db->update('customers')) { $this->db->query("ROLLBACK"); $this->db->query('UNLOCK TABLES'); return -1; } } } $previous_store_account_amount = 0; if ($sale_id !== FALSE) { $previous_store_account_amount = $this->get_store_account_payment_total($sale_id); } if ($sale_id) { //Delete previoulsy sale so we can overwrite data if (!$this->delete($sale_id, true)) { $this->db->query("ROLLBACK"); $this->db->query('UNLOCK TABLES'); return -1; } $this->db->where('sale_id', $sale_id); if (!$this->db->update('sales', $sales_data)) { $this->db->query("ROLLBACK"); $this->db->query('UNLOCK TABLES'); return -1; } } else { if (!$this->db->insert('sales', $sales_data)) { $this->db->query("ROLLBACK"); $this->db->query('UNLOCK TABLES'); return -1; } $sale_id = $this->db->insert_id(); } //Only update store account payments if we are NOT an estimate (suspended = 2) if ($suspended != 2) { //insert store account transaction if ($customer_id > 0 && $balance) { $store_account_transaction = array('customer_id' => $customer_id, 'sale_id' => $sale_id, 'comment' => $comment, 'transaction_amount' => $balance - $previous_store_account_amount, 'balance' => $this->Customer->get_info($customer_id)->balance, 'date' => date('Y-m-d H:i:s')); if ($balance - $previous_store_account_amount) { if (!$this->db->insert('store_accounts', $store_account_transaction)) { $this->db->query("ROLLBACK"); $this->db->query('UNLOCK TABLES'); return -1; } } } elseif ($customer_id > 0 && $previous_store_account_amount) { $store_account_transaction = array('customer_id' => $customer_id, 'sale_id' => $sale_id, 'comment' => $comment, 'transaction_amount' => -$previous_store_account_amount, 'balance' => $this->Customer->get_info($customer_id)->balance, 'date' => date('Y-m-d H:i:s')); if (!$this->db->insert('store_accounts', $store_account_transaction)) { $this->db->query("ROLLBACK"); $this->db->query('UNLOCK TABLES'); return -1; } } //insert store account payment transaction if ($customer_id > 0 && $store_account_payment) { $store_account_transaction = array('customer_id' => $customer_id, 'sale_id' => $sale_id, 'comment' => $comment, 'transaction_amount' => -$store_account_payment_amount, 'balance' => $this->Customer->get_info($customer_id)->balance, 'date' => date('Y-m-d H:i:s')); if (!$this->db->insert('store_accounts', $store_account_transaction)) { $this->db->query("ROLLBACK"); $this->db->query('UNLOCK TABLES'); return -1; } } } $total_giftcard_payments = 0; foreach ($payments as $payment_id => $payment) { //Only update giftcard payments if we are NOT an estimate (suspended = 2) if ($suspended != 2) { if (substr($payment['payment_type'], 0, strlen(lang('sales_giftcard'))) == lang('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']); $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 if (!$cur_item_info->is_service) { $cur_item_location_info->quantity = $cur_item_location_info->quantity !== NULL ? $cur_item_location_info->quantity : 0; if (!$this->Item_location->save_quantity($cur_item_location_info->quantity - $item['quantity'], $item['item_id'])) { $this->db->query("ROLLBACK"); $this->db->query('UNLOCK TABLES'); return -1; } } //Re-init $cur_item_location_info after updating quantity $cur_item_location_info = $this->Item_location->get_info($item['item_id']); //checks if the quantity is out of stock if ($out_of_stock_check && $cur_item_location_info->quantity <= 0) { $message = $cur_item_info->name . ' ' . lang('sales_is_out_stock') . ' ' . to_quantity($cur_item_location_info->quantity); $email = true; } else { if ($stock_recorder_check && $cur_item_location_info->quantity <= $reorder_level) { $message = $cur_item_info->name . ' ' . lang('sales_hits_reorder_level') . ' ' . to_quantity($cur_item_location_info->quantity); $email = true; } } //send email if ($this->Location->get_info_for_key('receive_stock_alert') && $email) { $this->load->library('email'); $config = array(); $config['mailtype'] = 'text'; $this->email->initialize($config); $this->email->from($this->Location->get_info_for_key('email') ? $this->Location->get_info_for_key('email') : '*****@*****.**', $this->config->item('company')); $this->email->to($this->Location->get_info_for_key('stock_alert_email') ? $this->Location->get_info_for_key('stock_alert_email') : $this->Location->get_info_for_key('email')); $this->email->subject(lang('sales_stock_alert_item_name') . $this->Item->get_info($item['item_id'])->name); $this->email->message($message); $this->email->send(); } if (!$cur_item_info->is_service) { $qty_buy = -$item['quantity']; $sale_remarks = $this->config->item('sale_prefix') . ' ' . $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, 'location_id' => $this->Employee->get_logged_in_employee_current_location_id()); if (!$this->Inventory->insert($inv_data)) { $this->db->query("ROLLBACK"); $this->db->query('UNLOCK TABLES'); return -1; } } } } else { $cur_item_kit_info = $this->Item_kit->get_info($item['item_kit_id']); $cur_item_kit_location_info = $this->Item_kit_location->get_info($item['item_kit_id']); $cost_price = $cur_item_kit_location_info && $cur_item_kit_location_info->cost_price ? $cur_item_kit_location_info->cost_price : $cur_item_kit_info->cost_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; } } if ($cur_item_kit_info->tax_included) { $item['price'] = get_price_for_item_kit_excluding_taxes($item['item_kit_id'], $item['price']); } $sales_item_kits_data = array('sale_id' => $sale_id, 'item_kit_id' => $item['item_kit_id'], 'line' => $item['line'], 'description' => $item['description'], 'quantity_purchased' => $item['quantity'], 'discount_percent' => $item['discount'], 'item_kit_cost_price' => $cost_price === NULL ? 0.0 : to_currency_no_money($cost_price, 10), 'item_kit_unit_price' => $item['price'], 'commission' => get_commission_for_item_kit($item['item_kit_id'], $item['price'], $item['quantity'], $item['discount'])); if (!$this->db->insert('sales_item_kits', $sales_item_kits_data)) { $this->db->query("ROLLBACK"); $this->db->query('UNLOCK TABLES'); return -1; } foreach ($this->Item_kit_items->get_info($item['item_kit_id']) as $item_kit_item) { $cur_item_info = $this->Item->get_info($item_kit_item->item_id); $cur_item_location_info = $this->Item_location->get_info($item_kit_item->item_id); $reorder_level = $cur_item_location_info && $cur_item_location_info->reorder_level !== NULL ? $cur_item_location_info->reorder_level : $cur_item_info->reorder_level; //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 item and the quantity for item is NOT NULL if (!$cur_item_info->is_service) { $cur_item_location_info->quantity = $cur_item_location_info->quantity !== NULL ? $cur_item_location_info->quantity : 0; if (!$this->Item_location->save_quantity($cur_item_location_info->quantity - $item['quantity'] * $item_kit_item->quantity, $item_kit_item->item_id)) { $this->db->query("ROLLBACK"); $this->db->query('UNLOCK TABLES'); return -1; } } //Re-init $cur_item_location_info after updating quantity $cur_item_location_info = $this->Item_location->get_info($item_kit_item->item_id); //checks if the quantity is out of stock if ($out_of_stock_check && !$cur_item_info->is_service && $cur_item_location_info->quantity <= 0) { $message = $cur_item_info->name . ' ' . lang('sales_is_out_stock') . ' ' . to_quantity($cur_item_location_info->quantity); $email = true; } else { if ($stock_recorder_check && $cur_item_location_info->quantity <= $reorder_level) { $message = $cur_item_info->name . ' ' . lang('sales_hits_reorder_level') . ' ' . to_quantity($cur_item_location_info->quantity); $email = true; } } //send email if ($this->Location->get_info_for_key('receive_stock_alert') && $email) { $this->load->library('email'); $config = array(); $config['mailtype'] = 'text'; $this->email->initialize($config); $this->email->from($this->Location->get_info_for_key('email') ? $this->Location->get_info_for_key('email') : '*****@*****.**', $this->config->item('company')); $this->email->to($this->Location->get_info_for_key('stock_alert_email') ? $this->Location->get_info_for_key('stock_alert_email') : $this->Location->get_info_for_key('email')); $this->email->subject(lang('sales_stock_alert_item_name') . $cur_item_info->name); $this->email->message($message); $this->email->send(); } if (!$cur_item_info->is_service) { $qty_buy = -$item['quantity'] * $item_kit_item->quantity; $sale_remarks = $this->config->item('sale_prefix') . ' ' . $sale_id; $inv_data = array('trans_date' => date('Y-m-d H:i:s'), 'trans_items' => $item_kit_item->item_id, 'trans_user' => $employee_id, 'trans_comment' => $sale_remarks, 'trans_inventory' => $qty_buy, 'location_id' => $this->Employee->get_logged_in_employee_current_location_id()); if (!$this->Inventory->insert($inv_data)) { $this->db->query("ROLLBACK"); $this->db->query('UNLOCK TABLES'); return -1; } } } } } $customer = $this->Customer->get_info($customer_id); if ($customer_id == -1 or $customer->taxable) { if (isset($item['item_id'])) { foreach ($this->Item_taxes_finder->get_info($item['item_id']) as $row) { $tax_name = $row['percent'] . '% ' . $row['name']; //Only save sale if the tax has NOT been deleted if (!in_array($tax_name, $this->sale_lib->get_deleted_taxes())) { $query_result = $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'], 'cumulative' => $row['cumulative'])); if (!$query_result) { $this->db->query("ROLLBACK"); $this->db->query('UNLOCK TABLES'); return -1; } } } } else { foreach ($this->Item_kit_taxes_finder->get_info($item['item_kit_id']) as $row) { $tax_name = $row['percent'] . '% ' . $row['name']; //Only save sale if the tax has NOT been deleted if (!in_array($tax_name, $this->sale_lib->get_deleted_taxes())) { $query_result = $this->db->insert('sales_item_kits_taxes', array('sale_id' => $sale_id, 'item_kit_id' => $item['item_kit_id'], 'line' => $item['line'], 'name' => $row['name'], 'percent' => $row['percent'], 'cumulative' => $row['cumulative'])); if (!$query_result) { $this->db->query("ROLLBACK"); $this->db->query('UNLOCK TABLES'); return -1; } } } } } } $this->db->query("COMMIT"); $this->db->query('UNLOCK TABLES'); return $sale_id; }
<div class='col-xs-1'> <?php echo form_input('number_locale', $this->config->item('number_locale'), array('class' => 'form-control input-sm', 'id' => 'number_locale')); ?> </div> <div class="col-xs-2"> <label class="control-label"> <a href="https://github.com/jekkos/opensourcepos/wiki/Localisation-support" target="_blank"> <span class="glyphicon glyphicon-info-sign" data-toggle="tootltip" data-placement="right" title="<?php echo $this->lang->line('config_number_locale_tooltip'); ?> "></span> </a> <span id="number_locale_example">   <?php echo to_currency(1234567890.123); ?> </span> </label> </div> </div> </div> <div class="form-group form-group-sm"> <?php echo form_label($this->lang->line('config_thousands_separator'), 'thousands_separator', array('class' => 'control-label col-xs-2')); ?> <div class='col-xs-2'> <?php echo form_checkbox(array('name' => 'thousands_separator', 'id' => 'thousands_separator', 'value' => 'thousands_separator', 'checked' => $this->config->item('thousands_separator'))); ?>
function detailed_receivings($start_date, $end_date, $receiving_type, $location_id = 'all', $export_excel = 0) { $this->load->model('reports/Detailed_receivings'); $model = $this->Detailed_receivings; $headers = $model->getDataColumns(); $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'receiving_type' => $receiving_type, 'location_id' => $location_id)); $summary_data = array(); $details_data = array(); $show_locations = $this->Stock_locations->multiple_locations(); foreach ($report_data['summary'] as $key => $row) { $summary_data[] = array(anchor('receivings/edit/' . $row['receiving_id'] . '/width:' . FORM_WIDTH, 'RECV ' . $row['receiving_id'], array('class' => 'thickbox')), $row['receiving_date'], $row['items_purchased'], $row['employee_name'], $row['supplier_name'], to_currency($row['total']), $row['payment_type'], $row['invoice_number'], $row['comment']); foreach ($report_data['details'][$key] as $drow) { $quantity_purchased = $drow['receiving_quantity'] > 1 ? $drow['quantity_purchased'] . ' x ' . $drow['receiving_quantity'] : $drow['quantity_purchased']; if ($show_locations) { $quantity_purchased .= ' [' . $this->Stock_locations->get_location_name($drow['item_location']) . ']'; } $details_data[$key][] = array($drow['item_number'], $drow['name'], $drow['category'], $quantity_purchased, to_currency($drow['total']), $drow['discount_percent'] . '%'); } } $data = array("title" => $this->lang->line('reports_detailed_receivings_report'), "subtitle" => date('m/d/Y', strtotime($start_date)) . '-' . date('m/d/Y', strtotime($end_date)), "headers" => $model->getDataColumns(), "header_width" => intval(100 / count($headers['summary'])), "editable" => "receivings", "summary_data" => $summary_data, "details_data" => $details_data, "header_width" => intval(100 / count($headers['summary'])), "overall_summary_data" => $model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'receiving_type' => $receiving_type, 'location_id' => $location_id)), "export_excel" => $export_excel); $this->load->view("reports/tabular_details", $data); }
</tr> <tr> <td colspan="2"><?php echo lang('common_total'); ?> </td> <td><?php echo $loan_info->currency == 'usd' ? to_currency($sum_principle) : to_riel_currency($sum_principle); ?> </td> <td><?php echo $loan_info->currency == 'usd' ? to_currency($sum_rate) : to_riel_currency($sum_rate); ?> </td> <td><?php echo $loan_info->currency == 'usd' ? to_currency($sum_total) : to_riel_currency($sum_total); ?> </td> <td></td> </tr> </table> <div class="row"> <br/> <div class="col-md-4"><center><b><?php echo lang('common_party_a'); ?> </b><br/><?php echo lang('common_signatur_a'); ?> </center></div> <div class="col-md-4"><center><b><?php
// "800", "400", "9.0.0", "expressInstall.swf", // {"data-file":"<?php echo $data_file; ?> "} ); </script> </div> --> <div id="chart_wrapper"> <div id="chart"></div> </div> <div id="report_summary"> <?php foreach ($summary_data as $name => $value) { ?> <div class="summary_row"><?php echo $this->lang->line('reports_' . $name) . ': ' . ($name == "quantity_purchased" ? intval($value) : to_currency($value)); ?> </div> <?php } ?> </div> </div><!-- /.box-body --> </div><!-- /.box --> <!-- for graphic --> </div> <div class="col-md-3"> <!-- for input filter --> <div class="box box-danger"> <div class="box-header with-border"> <h3 class="box-title"><?php
</td> <td style='text-align:right'><?php echo to_currency($cur_giftcard_value); ?> </td> </tr> <?php } ?> <tr> <td colspan="3" style='text-align:right;'> <?php echo $this->lang->line($amount_change >= 0 ? $only_sale_check ? 'sales_check_balance' : 'sales_change_due' : 'sales_amount_due'); ?> </td> <td style='text-align:right'><?php echo to_currency($amount_change); ?> </td> </tr> </table> <div id="sale_return_policy"> <?php echo nl2br($this->config->item('return_policy')); ?> </div> <div id='barcode'> <img src='data:image/png;base64,<?php echo $barcode; ?>
<?php } ?> </tr> <?php } ?> </tbody> </table> </div> <div id="report_summary"> <?php foreach ($summary_data as $name => $value) { ?> <div class="summary_row"><?php echo $this->lang->line('reports_' . $name) . ': ' . to_currency($value); ?> </div> <?php } ?> </div> <?php $this->load->view("partial/footer"); ?> <script type="text/javascript" language="javascript"> function init_table_sorting() { //Only init if there is more than one row if($('.tablesorter tbody tr').length >1)
<?php } ?> </div> </div> </div> <!--Supplier info ends here--> <div id='sale_details'> <table id="sales_items_total" class="table"> <tr class="success"> <td class="left"><h4><?php echo lang('sales_total'); ?> :</h4></td> <td class="right"><h4><?php echo to_currency($total, 10); ?> </h4></td> </tr> </table> </div> <?php } ?> <?php // Only show this part if there are Items already in the Table. if (count($cart) > 0) { ?>
?> </td> <?php } ?> </tr> <?php } ?> <tr> <td colspan="8"><strong>TOTAL</strong></td> <?php foreach ($summary_data as $name => $value) { ?> <td><strong><?php echo $name == "quantity_purchased" ? intval($value) : to_currency($value); ?> </strong></td> <?php } ?> </tr> </table> </div> <!-- ./table_holder --> </div><!-- /.box-body --> </div><!-- /.box --> </div> </div> <!-- Default box -->
</td></tr> <?php } ?> <tr> <td><?php echo lang('items_unit_price'); ?> </td> <td> <?php echo to_currency($item_info->unit_price, 10); ?> </td></tr> <tr> <td><?php echo lang('items_promo_price'); ?> </td> <td> <?php echo to_currency($item_info->promo_price, 10); ?> </td></tr> <tr> <td><?php echo lang('items_quantity'); ?> </td> <td> <?php echo to_quantity($item_location_info->quantity); ?> </td></tr> <tr> <td><?php echo lang('items_reorder_level'); ?> </td> <td> <?php echo to_quantity($reorder_level); ?>