mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-04-16 04:50:09 -04:00
Add a code to indicate a taxable item on a sales receipt
This commit is contained in:
@@ -750,7 +750,8 @@ class Config extends Secure_Controller
|
||||
'email_receipt_check_behaviour' => $this->input->post('email_receipt_check_behaviour'),
|
||||
'print_receipt_check_behaviour' => $this->input->post('print_receipt_check_behaviour'),
|
||||
'receipt_show_company_name' => $this->input->post('receipt_show_company_name') != NULL,
|
||||
'receipt_show_taxes' => $this->input->post('receipt_show_taxes') != NULL,
|
||||
'receipt_show_taxes' => ($this->input->post('receipt_show_taxes') != NULL),
|
||||
'receipt_show_tax_ind' => ($this->input->post('receipt_show_tax_ind') != NULL),
|
||||
'receipt_show_total_discount' => $this->input->post('receipt_show_total_discount') != NULL,
|
||||
'receipt_show_description' => $this->input->post('receipt_show_description') != NULL,
|
||||
'receipt_show_serialnumber' => $this->input->post('receipt_show_serialnumber') != NULL,
|
||||
@@ -762,7 +763,7 @@ class Config extends Secure_Controller
|
||||
'print_bottom_margin' => $this->input->post('print_bottom_margin'),
|
||||
'print_right_margin' => $this->input->post('print_right_margin')
|
||||
);
|
||||
|
||||
|
||||
$result = $this->Appconfig->batch_save($batch_save_data);
|
||||
$success = $result ? TRUE : FALSE;
|
||||
|
||||
|
||||
@@ -231,6 +231,7 @@ $lang["config_receipt_short"] = "Short";
|
||||
$lang["config_receipt_show_company_name"] = "Show Company Name";
|
||||
$lang["config_receipt_show_description"] = "Show Description";
|
||||
$lang["config_receipt_show_serialnumber"] = "Show Serial Number";
|
||||
$lang["config_receipt_show_tax_ind"] = "Show Tax Indicator";
|
||||
$lang["config_receipt_show_taxes"] = "Show Taxes";
|
||||
$lang["config_receipt_show_total_discount"] = "Show Total Discount";
|
||||
$lang["config_receipt_template"] = "Receipt Template";
|
||||
|
||||
@@ -97,6 +97,7 @@ $lang["sales_no_filter"] = "All";
|
||||
$lang["sales_no_items_in_cart"] = "There are no Items in the cart";
|
||||
$lang["sales_no_sales_to_display"] = "No Sales to display";
|
||||
$lang["sales_none_selected"] = "You have not selected any Sale(s) to delete";
|
||||
$lang["sales_nontaxed_ind"] = " ";
|
||||
$lang["sales_not_authorized"] = "This action is not authorised";
|
||||
$lang["sales_one_or_multiple"] = "Sale(s)";
|
||||
$lang["sales_payment"] = "Payment Type";
|
||||
@@ -154,6 +155,7 @@ $lang["sales_suspended_sales"] = "Suspended";
|
||||
$lang["sales_table"] = "Table";
|
||||
$lang["sales_takings"] = "Transactions";
|
||||
$lang["sales_tax"] = "Tax";
|
||||
$lang["sales_taxed_ind"] = "T";
|
||||
$lang["sales_tax_id"] = "Tax Id";
|
||||
$lang["sales_tax_invoice"] = "Tax Invoice";
|
||||
$lang["sales_tax_percent"] = "Tax %";
|
||||
|
||||
@@ -231,6 +231,7 @@ $lang["config_receipt_short"] = "Short";
|
||||
$lang["config_receipt_show_company_name"] = "Show Company Name";
|
||||
$lang["config_receipt_show_description"] = "Show Description";
|
||||
$lang["config_receipt_show_serialnumber"] = "Show Serial Number";
|
||||
$lang["config_receipt_show_tax_ind"] = "Show Tax Indicator";
|
||||
$lang["config_receipt_show_taxes"] = "Show Taxes";
|
||||
$lang["config_receipt_show_total_discount"] = "Show Total Discount";
|
||||
$lang["config_receipt_template"] = "Receipt Template";
|
||||
|
||||
@@ -97,6 +97,7 @@ $lang["sales_no_filter"] = "All";
|
||||
$lang["sales_no_items_in_cart"] = "There are no Items in the cart.";
|
||||
$lang["sales_no_sales_to_display"] = "No Sales to display.";
|
||||
$lang["sales_none_selected"] = "You have not selected any Sale(s) to delete.";
|
||||
$lang["sales_nontaxed_ind"] = " ";
|
||||
$lang["sales_not_authorized"] = "This action is not authorized.";
|
||||
$lang["sales_one_or_multiple"] = "Sale(s)";
|
||||
$lang["sales_payment"] = "Payment Type";
|
||||
@@ -130,6 +131,7 @@ $lang["sales_sale_by_invoice"] = "Sale by Invoice";
|
||||
$lang["sales_sale_for_customer"] = "Customer:";
|
||||
$lang["sales_sale_time"] = "Time";
|
||||
$lang["sales_sales_tax"] = "Sales Tax";
|
||||
$lang["sales_taxed_ind"] = "T";
|
||||
$lang["sales_select_customer"] = "Select Customer";
|
||||
$lang["sales_send_invoice"] = "Send Invoice";
|
||||
$lang["sales_send_quote"] = "Send Quote";
|
||||
|
||||
@@ -55,7 +55,7 @@ class Tax_lib
|
||||
/**
|
||||
* Compute taxes for all items in the cart
|
||||
*/
|
||||
public function get_taxes($cart)
|
||||
public function get_taxes(&$cart)
|
||||
{
|
||||
$register_mode = $this->CI->sale_lib->get_mode();
|
||||
$tax_decimals = tax_decimals();
|
||||
@@ -69,6 +69,8 @@ class Tax_lib
|
||||
{
|
||||
foreach($cart as $line => $item)
|
||||
{
|
||||
$taxed = FALSE;
|
||||
|
||||
if(!($this->CI->config->item('use_destination_based_tax')))
|
||||
{
|
||||
// Start of current Base System tax calculations
|
||||
@@ -100,6 +102,7 @@ class Tax_lib
|
||||
$tax_group_sequence++;
|
||||
$this->update_taxes($taxes, $tax_type, $tax['name'], $tax['percent'], $tax_basis, $tax_amount, $tax_group_sequence, Rounding_mode::HALF_UP, -1, $tax['name']);
|
||||
$tax_group_sequence += 1;
|
||||
$taxed = TRUE;
|
||||
}
|
||||
$items_taxes_detail = array();
|
||||
$items_taxes_detail['item_id'] = $item['item_id'];
|
||||
@@ -125,12 +128,16 @@ class Tax_lib
|
||||
{
|
||||
$item['tax_category_id'] = $this->CI->config->config['default_tax_category'];
|
||||
}
|
||||
$tax_category = '';
|
||||
$tax_rate = '';
|
||||
$rounding_code = Rounding_mode::HALF_UP;
|
||||
$tax_group_sequence = 0;
|
||||
$tax_code = '';
|
||||
$this->apply_destination_tax($item, $customer_info->city, $customer_info->state, $customer_info->sales_tax_code_id, $register_mode, 0, $taxes, $item_taxes, $item['line']);
|
||||
|
||||
$taxed = $this->apply_destination_tax($item, $customer_info->city, $customer_info->state, $customer_info->sales_tax_code_id, $register_mode, 0, $taxes, $item_taxes, $item['line']);
|
||||
}
|
||||
if($taxed)
|
||||
{
|
||||
$cart[$line]['taxed_flag'] = $this->CI->lang->line('sales_taxed_ind');
|
||||
}
|
||||
else
|
||||
{
|
||||
$cart[$line]['taxed_flag'] = $this->CI->lang->line('sales_nontaxed_ind');
|
||||
}
|
||||
}
|
||||
$this->round_taxes($taxes);
|
||||
@@ -292,6 +299,8 @@ class Tax_lib
|
||||
*/
|
||||
public function apply_destination_tax(&$item, $city, $state, $sales_tax_code_id, $register_mode, $sale_id, &$taxes, &$item_taxes, $line)
|
||||
{
|
||||
$taxed = FALSE;
|
||||
|
||||
$tax_code_id = $this->get_applicable_tax_code($register_mode, $city, $state, $sales_tax_code_id);
|
||||
|
||||
// If tax code cannot be determined or the price is zero then skip this item
|
||||
@@ -337,7 +346,7 @@ class Tax_lib
|
||||
|
||||
if($tax_amount != 0)
|
||||
{
|
||||
|
||||
$taxed = TRUE;
|
||||
$this->update_taxes($taxes, $tax_type, $tax['tax_group'], $tax_rate, $tax_basis, $tax_amount, $tax['tax_group_sequence'], $rounding_code, $sale_id, $tax['tax_group'], $tax_code_id, $tax['rate_jurisdiction_id'], $item['tax_category_id']);
|
||||
}
|
||||
|
||||
@@ -357,11 +366,11 @@ class Tax_lib
|
||||
|
||||
$item_taxes[] = $item_taxes_detail;
|
||||
}
|
||||
return;
|
||||
return $taxed;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
return $taxed;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Migration_receipttaxindicator extends CI_Migration
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function up()
|
||||
{
|
||||
$this->db->query('INSERT INTO ' . $this->db->dbprefix('app_config') . ' (`key`, `value`)
|
||||
VALUES (\'receipt_show_tax_ind\', \'0\')');
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->db->query('DELETE FROM ' . $this->db->dbprefix('app_config') . ' WHERE key = \'receipt_show_tax_ind\'');
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -126,6 +126,17 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label($this->lang->line('config_receipt_show_tax_ind'), 'receipt_show_tax_ind', array('class' => 'control-label col-xs-2')); ?>
|
||||
<div class='col-xs-1'>
|
||||
<?php echo form_checkbox(array(
|
||||
'name' => 'receipt_show_tax_ind',
|
||||
'value' => 'receipt_show_tax_ind',
|
||||
'id' => 'receipt_show_tax_ind',
|
||||
'checked' => $this->config->item('receipt_show_tax_ind'))); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<?php echo form_label($this->lang->line('config_receipt_show_total_discount'), 'receipt_show_total_discount', array('class' => 'control-label col-xs-2')); ?>
|
||||
<div class='col-xs-1'>
|
||||
@@ -303,7 +314,7 @@ $(document).ready(function()
|
||||
$(printers).each(function(key, value)
|
||||
{
|
||||
$this.append($('<option>', { value : value }).text(value));
|
||||
});
|
||||
});
|
||||
$("option[value='" + localStorage[$(this).attr('id')] + "']", this).prop('selected', true);
|
||||
$(this).change(function()
|
||||
{
|
||||
@@ -369,7 +380,7 @@ $(document).ready(function()
|
||||
required:true,
|
||||
number:true
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
messages:
|
||||
{
|
||||
|
||||
@@ -57,6 +57,14 @@
|
||||
<th style="width:20%;"><?php echo $this->lang->line('sales_price'); ?></th>
|
||||
<th style="width:20%;"><?php echo $this->lang->line('sales_quantity'); ?></th>
|
||||
<th style="width:20%;" class="total-value"><?php echo $this->lang->line('sales_total'); ?></th>
|
||||
<?php
|
||||
if($this->config->item('receipt_show_tax_ind'))
|
||||
{
|
||||
?>
|
||||
<th style="width:20%;"></th>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
<?php
|
||||
foreach($cart as $line=>$item)
|
||||
@@ -69,6 +77,14 @@
|
||||
<td><?php echo to_currency($item['price']); ?></td>
|
||||
<td><?php echo to_quantity_decimals($item['quantity']); ?></td>
|
||||
<td class="total-value"><?php echo to_currency($item[($this->config->item('receipt_show_total_discount') ? 'total' : 'discounted_total')]); ?></td>
|
||||
<?php
|
||||
if($this->config->item('receipt_show_tax_ind'))
|
||||
{
|
||||
?>
|
||||
<td><?php echo $item['taxed_flag'] ?></td>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
<tr>
|
||||
<?php
|
||||
|
||||
Reference in New Issue
Block a user