fix report
parent
9165fa1f2b
commit
84d40ba29c
|
|
@ -95,9 +95,32 @@ class CaseFrozenController extends Controller
|
|||
{
|
||||
$model = $this->findModel($id);
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
Yii::$app->pathology->setLog('Update', 'แก้ไข ID Case และ Status: ' . $model->id_case, Yii::$app->user->getId(), CaseFrozen::tableName());
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
if ($model->load(Yii::$app->request->post())) {
|
||||
|
||||
if ($model->save()) {
|
||||
|
||||
Yii::$app->pathology->setLog(
|
||||
'Update',
|
||||
'แก้ไข ID Case และ Status: ' . $model->id_case,
|
||||
Yii::$app->user->getId(),
|
||||
CaseFrozen::tableName()
|
||||
);
|
||||
|
||||
// Flash สำเร็จ
|
||||
Yii::$app->session->setFlash(
|
||||
'success',
|
||||
'บันทึกการแก้ไข Case: ' . $model->id_case . ' เรียบร้อยแล้ว'
|
||||
);
|
||||
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
} else {
|
||||
|
||||
// Flash กรณีบันทึกไม่สำเร็จ
|
||||
Yii::$app->session->setFlash(
|
||||
'error',
|
||||
'ไม่สามารถบันทึกข้อมูลได้ กรุณาตรวจสอบข้อมูลอีกครั้ง'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render('update', [
|
||||
|
|
@ -165,7 +188,6 @@ class CaseFrozenController extends Controller
|
|||
}
|
||||
return $this->redirect(['index']);
|
||||
}*/
|
||||
|
||||
public function actionDelete($id)
|
||||
{
|
||||
$model = $this->findModel($id);
|
||||
|
|
@ -173,14 +195,20 @@ class CaseFrozenController extends Controller
|
|||
// เก็บ id_case ไว้ก่อนลบ
|
||||
$id_case = $model->id_case;
|
||||
|
||||
$model->delete();
|
||||
if ($model->delete()) {
|
||||
|
||||
Yii::$app->pathology->setLog(
|
||||
'Delete',
|
||||
'ลบ Case: ' . $id_case,
|
||||
Yii::$app->user->getId(),
|
||||
CaseFrozen::tableName()
|
||||
);
|
||||
Yii::$app->pathology->setLog(
|
||||
'Delete',
|
||||
'ลบ Case: ' . $id_case,
|
||||
Yii::$app->user->getId(),
|
||||
CaseFrozen::tableName()
|
||||
);
|
||||
|
||||
// ตั้งค่า Flash Message
|
||||
Yii::$app->session->setFlash('success', 'ลบ Case: ' . $id_case . ' เรียบร้อยแล้ว');
|
||||
} else {
|
||||
Yii::$app->session->setFlash('error', 'ไม่สามารถลบข้อมูลได้');
|
||||
}
|
||||
|
||||
return $this->redirect(['index']);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,9 +87,32 @@ class CaseNonGynController extends Controller
|
|||
{
|
||||
$model = $this->findModel($id);
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
Yii::$app->pathology->setLog('Update', 'แก้ไข ID Case และ Status: ' . $model->id_case, Yii::$app->user->getId(), CaseNonGyn::tableName());
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
if ($model->load(Yii::$app->request->post())) {
|
||||
|
||||
if ($model->save()) {
|
||||
|
||||
Yii::$app->pathology->setLog(
|
||||
'Update',
|
||||
'แก้ไข ID Case และ Status: ' . $model->id_case,
|
||||
Yii::$app->user->getId(),
|
||||
CaseNonGyn::tableName()
|
||||
);
|
||||
|
||||
// Flash สำเร็จ
|
||||
Yii::$app->session->setFlash(
|
||||
'success',
|
||||
'บันทึกการแก้ไข Case: ' . $model->id_case . ' เรียบร้อยแล้ว'
|
||||
);
|
||||
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
} else {
|
||||
|
||||
// Flash กรณีบันทึกไม่สำเร็จ
|
||||
Yii::$app->session->setFlash(
|
||||
'error',
|
||||
'ไม่สามารถบันทึกข้อมูลได้ กรุณาตรวจสอบข้อมูลอีกครั้ง'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render('update', [
|
||||
|
|
@ -142,7 +165,6 @@ class CaseNonGynController extends Controller
|
|||
|
||||
return $this->redirect(['index']);
|
||||
}*/
|
||||
|
||||
public function actionDelete($id)
|
||||
{
|
||||
$model = $this->findModel($id);
|
||||
|
|
@ -150,18 +172,25 @@ class CaseNonGynController extends Controller
|
|||
// เก็บ id_case ไว้ก่อนลบ
|
||||
$id_case = $model->id_case;
|
||||
|
||||
$model->delete();
|
||||
if ($model->delete()) {
|
||||
|
||||
Yii::$app->pathology->setLog(
|
||||
'Delete',
|
||||
'ลบ Case: ' . $id_case,
|
||||
Yii::$app->user->getId(),
|
||||
CaseNonGyn::tableName()
|
||||
);
|
||||
Yii::$app->pathology->setLog(
|
||||
'Delete',
|
||||
'ลบ Case: ' . $id_case,
|
||||
Yii::$app->user->getId(),
|
||||
CaseNonGyn::tableName()
|
||||
);
|
||||
|
||||
// ตั้งค่า Flash Message
|
||||
Yii::$app->session->setFlash('success', 'ลบ Case: ' . $id_case . ' เรียบร้อยแล้ว');
|
||||
} else {
|
||||
Yii::$app->session->setFlash('error', 'ไม่สามารถลบข้อมูลได้');
|
||||
}
|
||||
|
||||
return $this->redirect(['index']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Finds the CaseNonGyn model based on its primary key value.
|
||||
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||
|
|
|
|||
|
|
@ -87,9 +87,32 @@ class CasePapController extends Controller
|
|||
{
|
||||
$model = $this->findModel($id);
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
Yii::$app->pathology->setLog('Update', 'แก้ไข ID Case และ Status: ' . $model->id_case, Yii::$app->user->getId(), CasePap::tableName());
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
if ($model->load(Yii::$app->request->post())) {
|
||||
|
||||
if ($model->save()) {
|
||||
|
||||
Yii::$app->pathology->setLog(
|
||||
'Update',
|
||||
'แก้ไข ID Case และ Status: ' . $model->id_case,
|
||||
Yii::$app->user->getId(),
|
||||
CasePap::tableName()
|
||||
);
|
||||
|
||||
// Flash สำเร็จ
|
||||
Yii::$app->session->setFlash(
|
||||
'success',
|
||||
'บันทึกการแก้ไข Case: ' . $model->id_case . ' เรียบร้อยแล้ว'
|
||||
);
|
||||
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
} else {
|
||||
|
||||
// Flash กรณีบันทึกไม่สำเร็จ
|
||||
Yii::$app->session->setFlash(
|
||||
'error',
|
||||
'ไม่สามารถบันทึกข้อมูลได้ กรุณาตรวจสอบข้อมูลอีกครั้ง'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render('update', [
|
||||
|
|
@ -153,7 +176,6 @@ class CasePapController extends Controller
|
|||
|
||||
return $this->redirect(['index']);
|
||||
}*/
|
||||
|
||||
public function actionDelete($id)
|
||||
{
|
||||
$model = $this->findModel($id);
|
||||
|
|
@ -161,14 +183,20 @@ class CasePapController extends Controller
|
|||
// เก็บ id_case ไว้ก่อนลบ
|
||||
$id_case = $model->id_case;
|
||||
|
||||
$model->delete();
|
||||
if ($model->delete()) {
|
||||
|
||||
Yii::$app->pathology->setLog(
|
||||
'Delete',
|
||||
'ลบ Case: ' . $id_case,
|
||||
Yii::$app->user->getId(),
|
||||
CasePap::tableName()
|
||||
);
|
||||
Yii::$app->pathology->setLog(
|
||||
'Delete',
|
||||
'ลบ Case: ' . $id_case,
|
||||
Yii::$app->user->getId(),
|
||||
CasePap::tableName()
|
||||
);
|
||||
|
||||
// ตั้งค่า Flash Message
|
||||
Yii::$app->session->setFlash('success', 'ลบ Case: ' . $id_case . ' เรียบร้อยแล้ว');
|
||||
} else {
|
||||
Yii::$app->session->setFlash('error', 'ไม่สามารถลบข้อมูลได้');
|
||||
}
|
||||
|
||||
return $this->redirect(['index']);
|
||||
}
|
||||
|
|
@ -188,4 +216,4 @@ class CasePapController extends Controller
|
|||
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -187,18 +187,25 @@ class CaseSurgicalController extends Controller
|
|||
// เก็บ id_case ไว้ก่อนลบ
|
||||
$id_case = $model->id_case;
|
||||
|
||||
$model->delete();
|
||||
if ($model->delete()) {
|
||||
|
||||
Yii::$app->pathology->setLog(
|
||||
'Delete',
|
||||
'ลบ Case: ' . $id_case,
|
||||
Yii::$app->user->getId(),
|
||||
CaseSurgical::tableName()
|
||||
);
|
||||
Yii::$app->pathology->setLog(
|
||||
'Delete',
|
||||
'ลบ Case: ' . $id_case,
|
||||
Yii::$app->user->getId(),
|
||||
CaseSurgical::tableName()
|
||||
);
|
||||
|
||||
// ตั้งค่า Flash Message
|
||||
Yii::$app->session->setFlash('success', 'ลบ Case ' . $id_case . ' เรียบร้อยแล้ว');
|
||||
} else {
|
||||
Yii::$app->session->setFlash('error', 'ไม่สามารถลบข้อมูลได้');
|
||||
}
|
||||
|
||||
return $this->redirect(['index']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Finds the CaseSurgical model based on its primary key value.
|
||||
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||
|
|
@ -214,4 +221,4 @@ class CaseSurgicalController extends Controller
|
|||
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,9 +86,30 @@ class CenterApproveController extends Controller
|
|||
{
|
||||
$model = $this->findModel($id);
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
Yii::$app->pathology->setLog('Update', 'แก้ไขสถานะ Center Approve: ' . $model->id_case, Yii::$app->user->getId(), CenterApprove::tableName());
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
if ($model->load(Yii::$app->request->post())) {
|
||||
|
||||
if ($model->save()) {
|
||||
|
||||
Yii::$app->pathology->setLog(
|
||||
'Update',
|
||||
'แก้ไขสถานะ Center Approve: ' . $model->id_case,
|
||||
Yii::$app->user->getId(),
|
||||
CenterApprove::tableName()
|
||||
);
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'success',
|
||||
'อัปเดตสถานะ Center Approve ของ Case ' . $model->id_case . ' เรียบร้อยแล้ว'
|
||||
);
|
||||
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
} else {
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'error',
|
||||
'ไม่สามารถบันทึกข้อมูลได้ กรุณาตรวจสอบความถูกต้องอีกครั้ง'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render('update', [
|
||||
|
|
@ -109,7 +130,6 @@ class CenterApproveController extends Controller
|
|||
|
||||
return $this->redirect(['index']);
|
||||
}*/
|
||||
|
||||
public function actionDelete($id)
|
||||
{
|
||||
$model = $this->findModel($id);
|
||||
|
|
@ -117,14 +137,26 @@ class CenterApproveController extends Controller
|
|||
// เก็บ id_case ไว้ก่อนลบ
|
||||
$id_case = $model->id_case;
|
||||
|
||||
$model->delete();
|
||||
if ($model->delete()) {
|
||||
|
||||
Yii::$app->pathology->setLog(
|
||||
'Delete',
|
||||
'ลบรายการ Center Approve: ' . $id_case,
|
||||
Yii::$app->user->getId(),
|
||||
CenterApprove::tableName()
|
||||
);
|
||||
Yii::$app->pathology->setLog(
|
||||
'Delete',
|
||||
'ลบรายการ Center Approve: ' . $id_case,
|
||||
Yii::$app->user->getId(),
|
||||
CenterApprove::tableName()
|
||||
);
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'success',
|
||||
'ลบรายการ Center Approve ของ Case: ' . $id_case . ' เรียบร้อยแล้ว'
|
||||
);
|
||||
} else {
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'error',
|
||||
'ไม่สามารถลบข้อมูลได้ กรุณาลองใหม่อีกครั้ง'
|
||||
);
|
||||
}
|
||||
|
||||
return $this->redirect(['index']);
|
||||
}
|
||||
|
|
@ -144,4 +176,4 @@ class CenterApproveController extends Controller
|
|||
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -86,9 +86,30 @@ class CytoNonGynDiagnosisController extends Controller
|
|||
{
|
||||
$model = $this->findModel($id);
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
Yii::$app->pathology->setLog('Update', 'แก้ไขสถานะ Non-Gyn Diagnosis: ' . $model->id_case, Yii::$app->user->getId(), CytoNonGynDiagnosis::tableName());
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
if ($model->load(Yii::$app->request->post())) {
|
||||
|
||||
if ($model->save()) {
|
||||
|
||||
Yii::$app->pathology->setLog(
|
||||
'Update',
|
||||
'แก้ไขสถานะ Non-Gyn Diagnosis: ' . $model->id_case,
|
||||
Yii::$app->user->getId(),
|
||||
CytoNonGynDiagnosis::tableName()
|
||||
);
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'success',
|
||||
'อัปเดตสถานะ Non-Gyn Diagnosis ของ Case ' . $model->id_case . ' เรียบร้อยแล้ว'
|
||||
);
|
||||
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
} else {
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'error',
|
||||
'ไม่สามารถบันทึกข้อมูลได้ กรุณาตรวจสอบความถูกต้องอีกครั้ง'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render('update', [
|
||||
|
|
@ -117,14 +138,35 @@ class CytoNonGynDiagnosisController extends Controller
|
|||
// เก็บ id_case ไว้ก่อนลบ
|
||||
$id_case = $model->id_case;
|
||||
|
||||
$model->delete();
|
||||
try {
|
||||
|
||||
Yii::$app->pathology->setLog(
|
||||
'Delete',
|
||||
'ลบ Non-Gyn Diagnosis: ' . $id_case,
|
||||
Yii::$app->user->getId(),
|
||||
CytoNonGynDiagnosis::tableName()
|
||||
);
|
||||
if ($model->delete()) {
|
||||
|
||||
Yii::$app->pathology->setLog(
|
||||
'Delete',
|
||||
'ลบ Non-Gyn Diagnosis: ' . $id_case,
|
||||
Yii::$app->user->getId(),
|
||||
CytoNonGynDiagnosis::tableName()
|
||||
);
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'success',
|
||||
'ลบ Non-Gyn Diagnosis ของ Case ' . $id_case . ' เรียบร้อยแล้ว'
|
||||
);
|
||||
} else {
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'error',
|
||||
'ไม่สามารถลบข้อมูลได้'
|
||||
);
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'error',
|
||||
'ไม่สามารถลบข้อมูลได้ อาจมีข้อมูลที่เกี่ยวข้องอยู่ในระบบ'
|
||||
);
|
||||
}
|
||||
|
||||
return $this->redirect(['index']);
|
||||
}
|
||||
|
|
@ -144,4 +186,4 @@ class CytoNonGynDiagnosisController extends Controller
|
|||
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -86,9 +86,30 @@ class CytoPapDiagnosisController extends Controller
|
|||
{
|
||||
$model = $this->findModel($id);
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
Yii::$app->pathology->setLog('Update', 'แก้ไขสถานะ Gyn Diagnosis: ' . $model->id_case, Yii::$app->user->getId(), CytoPapDiagnosis::tableName());
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
if ($model->load(Yii::$app->request->post())) {
|
||||
|
||||
if ($model->save()) {
|
||||
|
||||
Yii::$app->pathology->setLog(
|
||||
'Update',
|
||||
'แก้ไขสถานะ Gyn Diagnosis: ' . $model->id_case,
|
||||
Yii::$app->user->getId(),
|
||||
CytoPapDiagnosis::tableName()
|
||||
);
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'success',
|
||||
'อัปเดตสถานะ Gyn Diagnosis ของ Case: ' . $model->id_case . ' เรียบร้อยแล้ว'
|
||||
);
|
||||
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
} else {
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'error',
|
||||
'ไม่สามารถบันทึกข้อมูลได้ กรุณาตรวจสอบความถูกต้องอีกครั้ง'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render('update', [
|
||||
|
|
@ -117,14 +138,35 @@ class CytoPapDiagnosisController extends Controller
|
|||
// เก็บ id_case ไว้ก่อนลบ
|
||||
$id_case = $model->id_case;
|
||||
|
||||
$model->delete();
|
||||
try {
|
||||
|
||||
Yii::$app->pathology->setLog(
|
||||
'Delete',
|
||||
'ลบ Surgical Diagnosis: ' . $id_case,
|
||||
Yii::$app->user->getId(),
|
||||
CytoPapDiagnosis::tableName()
|
||||
);
|
||||
if ($model->delete()) {
|
||||
|
||||
Yii::$app->pathology->setLog(
|
||||
'Delete',
|
||||
'ลบ Gyn Diagnosis: ' . $id_case,
|
||||
Yii::$app->user->getId(),
|
||||
CytoPapDiagnosis::tableName()
|
||||
);
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'success',
|
||||
'ลบ Gyn Diagnosis ของ Case: ' . $id_case . ' เรียบร้อยแล้ว'
|
||||
);
|
||||
} else {
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'error',
|
||||
'ไม่สามารถลบข้อมูลได้'
|
||||
);
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'error',
|
||||
'ไม่สามารถลบข้อมูลได้ อาจมีข้อมูลที่เกี่ยวข้องอยู่ในระบบ'
|
||||
);
|
||||
}
|
||||
|
||||
return $this->redirect(['index']);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,14 +3,10 @@
|
|||
namespace frontend\modules\administrator\controllers;
|
||||
|
||||
use Yii;
|
||||
use yii\base\Exception;
|
||||
use yii\web\Controller;
|
||||
use yii\filters\VerbFilter;
|
||||
use common\models\PatientCase;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use common\models\ConstServiceCharge;
|
||||
use common\models\FinanceServiceCharge;
|
||||
use common\models\StainingOutlab;
|
||||
use frontend\modules\administrator\models\FinanceServiceChargeSearch;
|
||||
|
||||
/**
|
||||
|
|
@ -33,87 +29,6 @@ class FinanceServiceChargeController extends Controller
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|\yii\web\Response
|
||||
* @throws Exception
|
||||
*/
|
||||
public function actionCharge()
|
||||
{
|
||||
$model = new CaseForm();
|
||||
$case = null;
|
||||
if ($model->load(Yii::$app->request->get())) {
|
||||
$case = Yii::$app->pathology->getCase($model->id_case);
|
||||
//$case = CaseSurgical::findOne(['id_case' => $model->id_case]); //'status_id' => 1,
|
||||
|
||||
$model->items = FinanceServiceCharge::find()->where(['id_case' => $case->id_case])->all();
|
||||
|
||||
$time_now = date('Y-m-d H:i:s');
|
||||
|
||||
try {
|
||||
$items = Yii::$app->request->post();
|
||||
|
||||
//var_dump($items['SurgicalOperate']['items']);
|
||||
//die();
|
||||
|
||||
if (isset($items['CaseForm']['items']) && count($items['CaseForm']['items']) > 0) {
|
||||
//var_dump($items['CaseForm']['items']);
|
||||
//die();
|
||||
|
||||
foreach ($items['CaseForm']['items'] as $key => $val) {
|
||||
//var_dump($val['charge_id']);
|
||||
//die();
|
||||
if (empty($val['id'])) {
|
||||
$finance = new FinanceServiceCharge();
|
||||
} else {
|
||||
$finance = FinanceServiceCharge::findOne($val['id']);
|
||||
}
|
||||
$finance->id_case = $case->id_case;
|
||||
$finance->hospital_id = $case->hospital_id;
|
||||
$finance->charge_id = $val['charge_id'];
|
||||
//หาราคา
|
||||
$charge = ConstServiceCharge::findOne($val['charge_id']);
|
||||
|
||||
$finance->price = Yii::$app->pathology->getHosPrice($case->hospital_id, $val['charge_id']); //$price->price;
|
||||
$finance->df = Yii::$app->pathology->getHosDF($case->hospital_id, $val['charge_id']);
|
||||
$finance->is_cash = 0;
|
||||
$finance->occur_at = $time_now;
|
||||
$finance->is_able = 0; //คิดเงิน
|
||||
if ($finance->save()) {
|
||||
|
||||
$staining_outlab = StainingOutlab::findOne(['id_case' => $finance->id_case]);
|
||||
|
||||
if (!$staining_outlab) {
|
||||
$staining_outlab = new StainingOutlab([
|
||||
'id_case' => $finance->id_case,
|
||||
'block_no' => '-',
|
||||
'sent_location' => $model->sent_location,
|
||||
'note' => '-',
|
||||
'sent_at' => date('Y-m-d H:i:s'),
|
||||
]);
|
||||
}
|
||||
|
||||
$staining_outlab->save();
|
||||
|
||||
Yii::$app->session->addFlash('success', 'เพิ่มรายการตรวจ ' . (isset($charge) ? $charge->name : '') . ' แล้ว');
|
||||
} else {
|
||||
Yii::$app->session->addFlash('error', 'เพิ่มรายการตรวจ ' . (isset($charge) ? $charge->name : '') . ' ไม่ได้');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//return $this->redirect(['charge', 'CaseForm[id_case]' => $case->id_case]);
|
||||
return $this->redirect(['charge']);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
throw new Exception($e->getMessage());
|
||||
}
|
||||
}
|
||||
return $this->render('charge', [
|
||||
'model' => $model,
|
||||
'case' => $case,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @throws \Throwable
|
||||
|
|
@ -122,8 +37,6 @@ class FinanceServiceChargeController extends Controller
|
|||
public function actionFinanceServiceChargeDelete()
|
||||
{
|
||||
$p = Yii::$app->request->post();
|
||||
//var_dump($p);
|
||||
//die();
|
||||
$finance = FinanceServiceCharge::findOne(['id_case' => $p['id_case'], 'id' => $p['from_id']]);
|
||||
|
||||
if (!$finance) { // || !$surgical
|
||||
|
|
@ -134,7 +47,6 @@ class FinanceServiceChargeController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Lists all FinanceServiceCharge models.
|
||||
* @return mixed
|
||||
|
|
@ -164,38 +76,7 @@ class FinanceServiceChargeController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a new FinanceServiceCharge model.
|
||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionCreate()
|
||||
{
|
||||
$model = new FinanceServiceCharge();
|
||||
|
||||
if ($model->load(Yii::$app->request->post())) {
|
||||
|
||||
$case = PatientCase::findOne(['id_case' => $model->id_case]);
|
||||
if (!$case) {
|
||||
throw new Exception('ไม่พบ Case ที่ค้นหา');
|
||||
}
|
||||
$model->price = Yii::$app->pathology->getHosPrice($case->hospital_id, $model->charge_id); //$price->price;
|
||||
$model->df = Yii::$app->pathology->getHosDF($case->hospital_id, $model->charge_id);
|
||||
$model->occur_at = date('Y-m-d H:i:s');
|
||||
if ($model->save()) {
|
||||
Yii::$app->pathology->financeApiSendByCase($model->id_case);
|
||||
Yii::$app->session->setFlash('success', 'บันทึกข้อมูลเรียบร้อย');
|
||||
}
|
||||
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
}
|
||||
|
||||
return $this->render('create', [
|
||||
'model' => $model,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an existing FinanceServiceCharge model.
|
||||
* Updates an existing CaseSurgical model.
|
||||
* If update is successful, the browser will be redirected to the 'view' page.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
|
|
@ -207,19 +88,28 @@ class FinanceServiceChargeController extends Controller
|
|||
|
||||
if ($model->load(Yii::$app->request->post())) {
|
||||
|
||||
$case = PatientCase::findOne(['id_case' => $model->id_case]);
|
||||
if (!$case) {
|
||||
throw new Exception('ไม่พบ Case ที่ค้นหา');
|
||||
}
|
||||
$model->price = Yii::$app->pathology->getHosPrice($case->hospital_id, $model->charge_id); //$price->price;
|
||||
$model->df = Yii::$app->pathology->getHosDF($case->hospital_id, $model->charge_id);
|
||||
$model->occur_at = date('Y-m-d H:i:s');
|
||||
if ($model->save()) {
|
||||
Yii::$app->pathology->financeApiSendByCase($model->id_case);
|
||||
Yii::$app->session->setFlash('success', 'บันทึกข้อมูลเรียบร้อย');
|
||||
}
|
||||
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
Yii::$app->pathology->setLog(
|
||||
'Update',
|
||||
'แก้ไข ID Case และ Status: ' . $model->id_case,
|
||||
Yii::$app->user->getId(),
|
||||
FinanceServiceCharge::tableName()
|
||||
);
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'success',
|
||||
'บันทึกการแก้ไขข้อมูลค่าบริการของ Case: ' . $model->id_case . ' เรียบร้อยแล้ว'
|
||||
);
|
||||
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
} else {
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'error',
|
||||
'ไม่สามารถบันทึกข้อมูลได้ กรุณาตรวจสอบความถูกต้องอีกครั้ง'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render('update', [
|
||||
|
|
@ -237,31 +127,46 @@ class FinanceServiceChargeController extends Controller
|
|||
public function actionDelete($id)
|
||||
{
|
||||
$model = $this->findModel($id);
|
||||
if ($model->delete()) {
|
||||
//Yii::$app->pathology->financeApiSendByCase($model->id_case);
|
||||
Yii::$app->pathology->setLog(
|
||||
'Delete',
|
||||
'ลบ Finance Service Charge: ' . $model->id_case,
|
||||
Yii::$app->user->getId(),
|
||||
FinanceServiceCharge::tableName()
|
||||
|
||||
// เก็บ id_case ไว้ก่อนลบ (กันค่า null หลัง delete)
|
||||
$id_case = $model->id_case;
|
||||
|
||||
try {
|
||||
|
||||
if ($model->delete()) {
|
||||
|
||||
// ถ้าต้องการเรียก API หลังลบ
|
||||
// Yii::$app->pathology->financeApiSendByCase($id_case);
|
||||
|
||||
Yii::$app->pathology->setLog(
|
||||
'Delete',
|
||||
'ลบ Finance Service Charge: ' . $id_case,
|
||||
Yii::$app->user->getId(),
|
||||
FinanceServiceCharge::tableName()
|
||||
);
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'success',
|
||||
'ลบข้อมูล Finance Service Charge ของ Case: ' . $id_case . ' เรียบร้อยแล้ว'
|
||||
);
|
||||
} else {
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'error',
|
||||
'ไม่สามารถลบข้อมูลได้'
|
||||
);
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'error',
|
||||
'ไม่สามารถลบข้อมูลได้ อาจมีข้อมูลที่เกี่ยวข้องอยู่ในระบบ'
|
||||
);
|
||||
Yii::$app->session->setFlash('ลบข้อมูลเรียบร้อยแล้ว');
|
||||
}
|
||||
|
||||
return $this->redirect(['index']);
|
||||
}
|
||||
|
||||
/*public function actionDelete($id)
|
||||
{
|
||||
$model = $this->findModel($id);
|
||||
if ($model->delete()) {
|
||||
Yii::$app->pathology->financeApiSendByCase($model->id_case);
|
||||
Yii::$app->session->setFlash('ลบข้อมูลเรียบร้อยแล้ว');
|
||||
}
|
||||
|
||||
return $this->redirect(['index']);
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Finds the FinanceServiceCharge model based on its primary key value.
|
||||
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||
|
|
@ -277,4 +182,4 @@ class FinanceServiceChargeController extends Controller
|
|||
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -86,9 +86,30 @@ class FrozenDiagnosisController extends Controller
|
|||
{
|
||||
$model = $this->findModel($id);
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
Yii::$app->pathology->setLog('Update', 'แก้ไขสถานะ Frozen Diagnosis: ' . $model->id_case, Yii::$app->user->getId(), FrozenDiagnosis::tableName());
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
if ($model->load(Yii::$app->request->post())) {
|
||||
|
||||
if ($model->save()) {
|
||||
|
||||
Yii::$app->pathology->setLog(
|
||||
'Update',
|
||||
'แก้ไขสถานะ Frozen Diagnosis: ' . $model->id_case,
|
||||
Yii::$app->user->getId(),
|
||||
FrozenDiagnosis::tableName()
|
||||
);
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'success',
|
||||
'อัปเดตสถานะ Frozen Diagnosis ของ Case: ' . $model->id_case . ' เรียบร้อยแล้ว'
|
||||
);
|
||||
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
} else {
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'error',
|
||||
'ไม่สามารถบันทึกข้อมูลได้ กรุณาตรวจสอบความถูกต้องอีกครั้ง'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render('update', [
|
||||
|
|
@ -96,6 +117,7 @@ class FrozenDiagnosisController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deletes an existing FrozenDiagnosis model.
|
||||
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||
|
|
@ -109,7 +131,6 @@ class FrozenDiagnosisController extends Controller
|
|||
|
||||
return $this->redirect(['index']);
|
||||
}*/
|
||||
|
||||
public function actionDelete($id)
|
||||
{
|
||||
$model = $this->findModel($id);
|
||||
|
|
@ -117,14 +138,35 @@ class FrozenDiagnosisController extends Controller
|
|||
// เก็บ id_case ไว้ก่อนลบ
|
||||
$id_case = $model->id_case;
|
||||
|
||||
$model->delete();
|
||||
try {
|
||||
|
||||
Yii::$app->pathology->setLog(
|
||||
'Delete',
|
||||
'ลบ Frozen Diagnosis: ' . $id_case,
|
||||
Yii::$app->user->getId(),
|
||||
FrozenDiagnosis::tableName()
|
||||
);
|
||||
if ($model->delete()) {
|
||||
|
||||
Yii::$app->pathology->setLog(
|
||||
'Delete',
|
||||
'ลบ Frozen Diagnosis: ' . $id_case,
|
||||
Yii::$app->user->getId(),
|
||||
FrozenDiagnosis::tableName()
|
||||
);
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'success',
|
||||
'ลบ Frozen Diagnosis Case: ' . $id_case . ' เรียบร้อยแล้ว'
|
||||
);
|
||||
} else {
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'error',
|
||||
'ไม่สามารถลบข้อมูลได้'
|
||||
);
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'error',
|
||||
'ไม่สามารถลบข้อมูลได้ อาจมีข้อมูลที่เกี่ยวข้องอยู่ในระบบ'
|
||||
);
|
||||
}
|
||||
|
||||
return $this->redirect(['index']);
|
||||
}
|
||||
|
|
@ -144,4 +186,4 @@ class FrozenDiagnosisController extends Controller
|
|||
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -86,9 +86,30 @@ class HospitalImportController extends Controller
|
|||
{
|
||||
$model = $this->findModel($id);
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
Yii::$app->pathology->setLog('Update', 'แก้ไข ID CASE' . $model->id_case, Yii::$app->user->getId(), HospitalImport::tableName());
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
if ($model->load(Yii::$app->request->post())) {
|
||||
|
||||
if ($model->save()) {
|
||||
|
||||
Yii::$app->pathology->setLog(
|
||||
'Update',
|
||||
'แก้ไข ID CASE ' . $model->id_case,
|
||||
Yii::$app->user->getId(),
|
||||
HospitalImport::tableName()
|
||||
);
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'success',
|
||||
'บันทึกการแก้ไขข้อมูล Case: ' . $model->id_case . ' เรียบร้อยแล้ว'
|
||||
);
|
||||
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
} else {
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'error',
|
||||
'ไม่สามารถบันทึกข้อมูลได้ กรุณาตรวจสอบข้อมูลอีกครั้ง'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render('update', [
|
||||
|
|
@ -97,19 +118,12 @@ class HospitalImportController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Deletes an existing HospitalImport model.
|
||||
* Deletes an existing HisRequest model.
|
||||
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
* @throws NotFoundHttpException if the model cannot be found
|
||||
*/
|
||||
/*public function actionDelete($id)
|
||||
{
|
||||
$this->findModel($id)->delete();
|
||||
|
||||
return $this->redirect(['index']);
|
||||
}*/
|
||||
|
||||
public function actionDelete($id)
|
||||
{
|
||||
$model = $this->findModel($id);
|
||||
|
|
@ -117,14 +131,35 @@ class HospitalImportController extends Controller
|
|||
// เก็บ id_case ไว้ก่อนลบ
|
||||
$id_case = $model->id_case;
|
||||
|
||||
$model->delete();
|
||||
try {
|
||||
|
||||
Yii::$app->pathology->setLog(
|
||||
'Delete',
|
||||
'ลบ Hospital Import: ' . $id_case,
|
||||
Yii::$app->user->getId(),
|
||||
HospitalImport::tableName()
|
||||
);
|
||||
if ($model->delete()) {
|
||||
|
||||
Yii::$app->pathology->setLog(
|
||||
'Delete',
|
||||
'ลบ Hospital Import: ' . $id_case,
|
||||
Yii::$app->user->getId(),
|
||||
HospitalImport::tableName()
|
||||
);
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'success',
|
||||
'ลบข้อมูล Hospital Import ของ Case: ' . $id_case . ' เรียบร้อยแล้ว'
|
||||
);
|
||||
} else {
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'error',
|
||||
'ไม่สามารถลบข้อมูลได้'
|
||||
);
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'error',
|
||||
'ไม่สามารถลบข้อมูลได้ อาจมีข้อมูลที่เกี่ยวข้องอยู่ในระบบ'
|
||||
);
|
||||
}
|
||||
|
||||
return $this->redirect(['index']);
|
||||
}
|
||||
|
|
@ -144,4 +179,4 @@ class HospitalImportController extends Controller
|
|||
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -86,9 +86,30 @@ class HospitalImportServiceChargeController extends Controller
|
|||
{
|
||||
$model = $this->findModel($id);
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
Yii::$app->pathology->setLog('Update', 'แก้ไข Hospital ImportService Charge' . $model->id_case, Yii::$app->user->getId(), HospitalImportServiceCharge::tableName());
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
if ($model->load(Yii::$app->request->post())) {
|
||||
|
||||
if ($model->save()) {
|
||||
|
||||
Yii::$app->pathology->setLog(
|
||||
'Update',
|
||||
'แก้ไข Hospital Import Service Charge: ' . $model->id_case,
|
||||
Yii::$app->user->getId(),
|
||||
HospitalImportServiceCharge::tableName()
|
||||
);
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'success',
|
||||
'บันทึกการแก้ไข Hospital Import Service Charge ของ Case: ' . $model->id_case . ' เรียบร้อยแล้ว'
|
||||
);
|
||||
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
} else {
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'error',
|
||||
'ไม่สามารถบันทึกข้อมูลได้ กรุณาตรวจสอบข้อมูลอีกครั้ง'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render('update', [
|
||||
|
|
@ -109,22 +130,33 @@ class HospitalImportServiceChargeController extends Controller
|
|||
|
||||
return $this->redirect(['index']);
|
||||
}*/
|
||||
|
||||
public function actionDelete($id)
|
||||
{
|
||||
$model = $this->findModel($id);
|
||||
|
||||
// เก็บ id_case ไว้ก่อนลบ
|
||||
$id_case = $model->id_case;
|
||||
// เก็บ req_no ไว้ก่อนลบ
|
||||
$req_no = $model->req_no;
|
||||
|
||||
$model->delete();
|
||||
if ($model->delete()) {
|
||||
|
||||
Yii::$app->pathology->setLog(
|
||||
'Delete',
|
||||
'ลบ Hospital Import Service Charge ' . $id_case,
|
||||
Yii::$app->user->getId(),
|
||||
HospitalImportServiceCharge::tableName()
|
||||
);
|
||||
Yii::$app->pathology->setLog(
|
||||
'Delete',
|
||||
'ลบรายการตรวจ: ' . $req_no,
|
||||
Yii::$app->user->getId(),
|
||||
HospitalImportServiceCharge::tableName()
|
||||
);
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'success',
|
||||
'ลบรายการตรวจของ Request Number: ' . $req_no . ' เรียบร้อยแล้ว'
|
||||
);
|
||||
} else {
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'error',
|
||||
'ไม่สามารถลบข้อมูลได้ อาจมีข้อมูลที่เกี่ยวข้องอยู่ในระบบ'
|
||||
);
|
||||
}
|
||||
|
||||
return $this->redirect(['index']);
|
||||
}
|
||||
|
|
@ -144,4 +176,4 @@ class HospitalImportServiceChargeController extends Controller
|
|||
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -86,9 +86,30 @@ class SurgicalDiagnosisController extends Controller
|
|||
{
|
||||
$model = $this->findModel($id);
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
Yii::$app->pathology->setLog('Update', 'แก้ไขสถานะ Surgical Diagnosis: ' . $model->id_case, Yii::$app->user->getId(), SurgicalDiagnosis::tableName());
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
if ($model->load(Yii::$app->request->post())) {
|
||||
|
||||
if ($model->save()) {
|
||||
|
||||
Yii::$app->pathology->setLog(
|
||||
'Update',
|
||||
'แก้ไขสถานะ Surgical Diagnosis: ' . $model->id_case,
|
||||
Yii::$app->user->getId(),
|
||||
SurgicalDiagnosis::tableName()
|
||||
);
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'success',
|
||||
'อัปเดตสถานะ Surgical Diagnosis ของ Case: ' . $model->id_case . ' เรียบร้อยแล้ว'
|
||||
);
|
||||
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
} else {
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'error',
|
||||
'ไม่สามารถบันทึกข้อมูลได้ กรุณาตรวจสอบความถูกต้องอีกครั้ง'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render('update', [
|
||||
|
|
@ -109,7 +130,6 @@ class SurgicalDiagnosisController extends Controller
|
|||
|
||||
return $this->redirect(['index']);
|
||||
}*/
|
||||
|
||||
public function actionDelete($id)
|
||||
{
|
||||
$model = $this->findModel($id);
|
||||
|
|
@ -117,14 +137,35 @@ class SurgicalDiagnosisController extends Controller
|
|||
// เก็บ id_case ไว้ก่อนลบ
|
||||
$id_case = $model->id_case;
|
||||
|
||||
$model->delete();
|
||||
try {
|
||||
|
||||
Yii::$app->pathology->setLog(
|
||||
'Delete',
|
||||
'ลบ Surgical Diagnosis: ' . $id_case,
|
||||
Yii::$app->user->getId(),
|
||||
SurgicalDiagnosis::tableName()
|
||||
);
|
||||
if ($model->delete()) {
|
||||
|
||||
Yii::$app->pathology->setLog(
|
||||
'Delete',
|
||||
'ลบ Surgical Diagnosis: ' . $id_case,
|
||||
Yii::$app->user->getId(),
|
||||
SurgicalDiagnosis::tableName()
|
||||
);
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'success',
|
||||
'ลบ Surgical Diagnosis Case: ' . $id_case . ' เรียบร้อยแล้ว'
|
||||
);
|
||||
} else {
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'error',
|
||||
'ไม่สามารถลบข้อมูลได้'
|
||||
);
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
|
||||
Yii::$app->session->setFlash(
|
||||
'error',
|
||||
'ไม่สามารถลบข้อมูลได้ อาจมีข้อมูลที่เกี่ยวข้องอยู่ในระบบ'
|
||||
);
|
||||
}
|
||||
|
||||
return $this->redirect(['index']);
|
||||
}
|
||||
|
|
@ -144,4 +185,4 @@ class SurgicalDiagnosisController extends Controller
|
|||
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
use common\models\CaseSurgical;
|
||||
use common\models\ConstStatus;
|
||||
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
<?php
|
||||
|
||||
use common\models\ConstServiceCharge;
|
||||
use kartik\select2\Select2;
|
||||
use yii\bootstrap5\ActiveForm;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\helpers\Html;
|
||||
|
||||
|
||||
|
|
@ -12,31 +9,18 @@ use yii\helpers\Html;
|
|||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="finance-service-charge-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'id_case')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'charge_id')->widget(Select2::class, [
|
||||
'theme' => Select2::THEME_BOOTSTRAP,
|
||||
'data' => ArrayHelper::map(ConstServiceCharge::find()->where(['status' => 1])->all(), 'id', function ($model) {
|
||||
return $model->code . '-' . $model->name;
|
||||
}),
|
||||
]) ?>
|
||||
|
||||
<?php //= $form->field($model, 'is_cash')->checkbox()
|
||||
?>
|
||||
|
||||
<?php //= $form->field($model, 'is_able')->checkbox()
|
||||
?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton($model->isNewRecord ? 'เพิ่มข้อมูล' : 'แก้ไข', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||
<?= Html::a('กลับ', ['index', 'id' => $model->id], ['class' => 'btn btn-info']) ?>
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<?= $form->field($model, 'id_case')->textInput(['maxlength' => true]) ?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<?= $form->field($model, 'req_no')->textInput(['maxlength' => true, 'readonly' => true]) ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('<i class="ri-save-line"></i> บันทึกข้อมูล', ['class' => 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
|
@ -35,10 +35,16 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||
'class' => 'yii\grid\ActionColumn',
|
||||
'headerOptions' => ['class' => 'custom-action-column-header'],
|
||||
'contentOptions' => ['class' => 'custom-action-column'],
|
||||
'template' => '{delete}', // Customize buttons if needed
|
||||
'template' => '{update} {delete}', // Customize buttons if needed
|
||||
'buttons' => [
|
||||
'update' => function ($url, $model, $key) {
|
||||
return Html::a('<i class="ri-edit-box-line"></i> แก้ไข ID CASE', $url, [
|
||||
'title' => Yii::t('app', 'Update'),
|
||||
'class' => 'btn btn-info btn-sm'
|
||||
]);
|
||||
},
|
||||
'delete' => function ($url, $model, $key) {
|
||||
return Html::a('<i class="ri-delete-bin-line"></i> ลบ Case', $url, [
|
||||
return Html::a('<i class="ri-delete-bin-line"></i> ลบรายการตรวจ', $url, [
|
||||
'title' => Yii::t('app', 'Delete'),
|
||||
'data-confirm' => Yii::t('app', 'คุณแน่ใจว่าต้องการลบรายการนี้หรือไม่ ?'),
|
||||
'data-method' => 'post',
|
||||
|
|
|
|||
|
|
@ -5,26 +5,19 @@ use yii\helpers\Html;
|
|||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\FinanceServiceCharge */
|
||||
|
||||
$this->title = 'Update Finance Service Charge: ' . $model->id;
|
||||
$this->title = 'แก้ไข Finance Service Charge: ' . $model->id_case;
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Finance Service Charges', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->id_case, 'url' => ['view', 'id' => $model->id]];
|
||||
$this->params['breadcrumbs'][] = 'แก้ไข';
|
||||
?>
|
||||
<div class="finance-service-charge-update">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="card-title"></h4>
|
||||
|
||||
<div class="heading-elements">
|
||||
<ul class="list-inline mb-0">
|
||||
<li><a data-action="expand"><i class="ft-maximize"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
<div class="card md-3">
|
||||
<div class="card-header d-flex align-items-center justify-content-between">
|
||||
<h5 class="card-title"><i class="ri-file-edit-line"></i> <?= $this->title ?></h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -6,47 +6,29 @@ use yii\widgets\DetailView;
|
|||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\FinanceServiceCharge */
|
||||
|
||||
$this->title = $model->id;
|
||||
$this->title = $model->id_case;
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Finance Service Charges', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
\yii\web\YiiAsset::register($this);
|
||||
?>
|
||||
<div class="finance-service-charge-view">
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="card-title"><?= Html::encode($this->title) ?></h4>
|
||||
|
||||
<div class="heading-elements">
|
||||
<ul class="list-inline mb-0">
|
||||
<li><?= Html::a('แก้ไข', ['update', 'id' => $model->id], ['class' => 'btn btn-sm btn-warning']) ?></li>
|
||||
<li><?= Html::a('กลับ', ['index', 'id' => $model->id], ['class' => 'btn btn-sm btn-info']) ?></li>
|
||||
<li><a data-action="expand"><i class="ft-maximize"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
<?= DetailView::widget([
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
'id',
|
||||
'from_id',
|
||||
'id_case',
|
||||
'hospital_id',
|
||||
'charge_id',
|
||||
'price',
|
||||
'df',
|
||||
'is_cash',
|
||||
'occur_at',
|
||||
'is_able',
|
||||
'is_ready',
|
||||
],
|
||||
]) ?>
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header d-flex align-items-center justify-content-between">
|
||||
<h5 class="card-title"><i class="ri-file-text-line"></i> <?= Html::encode($this->title) ?></h5>
|
||||
<div class="d-flex gap-2 justify-content-end mt-4">
|
||||
<?= Html::a('<i class="ri-edit-box-line"></i> แก้ไข ID CASE', ['update', 'id' => $model->id], ['class' => 'btn btn-warning']) ?>
|
||||
<?= Html::a('<i class="ri-arrow-left-box-line"></i> กลับหน้าหลัก', ['index', 'id' => $model->id], ['class' => 'btn btn-info']) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<?= DetailView::widget([
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
'id_case',
|
||||
'req_no',
|
||||
],
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -186,7 +186,7 @@ class ReportLogController extends Controller
|
|||
]);
|
||||
}*/
|
||||
|
||||
public function actionLogReportView(
|
||||
/*public function actionLogReportView(
|
||||
$id_case,
|
||||
$report_type,
|
||||
$id,
|
||||
|
|
@ -246,7 +246,8 @@ class ReportLogController extends Controller
|
|||
$diagnoses = $modelClass::find()
|
||||
->where([
|
||||
'id_case' => $id_case,
|
||||
'report_type' => $report_type
|
||||
'report_type' => $report_type,
|
||||
'id' => $id
|
||||
])
|
||||
->all();
|
||||
|
||||
|
|
@ -279,6 +280,116 @@ class ReportLogController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
// =========================
|
||||
// 6. Render
|
||||
// =========================
|
||||
return $this->render('pdf', [
|
||||
'pdfUrl' => $pdfUrl,
|
||||
]);
|
||||
}*/
|
||||
|
||||
public function actionLogReportView(
|
||||
$id_case,
|
||||
$report_type,
|
||||
$id,
|
||||
$mode,
|
||||
$file,
|
||||
$pdf_type,
|
||||
$watermark = null
|
||||
) {
|
||||
|
||||
// =========================
|
||||
// 1. Save log
|
||||
// =========================
|
||||
$log = new ReportLog();
|
||||
$log->id_case = $id_case;
|
||||
$log->type = $report_type;
|
||||
$log->view_at = date('Y-m-d H:i:s');
|
||||
$log->view_by = Yii::$app->user->id;
|
||||
|
||||
if (!$log->save()) {
|
||||
Yii::error('Failed to save report log: ' . json_encode($log->errors));
|
||||
throw new \yii\web\ServerErrorHttpException('Failed to save report log');
|
||||
}
|
||||
|
||||
// =========================
|
||||
// 2. Default Fallback PDF Generator
|
||||
// =========================
|
||||
$pdfUrl = Url::to([
|
||||
'/report/case/' . $pdf_type . '-pdf',
|
||||
'id_case' => $id_case,
|
||||
'report_type' => $report_type,
|
||||
'id' => $id,
|
||||
'mode' => $mode,
|
||||
'file' => $file,
|
||||
'watermark' => $watermark
|
||||
]);
|
||||
|
||||
// =========================
|
||||
// 3. Map Case Type → Model
|
||||
// =========================
|
||||
$modelMap = [
|
||||
'surgical' => SurgicalDiagnosis::class,
|
||||
'pap' => CytoPapDiagnosis::class,
|
||||
'non-gyn' => CytoNonGynDiagnosis::class,
|
||||
'frozen' => FrozenDiagnosis::class,
|
||||
];
|
||||
|
||||
$caseType = Yii::$app->pathology->getCaseType($id_case);
|
||||
|
||||
if (!isset($modelMap[$caseType])) {
|
||||
return $this->render('pdf', ['pdfUrl' => $pdfUrl]);
|
||||
}
|
||||
|
||||
$modelClass = $modelMap[$caseType];
|
||||
|
||||
// =========================
|
||||
// 4. Load Diagnosis by ID (สำคัญมาก)
|
||||
// =========================
|
||||
$diagnosis = $modelClass::findOne([
|
||||
'id_case' => $id_case,
|
||||
'report_type' => $report_type,
|
||||
'id' => $id
|
||||
]);
|
||||
|
||||
if (!$diagnosis) {
|
||||
return $this->render('pdf', ['pdfUrl' => $pdfUrl]);
|
||||
}
|
||||
|
||||
// =========================
|
||||
// 5. Get Report Files
|
||||
// =========================
|
||||
if ($report_type === 'consult-outlab') {
|
||||
$reports = $diagnosis->getConsultReport();
|
||||
$basePath = $diagnosis->uploadConsultReportFolder;
|
||||
} else {
|
||||
$reports = $diagnosis->getReport();
|
||||
$basePath = $diagnosis->uploadReportFolder;
|
||||
}
|
||||
|
||||
if (!empty($reports)) {
|
||||
foreach ($reports as $value) {
|
||||
|
||||
$filePath = $basePath . '/' . $value;
|
||||
|
||||
if (!file_exists($filePath)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$ext = strtolower(pathinfo($filePath, PATHINFO_EXTENSION));
|
||||
|
||||
if ($ext === 'pdf') {
|
||||
$pdfUrl = Yii::getAlias('@web') . '/' . $filePath;
|
||||
break;
|
||||
}
|
||||
|
||||
// ถ้าเป็นรูป → ใช้ fallback generator
|
||||
if (in_array($ext, ['jpg', 'jpeg', 'png', 'gif'])) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// =========================
|
||||
// 6. Render
|
||||
// =========================
|
||||
|
|
@ -286,4 +397,4 @@ class ReportLogController extends Controller
|
|||
'pdfUrl' => $pdfUrl,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1083,14 +1083,6 @@ if (Yii::$app->user->can('administrator')) {
|
|||
'options' => ['class' => 'treeview'],
|
||||
'items' => [
|
||||
['label' => '<i class="ri-git-commit-fill"></i> Hospital Import', 'url' => ['/administrator/hospital-import/index']],
|
||||
],
|
||||
];
|
||||
|
||||
$menuItems[] = [
|
||||
'label' => '<i class="ri-draft-line"></i> Hospital Service Charge</span>',
|
||||
'url' => 'javascript:void()',
|
||||
'options' => ['class' => 'treeview'],
|
||||
'items' => [
|
||||
['label' => '<i class="ri-git-commit-fill"></i> Hospital Import Service Charge', 'url' => ['/administrator/hospital-import-service-charge/index']],
|
||||
],
|
||||
];
|
||||
|
|
@ -1100,26 +1092,14 @@ if (Yii::$app->user->can('administrator')) {
|
|||
'url' => 'javascript:void()',
|
||||
'options' => ['class' => 'treeview'],
|
||||
'items' => [
|
||||
['label' => '<i class="ri-git-commit-fill"></i> Finance Service Charges', 'url' => ['/administrator/finance-service-charge/index']],
|
||||
['label' => '<i class="ri-git-commit-fill"></i> จัดการ Case Surgical (S)', 'url' => ['/administrator/case-surgical/index']],
|
||||
['label' => '<i class="ri-git-commit-fill"></i> จัดการ Case Non Gyn (N)', 'url' => ['/administrator/case-non-gyn/index']],
|
||||
['label' => '<i class="ri-git-commit-fill"></i> จัดการ Case Gyn (C)', 'url' => ['/administrator/case-pap/index']],
|
||||
['label' => '<i class="ri-git-commit-fill"></i> จัดการ Case Frozen (F)', 'url' => ['/administrator/case-frozen/index']],
|
||||
//['label' => '<i class="ri-git-commit-fill"></i> จัดการ Case Autopsy (A)', 'url' => ['/administrator/case-autopsy/index']],
|
||||
//['label' => '<i class="ri-git-commit-fill"></i> จัดการ Case HPV (H)', 'url' => ['/administrator/case-hpv/index']],
|
||||
],
|
||||
];
|
||||
|
||||
$menuItems[] = [
|
||||
'label' => '<i class="ri-draft-line"></i> Finance Service Charges</span>',
|
||||
'url' => 'javascript:void()',
|
||||
'options' => ['class' => 'treeview'],
|
||||
'items' => [
|
||||
['label' => '<i class="ri-git-commit-fill"></i> Finance Service Charges', 'url' => ['/administrator/finance-service-charge/index']],
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
|
||||
$menuItems[] = [
|
||||
'label' => '<i class="ri-draft-line"></i> Manage Diagnosis</span>',
|
||||
'url' => 'javascript:void()',
|
||||
|
|
@ -1141,7 +1121,6 @@ if (Yii::$app->user->can('administrator')) {
|
|||
],
|
||||
];
|
||||
|
||||
|
||||
// Administrator
|
||||
$menuItems[] = [
|
||||
'label' => '<i class="ri-group-2-line"></i> <span class="menu-text"> ผู้ใช้งาน</span>',
|
||||
|
|
|
|||
Loading…
Reference in New Issue