mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-13 03:31:31 +00:00
updated streamline-setup v2
This commit is contained in:
+63
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class PatientCategoryInvoiceAccountSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeders.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$invoices = \Streamline\Models\PatientCategoryInvoice::all();
|
||||
$drugs_cost_of_good_account_id = \Streamline\Models\ChartOfAccount::where('id', 17)->pluck('id')->first();
|
||||
$sundries_cost_of_good_account_id = \Streamline\Models\ChartOfAccount::where('id', 5)->pluck('id')->first();
|
||||
|
||||
foreach ($invoices as $invoice){
|
||||
//Consultations / Services
|
||||
if($invoice->tag_id == 6 || $invoice->tag_id == 8 || $invoice->tag_id == 7 || $invoice->tag_id == 10){
|
||||
\Streamline\Models\PatientCategoryInvoice::where('id', $invoice->id)->update(['income_account'=> 7]);
|
||||
}
|
||||
//Drugs / Treatments
|
||||
elseif ($invoice->tag_id == 3 || $invoice->tag_id == 1){
|
||||
$cost_price_array = [];
|
||||
$items_array = explode(',',$invoice->items_ids);
|
||||
for ($x = 0; $x < count($items_array); $x++){
|
||||
$current_cost_price = get_name($items_array[$x], 'id', 'cost_price', 'drugs');
|
||||
array_push($cost_price_array, $current_cost_price);
|
||||
}
|
||||
$cost_price_string = implode(',', $cost_price_array);
|
||||
\Streamline\Models\PatientCategoryInvoice::where('id', $invoice->id)->update([
|
||||
'income_account'=> 4,
|
||||
'cost_price'=> $cost_price_string,
|
||||
'cost_of_goods_account'=> $drugs_cost_of_good_account_id
|
||||
]);
|
||||
|
||||
}
|
||||
//Sundries
|
||||
elseif ($invoice->tag_id == 5 ){
|
||||
$items_array = explode(',',$invoice->items_ids);
|
||||
for ($x = 0; $x < count($items_array); $x++){
|
||||
$current_cost_price = get_name($items_array[$x], 'id', 'cost_price', 'drugs');
|
||||
array_push($cost_price_array, $current_cost_price);
|
||||
}
|
||||
$cost_price_string = implode(',', $cost_price_array);
|
||||
\Streamline\Models\PatientCategoryInvoice::where('id', $invoice->id)->update([
|
||||
'income_account'=> 4,
|
||||
'cost_price'=> $cost_price_string,
|
||||
'cost_of_goods_account'=> $sundries_cost_of_good_account_id
|
||||
]);
|
||||
}
|
||||
//Investigations
|
||||
elseif ($invoice->tag_id == 2 ){
|
||||
\Streamline\Models\PatientCategoryInvoice::where('id', $invoice->id)->update(['income_account'=> 11]);
|
||||
}
|
||||
//Procedures
|
||||
elseif ($invoice->tag_id == 4 ){
|
||||
\Streamline\Models\PatientCategoryInvoice::where('id', $invoice->id)->update(['income_account'=> 8]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user