mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-12 11:11:31 +00:00
The official image from streamline does not currently work for the arm64 platform. As a temporary measure, the source code and docker build scripts have been lifted from the official images and are used to build locally. Some additional modifications are made to reduce overall image size, these are documented in docker/README.md
36 lines
1.2 KiB
PHP
Executable File
36 lines
1.2 KiB
PHP
Executable File
<?php
|
|
|
|
use Illuminate\Database\Seeder;
|
|
use Streamline\Models\Drug;
|
|
use Streamline\Models\TreatmentDeposits;
|
|
|
|
class DrugsCostOfGoodsSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeders.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function run()
|
|
{
|
|
$drugs_cog_account_id = get_name("Drugs Cost Of Goods", "name", "id", "chart_of_accounts");
|
|
|
|
$drugs_without_cog_account = DB::table('drugs')->where('available', 1)->whereNull('cost_of_goods_account')->get();
|
|
|
|
foreach ($drugs_without_cog_account as $drug) {
|
|
$drug = Drug::withTrashed()->find($drug->id);
|
|
$drug->cost_of_goods_account = $drugs_cog_account_id;
|
|
$drug->update();
|
|
}
|
|
|
|
|
|
/* run this in case of any treatment deposits that do not have attached cost_of_goods_account */
|
|
$treatment_deposits_without_cog_account = DB::table('treatment_deposits')->whereNull('cost_of_goods_account')->get();
|
|
foreach ($treatment_deposits_without_cog_account as $deposit) {
|
|
$treatment_deposit = TreatmentDeposits::find($deposit->id);
|
|
$treatment_deposit->cost_of_goods_account = $drugs_cog_account_id;
|
|
$treatment_deposit->update();
|
|
}
|
|
}
|
|
}
|