Add receipt font size configuration (#1401 #1416)

This commit is contained in:
FrancescoUK
2017-07-28 21:48:34 +01:00
parent 256c926e3d
commit cd792eb56a
9 changed files with 69 additions and 30 deletions

View File

@@ -801,6 +801,7 @@ class Config extends Secure_Controller
{
$batch_save_data = array (
'receipt_template' => $this->input->post('receipt_template'),
'receipt_font_size' => $this->input->post('receipt_font_size'),
'receipt_show_company_name' => $this->input->post('receipt_show_company_name') != NULL,
'receipt_show_taxes' => $this->input->post('receipt_show_taxes') != NULL,
'receipt_show_total_discount' => $this->input->post('receipt_show_total_discount') != NULL,

View File

@@ -194,6 +194,9 @@ $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_info"] = "Receipt Configuration Information";
$lang["config_receipt_printer"] = "Ticket Printer";
$lang["config_receipt_short"] = "Short";

View File

@@ -16,7 +16,24 @@
</div>
</div>
<div class="form-group form-group-sm">
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('config_receipt_font_size'), 'receipt_font_size', array('class' => 'control-label col-xs-2 required')); ?>
<div class='col-xs-2'>
<div class="input-group">
<?php echo form_input(array(
'type' => 'number',
'min' => '0',
'max' => '20',
'name' => 'receipt_font_size',
'id' => 'receipt_font_size',
'class' => 'form-control input-sm required',
'value'=>$this->config->item('receipt_font_size'))); ?>
<span class="input-group-addon input-sm">px</span>
</div>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('config_receipt_show_company_name'), 'receipt_show_company_name', array('class' => 'control-label col-xs-2')); ?>
<div class='col-xs-1'>
<?php echo form_checkbox(array(
@@ -27,7 +44,7 @@
</div>
</div>
<div class="form-group form-group-sm">
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('config_receipt_show_taxes'), 'receipt_show_taxes', array('class' => 'control-label col-xs-2')); ?>
<div class='col-xs-1'>
<?php echo form_checkbox(array(
@@ -38,7 +55,7 @@
</div>
</div>
<div class="form-group form-group-sm">
<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'>
<?php echo form_checkbox(array(
@@ -49,7 +66,7 @@
</div>
</div>
<div class="form-group form-group-sm">
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('config_receipt_show_description'), 'receipt_show_description', array('class' => 'control-label col-xs-2')); ?>
<div class='col-xs-1'>
<?php echo form_checkbox(array(
@@ -60,7 +77,7 @@
</div>
</div>
<div class="form-group form-group-sm">
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('config_receipt_show_serialnumber'), 'receipt_show_serialnumber', array('class' => 'control-label col-xs-2')); ?>
<div class='col-xs-1'>
<?php echo form_checkbox(array(
@@ -71,7 +88,7 @@
</div>
</div>
<div class="form-group form-group-sm">
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('config_print_silently'), 'print_silently', array('class' => 'control-label col-xs-2')); ?>
<div class='col-xs-1'>
<?php echo form_checkbox(array(
@@ -82,7 +99,7 @@
</div>
</div>
<div class="form-group form-group-sm">
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('config_print_header'), 'print_header', array('class' => 'control-label col-xs-2')); ?>
<div class='col-xs-1'>
<?php echo form_checkbox(array(
@@ -93,7 +110,7 @@
</div>
</div>
<div class="form-group form-group-sm">
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('config_print_footer'), 'print_footer', array('class' => 'control-label col-xs-2')); ?>
<div class='col-xs-1'>
<?php echo form_checkbox(array(
@@ -104,28 +121,28 @@
</div>
</div>
<div class="form-group form-group-sm">
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('config_receipt_printer'), 'config_receipt_printer', array('class' => 'control-label col-xs-2')); ?>
<div class='col-xs-2'>
<?php echo form_dropdown('receipt_printer', array(), ' ', 'id="receipt_printer" class="form-control"'); ?>
</div>
</div>
<div class="form-group form-group-sm">
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('config_invoice_printer'), 'config_invoice_printer', array('class' => 'control-label col-xs-2')); ?>
<div class='col-xs-2'>
<?php echo form_dropdown('invoice_printer', array(), ' ', 'id="invoice_printer" class="form-control"'); ?>
</div>
</div>
<div class="form-group form-group-sm">
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('config_takings_printer'), 'config_takings_printer', array('class' => 'control-label col-xs-2')); ?>
<div class='col-xs-2'>
<?php echo form_dropdown('takings_printer', array(), ' ', 'id="takings_printer" class="form-control"'); ?>
</div>
</div>
<div class="form-group form-group-sm">
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('config_print_top_margin'), 'print_top_margin', array('class' => 'control-label col-xs-2 required')); ?>
<div class='col-xs-2'>
<div class="input-group">
@@ -142,7 +159,7 @@
</div>
</div>
<div class="form-group form-group-sm">
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('config_print_left_margin'), 'print_left_margin', array('class' => 'control-label col-xs-2 required')); ?>
<div class='col-xs-2'>
<div class="input-group">
@@ -159,7 +176,7 @@
</div>
</div>
<div class="form-group form-group-sm">
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('config_print_bottom_margin'), 'print_bottom_margin', array('class' => 'control-label col-xs-2 required')); ?>
<div class='col-xs-2'>
<div class="input-group">
@@ -176,7 +193,7 @@
</div>
</div>
<div class="form-group form-group-sm">
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('config_print_right_margin'), 'print_right_margin', array('class' => 'control-label col-xs-2 required')); ?>
<div class='col-xs-2'>
<div class="input-group">
@@ -206,34 +223,34 @@
//validation and submit handling
$(document).ready(function()
{
if (window.localStorage && window.jsPrintSetup)
if (window.localStorage && window.jsPrintSetup)
{
var printers = (jsPrintSetup.getPrintersList() && jsPrintSetup.getPrintersList().split(',')) || [];
$('#receipt_printer, #invoice_printer, #takings_printer').each(function()
$('#receipt_printer, #invoice_printer, #takings_printer').each(function()
{
var $this = $(this)
$(printers).each(function(key, value)
{
$(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()
{
localStorage[$(this).attr('id')] = $(this).val();
localStorage[$(this).attr('id')] = $(this).val();
});
});
}
else
{
$("input[id*='margin'], #print_footer, #print_header, #receipt_printer, #invoice_printer, #takings_printer, #print_silently").prop('disabled', true);
$("#receipt_printer, #invoice_printer, #takings_printer").each(function()
$("#receipt_printer, #invoice_printer, #takings_printer").each(function()
{
$(this).append($('<option>', {value : 'na'}).text('N/A'));
});
}
var dialog_confirmed = window.jsPrintSetup;
$('#receipt_config_form').validate($.extend(form_support.handler, {
submitHandler: function(form) {
$(form).ajaxSubmit({
@@ -270,10 +287,15 @@ $(document).ready(function()
{
required:true,
number:true
}
},
receipt_font_size:
{
required:true,
number:true
}
},
messages:
messages:
{
print_top_margin:
{
@@ -294,6 +316,11 @@ $(document).ready(function()
{
required:"<?php echo $this->lang->line('config_print_right_margin_required'); ?>",
number:"<?php echo $this->lang->line('config_print_right_margin_number'); ?>"
},
receipt_font_size:
{
required:"<?php echo $this->lang->line('config_receipt_font_size_required'); ?>",
number:"<?php echo $this->lang->line('config_receipt_font_size_number'); ?>"
}
}
}));

View File

@@ -1,4 +1,4 @@
<div id="receipt_wrapper">
<div id="receipt_wrapper" style="font-size:<?php echo $this->config->item('receipt_font_size');?>px">
<div id="receipt_header">
<?php
if($this->config->item('company_logo') != '')

View File

@@ -1,4 +1,4 @@
<div id="receipt_wrapper">
<div id="receipt_wrapper" style="font-size:<?php echo $this->config->item('receipt_font_size');?>px">
<div id="receipt_header">
<?php
if($this->config->item('company_logo') != '')

View File

@@ -210,7 +210,7 @@ ALTER TABLE `ospos_people`
-- add financial year start into config
INSERT INTO `ospos_app_config` (`key`, `value`) VALUES
('financial_year','1');
('financial_year', '1');
-- alter giftcard field number to be varchar
@@ -269,3 +269,8 @@ UPDATE `ospos_tax_code_rates` SET rate_tax_category_id = 3 WHERE rate_tax_catego
UPDATE `ospos_tax_code_rates` SET rate_tax_category_id = 2 WHERE rate_tax_category_id = 1;
UPDATE `ospos_tax_code_rates` SET rate_tax_category_id = 1 WHERE rate_tax_category_id = 0;
-- add receipt font size
INSERT INTO `ospos_app_config` (`key`, `value`) VALUES
('receipt_font_size', '12');

View File

@@ -96,7 +96,8 @@ INSERT INTO `ospos_app_config` (`key`, `value`) VALUES
('default_origin_tax_code', ''),
('cash_decimals', '2'),
('financial_year', '1'),
('giftcard_number', 'series');
('giftcard_number', 'series'),
('receipt_font_size', '12');
-- --------------------------------------------------------

View File

@@ -96,7 +96,8 @@ INSERT INTO `ospos_app_config` (`key`, `value`) VALUES
('default_origin_tax_code', ''),
('cash_decimals', '2'),
('financial_year', '1'),
('giftcard_number', 'series');
('giftcard_number', 'series'),
('receipt_font_size', '12');
-- --------------------------------------------------------

View File

@@ -96,7 +96,8 @@ INSERT INTO `ospos_app_config` (`key`, `value`) VALUES
('default_origin_tax_code', ''),
('cash_decimals', '2'),
('financial_year', '1'),
('giftcard_number', 'series');
('giftcard_number', 'series'),
('receipt_font_size', '12');
-- --------------------------------------------------------