64 lines
1.8 KiB
PHP
64 lines
1.8 KiB
PHP
<?php
|
|
class Send_wa extends MY_Controller
|
|
{
|
|
public function index()
|
|
{
|
|
echo "API SEND WA";
|
|
}
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->load->library("Wa_krmv3");
|
|
}
|
|
|
|
public function send()
|
|
{
|
|
try {
|
|
$prm = $this->sys_input;
|
|
|
|
$orderheaderid = $prm["orderheaderid"];
|
|
$nomorlab = $prm["nomorlab"];
|
|
$namapasien = $prm["namapasien"];
|
|
$sotemplate = $prm["sotemplate"];
|
|
$nohp = $prm["nohp"];
|
|
$numberlabext = $prm["numberlabext"];
|
|
|
|
$sql_branch = "SELECT M_BranchID,
|
|
M_BranchCode,
|
|
M_BranchName
|
|
FROM m_branch
|
|
WHERE M_BranchIsDefault = 'Y'";
|
|
$qry_branch = $this->db->query($sql_branch);
|
|
if ($qry_branch) {
|
|
$rowCode = $qry_branch->result_array()[0]["M_BranchCode"];
|
|
} else {
|
|
$this->db->sys_error_db("select branch error", $this->db);
|
|
exit;
|
|
}
|
|
|
|
$result = $this->wa_krmv3->send_eform($nohp, $rowCode, $numberlabext, $sotemplate);
|
|
if ($result["code"] == 200) {
|
|
//
|
|
$resp = array(
|
|
"status" => "OK",
|
|
"message" => "Pesan berhasil di kirimkan"
|
|
);
|
|
|
|
echo json_encode($resp);
|
|
} else {
|
|
//
|
|
$resp = array(
|
|
"status" => "ERR",
|
|
"message" => $result
|
|
);
|
|
|
|
echo json_encode($resp);
|
|
}
|
|
} catch (Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
}
|