mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-04-29 03:15:58 -04:00
Fix to sale and receiving receipt barcode
This commit is contained in:
@@ -220,8 +220,7 @@ class Receivings extends Secure_area
|
||||
{
|
||||
$data['error_message'] = $this->lang->line('receivings_transaction_failed');
|
||||
}
|
||||
$barcode_config=array('barcode_type'=>2,'barcode_width'=>200, 'barcode_height'=>30, 'barcode_quality'=>100);
|
||||
$data['barcode']=$this->barcode_lib->generate_barcode($data['receiving_id'],$barcode_config);
|
||||
$data['barcode']=$this->barcode_lib->generate_receipt_barcode($data['receiving_id']);
|
||||
$data['print_after_sale'] = $this->receiving_lib->is_print_after_sale();
|
||||
$this->load->view("receivings/receipt",$data);
|
||||
$this->receiving_lib->clear_all();
|
||||
@@ -313,8 +312,7 @@ class Receivings extends Secure_area
|
||||
$data['payment_type']=$receiving_info['payment_type'];
|
||||
$data['invoice_number']=$this->receiving_lib->get_invoice_number();
|
||||
$data['receiving_id']='RECV '.$receiving_id;
|
||||
$barcode_config=array('barcode_type'=>2,'barcode_width'=>200, 'barcode_height'=>30, 'barcode_quality'=>100);
|
||||
$data['barcode']=$this->barcode_lib->generate_barcode($data['receiving_id'],$barcode_config);
|
||||
$data['barcode']=$this->barcode_lib->generate_receipt_barcode($data['receiving_id']);
|
||||
$data['employee']=$emp_info->first_name.' '.$emp_info->last_name;
|
||||
|
||||
if($supplier_id!=-1)
|
||||
|
||||
@@ -378,8 +378,7 @@ class Sales extends Secure_area
|
||||
}
|
||||
else
|
||||
{
|
||||
$barcode_config=array('barcode_type'=>2,'barcode_width'=>200, 'barcode_height'=>30, 'barcode_quality'=>100);
|
||||
$data['barcode']=$this->barcode_lib->generate_barcode($data['sale_id'],$barcode_config);
|
||||
$data['barcode']=$this->barcode_lib->generate_receipt_barcode($data['sale_id']);
|
||||
// if we want to email. .. just attach the pdf in there?
|
||||
if ($this->sale_lib->get_email_receipt() && !empty($cust_info->email))
|
||||
{
|
||||
@@ -582,9 +581,7 @@ class Sales extends Secure_area
|
||||
$this->config->item('phone'),
|
||||
$this->config->item('account_number')
|
||||
));
|
||||
// static barcode config for receipts + invoices
|
||||
$barcode_config=array('barcode_type'=>2,'barcode_width'=>200, 'barcode_height'=>30, 'barcode_quality'=>100);
|
||||
$data['barcode']=$this->barcode_lib->generate_barcode($data['sale_id'],$barcode_config);
|
||||
$data['barcode']=$this->barcode_lib->generate_receipt_barcode($data['sale_id']);
|
||||
$data['print_after_sale'] = FALSE;
|
||||
return $data;
|
||||
}
|
||||
|
||||
@@ -82,10 +82,32 @@ class Barcode_lib
|
||||
}
|
||||
}
|
||||
|
||||
public function generate_item_barcode($item, $barcode_config)
|
||||
public function generate_receipt_barcode($barcode_content)
|
||||
{
|
||||
$barcode_content = $barcode_config['barcode_content'] !== "id" && isset($item['item_number']) ? $item['item_number'] : $item['item_id'];
|
||||
return $this->generate_barcode($barcode_content, $barcode_config);
|
||||
try
|
||||
{
|
||||
// Code128 is used for the receipts
|
||||
|
||||
$barcode = $this->get_barcode_instance(2);
|
||||
|
||||
// set the receipt number to generate the barcode for
|
||||
$barcode->setData($barcode_content);
|
||||
|
||||
// image quality 100
|
||||
$barcode->setQuality(100);
|
||||
|
||||
// width: 200, height: 30
|
||||
$barcode->setDimensions(200, 30);
|
||||
|
||||
// draw the image
|
||||
$barcode->draw();
|
||||
|
||||
return $barcode->base64();
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
echo 'Caught exception: ', $e->getMessage(), "\n";
|
||||
}
|
||||
}
|
||||
|
||||
public function get_barcode($item, $barcode_config)
|
||||
|
||||
Reference in New Issue
Block a user