updated streamline-setup v2

This commit is contained in:
2025-01-15 08:53:49 -08:00
committed by alec.turner
parent a2ce9248f0
commit 4b569f81b0
20228 changed files with 2932048 additions and 63204 deletions
@@ -0,0 +1,65 @@
<?php
use Illuminate\Database\Seeder;
class DataCorrectionIncomeAccountStrings extends Seeder
{
/**
* Run the database seeders.
*
* @return void
*/
public function run()
{
$service_payments = \Streamline\Models\ServiceDeposit::all();
$investigation_payments = \Streamline\Models\InvestigationDeposit::all();
$procedure_payments = \Streamline\Models\ProcedureDeposit::all();
$sundry_payments = \Streamline\Models\SundryDeposit::all();
$treatment_payments = \Streamline\Models\TreatmentDeposits::all();
foreach ($service_payments as $payment){
$income_account_array = [];
$item_array = explode(',', $payment->items_ids);
for ($x = 0; $x < count($item_array); $x ++){
$income_account_array[] = get_name($item_array[$x], 'id', 'account_id', 'services');
}
\Streamline\Models\ServiceDeposit::where('id', $payment->id)->update(['current_chart_of_accounts'=> implode(',',$income_account_array)]);
}
foreach ($investigation_payments as $payment){
$income_account_array = [];
$item_array = explode(',', $payment->investigation_items);
for ($x = 0; $x < count($item_array); $x ++){
$income_account_array[] = get_name($item_array[$x], 'id', 'account_id', 'investigations');
}
\Streamline\Models\InvestigationDeposit::where('id', $payment->id)->update(['current_chart_of_accounts'=> implode(',',$income_account_array)]);
}
foreach ($procedure_payments as $payment){
$income_account_array = [];
$item_array = explode(',', $payment->procedure_items);
for ($x = 0; $x < count($item_array); $x ++){
$income_account_array[] = get_name($item_array[$x], 'id', 'account_id', 'procedures');
}
\Streamline\Models\ProcedureDeposit::where('id', $payment->id)->update(['current_chart_of_accounts'=> implode(',',$income_account_array)]);
}
foreach ($treatment_payments as $payment){
$income_account_array = [];
$item_array = explode(',', $payment->treatment_items);
for ($x = 0; $x < count($item_array); $x ++){
$income_account_array[] = get_name($item_array[$x], 'id', 'account_id', 'drugs');
}
\Streamline\Models\TreatmentDeposits::where('id', $payment->id)->update(['current_chart_of_accounts'=> implode(',',$income_account_array)]);
}
foreach ($sundry_payments as $payment){
$income_account_array = [];
$item_array = explode(',', $payment->sundry_items);
for ($x = 0; $x < count($item_array); $x ++){
$income_account_array[] = get_name($item_array[$x], 'id', 'account_id', 'sundries');
}
\Streamline\Models\SundryDeposit::where('id', $payment->id)->update(['current_chart_of_accounts'=> implode(',',$income_account_array)]);
}
}
}