======================================== اختبار نظام التسجيل التلقائي للـ Tenant ======================================== 1. إنشاء مستخدم جديد...
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'sale-receivable' for key 'journal_mappings_transaction_type_field_name_unique' (Connection: mysql, Host: localhost, Port: 3306, Database: karamkha_karam, SQL: insert into `journal_mappings` (`tenant_id`, `transaction_type`, `field_name`, `account_id`, `created_by`, `updated_by`, `updated_at`, `created_at`) values (53, sale, receivable, 1505, ?, ?, 2026-07-29 15:16:46, 2026-07-29 15:16:46))
Illuminate\Database\Connection->runQueryCallback(string, array, object(Closure))Illuminate\Database\Connection->runQueryCallback(string, array, object(Closure))Illuminate\Database\Connection->run(string, array, object(Closure))Illuminate\Database\MySqlConnection->insert(string, array, string)Illuminate\Database\Query\Processors\MySqlProcessor->processInsertGetId(object(Illuminate\Database\Query\Builder), string, array, string)Illuminate\Database\Query\Builder->insertGetId(array, string)Illuminate\Database\Eloquent\Builder->__call(string, array)Illuminate\Database\Eloquent\Model->insertAndSetId(object(Illuminate\Database\Eloquent\Builder), array)Illuminate\Database\Eloquent\Model->performInsert(object(Illuminate\Database\Eloquent\Builder))Illuminate\Database\Eloquent\Model->save()Illuminate\Database\Eloquent\Builder->Illuminate\Database\Eloquent\{closure}(object(App\Models\Accounting\JournalMapping))tap(object(App\Models\Accounting\JournalMapping), object(Closure))Illuminate\Database\Eloquent\Builder->create(array)Illuminate\Database\Eloquent\Model->forwardCallTo(object(Illuminate\Database\Eloquent\Builder), string, array)Illuminate\Database\Eloquent\Model->__call(string, array)Illuminate\Database\Eloquent\Model::__callStatic(string, array)510 $account = ChartOfAccount::where('tenant_id', $tenantId)511 ->where('code', $accountCode)512 ->first();513514 if ($account) {515 JournalMapping::create([516 'tenant_id' => $tenantId,517 'transaction_type' => $transactionType,518 'field_name' => $fieldName,519 'account_id' => $account->id,520 ]);521 }522 }523524 /**525 * توليد slug فريد526 */527App\Services\TenantSetupService->createMapping(integer, string, string, string)418 {419 // ═══════════════════════════════════════════════════════════420 // 1. ربط حسابات المبيعات (Sales)421 // ═══════════════════════════════════════════════════════════422 423 $this->createMapping($tenantId, 'sale', 'receivable', '1121'); // Trade Receivables424 $this->createMapping($tenantId, 'sale', 'sales', '4110'); // Product Sales425 $this->createMapping($tenantId, 'sale', 'cost_of_goods_sold', '5110'); // Cost of Products Sold426 $this->createMapping($tenantId, 'sale', 'inventory', '1131'); // Merchandise Inventory427 $this->createMapping($tenantId, 'sale', 'sales_discount', '5210'); // Sales Discounts Allowed428 $this->createMapping($tenantId, 'sale', 'tax_payable', '2410'); // VAT Payable429 $this->createMapping($tenantId, 'sale', 'cash', '1111'); // Cash on Hand430431 // ═══════════════════════════════════════════════════════════432 // 2. ربط حسابات مرتجع المبيعات (Sale Returns)433 // ═══════════════════════════════════════════════════════════434 435App\Services\TenantSetupService->seedJournalMappings(integer)5253 // 2. إضافة دليل الحسابات54 $this->seedChartOfAccounts($currentTenantId);5556 // 3. إضافة ربط الحسابات (Mappings)57 $this->seedJournalMappings($currentTenantId);58 }5960 /**61 * إضافة الوحدات الأساسية62 */63 protected function seedUnits(int $tenantId): void64 {65 $units = [66 // وحدات الوزن67 ['name' => 'Kilogram', 'name_ar' => 'كيلوجرام', 'symbol' => 'كجم', 'is_base_unit' => true, 'conversion_factor' => 1.0000],68 ['name' => 'Gram', 'name_ar' => 'جرام', 'symbol' => 'جم', 'is_base_unit' => false, 'conversion_factor' => 0.0010],69App\Services\TenantSetupService->seedTenantData(object(App\Models\Tenant))31 'tenant_id' => $tenant->id,32 'is_tenant_owner' => true,33 ]);3435 // 3. تشغيل البيانات الأساسية للـ Tenant36 $this->seedTenantData($tenant);3738 return $tenant;39 });40 }4142 /**43 * تشغيل البيانات الأساسية للـ Tenant44 */45 protected function seedTenantData(Tenant $tenant): void46 {47 // حفظ الـ tenant_id الحالي48App\Services\TenantSetupService->App\Services\{closure}(object(Illuminate\Database\MySqlConnection))Illuminate\Database\Connection->transaction(object(Closure))Illuminate\Database\DatabaseManager->__call(string, array)Illuminate\Support\Facades\Facade::__callStatic(string, array)15 /**16 * إعداد Tenant جديد عند تسجيل مستخدم جديد17 */18 public function setupNewTenant(User $user): Tenant19 {20 return DB::transaction(function () use ($user) {21 // 1. إنشاء Tenant جديد باسم المستخدم22 $tenant = Tenant::create([23 'name' => $user->name ?? $user->email,24 'slug' => $this->generateUniqueSlug($user->name ?? $user->email),25 'is_active' => true,26 'plan' => 'free', // يمكن تغييره حسب الخطة27 ]);2829 // 2. ربط المستخدم بالـ Tenant وجعله Owner30 $user->update([31 'tenant_id' => $tenant->id,32App\Services\TenantSetupService->setupNewTenant(object(App\Models\User))14 {15 // إذا كان المستخدم ليس system admin وليس لديه tenant_id16 // نقوم بإنشاء tenant جديد له17 if (!$user->is_system_admin && !$user->tenant_id) {18 $setupService = app(TenantSetupService::class);19 $setupService->setupNewTenant($user);20 }21 }2223 /**24 * Handle the User "updated" event.25 */26 public function updated(User $user): void27 {28 //29 }3031App\Observers\UserObserver->created(object(App\Models\User))Illuminate\Events\Dispatcher->Illuminate\Events\{closure}(string, array)Illuminate\Events\Dispatcher->invokeListeners(string, array, boolean)Illuminate\Events\Dispatcher->dispatch(string, object(App\Models\User))Illuminate\Database\Eloquent\Model->fireModelEvent(string, boolean)Illuminate\Database\Eloquent\Model->performInsert(object(Illuminate\Database\Eloquent\Builder))Illuminate\Database\Eloquent\Model->save()Illuminate\Database\Eloquent\Builder->Illuminate\Database\Eloquent\{closure}(object(App\Models\User))tap(object(App\Models\User), object(Closure))Illuminate\Database\Eloquent\Builder->create(array)Illuminate\Database\Eloquent\Model->forwardCallTo(object(Illuminate\Database\Eloquent\Builder), string, array)Illuminate\Database\Eloquent\Model->__call(string, array)Illuminate\Database\Eloquent\Model::__callStatic(string, array)32echo "1. إنشاء مستخدم جديد...\n";3334$testEmail = 'test_' . time() . '@example.com';35$testName = 'Test User ' . time();3637$user = User::create([38 'name' => $testName,39 'email' => $testEmail,40 'password' => Hash::make('password123'),41]);4243echo " ✓ تم إنشاء المستخدم: {$user->name} ({$user->email})\n";44echo " ✓ User ID: {$user->id}\n\n";4546// إعادة تحميل المستخدم للحصول على البيانات المحدثة47$user->refresh();4849select `company_name`, `site_name` from `general_settings` where 1 = 0 limit 1insert into `users` (`name`, `email`, `password`, `updated_at`, `created_at`) values ('Test User 1785327406', 'test_1785327406@example.com', 'y$EgGWt9KFD5Wi8x/b4zOeJuIyZy/o0XdC3QYSYifTavVsj70AmtaG6', '2026-07-29 15:16:46', '2026-07-29 15:16:46')select exists(select * from `tenants` where `slug` = 'test-user-1785327406' and `tenants`.`deleted_at` is null) as `exists`insert into `tenants` (`name`, `slug`, `is_active`, `plan`, `created_by`, `updated_by`, `updated_at`, `created_at`) values ('Test User 1785327406', 'test-user-1785327406', 1, 'free', NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')update `users` set `name` = 'Test User 1785327406', `email` = 'test_1785327406@example.com', `password` = 'y$EgGWt9KFD5Wi8x/b4zOeJuIyZy/o0XdC3QYSYifTavVsj70AmtaG6', `created_at` = '2026-07-29 15:16:46', `id` = 55, `tenant_id` = 53, `is_tenant_owner` = 1, `users`.`updated_at` = '2026-07-29 15:16:46' where `id` = 55insert into `units` (`name`, `name_ar`, `symbol`, `is_base_unit`, `conversion_factor`, `tenant_id`, `is_active`, `created_by`, `updated_by`, `updated_at`, `created_at`) values ('Kilogram', 'كيلوجرام', 'كجم', 1, 1, 53, 1, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `units` where `id` = 607 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"name":"Kilogram","name_ar":"\u0643\u064a\u0644\u0648\u062c\u0631\u0627\u0645","symbol":"\u0643\u062c\u0645","is_active":true}}', NULL, 'created', 607, 'App\Models\Unit', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `units` (`name`, `name_ar`, `symbol`, `is_base_unit`, `conversion_factor`, `tenant_id`, `is_active`, `created_by`, `updated_by`, `updated_at`, `created_at`) values ('Gram', 'جرام', 'جم', 0, 0.001, 53, 1, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `units` where `id` = 608 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"name":"Gram","name_ar":"\u062c\u0631\u0627\u0645","symbol":"\u062c\u0645","is_active":true}}', NULL, 'created', 608, 'App\Models\Unit', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `units` (`name`, `name_ar`, `symbol`, `is_base_unit`, `conversion_factor`, `tenant_id`, `is_active`, `created_by`, `updated_by`, `updated_at`, `created_at`) values ('Ton', 'طن', 'طن', 0, 1000, 53, 1, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `units` where `id` = 609 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"name":"Ton","name_ar":"\u0637\u0646","symbol":"\u0637\u0646","is_active":true}}', NULL, 'created', 609, 'App\Models\Unit', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `units` (`name`, `name_ar`, `symbol`, `is_base_unit`, `conversion_factor`, `tenant_id`, `is_active`, `created_by`, `updated_by`, `updated_at`, `created_at`) values ('Sack', 'شيكارة', 'شيكارة', 0, 50, 53, 1, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `units` where `id` = 610 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"name":"Sack","name_ar":"\u0634\u064a\u0643\u0627\u0631\u0629","symbol":"\u0634\u064a\u0643\u0627\u0631\u0629","is_active":true}}', NULL, 'created', 610, 'App\Models\Unit', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `units` (`name`, `name_ar`, `symbol`, `is_base_unit`, `conversion_factor`, `tenant_id`, `is_active`, `created_by`, `updated_by`, `updated_at`, `created_at`) values ('Liter', 'لتر', 'لتر', 1, 1, 53, 1, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `units` where `id` = 611 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"name":"Liter","name_ar":"\u0644\u062a\u0631","symbol":"\u0644\u062a\u0631","is_active":true}}', NULL, 'created', 611, 'App\Models\Unit', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `units` (`name`, `name_ar`, `symbol`, `is_base_unit`, `conversion_factor`, `tenant_id`, `is_active`, `created_by`, `updated_by`, `updated_at`, `created_at`) values ('Milliliter', 'ملليلتر', 'مل', 0, 0.001, 53, 1, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `units` where `id` = 612 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"name":"Milliliter","name_ar":"\u0645\u0644\u0644\u064a\u0644\u062a\u0631","symbol":"\u0645\u0644","is_active":true}}', NULL, 'created', 612, 'App\Models\Unit', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `units` (`name`, `name_ar`, `symbol`, `is_base_unit`, `conversion_factor`, `tenant_id`, `is_active`, `created_by`, `updated_by`, `updated_at`, `created_at`) values ('Piece', 'قطعة', 'قطعة', 1, 1, 53, 1, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `units` where `id` = 613 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"name":"Piece","name_ar":"\u0642\u0637\u0639\u0629","symbol":"\u0642\u0637\u0639\u0629","is_active":true}}', NULL, 'created', 613, 'App\Models\Unit', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `units` (`name`, `name_ar`, `symbol`, `is_base_unit`, `conversion_factor`, `tenant_id`, `is_active`, `created_by`, `updated_by`, `updated_at`, `created_at`) values ('Box', 'صندوق', 'صندوق', 0, 12, 53, 1, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `units` where `id` = 614 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"name":"Box","name_ar":"\u0635\u0646\u062f\u0648\u0642","symbol":"\u0635\u0646\u062f\u0648\u0642","is_active":true}}', NULL, 'created', 614, 'App\Models\Unit', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `units` (`name`, `name_ar`, `symbol`, `is_base_unit`, `conversion_factor`, `tenant_id`, `is_active`, `created_by`, `updated_by`, `updated_at`, `created_at`) values ('Carton', 'كرتونة', 'كرتونة', 0, 24, 53, 1, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `units` where `id` = 615 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"name":"Carton","name_ar":"\u0643\u0631\u062a\u0648\u0646\u0629","symbol":"\u0643\u0631\u062a\u0648\u0646\u0629","is_active":true}}', NULL, 'created', 615, 'App\Models\Unit', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `units` (`name`, `name_ar`, `symbol`, `is_base_unit`, `conversion_factor`, `tenant_id`, `is_active`, `created_by`, `updated_by`, `updated_at`, `created_at`) values ('Dozen', 'دستة', 'دستة', 0, 12, 53, 1, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `units` where `id` = 616 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"name":"Dozen","name_ar":"\u062f\u0633\u062a\u0629","symbol":"\u062f\u0633\u062a\u0629","is_active":true}}', NULL, 'created', 616, 'App\Models\Unit', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `units` (`name`, `name_ar`, `symbol`, `is_base_unit`, `conversion_factor`, `tenant_id`, `is_active`, `created_by`, `updated_by`, `updated_at`, `created_at`) values ('Pack', 'عبوة', 'عبوة', 0, 6, 53, 1, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `units` where `id` = 617 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"name":"Pack","name_ar":"\u0639\u0628\u0648\u0629","symbol":"\u0639\u0628\u0648\u0629","is_active":true}}', NULL, 'created', 617, 'App\Models\Unit', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `chart_of_accounts` (`tenant_id`, `is_active`, `is_system`, `sort_order`, `code`, `name`, `name_ar`, `account_type`, `normal_balance`, `level`, `created_by`, `updated_by`, `updated_at`, `created_at`) values (53, 1, 1, 0, '1000', 'Assets', 'الأصول', 'asset', 'debit', 1, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `chart_of_accounts` where `id` = 1499 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"code":"1000","name":"Assets","name_ar":"\u0627\u0644\u0623\u0635\u0648\u0644","account_type":"asset","is_active":true}}', NULL, 'created', 1499, 'App\Models\Accounting\ChartOfAccount', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `chart_of_accounts` (`tenant_id`, `is_active`, `is_system`, `sort_order`, `code`, `name`, `name_ar`, `account_type`, `normal_balance`, `parent_id`, `level`, `created_by`, `updated_by`, `updated_at`, `created_at`) values (53, 1, 1, 0, '1100', 'Current Assets', 'الأصول المتداولة', 'asset', 'debit', 1499, 2, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `chart_of_accounts` where `id` = 1500 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"code":"1100","name":"Current Assets","name_ar":"\u0627\u0644\u0623\u0635\u0648\u0644 \u0627\u0644\u0645\u062a\u062f\u0627\u0648\u0644\u0629","account_type":"asset","is_active":true}}', NULL, 'created', 1500, 'App\Models\Accounting\ChartOfAccount', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `chart_of_accounts` (`tenant_id`, `is_active`, `is_system`, `sort_order`, `code`, `name`, `name_ar`, `account_type`, `normal_balance`, `parent_id`, `level`, `created_by`, `updated_by`, `updated_at`, `created_at`) values (53, 1, 0, 0, '1110', 'Cash and Cash Equivalents', 'النقدية وما في حكمها', 'asset', 'debit', 1500, 3, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `chart_of_accounts` where `id` = 1501 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"code":"1110","name":"Cash and Cash Equivalents","name_ar":"\u0627\u0644\u0646\u0642\u062f\u064a\u0629 \u0648\u0645\u0627 \u0641\u064a \u062d\u0643\u0645\u0647\u0627","account_type":"asset","is_active":true}}', NULL, 'created', 1501, 'App\Models\Accounting\ChartOfAccount', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `chart_of_accounts` (`tenant_id`, `is_active`, `is_system`, `sort_order`, `code`, `name`, `name_ar`, `account_type`, `normal_balance`, `parent_id`, `level`, `created_by`, `updated_by`, `updated_at`, `created_at`) values (53, 1, 0, 0, '1111', 'Cash on Hand', 'النقدية في الصندوق', 'asset', 'debit', 1501, 4, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `chart_of_accounts` where `id` = 1502 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"code":"1111","name":"Cash on Hand","name_ar":"\u0627\u0644\u0646\u0642\u062f\u064a\u0629 \u0641\u064a \u0627\u0644\u0635\u0646\u062f\u0648\u0642","account_type":"asset","is_active":true}}', NULL, 'created', 1502, 'App\Models\Accounting\ChartOfAccount', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `chart_of_accounts` (`tenant_id`, `is_active`, `is_system`, `sort_order`, `code`, `name`, `name_ar`, `account_type`, `normal_balance`, `parent_id`, `level`, `created_by`, `updated_by`, `updated_at`, `created_at`) values (53, 1, 0, 0, '1112', 'Cash in Bank', 'النقدية في البنك', 'asset', 'debit', 1501, 4, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `chart_of_accounts` where `id` = 1503 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"code":"1112","name":"Cash in Bank","name_ar":"\u0627\u0644\u0646\u0642\u062f\u064a\u0629 \u0641\u064a \u0627\u0644\u0628\u0646\u0643","account_type":"asset","is_active":true}}', NULL, 'created', 1503, 'App\Models\Accounting\ChartOfAccount', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `chart_of_accounts` (`tenant_id`, `is_active`, `is_system`, `sort_order`, `code`, `name`, `name_ar`, `account_type`, `normal_balance`, `parent_id`, `level`, `created_by`, `updated_by`, `updated_at`, `created_at`) values (53, 1, 0, 0, '1120', 'Accounts Receivable', 'الذمم المدينة', 'asset', 'debit', 1500, 3, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `chart_of_accounts` where `id` = 1504 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"code":"1120","name":"Accounts Receivable","name_ar":"\u0627\u0644\u0630\u0645\u0645 \u0627\u0644\u0645\u062f\u064a\u0646\u0629","account_type":"asset","is_active":true}}', NULL, 'created', 1504, 'App\Models\Accounting\ChartOfAccount', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `chart_of_accounts` (`tenant_id`, `is_active`, `is_system`, `sort_order`, `code`, `name`, `name_ar`, `account_type`, `normal_balance`, `parent_id`, `level`, `created_by`, `updated_by`, `updated_at`, `created_at`) values (53, 1, 0, 0, '1121', 'Trade Receivables', 'ذمم العملاء', 'asset', 'debit', 1504, 4, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `chart_of_accounts` where `id` = 1505 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"code":"1121","name":"Trade Receivables","name_ar":"\u0630\u0645\u0645 \u0627\u0644\u0639\u0645\u0644\u0627\u0621","account_type":"asset","is_active":true}}', NULL, 'created', 1505, 'App\Models\Accounting\ChartOfAccount', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `chart_of_accounts` (`tenant_id`, `is_active`, `is_system`, `sort_order`, `code`, `name`, `name_ar`, `account_type`, `normal_balance`, `parent_id`, `level`, `created_by`, `updated_by`, `updated_at`, `created_at`) values (53, 1, 0, 0, '1130', 'Inventory', 'المخزون', 'asset', 'debit', 1500, 3, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `chart_of_accounts` where `id` = 1506 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"code":"1130","name":"Inventory","name_ar":"\u0627\u0644\u0645\u062e\u0632\u0648\u0646","account_type":"asset","is_active":true}}', NULL, 'created', 1506, 'App\Models\Accounting\ChartOfAccount', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `chart_of_accounts` (`tenant_id`, `is_active`, `is_system`, `sort_order`, `code`, `name`, `name_ar`, `account_type`, `normal_balance`, `parent_id`, `level`, `created_by`, `updated_by`, `updated_at`, `created_at`) values (53, 1, 0, 0, '1131', 'Merchandise Inventory', 'مخزون البضاعة', 'asset', 'debit', 1506, 4, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `chart_of_accounts` where `id` = 1507 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"code":"1131","name":"Merchandise Inventory","name_ar":"\u0645\u062e\u0632\u0648\u0646 \u0627\u0644\u0628\u0636\u0627\u0639\u0629","account_type":"asset","is_active":true}}', NULL, 'created', 1507, 'App\Models\Accounting\ChartOfAccount', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `chart_of_accounts` (`tenant_id`, `is_active`, `is_system`, `sort_order`, `code`, `name`, `name_ar`, `account_type`, `normal_balance`, `level`, `created_by`, `updated_by`, `updated_at`, `created_at`) values (53, 1, 1, 0, '2000', 'Liabilities', 'الالتزامات', 'liability', 'credit', 1, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `chart_of_accounts` where `id` = 1508 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"code":"2000","name":"Liabilities","name_ar":"\u0627\u0644\u0627\u0644\u062a\u0632\u0627\u0645\u0627\u062a","account_type":"liability","is_active":true}}', NULL, 'created', 1508, 'App\Models\Accounting\ChartOfAccount', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `chart_of_accounts` (`tenant_id`, `is_active`, `is_system`, `sort_order`, `code`, `name`, `name_ar`, `account_type`, `normal_balance`, `parent_id`, `level`, `created_by`, `updated_by`, `updated_at`, `created_at`) values (53, 1, 1, 0, '2100', 'Current Liabilities', 'الالتزامات المتداولة', 'liability', 'credit', 1508, 2, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `chart_of_accounts` where `id` = 1509 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"code":"2100","name":"Current Liabilities","name_ar":"\u0627\u0644\u0627\u0644\u062a\u0632\u0627\u0645\u0627\u062a \u0627\u0644\u0645\u062a\u062f\u0627\u0648\u0644\u0629","account_type":"liability","is_active":true}}', NULL, 'created', 1509, 'App\Models\Accounting\ChartOfAccount', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `chart_of_accounts` (`tenant_id`, `is_active`, `is_system`, `sort_order`, `code`, `name`, `name_ar`, `account_type`, `normal_balance`, `parent_id`, `level`, `created_by`, `updated_by`, `updated_at`, `created_at`) values (53, 1, 0, 0, '2110', 'Accounts Payable', 'الذمم الدائنة', 'liability', 'credit', 1509, 3, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `chart_of_accounts` where `id` = 1510 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"code":"2110","name":"Accounts Payable","name_ar":"\u0627\u0644\u0630\u0645\u0645 \u0627\u0644\u062f\u0627\u0626\u0646\u0629","account_type":"liability","is_active":true}}', NULL, 'created', 1510, 'App\Models\Accounting\ChartOfAccount', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `chart_of_accounts` (`tenant_id`, `is_active`, `is_system`, `sort_order`, `code`, `name`, `name_ar`, `account_type`, `normal_balance`, `parent_id`, `level`, `created_by`, `updated_by`, `updated_at`, `created_at`) values (53, 1, 0, 0, '2111', 'Trade Payables', 'ذمم الموردين', 'liability', 'credit', 1510, 4, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `chart_of_accounts` where `id` = 1511 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"code":"2111","name":"Trade Payables","name_ar":"\u0630\u0645\u0645 \u0627\u0644\u0645\u0648\u0631\u062f\u064a\u0646","account_type":"liability","is_active":true}}', NULL, 'created', 1511, 'App\Models\Accounting\ChartOfAccount', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `chart_of_accounts` (`tenant_id`, `is_active`, `is_system`, `sort_order`, `code`, `name`, `name_ar`, `account_type`, `normal_balance`, `parent_id`, `level`, `created_by`, `updated_by`, `updated_at`, `created_at`) values (53, 1, 0, 0, '2120', 'Taxes Payable', 'الضرائب المستحقة', 'liability', 'credit', 1509, 3, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `chart_of_accounts` where `id` = 1512 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"code":"2120","name":"Taxes Payable","name_ar":"\u0627\u0644\u0636\u0631\u0627\u0626\u0628 \u0627\u0644\u0645\u0633\u062a\u062d\u0642\u0629","account_type":"liability","is_active":true}}', NULL, 'created', 1512, 'App\Models\Accounting\ChartOfAccount', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `chart_of_accounts` (`tenant_id`, `is_active`, `is_system`, `sort_order`, `code`, `name`, `name_ar`, `account_type`, `normal_balance`, `parent_id`, `level`, `created_by`, `updated_by`, `updated_at`, `created_at`) values (53, 1, 0, 0, '2410', 'VAT Payable', 'ضريبة القيمة المضافة المستحقة', 'liability', 'credit', 1512, 4, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `chart_of_accounts` where `id` = 1513 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"code":"2410","name":"VAT Payable","name_ar":"\u0636\u0631\u064a\u0628\u0629 \u0627\u0644\u0642\u064a\u0645\u0629 \u0627\u0644\u0645\u0636\u0627\u0641\u0629 \u0627\u0644\u0645\u0633\u062a\u062d\u0642\u0629","account_type":"liability","is_active":true}}', NULL, 'created', 1513, 'App\Models\Accounting\ChartOfAccount', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `chart_of_accounts` (`tenant_id`, `is_active`, `is_system`, `sort_order`, `code`, `name`, `name_ar`, `account_type`, `normal_balance`, `level`, `created_by`, `updated_by`, `updated_at`, `created_at`) values (53, 1, 1, 0, '3000', 'Equity', 'حقوق الملكية', 'equity', 'credit', 1, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `chart_of_accounts` where `id` = 1514 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"code":"3000","name":"Equity","name_ar":"\u062d\u0642\u0648\u0642 \u0627\u0644\u0645\u0644\u0643\u064a\u0629","account_type":"equity","is_active":true}}', NULL, 'created', 1514, 'App\Models\Accounting\ChartOfAccount', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `chart_of_accounts` (`tenant_id`, `is_active`, `is_system`, `sort_order`, `code`, `name`, `name_ar`, `account_type`, `normal_balance`, `parent_id`, `level`, `created_by`, `updated_by`, `updated_at`, `created_at`) values (53, 1, 0, 0, '3100', 'Owner's Capital', 'رأس المال', 'equity', 'credit', 1514, 2, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `chart_of_accounts` where `id` = 1515 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"code":"3100","name":"Owner's Capital","name_ar":"\u0631\u0623\u0633 \u0627\u0644\u0645\u0627\u0644","account_type":"equity","is_active":true}}', NULL, 'created', 1515, 'App\Models\Accounting\ChartOfAccount', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `chart_of_accounts` (`tenant_id`, `is_active`, `is_system`, `sort_order`, `code`, `name`, `name_ar`, `account_type`, `normal_balance`, `parent_id`, `level`, `created_by`, `updated_by`, `updated_at`, `created_at`) values (53, 1, 0, 0, '3200', 'Retained Earnings', 'الأرباح المحتجزة', 'equity', 'credit', 1514, 2, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `chart_of_accounts` where `id` = 1516 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"code":"3200","name":"Retained Earnings","name_ar":"\u0627\u0644\u0623\u0631\u0628\u0627\u062d \u0627\u0644\u0645\u062d\u062a\u062c\u0632\u0629","account_type":"equity","is_active":true}}', NULL, 'created', 1516, 'App\Models\Accounting\ChartOfAccount', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `chart_of_accounts` (`tenant_id`, `is_active`, `is_system`, `sort_order`, `code`, `name`, `name_ar`, `account_type`, `normal_balance`, `level`, `created_by`, `updated_by`, `updated_at`, `created_at`) values (53, 1, 1, 0, '4000', 'Revenue', 'الإيرادات', 'revenue', 'credit', 1, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `chart_of_accounts` where `id` = 1517 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"code":"4000","name":"Revenue","name_ar":"\u0627\u0644\u0625\u064a\u0631\u0627\u062f\u0627\u062a","account_type":"revenue","is_active":true}}', NULL, 'created', 1517, 'App\Models\Accounting\ChartOfAccount', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `chart_of_accounts` (`tenant_id`, `is_active`, `is_system`, `sort_order`, `code`, `name`, `name_ar`, `account_type`, `normal_balance`, `parent_id`, `level`, `created_by`, `updated_by`, `updated_at`, `created_at`) values (53, 1, 0, 0, '4100', 'Sales Revenue', 'إيرادات المبيعات', 'revenue', 'credit', 1517, 2, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `chart_of_accounts` where `id` = 1518 limit 1insert into `activity_log` (`log_name`, `properties`, `batch_uuid`, `event`, `subject_id`, `subject_type`, `description`, `updated_at`, `created_at`) values ('default', '{"attributes":{"code":"4100","name":"Sales Revenue","name_ar":"\u0625\u064a\u0631\u0627\u062f\u0627\u062a \u0627\u0644\u0645\u0628\u064a\u0639\u0627\u062a","account_type":"revenue","is_active":true}}', NULL, 'created', 1518, 'App\Models\Accounting\ChartOfAccount', 'created', '2026-07-29 15:16:46', '2026-07-29 15:16:46')insert into `chart_of_accounts` (`tenant_id`, `is_active`, `is_system`, `sort_order`, `code`, `name`, `name_ar`, `account_type`, `normal_balance`, `parent_id`, `level`, `created_by`, `updated_by`, `updated_at`, `created_at`) values (53, 1, 0, 0, '4110', 'Product Sales', 'مبيعات المنتجات', 'revenue', 'credit', 1518, 3, NULL, NULL, '2026-07-29 15:16:46', '2026-07-29 15:16:46')select * from `chart_of_accounts` where `id` = 1519 limit 1