[WIP] ASO Payment
This commit is contained in:
@@ -15,6 +15,7 @@ use App\Models\Unit;
|
||||
use Box\Spout\Reader\Common\Creator\ReaderEntityFactory;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Str;
|
||||
|
||||
class DrugSeeder extends Seeder
|
||||
{
|
||||
@@ -25,6 +26,12 @@ class DrugSeeder extends Seeder
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Drug::truncate();
|
||||
Organization::where('type', 'manufacturer')->delete();
|
||||
Ingredient::truncate();
|
||||
DrugComposition::truncate();
|
||||
DrugCategory::truncate();
|
||||
|
||||
$file_path = resource_path('files/daftar_masteritem_ccp_14-06-2022.xlsx');
|
||||
$reader = ReaderEntityFactory::createReaderFromFile($file_path);
|
||||
$reader->open($file_path);
|
||||
@@ -69,12 +76,13 @@ class DrugSeeder extends Seeder
|
||||
'name' => $row_data['brand']
|
||||
]) : null;
|
||||
|
||||
$manufacturerCode = 'MAN'.str_pad(Str::initials($row_data['pabrikan']), 10, "0", STR_PAD_LEFT);
|
||||
$manufacturer = Organization::firstOrCreate([
|
||||
'name' => $row_data['pabrikan']
|
||||
'code' => $manufacturerCode
|
||||
], [
|
||||
'name' => $row_data['pabrikan'],
|
||||
'type' => 'manufacturer',
|
||||
'code' => $row_data['pabrikan']
|
||||
'code' => $manufacturerCode
|
||||
]);
|
||||
|
||||
if (in_array($row_data['golongan'], ['VITAMINS & MINERALS', 'NUTRITIONS'])) {
|
||||
|
||||
Reference in New Issue
Block a user