public function print_setoran($param = '') { $setoran = $this->mk->get_cashdraw_list($param); $config = $this->config->item('astro'); $cnt = 32; $tmpdir = sys_get_temp_dir(); # ambil direktori temporary untuk simpan file. $file = tempnam($tmpdir, 'ctk'); # nama file temporary yang akan dicetak $handle = fopen($file, 'w'); $Data = align_center($cnt, $config['bas_branch_name']) . "\n"; $Data .= align_center($cnt, $config['bas_branch_address']) . "\n"; $Data .= align_center($cnt, $config['bas_branch_phone']) . "\n"; $Data .= cetak_garis($cnt) . "\n"; $Data .= align_center($cnt, "RINCIAN SETORAN KASIR") . "\n"; $Data .= "\n"; $Data .= align_left(28, "TANGGAL : " . tanggalIndo($setoran->date)) . "\n"; $Data .= align_left($cnt, "BUKA : " . $setoran->checkin) . "\n"; $Data .= align_left($cnt, "TUTUP : " . $setoran->checkout) . "\n"; $Data .= cetak_garis($cnt) . "\n"; $Data .= align_left($cnt / 2, "BUKA KAS") . align_right($cnt / 2, format_harga($setoran->start_cash)) . "\n"; $Data .= align_left($cnt / 2, "OMSET") . align_right($cnt / 2, format_harga($setoran->omset)) . "\n"; $Data .= align_left($cnt / 2, "KAS AKHIR") . align_right($cnt / 2, format_harga($setoran->total_cash)) . "\n"; $Data .= align_left($cnt / 2, "SETOR") . align_right($cnt / 2, format_harga($setoran->end_cash)) . "\n"; print_r($Data); exit; $handle = printer_open('58 Printer'); printer_set_option($handle, PRINTER_MODE, "RAW"); printer_write($handle, $Data); printer_close($handle); }
function print_slip($param) { $karyawan = $this->mp->get_paramedik($param['id_karyawan']); $karyawan = $karyawan[0]; $tmpdir = sys_get_temp_dir(); # ambil direktori temporary untuk simpan file. $file = tempnam($tmpdir, 'cetak-slip'); # nama file temporary yang akan dicetak $handle = fopen($file, 'w'); $config = $this->config->item('astro'); $cnt = 40; //ata = "1234567890123456789012345678901234567890\n"; $Data = align_center($cnt, $config['bas_branch_name']) . "\n"; $Data .= align_center($cnt, $config['bas_branch_address']) . "\n"; $Data .= align_center($cnt, $config['bas_branch_phone']) . "\n"; $Data .= cetak_garis($cnt) . "\n"; $Data .= "Tanggal : " . tanggalIndo(date('Y-m-d')) . "\n"; $Data .= "Nomor : " . $param['no_slip'] . "\n"; $Data .= cetak_garis($cnt) . "\n"; $Data .= align_left($cnt / 2, "Nama") . align_right($cnt / 2, $karyawan->name) . "\n"; $Data .= align_left($cnt / 2, "NIK") . align_right($cnt / 2, $karyawan->code) . "\n"; $Data .= align_left($cnt / 2, "Gaji Pokok") . align_right($cnt / 2, format_rupiah($param['gaji'])) . "\n"; $Data .= align_left($cnt / 2, "Bonus") . align_right($cnt / 2, format_rupiah($param['bonus'])) . "\n"; $Data .= align_left($cnt / 2, "Kasbon") . align_right($cnt / 2, format_rupiah($param['casbon'])) . "\n"; $Data .= cetak_garis($cnt) . "\n"; $Data .= align_left($cnt / 2, "Total") . align_right($cnt / 2, format_rupiah($param['total'])) . "\n"; print_r($Data); //exit(); $handle = printer_open('Canon_iP2700_series'); // $handle = printer_open('Microsoft XPS Document Writer'); printer_set_option($handle, PRINTER_MODE, "TEXT"); printer_write($handle, $Data); printer_close($handle); }
public function print_struck() { $id = $this->input->post('id'); $bayar = $this->input->post('bayar'); $discount = $this->input->post('disc'); $list = $this->ksr->get_order_payed($id); $struck = $this->ksr->get_struk($id); $disc = $struck->tagihan * $discount / 100; $tagihan = $struck->tagihan - $disc; // $tax = $tagihan/10; $total_tag = $tagihan; // + $tax; $kembalian = $bayar - $total_tag; $config = $this->config->item('astro'); $cnt = 32; $tmpdir = sys_get_temp_dir(); # ambil direktori temporary untuk simpan file. $file = tempnam($tmpdir, 'ctk'); # nama file temporary yang akan dicetak $handle = fopen($file, 'w'); $Data = align_center($cnt, $config['bas_branch_name']) . "\n"; $Data .= align_center($cnt, $config['bas_branch_address']) . "\n"; $Data .= align_center($cnt, $config['bas_branch_phone']) . "\n"; $Data .= cetak_garis($cnt) . "\n"; $Data .= align_center($cnt, "NOTA PEMBAYARAN") . "\n"; $Data .= "\n"; $Data .= align_left(28, "TANGGAL : " . tanggalIndo($struck->date)) . align_right($cnt - 28, "MEJA : " . $list[0]->meja) . "\n"; $Data .= align_left($cnt, "NO. NOTA : " . $struck->invoice) . "\n"; $Data .= cetak_garis($cnt) . "\n"; foreach ($list as $key => $value) { $Data .= $value->nama . "\n"; $Data .= "X " . align_left(3, $value->qty) . " " . align_left($cnt / 2 - 8, format_harga($value->harga)) . align_right($cnt / 2, format_harga($value->total)) . "\n"; } $Data .= cetak_garis($cnt) . "\n"; $Data .= align_left($cnt / 2, "TOTAL") . align_right($cnt / 2, format_harga($struck->tagihan)) . "\n"; $Data .= align_left($cnt / 2, "DISCOUNT(" . $discount . "%)") . align_right($cnt / 2, format_harga($disc)) . "\n"; $Data .= cetak_garis($cnt) . "\n"; $Data .= align_left($cnt / 2, "TAGIHAN") . align_right($cnt / 2, format_harga($total_tag)) . "\n"; if ($struck->cash == 1) { $Data .= align_left($cnt / 2, "BAYAR") . align_right($cnt / 2, format_harga($bayar)) . "\n"; $Data .= align_left($cnt / 2, "KEMBALIAN") . align_right($cnt / 2, format_harga($kembalian)) . "\n"; } elseif ($struck->cash == 0) { $Data .= align_center($cnt, "**Pembayaran dengan Kartu Debet**") . "\n"; $Data .= align_center($cnt, "Bank " . $struck->note); } else { $Data .= align_center($cnt, "COMPLIMENT"); } $Data .= cetak_garis($cnt) . "\n"; $Data .= align_center($cnt, "**Terima Kasih Atas Kunjungannya**") . "\n"; $this->ksr->delete_tmp_personal($id); // print_r($Data);exit(); $handle = printer_open('58 Printer'); printer_set_option($handle, PRINTER_MODE, "RAW"); printer_write($handle, $Data); printer_close($handle); autocutter('58 Printer'); }