Fix profile master data loading and remove city_auto_u migration
This commit is contained in:
parent
14a5a4e79a
commit
f4891c0bb4
|
|
@ -3291,10 +3291,10 @@ class Opd_prescription extends BaseController
|
||||||
return view('billing/opd_invest_profile_master_workspace');
|
return view('billing/opd_invest_profile_master_workspace');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function opd_invest_profile_master_list()
|
private function buildInvestigationProfileRows(string $filter = ''): array
|
||||||
{
|
{
|
||||||
if (! $this->db->tableExists('invprofiles') || ! $this->db->tableExists('invtprofiles') || ! $this->db->tableExists('investigation')) {
|
if (! $this->db->tableExists('invprofiles') || ! $this->db->tableExists('invtprofiles') || ! $this->db->tableExists('investigation')) {
|
||||||
return $this->response->setJSON(['rows' => []]);
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$pFields = $this->db->getFieldNames('invprofiles');
|
$pFields = $this->db->getFieldNames('invprofiles');
|
||||||
|
|
@ -3310,11 +3310,9 @@ class Opd_prescription extends BaseController
|
||||||
$iName = $this->resolveFirstField($iFields, ['Name', 'name']);
|
$iName = $this->resolveFirstField($iFields, ['Name', 'name']);
|
||||||
|
|
||||||
if ($pCode === null || $pName === null || $jProfileCode === null || $jInvestCode === null || $iCode === null || $iName === null) {
|
if ($pCode === null || $pName === null || $jProfileCode === null || $jInvestCode === null || $iCode === null || $iName === null) {
|
||||||
return $this->response->setJSON(['rows' => []]);
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$filter = trim((string) $this->request->getGet('filter'));
|
|
||||||
|
|
||||||
$sql = 'SELECT '
|
$sql = 'SELECT '
|
||||||
. 'p.`' . $pCode . '` AS profile_code, '
|
. 'p.`' . $pCode . '` AS profile_code, '
|
||||||
. 'p.`' . $pName . '` AS profile_name, '
|
. 'p.`' . $pName . '` AS profile_name, '
|
||||||
|
|
@ -3360,13 +3358,20 @@ class Opd_prescription extends BaseController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->response->setJSON(['rows' => array_values($map)]);
|
return array_values($map);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function opd_invest_profile_master_list()
|
||||||
|
{
|
||||||
|
$filter = trim((string) $this->request->getGet('filter'));
|
||||||
|
|
||||||
|
return $this->response->setJSON(['rows' => $this->buildInvestigationProfileRows($filter)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function opd_invest_profile_master_data()
|
public function opd_invest_profile_master_data()
|
||||||
{
|
{
|
||||||
$rows = $this->opd_invest_profile_master_list()->getJSON(true);
|
$filter = trim((string) $this->request->getGet('filter'));
|
||||||
$list = $rows['rows'] ?? [];
|
$list = $this->buildInvestigationProfileRows($filter);
|
||||||
$draw = (int) $this->request->getGet('draw');
|
$draw = (int) $this->request->getGet('draw');
|
||||||
$start = max(0, (int) $this->request->getGet('start'));
|
$start = max(0, (int) $this->request->getGet('start'));
|
||||||
$length = (int) $this->request->getGet('length');
|
$length = (int) $this->request->getGet('length');
|
||||||
|
|
@ -3393,8 +3398,7 @@ class Opd_prescription extends BaseController
|
||||||
|
|
||||||
public function opd_invest_profile_master_get(int $profileCode)
|
public function opd_invest_profile_master_get(int $profileCode)
|
||||||
{
|
{
|
||||||
$response = $this->opd_invest_profile_master_list()->getJSON(true);
|
$rows = $this->buildInvestigationProfileRows();
|
||||||
$rows = $response['rows'] ?? [];
|
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
if ((int) ($row['profile_code'] ?? 0) === $profileCode) {
|
if ((int) ($row['profile_code'] ?? 0) === $profileCode) {
|
||||||
return $this->response->setJSON([
|
return $this->response->setJSON([
|
||||||
|
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Database\Migrations;
|
|
||||||
|
|
||||||
use CodeIgniter\Database\Migration;
|
|
||||||
|
|
||||||
class CreateCityAutoUTable extends Migration
|
|
||||||
{
|
|
||||||
public function up(): void
|
|
||||||
{
|
|
||||||
$this->forge->addField([
|
|
||||||
'id' => [
|
|
||||||
'type' => 'INT',
|
|
||||||
'unsigned' => true,
|
|
||||||
'auto_increment' => true,
|
|
||||||
],
|
|
||||||
'city' => [
|
|
||||||
'type' => 'VARCHAR',
|
|
||||||
'constraint' => 150,
|
|
||||||
'default' => '',
|
|
||||||
],
|
|
||||||
'district' => [
|
|
||||||
'type' => 'VARCHAR',
|
|
||||||
'constraint' => 150,
|
|
||||||
'default' => '',
|
|
||||||
],
|
|
||||||
'state' => [
|
|
||||||
'type' => 'VARCHAR',
|
|
||||||
'constraint' => 100,
|
|
||||||
'default' => '',
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
|
|
||||||
$this->forge->addKey('id', true);
|
|
||||||
$this->forge->addKey(['city', 'district', 'state']);
|
|
||||||
|
|
||||||
$this->forge->createTable('city_auto_u', true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
$this->forge->dropTable('city_auto_u', true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user