diff --git a/.htaccess b/.htaccess index 71b270bd0..0f8d093b5 100755 --- a/.htaccess +++ b/.htaccess @@ -33,7 +33,7 @@ IndexIgnore * # prevent access to generate_languages.php - order allow,deny + order deny,allow deny from all allow from 127.0.0.1 diff --git a/application/config/autoload.php b/application/config/autoload.php index 605631609..ccee7912d 100644 --- a/application/config/autoload.php +++ b/application/config/autoload.php @@ -83,7 +83,7 @@ $autoload['drivers'] = array(); | | $autoload['helper'] = array('url', 'file'); */ -$autoload['helper'] = array('form', 'url', 'table', 'text', 'currency', 'html', 'download', 'directory', 'dateformat_helper'); +$autoload['helper'] = array('form', 'url', 'table', 'text', 'currency', 'html', 'download', 'directory', 'dateformat', 'quantity'); /* | ------------------------------------------------------------------- diff --git a/application/controllers/Config.php b/application/controllers/Config.php index 9dcd1f4de..799755f11 100644 --- a/application/controllers/Config.php +++ b/application/controllers/Config.php @@ -76,7 +76,8 @@ class Config extends Secure_area 'dateformat'=>$this->input->post('dateformat'), 'timeformat'=>$this->input->post('timeformat'), 'thousands_separator'=>$this->input->post('thousands_separator'), - 'decimal_point'=>$this->input->post('decimal_point') + 'decimal_point'=>$this->input->post('decimal_point'), + 'quantity_decimals'=>$this->input->post('quantity_decimals') ); $result = $this->Appconfig->batch_save( $batch_save_data ); diff --git a/application/controllers/Items.php b/application/controllers/Items.php index bfec13607..b8c547ad0 100644 --- a/application/controllers/Items.php +++ b/application/controllers/Items.php @@ -193,7 +193,7 @@ class Items extends Secure_area implements iData_controller foreach($locations_data as $location) { $quantity = $this->Item_quantity->get_item_quantity($item_id,$location['location_id'])->quantity; - $quantity = ($item_id == -1) ? null: $quantity; + $quantity = ($item_id == -1) ? 0 : $quantity; $location_array[$location['location_id']] = array('location_name'=>$location['location_name'], 'quantity'=>$quantity); $data['stock_locations'] = $location_array; } diff --git a/application/controllers/Reports.php b/application/controllers/Reports.php index c2e46dc3f..5600721ab 100644 --- a/application/controllers/Reports.php +++ b/application/controllers/Reports.php @@ -103,7 +103,7 @@ class Reports extends Secure_area foreach($report_data as $row) { - $tabular_data[] = array($row['sale_date'], $row['quantity_purchased'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']), to_currency($row['cost']), to_currency($row['profit'])); + $tabular_data[] = array($row['sale_date'], to_quantity($row['quantity_purchased']), to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']), to_currency($row['cost']), to_currency($row['profit'])); } $data = array( @@ -128,7 +128,7 @@ class Reports extends Secure_area foreach($report_data as $row) { - $tabular_data[] = array($row['category'], $row['quantity_purchased'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']), to_currency($row['cost']), to_currency($row['profit'])); + $tabular_data[] = array($row['category'], to_quantity($row['quantity_purchased']), to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']), to_currency($row['cost']), to_currency($row['profit'])); } $data = array( @@ -153,7 +153,7 @@ class Reports extends Secure_area foreach($report_data as $row) { - $tabular_data[] = array($row['customer'], $row['quantity_purchased'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']), to_currency($row['cost']), to_currency($row['profit'])); + $tabular_data[] = array($row['customer'], to_quantity($row['quantity_purchased']), to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']), to_currency($row['cost']), to_currency($row['profit'])); } $data = array( @@ -178,7 +178,7 @@ class Reports extends Secure_area foreach($report_data as $row) { - $tabular_data[] = array($row['supplier'], $row['quantity_purchased'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']), to_currency($row['cost']), to_currency($row['profit'])); + $tabular_data[] = array($row['supplier'], to_quantity($row['quantity_purchased']), to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']), to_currency($row['cost']), to_currency($row['profit'])); } $data = array( @@ -203,7 +203,7 @@ class Reports extends Secure_area foreach($report_data as $row) { - $tabular_data[] = array(character_limiter($row['name'], 40), $row['quantity_purchased'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']), to_currency($row['cost']), to_currency($row['profit'])); + $tabular_data[] = array(character_limiter($row['name'], 40), to_quantity($row['quantity_purchased']), to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']), to_currency($row['cost']), to_currency($row['profit'])); } $data = array( @@ -228,7 +228,7 @@ class Reports extends Secure_area foreach($report_data as $row) { - $tabular_data[] = array($row['employee'], $row['quantity_purchased'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']), to_currency($row['cost']), to_currency($row['profit'])); + $tabular_data[] = array($row['employee'], to_quantity($row['quantity_purchased']), to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']), to_currency($row['cost']), to_currency($row['profit'])); } $data = array( @@ -718,11 +718,11 @@ class Reports extends Secure_area foreach($report_data['summary'] as $key=>$row) { - $summary_data[] = array(anchor('sales/receipt/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target' => '_blank')), $row['sale_date'], $row['items_purchased'], $row['employee_name'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']), to_currency($row['cost']), to_currency($row['profit']), $row['payment_type'], $row['comment']); + $summary_data[] = array(anchor('sales/receipt/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target' => '_blank')), $row['sale_date'], to_quantity($row['items_purchased']), $row['employee_name'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']), to_currency($row['cost']), to_currency($row['profit']), $row['payment_type'], $row['comment']); foreach($report_data['details'][$key] as $drow) { - $details_data[$key][] = array($drow['name'], $drow['category'], $drow['serialnumber'], $drow['description'], $drow['quantity_purchased'], to_currency($drow['subtotal']), to_currency($drow['total']), to_currency($drow['tax']), to_currency($drow['cost']), to_currency($drow['profit']), $drow['discount_percent'].'%'); + $details_data[$key][] = array($drow['name'], $drow['category'], $drow['serialnumber'], $drow['description'], to_quantity($drow['quantity_purchased']), to_currency($drow['subtotal']), to_currency($drow['total']), to_currency($drow['tax']), to_currency($drow['cost']), to_currency($drow['profit']), $drow['discount_percent'].'%'); } } @@ -768,11 +768,11 @@ class Reports extends Secure_area foreach($report_data['summary'] as $key=>$row) { - $summary_data[] = array(anchor('sales/receipt/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target' => '_blank')), $row['sale_date'], $row['items_purchased'], $row['customer_name'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']), to_currency($row['cost']), to_currency($row['profit']), $row['payment_type'], $row['comment']); + $summary_data[] = array(anchor('sales/receipt/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target' => '_blank')), $row['sale_date'], to_quantity($row['items_purchased']), $row['customer_name'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']), to_currency($row['cost']), to_currency($row['profit']), $row['payment_type'], $row['comment']); foreach($report_data['details'][$key] as $drow) { - $details_data[$key][] = array($drow['name'], $drow['category'], $drow['serialnumber'], $drow['description'], $drow['quantity_purchased'], to_currency($drow['subtotal']), to_currency($drow['total']), to_currency($drow['tax']), to_currency($drow['cost']), to_currency($drow['profit']), $drow['discount_percent'].'%'); + $details_data[$key][] = array($drow['name'], $drow['category'], $drow['serialnumber'], $drow['description'], to_quantity($drow['quantity_purchased']), to_currency($drow['subtotal']), to_currency($drow['total']), to_currency($drow['tax']), to_currency($drow['cost']), to_currency($drow['profit']), $drow['discount_percent'].'%'); } } @@ -818,11 +818,11 @@ class Reports extends Secure_area foreach($report_data['summary'] as $key=>$row) { - $summary_data[] = array(anchor('sales/receipt/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target' => '_blank')), $row['sale_date'], $row['items_purchased'], $row['customer_name'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),/*to_currency($row['profit']),*/ $row['payment_type'], $row['comment']); + $summary_data[] = array(anchor('sales/receipt/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target' => '_blank')), $row['sale_date'], to_quantity($row['items_purchased']), $row['customer_name'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),/*to_currency($row['profit']),*/ $row['payment_type'], $row['comment']); foreach($report_data['details'][$key] as $drow) { - $details_data[$key][] = array($drow['name'], $drow['category'], $drow['serialnumber'], $drow['description'], $drow['quantity_purchased'], to_currency($drow['subtotal']), to_currency($drow['total']), to_currency($drow['tax']),/*to_currency($drow['profit']),*/ $drow['discount_percent'].'%'); + $details_data[$key][] = array($drow['name'], $drow['category'], $drow['serialnumber'], $drow['description'], to_quantity($drow['quantity_purchased']), to_currency($drow['subtotal']), to_currency($drow['total']), to_currency($drow['tax']),/*to_currency($drow['profit']),*/ $drow['discount_percent'].'%'); } } @@ -856,11 +856,11 @@ class Reports extends Secure_area foreach($report_data['summary'] as $key=>$row) { - $summary_data[] = array(anchor('sales/edit/'.$row['sale_id'], 'POS '.$row['sale_id'], array('class' => 'modal-dlg modal-btn-submit')), $row['sale_date'], $row['items_purchased'], $row['employee_name'], $row['customer_name'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']), to_currency($row['cost']), to_currency($row['profit']), $row['payment_type'], $row['comment']); + $summary_data[] = array(anchor('sales/edit/'.$row['sale_id'], 'POS '.$row['sale_id'], array('class' => 'modal-dlg modal-btn-submit')), $row['sale_date'], to_quantity($row['items_purchased']), $row['employee_name'], $row['customer_name'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']), to_currency($row['cost']), to_currency($row['profit']), $row['payment_type'], $row['comment']); foreach($report_data['details'][$key] as $drow) { - $quantity_purchased = $drow['quantity_purchased']; + $quantity_purchased = to_quantity($drow['quantity_purchased']); if ($show_locations) { $quantity_purchased .= ' [' . $this->Stock_location->get_location_name($drow['item_location']) . ']'; @@ -899,11 +899,11 @@ class Reports extends Secure_area foreach($report_data['summary'] as $key=>$row) { - $summary_data[] = array(anchor('receivings/edit/'.$row['receiving_id'], 'RECV '.$row['receiving_id'], array('class' => 'modal-dlg modal-btn-delete modal-btn-submit')), $row['receiving_date'], $row['items_purchased'], $row['employee_name'], $row['supplier_name'], to_currency($row['total']), $row['payment_type'], $row['invoice_number'], $row['comment']); + $summary_data[] = array(anchor('receivings/edit/'.$row['receiving_id'], 'RECV '.$row['receiving_id'], array('class' => 'modal-dlg modal-btn-delete modal-btn-submit')), $row['receiving_date'], to_quantity($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']; + $quantity_purchased = $drow['receiving_quantity'] > 1 ? to_quantity($drow['quantity_purchased']) . ' x ' . to_quantity($drow['receiving_quantity']) : to_quantity($drow['quantity_purchased']); if ($show_locations) { $quantity_purchased .= ' [' . $this->Stock_location->get_location_name($drow['item_location']) . ']'; diff --git a/application/helpers/currency_helper.php b/application/helpers/currency_helper.php index 6ecdeae12..09f535e43 100644 --- a/application/helpers/currency_helper.php +++ b/application/helpers/currency_helper.php @@ -1,29 +1,40 @@ config->item('currency_symbol') ? $CI->config->item('currency_symbol') : '$'; $currency_symbol = $currency_symbol == '$' && $escape ? '\$' : $currency_symbol; $thousands_separator = $CI->config->item('thousands_separator') ? $CI->config->item('thousands_separator') : ''; $decimal_point = $CI->config->item('decimal_point') ? $CI->config->item('decimal_point') : '.'; + $decimals = $CI->config->item('currency_decimals') ? $CI->config->item('currency_decimals') : 2; + if($number >= 0) { if($CI->config->item('currency_side') !== 'currency_side') - return $currency_symbol.number_format($number, 2, $decimal_point, $thousands_separator); + return $currency_symbol.number_format($number, $decimals, $decimal_point, $thousands_separator); else - return number_format($number, 2, $decimal_point, $thousands_separator).$currency_symbol; + return number_format($number, $decimals, $decimal_point, $thousands_separator).$currency_symbol; } else { if($CI->config->item('currency_side') !== 'currency_side') - return '-'.$currency_symbol.number_format(abs($number), 2, $decimal_point, $thousands_separator); + return '-'.$currency_symbol.number_format(abs($number), $decimals, $decimal_point, $thousands_separator); else - return '-'.number_format(abs($number), 2, $decimal_point, $thousands_separator).$currency_symbol; + return '-'.number_format(abs($number), $decimals, $decimal_point, $thousands_separator).$currency_symbol; } } function to_currency_no_money($number) { - return number_format($number, 2, '.', ''); + $CI =& get_instance(); + + $thousands_separator = $CI->config->item('thousands_separator') ? $CI->config->item('thousands_separator') : ''; + $decimal_point = $CI->config->item('decimal_point') ? $CI->config->item('decimal_point') : '.'; + $decimals = $CI->config->item('currency_decimals') ? $CI->config->item('currency_decimals') : 2; + + return number_format($number, $decimals, $decimal_point, $thousands_separator); } + ?> diff --git a/application/helpers/quantity_helper.php b/application/helpers/quantity_helper.php new file mode 100644 index 000000000..cc289d393 --- /dev/null +++ b/application/helpers/quantity_helper.php @@ -0,0 +1,13 @@ +config->item('quantity_decimals') ? $CI->config->item('quantity_decimals') : 0; + $decimal_point = $CI->config->item('decimal_point') ? $CI->config->item('decimal_point') : '.'; + + return number_format($number, $decimals, $decimal_point, ''); +} + +?> diff --git a/application/helpers/report_helper.php b/application/helpers/report_helper.php index 716ef7e9b..1136d553e 100644 --- a/application/helpers/report_helper.php +++ b/application/helpers/report_helper.php @@ -1,4 +1,5 @@ \ No newline at end of file diff --git a/application/helpers/table_helper.php b/application/helpers/table_helper.php index ae3b1ec22..c60278005 100644 --- a/application/helpers/table_helper.php +++ b/application/helpers/table_helper.php @@ -341,7 +341,7 @@ function get_item_data_row($item,$controller) $table_data_row.=''.$item->company_name.''; $table_data_row.=''.to_currency($item->cost_price).''; $table_data_row.=''.to_currency($item->unit_price).''; - $table_data_row.=''.$item->quantity.''; + $table_data_row.=''.to_quantity($item->quantity).''; $table_data_row.=''.$tax_percents.''; $image = ''; if (!empty($item->pic_id)) diff --git a/application/language/de-CH/config_lang.php b/application/language/de-CH/config_lang.php index 138b3a6a8..a39f1c707 100644 --- a/application/language/de-CH/config_lang.php +++ b/application/language/de-CH/config_lang.php @@ -100,6 +100,7 @@ $lang["config_print_silently"] = "Zeige Druckdialog"; $lang["config_print_top_margin"] = "Rand oben"; $lang["config_print_top_margin_number"] = "Rand oben muss eine Zahl sein"; $lang["config_print_top_margin_required"] = "Rand oben ist erforderlich"; +$lang["config_quantity_decimals"] = "Quantity Decimals"; $lang["config_receipt_configuration"] = "Druckereinstellungen"; $lang["config_receipt_info"] = "Quittungsinformation"; $lang["config_receipt_printer"] = "Quittungsdrucker"; diff --git a/application/language/en/config_lang.php b/application/language/en/config_lang.php index ce02074a4..c4391a51a 100644 --- a/application/language/en/config_lang.php +++ b/application/language/en/config_lang.php @@ -100,6 +100,7 @@ $lang["config_print_silently"] = "Show Print Dialog"; $lang["config_print_top_margin"] = "Margin Top"; $lang["config_print_top_margin_number"] = "The default top margin must be a number"; $lang["config_print_top_margin_required"] = "The default top margin is a required field"; +$lang["config_quantity_decimals"] = "Quantity Decimals"; $lang["config_receipt_configuration"] = "Print Settings"; $lang["config_receipt_info"] = "Receipt Configuration Information"; $lang["config_receipt_printer"] = "Ticket Printer"; diff --git a/application/language/es/config_lang.php b/application/language/es/config_lang.php index e58bc4b56..d188bc951 100644 --- a/application/language/es/config_lang.php +++ b/application/language/es/config_lang.php @@ -100,6 +100,7 @@ $lang["config_print_silently"] = "Mostrar cuadro de Dialogo de impresión"; $lang["config_print_top_margin"] = "Margen Superior"; $lang["config_print_top_margin_number"] = "Margen Superior debe ser un número"; $lang["config_print_top_margin_required"] = "Margen Superior es requerido"; +$lang["config_quantity_decimals"] = "Quantity Decimals"; $lang["config_receipt_configuration"] = "Parámetros de Impresión"; $lang["config_receipt_info"] = "Información de Configuración de Recibo"; $lang["config_receipt_printer"] = "Impresora de Ticket"; diff --git a/application/language/fr/config_lang.php b/application/language/fr/config_lang.php index 8cd245017..67fd7cff3 100644 --- a/application/language/fr/config_lang.php +++ b/application/language/fr/config_lang.php @@ -100,6 +100,7 @@ $lang["config_print_silently"] = "Show Print Dialog"; $lang["config_print_top_margin"] = "Margin Top"; $lang["config_print_top_margin_number"] = "The default top margin must be a number"; $lang["config_print_top_margin_required"] = "The default top margin is a required field"; +$lang["config_quantity_decimals"] = "Quantity Decimals"; $lang["config_receipt_configuration"] = "Print Settings"; $lang["config_receipt_info"] = "Receipt Configuration Information"; $lang["config_receipt_printer"] = "Ticket Printer"; diff --git a/application/language/id/config_lang.php b/application/language/id/config_lang.php index 4726db538..a405993bd 100644 --- a/application/language/id/config_lang.php +++ b/application/language/id/config_lang.php @@ -100,6 +100,7 @@ $lang["config_print_silently"] = "Show Print Dialog"; $lang["config_print_top_margin"] = "Margin Top"; $lang["config_print_top_margin_number"] = "The default top margin must be a number"; $lang["config_print_top_margin_required"] = "The default top margin is a required field"; +$lang["config_quantity_decimals"] = "Quantity Decimals"; $lang["config_receipt_configuration"] = "Print Settings"; $lang["config_receipt_info"] = "Receipt Configuration Information"; $lang["config_receipt_printer"] = "Ticket Printer"; diff --git a/application/language/nl-BE/config_lang.php b/application/language/nl-BE/config_lang.php index a37f70795..548701fb7 100755 --- a/application/language/nl-BE/config_lang.php +++ b/application/language/nl-BE/config_lang.php @@ -100,6 +100,7 @@ $lang["config_print_silently"] = "Toon Printvenster"; $lang["config_print_top_margin"] = "Marge Boven"; $lang["config_print_top_margin_number"] = "The default top margin must be a number"; $lang["config_print_top_margin_required"] = "The default top margin is a required field"; +$lang["config_quantity_decimals"] = "Quantity Decimals"; $lang["config_receipt_configuration"] = "Print Instellingen"; $lang["config_receipt_info"] = "Ticket Instellingen"; $lang["config_receipt_printer"] = "Ticket Printer"; diff --git a/application/language/ru/config_lang.php b/application/language/ru/config_lang.php index b9894be15..c3d8e88d4 100644 --- a/application/language/ru/config_lang.php +++ b/application/language/ru/config_lang.php @@ -100,6 +100,7 @@ $lang["config_print_silently"] = "Show Print Dialog"; $lang["config_print_top_margin"] = "Margin Top"; $lang["config_print_top_margin_number"] = "The default top margin must be a number"; $lang["config_print_top_margin_required"] = "The default top margin is a required field"; +$lang["config_quantity_decimals"] = "Quantity Decimals"; $lang["config_receipt_configuration"] = "Print Settings"; $lang["config_receipt_info"] = "Receipt Configuration Information"; $lang["config_receipt_printer"] = "Ticket Printer"; diff --git a/application/language/th/config_lang.php b/application/language/th/config_lang.php index 65e2f09b3..79558e78e 100644 --- a/application/language/th/config_lang.php +++ b/application/language/th/config_lang.php @@ -100,6 +100,7 @@ $lang["config_print_silently"] = "Show Print Dialog"; $lang["config_print_top_margin"] = "Margin Top"; $lang["config_print_top_margin_number"] = "The default top margin must be a number"; $lang["config_print_top_margin_required"] = "The default top margin is a required field"; +$lang["config_quantity_decimals"] = "Quantity Decimals"; $lang["config_receipt_configuration"] = "Print Settings"; $lang["config_receipt_info"] = "Receipt Configuration Information"; $lang["config_receipt_printer"] = "Ticket Printer"; diff --git a/application/language/tr/config_lang.php b/application/language/tr/config_lang.php index 0ea0e41d6..ba8e8d28c 100644 --- a/application/language/tr/config_lang.php +++ b/application/language/tr/config_lang.php @@ -100,6 +100,7 @@ $lang["config_print_silently"] = "Show Print Dialog"; $lang["config_print_top_margin"] = "Margin Top"; $lang["config_print_top_margin_number"] = "The default top margin must be a number"; $lang["config_print_top_margin_required"] = "The default top margin is a required field"; +$lang["config_quantity_decimals"] = "Quantity Decimals"; $lang["config_receipt_configuration"] = "Print Settings"; $lang["config_receipt_info"] = "Receipt Configuration Information"; $lang["config_receipt_printer"] = "Ticket Printer"; diff --git a/application/language/zh/config_lang.php b/application/language/zh/config_lang.php index 9222fad31..d1005636b 100755 --- a/application/language/zh/config_lang.php +++ b/application/language/zh/config_lang.php @@ -100,6 +100,7 @@ $lang["config_print_silently"] = "Show Print Dialog"; $lang["config_print_top_margin"] = "Margin Top"; $lang["config_print_top_margin_number"] = "The default top margin must be a number"; $lang["config_print_top_margin_required"] = "The default top margin is a required field"; +$lang["config_quantity_decimals"] = "Quantity Decimals"; $lang["config_receipt_configuration"] = "Print Settings"; $lang["config_receipt_info"] = "Receipt Configuration Information"; $lang["config_receipt_printer"] = "Ticket Printer"; diff --git a/application/models/Receiving.php b/application/models/Receiving.php index 2de3f5230..a05e530ad 100644 --- a/application/models/Receiving.php +++ b/application/models/Receiving.php @@ -51,17 +51,17 @@ class Receiving extends CI_Model return $success; } - function save ($items,$supplier_id,$employee_id,$comment,$invoice_number,$payment_type,$receiving_id=false) + function save($items, $supplier_id, $employee_id, $comment, $invoice_number, $payment_type, $receiving_id=false) { if(count($items)==0) return -1; $receivings_data = array( - 'supplier_id'=> $this->Supplier->exists($supplier_id) ? $supplier_id : null, - 'employee_id'=>$employee_id, - 'payment_type'=>$payment_type, - 'comment'=>$comment, - 'invoice_number'=>$invoice_number + 'supplier_id'=>$this->Supplier->exists($supplier_id) ? $supplier_id : null, + 'employee_id'=>$employee_id, + 'payment_type'=>$payment_type, + 'comment'=>$comment, + 'invoice_number'=>$invoice_number ); //Run these queries as a transaction, we want to make sure we do all or nothing @@ -70,11 +70,9 @@ class Receiving extends CI_Model $this->db->insert('receivings',$receivings_data); $receiving_id = $this->db->insert_id(); - foreach($items as $line=>$item) { $cur_item_info = $this->Item->get_info($item['item_id']); - $receivings_items_data = array( 'receiving_id'=>$receiving_id, @@ -90,7 +88,7 @@ class Receiving extends CI_Model 'item_location'=>$item['item_location'] ); - $this->db->insert('receivings_items',$receivings_items_data); + $this->db->insert('receivings_items', $receivings_items_data); $items_received = $item['receiving_quantity'] != 0 ? $item['quantity'] * $item['receiving_quantity'] : $item['quantity']; diff --git a/application/views/configs/locale_config.php b/application/views/configs/locale_config.php index 38fa49a81..12ae66713 100644 --- a/application/views/configs/locale_config.php +++ b/application/views/configs/locale_config.php @@ -6,14 +6,14 @@
lang->line('config_currency_symbol'), 'currency_symbol', array('class'=>'control-label col-xs-2')); ?> -
+
'currency_symbol', 'id'=>'currency_symbol', 'class'=>'form-control input-sm', 'value'=>$this->config->item('currency_symbol')));?>
-
+
diff --git a/application/views/items/inventory.php b/application/views/items/inventory.php index e492a45fa..773c73e01 100644 --- a/application/views/items/inventory.php +++ b/application/views/items/inventory.php @@ -64,7 +64,7 @@ 'id'=>'quantity', 'class'=>'form-control input-sm', 'disabled'=>'', - 'value'=>current($item_quantities)) + 'value'=>to_quantity(current($item_quantities))) ); ?>
@@ -135,7 +135,7 @@ $(document).ready(function() function fill_quantity(val) { - var item_quantities= ; + var item_quantities = ; document.getElementById("quantity").value = item_quantities[val]; } \ No newline at end of file diff --git a/application/views/receivings/receipt.php b/application/views/receivings/receipt.php index 4cc503626..44e2da0c3 100644 --- a/application/views/receivings/receipt.php +++ b/application/views/receivings/receipt.php @@ -73,8 +73,8 @@ if (isset($error_message)) -    x +    x
diff --git a/application/views/receivings/receiving.php b/application/views/receivings/receiving.php index ca5586d8e..06130fdc2 100644 --- a/application/views/receivings/receiving.php +++ b/application/views/receivings/receiving.php @@ -141,12 +141,12 @@ if (isset($error)) } ?> - 'quantity', 'class'=>'form-control input-sm', 'value'=>$item['quantity'])); ?> + 'quantity', 'class'=>'form-control input-sm', 'value'=>to_quantity($item['quantity']))); ?> 1) { ?> - + - + diff --git a/application/views/sales/invoice_email.php b/application/views/sales/invoice_email.php index a751bcd9c..8c7faec72 100644 --- a/application/views/sales/invoice_email.php +++ b/application/views/sales/invoice_email.php @@ -86,7 +86,7 @@ if (isset($error_message)) - + diff --git a/application/views/sales/receipt.php b/application/views/sales/receipt.php index 16df130c3..5c288ec85 100644 --- a/application/views/sales/receipt.php +++ b/application/views/sales/receipt.php @@ -76,7 +76,7 @@ if (isset($error_message)) - +
Appconfig->get('show_total_discount') ? 'total' : 'discounted_total')]); ?>
diff --git a/application/views/sales/receipt_email.php b/application/views/sales/receipt_email.php index b320fa544..dd695050a 100644 --- a/application/views/sales/receipt_email.php +++ b/application/views/sales/receipt_email.php @@ -36,7 +36,7 @@ - + diff --git a/application/views/sales/register.php b/application/views/sales/register.php index 0a8cdf3b1..7bdecdd1d 100644 --- a/application/views/sales/register.php +++ b/application/views/sales/register.php @@ -152,12 +152,12 @@ if (isset($success)) 'quantity', 'class'=>'form-control input-sm', 'value'=>$item['quantity'], 'tabindex'=>$tabindex)); + echo form_input(array('name'=>'quantity', 'class'=>'form-control input-sm', 'value'=>to_quantity($item['quantity']), 'tabindex'=>$tabindex)); } ?> diff --git a/translations/config_lang.csv b/translations/config_lang.csv index d45fe9155..e410995c5 100644 --- a/translations/config_lang.csv +++ b/translations/config_lang.csv @@ -99,6 +99,7 @@ config_print_silently,Zeige Druckdialog,Toon Printvenster,Mostrar cuadro de Dial config_print_top_margin,Rand oben,Marge Boven,Margen Superior,Margin Top,Margin Top,Margin Top,Margin Top,Margin Top,Margin Top,Margin Top config_print_top_margin_number,Rand oben muss eine Zahl sein,The default top margin must be a number,Margen Superior debe ser un número,The default top margin must be a number,The default top margin must be a number,The default top margin must be a number,The default top margin must be a number,The default top margin must be a number,The default top margin must be a number,The default top margin must be a number config_print_top_margin_required,Rand oben ist erforderlich,The default top margin is a required field,Margen Superior es requerido,The default top margin is a required field,The default top margin is a required field,The default top margin is a required field,The default top margin is a required field,The default top margin is a required field,The default top margin is a required field,The default top margin is a required field +config_quantity_decimals,Quantity Decimals,Quantity Decimals,Quantity Decimals,Quantity Decimals,Quantity Decimals,Quantity Decimals,Quantity Decimals,Quantity Decimals,Quantity Decimals,Quantity Decimals config_receipt_configuration,Druckereinstellungen,Print Instellingen,Parámetros de Impresión,Print Settings,Print Settings,Print Settings,Print Settings,Print Settings,Print Settings,Print Settings config_receipt_info,Quittungsinformation,Ticket Instellingen,Información de Configuración de Recibo,Receipt Configuration Information,Receipt Configuration Information,Receipt Configuration Information,Receipt Configuration Information,Receipt Configuration Information,Receipt Configuration Information,Receipt Configuration Information config_receipt_printer,Quittungsdrucker,Ticket Printer,Impresora de Ticket,Ticket Printer,Ticket Printer,Ticket Printer,Ticket Printer,Ticket Printer,Ticket Printer,Ticket Printer