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,120 @@
<?php
use Illuminate\Database\Seeder;
use Streamline\Models\Debtor;
use Streamline\Models\DebtPlan;
use Streamline\Models\InsuranceExpenditure;
class DebtTablesAccountSeeder extends Seeder
{
/**
* Run the database seeders.
*
* @return void
*/
public function run()
{
$debtors = \Streamline\Models\Debtor::all();
$debt_plans = \Streamline\Models\DebtPlan::all();
$insurance_expenditures = \Streamline\Models\InsuranceExpenditure::all();
$inventory_account_id = \Streamline\Models\ChartOfAccount::where('type', 10)->pluck('id')->first();
$cost_of_good_account_id = \Streamline\Models\ChartOfAccount::where('type', 7)->pluck('id')->first();
foreach ($debtors as $invoice){
//Consultations / Services
if($invoice->tag_id == 6 || $invoice->tag_id == 8 || $invoice->tag_id == 7 || $invoice->tag_id == 10){
Debtor::where('id', $invoice->id)->update(['income_account'=> 7]);
}
//Drugs / Treatments
elseif ($invoice->tag_id == 3 || $invoice->tag_id == 1){
Debtor::where('id', $invoice->id)->update([
'income_account'=> 4,
'inventory_account'=> $inventory_account_id,
'cost_of_goods_account'=> $cost_of_good_account_id
]);
}
//Sundries
elseif ($invoice->tag_id == 5 ){
Debtor::where('id', $invoice->id)->update([
'income_account'=> 4,
'inventory_account'=> $inventory_account_id,
'cost_of_goods_account'=> $cost_of_good_account_id
]);
}
//Investigations
elseif ($invoice->tag_id == 2 ){
Debtor::where('id', $invoice->id)->update(['income_account'=> 11]);
}
//Procedures
elseif ($invoice->tag_id == 4 ){
Debtor::where('id', $invoice->id)->update(['income_account'=> 8]);
}
}
foreach ($debt_plans as $invoice){
//Consultations / Services
if($invoice->tag_id == 6 || $invoice->tag_id == 8 || $invoice->tag_id == 7 || $invoice->tag_id == 10){
DebtPlan::where('id', $invoice->id)->update(['income_account'=> 7]);
}
//Drugs / Treatments
elseif ($invoice->tag_id == 3 || $invoice->tag_id == 1){
DebtPlan::where('id', $invoice->id)->update([
'income_account'=> 4,
'inventory_account'=> $inventory_account_id,
'cost_of_goods_account'=> $cost_of_good_account_id
]);
}
//Sundries
elseif ($invoice->tag_id == 5 ){
DebtPlan::where('id', $invoice->id)->update([
'income_account'=> 4,
'inventory_account'=> $inventory_account_id,
'cost_of_goods_account'=> $cost_of_good_account_id
]);
}
//Investigations
elseif ($invoice->tag_id == 2 ){
DebtPlan::where('id', $invoice->id)->update(['income_account'=> 11]);
}
//Procedures
elseif ($invoice->tag_id == 4 ){
DebtPlan::where('id', $invoice->id)->update(['income_account'=> 8]);
}
}
foreach ($insurance_expenditures as $invoice){
//Consultations / Services
if($invoice->tag_id == 6 || $invoice->tag_id == 8 || $invoice->tag_id == 7 || $invoice->tag_id == 10){
InsuranceExpenditure::where('id', $invoice->id)->update(['income_account'=> 7]);
}
//Drugs / Treatments
elseif ($invoice->tag_id == 3 || $invoice->tag_id == 1){
InsuranceExpenditure::where('id', $invoice->id)->update([
'income_account'=> 4,
'inventory_account'=> $inventory_account_id,
'cost_of_goods_account'=> $cost_of_good_account_id
]);
}
//Sundries
elseif ($invoice->tag_id == 5 ){
InsuranceExpenditure::where('id', $invoice->id)->update([
'income_account'=> 12,
'inventory_account'=> $inventory_account_id,
'cost_of_goods_account'=> $cost_of_good_account_id
]);
}
//Investigations
elseif ($invoice->tag_id == 2 ){
InsuranceExpenditure::where('id', $invoice->id)->update(['income_account'=> 11]);
}
//Procedures
elseif ($invoice->tag_id == 4 ){
InsuranceExpenditure::where('id', $invoice->id)->update(['income_account'=> 8]);
}
}
}
}