Info

Order No. : {{$order->OrderNumber}}
Customer : {{$order->customer_name}}
Location : {{$order->location}}
Sales Rep : {{$order->sales_rep}}
Order Note : {{$order->notes}}

@foreach ($o_items as $oi) @endforeach

Item

Qty

Price

Disc

Sub Total

{{@$oi->product_code}}

{{@$oi->qty}}

Rs. {{number_format(@$oi->unit_price)}}

@if($oi->discount_percent >0 ) {{@$oi->discount_percent}}% @else 0 @endif

Rs. {{number_format(@$oi->sub_total)}}

Total

Rs. {{number_format($order->grand_total)}}

Paid

Rs. {{number_format($order->paid)}}

Balance

Rs. {{number_format($order->balance)}}

@php use \Mike42\Escpos\Printer; use \Mike42\Escpos\EscposImage; use \Mike42\Escpos; use \Mike42\Escpos\PrintConnectors\WindowsPrintConnector; use \Mike42\Escpos\GdEscposImage; $info = array("Order No: ".$order->OrderNumber."\n" ,"Customer: ". $order->customer_name."\n","Location: ".$order->location."\n","Sales Rep: ". $order->sales_rep."\n","Order Notes: ".$order->notes."\n"); $items = ["CODE QTY RATE DISC AMOUNT\n"]; foreach ($o_items as $oi){ $i = $oi->product_code." x".$oi->qty." ".number_format($oi->unit_price)." RS ".$oi->discount_percent."% ".number_format($oi->sub_total)." RS\n"; // " ".$oi->unit_price." ".($oi->discount_percent > 0) ? $oi->discount_percent : '0'." ".$oi->sub_total."\n"); array_push($items, $i); } $paid = " Paid: ".number_format($order->paid)." RS\n"; $balance = " Balance: ".number_format($order->balance)." RS\n" ; $total = " Total: ". number_format($order->grand_total)." RS\n"; $date = date("d F Y h:i:s A"); $connector = new WindowsPrintConnector("POS-80-Series-1"); // Add connector for your printer here. // $printer = new Printer($connector); $printer = new Printer($connector); $printer->setPrintLeftMargin(10); /* Print top logo */ // $printer -> setJustification(Printer::JUSTIFY_CENTER); // $tux = EscposImage::load("assets/dist/img/logo.bmp"); // $printer->bitImage($tux); $ticketim = imagecreatefrompng("assets/dist/img/invoice.png"); $logo = new GdEscposImage(); $logo -> readImageFromGdResource($ticketim); $printer->setJustification(Printer::JUSTIFY_CENTER); $printer -> bitImageColumnFormat($logo); /* Name of shop */ // $printer -> selectPrintMode(Printer::MODE_DOUBLE_WIDTH); // $printer -> text("Saira Habib.\n"); // $printer -> selectPrintMode(); $printer -> text("----------------------------------------------\n"); $printer -> setJustification(Printer::JUSTIFY_CENTER); $printer -> selectPrintMode(Printer::MODE_DOUBLE_WIDTH); $printer -> text("INVOICE\n"); $printer -> selectPrintMode(); // $printer -> text("Shop No. 42.\n"); $printer -> text("----------------------------------------------\n"); $printer -> feed(); // $printer -> feed(); $printer -> setJustification(Printer::JUSTIFY_LEFT); foreach ($info as $item) { $printer -> text($item); } $printer -> text("----------------------------------------------\n"); // $printer -> selectPrintMode(); // $printer -> text("Shop No. 42.\n"); // $printer -> feed(); /* Title of receipt */ $printer -> setEmphasis(false); /* Items */ $printer -> setJustification(Printer::JUSTIFY_LEFT); $printer -> setEmphasis(false); foreach ($items as $item) { $printer -> text($item); } $printer -> setEmphasis(true); $printer -> feed(); /* paid and balance */ $printer -> text($total); $printer -> text($paid); $printer -> text($balance); $printer -> feed(); /* Footer */ $printer -> setJustification(Printer::JUSTIFY_CENTER); $printer -> text("THANK YOU FOR SHOPPING!\n"); $printer -> text($date . "\n\n"); /* Cut the receipt and open the cash drawer */ $printer -> cut(); $printer -> pulse(); $printer -> close(); @endphp {{-- --}}