Provide a way to enter a line total and have the quantity sold automatically calculated (#1647)

This commit is contained in:
FrancescoUK
2018-01-01 12:01:43 +00:00
34 changed files with 166 additions and 104 deletions

View File

@@ -299,6 +299,7 @@ class Config extends Secure_Controller
'suggestions_second_column' => $this->input->post('suggestions_second_column'),
'suggestions_third_column' => $this->input->post('suggestions_third_column'),
'giftcard_number' => $this->input->post('giftcard_number'),
'derive_sale_quantity' => $this->input->post('derive_sale_quantity') != NULL,
'statistics' => $this->input->post('statistics') != NULL,
'custom1_name' => $this->input->post('custom1_name'),
'custom2_name' => $this->input->post('custom2_name'),

View File

@@ -464,10 +464,11 @@ class Sales extends Secure_Controller
$quantity = parse_decimals($this->input->post('quantity'));
$discount = parse_decimals($this->input->post('discount'));
$item_location = $this->input->post('location');
$total = $this->input->post('total') != '' ? $this->input->post('total') : NULL;
if($this->form_validation->run() != FALSE)
{
$this->sale_lib->edit_item($item_id, $description, $serialnumber, $quantity, $discount, $price);
$this->sale_lib->edit_item($item_id, $description, $serialnumber, $quantity, $discount, $price, $total);
}
else
{

View File

@@ -3,7 +3,6 @@
$lang["items_add_minus"] = "الكمية المطلوب خصمها أو اضافتها";
$lang["items_allow_alt_desciption"] = "وصف بديل";
$lang["items_allow_alt_description"] = "السماح بوصف بديل";
$lang["items_amazon"] = "Amazon";
$lang["items_bulk_edit"] = "تحرير جماعى";
$lang["items_buy_price_required"] = "سعر الشراء مطلوب";
$lang["items_cannot_be_deleted"] = "لايمكن حذف الأصناف المختارة، واحد أو أكثر منها لديه مبيعات";

View File

@@ -3,7 +3,6 @@
$lang["items_add_minus"] = "inventor toplama və çixma üçün";
$lang["items_allow_alt_desciption"] = "";
$lang["items_allow_alt_description"] = "lternativ təsvirə icazə";
$lang["items_amazon"] = "Amazon";
$lang["items_bulk_edit"] = "kütləvi dəyişiklik";
$lang["items_buy_price_required"] = "alış qiyməti və mütləq məsafə";
$lang["items_cannot_be_deleted"] = "işarələnmiş mallardan silmək olmur cunki bəziləri satılır.";

View File

@@ -3,7 +3,6 @@
$lang["items_add_minus"] = "Inventory to add or subtract.";
$lang["items_allow_alt_desciption"] = "";
$lang["items_allow_alt_description"] = "Allow Alternate Description";
$lang["items_amazon"] = "Amazon";
$lang["items_bulk_edit"] = "Bulk Edit";
$lang["items_buy_price_required"] = "Purchase Price is a required field.";
$lang["items_cannot_be_deleted"] = "Could not delete selected Item(s), one or more of the selected Items have sales.";

View File

@@ -3,7 +3,6 @@
$lang["items_add_minus"] = "Bestandsänderung";
$lang["items_allow_alt_desciption"] = "Erlaube Alt. Bez.";
$lang["items_allow_alt_description"] = "Erlaube Alt. Bez.";
$lang["items_amazon"] = "Amazon";
$lang["items_bulk_edit"] = "Sammeländerung";
$lang["items_buy_price_required"] = "Einkaufspreis ist erforderlich";
$lang["items_cannot_be_deleted"] = "Gewählte Artikel können nicht gelöscht werden, einer odere mehrere weisen Verkäufe auf";

View File

@@ -3,7 +3,6 @@
$lang["items_add_minus"] = "Bestandsänderung";
$lang["items_allow_alt_desciption"] = "Erlaube Alt. Bez.";
$lang["items_allow_alt_description"] = "Erlaube Alt. Bez.";
$lang["items_amazon"] = "Amazon";
$lang["items_bulk_edit"] = "Sammeländerung";
$lang["items_buy_price_required"] = "Einkaufspreis ist erforderlich";
$lang["items_cannot_be_deleted"] = "Gewählte Artikel können nicht gelöscht werden, einer odere mehrere weisen Verkäufe auf";

View File

@@ -65,29 +65,31 @@ $lang["config_customer_sales_tax_support"] = "Customer Sales Tax Support";
$lang["config_date_or_time_format"] = "Date and Time Filter";
$lang["config_datetimeformat"] = "Date and Time Format";
$lang["config_decimal_point"] = "Decimal Point";
$lang["config_default_barcode_font_size_number"] = "The default barcode font size must be a number";
$lang["config_default_barcode_font_size_required"] = "The default barcode font size is a required field";
$lang["config_default_barcode_height_number"] = "The default barcode height must be a number";
$lang["config_default_barcode_height_required"] = "The default barcode height is a required field";
$lang["config_default_barcode_num_in_row_number"] = "The default barcode number in row must be a number";
$lang["config_default_barcode_num_in_row_required"] = "The default barcode num in row is a required field";
$lang["config_default_barcode_page_cellspacing_number"] = "The default barcode page cellspacing must be a number";
$lang["config_default_barcode_page_cellspacing_required"] = "The default barcode page cellspacing is a required field";
$lang["config_default_barcode_page_width_number"] = "The default barcode page width must be a number";
$lang["config_default_barcode_page_width_required"] = "The default barcode page width is a required field";
$lang["config_default_barcode_width_number"] = "The default barcode width must be a number";
$lang["config_default_barcode_width_required"] = "The default barcode width is a required field";
$lang["config_default_barcode_font_size_number"] = "Default Barcode Font size must be a number";
$lang["config_default_barcode_font_size_required"] = "Default Barcode Font size is a required field";
$lang["config_default_barcode_height_number"] = "Default Barcode Height must be a number";
$lang["config_default_barcode_height_required"] = "Default Barcode Height is a required field";
$lang["config_default_barcode_num_in_row_number"] = "Default Barcode Number in row must be a number";
$lang["config_default_barcode_num_in_row_required"] = "Default Barcode Number in row is a required field";
$lang["config_default_barcode_page_cellspacing_number"] = "Default Barcode Page Cellspacing must be a number";
$lang["config_default_barcode_page_cellspacing_required"] = "Default Barcode Page Cellspacing is a required field";
$lang["config_default_barcode_page_width_number"] = "Default Barcode Page Width must be a number";
$lang["config_default_barcode_page_width_required"] = "Default Barcode Page Width is a required field";
$lang["config_default_barcode_width_number"] = "Default Barcode Width must be a number";
$lang["config_default_barcode_width_required"] = "Default Barcode Width is a required field";
$lang["config_default_origin_tax_code"] = "Default Origin Tax Code";
$lang["config_default_sales_discount"] = "Default Sales Discount %";
$lang["config_default_sales_discount_number"] = "The default sales discount must be a number";
$lang["config_default_sales_discount_required"] = "The default sales discount is a required field";
$lang["config_default_tax_name_number"] = "The default tax name must be a string";
$lang["config_default_tax_name_required"] = "The default tax name is a required field";
$lang["config_default_sales_discount_number"] = "Default Sales Discount must be a number";
$lang["config_default_sales_discount_required"] = "Default Sales Discount is a required field";
$lang["config_default_tax_name_number"] = "Default Tax Name must be a string";
$lang["config_default_tax_name_required"] = "Default Tax Name is a required field";
$lang["config_default_tax_rate"] = "Default Tax Rate %";
$lang["config_default_tax_rate_1"] = "Tax 1 Rate";
$lang["config_default_tax_rate_2"] = "Tax 2 Rate";
$lang["config_default_tax_rate_number"] = "The default tax rate must be a number";
$lang["config_default_tax_rate_required"] = "The default tax rate is a required field";
$lang["config_default_tax_rate_number"] = "Default Tax Rate must be a number";
$lang["config_default_tax_rate_required"] = "Default Tax Rate is a required field";
$lang["config_derive_sale_quantity"] = "Allow Derived Sale Quantity";
$lang["config_derive_sale_quantity_tooltip"] = "If checked then a new item type will provided for items ordered by extended amount"
$lang["config_dinner_table"] = "Table";
$lang["config_dinner_table_duplicate"] = "Please use an unique table name";
$lang["config_dinner_table_enable"] = "Enable Dinner Tables";
@@ -148,7 +150,7 @@ $lang["config_license_configuration"] = "License Statement";
$lang["config_line_sequence"] = "Line Sequence";
$lang["config_lines_per_page"] = "Lines Per Page";
$lang["config_lines_per_page_number"] = "";
$lang["config_lines_per_page_required"] = "The lines per page is a required field";
$lang["config_lines_per_page_required"] = "Lines Per Page is a required field";
$lang["config_locale"] = "Localisation";
$lang["config_locale_configuration"] = "Localisation Configuration";
$lang["config_locale_info"] = "Localisation Configuration Information";
@@ -184,27 +186,27 @@ $lang["config_payment_options_order"] = "Payment Options Order";
$lang["config_phone"] = "Company Phone";
$lang["config_phone_required"] = "Company phone is a required field";
$lang["config_print_bottom_margin"] = "Margin Bottom";
$lang["config_print_bottom_margin_number"] = "The default bottom margin must be a number";
$lang["config_print_bottom_margin_required"] = "The default bottom margin is a required field";
$lang["config_print_bottom_margin_number"] = "Default Bottom Margin must be a number";
$lang["config_print_bottom_margin_required"] = "Default Bottom Margin is a required field";
$lang["config_print_footer"] = "Print Browser Footer";
$lang["config_print_header"] = "Print Browser Header";
$lang["config_print_left_margin"] = "Margin Left";
$lang["config_print_left_margin_number"] = "The default left margin must be a number";
$lang["config_print_left_margin_required"] = "The default left margin is a required field";
$lang["config_print_left_margin_number"] = "Default Left Margin must be a number";
$lang["config_print_left_margin_required"] = "Default Left Margin is a required field";
$lang["config_print_right_margin"] = "Margin Right";
$lang["config_print_right_margin_number"] = "The default right margin must be a number";
$lang["config_print_right_margin_required"] = "The default right margin is a required field";
$lang["config_print_right_margin_number"] = "Default Right Margin must be a number";
$lang["config_print_right_margin_required"] = "Default Right Margin is a required field";
$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_print_top_margin_number"] = "Default Top Margin must be a number";
$lang["config_print_top_margin_required"] = "Default Top Margin is a required field";
$lang["config_quantity_decimals"] = "Quantity Decimals";
$lang["config_receipt"] = "Receipt";
$lang["config_receipt_configuration"] = "Receipt Print Settings";
$lang["config_receipt_default"] = "Default";
$lang["config_receipt_font_size"] = "Font Size";
$lang["config_receipt_font_size_number"] = "The font size must be a number";
$lang["config_receipt_font_size_required"] = "The font size is a required field";
$lang["config_receipt_font_size_number"] = "Font Size must be a number";
$lang["config_receipt_font_size_required"] = "Font Size is a required field";
$lang["config_receipt_info"] = "Receipt Configuration Information";
$lang["config_receipt_printer"] = "Ticket Printer";
$lang["config_receipt_short"] = "Short";
@@ -230,7 +232,7 @@ $lang["config_statistics"] = "Send Statistics";
$lang["config_statistics_tooltip"] = "Send statistics for development and feature improvement purposes";
$lang["config_stock_location"] = "Stock location";
$lang["config_stock_location_duplicate"] = "Please use an unique location name";
$lang["config_stock_location_invalid_chars"] = "The stock location name cannot contain '_'";
$lang["config_stock_location_invalid_chars"] = "Stock location name cannot contain '_'";
$lang["config_stock_location_required"] = "Stock location is a required field";
$lang["config_suggestions_first_column"] = "Column 1";
$lang["config_suggestions_layout"] = "Search Suggestions Layout";

View File

@@ -3,7 +3,7 @@
$lang["items_add_minus"] = "Inventory to add or subtract";
$lang["items_allow_alt_desciption"] = "";
$lang["items_allow_alt_description"] = "Allow Alternate Description";
$lang["items_amazon"] = "Amazon";
$lang["items_amount_entry"] = "Amount Entry";
$lang["items_bulk_edit"] = "Bulk Edit";
$lang["items_buy_price_required"] = "Purchase Price is a required field";
$lang["items_cannot_be_deleted"] = "Could not delete the selected Item(s), one or more of the selected Items have sales";

View File

@@ -88,6 +88,8 @@ $lang["config_default_tax_rate_1"] = "Tax 1 Rate";
$lang["config_default_tax_rate_2"] = "Tax 2 Rate";
$lang["config_default_tax_rate_number"] = "Default Tax Rate must be a number.";
$lang["config_default_tax_rate_required"] = "Default Tax Rate is a required field.";
$lang["config_derive_sale_quantity"] = "Allow Derived Sale Quantity";
$lang["config_derive_sale_quantity_tooltip"] = "If checked then a new item type will provided for items ordered by extended amount";
$lang["config_dinner_table"] = "Table";
$lang["config_dinner_table_duplicate"] = "Table must be unique.";
$lang["config_dinner_table_enable"] = "Enable Dinner Tables";

View File

@@ -3,7 +3,7 @@
$lang["items_add_minus"] = "Inventory to add or subtract.";
$lang["items_allow_alt_desciption"] = "";
$lang["items_allow_alt_description"] = "Allow Alternate Description";
$lang["items_amazon"] = "Amazon";
$lang["items_amount_entry"] = "Amount Entry";
$lang["items_bulk_edit"] = "Bulk Edit";
$lang["items_buy_price_required"] = "Purchase Price is a required field.";
$lang["items_cannot_be_deleted"] = "Could not delete selected Item(s), one or more of the selected Items have sales.";

View File

@@ -3,7 +3,6 @@
$lang["items_add_minus"] = "Inventario a agregar/substraer";
$lang["items_allow_alt_desciption"] = "Permitir Descripción Alternativa";
$lang["items_allow_alt_description"] = "Permitir Descripción Alternativa";
$lang["items_amazon"] = "Amazon";
$lang["items_bulk_edit"] = "Edición Múltiple";
$lang["items_buy_price_required"] = "Precio de Compra es requerido";
$lang["items_cannot_be_deleted"] = "No se pueden borrar los artículos seleccionados. Uno o más tiene(n) ventas.";

View File

@@ -3,7 +3,6 @@
$lang["items_add_minus"] = "Ajoujer/Soustraire à l'Inventaire";
$lang["items_allow_alt_desciption"] = "";
$lang["items_allow_alt_description"] = "Autoriser Description Alt";
$lang["items_amazon"] = "Amazon";
$lang["items_bulk_edit"] = "Édition en groupe";
$lang["items_buy_price_required"] = "Le Prix d'achat est requis";
$lang["items_cannot_be_deleted"] = "Impossible de supprimer. Un ou plusiers des articles sélectionnés a des ventes.";

View File

@@ -3,7 +3,6 @@
$lang["items_add_minus"] = "Dodavanje/skidanje s inventure";
$lang["items_allow_alt_desciption"] = "Dozvoli Alt opis";
$lang["items_allow_alt_description"] = "Dozvoli Alt opis";
$lang["items_amazon"] = "Amazon";
$lang["items_bulk_edit"] = "Zajedno uređenje";
$lang["items_buy_price_required"] = "Prodajna cijena je potrebna";
$lang["items_cannot_be_deleted"] = "Nemožete obrisati odabranu stavku, jedna ili više odabranih stavki ima prodaju.";

View File

@@ -3,7 +3,6 @@
$lang["items_add_minus"] = "Mennyiség hozzáadása/elvétele";
$lang["items_allow_alt_desciption"] = "Alternativ leirás eng.";
$lang["items_allow_alt_description"] = "Alternativ leirás eng.";
$lang["items_amazon"] = "Amazon";
$lang["items_bulk_edit"] = "Tömeges módosítás";
$lang["items_buy_price_required"] = "Vételár kötelező mező";
$lang["items_cannot_be_deleted"] = "Nem törölhető a kiválasztott termék, mert van folyamatban lévő eladás!";

View File

@@ -3,7 +3,6 @@
$lang["items_add_minus"] = "Penyesuaian Inventori TAMBAH / KURANG (-)";
$lang["items_allow_alt_desciption"] = "";
$lang["items_allow_alt_description"] = "Deskripsi Alternatif dimungkinkan";
$lang["items_amazon"] = "Amazon";
$lang["items_bulk_edit"] = "Ubah Massal";
$lang["items_buy_price_required"] = "Harga Beli wajib diisi";
$lang["items_cannot_be_deleted"] = "Tidak dapat menghapus item terpilih, satu atau lebih item yang dipilih memiliki penjualan.";

View File

@@ -3,7 +3,6 @@
$lang["items_add_minus"] = "ເພີ່ມຫລືຫລຸດປະລິມານສິນຄ້າໃນສາງ";
$lang["items_allow_alt_desciption"] = "";
$lang["items_allow_alt_description"] = "ອະນຸຍາດໃຫ້ມີລາຍລະອຽດເສີມ";
$lang["items_amazon"] = "ອາເມຊອນ";
$lang["items_bulk_edit"] = "ແກ້ໄຂເປັນກຸ່ມ";
$lang["items_buy_price_required"] = "ກະລຸນາກຳນົດລາຄາ.";
$lang["items_cannot_be_deleted"] = "ບໍ່ສາມາດລຶບສິນຄ້າທີ່ເລືອກໄດ້, ໃນສິນຄ້າທີ່ເລືອກໄດ້ມີການຂາຍແລ້ວ.";

View File

@@ -3,7 +3,6 @@
$lang["items_add_minus"] = "Corrigatie hoeveelheid";
$lang["items_allow_alt_desciption"] = "";
$lang["items_allow_alt_description"] = "Aanpasbare omschrijving";
$lang["items_amazon"] = "Amazon";
$lang["items_bulk_edit"] = "Bewerk Selectie";
$lang["items_buy_price_required"] = "Buy price is a required field";
$lang["items_cannot_be_deleted"] = "De geselecteerde producten konden niet worden verwijderd.";

View File

@@ -3,7 +3,6 @@
$lang["items_add_minus"] = "Inventário para adicionar/subtrair";
$lang["items_allow_alt_desciption"] = "Descrição longa";
$lang["items_allow_alt_description"] = "Permitir atualizar descrição";
$lang["items_amazon"] = "Amazon";
$lang["items_bulk_edit"] = "Editar Múltiplos Itens";
$lang["items_buy_price_required"] = "Preço de compra é um campo obrigatório";
$lang["items_cannot_be_deleted"] = "Não foi possível excluir os itens selecionados um ou mais dos itens selecionados tem vendas.";

View File

@@ -3,7 +3,6 @@
$lang["items_add_minus"] = "Инвентарь для сложения/вычитания";
$lang["items_allow_alt_desciption"] = "";
$lang["items_allow_alt_description"] = "Разрешить альтернативные описания";
$lang["items_amazon"] = "Amazon";
$lang["items_bulk_edit"] = "Массовое изменение";
$lang["items_buy_price_required"] = "Цена покупки обязательное пробелья";
$lang["items_cannot_be_deleted"] = "Невозможно удалить выбранные товари, один или более из выбранных товаров имеет продаж.";

View File

@@ -3,7 +3,6 @@
$lang["items_add_minus"] = "";
$lang["items_allow_alt_desciption"] = "";
$lang["items_allow_alt_description"] = "";
$lang["items_amazon"] = "";
$lang["items_bulk_edit"] = "";
$lang["items_buy_price_required"] = "";
$lang["items_cannot_be_deleted"] = "";

View File

@@ -3,7 +3,6 @@
$lang["items_add_minus"] = "เพิ่ม/ลบ จำนวนสินค้าคงคลัง";
$lang["items_allow_alt_desciption"] = "อนุญาตให้เพิ่มรายละเอียด";
$lang["items_allow_alt_description"] = "แสดงข้อมูลเพิ่มเติม";
$lang["items_amazon"] = "อเมซอน";
$lang["items_bulk_edit"] = "แก้ไขความจุ";
$lang["items_buy_price_required"] = "ราคาซื้อขายต้องกรอก";
$lang["items_cannot_be_deleted"] = "ไม่สามารถลบสินค้าที่เลือก, สินค้าที่เลือกถูกขายไปแล้ว.";

View File

@@ -2,7 +2,6 @@
$lang["giftcards_add_minus"] = "Eklenen/Çıkarılan Adet";
$lang["giftcards_allow_alt_description"] = "Dip Nota izin ver";
$lang["giftcards_amazon"] = "Amazon";
$lang["giftcards_bulk_edit"] = "Çoklu Düzenleme";
$lang["giftcards_cannot_be_deleted"] = "Seçili Hediye Çekleri silinemedi, bir veya fazla Hediye Çekinde satış bulunmaktadır.";
$lang["giftcards_cannot_find_giftcard"] = "Hediye Çekine ait bilgi bulunamadı";

View File

@@ -3,7 +3,6 @@
$lang["items_add_minus"] = "Eklenen/Çıkarılan Adet";
$lang["items_allow_alt_desciption"] = "";
$lang["items_allow_alt_description"] = "Dip Nota izin ver";
$lang["items_amazon"] = "Amazon";
$lang["items_bulk_edit"] = "Toplu Düzenleme";
$lang["items_buy_price_required"] = "Alış Fiyatı zorunlu alandır";
$lang["items_cannot_be_deleted"] = "Seçili ürünler silinemedi, bazı ürünlerin satışı var.";

View File

@@ -3,7 +3,6 @@
$lang["items_add_minus"] = "增/減庫存";
$lang["items_allow_alt_desciption"] = "";
$lang["items_allow_alt_description"] = "允許ALT描述";
$lang["items_amazon"] = "Amazon";
$lang["items_bulk_edit"] = "批次編輯";
$lang["items_buy_price_required"] = "進貨價為必填欄位";
$lang["items_cannot_be_deleted"] = "無法刪除選定產品,所選產品中的一個或多個有銷售紀綠。";

View File

@@ -807,6 +807,7 @@ class Sale_lib
'discounted_total' => $discounted_total,
'print_option' => $print_option_selected,
'stock_type' => $stock_type,
'item_type' => $item_type,
'tax_category_id' => $item_info->tax_category_id
)
);
@@ -882,12 +883,16 @@ class Sale_lib
return -1;
}
public function edit_item($line, $description, $serialnumber, $quantity, $discount, $price)
public function edit_item($line, $description, $serialnumber, $quantity, $discount, $price, $total=NULL)
{
$items = $this->get_cart();
if(isset($items[$line]))
{
$line = &$items[$line];
if($total != NULL && $total != $line['total'])
{
$quantity = $this->get_quantity_sold($total, $price);
}
$line['description'] = $description;
$line['serialnumber'] = $serialnumber;
$line['quantity'] = $quantity;
@@ -1185,6 +1190,20 @@ class Sale_lib
return $total;
}
/**
* Derive the quantity sold based on the new total entered, returning the quanitity rounded to the
* appropriate decimal positions.
* @param $total
* @param $price
* @return string
*/
public function get_quantity_sold($total, $price)
{
$quantity = bcdiv($total, $price, quantity_decimals());
return $quantity;
}
public function get_extended_amount($quantity, $price, $discount_amount = 0)
{
$extended_amount = bcmul($quantity, $price);

View File

@@ -224,11 +224,13 @@ ALTER TABLE `ospos_giftcards` CHANGE `giftcard_number` `giftcard_number` VARCHAR
-- add support for select between gitcard number series or random
INSERT INTO `ospos_app_config` (`key`, `value`) VALUES ('giftcard_number', 'series');
INSERT INTO `ospos_app_config` (`key`, `value`) VALUES
('giftcard_number', 'series');
-- add option to print company name in receipt
INSERT INTO `ospos_app_config` (`key`, `value`) VALUES ('receipt_show_company_name', '1');
INSERT INTO `ospos_app_config` (`key`, `value`) VALUES
('receipt_show_company_name', '1');
-- add support for sales tax history migration

View File

@@ -206,3 +206,14 @@ ALTER TABLE `ospos_expenses`
ADD COLUMN `supplier_name` varchar(255) DEFAULT NULL,
ADD COLUMN `supplier_tax_code` varchar(255) DEFAULT NULL,
ADD COLUMN `tax_amount` decimal(15,2) DEFAULT NULL;
-- Remove unused barcode quality
DELETE FROM `ospos_app_config` WHERE `key` = 'barcode_quality';
-- Add new config option to allow derive sale quantity feature
INSERT INTO `ospos_app_config` (`key`, `value`) VALUES
('derive_sale_quantity', '0');

View File

@@ -5,6 +5,7 @@ define('HAS_NO_STOCK', 1);
define('ITEM', 0);
define('ITEM_KIT', 1);
define('ITEM_AMOUNT_ENTRY', 2);
define('PRINT_ALL', 0);
define('PRINT_PRICED', 1);
@@ -492,11 +493,12 @@ class Item extends CI_Model
public function get_search_suggestions($search, $filters = array('is_deleted' => FALSE, 'search_custom' => FALSE), $unique = FALSE, $limit = 25)
{
$suggestions = array();
$non_kit = array(ITEM, ITEM_AMOUNT_ENTRY);
$this->db->select($this->get_search_suggestion_format('item_id, name'));
$this->db->from('items');
$this->db->where('deleted', $filters['is_deleted']);
$this->db->where("item_type = " . ITEM); // standard, exclude kit items since kits will be picked up later
$this->db->where_in('item_type', $non_kit); // standard, exclude kit items since kits will be picked up later
$this->db->like('name', $search);
$this->db->order_by('name', 'asc');
foreach($this->db->get()->result() as $row)
@@ -507,7 +509,7 @@ class Item extends CI_Model
$this->db->select($this->get_search_suggestion_format('item_id, item_number'));
$this->db->from('items');
$this->db->where('deleted', $filters['is_deleted']);
$this->db->where("item_type = " . ITEM); // standard, exclude kit items since kits will be picked up later
$this->db->where_in('item_type', $non_kit); // standard, exclude kit items since kits will be picked up later
$this->db->like('item_number', $search);
$this->db->order_by('item_number', 'asc');
foreach($this->db->get()->result() as $row)
@@ -521,7 +523,7 @@ class Item extends CI_Model
$this->db->select('category');
$this->db->from('items');
$this->db->where('deleted', $filters['is_deleted']);
$this->db->where("item_type = " . ITEM); // standard, exclude kit items since kits will be picked up later
$this->db->where_in('item_type', $non_kit); // standard, exclude kit items since kits will be picked up later
$this->db->distinct();
$this->db->like('category', $search);
$this->db->order_by('category', 'asc');
@@ -536,7 +538,7 @@ class Item extends CI_Model
$this->db->like('company_name', $search);
// restrict to non deleted companies only if is_deleted is FALSE
$this->db->where('deleted', $filters['is_deleted']);
$this->db->where("item_type = " . ITEM); // standard, exclude kit items since kits will be picked up later
$this->db->where_in('item_type', $non_kit); // standard, exclude kit items since kits will be picked up later
$this->db->distinct();
$this->db->order_by('company_name', 'asc');
foreach($this->db->get()->result() as $row)
@@ -548,7 +550,7 @@ class Item extends CI_Model
$this->db->select($this->get_search_suggestion_format('item_id, name, description'));
$this->db->from('items');
$this->db->where('deleted', $filters['is_deleted']);
$this->db->where("item_type = " . ITEM); // standard, exclude kit items since kits will be picked up later
$this->db->where_in('item_type', $non_kit); // standard, exclude kit items since kits will be picked up later
$this->db->like('description', $search);
$this->db->order_by('description', 'asc');
foreach($this->db->get()->result() as $row)
@@ -577,7 +579,7 @@ class Item extends CI_Model
$this->db->or_like('custom10', $search);
$this->db->group_end();
$this->db->where('deleted', $filters['is_deleted']);
$this->db->where("item_type = " . ITEM); // standard, exclude kit items since kits will be picked up later
$this->db->where_in('item_type', $non_kit); // standard, exclude kit items since kits will be picked up later
foreach($this->db->get()->result() as $row)
{
$suggestions[] = array('value' => $row->item_id, 'label' => get_search_suggestion_label($row));
@@ -598,11 +600,12 @@ class Item extends CI_Model
public function get_stock_search_suggestions($search, $filters = array('is_deleted' => FALSE, 'search_custom' => FALSE), $unique = FALSE, $limit = 25)
{
$suggestions = array();
$non_kit = array(ITEM, ITEM_PRICE_BASED);
$this->db->select($this->get_search_suggestion_format('item_id, name'));
$this->db->from('items');
$this->db->where('deleted', $filters['is_deleted']);
$this->db->where("item_type = " . ITEM); // standard, exclude kit items since kits will be picked up later
$this->db->where_in('item_type', $non_kit); // standard, exclude kit items since kits will be picked up later
$this->db->where("stock_type = '0'"); // stocked items only
$this->db->like('name', $search);
$this->db->order_by('name', 'asc');
@@ -614,7 +617,7 @@ class Item extends CI_Model
$this->db->select($this->get_search_suggestion_format('item_id, item_number'));
$this->db->from('items');
$this->db->where('deleted', $filters['is_deleted']);
$this->db->where("item_type = " . ITEM); // standard, exclude kit items since kits will be picked up later
$this->db->where_in('item_type', $non_kit); // standard, exclude kit items since kits will be picked up later
$this->db->where("stock_type = '0'"); // stocked items only
$this->db->like('item_number', $search);
$this->db->order_by('item_number', 'asc');
@@ -629,7 +632,7 @@ class Item extends CI_Model
$this->db->select('category');
$this->db->from('items');
$this->db->where('deleted', $filters['is_deleted']);
$this->db->where("item_type = " . ITEM); // standard, exclude kit items since kits will be picked up later
$this->db->where_in('item_type', $non_kit); // standard, exclude kit items since kits will be picked up later
$this->db->where("stock_type = '0'"); // stocked items only
$this->db->distinct();
$this->db->like('category', $search);
@@ -656,7 +659,7 @@ class Item extends CI_Model
$this->db->select($this->get_search_suggestion_format('item_id, name, description'));
$this->db->from('items');
$this->db->where('deleted', $filters['is_deleted']);
$this->db->where("item_type = " . ITEM); // standard, exclude kit items since kits will be picked up later
$this->db->where_in('item_type', $non_kit); // standard, exclude kit items since kits will be picked up later
$this->db->where("stock_type = '0'"); // stocked items only
$this->db->like('description', $search);
$this->db->order_by('description', 'asc');
@@ -685,7 +688,7 @@ class Item extends CI_Model
$this->db->or_like('custom9', $search);
$this->db->or_like('custom10', $search);
$this->db->group_end();
$this->db->where("item_type = " . ITEM); // standard, exclude kit items since kits will be picked up later
$this->db->where_in('item_type', $non_kit); // standard, exclude kit items since kits will be picked up later
$this->db->where("stock_type = '0'"); // stocked items only
$this->db->where('deleted', $filters['is_deleted']);
foreach($this->db->get()->result() as $row)
@@ -707,11 +710,12 @@ class Item extends CI_Model
public function get_kit_search_suggestions($search, $filters = array('is_deleted' => FALSE, 'search_custom' => FALSE), $unique = FALSE, $limit = 25)
{
$suggestions = array();
$non_kit = array(ITEM, ITEM_PRICE_BASED);
$this->db->select('item_id, name');
$this->db->from('items');
$this->db->where('deleted', $filters['is_deleted']);
$this->db->where("item_type = " . ITEM_KIT); // standard, exclude kit items since kits will be picked up later
$this->db->where_in('item_type', $non_kit); // standard, exclude kit items since kits will be picked up later
$this->db->like('name', $search);
$this->db->order_by('name', 'asc');
foreach($this->db->get()->result() as $row)

View File

@@ -151,7 +151,7 @@
</div>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('config_giftcard_number'), 'giftcard_number', array('class' => 'control-label col-xs-2')); ?>
<div class='col-xs-8'>
@@ -172,6 +172,21 @@
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('config_derive_sale_quantity'), 'derive_sale_quantity', array('class' => 'control-label col-xs-2')); ?>
<div class='col-xs-1'>
<?php echo form_checkbox(array(
'name' => 'derive_sale_quantity',
'id' => 'derive_sale_quantity',
'value' => 'derive_sale_quantity',
'checked' => $this->config->item('derive_sale_quantity'))); ?>
&nbsp
<label class="control-label">
<span class="glyphicon glyphicon-info-sign" data-toggle="tooltip" data-placement="right" title="<?php echo $this->lang->line('config_derive_sale_quantity_tooltip'); ?>"></span>
</label>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('config_statistics'), 'statistics', array('class' => 'control-label col-xs-2')); ?>
<div class='col-xs-1'>

View File

@@ -92,11 +92,27 @@
'checked'=>$item_info->item_type == ITEM_KIT)
); ?> <?php echo $this->lang->line('items_kit'); ?>
</label>
<?php
if($this->config->item('derive_sale_quantity') == '1') {
?>
<label class="radio-inline">
<?php echo form_radio(array(
'name' => 'item_type',
'type' => 'radio',
'id' => 'item_type',
'value' => 2,
'checked' => $item_info->item_type == ITEM_AMOUNT_ENTRY)
); ?><?php echo $this->lang->line('items_amount_entry'); ?>
</label>
<?php
}
?>
</div>
</div>
<?php endif; ?>
<div class="form-group form-group-sm">
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('items_supplier'), 'supplier', array('class'=>'control-label col-xs-3')); ?>
<div class='col-xs-8'>
<?php echo form_dropdown('supplier_id', $suppliers, $selected_supplier, array('class'=>'form-control')); ?>
@@ -166,7 +182,7 @@
</div>
</div>
<div class="form-group form-group-sm">
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('items_tax_2'), 'tax_percent_2', array('class'=>'control-label col-xs-3')); ?>
<div class='col-xs-4'>
<?php echo form_input(array(
@@ -190,15 +206,15 @@
</div>
<?php if($customer_sales_tax_enabled) { ?>
<div class="form-group form-group-sm">
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('taxes_tax_category'), 'tax_category', array('class'=>'control-label col-xs-3')); ?>
<div class='col-xs-8'>
<div class='col-xs-8'>
<?php echo form_dropdown('tax_category_id', $tax_categories, $selected_tax_category, array('class'=>'form-control')); ?>
</div>
</div>
</div>
</div>
<?php } ?>
<?php
<?php
foreach($stock_locations as $key=>$location_detail)
{
?>

View File

@@ -175,10 +175,18 @@ if(isset($success))
</td>
<td><?php echo form_input(array('name'=>'discount', 'class'=>'form-control input-sm', 'value'=>to_decimals($item['discount'], 0), 'tabindex'=>++$tabindex));?></td>
<td><?php echo to_currency($item['price']*$item['quantity']-$item['price']*$item['quantity']*$item['discount']/100); ?></td>
<td>
<?php
if($item['item_type'] == 2) {
echo form_input(array('name'=>'total', 'class'=>'form-control input-sm', 'value'=>to_currency_no_money($item['total']), 'tabindex'=>++$tabindex));
} else {
echo to_currency($item['total']);
}
?>
</td>
<td><a href="javascript:document.getElementById('<?php echo 'cart_'.$line ?>').submit();" title=<?php echo $this->lang->line('sales_update')?> ><span class="glyphicon glyphicon-refresh"></span></a></td>
</tr>
<tr>
</tr>
<tr>
<?php
if($item['allow_alt_description']==1)
{
@@ -413,16 +421,16 @@ if(isset($success))
</tr>
</table>
<?php echo form_close(); ?>
<?php
<?php
// Only show this part if the payment cover the total and in sale or return mode
if($pos_mode == '1')
{
?>
<div class='btn btn-sm btn-success pull-right' id='finish_sale_button' tabindex='<?php echo ++$tabindex; ?>'><span class="glyphicon glyphicon-ok">&nbsp</span><?php echo $this->lang->line('sales_complete_sale'); ?></div>
<div class='btn btn-sm btn-success pull-right' id='finish_sale_button' tabindex='<?php echo ++$tabindex; ?>'><span class="glyphicon glyphicon-ok">&nbsp</span><?php echo $this->lang->line('sales_complete_sale'); ?></div>
<?php
}
?>
<?php
?>
<?php
}
else
{
@@ -539,20 +547,20 @@ if(isset($success))
<?php
}
?>
<?php
if($mode == "sale_work_order")
{
?>
<div class="col-xs-6">
<label for="price_work_orders" class="control-label checkbox">
<?php echo form_checkbox(array('name'=>'price_work_orders', 'id'=>'price_work_orders', 'value'=>1, 'checked'=>$price_work_orders)); ?>
<?php echo $this->lang->line('sales_include_prices');?>
</label>
</div>
<?php
}
?>
</div>
<?php
if($mode == "sale_work_order")
{
?>
<div class="col-xs-6">
<label for="price_work_orders" class="control-label checkbox">
<?php echo form_checkbox(array('name'=>'price_work_orders', 'id'=>'price_work_orders', 'value'=>1, 'checked'=>$price_work_orders)); ?>
<?php echo $this->lang->line('sales_include_prices');?>
</label>
</div>
<?php
}
?>
</div>
</div>
<?php
if(($mode == "sale") && $this->config->item('invoice_enable') == TRUE)
@@ -597,7 +605,7 @@ $(document).ready(function()
source: '<?php echo site_url($controller_name."/item_search"); ?>',
minChars: 0,
autoFocus: false,
delay: 500,
delay: 500,
select: function (a, ui) {
$(this).val(ui.item.value);
$("#add_item_form").submit();
@@ -696,10 +704,10 @@ $(document).ready(function()
$.post('<?php echo site_url($controller_name."/set_print_after_sale");?>', {sales_print_after_sale: $(this).is(":checked")});
});
$("#price_work_orders").change(function()
{
$.post('<?php echo site_url($controller_name."/set_price_work_orders");?>', {price_work_orders: $(this).is(":checked")});
});
$("#price_work_orders").change(function()
{
$.post('<?php echo site_url($controller_name."/set_price_work_orders");?>', {price_work_orders: $(this).is(":checked")});
});
$('#email_receipt').change(function()
{
@@ -792,7 +800,7 @@ $(document).ready(function()
}
}
$('[name="price"],[name="quantity"],[name="discount"],[name="description"],[name="serialnumber"]').change(function() {
$('[name="price"],[name="quantity"],[name="discount"],[name="description"],[name="serialnumber"],[name="total"]').change(function() {
$(this).parents("tr").prevAll("form:first").submit()
});

View File

@@ -39,7 +39,7 @@ INSERT INTO `ospos_app_config` (`key`, `value`) VALUES
('barcode_second_row', 'item_code'),
('barcode_third_row', 'unit_price'),
('barcode_num_in_row', '2'),
('barcode_page_width', '100'),
('barcode_page_width', '100'),
('barcode_page_cellspacing', '20'),
('barcode_generate_if_empty', '0'),
('receipt_show_company_name', '1'),
@@ -997,7 +997,7 @@ ALTER TABLE `ospos_item_quantities`
--
ALTER TABLE `ospos_suppliers`
ADD CONSTRAINT `ospos_suppliers_ibfk_1` FOREIGN KEY (`person_id`) REFERENCES `ospos_people` (`person_id`);
--
-- Constraints for table `ospos_giftcards`
--