====== TABLE: purchase_receptions (2 migrations) ====== -- /home/victoriaa/public_html/panel.inversionesvictoriaa.com/database/migrations/2025_10_20_200000_create_purchases_module_tables.php -- $table->id(); $table->foreignId('purchase_invoice_id')->constrained('purchase_invoices')->onDelete('cascade'); $table->foreignId('warehouse_id')->constrained('warehouses')->onDelete('cascade'); $table->foreignId('location_id')->constrained('locations')->onDelete('cascade'); $table->foreignId('product_id')->constrained('products')->onDelete('cascade'); $table->integer('quantity_received'); $table->decimal('unit_cost', 10, 2); $table->decimal('total_cost', 15, 2); $table->text('notes')->nullable(); $table->foreignId('received_by')->constrained('users'); $table->timestamp('received_at'); $table->timestamps(); $table->index(['purchase_invoice_id', 'warehouse_id']); $table->index(['product_id', 'warehouse_id']); -- /home/victoriaa/public_html/panel.inversionesvictoriaa.com/database/migrations/2025_11_26_221610_fix_purchase_receptions_schema_full.php -- $table->id(); $table->string('reception_number')->unique(); $table->foreignId('purchase_invoice_id')->constrained()->onDelete('cascade'); $table->foreignId('supplier_id')->constrained(); $table->foreignId('warehouse_id')->nullable(); // Nullable por seguridad $table->date('reception_date'); $table->string('status')->default('pending'); // pending, completed, cancelled $table->text('notes')->nullable(); $table->foreignId('created_by')->nullable(); $table->timestamps(); ====== TABLE: purchase_reception_details (2 migrations) ====== -- /home/victoriaa/public_html/panel.inversionesvictoriaa.com/database/migrations/2025_10_21_222244_create_purchase_reception_details_table.php -- $table->id(); $table->foreignId('purchase_reception_id')->constrained('purchase_receptions')->onDelete('cascade'); $table->foreignId('product_id')->constrained('products')->onDelete('cascade'); $table->foreignId('warehouse_id')->constrained('warehouses')->onDelete('cascade'); $table->foreignId('location_id')->constrained('locations')->onDelete('cascade'); $table->decimal('quantity_ordered', 10, 2)->default(0); $table->decimal('quantity_received', 10, 2)->default(0); $table->decimal('quantity_damaged', 10, 2)->default(0); $table->decimal('quantity_missing', 10, 2)->default(0); $table->decimal('unit_cost', 10, 2)->default(0); $table->decimal('total_cost', 10, 2)->default(0); $table->text('notes')->nullable(); $table->timestamps(); $table->index(['purchase_reception_id'], 'pr_details_reception_idx'); $table->index(['product_id'], 'pr_details_product_idx'); $table->index(['warehouse_id'], 'pr_details_warehouse_idx'); $table->index(['location_id'], 'pr_details_location_idx'); -- /home/victoriaa/public_html/panel.inversionesvictoriaa.com/database/migrations/2025_11_26_221610_fix_purchase_receptions_schema_full.php -- $table->id(); $table->foreignId('purchase_reception_id')->constrained()->onDelete('cascade'); $table->foreignId('product_id')->constrained(); $table->decimal('quantity_ordered', 15, 2); $table->decimal('quantity_received', 15, 2)->default(0); $table->decimal('unit_cost', 15, 2)->default(0); $table->text('notes')->nullable(); $table->timestamps(); ====== TABLE: commissions (2 migrations) ====== -- /home/victoriaa/public_html/panel.inversionesvictoriaa.com/database/migrations/2025_10_22_050000_create_commissions_table.php -- $table->id(); $table->foreignId('salesman_id')->constrained('salesmen')->onDelete('cascade'); $table->foreignId('sales_invoice_id')->constrained('sales_invoices')->onDelete('cascade'); $table->foreignId('rule_id')->constrained('commission_rules')->onDelete('cascade'); $table->decimal('amount', 15, 2); $table->decimal('percentage', 5, 2); $table->enum('status', ['pending', 'paid', 'partial', 'cancelled'])->default('pending'); $table->text('notes')->nullable(); $table->foreignId('created_by')->constrained('users')->onDelete('cascade'); $table->foreignId('updated_by')->nullable()->constrained('users')->onDelete('set null'); $table->timestamps(); $table->softDeletes(); $table->index(['salesman_id', 'status'], 'commissions_salesman_id_status_index'); $table->index(['sales_invoice_id'], 'commissions_sales_invoice_id_index'); $table->index(['status', 'created_at'], 'commissions_status_created_at_index'); -- /home/victoriaa/public_html/panel.inversionesvictoriaa.com/database/migrations/2025_10_27_000200_create_commissions_table.php -- $table->id(); $table->foreignId('salesman_id')->constrained('salesmen')->onDelete('cascade'); $table->foreignId('sales_invoice_id')->constrained('sales_invoices')->onDelete('cascade'); $table->foreignId('rule_id')->constrained('commission_rules')->onDelete('cascade'); $table->decimal('amount', 15, 2); $table->decimal('percentage', 5, 2); $table->enum('status', ['pending', 'paid', 'partial', 'cancelled'])->default('pending'); $table->text('notes')->nullable(); $table->foreignId('created_by')->constrained('users')->onDelete('cascade'); $table->foreignId('updated_by')->nullable()->constrained('users')->onDelete('set null'); $table->timestamps(); $table->softDeletes(); $table->index(['salesman_id', 'status'], 'commissions_salesman_id_status_index'); $table->index(['sales_invoice_id'], 'commissions_sales_invoice_id_index'); $table->index(['status', 'created_at'], 'commissions_status_created_at_index'); ====== TABLE: accounts_receivable_payments (2 migrations) ====== -- /home/victoriaa/public_html/panel.inversionesvictoriaa.com/database/migrations/2025_10_27_000100_create_accounts_receivable_payments_table.php -- $table->id(); $table->foreignId('accounts_receivable_id')->constrained('accounts_receivable')->onDelete('cascade'); $table->string('payment_number')->unique(); $table->date('payment_date'); $table->decimal('payment_amount', 15, 2); $table->string('payment_currency', 3)->default('USD'); $table->decimal('payment_exchange_rate', 10, 4)->default(1.0000); $table->decimal('equivalent_amount', 15, 2); $table->enum('payment_method', ['cash', 'check', 'transfer', 'card', 'other'])->default('transfer'); $table->string('payment_reference_number')->nullable(); $table->foreignId('bank_account_id')->nullable()->constrained('bank_accounts')->onDelete('set null'); $table->foreignId('petty_cash_account_id')->nullable()->constrained('petty_cash_accounts')->onDelete('set null'); $table->text('notes')->nullable(); $table->foreignId('created_by')->constrained('users'); $table->timestamps(); $table->index(['accounts_receivable_id', 'payment_date'], 'ar_payments_account_date_idx'); $table->index(['payment_date', 'payment_method'], 'ar_payments_date_method_idx'); -- /home/victoriaa/public_html/panel.inversionesvictoriaa.com/database/migrations/2025_10_28_000000_create_accounts_receivable_payments_table.php -- $table->id(); $table->foreignId('accounts_receivable_id')->constrained('accounts_receivable')->onDelete('cascade'); $table->string('payment_number')->unique(); $table->date('payment_date'); $table->decimal('payment_amount', 15, 2); $table->string('payment_currency', 3)->default('USD'); $table->decimal('payment_exchange_rate', 10, 4)->default(1.0000); $table->decimal('equivalent_amount', 15, 2); $table->enum('payment_method', ['cash', 'check', 'transfer', 'card', 'other'])->default('transfer'); $table->string('payment_reference_number')->nullable(); $table->foreignId('bank_account_id')->nullable()->constrained('bank_accounts')->onDelete('set null'); $table->foreignId('petty_cash_account_id')->nullable()->constrained('petty_cash_accounts')->onDelete('set null'); $table->text('notes')->nullable(); $table->foreignId('created_by')->constrained('users'); $table->timestamps(); $table->index(['accounts_receivable_id', 'payment_date'], 'ar_payments_account_date_idx'); $table->index(['payment_date', 'payment_method'], 'ar_payments_date_method_idx'); Done.