mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-04-26 10:03:11 -04:00
@@ -418,7 +418,14 @@ class Sales extends Secure_Controller
|
||||
$kit_price_option = $item_kit_info->price_option;
|
||||
$kit_print_option = $item_kit_info->print_option; // 0-all, 1-priced, 2-kit-only
|
||||
|
||||
if($item_kit_info->kit_discount != 0 && $item_kit_info->kit_discount > $discount)
|
||||
if($discount_type == $item_kit_info->kit_discount_type)
|
||||
{
|
||||
if($item_kit_info->kit_discount > $discount)
|
||||
{
|
||||
$discount = $item_kit_info->kit_discount;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$discount = $item_kit_info->kit_discount;
|
||||
$discount_type = $item_kit_info->kit_discount_type;
|
||||
@@ -428,7 +435,7 @@ class Sales extends Secure_Controller
|
||||
|
||||
if(!empty($kit_item_id))
|
||||
{
|
||||
if(!$this->sale_lib->add_item($kit_item_id, $quantity, $item_location, $discount, $discount_type, PRICE_MODE_STANDARD, NULL, NULL, $price))
|
||||
if(!$this->sale_lib->add_item($kit_item_id, $quantity, $item_location, $discount, $discount_type, PRICE_MODE_KIT, $kit_price_option, $kit_print_option, $price))
|
||||
{
|
||||
$data['error'] = $this->lang->line('sales_unable_to_add_item');
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ $lang["sales_tax"] = "Tax";
|
||||
$lang["sales_tax_id"] = "Tax Id";
|
||||
$lang["sales_tax_invoice"] = "Tax Invoice";
|
||||
$lang["sales_tax_percent"] = "Tax %";
|
||||
$lang["sales_taxed_ind"] = "Sales tax ind";
|
||||
$lang["sales_taxed_ind"] = "T";
|
||||
$lang["sales_total"] = "Total";
|
||||
$lang["sales_total_tax_exclusive"] = "Tax excluded";
|
||||
$lang["sales_transaction_failed"] = "Sales Transaction failed.";
|
||||
|
||||
@@ -161,7 +161,7 @@ $lang["sales_tax"] = "Imp";
|
||||
$lang["sales_tax_id"] = "Identificador del Impuesto";
|
||||
$lang["sales_tax_invoice"] = "Impuesto de la Factura";
|
||||
$lang["sales_tax_percent"] = "% de Imp";
|
||||
$lang["sales_taxed_ind"] = "Ventas gravadas";
|
||||
$lang["sales_taxed_ind"] = "I";
|
||||
$lang["sales_total"] = "Total";
|
||||
$lang["sales_total_tax_exclusive"] = "Sin impuesto";
|
||||
$lang["sales_transaction_failed"] = "La transacción de venta falló.";
|
||||
|
||||
@@ -161,7 +161,7 @@ $lang["sales_tax"] = "Impuestos";
|
||||
$lang["sales_tax_id"] = "ID Impuesto";
|
||||
$lang["sales_tax_invoice"] = "Impuesto de la factura";
|
||||
$lang["sales_tax_percent"] = "Impuesto %";
|
||||
$lang["sales_taxed_ind"] = "Ventas con impuestos";
|
||||
$lang["sales_taxed_ind"] = "I";
|
||||
$lang["sales_total"] = "Total";
|
||||
$lang["sales_total_tax_exclusive"] = "Sin impuesto";
|
||||
$lang["sales_transaction_failed"] = "Ha fallado la venta.";
|
||||
|
||||
@@ -160,7 +160,7 @@ $lang["sales_tax"] = "Pajak";
|
||||
$lang["sales_tax_id"] = "ID Pajak";
|
||||
$lang["sales_tax_invoice"] = "Faktur Pajak";
|
||||
$lang["sales_tax_percent"] = "Pajak %";
|
||||
$lang["sales_taxed_ind"] = "Ind pajak penjualan";
|
||||
$lang["sales_taxed_ind"] = "P";
|
||||
$lang["sales_total"] = "Total";
|
||||
$lang["sales_total_tax_exclusive"] = "Tidak termasuk pajak";
|
||||
$lang["sales_transaction_failed"] = "Transaksi Penjualan gagal.";
|
||||
|
||||
@@ -161,7 +161,7 @@ $lang["sales_tax"] = "Tax";
|
||||
$lang["sales_tax_id"] = "Tax Id";
|
||||
$lang["sales_tax_invoice"] = "Tax Invoice";
|
||||
$lang["sales_tax_percent"] = "Tax %";
|
||||
$lang["sales_taxed_ind"] = "விற்பனை வரி குறியீடு";
|
||||
$lang["sales_taxed_ind"] = "வ";
|
||||
$lang["sales_total"] = "Total";
|
||||
$lang["sales_total_tax_exclusive"] = "Tax excluded";
|
||||
$lang["sales_transaction_failed"] = "Sales Transaction failed.";
|
||||
|
||||
@@ -130,7 +130,7 @@ $lang["sales_sale_by_invoice"] = "Продаж за рахунком";
|
||||
$lang["sales_sale_for_customer"] = "Клієнт:";
|
||||
$lang["sales_sale_time"] = "Час продажу";
|
||||
$lang["sales_sales_tax"] = "Податок з продажів";
|
||||
$lang["sales_taxed_ind"] = "Ідентифікатор оподаткування";
|
||||
$lang["sales_taxed_ind"] = "П";
|
||||
$lang["sales_select_customer"] = "Оберіть клієнта";
|
||||
$lang["sales_send_invoice"] = "Відправити рахунок-фактуру";
|
||||
$lang["sales_send_quote"] = "Надіслати котирвання продажів";
|
||||
|
||||
@@ -743,7 +743,7 @@ class Sale_lib
|
||||
$this->CI->session->unset_userdata('sales_rewards_remainder');
|
||||
}
|
||||
|
||||
public function add_item(&$item_id, $quantity = 1, $item_location, $discount = 0.0, $discount_type = 0, $price_mode = PRICE_MODE_STANDARD, $kit_price_option = NULL, $kit_print_option = NULL, $price_override = NULL, $description = NULL, $serialnumber = NULL, $sale_id = NULL, $include_deleted = FALSE, $print_option = NULL, $line = NULL)
|
||||
public function add_item(&$item_id, $quantity = 1, $item_location, &$discount = 0.0, $discount_type = 0, $price_mode = PRICE_MODE_STANDARD, $kit_price_option = NULL, $kit_print_option = NULL, $price_override = NULL, $description = NULL, $serialnumber = NULL, $sale_id = NULL, $include_deleted = FALSE, $print_option = NULL, $line = NULL)
|
||||
{
|
||||
$item_info = $this->CI->Item->get_info_by_id_or_number($item_id, $include_deleted);
|
||||
//make sure item exists
|
||||
@@ -753,40 +753,47 @@ class Sale_lib
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$cost_price = 0.00;
|
||||
$applied_discount = $discount;
|
||||
$item_id = $item_info->item_id;
|
||||
$item_type = $item_info->item_type;
|
||||
$stock_type = $item_info->stock_type;
|
||||
|
||||
if($price_mode == PRICE_MODE_STANDARD)
|
||||
{
|
||||
$price = $item_info->unit_price;
|
||||
$cost_price = $item_info->cost_price;
|
||||
}
|
||||
elseif($price_mode == PRICE_MODE_KIT)
|
||||
{
|
||||
if($kit_price_option == PRICE_OPTION_ALL)
|
||||
{
|
||||
$price = $item_info->unit_price;
|
||||
$cost_price = $item_info->cost_price;
|
||||
}
|
||||
elseif($kit_price_option == PRICE_OPTION_KIT && $item_type == ITEM_KIT)
|
||||
{
|
||||
$price = $item_info->unit_price;
|
||||
$cost_price = $item_info->cost_price;
|
||||
}
|
||||
elseif($kit_price_option == PRICE_OPTION_KIT_STOCK && $stock_type == HAS_STOCK)
|
||||
{
|
||||
$price = $item_info->unit_price;
|
||||
$cost_price = $item_info->cost_price;
|
||||
}
|
||||
}
|
||||
|
||||
$price = $item_info->unit_price;
|
||||
$cost_price = $item_info->cost_price;
|
||||
if($price_override != NULL)
|
||||
{
|
||||
$price = $price_override;
|
||||
}
|
||||
|
||||
if($price_mode == PRICE_MODE_KIT)
|
||||
{
|
||||
if(!($kit_price_option == PRICE_OPTION_ALL
|
||||
|| $kit_price_option == PRICE_OPTION_KIT && $item_type == ITEM_KIT
|
||||
|| $kit_price_option == PRICE_OPTION_KIT_STOCK && $stock_type == HAS_STOCK))
|
||||
{
|
||||
$price = 0.00;
|
||||
$applied_discount = 0.00;
|
||||
}
|
||||
// If price is zero do not include a discount regardless of type
|
||||
if($price == 0.00)
|
||||
{
|
||||
$applied_discount = 0.00;
|
||||
}
|
||||
// If fixed discount then apply no more than the item price
|
||||
if($discount_type == FIXED)
|
||||
{
|
||||
if($applied_discount > $price)
|
||||
{
|
||||
$applied_discount = $price;
|
||||
$discount -= $applied_discount;
|
||||
}
|
||||
else
|
||||
{
|
||||
$discount = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Serialization and Description
|
||||
|
||||
//Get all items in the cart so far...
|
||||
@@ -857,8 +864,8 @@ class Sale_lib
|
||||
}
|
||||
}
|
||||
|
||||
$total = $this->get_item_total($quantity, $price, $discount, $discount_type);
|
||||
$discounted_total = $this->get_item_total($quantity, $price, $discount, $discount_type, TRUE);
|
||||
$total = $this->get_item_total($quantity, $price, $applied_discount, $discount_type);
|
||||
$discounted_total = $this->get_item_total($quantity, $price, $applied_discount, $discount_type, TRUE);
|
||||
|
||||
if($this->CI->config->item('multi_pack_enabled') == '1')
|
||||
{
|
||||
@@ -884,7 +891,7 @@ class Sale_lib
|
||||
'allow_alt_description' => $item_info->allow_alt_description,
|
||||
'is_serialized' => $item_info->is_serialized,
|
||||
'quantity' => $quantity,
|
||||
'discount' => $discount,
|
||||
'discount' => $applied_discount,
|
||||
'discount_type' => $discount_type,
|
||||
'in_stock' => $this->CI->Item_quantity->get_item_quantity($item_id, $item_location)->quantity,
|
||||
'price' => $price,
|
||||
@@ -1034,6 +1041,7 @@ class Sale_lib
|
||||
$pieces = explode(' ', $external_item_kit_id);
|
||||
$item_kit_id = (count($pieces) > 1) ? $pieces[1] : $external_item_kit_id;
|
||||
$result = TRUE;
|
||||
$applied_discount = $discount;
|
||||
|
||||
foreach($this->CI->Item_kit_items->get_info($item_kit_id) as $item_kit_item)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user