|
@@ -320,11 +320,20 @@ class RequestController
|
|
|
// $ptr = printer_open("POS-58");
|
|
|
// printer_set_option($ptr, PRINTER_MODE, "raw");
|
|
|
$ptr = "/dev/usb/lp0";
|
|
|
- printer_write($ptr, $this->printFormat($result));
|
|
|
+ // printer_write($ptr, $this->printFormat($result));
|
|
|
+ $url = "https://pos58.global-cube.online/";
|
|
|
+ $payload = array('data' => $this->printFormat($result));
|
|
|
+
|
|
|
+ $curl = curl_init($url);
|
|
|
+ curl_setopt($curl, CURLOPT_POST, true);
|
|
|
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $payload);
|
|
|
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
|
|
+ $response = curl_exec($curl);
|
|
|
+ curl_close($curl);
|
|
|
|
|
|
// printer_close($ptr);
|
|
|
|
|
|
- return $result;
|
|
|
+ return $response;
|
|
|
}
|
|
|
|
|
|
private function printFormat ($data)
|
|
@@ -346,7 +355,7 @@ class RequestController
|
|
|
$result[] = str_pad(number_format($data['total'], 2, ",", "."), 31, " ", STR_PAD_LEFT);
|
|
|
|
|
|
$result[] = $this->project['print_footer'];
|
|
|
- $result[] = str_repeat("\n", 7);
|
|
|
+ $result[] = str_repeat("\n", 4);
|
|
|
return implode("\n", $result);
|
|
|
}
|
|
|
|