$account['name'] = $this->input->post('name'); $account['name_surname'] = $this->input->post('name_surname'); $account['balance'] = $this->input->post('balance'); $account['phone'] = $this->input->post('phone'); $account['gsm'] = $this->input->post('gsm'); $account['email'] = $this->input->post('email'); $account['address'] = $this->input->post('address'); $account['county'] = $this->input->post('county'); $account['city'] = $this->input->post('city'); $account['description'] = $this->input->post('description'); // if the barcode is empty, auto-create if ($account['code'] == '') { $account['code'] = replace_text_for_utf8($this->input->post('name')); // Have barcode? for ($i = is_account_code($account['code']); $i > 0; $i++) { $account['code'] = replace_text_for_utf8($this->input->post('name')) . '-' . $i; $i = is_account_code($account['code']); } } else { // Have barcode? if (is_account_code($account['code'])) { alertbox('alert-danger', get_lang('This barcode is found in the database.')); $continue = false; } } if ($continue) { $account_id = add_account($account); if ($account_id > 0) { alertbox('alert-success', get_lang('Operation is Successful'), ''); $log['date'] = $this->input->post('log_time'); $log['type'] = 'account';
function get_print_barcode($text) { return site_url('general/barcode/' . replace_text_for_utf8(strtolower($text))); }
$color_black = new BCGColor(0, 0, 0); $color_white = new BCGColor(255, 255, 255); function replace_text_for_utf8($text) { $text = trim($text); $search = array('Ç', 'ç', 'Ğ', 'ğ', 'ı', 'İ', 'Ö', 'ö', 'Ş', 'ş', 'Ü', 'ü', ' '); $replace = array('c', 'c', 'g', 'g', 'i', 'i', 'o', 'o', 's', 's', 'u', 'u', '-'); $new_text = str_replace($search, $replace, $text); return $new_text; } if (isset($_GET['text'])) { $text = $_GET['text']; } else { $text = 'no-text'; } $text = replace_text_for_utf8(strtolower($text)); // Barcode Part $code = new BCGcode128(); $code->setScale(2); $code->setThickness(30); $code->setForegroundColor($color_black); $code->setBackgroundColor($color_white); $code->setFont($font); $code->setStart(NULL); $code->setTilde(true); $code->parse($text); // Drawing Part $drawing = new BCGDrawing('', $color_white); $drawing->setBarcode($code); $drawing->draw(); header('Content-Type: image/png');