75 lines
2.1 KiB
PHP
75 lines
2.1 KiB
PHP
<?php
|
|
class RptKasirKwitansiWa extends MY_Controller
|
|
{
|
|
var $db;
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
echo "Tools untuk ngakali upload Kwitansi ke Qontak karena kalau dari birt_run tidak bisa di upload";
|
|
}
|
|
|
|
public function KwitansiWa(string $urlbirt)
|
|
{
|
|
|
|
}
|
|
|
|
function get_list_patient_rpt()
|
|
{
|
|
try {
|
|
$list_rpt = [];
|
|
$prefix = "https://" . $_SERVER['SERVER_NAME'];
|
|
$list_rpt[] = $prefix . "/birt/run?__report=report/one/fo/rpt_kwitansi_001.rptdesign&__format=pdf&username=PETUGAS SAMPLE LAB&PID=296";
|
|
|
|
$merge_input = array(
|
|
"output" => "test.pdf",
|
|
"input" => $list_rpt
|
|
);
|
|
|
|
$jsonData = json_encode($merge_input);
|
|
|
|
$jsonDebug = json_encode($merge_input, JSON_PRETTY_PRINT);
|
|
|
|
echo '<pre>' . htmlspecialchars($jsonDebug) . '</pre>';
|
|
exit;
|
|
|
|
// Initialize cURL session
|
|
$target_pdf = "https://" . $_SERVER['SERVER_NAME'] . "/one-api/tools/merge_pdf/merge";
|
|
|
|
$response = $this->post($target_pdf, $jsonData);
|
|
$output_file_name = "test_kwitansi.pdf";
|
|
|
|
header("Content-type: application/pdf");
|
|
header(
|
|
'Content-Disposition: inline; filename="' . $output_file_name .'"'
|
|
);
|
|
echo ($response);
|
|
|
|
} catch (Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
|
|
function post($url, $data)
|
|
{
|
|
$ch = curl_init($url);
|
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
//curl_setopt($ch, CURLOPT_VERBOSE, true);
|
|
curl_setopt(
|
|
$ch,
|
|
CURLOPT_HTTPHEADER,
|
|
array(
|
|
'Content-Type: application/json',
|
|
'Content-Length: ' . strlen($data)
|
|
)
|
|
);
|
|
$result = curl_exec($ch);
|
|
return $result;
|
|
}
|
|
} |