mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-05-24 16:28:40 -04:00
Sales overview added to register screen
Add pagination to default search routine Remove payment_type column from sales table (was redundant) Fix search spinner location (just toggle ac_loading class) Complete sale labels
This commit is contained in:
@@ -13,6 +13,72 @@ class Sales extends Secure_area
|
||||
{
|
||||
$this->_reload();
|
||||
}
|
||||
|
||||
function manage($payment_type = 0, $limit_from = 0)
|
||||
{
|
||||
$data['controller_name']=strtolower($this->uri->segment(1));
|
||||
$data['payment_types'] = array($this->lang->line('sales_no_filter'), $this->lang->line('sales_invoice'));
|
||||
$data['search_section_state']=$this->input->post('search_section_state');
|
||||
|
||||
$lines_per_page = $this->Appconfig->get('lines_per_page');
|
||||
$sales = $this->Sale->get_all($payment_type,$lines_per_page,$limit_from);
|
||||
$total_rows = $this->Sale->get_found_rows($payment_type);
|
||||
$data['payment_type'] = $payment_type;
|
||||
$data['links'] = $this->_initialize_pagination($payment_type, $lines_per_page, $limit_from, $total_rows);
|
||||
|
||||
$data['manage_table']=get_sales_manage_table($sales,$this);
|
||||
$this->load->view($data['controller_name'] . '/manage',$data);
|
||||
$this->_remove_duplicate_cookies();
|
||||
}
|
||||
|
||||
function get_row()
|
||||
{
|
||||
$sale_id = $this->input->post('row_id');
|
||||
$sale_info = $this->Sale->get_info($sale_id)->result_array();
|
||||
$data_row=get_sale_data_row($sale_info[0],$this);
|
||||
echo $data_row;
|
||||
}
|
||||
|
||||
function _initialize_pagination($payment_type, $lines_per_page, $limit_from = 0, $total_rows = 0)
|
||||
{
|
||||
$this->load->library('pagination');
|
||||
$config['base_url'] = site_url($this->get_controller_name() . '/manage/' . $payment_type);
|
||||
$config['total_rows'] = $total_rows;
|
||||
$config['per_page'] = $lines_per_page;
|
||||
$config['num_links'] = 2;
|
||||
$config['last_link'] = $this->lang->line('common_last_page');
|
||||
$config['first_link'] = $this->lang->line('common_first_page');
|
||||
// page is calculated here instead of in pagination lib
|
||||
$config['cur_page'] = $limit_from > 0 ? $limit_from : 0;
|
||||
$config['page_query_string'] = FALSE;
|
||||
$config['uri_segment'] = 0;
|
||||
$this->pagination->initialize($config);
|
||||
return $this->pagination->create_links();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Get the width for the add/edit form.
|
||||
* @return number The form width
|
||||
*/
|
||||
function get_form_width()
|
||||
{
|
||||
return 400;
|
||||
}
|
||||
|
||||
function search()
|
||||
{
|
||||
$payment_type = $this->input->post('payment_type', TRUE);
|
||||
$limit_from = $this->input->post('limit_from', TRUE);
|
||||
$search = $this->input->post('search', TRUE);
|
||||
$lines_per_page = $this->Appconfig->get('lines_per_page');
|
||||
$sales = $this->Sale->search($search, $payment_type, $lines_per_page, $limit_from, $search);
|
||||
$total_rows = $this->Sale->get_found_rows($search);
|
||||
$links = $this->_initialize_pagination($payment_type, $lines_per_page, $limit_from, $total_rows);
|
||||
$data_rows=get_sales_manage_table_data_rows($sales,$this);
|
||||
echo json_encode(array('total_rows' => $total_rows, 'rows' => $data_rows, 'pagination' => $links));
|
||||
$this->_remove_duplicate_cookies();
|
||||
}
|
||||
|
||||
function item_search()
|
||||
{
|
||||
@@ -26,6 +92,14 @@ class Sales extends Secure_area
|
||||
$suggestions = $this->Customer->get_customer_search_suggestions($this->input->post('q'),$this->input->post('limit'));
|
||||
echo implode("\n",$suggestions);
|
||||
}
|
||||
|
||||
function suggest()
|
||||
{
|
||||
$search = $this->input->post('q', TRUE);
|
||||
$limit = $this->input->post('limit', TRUE);
|
||||
$suggestions = $this->Sale->get_search_suggestions($search, $limit);
|
||||
echo implode("\n",$suggestions);
|
||||
}
|
||||
|
||||
function select_customer()
|
||||
{
|
||||
@@ -487,12 +561,6 @@ class Sales extends Secure_area
|
||||
{
|
||||
$data = array();
|
||||
|
||||
$data['customers'] = array('' => 'No Customer');
|
||||
foreach ($this->Customer->get_all()->result() as $customer)
|
||||
{
|
||||
$data['customers'][$customer->person_id] = $customer->first_name . ' '. $customer->last_name;
|
||||
}
|
||||
|
||||
$data['employees'] = array();
|
||||
foreach ($this->Employee->get_all()->result() as $employee)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<?php
|
||||
class Secure_area extends CI_Controller
|
||||
{
|
||||
|
||||
private $controller_name;
|
||||
|
||||
/*
|
||||
Controllers that are considered secure extend Secure_area, optionally a $module_id can
|
||||
be set to also check if a user can access a particular module in the system.
|
||||
@@ -30,9 +33,14 @@ class Secure_area extends CI_Controller
|
||||
}
|
||||
$data['user_info']=$logged_in_employee_info;
|
||||
$data['controller_name']=$module_id;
|
||||
$this->controller_name=$module_id;
|
||||
$this->load->vars($data);
|
||||
}
|
||||
|
||||
function get_controller_name() {
|
||||
return strtolower($this->controller_name);
|
||||
}
|
||||
|
||||
function _remove_duplicate_cookies ()
|
||||
{
|
||||
//php < 5.3 doesn't have header remove so this function will fatal error otherwise
|
||||
|
||||
@@ -1,4 +1,77 @@
|
||||
<?php
|
||||
|
||||
function get_sales_manage_table($sales,$controller)
|
||||
{
|
||||
$CI =& get_instance();
|
||||
$table='<table class="tablesorter" id="sortable_table">';
|
||||
|
||||
$headers = array(' ',
|
||||
$CI->lang->line('sales_sale_time'),
|
||||
$CI->lang->line('customers_customer'),
|
||||
$CI->lang->line('sales_amount_tendered'),
|
||||
$CI->lang->line('sales_amount_due'),
|
||||
$CI->lang->line('sales_receipt_number'),
|
||||
$CI->lang->line('sales_invoice_number'),
|
||||
' ');
|
||||
|
||||
$table.='<thead><tr>';
|
||||
foreach($headers as $header)
|
||||
{
|
||||
$table.="<th>$header</th>";
|
||||
}
|
||||
$table.='</tr></thead><tbody>';
|
||||
$table.=get_sales_manage_table_data_rows($sales,$controller);
|
||||
$table.='</tbody></table>';
|
||||
return $table;
|
||||
}
|
||||
|
||||
/*
|
||||
Gets the html data rows for the people.
|
||||
*/
|
||||
function get_sales_manage_table_data_rows($sales,$controller)
|
||||
{
|
||||
$CI =& get_instance();
|
||||
$table_data_rows='';
|
||||
|
||||
foreach($sales->result_array() as $sale)
|
||||
{
|
||||
$table_data_rows.=get_sale_data_row($sale,$controller);
|
||||
}
|
||||
|
||||
if($sales->num_rows()==0)
|
||||
{
|
||||
$table_data_rows.="<tr><td colspan='8'><div class='warning_message' style='padding:7px;'>".$CI->lang->line('sales_no_sales_to_display')."</div></tr></tr>";
|
||||
}
|
||||
|
||||
return $table_data_rows;
|
||||
}
|
||||
|
||||
function get_sale_data_row($sale,$controller)
|
||||
{
|
||||
$CI =& get_instance();
|
||||
$controller_name=$CI->uri->segment(1);
|
||||
$width = $controller->get_form_width();
|
||||
|
||||
$table_data_row='<tr>';
|
||||
$table_data_row.='<td width="3%"><input type="checkbox" id="sale_"' . $sale[ 'sale_id' ] . ' value="' . $sale[ 'sale_id' ]. '" /></td>';
|
||||
$table_data_row.='<td width="17%">'.date('d/m/Y H:i' , strtotime($sale[ 'sale_time' ])).'</td>';
|
||||
$table_data_row.='<td width="23%">'.character_limiter( $sale[ 'last_name' ] . " " . $sale[ 'first_name' ] ,25).'</td>';
|
||||
$table_data_row.='<td width="10%">'.to_currency( $sale[ 'amount_tendered' ] ).'</td>';
|
||||
$table_data_row.='<td width="10%">'.to_currency( $sale[ 'amount_due' ] ).'</td>';
|
||||
$table_data_row.='<td width="15%">'.'Ticket ' . $sale[ 'sale_id' ]. '</td>';
|
||||
$table_data_row.='<td width="10%">'.$sale[ 'invoice_number' ].'</td>';
|
||||
$table_data_row.='<td width="12%">';
|
||||
$table_data_row.=anchor($controller_name."/edit/" . $sale[ 'sale_id' ] . "/width:$width", $CI->lang->line('common_edit'),array('class'=>'thickbox','title'=>$CI->lang->line($controller_name.'_update')));
|
||||
$table_data_row.=' ';
|
||||
$table_data_row.='<a href="'.site_url($controller_name. "/receipt/" . $sale[ 'sale_id' ]) . '">' . $CI->lang->line('sales_show_receipt') . '</a>';
|
||||
$table_data_row.=' ';
|
||||
$table_data_row.='<a href="'.site_url($controller_name. "/invoice/" . $sale[ 'sale_id' ]) . '">' . $CI->lang->line('sales_show_invoice') . '</a>';
|
||||
$table_data_row.='</td>';
|
||||
$table_data_row.='</tr>';
|
||||
|
||||
return $table_data_row;
|
||||
}
|
||||
|
||||
/*
|
||||
Gets the html table to manage people.
|
||||
*/
|
||||
|
||||
@@ -44,3 +44,4 @@ $lang["common_gender"] = "Gender";
|
||||
$lang["common_gender_male"] = "M";
|
||||
$lang["common_gender_female"] = "F";
|
||||
$lang["common_date"] = "Date";
|
||||
$lang["common_search_options"] = "Search options";
|
||||
|
||||
@@ -99,3 +99,12 @@ $lang["sales_invoice_confirm"] = "This invoice will be sent to";
|
||||
$lang["sales_invoice_no_email"] = "This customer does not have a valid email address";
|
||||
$lang["sales_invoice_sent"] = "Invoice sent to";
|
||||
$lang["sales_invoice_unsent"] = "Invoice failed to be sent to";
|
||||
$lang["sales_invoice_filter"] = "Invoices";
|
||||
$lang["sales_no_filter"] = "All";
|
||||
$lang["sales_no_sales_to_display"] = "No sales to display";
|
||||
$lang["sales_show_invoice"] = "invoice";
|
||||
$lang["sales_show_receipt"] = "receipt";
|
||||
$lang["sales_invoice_filter"] = "Filter sales for ";
|
||||
$lang["sales_overview"] = "Overview";
|
||||
$lang["sales_update"] = "Edit Sale";
|
||||
$lang["sales_confirm_delete"] = "Are you sure you want to delete the selected sales?";
|
||||
|
||||
@@ -44,3 +44,4 @@ $lang["common_gender"] = "Gender";
|
||||
$lang["common_gender_male"] = "M";
|
||||
$lang["common_gender_female"] = "F";
|
||||
$lang["common_date"] = "Date";
|
||||
$lang["common_search_options"] = "Search options";
|
||||
|
||||
@@ -92,10 +92,19 @@ $lang["sales_unsuspend_and_delete"] = "Retomar y Borrar";
|
||||
$lang["sales_giftcard_balance"] = "Giftcard Balance";
|
||||
$lang["sales_discount_included"] = "% discount included";
|
||||
$lang["sales_print_after_sale"] = "Imprimir recibo después de una venta";
|
||||
$lang["sales_invoice"] = "Invoice";
|
||||
$lang["sales_invoice"] = "tarjeta de Crédito";
|
||||
$lang["sales_total_tax_exclusive"] = "Tax excluded";
|
||||
$lang["sales_send_invoice"] = "Send Invoice";
|
||||
$lang["sales_invoice_confirm"] = "This invoice will be sent to";
|
||||
$lang["sales_invoice_no_email"] = "This customer does not have a valid email address";
|
||||
$lang["sales_invoice_sent"] = "Invoice sent to";
|
||||
$lang["sales_invoice_unsent"] = "Invoice failed to be sent to";
|
||||
$lang["sales_invoice_filter"] = "Invoices";
|
||||
$lang["sales_no_filter"] = "All";
|
||||
$lang["sales_no_sales_to_display"] = "No sales to display";
|
||||
$lang["sales_show_invoice"] = "invoice";
|
||||
$lang["sales_show_receipt"] = "receipt";
|
||||
$lang["sales_invoice_filter"] = "Filter sales for ";
|
||||
$lang["sales_overview"] = "Overview";
|
||||
$lang["sales_update"] = "Edit Sale";
|
||||
$lang["sales_confirm_delete"] = "Are you sure you want to delete the selected sales?";
|
||||
|
||||
@@ -44,3 +44,4 @@ $lang["common_gender"] = "Gender";
|
||||
$lang["common_gender_male"] = "M";
|
||||
$lang["common_gender_female"] = "F";
|
||||
$lang["common_date"] = "Date";
|
||||
$lang["common_search_options"] = "Search options";
|
||||
|
||||
@@ -99,3 +99,12 @@ $lang["sales_invoice_confirm"] = "This invoice will be sent to";
|
||||
$lang["sales_invoice_no_email"] = "This customer does not have a valid email address";
|
||||
$lang["sales_invoice_sent"] = "Invoice sent to";
|
||||
$lang["sales_invoice_unsent"] = "Invoice failed to be sent to";
|
||||
$lang["sales_invoice_filter"] = "Invoices";
|
||||
$lang["sales_no_filter"] = "All";
|
||||
$lang["sales_no_sales_to_display"] = "No sales to display";
|
||||
$lang["sales_show_invoice"] = "invoice";
|
||||
$lang["sales_show_receipt"] = "receipt";
|
||||
$lang["sales_invoice_filter"] = "Filter sales for ";
|
||||
$lang["sales_overview"] = "Overview";
|
||||
$lang["sales_update"] = "Edit Sale";
|
||||
$lang["sales_confirm_delete"] = "Are you sure you want to delete the selected sales?";
|
||||
|
||||
@@ -44,3 +44,4 @@ $lang["common_gender"] = "Gender";
|
||||
$lang["common_gender_male"] = "M";
|
||||
$lang["common_gender_female"] = "V";
|
||||
$lang["common_date"] = "Date";
|
||||
$lang["common_search_options"] = "Search options";
|
||||
|
||||
@@ -99,3 +99,12 @@ $lang["sales_invoice_confirm"] = "This invoice will be sent to";
|
||||
$lang["sales_invoice_no_email"] = "This customer does not have a valid email address";
|
||||
$lang["sales_invoice_sent"] = "Invoice sent to";
|
||||
$lang["sales_invoice_unsent"] = "Invoice failed to be sent to";
|
||||
$lang["sales_invoice_filter"] = "Invoices";
|
||||
$lang["sales_no_filter"] = "All";
|
||||
$lang["sales_no_sales_to_display"] = "No sales to display";
|
||||
$lang["sales_show_invoice"] = "invoice";
|
||||
$lang["sales_show_receipt"] = "receipt";
|
||||
$lang["sales_invoice_filter"] = "Filter sales for ";
|
||||
$lang["sales_overview"] = "Overview";
|
||||
$lang["sales_update"] = "Edit Sale";
|
||||
$lang["sales_confirm_delete"] = "Are you sure you want to delete the selected sales?";
|
||||
|
||||
@@ -44,3 +44,4 @@ $lang["common_gender"] = "Geslacht";
|
||||
$lang["common_gender_male"] = "M";
|
||||
$lang["common_gender_female"] = "V";
|
||||
$lang["common_date"] = "Datum";
|
||||
$lang["common_search_options"] = "Zoek criteria";
|
||||
|
||||
@@ -99,3 +99,12 @@ $lang["sales_invoice_confirm"] = "Deze factuur zal verstuurd worden naar";
|
||||
$lang["sales_invoice_no_email"] = "Er werd geen email adres gevonden voor deze klant";
|
||||
$lang["sales_invoice_sent"] = "Factuur verstuurd naar";
|
||||
$lang["sales_invoice_unsent"] = "Fout bij het versturen van factuur naar";
|
||||
$lang["sales_invoice_filter"] = "Facturen";
|
||||
$lang["sales_no_filter"] = "Alle";
|
||||
$lang["sales_no_sales_to_display"] = "Er werden geen aankopen gevonden";
|
||||
$lang["sales_show_invoice"] = "factuur";
|
||||
$lang["sales_show_receipt"] = "ticket";
|
||||
$lang["sales_invoice_filter"] = "Filter tickets op ";
|
||||
$lang["sales_overview"] = "Overzicht";
|
||||
$lang["sales_update"] = "Bewerk Ticket";
|
||||
$lang["sales_confirm_delete"] = "Bent u zeker dat u de geselecteerde aankopen wil verwijderen?";
|
||||
|
||||
@@ -44,3 +44,4 @@ $lang["common_gender"] = "Gender";
|
||||
$lang["common_gender_male"] = "M";
|
||||
$lang["common_gender_female"] = "V";
|
||||
$lang["common_date"] = "Date";
|
||||
$lang["common_search_options"] = "Search options";
|
||||
|
||||
@@ -99,3 +99,12 @@ $lang["sales_invoice_confirm"] = "This invoice will be sent to";
|
||||
$lang["sales_invoice_no_email"] = "This customer does not have a valid email address";
|
||||
$lang["sales_invoice_sent"] = "Invoice sent to";
|
||||
$lang["sales_invoice_unsent"] = "Invoice failed to be sent to";
|
||||
$lang["sales_invoice_filter"] = "Invoices";
|
||||
$lang["sales_no_filter"] = "All";
|
||||
$lang["sales_no_sales_to_display"] = "No sales to display";
|
||||
$lang["sales_show_invoice"] = "invoice";
|
||||
$lang["sales_show_receipt"] = "receipt";
|
||||
$lang["sales_invoice_filter"] = "Filter sales for ";
|
||||
$lang["sales_overview"] = "Overview";
|
||||
$lang["sales_update"] = "Edit Sale";
|
||||
$lang["sales_confirm_delete"] = "Are you sure you want to delete the selected sales?";
|
||||
|
||||
@@ -44,3 +44,4 @@ $lang["common_gender"] = "Gender";
|
||||
$lang["common_gender_male"] = "M";
|
||||
$lang["common_gender_female"] = "V";
|
||||
$lang["common_date"] = "Date";
|
||||
$lang["common_search_options"] = "Search options";
|
||||
|
||||
@@ -99,3 +99,12 @@ $lang["sales_invoice_confirm"] = "This invoice will be sent to";
|
||||
$lang["sales_invoice_no_email"] = "This customer does not have a valid email address";
|
||||
$lang["sales_invoice_sent"] = "Invoice sent to";
|
||||
$lang["sales_invoice_unsent"] = "Invoice failed to be sent to";
|
||||
$lang["sales_invoice_filter"] = "Invoices";
|
||||
$lang["sales_no_filter"] = "All";
|
||||
$lang["sales_no_sales_to_display"] = "No sales to display";
|
||||
$lang["sales_show_invoice"] = "invoice";
|
||||
$lang["sales_show_receipt"] = "receipt";
|
||||
$lang["sales_invoice_filter"] = "Filter sales for ";
|
||||
$lang["sales_overview"] = "Overview";
|
||||
$lang["sales_update"] = "Edit Sale";
|
||||
$lang["sales_confirm_delete"] = "Are you sure you want to delete the selected sales?";
|
||||
|
||||
@@ -44,3 +44,4 @@ $lang["common_gender"] = "Gender";
|
||||
$lang["common_gender_male"] = "M";
|
||||
$lang["common_gender_female"] = "V";
|
||||
$lang["common_date"] = "Date";
|
||||
$lang["common_search_options"] = "Search options";
|
||||
|
||||
@@ -99,3 +99,12 @@ $lang["sales_invoice_confirm"] = "This invoice will be sent to";
|
||||
$lang["sales_invoice_no_email"] = "This customer does not have a valid email address";
|
||||
$lang["sales_invoice_sent"] = "Invoice sent to";
|
||||
$lang["sales_invoice_unsent"] = "Invoice failed to be sent to";
|
||||
$lang["sales_invoice_filter"] = "Invoices";
|
||||
$lang["sales_no_filter"] = "All";
|
||||
$lang["sales_no_sales_to_display"] = "No sales to display";
|
||||
$lang["sales_show_invoice"] = "invoice";
|
||||
$lang["sales_show_receipt"] = "receipt";
|
||||
$lang["sales_invoice_filter"] = "Filter sales for ";
|
||||
$lang["sales_overview"] = "Overview";
|
||||
$lang["sales_update"] = "Edit Sale";
|
||||
$lang["sales_confirm_delete"] = "Are you sure you want to delete the selected sales?";
|
||||
|
||||
@@ -44,3 +44,4 @@ $lang["common_gender"] = "Gender";
|
||||
$lang["common_gender_male"] = "M";
|
||||
$lang["common_gender_female"] = "V";
|
||||
$lang["common_date"] = "Date";
|
||||
$lang["common_search_options"] = "Search options";
|
||||
|
||||
@@ -99,3 +99,12 @@ $lang["sales_invoice_confirm"] = "This invoice will be sent to";
|
||||
$lang["sales_invoice_no_email"] = "This customer does not have a valid email address";
|
||||
$lang["sales_invoice_sent"] = "Invoice sent to";
|
||||
$lang["sales_invoice_unsent"] = "Invoice failed to be sent to";
|
||||
$lang["sales_invoice_filter"] = "Invoices";
|
||||
$lang["sales_no_filter"] = "All";
|
||||
$lang["sales_no_sales_to_display"] = "No sales to display";
|
||||
$lang["sales_show_invoice"] = "invoice";
|
||||
$lang["sales_show_receipt"] = "receipt";
|
||||
$lang["sales_invoice_filter"] = "Filter sales for ";
|
||||
$lang["sales_overview"] = "Overview";
|
||||
$lang["sales_update"] = "Edit Sale";
|
||||
$lang["sales_confirm_delete"] = "Are you sure you want to delete the selected sales?";
|
||||
|
||||
@@ -3,12 +3,139 @@ class Sale extends CI_Model
|
||||
{
|
||||
public function get_info($sale_id)
|
||||
{
|
||||
$this->db->select('first_name, last_name, email, comment, invoice_number, amount_tendered, ' .
|
||||
'sale_time, employee_id, customer_id, comments');
|
||||
$this->db->select("DATE_FORMAT( sale_time, '%d-%m-%Y' ) AS sale_date", FALSE);
|
||||
$this->db->select("sales.sale_id AS sale_id");
|
||||
$this->db->select("SUM(item_unit_price * quantity_purchased * (1 - discount_percent / 100)) AS amount_due");
|
||||
$this->db->from('sales');
|
||||
$this->db->join('people', 'people.person_id = sales.customer_id', 'LEFT');
|
||||
$this->db->where('sale_id',$sale_id);
|
||||
$this->db->join('people', 'people.person_id = sales.customer_id', 'left');
|
||||
$this->db->join('sales_items', 'sales_items.sale_id = sales.sale_id');
|
||||
$this->db->join("(SELECT sale_id, SUM(payment_amount) AS amount_tendered " .
|
||||
" FROM " . $this->db->dbprefix('sales_payments') ." WHERE payment_type <> '" .
|
||||
$this->lang->line('sales_check') . "' GROUP BY sale_id) AS payments",
|
||||
"payments.sale_id = sales.sale_id", 'left');
|
||||
$this->db->where('sales.sale_id',$sale_id);
|
||||
$this->db->order_by('sale_time', 'desc');
|
||||
$this->db->group_by('sale_id');
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
function get_all($only_invoices = 0, $rows = 0, $limit_from = 0)
|
||||
{
|
||||
$this->db->select('first_name, last_name, invoice_number, amount_tendered, sale_time');
|
||||
$this->db->select("DATE_FORMAT( sale_time, '%d-%m-%Y' ) AS sale_date", FALSE);
|
||||
$this->db->select("sales.sale_id AS sale_id");
|
||||
$this->db->select("SUM(item_unit_price * quantity_purchased * (1 - discount_percent / 100)) AS amount_due");
|
||||
$this->db->from('sales');
|
||||
$this->db->join('people', 'people.person_id = sales.customer_id', 'left');
|
||||
$this->db->join('sales_items', 'sales_items.sale_id = sales.sale_id');
|
||||
$this->db->join("(SELECT sale_id, SUM(payment_amount) AS amount_tendered " .
|
||||
" FROM " . $this->db->dbprefix('sales_payments') ." WHERE payment_type <> '" .
|
||||
$this->lang->line('sales_check') . "' GROUP BY sale_id) AS payments",
|
||||
"payments.sale_id = sales.sale_id", 'left');
|
||||
$this->db->order_by('sale_time', 'desc');
|
||||
$this->db->group_by('sale_id');
|
||||
if ($rows > 0) {
|
||||
$this->db->limit($rows, $limit_from);
|
||||
}
|
||||
if ($only_invoices != 0) {
|
||||
$this->db->where('invoice_number <> ', 'NULL');
|
||||
}
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
function search($search, $only_invoices = FALSE, $rows = 0, $limit_from = 0)
|
||||
{
|
||||
$valid_receipt = $this->sale_lib->is_valid_receipt($search);
|
||||
$this->db->select('first_name, last_name, invoice_number, amount_tendered, sale_time');
|
||||
$this->db->select("DATE_FORMAT( sale_time, '%d-%m-%Y' ) AS sale_date", FALSE);
|
||||
$this->db->select("sales.sale_id AS sale_id");
|
||||
$this->db->select("SUM(item_unit_price * quantity_purchased * (1 - discount_percent / 100)) AS amount_due");
|
||||
$this->db->from('sales');
|
||||
$this->db->join('people', 'people.person_id = sales.customer_id', 'left');
|
||||
$this->db->join('sales_items', 'sales_items.sale_id = sales.sale_id');
|
||||
$this->db->join("(SELECT sale_id, SUM(payment_amount) AS amount_tendered " .
|
||||
" FROM " . $this->db->dbprefix('sales_payments') ." WHERE payment_type <> '" .
|
||||
$this->lang->line('sales_check') . "' GROUP BY sale_id) AS payments",
|
||||
"payments.sale_id = sales.sale_id", 'left');
|
||||
$this->db->group_by('sale_id');
|
||||
if (!empty($search)) {
|
||||
// if barcode scanned, explode and search for second term which will be the id
|
||||
if ($valid_receipt) {
|
||||
$pieces = explode(' ',$search);
|
||||
$this->db->where('sales.sale_id', $pieces[1]);
|
||||
} else {
|
||||
// open parentheses
|
||||
$this->db->where("( last_name LIKE '%" . $search . "%' OR ".
|
||||
"first_name LIKE '%" . $search . "%' OR " .
|
||||
"CONCAT( first_name,' ',last_name ) LIKE '%" . $search . "%')");
|
||||
// close parentheses
|
||||
}
|
||||
}
|
||||
if ($only_invoices != 0) {
|
||||
$this->db->where('invoice_number <> ', 'NULL');
|
||||
}
|
||||
$this->db->order_by('sale_time DESC');
|
||||
if ($rows > 0) {
|
||||
$this->db->limit($rows, $limit_from);
|
||||
}
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
function get_search_suggestions($search,$limit=25)
|
||||
{
|
||||
$suggestions = array();
|
||||
|
||||
if (!$this->sale_lib->is_valid_receipt($search)) {
|
||||
$this->db->distinct();
|
||||
$this->db->select('first_name, last_name, invoice_number, sale_time');
|
||||
$this->db->select("DATE_FORMAT( sale_time, '%d-%m-%Y' ) AS sale_date", FALSE);
|
||||
$this->db->select("sales.sale_id AS sale_id");
|
||||
$this->db->from('sales');
|
||||
$this->db->join('people', 'people.person_id = sales.customer_id', 'left');
|
||||
$this->db->where("( last_name LIKE '%" . $search . "%' OR ".
|
||||
"first_name LIKE '%" . $search . "%' OR " .
|
||||
"CONCAT( first_name, last_name ))");
|
||||
$this->db->order_by('last_name', "asc");
|
||||
|
||||
foreach($this->db->get()->result_array() as $result)
|
||||
{
|
||||
$suggestions[]=$result[ 'first_name' ].' '.$result[ 'last_name' ];
|
||||
}
|
||||
|
||||
} else {
|
||||
$suggestions[]=$search;
|
||||
}
|
||||
return $suggestions;
|
||||
}
|
||||
|
||||
function get_found_rows($search, $only_invoices = FALSE)
|
||||
{
|
||||
$valid_receipt = $this->sale_lib->is_valid_receipt($search);
|
||||
$this->db->from('sales');
|
||||
$this->db->join('sales_items', 'sales_items.sale_id = sales.sale_id');
|
||||
$this->db->join('people', 'people.person_id = sales.customer_id', 'left');
|
||||
$this->db->group_by('sales.sale_id');
|
||||
if (!empty($search)) {
|
||||
// if barcode scanned, explode and search for second term which will be the id
|
||||
if ($valid_receipt) {
|
||||
$pieces = explode(' ',$search);
|
||||
$this->db->where('sales.sale_id', $pieces[1]);
|
||||
} else {
|
||||
// open parentheses
|
||||
$this->db->where("( last_name LIKE '%" . $search . "%' OR ".
|
||||
"first_name LIKE '%" . $search . "%' OR " .
|
||||
"CONCAT( first_name,' ',last_name ) LIKE '%" . $search . "%')");
|
||||
// close parentheses
|
||||
}
|
||||
}
|
||||
if ($only_invoices != 0) {
|
||||
$this->db->where('invoice_number <> ', 'NULL');
|
||||
}
|
||||
return $this->db->get()->num_rows();
|
||||
}
|
||||
|
||||
function get_invoice_count()
|
||||
{
|
||||
$this->db->from('sales');
|
||||
@@ -56,19 +183,10 @@ class Sale extends CI_Model
|
||||
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,
|
||||
'invoice_number'=>$invoice_number
|
||||
);
|
||||
@@ -183,6 +301,10 @@ class Sale extends CI_Model
|
||||
$this->db->delete('sales_payments', array('sale_id' => $sale_id));
|
||||
// then delete all taxes on items
|
||||
$this->db->delete('sales_items_taxes', array('sale_id' => $sale_id));
|
||||
// delete all items
|
||||
$this->db->delete('sales_items', array('sale_id' => $sale_id));
|
||||
// delete sale itself
|
||||
$this->db->delete('sales', array('sale_id' => $sale_id));
|
||||
if ($update_inventory) {
|
||||
// defect, not all item deletions will be undone??
|
||||
// get array with all the items involved in the sale to update the inventory tracking
|
||||
@@ -208,10 +330,6 @@ class Sale extends CI_Model
|
||||
$item['quantity_purchased']);
|
||||
}
|
||||
}
|
||||
// delete all items
|
||||
$this->db->delete('sales_items', array('sale_id' => $sale_id));
|
||||
// delete sale itself
|
||||
$this->db->delete('sales', array('sale_id' => $sale_id));
|
||||
// execute transaction
|
||||
$this->db->trans_complete();
|
||||
|
||||
@@ -254,7 +372,6 @@ class Sale extends CI_Model
|
||||
//We create a temp table that allows us to do easy report/sales queries
|
||||
public function create_sales_items_temp_table()
|
||||
{
|
||||
$this->db->query("DROP TABLE IF EXISTS phppos_sales_items_temp");
|
||||
$this->db->query("CREATE TEMPORARY TABLE ".$this->db->dbprefix('sales_items_temp')."
|
||||
(SELECT date(sale_time) as sale_date, sale_time, ".$this->db->dbprefix('sales_items').".sale_id, comment,payments.payment_type, customer_id, employee_id,
|
||||
".$this->db->dbprefix('items').".item_id, supplier_id, quantity_purchased, item_cost_price, item_unit_price, SUM(percent) as item_tax_percent,
|
||||
|
||||
@@ -133,7 +133,7 @@ function show_hide_search_filter(search_filter_section, switchImgTag) {
|
||||
</div>
|
||||
|
||||
<div id="titleTextImg" style="background-color:#EEEEEE;height:30px;position:relative;">
|
||||
<div style="float:left;vertical-align:text-top;">Search Options :</div>
|
||||
<div style="float:left;vertical-align:text-top;"><?php echo $this->lang->line('common_search_options'); ?> :</div>
|
||||
<a id="imageDivLink" href="javascript:show_hide_search_filter('search_filter_section', 'imageDivLink');" style="outline:none;">
|
||||
<img src="
|
||||
<?php echo isset($search_section_state)? ( ($search_section_state)? base_url().'images/minus.png' : base_url().'images/plus.png') : base_url().'images/plus.png';?>" style="border:0;outline:none;padding:0px;margin:0px;position:relative;top:-5px;"></a>
|
||||
|
||||
176
application/views/sales/manage.php
Executable file
176
application/views/sales/manage.php
Executable file
@@ -0,0 +1,176 @@
|
||||
<?php $this->load->view("partial/header"); ?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function()
|
||||
{
|
||||
init_table_sorting();
|
||||
enable_checkboxes();
|
||||
enable_row_selection();
|
||||
enable_search('<?php echo site_url("$controller_name/suggest")?>','<?php echo $this->lang->line("common_confirm_search")?>');
|
||||
enable_delete('<?php echo $this->lang->line($controller_name."_confirm_delete")?>','<?php echo $this->lang->line($controller_name."_none_selected")?>');
|
||||
|
||||
$("#search_filter_section select").change(function() {
|
||||
do_search(true);
|
||||
return false;
|
||||
});
|
||||
|
||||
var show_renumber = function() {
|
||||
var value = $("#payment_type").val();
|
||||
var $button = $("#update_invoice_numbers").parents("li");
|
||||
$button.toggle(value === "1");
|
||||
}
|
||||
|
||||
$("#payment_type").change(show_renumber);
|
||||
show_renumber();
|
||||
|
||||
$("#update_invoice_numbers").click(function() {
|
||||
$.ajax({url : "<?php echo site_url('sales') ?>/update_invoice_numbers", dataType: 'json', success : post_bulk_form_submit });
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function post_form_submit(response)
|
||||
{
|
||||
if(!response.success)
|
||||
{
|
||||
set_feedback(response.message,'error_message',true);
|
||||
}
|
||||
else
|
||||
{
|
||||
update_row(response.id,'<?php echo site_url("$controller_name/get_row")?>');
|
||||
set_feedback(response.message,'success_message',false);
|
||||
}
|
||||
}
|
||||
|
||||
function post_bulk_form_submit(response)
|
||||
{
|
||||
if(!response.success)
|
||||
{
|
||||
set_feedback(response.message,'error_message',true);
|
||||
}
|
||||
else
|
||||
{
|
||||
for(id in response.ids)
|
||||
{
|
||||
update_row(response.ids[id],'<?php echo site_url("$controller_name/get_row")?>');
|
||||
}
|
||||
set_feedback(response.message,'success_message',false);
|
||||
}
|
||||
}
|
||||
|
||||
function show_hide_search_filter(search_filter_section, switchImgTag) {
|
||||
var ele = document.getElementById(search_filter_section);
|
||||
var imageEle = document.getElementById(switchImgTag);
|
||||
if(ele.style.display == "block")
|
||||
{
|
||||
ele.style.display = "none";
|
||||
imageEle.innerHTML = '<img src=" <?php echo base_url()?>images/plus.png" style="border:0;outline:none;padding:0px;margin:0px;position:relative;top:-5px;" >';
|
||||
}
|
||||
else
|
||||
{
|
||||
ele.style.display = "block";
|
||||
imageEle.innerHTML = '<img src=" <?php echo base_url()?>images/minus.png" style="border:0;outline:none;padding:0px;margin:0px;position:relative;top:-5px;" >';
|
||||
}
|
||||
}
|
||||
|
||||
function init_table_sorting()
|
||||
{
|
||||
$.tablesorter.addParser({
|
||||
id: "datetime",
|
||||
is: function(s) {
|
||||
return false;
|
||||
},
|
||||
format: function(s,table) {
|
||||
s = s.replace(/\-/g,"/");
|
||||
s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})\s(\d{1,2})\:(\d{2})/, "$3/$2/$1 $4:$5");
|
||||
return $.tablesorter.formatFloat(new Date(s).getTime());
|
||||
},
|
||||
type: "numeric"
|
||||
});
|
||||
|
||||
$.tablesorter.addParser({
|
||||
id: "invoice_number",
|
||||
is: function(s) {
|
||||
return false;
|
||||
},
|
||||
format: function(s,table) {
|
||||
s = s.split(/[\/\-]/);
|
||||
if (s.length == 2 && s[0].match(/[12]\d{3}/g))
|
||||
{
|
||||
return $.tablesorter.formatFloat(new Date(s[0]).getTime() + s[1]);
|
||||
}
|
||||
return $.tablesorter.formatFloat(s);
|
||||
},
|
||||
type: "numeric"
|
||||
});
|
||||
|
||||
$.tablesorter.addParser({
|
||||
id: "receipt_number",
|
||||
is: function(s) {
|
||||
return false;
|
||||
},
|
||||
format: function(s,table) {
|
||||
s = s.split(/[\s]/);
|
||||
if (s.length == 2 && s[1].match(/\d+/g))
|
||||
{
|
||||
return $.tablesorter.formatFloat(s[1]);
|
||||
}
|
||||
return s;
|
||||
},
|
||||
type: "numeric"
|
||||
});
|
||||
|
||||
//Only init if there is more than one row
|
||||
if($('.tablesorter tbody tr').length >1)
|
||||
{
|
||||
$("#sortable_table").tablesorter(
|
||||
{
|
||||
sortList: [[1,1], [5,1]],
|
||||
dateFormat: 'dd-mm-yyyy',
|
||||
headers:
|
||||
{
|
||||
1: { sorter: 'datetime'},
|
||||
6: { sorter: 'invoice_number'},
|
||||
7: { sorter: false}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div id="title_bar">
|
||||
<div id="title" class="float_left"><?php echo $this->lang->line('common_list_of').' '.$this->lang->line('sales_receipt_number'); ?></div>
|
||||
</div>
|
||||
<div id="pagination"><?= $links ?></div>
|
||||
<div id="titleTextImg" style="background-color:#EEEEEE;height:30px;position:relative;">
|
||||
<div style="float:left;vertical-align:text-top;"><?php echo $this->lang->line('common_search_options'). ': '; ?></div>
|
||||
<a id="imageDivLink" href="javascript:show_hide_search_filter('search_filter_section', 'imageDivLink');" style="outline:none;">
|
||||
<img src="<?php echo base_url().'images/plus.png'; ?>" style="border:0;outline:none;padding:0px;margin:0px;position:relative;top:-5px;"></a>
|
||||
</div>
|
||||
<?php echo form_open("$controller_name/search",array('id'=>'search_form')); ?>
|
||||
<div id="search_filter_section" style="display: <?php echo isset($search_section_state)? ( ($search_section_state)? 'block' : 'none') : 'none';?>;background-color:#EEEEEE;">
|
||||
<?php echo form_label($this->lang->line('sales_invoice_filter').' '.':', 'invoices_filter');?>
|
||||
|
||||
<?php echo form_dropdown('payment_type', $payment_types, $payment_type, 'id="payment_type"');?>
|
||||
<input type="hidden" name="search_section_state" id="search_section_state" value="<?php echo isset($search_section_state)? ( ($search_section_state)? 'block' : 'none') : 'none';?>" />
|
||||
</div>
|
||||
<div id="table_action_header">
|
||||
<ul>
|
||||
<li class="float_left"><span><?php echo anchor($controller_name . "/delete",$this->lang->line("common_delete"),array('id'=>'delete')); ?></span></li>
|
||||
<!-- li class="float_left"><span><?php echo anchor($controller_name . "/update_invoice_numbers", $this->lang->line('sales_invoice_update'),array('id'=>'update_invoice_numbers')); ?></span></li-->
|
||||
<li class="float_right">
|
||||
<img src='<?php echo base_url()?>images/spinner_small.gif' alt='spinner' id='spinner' />
|
||||
<input type="text" name ='search' id='search'/>
|
||||
<input type="hidden" name ='limit_from' id='limit_from'/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php echo form_close(); ?>
|
||||
|
||||
<div id="table_holder">
|
||||
<?php echo $manage_table; ?>
|
||||
</div>
|
||||
<div id="feedback_bar"></div>
|
||||
<?php $this->load->view("partial/footer"); ?>
|
||||
@@ -134,7 +134,7 @@ if (isset($error_message))
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="3" style='text-align:right;'> <?php echo $this->lang->line($amount_change >= 0 ? ($only_sale_check ? 'sales_check_due' : 'sales_change_due') : 'sales_invoice_amount_due') ; ?> </td>
|
||||
<td style='text-align:right'><?php echo $amount_change; ?></td>
|
||||
<td style='text-align:right'><?php echo to_currency($amount_change); ?></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
@@ -25,6 +25,9 @@ if (isset($success))
|
||||
<span><?php echo $this->lang->line('sales_stock_location') ?></span>
|
||||
<?php echo form_dropdown('stock_location',$stock_locations,$stock_location,'onchange="$(\'#mode_form\').submit();"'); ?>
|
||||
<?php endif; ?>
|
||||
<div id="sales_overview" class="small_button"><a href="<?=site_url($controller_name . '/manage')?>">
|
||||
<span><?php echo $this->lang->line('sales_overview'); ?><span></a>
|
||||
</div>
|
||||
<div id="show_suspended_sales_button">
|
||||
<?php echo anchor("sales/suspended/width:425",
|
||||
"<div class='small_button'><span style='font-size:73%;'>".$this->lang->line('sales_suspended_sales')."</span></div>",
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#page-wrap table { border-collapse: collapse; }
|
||||
#page-wrap table td, #page-wrap table th { border: 1px solid black; padding: 5px; }
|
||||
|
||||
#header { height: 30px; width: 100%; margin: 20px 0; background: #222; text-align: center; color: white; font: bold 26px Helvetica, Sans-Serif; text-decoration: uppercase; letter-spacing: 4px; padding: 8px 0px; }
|
||||
#header { height: 30px; width: 100%; margin: 20px 0; background: #222; text-align: center; color: white; font: bold 26px Helvetica, Sans-Serif; text-transform: uppercase; letter-spacing: 4px; padding: 8px 0px; }
|
||||
|
||||
/* first row */
|
||||
#logo { text-align: right; margin-top: 15px; float: left; position: relative; border: 1px solid #fff; max-width: 150px; max-height: 150px; overflow: hidden; }
|
||||
|
||||
@@ -156,3 +156,9 @@
|
||||
margin: 0 4px 8px 0;
|
||||
}
|
||||
|
||||
#sales_overview
|
||||
{
|
||||
position:absolute;
|
||||
top:3px;
|
||||
right:99px;
|
||||
}
|
||||
@@ -31,4 +31,8 @@ ALTER TABLE `ospos_items`
|
||||
|
||||
ALTER TABLE `ospos_people`
|
||||
ADD COLUMN `gender` int(1) DEFAULT NULL;
|
||||
|
||||
|
||||
-- drop redundant payment_type column in sales, add index to sale_time to speed up sorting
|
||||
ALTER TABLE `ospos_sales`
|
||||
DROP COLUMN `payment_type`,
|
||||
ADD INDEX `sale_time` (`sale_time`);
|
||||
|
||||
@@ -478,10 +478,10 @@ CREATE TABLE `ospos_sales` (
|
||||
`comment` text NOT NULL,
|
||||
`invoice_number` varchar(32) DEFAULT NULL,
|
||||
`sale_id` int(10) NOT NULL AUTO_INCREMENT,
|
||||
`payment_type` varchar(512) DEFAULT NULL,
|
||||
PRIMARY KEY (`sale_id`),
|
||||
KEY `customer_id` (`customer_id`),
|
||||
KEY `employee_id` (`employee_id`),
|
||||
KEY `sale_time` (`sale_time`),
|
||||
UNIQUE KEY `invoice_number` (`invoice_number`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
||||
|
||||
@@ -572,7 +572,6 @@ CREATE TABLE `ospos_sales_suspended` (
|
||||
`comment` text NOT NULL,
|
||||
`invoice_number` varchar(32) DEFAULT NULL,
|
||||
`sale_id` int(10) NOT NULL AUTO_INCREMENT,
|
||||
`payment_type` varchar(512) DEFAULT NULL,
|
||||
PRIMARY KEY (`sale_id`),
|
||||
KEY `customer_id` (`customer_id`),
|
||||
KEY `employee_id` (`employee_id`),
|
||||
|
||||
@@ -12,8 +12,13 @@ function checkbox_click(event)
|
||||
}
|
||||
}
|
||||
|
||||
function enable_search(suggest_url,confirm_search_message)
|
||||
function enable_search(suggest_url,confirm_search_message,format_item)
|
||||
{
|
||||
if (!format_item) {
|
||||
format_item = function(results) {
|
||||
return results[0];
|
||||
};
|
||||
}
|
||||
//Keep track of enable_email has been called
|
||||
if(!enable_search.enabled)
|
||||
enable_search.enabled=true;
|
||||
@@ -23,16 +28,19 @@ function enable_search(suggest_url,confirm_search_message)
|
||||
$(this).attr('value','');
|
||||
});
|
||||
|
||||
$("#search").autocomplete(suggest_url,{max:100,delay:10, selectFirst: false});
|
||||
$("#search").autocomplete(suggest_url,{max:100,delay:10, selectFirst: false, formatItem : format_item});
|
||||
$("#search").result(function(event, data, formatted)
|
||||
{
|
||||
do_search(true);
|
||||
});
|
||||
|
||||
attach_search_listener();
|
||||
|
||||
$('#search_form').submit(function(event)
|
||||
{
|
||||
event.preventDefault();
|
||||
|
||||
// reset page number when selecting a specific page number
|
||||
$('#limit_from').val(0);
|
||||
if(get_selected_values().length >0)
|
||||
{
|
||||
if(!confirm(confirm_search_message))
|
||||
@@ -43,6 +51,21 @@ function enable_search(suggest_url,confirm_search_message)
|
||||
}
|
||||
enable_search.enabled=false;
|
||||
|
||||
function attach_search_listener()
|
||||
{
|
||||
// prevent redirecting to link when search enabled
|
||||
$("#pagination a").click(function(event) {
|
||||
if ($("#search").val()) {
|
||||
event.preventDefault();
|
||||
// set limit_from to value included in the link
|
||||
var uri_segments = event.currentTarget.href.split('/');
|
||||
var limit_from = uri_segments.pop();
|
||||
$('#limit_from').val(limit_from);
|
||||
do_search(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function do_search(show_feedback,on_complete)
|
||||
{
|
||||
//If search is not enabled, don't do anything
|
||||
@@ -50,21 +73,28 @@ function do_search(show_feedback,on_complete)
|
||||
return;
|
||||
|
||||
if(show_feedback)
|
||||
$('#spinner').show();
|
||||
$('#search').addClass("ac_loading");
|
||||
|
||||
$('#sortable_table tbody').load($('#search_form').attr('action'),{'search':$('#search').val()},function()
|
||||
{
|
||||
if(typeof on_complete=='function')
|
||||
on_complete();
|
||||
|
||||
$('#spinner').hide();
|
||||
//re-init elements in new table, as table tbody children were replaced
|
||||
tb_init('#sortable_table a.thickbox');
|
||||
update_sortable_table();
|
||||
enable_row_selection();
|
||||
$('#sortable_table tbody :checkbox').click(checkbox_click);
|
||||
$("#select_all").attr('checked',false);
|
||||
});
|
||||
$.post(
|
||||
$('#search_form').attr('action'),
|
||||
// serialize all the input fields in the form
|
||||
$('#search_form').serialize(),
|
||||
function(response) {
|
||||
$('#sortable_table tbody').html(response.rows);
|
||||
if(typeof on_complete=='function')
|
||||
on_complete();
|
||||
$('#search').removeClass("ac_loading");
|
||||
//$('#spinner').hide();
|
||||
//re-init elements in new table, as table tbody children were replaced
|
||||
tb_init('#sortable_table a.thickbox');
|
||||
$('#pagination').html(response.pagination);
|
||||
$('#sortable_table tbody :checkbox').click(checkbox_click);
|
||||
$("#select_all").attr('checked',false);
|
||||
update_sortable_table();
|
||||
enable_row_selection();
|
||||
attach_search_listener();
|
||||
}, "json"
|
||||
);
|
||||
}
|
||||
|
||||
function enable_email(email_url)
|
||||
@@ -108,7 +138,7 @@ function enable_delete(confirm_message,none_selected_message)
|
||||
if(!enable_delete.enabled)
|
||||
enable_delete.enabled=true;
|
||||
|
||||
$('#delete').click(function(event)
|
||||
$("#delete").click(function(event)
|
||||
{
|
||||
event.preventDefault();
|
||||
if($("#sortable_table tbody :checkbox:checked").length >0)
|
||||
@@ -150,10 +180,9 @@ function do_delete(url)
|
||||
|
||||
});
|
||||
});
|
||||
// update rows that were affected by this delete
|
||||
for(index in response.ids) {
|
||||
update_row(response.ids[index],url.replace(/[^\/]+$/,'get_row'));
|
||||
}
|
||||
// for(index in response.ids) {
|
||||
// update_row(response.ids[index],url.replace(/[^\/]+$/,'get_row'));
|
||||
// }
|
||||
|
||||
set_feedback(response.message,'success_message',false);
|
||||
}
|
||||
@@ -277,7 +306,7 @@ function get_table_row(id) {
|
||||
id = id || $("input[name='sale_id']").val();
|
||||
var $element = $("#sortable_table tbody :checkbox[value='" + id + "']");
|
||||
if ($element.length === 0) {
|
||||
$element = $("#sortable_table a.thickbox[href*='" + id + "']");
|
||||
$element = $("#sortable_table tbody a[href*='" + id + "']");
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
@@ -310,7 +339,7 @@ function reinit_row(checkbox_id)
|
||||
function animate_row(row,color)
|
||||
{
|
||||
color = color || "#e1ffdd";
|
||||
row.find("td").animate({backgroundColor:color},"slow","linear")
|
||||
row.find("td").css("backgroundColor", "#ffffff").animate({backgroundColor:color},"slow","linear")
|
||||
.animate({backgroundColor:color},5000)
|
||||
.animate({backgroundColor:"#ffffff"},"slow","linear");
|
||||
}
|
||||
|
||||
@@ -43,3 +43,4 @@ common_gender,Geslacht,Gender,Gender,Gender,Gender,Gender,Gender,Gender,Gender
|
||||
common_gender_male,M,M,M,M,M,M,M,M,M
|
||||
common_gender_female,V,F,F,F,V,V,V,V,V
|
||||
common_date,Datum,Date,Date,Date,Date,Date,Date,Date,Date
|
||||
common_search_options,Zoek criteria,Search options,Search options,Search options,Search options,Search options,Search options,Search options,Search options
|
||||
|
||||
|
@@ -91,10 +91,19 @@ sales_unsuspend_and_delete,,Retomar y Borrar,,,取消暫停銷售並刪除,Ра
|
||||
sales_giftcard_balance,Waardebon Resterend,Giftcard Balance,Giftcard Balance,Giftcard Balance,Giftcard Balance,Giftcard Balance,Giftcard Balance,Giftcard Balance,Giftcard Balance
|
||||
sales_discount_included,% korting inbegrepen,% discount included,% discount included,% discount included,% discount included,% discount included,% discount included,% discount included,% discount included
|
||||
sales_print_after_sale,Print Ticket,Imprimir recibo después de una venta,Print after sale,Imprimer un recu après vente,出貨時打印收據,Распечатать квитанцию после продажи,พิมพ์บิลหลังการขาย,Satıştan sonra yazdır,Cetak Faktur setelah penjualan
|
||||
sales_invoice,Factuur,Invoice,Invoice,Invoice,Invoice,Invoice,Invoice,Invoice,Invoice
|
||||
sales_invoice,Factuur,tarjeta de Crédito,Invoice,Invoice,Invoice,Invoice,Invoice,Invoice,Invoice
|
||||
sales_total_tax_exclusive,Totaal,Tax excluded,Tax excluded,Tax excluded,Tax excluded,Tax excluded,Tax excluded,Tax excluded,Tax excluded
|
||||
sales_send_invoice,Vestuur Factuur,Send Invoice,Send Invoice,Send Invoice,Send Invoice,Send Invoice,Send Invoice,Send Invoice,Send Invoice
|
||||
sales_invoice_confirm,Deze factuur zal verstuurd worden naar,This invoice will be sent to,This invoice will be sent to,This invoice will be sent to,This invoice will be sent to,This invoice will be sent to,This invoice will be sent to,This invoice will be sent to,This invoice will be sent to
|
||||
sales_invoice_no_email,Er werd geen email adres gevonden voor deze klant,This customer does not have a valid email address,This customer does not have a valid email address,This customer does not have a valid email address,This customer does not have a valid email address,This customer does not have a valid email address,This customer does not have a valid email address,This customer does not have a valid email address,This customer does not have a valid email address
|
||||
sales_invoice_sent,Factuur verstuurd naar,Invoice sent to,Invoice sent to,Invoice sent to,Invoice sent to,Invoice sent to,Invoice sent to,Invoice sent to,Invoice sent to
|
||||
sales_invoice_unsent,Fout bij het versturen van factuur naar,Invoice failed to be sent to,Invoice failed to be sent to,Invoice failed to be sent to,Invoice failed to be sent to,Invoice failed to be sent to,Invoice failed to be sent to,Invoice failed to be sent to,Invoice failed to be sent to
|
||||
sales_invoice_filter,Facturen,Invoices,Invoices,Invoices,Invoices,Invoices,Invoices,Invoices,Invoices
|
||||
sales_no_filter,Alle,All,All,All,All,All,All,All,All
|
||||
sales_no_sales_to_display,Er werden geen aankopen gevonden,No sales to display,No sales to display,No sales to display,No sales to display,No sales to display,No sales to display,No sales to display,No sales to display
|
||||
sales_show_invoice,factuur,invoice,invoice,invoice,invoice,invoice,invoice,invoice,invoice
|
||||
sales_show_receipt,ticket,receipt,receipt,receipt,receipt,receipt,receipt,receipt,receipt
|
||||
sales_invoice_filter,Filter tickets op ,Filter sales for ,Filter sales for ,Filter sales for ,Filter sales for ,Filter sales for ,Filter sales for ,Filter sales for ,Filter sales for
|
||||
sales_overview,Overzicht,Overview,Overview,Overview,Overview,Overview,Overview,Overview,Overview
|
||||
sales_update,Bewerk Ticket,Edit Sale,Edit Sale,Edit Sale,Edit Sale,Edit Sale,Edit Sale,Edit Sale,Edit Sale
|
||||
sales_confirm_delete,Bent u zeker dat u de geselecteerde aankopen wil verwijderen?,Are you sure you want to delete the selected sales?,Are you sure you want to delete the selected sales?,Are you sure you want to delete the selected sales?,Are you sure you want to delete the selected sales?,Are you sure you want to delete the selected sales?,Are you sure you want to delete the selected sales?,Are you sure you want to delete the selected sales?,Are you sure you want to delete the selected sales?
|
||||
|
||||
|
Reference in New Issue
Block a user