





















const db = require('../models');
const Users = db.users;






const Companies = db.companies;

const Drivers = db.drivers;

const Vehicles = db.vehicles;

const Agreements = db.agreements;

const RecurringInvoiceTemplates = db.recurring_invoice_templates;

const Invoices = db.invoices;

const ChartOfAccounts = db.chart_of_accounts;

const InvoiceLines = db.invoice_lines;

const Payments = db.payments;

const PaymentAllocations = db.payment_allocations;

const Vendors = db.vendors;

const VehicleExpenses = db.vehicle_expenses;

const DriverExpenses = db.driver_expenses;

const Bills = db.bills;

const BillLines = db.bill_lines;

const BillPayments = db.bill_payments;

const LedgerEntries = db.ledger_entries;

const LoanSchedules = db.loan_schedules;

const VehicleCompliance = db.vehicle_compliance;

const Documents = db.documents;

const AuditLogs = db.audit_logs;







const CompaniesData = [
    
    {
    
        
        
            
                "name": "Marie Curie",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Marie Curie",
            
        
    
    },
    
];



const DriversData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "driver_code": "DRV-1001",
            
        
    
        
        
            
                "driver_name": "Michael Harris",
            
        
    
        
        
            
                "phone": "+1-212-555-0142",
            
        
    
        
        
            
                "email": "michael.harris@example.com",
            
        
    
        
        
            
                "address": "120 West 34th Street New York NY",
            
        
    
        
        
            
                "license_number": "NYH-4829137",
            
        
    
        
        
            
                "license_expiry_date": new Date('2027-05-31T00:00:00Z'),
            
        
    
        
        
            
                "national_id": "USNID-48392015",
            
        
    
        
        
            
                "trn_tax_id": "US-TAX-8392015",
            
        
    
        
        
            
                "security_deposit": 500,
            
        
    
        
        
            
                "credit_limit": 1500,
            
        
    
        
        
            
                "status": "blacklisted",
            
        
    
        
        
            
                "notes": "Prefers weekly billing cycle.",
            
        
    
        
        
            
                "created_on": new Date('2025-01-10T09:00:00Z'),
            
        
    
        
        
            
                "modified_on": new Date('2025-06-01T10:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "driver_code": "DRV-1002",
            
        
    
        
        
            
                "driver_name": "Angela Kim",
            
        
    
        
        
            
                "phone": "+1-646-555-0188",
            
        
    
        
        
            
                "email": "angela.kim@example.com",
            
        
    
        
        
            
                "address": "88 Allen Street New York NY",
            
        
    
        
        
            
                "license_number": "NYK-2291044",
            
        
    
        
        
            
                "license_expiry_date": new Date('2026-11-15T00:00:00Z'),
            
        
    
        
        
            
                "national_id": "USNID-22910440",
            
        
    
        
        
            
                "trn_tax_id": "US-TAX-2291044",
            
        
    
        
        
            
                "security_deposit": 400,
            
        
    
        
        
            
                "credit_limit": 1200,
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "notes": "On-time payer historically.",
            
        
    
        
        
            
                "created_on": new Date('2025-01-18T10:30:00Z'),
            
        
    
        
        
            
                "modified_on": new Date('2025-06-12T08:15:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "driver_code": "DRV-2001",
            
        
    
        
        
            
                "driver_name": "Rashid Khan",
            
        
    
        
        
            
                "phone": "+971-50-555-0199",
            
        
    
        
        
            
                "email": "rashid.khan@example.com",
            
        
    
        
        
            
                "address": "Al Barsha Dubai UAE",
            
        
    
        
        
            
                "license_number": "UAE-5582019",
            
        
    
        
        
            
                "license_expiry_date": new Date('2027-02-20T00:00:00Z'),
            
        
    
        
        
            
                "national_id": "UAEID-5582019",
            
        
    
        
        
            
                "trn_tax_id": "AE-TRN-5582019",
            
        
    
        
        
            
                "security_deposit": 1000,
            
        
    
        
        
            
                "credit_limit": 2500,
            
        
    
        
        
            
                "status": "blacklisted",
            
        
    
        
        
            
                "notes": "Assigned to SUV category vehicles.",
            
        
    
        
        
            
                "created_on": new Date('2025-02-20T08:45:00Z'),
            
        
    
        
        
            
                "modified_on": new Date('2025-07-03T09:10:00Z'),
            
        
    
    },
    
];



const VehiclesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "vehicle_code": "VH-001",
            
        
    
        
        
            
                "plate_no": "NYC-8421",
            
        
    
        
        
            
                "engine_no": "EN-5K2M-88421",
            
        
    
        
        
            
                "chassis_no": "CH-9X1A-12098",
            
        
    
        
        
            
                "make": "Toyota",
            
        
    
        
        
            
                "model": "Camry",
            
        
    
        
        
            
                "year": 2022,
            
        
    
        
        
            
                "colour": "White",
            
        
    
        
        
            
                "category": "Sedan",
            
        
    
        
        
            
                "purchase_date": new Date('2024-01-15T00:00:00Z'),
            
        
    
        
        
            
                "purchase_cost": 24500,
            
        
    
        
        
            
                "ownership_type": "financed",
            
        
    
        
        
            
                "status": "sold",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "branch": "Manhattan",
            
        
    
        
        
            
                "odometer": 48210,
            
        
    
        
        
            
                "insurance_policy_no": "INS-NY-22001",
            
        
    
        
        
            
                "notes": "Regular service every 10000 miles.",
            
        
    
        
        
            
                "created_on": new Date('2025-01-08T09:10:00Z'),
            
        
    
        
        
            
                "modified_on": new Date('2026-02-01T12:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "vehicle_code": "VH-002",
            
        
    
        
        
            
                "plate_no": "NYC-1195",
            
        
    
        
        
            
                "engine_no": "EN-2Q7B-11950",
            
        
    
        
        
            
                "chassis_no": "CH-3K8L-44120",
            
        
    
        
        
            
                "make": "Honda",
            
        
    
        
        
            
                "model": "Civic",
            
        
    
        
        
            
                "year": 2021,
            
        
    
        
        
            
                "colour": "Blue",
            
        
    
        
        
            
                "category": "Sedan",
            
        
    
        
        
            
                "purchase_date": new Date('2023-07-10T00:00:00Z'),
            
        
    
        
        
            
                "purchase_cost": 19800,
            
        
    
        
        
            
                "ownership_type": "owned",
            
        
    
        
        
            
                "status": "inactive",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "branch": "Queens",
            
        
    
        
        
            
                "odometer": 60350,
            
        
    
        
        
            
                "insurance_policy_no": "INS-NY-22009",
            
        
    
        
        
            
                "notes": "Tires replaced Jan 2026.",
            
        
    
        
        
            
                "created_on": new Date('2025-01-08T09:20:00Z'),
            
        
    
        
        
            
                "modified_on": new Date('2026-01-20T09:30:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "vehicle_code": "VH-101",
            
        
    
        
        
            
                "plate_no": "DXB-77834",
            
        
    
        
        
            
                "engine_no": "EN-UAE-77834",
            
        
    
        
        
            
                "chassis_no": "CH-UAE-77834",
            
        
    
        
        
            
                "make": "Nissan",
            
        
    
        
        
            
                "model": "Patrol",
            
        
    
        
        
            
                "year": 2023,
            
        
    
        
        
            
                "colour": "Silver",
            
        
    
        
        
            
                "category": "SUV",
            
        
    
        
        
            
                "purchase_date": new Date('2024-05-01T00:00:00Z'),
            
        
    
        
        
            
                "purchase_cost": 315000,
            
        
    
        
        
            
                "ownership_type": "owned",
            
        
    
        
        
            
                "status": "maintenance",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "branch": "Dubai HQ",
            
        
    
        
        
            
                "odometer": 22110,
            
        
    
        
        
            
                "insurance_policy_no": "INS-AE-33001",
            
        
    
        
        
            
                "notes": "Leased vehicle with monthly payments.",
            
        
    
        
        
            
                "created_on": new Date('2025-02-14T08:30:00Z'),
            
        
    
        
        
            
                "modified_on": new Date('2026-02-18T10:10:00Z'),
            
        
    
    },
    
];



const AgreementsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "agreement_number": "AGR-2025-0001",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "agreement_type": "rental",
            
        
    
        
        
            
                "billing_frequency": "daily",
            
        
    
        
        
            
                "daily_rate": 85,
            
        
    
        
        
            
                "weekly_rate": 520,
            
        
    
        
        
            
                "monthly_rate": 2050,
            
        
    
        
        
            
                "deposit_required": true,
            
        
    
        
        
            
                "deposit_amount": 500,
            
        
    
        
        
            
                "start_date": new Date('2025-01-12T00:00:00Z'),
            
        
    
        
        
            
                "end_date": new Date('2025-12-31T00:00:00Z'),
            
        
    
        
        
            
                "recurring_invoice_enabled": true,
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "notes": "Includes standard mileage allowance.",
            
        
    
        
        
            
                "created_on": new Date('2025-01-11T14:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "agreement_number": "AGR-2025-0002",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "agreement_type": "rental",
            
        
    
        
        
            
                "billing_frequency": "daily",
            
        
    
        
        
            
                "daily_rate": 0,
            
        
    
        
        
            
                "weekly_rate": 0,
            
        
    
        
        
            
                "monthly_rate": 1850,
            
        
    
        
        
            
                "deposit_required": true,
            
        
    
        
        
            
                "deposit_amount": 400,
            
        
    
        
        
            
                "start_date": new Date('2025-02-01T00:00:00Z'),
            
        
    
        
        
            
                "end_date": new Date('2026-01-31T00:00:00Z'),
            
        
    
        
        
            
                "recurring_invoice_enabled": true,
            
        
    
        
        
            
                "status": "paused",
            
        
    
        
        
            
                "notes": "Lease with monthly invoicing.",
            
        
    
        
        
            
                "created_on": new Date('2025-01-28T09:30:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "agreement_number": "AGR-2025-0101",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "agreement_type": "lease",
            
        
    
        
        
            
                "billing_frequency": "daily",
            
        
    
        
        
            
                "daily_rate": 210,
            
        
    
        
        
            
                "weekly_rate": 1350,
            
        
    
        
        
            
                "monthly_rate": 5200,
            
        
    
        
        
            
                "deposit_required": true,
            
        
    
        
        
            
                "deposit_amount": 1000,
            
        
    
        
        
            
                "start_date": new Date('2025-02-22T00:00:00Z'),
            
        
    
        
        
            
                "end_date": new Date('2025-11-30T00:00:00Z'),
            
        
    
        
        
            
                "recurring_invoice_enabled": true,
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "notes": "SUV rental for ride-hailing usage.",
            
        
    
        
        
            
                "created_on": new Date('2025-02-21T12:20:00Z'),
            
        
    
    },
    
];



const RecurringInvoiceTemplatesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "billing_frequency": "weekly",
            
        
    
        
        
            
                "rate": 520,
            
        
    
        
        
            
                "next_run_date": new Date('2026-03-17T00:00:00Z'),
            
        
    
        
        
            
                "last_run_date": new Date('2026-03-10T00:00:00Z'),
            
        
    
        
        
            
                "active_flag": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "billing_frequency": "monthly",
            
        
    
        
        
            
                "rate": 1850,
            
        
    
        
        
            
                "next_run_date": new Date('2026-04-01T00:00:00Z'),
            
        
    
        
        
            
                "last_run_date": new Date('2026-03-01T00:00:00Z'),
            
        
    
        
        
            
                "active_flag": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "billing_frequency": "weekly",
            
        
    
        
        
            
                "rate": 1350,
            
        
    
        
        
            
                "next_run_date": new Date('2026-03-18T00:00:00Z'),
            
        
    
        
        
            
                "last_run_date": new Date('2026-03-11T00:00:00Z'),
            
        
    
        
        
            
                "active_flag": true,
            
        
    
    },
    
];



const InvoicesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "invoice_no": "INV-2026-0105",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "issue_date": new Date('2026-03-04T00:00:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2026-03-11T00:00:00Z'),
            
        
    
        
        
            
                "week_start": new Date('2026-02-23T00:00:00Z'),
            
        
    
        
        
            
                "week_end": new Date('2026-03-01T00:00:00Z'),
            
        
    
        
        
            
                "billing_days": 7,
            
        
    
        
        
            
                "holiday_days": 0,
            
        
    
        
        
            
                "billable_days": 7,
            
        
    
        
        
            
                "daily_rate": 85,
            
        
    
        
        
            
                "gross_amount": 595,
            
        
    
        
        
            
                "expense_deductions": 0,
            
        
    
        
        
            
                "net_amount": 595,
            
        
    
        
        
            
                "amount_paid": 595,
            
        
    
        
        
            
                "balance_due": 0,
            
        
    
        
        
            
                "status": "approved",
            
        
    
        
        
            
                "created_on": new Date('2026-03-04T09:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "invoice_no": "INV-2026-0106",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "issue_date": new Date('2026-03-11T00:00:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2026-03-18T00:00:00Z'),
            
        
    
        
        
            
                "week_start": new Date('2026-03-02T00:00:00Z'),
            
        
    
        
        
            
                "week_end": new Date('2026-03-08T00:00:00Z'),
            
        
    
        
        
            
                "billing_days": 7,
            
        
    
        
        
            
                "holiday_days": 0,
            
        
    
        
        
            
                "billable_days": 7,
            
        
    
        
        
            
                "daily_rate": 85,
            
        
    
        
        
            
                "gross_amount": 595,
            
        
    
        
        
            
                "expense_deductions": 0,
            
        
    
        
        
            
                "net_amount": 595,
            
        
    
        
        
            
                "amount_paid": 300,
            
        
    
        
        
            
                "balance_due": 295,
            
        
    
        
        
            
                "status": "overdue",
            
        
    
        
        
            
                "created_on": new Date('2026-03-11T09:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "invoice_no": "INV-2026-0201",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "issue_date": new Date('2026-03-01T00:00:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2026-03-10T00:00:00Z'),
            
        
    
        
        
            
                "week_start": new Date('2026-03-01T00:00:00Z'),
            
        
    
        
        
            
                "week_end": new Date('2026-03-31T00:00:00Z'),
            
        
    
        
        
            
                "billing_days": 31,
            
        
    
        
        
            
                "holiday_days": 0,
            
        
    
        
        
            
                "billable_days": 31,
            
        
    
        
        
            
                "daily_rate": 0,
            
        
    
        
        
            
                "gross_amount": 1850,
            
        
    
        
        
            
                "expense_deductions": 0,
            
        
    
        
        
            
                "net_amount": 1850,
            
        
    
        
        
            
                "amount_paid": 1850,
            
        
    
        
        
            
                "balance_due": 0,
            
        
    
        
        
            
                "status": "overdue",
            
        
    
        
        
            
                "created_on": new Date('2026-03-01T08:00:00Z'),
            
        
    
    },
    
];



const ChartOfAccountsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "account_code": "1000",
            
        
    
        
        
            
                "account_name": "Cash",
            
        
    
        
        
            
                "account_type": "asset",
            
        
    
        
        
            
                "category": "Cash and Cash Equivalents",
            
        
    
        
        
            
                "normal_balance": "debit",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "active",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "account_code": "1010",
            
        
    
        
        
            
                "account_name": "Bank Operating Account",
            
        
    
        
        
            
                "account_type": "expense",
            
        
    
        
        
            
                "category": "Cash and Cash Equivalents",
            
        
    
        
        
            
                "normal_balance": "credit",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "inactive",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "account_code": "1100",
            
        
    
        
        
            
                "account_name": "Accounts Receivable",
            
        
    
        
        
            
                "account_type": "equity",
            
        
    
        
        
            
                "category": "Receivables",
            
        
    
        
        
            
                "normal_balance": "credit",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "inactive",
            
        
    
    },
    
];



const InvoiceLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_type": "mileage_charge",
            
        
    
        
        
            
                "description": "Weekly rental charge for NYC-8421",
            
        
    
        
        
            
                "quantity": 7,
            
        
    
        
        
            
                "rate": 85,
            
        
    
        
        
            
                "amount": 595,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_type": "mileage_charge",
            
        
    
        
        
            
                "description": "Weekly rental charge for NYC-8421",
            
        
    
        
        
            
                "quantity": 7,
            
        
    
        
        
            
                "rate": 85,
            
        
    
        
        
            
                "amount": 595,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_type": "mileage_charge",
            
        
    
        
        
            
                "description": "Monthly lease charge for NYC-1195",
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                "rate": 1850,
            
        
    
        
        
            
                "amount": 1850,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const PaymentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payment_ref": "PAY-2026-0009",
            
        
    
        
        
            
                "payment_date": new Date('2026-03-07T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "amount": 595,
            
        
    
        
        
            
                "allocated_amount": 595,
            
        
    
        
        
            
                "unallocated_amount": 0,
            
        
    
        
        
            
                "method": "other",
            
        
    
        
        
            
                "reference_no": "BANK-TRX-889120",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "notes": "Payment for INV-2026-0105",
            
        
    
        
        
            
                "created_on": new Date('2026-03-07T11:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payment_ref": "PAY-2026-0011",
            
        
    
        
        
            
                "payment_date": new Date('2026-03-12T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "amount": 300,
            
        
    
        
        
            
                "allocated_amount": 300,
            
        
    
        
        
            
                "unallocated_amount": 0,
            
        
    
        
        
            
                "method": "bank_transfer",
            
        
    
        
        
            
                "reference_no": "CASH-REC-10311",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "notes": "Partial payment for INV-2026-0106",
            
        
    
        
        
            
                "created_on": new Date('2026-03-12T16:30:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payment_ref": "PAY-2026-0015",
            
        
    
        
        
            
                "payment_date": new Date('2026-03-05T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "amount": 1850,
            
        
    
        
        
            
                "allocated_amount": 1850,
            
        
    
        
        
            
                "unallocated_amount": 0,
            
        
    
        
        
            
                "method": "card",
            
        
    
        
        
            
                "reference_no": "CARD-APPR-55221",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "reversed",
            
        
    
        
        
            
                "notes": "Payment for INV-2026-0201",
            
        
    
        
        
            
                "created_on": new Date('2026-03-05T10:10:00Z'),
            
        
    
    },
    
];



const PaymentAllocationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "allocation_date": new Date('2026-03-07T00:00:00Z'),
            
        
    
        
        
            
                "amount_allocated": 595,
            
        
    
        
        
            
                "notes": "Full settlement",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "allocation_date": new Date('2026-03-12T00:00:00Z'),
            
        
    
        
        
            
                "amount_allocated": 300,
            
        
    
        
        
            
                "notes": "Partial allocation",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "allocation_date": new Date('2026-03-05T00:00:00Z'),
            
        
    
        
        
            
                "amount_allocated": 1850,
            
        
    
        
        
            
                "notes": "Full settlement",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const VendorsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "vendor_code": "VND-001",
            
        
    
        
        
            
                "vendor_name": "City Tire and Service",
            
        
    
        
        
            
                "phone": "+1-718-555-0120",
            
        
    
        
        
            
                "email": "billing@citytire.example.com",
            
        
    
        
        
            
                "address": "45 Atlantic Ave Brooklyn NY",
            
        
    
        
        
            
                "tax_id": "US-VAT-CT001",
            
        
    
        
        
            
                "payment_terms": "Net 30",
            
        
    
        
        
            
                "status": "inactive",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "vendor_code": "VND-002",
            
        
    
        
        
            
                "vendor_name": "Northside Auto Glass",
            
        
    
        
        
            
                "phone": "+1-646-555-0166",
            
        
    
        
        
            
                "email": "accounts@northsideglass.example.com",
            
        
    
        
        
            
                "address": "210 3rd Ave New York NY",
            
        
    
        
        
            
                "tax_id": "US-VAT-NAG02",
            
        
    
        
        
            
                "payment_terms": "Net 15",
            
        
    
        
        
            
                "status": "inactive",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "vendor_code": "VND-101",
            
        
    
        
        
            
                "vendor_name": "Desert Fuel Cards",
            
        
    
        
        
            
                "phone": "+971-4-555-0101",
            
        
    
        
        
            
                "email": "finance@desertfuel.example.com",
            
        
    
        
        
            
                "address": "Business Bay Dubai UAE",
            
        
    
        
        
            
                "tax_id": "AE-TRN-DF101",
            
        
    
        
        
            
                "payment_terms": "Net 30",
            
        
    
        
        
            
                "status": "inactive",
            
        
    
    },
    
];



const VehicleExpensesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "expense_no": "VE-2026-0010",
            
        
    
        
        
            
                "date": new Date('2026-03-02T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "expense_category": "Maintenance",
            
        
    
        
        
            
                "description": "Oil change and inspection",
            
        
    
        
        
            
                "amount": 120,
            
        
    
        
        
            
                "tax_amount": 10,
            
        
    
        
        
            
                "gross_amount": 130,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "reversed",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "created_on": new Date('2026-03-02T14:10:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "expense_no": "VE-2026-0013",
            
        
    
        
        
            
                "date": new Date('2026-03-06T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "expense_category": "Repairs",
            
        
    
        
        
            
                "description": "Windshield chip repair",
            
        
    
        
        
            
                "amount": 180,
            
        
    
        
        
            
                "tax_amount": 15,
            
        
    
        
        
            
                "gross_amount": 195,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "approved",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "created_on": new Date('2026-03-06T09:25:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "expense_no": "VE-2026-0102",
            
        
    
        
        
            
                "date": new Date('2026-03-04T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "expense_category": "Fuel",
            
        
    
        
        
            
                "description": "Fleet fuel card top-up",
            
        
    
        
        
            
                "amount": 800,
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "gross_amount": 800,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "approved",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "created_on": new Date('2026-03-04T12:00:00Z'),
            
        
    
    },
    
];



const DriverExpensesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "date": new Date('2026-03-03T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "expense_category": "Penalty",
            
        
    
        
        
            
                "description": "Late return penalty assessed",
            
        
    
        
        
            
                "amount": 25,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "charge_to_driver_flag": true,
            
        
    
        
        
            
                "billable_to_driver_flag": true,
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "created_on": new Date('2026-03-03T18:10:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "date": new Date('2026-03-08T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "expense_category": "Fuel Recovery",
            
        
    
        
        
            
                "description": "Fuel recovery charge for low fuel return",
            
        
    
        
        
            
                "amount": 40,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "charge_to_driver_flag": true,
            
        
    
        
        
            
                "billable_to_driver_flag": true,
            
        
    
        
        
            
                "status": "reversed",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "created_on": new Date('2026-03-08T09:30:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "date": new Date('2026-03-05T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "expense_category": "Salik Tolls",
            
        
    
        
        
            
                "description": "Toll charges recovery",
            
        
    
        
        
            
                "amount": 55,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "charge_to_driver_flag": true,
            
        
    
        
        
            
                "billable_to_driver_flag": true,
            
        
    
        
        
            
                "status": "voided",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "created_on": new Date('2026-03-05T13:00:00Z'),
            
        
    
    },
    
];



const BillsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "bill_no": "BILL-2026-0007",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "bill_date": new Date('2026-03-02T00:00:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2026-04-01T00:00:00Z'),
            
        
    
        
        
            
                "gross_amount": 130,
            
        
    
        
        
            
                "amount_paid": 0,
            
        
    
        
        
            
                "balance_due": 130,
            
        
    
        
        
            
                "status": "overdue",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "bill_no": "BILL-2026-0009",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "bill_date": new Date('2026-03-06T00:00:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2026-03-21T00:00:00Z'),
            
        
    
        
        
            
                "gross_amount": 195,
            
        
    
        
        
            
                "amount_paid": 195,
            
        
    
        
        
            
                "balance_due": 0,
            
        
    
        
        
            
                "status": "overdue",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "bill_no": "BILL-2026-0103",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "bill_date": new Date('2026-03-04T00:00:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2026-04-03T00:00:00Z'),
            
        
    
        
        
            
                "gross_amount": 800,
            
        
    
        
        
            
                "amount_paid": 0,
            
        
    
        
        
            
                "balance_due": 800,
            
        
    
        
        
            
                "status": "approved",
            
        
    
    },
    
];



const BillLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Oil change and inspection",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "amount": 130,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Windshield chip repair",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "amount": 195,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Fuel card top-up March",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "amount": 800,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const BillPaymentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payment_date": new Date('2026-03-08T00:00:00Z'),
            
        
    
        
        
            
                "amount": 195,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reference_no": "BP-TRX-10091",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payment_date": new Date('2026-03-01T00:00:00Z'),
            
        
    
        
        
            
                "amount": 420,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reference_no": "BP-TRX-22010",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payment_date": new Date('2026-03-20T00:00:00Z'),
            
        
    
        
        
            
                "amount": 0,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reference_no": "BP-PENDING-0007",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const LedgerEntriesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entry_no": "LE-2026-0001",
            
        
    
        
        
            
                "transaction_date": new Date('2026-03-04T00:00:00Z'),
            
        
    
        
        
            
                "source_module": "bill_payment",
            
        
    
        
        
            
                "source_ref": "INV-2026-0105",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "debit": 595,
            
        
    
        
        
            
                "credit": 0,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Invoice posted to accounts receivable",
            
        
    
        
        
            
                "created_on": new Date('2026-03-04T09:05:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entry_no": "LE-2026-0002",
            
        
    
        
        
            
                "transaction_date": new Date('2026-03-04T00:00:00Z'),
            
        
    
        
        
            
                "source_module": "driver_expense",
            
        
    
        
        
            
                "source_ref": "INV-2026-0105",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "debit": 0,
            
        
    
        
        
            
                "credit": 595,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Revenue recognized for weekly rental",
            
        
    
        
        
            
                "created_on": new Date('2026-03-04T09:05:10Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entry_no": "LE-2026-0003",
            
        
    
        
        
            
                "transaction_date": new Date('2026-03-07T00:00:00Z'),
            
        
    
        
        
            
                "source_module": "opening_balance",
            
        
    
        
        
            
                "source_ref": "PAY-2026-0009",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "debit": 595,
            
        
    
        
        
            
                "credit": 0,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Payment received to bank",
            
        
    
        
        
            
                "created_on": new Date('2026-03-07T11:01:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const LoanSchedulesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "bank_name": "First National Bank",
            
        
    
        
        
            
                "payment_no": "LN-101-0001",
            
        
    
        
        
            
                "payment_date": new Date('2026-03-15T00:00:00Z'),
            
        
    
        
        
            
                "payment_amount": 420,
            
        
    
        
        
            
                "principal": 320,
            
        
    
        
        
            
                "interest": 100,
            
        
    
        
        
            
                "remaining_balance": 8200,
            
        
    
        
        
            
                "status": "overdue",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "bank_name": "First National Bank",
            
        
    
        
        
            
                "payment_no": "LN-101-0002",
            
        
    
        
        
            
                "payment_date": new Date('2026-04-15T00:00:00Z'),
            
        
    
        
        
            
                "payment_amount": 420,
            
        
    
        
        
            
                "principal": 325,
            
        
    
        
        
            
                "interest": 95,
            
        
    
        
        
            
                "remaining_balance": 7875,
            
        
    
        
        
            
                "status": "restructured",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "bank_name": "Emirates Commercial Bank",
            
        
    
        
        
            
                "payment_no": "LN-210-0007",
            
        
    
        
        
            
                "payment_date": new Date('2026-03-20T00:00:00Z'),
            
        
    
        
        
            
                "payment_amount": 2900,
            
        
    
        
        
            
                "principal": 2400,
            
        
    
        
        
            
                "interest": 500,
            
        
    
        
        
            
                "remaining_balance": 112000,
            
        
    
        
        
            
                "status": "skipped",
            
        
    
    },
    
];



const VehicleComplianceData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "registration_expiry": new Date('2026-05-20T00:00:00Z'),
            
        
    
        
        
            
                "fitness_expiry": new Date('2026-06-10T00:00:00Z'),
            
        
    
        
        
            
                "insurance_expiry": new Date('2026-04-15T00:00:00Z'),
            
        
    
        
        
            
                "insurance_policy_no": "INS-NY-22001",
            
        
    
        
        
            
                "certificate_no": "CERT-NY-8421",
            
        
    
        
        
            
                "mileage": 48210,
            
        
    
        
        
            
                "registration_status": "unknown",
            
        
    
        
        
            
                "insurance_status": "valid",
            
        
    
        
        
            
                "fitness_status": "valid",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "registration_expiry": new Date('2026-07-01T00:00:00Z'),
            
        
    
        
        
            
                "fitness_expiry": new Date('2026-07-15T00:00:00Z'),
            
        
    
        
        
            
                "insurance_expiry": new Date('2026-06-30T00:00:00Z'),
            
        
    
        
        
            
                "insurance_policy_no": "INS-NY-22009",
            
        
    
        
        
            
                "certificate_no": "CERT-NY-1195",
            
        
    
        
        
            
                "mileage": 60350,
            
        
    
        
        
            
                "registration_status": "unknown",
            
        
    
        
        
            
                "insurance_status": "unknown",
            
        
    
        
        
            
                "fitness_status": "unknown",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "registration_expiry": new Date('2026-03-25T00:00:00Z'),
            
        
    
        
        
            
                "fitness_expiry": new Date('2026-04-05T00:00:00Z'),
            
        
    
        
        
            
                "insurance_expiry": new Date('2026-04-01T00:00:00Z'),
            
        
    
        
        
            
                "insurance_policy_no": "INS-AE-33001",
            
        
    
        
        
            
                "certificate_no": "CERT-AE-77834",
            
        
    
        
        
            
                "mileage": 22110,
            
        
    
        
        
            
                "registration_status": "valid",
            
        
    
        
        
            
                "insurance_status": "unknown",
            
        
    
        
        
            
                "fitness_status": "unknown",
            
        
    
    },
    
];



const DocumentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entity_type": "loan_schedule",
            
        
    
        
        
            
                "entity_ref": "AGR-2025-0001",
            
        
    
        
        
            
                "file_name": "Agreement AGR-2025-0001 PDF",
            
        
    
        
        
            
                "file_url": "https://files.example.com/docs/agr-2025-0001.pdf",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "uploaded_at": new Date('2025-01-11T14:05:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entity_type": "driver",
            
        
    
        
        
            
                "entity_ref": "INV-2026-0106",
            
        
    
        
        
            
                "file_name": "Invoice INV-2026-0106 PDF",
            
        
    
        
        
            
                "file_url": "https://files.example.com/docs/inv-2026-0106.pdf",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "uploaded_at": new Date('2026-03-11T09:02:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "entity_type": "driver",
            
        
    
        
        
            
                "entity_ref": "CERT-AE-77834",
            
        
    
        
        
            
                "file_name": "Insurance Certificate DXB-77834",
            
        
    
        
        
            
                "file_url": "https://files.example.com/docs/ins-dxb-77834.pdf",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "uploaded_at": new Date('2026-03-01T12:10:00Z'),
            
        
    
    },
    
];



const AuditLogsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "module": "invoices",
            
        
    
        
        
            
                "record_ref": "INV-2026-0106",
            
        
    
        
        
            
                "action": "update",
            
        
    
        
        
            
                "old_value": "status approved",
            
        
    
        
        
            
                "new_value": "status posted",
            
        
    
        
        
            
                "timestamp": new Date('2026-03-11T09:10:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "module": "payments",
            
        
    
        
        
            
                "record_ref": "PAY-2026-0011",
            
        
    
        
        
            
                "action": "export",
            
        
    
        
        
            
                "old_value": "none",
            
        
    
        
        
            
                "new_value": "payment created for Michael Harris",
            
        
    
        
        
            
                "timestamp": new Date('2026-03-12T16:31:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "module": "vehicle_compliance",
            
        
    
        
        
            
                "record_ref": "CERT-AE-77834",
            
        
    
        
        
            
                "action": "update",
            
        
    
        
        
            
                "old_value": "insurance_status valid",
            
        
    
        
        
            
                "new_value": "insurance_status expiring",
            
        
    
        
        
            
                "timestamp": new Date('2026-03-10T08:00:00Z'),
            
        
    
    },
    
];




    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateUserWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const User0 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (User0?.setCompany)
                {
                    await
                    User0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const User1 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (User1?.setCompany)
                {
                    await
                    User1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const User2 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (User2?.setCompany)
                {
                    await
                    User2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    

    
    
    
    
    
        
    

    
    
    
        
            
            async function associateDriverWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Driver0 = await Drivers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Driver0?.setCompany)
                {
                    await
                    Driver0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Driver1 = await Drivers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Driver1?.setCompany)
                {
                    await
                    Driver1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Driver2 = await Drivers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Driver2?.setCompany)
                {
                    await
                    Driver2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateVehicleWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Vehicle0 = await Vehicles.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Vehicle0?.setCompany)
                {
                    await
                    Vehicle0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Vehicle1 = await Vehicles.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Vehicle1?.setCompany)
                {
                    await
                    Vehicle1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Vehicle2 = await Vehicles.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Vehicle2?.setCompany)
                {
                    await
                    Vehicle2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateVehicleWithCurrent_driver() {
            
                const relatedCurrent_driver0 = await Drivers.findOne({
                    offset: Math.floor(Math.random() * (await Drivers.count())),
                });
                const Vehicle0 = await Vehicles.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Vehicle0?.setCurrent_driver)
                {
                    await
                    Vehicle0.
                    setCurrent_driver(relatedCurrent_driver0);
                }
            
                const relatedCurrent_driver1 = await Drivers.findOne({
                    offset: Math.floor(Math.random() * (await Drivers.count())),
                });
                const Vehicle1 = await Vehicles.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Vehicle1?.setCurrent_driver)
                {
                    await
                    Vehicle1.
                    setCurrent_driver(relatedCurrent_driver1);
                }
            
                const relatedCurrent_driver2 = await Drivers.findOne({
                    offset: Math.floor(Math.random() * (await Drivers.count())),
                });
                const Vehicle2 = await Vehicles.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Vehicle2?.setCurrent_driver)
                {
                    await
                    Vehicle2.
                    setCurrent_driver(relatedCurrent_driver2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateAgreementWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Agreement0 = await Agreements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Agreement0?.setCompany)
                {
                    await
                    Agreement0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Agreement1 = await Agreements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Agreement1?.setCompany)
                {
                    await
                    Agreement1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Agreement2 = await Agreements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Agreement2?.setCompany)
                {
                    await
                    Agreement2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
    
        
            
            async function associateAgreementWithDriver() {
            
                const relatedDriver0 = await Drivers.findOne({
                    offset: Math.floor(Math.random() * (await Drivers.count())),
                });
                const Agreement0 = await Agreements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Agreement0?.setDriver)
                {
                    await
                    Agreement0.
                    setDriver(relatedDriver0);
                }
            
                const relatedDriver1 = await Drivers.findOne({
                    offset: Math.floor(Math.random() * (await Drivers.count())),
                });
                const Agreement1 = await Agreements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Agreement1?.setDriver)
                {
                    await
                    Agreement1.
                    setDriver(relatedDriver1);
                }
            
                const relatedDriver2 = await Drivers.findOne({
                    offset: Math.floor(Math.random() * (await Drivers.count())),
                });
                const Agreement2 = await Agreements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Agreement2?.setDriver)
                {
                    await
                    Agreement2.
                    setDriver(relatedDriver2);
                }
            
        }
        
    
        
            
            async function associateAgreementWithVehicle() {
            
                const relatedVehicle0 = await Vehicles.findOne({
                    offset: Math.floor(Math.random() * (await Vehicles.count())),
                });
                const Agreement0 = await Agreements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Agreement0?.setVehicle)
                {
                    await
                    Agreement0.
                    setVehicle(relatedVehicle0);
                }
            
                const relatedVehicle1 = await Vehicles.findOne({
                    offset: Math.floor(Math.random() * (await Vehicles.count())),
                });
                const Agreement1 = await Agreements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Agreement1?.setVehicle)
                {
                    await
                    Agreement1.
                    setVehicle(relatedVehicle1);
                }
            
                const relatedVehicle2 = await Vehicles.findOne({
                    offset: Math.floor(Math.random() * (await Vehicles.count())),
                });
                const Agreement2 = await Agreements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Agreement2?.setVehicle)
                {
                    await
                    Agreement2.
                    setVehicle(relatedVehicle2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateRecurringInvoiceTemplateWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const RecurringInvoiceTemplate0 = await RecurringInvoiceTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RecurringInvoiceTemplate0?.setCompany)
                {
                    await
                    RecurringInvoiceTemplate0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const RecurringInvoiceTemplate1 = await RecurringInvoiceTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RecurringInvoiceTemplate1?.setCompany)
                {
                    await
                    RecurringInvoiceTemplate1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const RecurringInvoiceTemplate2 = await RecurringInvoiceTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RecurringInvoiceTemplate2?.setCompany)
                {
                    await
                    RecurringInvoiceTemplate2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateRecurringInvoiceTemplateWithAgreement() {
            
                const relatedAgreement0 = await Agreements.findOne({
                    offset: Math.floor(Math.random() * (await Agreements.count())),
                });
                const RecurringInvoiceTemplate0 = await RecurringInvoiceTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RecurringInvoiceTemplate0?.setAgreement)
                {
                    await
                    RecurringInvoiceTemplate0.
                    setAgreement(relatedAgreement0);
                }
            
                const relatedAgreement1 = await Agreements.findOne({
                    offset: Math.floor(Math.random() * (await Agreements.count())),
                });
                const RecurringInvoiceTemplate1 = await RecurringInvoiceTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RecurringInvoiceTemplate1?.setAgreement)
                {
                    await
                    RecurringInvoiceTemplate1.
                    setAgreement(relatedAgreement1);
                }
            
                const relatedAgreement2 = await Agreements.findOne({
                    offset: Math.floor(Math.random() * (await Agreements.count())),
                });
                const RecurringInvoiceTemplate2 = await RecurringInvoiceTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RecurringInvoiceTemplate2?.setAgreement)
                {
                    await
                    RecurringInvoiceTemplate2.
                    setAgreement(relatedAgreement2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateInvoiceWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Invoice0 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Invoice0?.setCompany)
                {
                    await
                    Invoice0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Invoice1 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Invoice1?.setCompany)
                {
                    await
                    Invoice1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Invoice2 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Invoice2?.setCompany)
                {
                    await
                    Invoice2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
    
        
            
            async function associateInvoiceWithDriver() {
            
                const relatedDriver0 = await Drivers.findOne({
                    offset: Math.floor(Math.random() * (await Drivers.count())),
                });
                const Invoice0 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Invoice0?.setDriver)
                {
                    await
                    Invoice0.
                    setDriver(relatedDriver0);
                }
            
                const relatedDriver1 = await Drivers.findOne({
                    offset: Math.floor(Math.random() * (await Drivers.count())),
                });
                const Invoice1 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Invoice1?.setDriver)
                {
                    await
                    Invoice1.
                    setDriver(relatedDriver1);
                }
            
                const relatedDriver2 = await Drivers.findOne({
                    offset: Math.floor(Math.random() * (await Drivers.count())),
                });
                const Invoice2 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Invoice2?.setDriver)
                {
                    await
                    Invoice2.
                    setDriver(relatedDriver2);
                }
            
        }
        
    
        
            
            async function associateInvoiceWithVehicle() {
            
                const relatedVehicle0 = await Vehicles.findOne({
                    offset: Math.floor(Math.random() * (await Vehicles.count())),
                });
                const Invoice0 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Invoice0?.setVehicle)
                {
                    await
                    Invoice0.
                    setVehicle(relatedVehicle0);
                }
            
                const relatedVehicle1 = await Vehicles.findOne({
                    offset: Math.floor(Math.random() * (await Vehicles.count())),
                });
                const Invoice1 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Invoice1?.setVehicle)
                {
                    await
                    Invoice1.
                    setVehicle(relatedVehicle1);
                }
            
                const relatedVehicle2 = await Vehicles.findOne({
                    offset: Math.floor(Math.random() * (await Vehicles.count())),
                });
                const Invoice2 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Invoice2?.setVehicle)
                {
                    await
                    Invoice2.
                    setVehicle(relatedVehicle2);
                }
            
        }
        
    
        
            
            async function associateInvoiceWithAgreement() {
            
                const relatedAgreement0 = await Agreements.findOne({
                    offset: Math.floor(Math.random() * (await Agreements.count())),
                });
                const Invoice0 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Invoice0?.setAgreement)
                {
                    await
                    Invoice0.
                    setAgreement(relatedAgreement0);
                }
            
                const relatedAgreement1 = await Agreements.findOne({
                    offset: Math.floor(Math.random() * (await Agreements.count())),
                });
                const Invoice1 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Invoice1?.setAgreement)
                {
                    await
                    Invoice1.
                    setAgreement(relatedAgreement1);
                }
            
                const relatedAgreement2 = await Agreements.findOne({
                    offset: Math.floor(Math.random() * (await Agreements.count())),
                });
                const Invoice2 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Invoice2?.setAgreement)
                {
                    await
                    Invoice2.
                    setAgreement(relatedAgreement2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateChartOfAccountWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const ChartOfAccount0 = await ChartOfAccounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ChartOfAccount0?.setCompany)
                {
                    await
                    ChartOfAccount0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const ChartOfAccount1 = await ChartOfAccounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ChartOfAccount1?.setCompany)
                {
                    await
                    ChartOfAccount1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const ChartOfAccount2 = await ChartOfAccounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ChartOfAccount2?.setCompany)
                {
                    await
                    ChartOfAccount2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateChartOfAccountWithParent_account() {
            
                const relatedParent_account0 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const ChartOfAccount0 = await ChartOfAccounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ChartOfAccount0?.setParent_account)
                {
                    await
                    ChartOfAccount0.
                    setParent_account(relatedParent_account0);
                }
            
                const relatedParent_account1 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const ChartOfAccount1 = await ChartOfAccounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ChartOfAccount1?.setParent_account)
                {
                    await
                    ChartOfAccount1.
                    setParent_account(relatedParent_account1);
                }
            
                const relatedParent_account2 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const ChartOfAccount2 = await ChartOfAccounts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ChartOfAccount2?.setParent_account)
                {
                    await
                    ChartOfAccount2.
                    setParent_account(relatedParent_account2);
                }
            
        }
        
    
        
    

    
    
    
        
            
            async function associateInvoiceLineWithInvoice() {
            
                const relatedInvoice0 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const InvoiceLine0 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InvoiceLine0?.setInvoice)
                {
                    await
                    InvoiceLine0.
                    setInvoice(relatedInvoice0);
                }
            
                const relatedInvoice1 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const InvoiceLine1 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InvoiceLine1?.setInvoice)
                {
                    await
                    InvoiceLine1.
                    setInvoice(relatedInvoice1);
                }
            
                const relatedInvoice2 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const InvoiceLine2 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InvoiceLine2?.setInvoice)
                {
                    await
                    InvoiceLine2.
                    setInvoice(relatedInvoice2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateInvoiceLineWithVehicle() {
            
                const relatedVehicle0 = await Vehicles.findOne({
                    offset: Math.floor(Math.random() * (await Vehicles.count())),
                });
                const InvoiceLine0 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InvoiceLine0?.setVehicle)
                {
                    await
                    InvoiceLine0.
                    setVehicle(relatedVehicle0);
                }
            
                const relatedVehicle1 = await Vehicles.findOne({
                    offset: Math.floor(Math.random() * (await Vehicles.count())),
                });
                const InvoiceLine1 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InvoiceLine1?.setVehicle)
                {
                    await
                    InvoiceLine1.
                    setVehicle(relatedVehicle1);
                }
            
                const relatedVehicle2 = await Vehicles.findOne({
                    offset: Math.floor(Math.random() * (await Vehicles.count())),
                });
                const InvoiceLine2 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InvoiceLine2?.setVehicle)
                {
                    await
                    InvoiceLine2.
                    setVehicle(relatedVehicle2);
                }
            
        }
        
    
        
            
            async function associateInvoiceLineWithRevenue_account() {
            
                const relatedRevenue_account0 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const InvoiceLine0 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InvoiceLine0?.setRevenue_account)
                {
                    await
                    InvoiceLine0.
                    setRevenue_account(relatedRevenue_account0);
                }
            
                const relatedRevenue_account1 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const InvoiceLine1 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InvoiceLine1?.setRevenue_account)
                {
                    await
                    InvoiceLine1.
                    setRevenue_account(relatedRevenue_account1);
                }
            
                const relatedRevenue_account2 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const InvoiceLine2 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InvoiceLine2?.setRevenue_account)
                {
                    await
                    InvoiceLine2.
                    setRevenue_account(relatedRevenue_account2);
                }
            
        }
        
    
        
            
            async function associateInvoiceLineWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const InvoiceLine0 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InvoiceLine0?.setCompany)
                {
                    await
                    InvoiceLine0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const InvoiceLine1 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InvoiceLine1?.setCompany)
                {
                    await
                    InvoiceLine1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const InvoiceLine2 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InvoiceLine2?.setCompany)
                {
                    await
                    InvoiceLine2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    

    
    
    
        
            
            async function associatePaymentWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setCompany)
                {
                    await
                    Payment0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setCompany)
                {
                    await
                    Payment1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setCompany)
                {
                    await
                    Payment2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associatePaymentWithDriver() {
            
                const relatedDriver0 = await Drivers.findOne({
                    offset: Math.floor(Math.random() * (await Drivers.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setDriver)
                {
                    await
                    Payment0.
                    setDriver(relatedDriver0);
                }
            
                const relatedDriver1 = await Drivers.findOne({
                    offset: Math.floor(Math.random() * (await Drivers.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setDriver)
                {
                    await
                    Payment1.
                    setDriver(relatedDriver1);
                }
            
                const relatedDriver2 = await Drivers.findOne({
                    offset: Math.floor(Math.random() * (await Drivers.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setDriver)
                {
                    await
                    Payment2.
                    setDriver(relatedDriver2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associatePaymentWithDeposit_account() {
            
                const relatedDeposit_account0 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setDeposit_account)
                {
                    await
                    Payment0.
                    setDeposit_account(relatedDeposit_account0);
                }
            
                const relatedDeposit_account1 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setDeposit_account)
                {
                    await
                    Payment1.
                    setDeposit_account(relatedDeposit_account1);
                }
            
                const relatedDeposit_account2 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setDeposit_account)
                {
                    await
                    Payment2.
                    setDeposit_account(relatedDeposit_account2);
                }
            
        }
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associatePaymentAllocationWithPayment() {
            
                const relatedPayment0 = await Payments.findOne({
                    offset: Math.floor(Math.random() * (await Payments.count())),
                });
                const PaymentAllocation0 = await PaymentAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PaymentAllocation0?.setPayment)
                {
                    await
                    PaymentAllocation0.
                    setPayment(relatedPayment0);
                }
            
                const relatedPayment1 = await Payments.findOne({
                    offset: Math.floor(Math.random() * (await Payments.count())),
                });
                const PaymentAllocation1 = await PaymentAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PaymentAllocation1?.setPayment)
                {
                    await
                    PaymentAllocation1.
                    setPayment(relatedPayment1);
                }
            
                const relatedPayment2 = await Payments.findOne({
                    offset: Math.floor(Math.random() * (await Payments.count())),
                });
                const PaymentAllocation2 = await PaymentAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PaymentAllocation2?.setPayment)
                {
                    await
                    PaymentAllocation2.
                    setPayment(relatedPayment2);
                }
            
        }
        
    
        
            
            async function associatePaymentAllocationWithInvoice() {
            
                const relatedInvoice0 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const PaymentAllocation0 = await PaymentAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PaymentAllocation0?.setInvoice)
                {
                    await
                    PaymentAllocation0.
                    setInvoice(relatedInvoice0);
                }
            
                const relatedInvoice1 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const PaymentAllocation1 = await PaymentAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PaymentAllocation1?.setInvoice)
                {
                    await
                    PaymentAllocation1.
                    setInvoice(relatedInvoice1);
                }
            
                const relatedInvoice2 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const PaymentAllocation2 = await PaymentAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PaymentAllocation2?.setInvoice)
                {
                    await
                    PaymentAllocation2.
                    setInvoice(relatedInvoice2);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associatePaymentAllocationWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const PaymentAllocation0 = await PaymentAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PaymentAllocation0?.setCompany)
                {
                    await
                    PaymentAllocation0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const PaymentAllocation1 = await PaymentAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PaymentAllocation1?.setCompany)
                {
                    await
                    PaymentAllocation1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const PaymentAllocation2 = await PaymentAllocations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PaymentAllocation2?.setCompany)
                {
                    await
                    PaymentAllocation2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateVendorWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Vendor0 = await Vendors.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Vendor0?.setCompany)
                {
                    await
                    Vendor0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Vendor1 = await Vendors.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Vendor1?.setCompany)
                {
                    await
                    Vendor1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Vendor2 = await Vendors.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Vendor2?.setCompany)
                {
                    await
                    Vendor2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateVehicleExpensWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const VehicleExpens0 = await VehicleExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (VehicleExpens0?.setCompany)
                {
                    await
                    VehicleExpens0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const VehicleExpens1 = await VehicleExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (VehicleExpens1?.setCompany)
                {
                    await
                    VehicleExpens1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const VehicleExpens2 = await VehicleExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (VehicleExpens2?.setCompany)
                {
                    await
                    VehicleExpens2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateVehicleExpensWithVehicle() {
            
                const relatedVehicle0 = await Vehicles.findOne({
                    offset: Math.floor(Math.random() * (await Vehicles.count())),
                });
                const VehicleExpens0 = await VehicleExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (VehicleExpens0?.setVehicle)
                {
                    await
                    VehicleExpens0.
                    setVehicle(relatedVehicle0);
                }
            
                const relatedVehicle1 = await Vehicles.findOne({
                    offset: Math.floor(Math.random() * (await Vehicles.count())),
                });
                const VehicleExpens1 = await VehicleExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (VehicleExpens1?.setVehicle)
                {
                    await
                    VehicleExpens1.
                    setVehicle(relatedVehicle1);
                }
            
                const relatedVehicle2 = await Vehicles.findOne({
                    offset: Math.floor(Math.random() * (await Vehicles.count())),
                });
                const VehicleExpens2 = await VehicleExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (VehicleExpens2?.setVehicle)
                {
                    await
                    VehicleExpens2.
                    setVehicle(relatedVehicle2);
                }
            
        }
        
    
        
            
            async function associateVehicleExpensWithVendor() {
            
                const relatedVendor0 = await Vendors.findOne({
                    offset: Math.floor(Math.random() * (await Vendors.count())),
                });
                const VehicleExpens0 = await VehicleExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (VehicleExpens0?.setVendor)
                {
                    await
                    VehicleExpens0.
                    setVendor(relatedVendor0);
                }
            
                const relatedVendor1 = await Vendors.findOne({
                    offset: Math.floor(Math.random() * (await Vendors.count())),
                });
                const VehicleExpens1 = await VehicleExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (VehicleExpens1?.setVendor)
                {
                    await
                    VehicleExpens1.
                    setVendor(relatedVendor1);
                }
            
                const relatedVendor2 = await Vendors.findOne({
                    offset: Math.floor(Math.random() * (await Vendors.count())),
                });
                const VehicleExpens2 = await VehicleExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (VehicleExpens2?.setVendor)
                {
                    await
                    VehicleExpens2.
                    setVendor(relatedVendor2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateVehicleExpensWithExpense_account() {
            
                const relatedExpense_account0 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const VehicleExpens0 = await VehicleExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (VehicleExpens0?.setExpense_account)
                {
                    await
                    VehicleExpens0.
                    setExpense_account(relatedExpense_account0);
                }
            
                const relatedExpense_account1 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const VehicleExpens1 = await VehicleExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (VehicleExpens1?.setExpense_account)
                {
                    await
                    VehicleExpens1.
                    setExpense_account(relatedExpense_account1);
                }
            
                const relatedExpense_account2 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const VehicleExpens2 = await VehicleExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (VehicleExpens2?.setExpense_account)
                {
                    await
                    VehicleExpens2.
                    setExpense_account(relatedExpense_account2);
                }
            
        }
        
    
        
            
            async function associateVehicleExpensWithPayment_account() {
            
                const relatedPayment_account0 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const VehicleExpens0 = await VehicleExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (VehicleExpens0?.setPayment_account)
                {
                    await
                    VehicleExpens0.
                    setPayment_account(relatedPayment_account0);
                }
            
                const relatedPayment_account1 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const VehicleExpens1 = await VehicleExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (VehicleExpens1?.setPayment_account)
                {
                    await
                    VehicleExpens1.
                    setPayment_account(relatedPayment_account1);
                }
            
                const relatedPayment_account2 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const VehicleExpens2 = await VehicleExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (VehicleExpens2?.setPayment_account)
                {
                    await
                    VehicleExpens2.
                    setPayment_account(relatedPayment_account2);
                }
            
        }
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateDriverExpensWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const DriverExpens0 = await DriverExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DriverExpens0?.setCompany)
                {
                    await
                    DriverExpens0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const DriverExpens1 = await DriverExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DriverExpens1?.setCompany)
                {
                    await
                    DriverExpens1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const DriverExpens2 = await DriverExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DriverExpens2?.setCompany)
                {
                    await
                    DriverExpens2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
    
        
            
            async function associateDriverExpensWithDriver() {
            
                const relatedDriver0 = await Drivers.findOne({
                    offset: Math.floor(Math.random() * (await Drivers.count())),
                });
                const DriverExpens0 = await DriverExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DriverExpens0?.setDriver)
                {
                    await
                    DriverExpens0.
                    setDriver(relatedDriver0);
                }
            
                const relatedDriver1 = await Drivers.findOne({
                    offset: Math.floor(Math.random() * (await Drivers.count())),
                });
                const DriverExpens1 = await DriverExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DriverExpens1?.setDriver)
                {
                    await
                    DriverExpens1.
                    setDriver(relatedDriver1);
                }
            
                const relatedDriver2 = await Drivers.findOne({
                    offset: Math.floor(Math.random() * (await Drivers.count())),
                });
                const DriverExpens2 = await DriverExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DriverExpens2?.setDriver)
                {
                    await
                    DriverExpens2.
                    setDriver(relatedDriver2);
                }
            
        }
        
    
        
            
            async function associateDriverExpensWithVehicle() {
            
                const relatedVehicle0 = await Vehicles.findOne({
                    offset: Math.floor(Math.random() * (await Vehicles.count())),
                });
                const DriverExpens0 = await DriverExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DriverExpens0?.setVehicle)
                {
                    await
                    DriverExpens0.
                    setVehicle(relatedVehicle0);
                }
            
                const relatedVehicle1 = await Vehicles.findOne({
                    offset: Math.floor(Math.random() * (await Vehicles.count())),
                });
                const DriverExpens1 = await DriverExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DriverExpens1?.setVehicle)
                {
                    await
                    DriverExpens1.
                    setVehicle(relatedVehicle1);
                }
            
                const relatedVehicle2 = await Vehicles.findOne({
                    offset: Math.floor(Math.random() * (await Vehicles.count())),
                });
                const DriverExpens2 = await DriverExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DriverExpens2?.setVehicle)
                {
                    await
                    DriverExpens2.
                    setVehicle(relatedVehicle2);
                }
            
        }
        
    
        
            
            async function associateDriverExpensWithAgreement() {
            
                const relatedAgreement0 = await Agreements.findOne({
                    offset: Math.floor(Math.random() * (await Agreements.count())),
                });
                const DriverExpens0 = await DriverExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DriverExpens0?.setAgreement)
                {
                    await
                    DriverExpens0.
                    setAgreement(relatedAgreement0);
                }
            
                const relatedAgreement1 = await Agreements.findOne({
                    offset: Math.floor(Math.random() * (await Agreements.count())),
                });
                const DriverExpens1 = await DriverExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DriverExpens1?.setAgreement)
                {
                    await
                    DriverExpens1.
                    setAgreement(relatedAgreement1);
                }
            
                const relatedAgreement2 = await Agreements.findOne({
                    offset: Math.floor(Math.random() * (await Agreements.count())),
                });
                const DriverExpens2 = await DriverExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DriverExpens2?.setAgreement)
                {
                    await
                    DriverExpens2.
                    setAgreement(relatedAgreement2);
                }
            
        }
        
    
        
            
            async function associateDriverExpensWithInvoice() {
            
                const relatedInvoice0 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const DriverExpens0 = await DriverExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DriverExpens0?.setInvoice)
                {
                    await
                    DriverExpens0.
                    setInvoice(relatedInvoice0);
                }
            
                const relatedInvoice1 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const DriverExpens1 = await DriverExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DriverExpens1?.setInvoice)
                {
                    await
                    DriverExpens1.
                    setInvoice(relatedInvoice1);
                }
            
                const relatedInvoice2 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const DriverExpens2 = await DriverExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DriverExpens2?.setInvoice)
                {
                    await
                    DriverExpens2.
                    setInvoice(relatedInvoice2);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateDriverExpensWithExpense_account() {
            
                const relatedExpense_account0 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const DriverExpens0 = await DriverExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DriverExpens0?.setExpense_account)
                {
                    await
                    DriverExpens0.
                    setExpense_account(relatedExpense_account0);
                }
            
                const relatedExpense_account1 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const DriverExpens1 = await DriverExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DriverExpens1?.setExpense_account)
                {
                    await
                    DriverExpens1.
                    setExpense_account(relatedExpense_account1);
                }
            
                const relatedExpense_account2 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const DriverExpens2 = await DriverExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DriverExpens2?.setExpense_account)
                {
                    await
                    DriverExpens2.
                    setExpense_account(relatedExpense_account2);
                }
            
        }
        
    
        
            
            async function associateDriverExpensWithPayment_account() {
            
                const relatedPayment_account0 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const DriverExpens0 = await DriverExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DriverExpens0?.setPayment_account)
                {
                    await
                    DriverExpens0.
                    setPayment_account(relatedPayment_account0);
                }
            
                const relatedPayment_account1 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const DriverExpens1 = await DriverExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DriverExpens1?.setPayment_account)
                {
                    await
                    DriverExpens1.
                    setPayment_account(relatedPayment_account1);
                }
            
                const relatedPayment_account2 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const DriverExpens2 = await DriverExpenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DriverExpens2?.setPayment_account)
                {
                    await
                    DriverExpens2.
                    setPayment_account(relatedPayment_account2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateBillWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Bill0 = await Bills.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Bill0?.setCompany)
                {
                    await
                    Bill0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Bill1 = await Bills.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Bill1?.setCompany)
                {
                    await
                    Bill1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Bill2 = await Bills.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Bill2?.setCompany)
                {
                    await
                    Bill2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
    
        
            
            async function associateBillWithVendor() {
            
                const relatedVendor0 = await Vendors.findOne({
                    offset: Math.floor(Math.random() * (await Vendors.count())),
                });
                const Bill0 = await Bills.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Bill0?.setVendor)
                {
                    await
                    Bill0.
                    setVendor(relatedVendor0);
                }
            
                const relatedVendor1 = await Vendors.findOne({
                    offset: Math.floor(Math.random() * (await Vendors.count())),
                });
                const Bill1 = await Bills.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Bill1?.setVendor)
                {
                    await
                    Bill1.
                    setVendor(relatedVendor1);
                }
            
                const relatedVendor2 = await Vendors.findOne({
                    offset: Math.floor(Math.random() * (await Vendors.count())),
                });
                const Bill2 = await Bills.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Bill2?.setVendor)
                {
                    await
                    Bill2.
                    setVendor(relatedVendor2);
                }
            
        }
        
    
        
            
            async function associateBillWithVehicle() {
            
                const relatedVehicle0 = await Vehicles.findOne({
                    offset: Math.floor(Math.random() * (await Vehicles.count())),
                });
                const Bill0 = await Bills.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Bill0?.setVehicle)
                {
                    await
                    Bill0.
                    setVehicle(relatedVehicle0);
                }
            
                const relatedVehicle1 = await Vehicles.findOne({
                    offset: Math.floor(Math.random() * (await Vehicles.count())),
                });
                const Bill1 = await Bills.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Bill1?.setVehicle)
                {
                    await
                    Bill1.
                    setVehicle(relatedVehicle1);
                }
            
                const relatedVehicle2 = await Vehicles.findOne({
                    offset: Math.floor(Math.random() * (await Vehicles.count())),
                });
                const Bill2 = await Bills.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Bill2?.setVehicle)
                {
                    await
                    Bill2.
                    setVehicle(relatedVehicle2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateBillLineWithBill() {
            
                const relatedBill0 = await Bills.findOne({
                    offset: Math.floor(Math.random() * (await Bills.count())),
                });
                const BillLine0 = await BillLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (BillLine0?.setBill)
                {
                    await
                    BillLine0.
                    setBill(relatedBill0);
                }
            
                const relatedBill1 = await Bills.findOne({
                    offset: Math.floor(Math.random() * (await Bills.count())),
                });
                const BillLine1 = await BillLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (BillLine1?.setBill)
                {
                    await
                    BillLine1.
                    setBill(relatedBill1);
                }
            
                const relatedBill2 = await Bills.findOne({
                    offset: Math.floor(Math.random() * (await Bills.count())),
                });
                const BillLine2 = await BillLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (BillLine2?.setBill)
                {
                    await
                    BillLine2.
                    setBill(relatedBill2);
                }
            
        }
        
    
        
    
        
            
            async function associateBillLineWithExpense_account() {
            
                const relatedExpense_account0 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const BillLine0 = await BillLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (BillLine0?.setExpense_account)
                {
                    await
                    BillLine0.
                    setExpense_account(relatedExpense_account0);
                }
            
                const relatedExpense_account1 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const BillLine1 = await BillLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (BillLine1?.setExpense_account)
                {
                    await
                    BillLine1.
                    setExpense_account(relatedExpense_account1);
                }
            
                const relatedExpense_account2 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const BillLine2 = await BillLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (BillLine2?.setExpense_account)
                {
                    await
                    BillLine2.
                    setExpense_account(relatedExpense_account2);
                }
            
        }
        
    
        
    
        
            
            async function associateBillLineWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const BillLine0 = await BillLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (BillLine0?.setCompany)
                {
                    await
                    BillLine0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const BillLine1 = await BillLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (BillLine1?.setCompany)
                {
                    await
                    BillLine1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const BillLine2 = await BillLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (BillLine2?.setCompany)
                {
                    await
                    BillLine2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateBillPaymentWithBill() {
            
                const relatedBill0 = await Bills.findOne({
                    offset: Math.floor(Math.random() * (await Bills.count())),
                });
                const BillPayment0 = await BillPayments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (BillPayment0?.setBill)
                {
                    await
                    BillPayment0.
                    setBill(relatedBill0);
                }
            
                const relatedBill1 = await Bills.findOne({
                    offset: Math.floor(Math.random() * (await Bills.count())),
                });
                const BillPayment1 = await BillPayments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (BillPayment1?.setBill)
                {
                    await
                    BillPayment1.
                    setBill(relatedBill1);
                }
            
                const relatedBill2 = await Bills.findOne({
                    offset: Math.floor(Math.random() * (await Bills.count())),
                });
                const BillPayment2 = await BillPayments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (BillPayment2?.setBill)
                {
                    await
                    BillPayment2.
                    setBill(relatedBill2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateBillPaymentWithPayment_account() {
            
                const relatedPayment_account0 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const BillPayment0 = await BillPayments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (BillPayment0?.setPayment_account)
                {
                    await
                    BillPayment0.
                    setPayment_account(relatedPayment_account0);
                }
            
                const relatedPayment_account1 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const BillPayment1 = await BillPayments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (BillPayment1?.setPayment_account)
                {
                    await
                    BillPayment1.
                    setPayment_account(relatedPayment_account1);
                }
            
                const relatedPayment_account2 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const BillPayment2 = await BillPayments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (BillPayment2?.setPayment_account)
                {
                    await
                    BillPayment2.
                    setPayment_account(relatedPayment_account2);
                }
            
        }
        
    
        
    
        
            
            async function associateBillPaymentWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const BillPayment0 = await BillPayments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (BillPayment0?.setCompany)
                {
                    await
                    BillPayment0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const BillPayment1 = await BillPayments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (BillPayment1?.setCompany)
                {
                    await
                    BillPayment1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const BillPayment2 = await BillPayments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (BillPayment2?.setCompany)
                {
                    await
                    BillPayment2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateLedgerEntryWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const LedgerEntry0 = await LedgerEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (LedgerEntry0?.setCompany)
                {
                    await
                    LedgerEntry0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const LedgerEntry1 = await LedgerEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (LedgerEntry1?.setCompany)
                {
                    await
                    LedgerEntry1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const LedgerEntry2 = await LedgerEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (LedgerEntry2?.setCompany)
                {
                    await
                    LedgerEntry2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateLedgerEntryWithAccount() {
            
                const relatedAccount0 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const LedgerEntry0 = await LedgerEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (LedgerEntry0?.setAccount)
                {
                    await
                    LedgerEntry0.
                    setAccount(relatedAccount0);
                }
            
                const relatedAccount1 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const LedgerEntry1 = await LedgerEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (LedgerEntry1?.setAccount)
                {
                    await
                    LedgerEntry1.
                    setAccount(relatedAccount1);
                }
            
                const relatedAccount2 = await ChartOfAccounts.findOne({
                    offset: Math.floor(Math.random() * (await ChartOfAccounts.count())),
                });
                const LedgerEntry2 = await LedgerEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (LedgerEntry2?.setAccount)
                {
                    await
                    LedgerEntry2.
                    setAccount(relatedAccount2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateLedgerEntryWithDriver() {
            
                const relatedDriver0 = await Drivers.findOne({
                    offset: Math.floor(Math.random() * (await Drivers.count())),
                });
                const LedgerEntry0 = await LedgerEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (LedgerEntry0?.setDriver)
                {
                    await
                    LedgerEntry0.
                    setDriver(relatedDriver0);
                }
            
                const relatedDriver1 = await Drivers.findOne({
                    offset: Math.floor(Math.random() * (await Drivers.count())),
                });
                const LedgerEntry1 = await LedgerEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (LedgerEntry1?.setDriver)
                {
                    await
                    LedgerEntry1.
                    setDriver(relatedDriver1);
                }
            
                const relatedDriver2 = await Drivers.findOne({
                    offset: Math.floor(Math.random() * (await Drivers.count())),
                });
                const LedgerEntry2 = await LedgerEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (LedgerEntry2?.setDriver)
                {
                    await
                    LedgerEntry2.
                    setDriver(relatedDriver2);
                }
            
        }
        
    
        
            
            async function associateLedgerEntryWithVehicle() {
            
                const relatedVehicle0 = await Vehicles.findOne({
                    offset: Math.floor(Math.random() * (await Vehicles.count())),
                });
                const LedgerEntry0 = await LedgerEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (LedgerEntry0?.setVehicle)
                {
                    await
                    LedgerEntry0.
                    setVehicle(relatedVehicle0);
                }
            
                const relatedVehicle1 = await Vehicles.findOne({
                    offset: Math.floor(Math.random() * (await Vehicles.count())),
                });
                const LedgerEntry1 = await LedgerEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (LedgerEntry1?.setVehicle)
                {
                    await
                    LedgerEntry1.
                    setVehicle(relatedVehicle1);
                }
            
                const relatedVehicle2 = await Vehicles.findOne({
                    offset: Math.floor(Math.random() * (await Vehicles.count())),
                });
                const LedgerEntry2 = await LedgerEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (LedgerEntry2?.setVehicle)
                {
                    await
                    LedgerEntry2.
                    setVehicle(relatedVehicle2);
                }
            
        }
        
    
        
            
            async function associateLedgerEntryWithInvoice() {
            
                const relatedInvoice0 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const LedgerEntry0 = await LedgerEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (LedgerEntry0?.setInvoice)
                {
                    await
                    LedgerEntry0.
                    setInvoice(relatedInvoice0);
                }
            
                const relatedInvoice1 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const LedgerEntry1 = await LedgerEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (LedgerEntry1?.setInvoice)
                {
                    await
                    LedgerEntry1.
                    setInvoice(relatedInvoice1);
                }
            
                const relatedInvoice2 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const LedgerEntry2 = await LedgerEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (LedgerEntry2?.setInvoice)
                {
                    await
                    LedgerEntry2.
                    setInvoice(relatedInvoice2);
                }
            
        }
        
    
        
            
            async function associateLedgerEntryWithPayment() {
            
                const relatedPayment0 = await Payments.findOne({
                    offset: Math.floor(Math.random() * (await Payments.count())),
                });
                const LedgerEntry0 = await LedgerEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (LedgerEntry0?.setPayment)
                {
                    await
                    LedgerEntry0.
                    setPayment(relatedPayment0);
                }
            
                const relatedPayment1 = await Payments.findOne({
                    offset: Math.floor(Math.random() * (await Payments.count())),
                });
                const LedgerEntry1 = await LedgerEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (LedgerEntry1?.setPayment)
                {
                    await
                    LedgerEntry1.
                    setPayment(relatedPayment1);
                }
            
                const relatedPayment2 = await Payments.findOne({
                    offset: Math.floor(Math.random() * (await Payments.count())),
                });
                const LedgerEntry2 = await LedgerEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (LedgerEntry2?.setPayment)
                {
                    await
                    LedgerEntry2.
                    setPayment(relatedPayment2);
                }
            
        }
        
    
        
            
            async function associateLedgerEntryWithVehicle_expense() {
            
                const relatedVehicle_expense0 = await VehicleExpenses.findOne({
                    offset: Math.floor(Math.random() * (await VehicleExpenses.count())),
                });
                const LedgerEntry0 = await LedgerEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (LedgerEntry0?.setVehicle_expense)
                {
                    await
                    LedgerEntry0.
                    setVehicle_expense(relatedVehicle_expense0);
                }
            
                const relatedVehicle_expense1 = await VehicleExpenses.findOne({
                    offset: Math.floor(Math.random() * (await VehicleExpenses.count())),
                });
                const LedgerEntry1 = await LedgerEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (LedgerEntry1?.setVehicle_expense)
                {
                    await
                    LedgerEntry1.
                    setVehicle_expense(relatedVehicle_expense1);
                }
            
                const relatedVehicle_expense2 = await VehicleExpenses.findOne({
                    offset: Math.floor(Math.random() * (await VehicleExpenses.count())),
                });
                const LedgerEntry2 = await LedgerEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (LedgerEntry2?.setVehicle_expense)
                {
                    await
                    LedgerEntry2.
                    setVehicle_expense(relatedVehicle_expense2);
                }
            
        }
        
    
        
            
            async function associateLedgerEntryWithBill() {
            
                const relatedBill0 = await Bills.findOne({
                    offset: Math.floor(Math.random() * (await Bills.count())),
                });
                const LedgerEntry0 = await LedgerEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (LedgerEntry0?.setBill)
                {
                    await
                    LedgerEntry0.
                    setBill(relatedBill0);
                }
            
                const relatedBill1 = await Bills.findOne({
                    offset: Math.floor(Math.random() * (await Bills.count())),
                });
                const LedgerEntry1 = await LedgerEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (LedgerEntry1?.setBill)
                {
                    await
                    LedgerEntry1.
                    setBill(relatedBill1);
                }
            
                const relatedBill2 = await Bills.findOne({
                    offset: Math.floor(Math.random() * (await Bills.count())),
                });
                const LedgerEntry2 = await LedgerEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (LedgerEntry2?.setBill)
                {
                    await
                    LedgerEntry2.
                    setBill(relatedBill2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateLedgerEntryWithReversal_entry() {
            
                const relatedReversal_entry0 = await LedgerEntries.findOne({
                    offset: Math.floor(Math.random() * (await LedgerEntries.count())),
                });
                const LedgerEntry0 = await LedgerEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (LedgerEntry0?.setReversal_entry)
                {
                    await
                    LedgerEntry0.
                    setReversal_entry(relatedReversal_entry0);
                }
            
                const relatedReversal_entry1 = await LedgerEntries.findOne({
                    offset: Math.floor(Math.random() * (await LedgerEntries.count())),
                });
                const LedgerEntry1 = await LedgerEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (LedgerEntry1?.setReversal_entry)
                {
                    await
                    LedgerEntry1.
                    setReversal_entry(relatedReversal_entry1);
                }
            
                const relatedReversal_entry2 = await LedgerEntries.findOne({
                    offset: Math.floor(Math.random() * (await LedgerEntries.count())),
                });
                const LedgerEntry2 = await LedgerEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (LedgerEntry2?.setReversal_entry)
                {
                    await
                    LedgerEntry2.
                    setReversal_entry(relatedReversal_entry2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateLoanScheduleWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const LoanSchedule0 = await LoanSchedules.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (LoanSchedule0?.setCompany)
                {
                    await
                    LoanSchedule0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const LoanSchedule1 = await LoanSchedules.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (LoanSchedule1?.setCompany)
                {
                    await
                    LoanSchedule1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const LoanSchedule2 = await LoanSchedules.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (LoanSchedule2?.setCompany)
                {
                    await
                    LoanSchedule2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateLoanScheduleWithVehicle() {
            
                const relatedVehicle0 = await Vehicles.findOne({
                    offset: Math.floor(Math.random() * (await Vehicles.count())),
                });
                const LoanSchedule0 = await LoanSchedules.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (LoanSchedule0?.setVehicle)
                {
                    await
                    LoanSchedule0.
                    setVehicle(relatedVehicle0);
                }
            
                const relatedVehicle1 = await Vehicles.findOne({
                    offset: Math.floor(Math.random() * (await Vehicles.count())),
                });
                const LoanSchedule1 = await LoanSchedules.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (LoanSchedule1?.setVehicle)
                {
                    await
                    LoanSchedule1.
                    setVehicle(relatedVehicle1);
                }
            
                const relatedVehicle2 = await Vehicles.findOne({
                    offset: Math.floor(Math.random() * (await Vehicles.count())),
                });
                const LoanSchedule2 = await LoanSchedules.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (LoanSchedule2?.setVehicle)
                {
                    await
                    LoanSchedule2.
                    setVehicle(relatedVehicle2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateVehicleComplianceWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const VehicleCompliance0 = await VehicleCompliance.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (VehicleCompliance0?.setCompany)
                {
                    await
                    VehicleCompliance0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const VehicleCompliance1 = await VehicleCompliance.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (VehicleCompliance1?.setCompany)
                {
                    await
                    VehicleCompliance1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const VehicleCompliance2 = await VehicleCompliance.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (VehicleCompliance2?.setCompany)
                {
                    await
                    VehicleCompliance2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateVehicleComplianceWithVehicle() {
            
                const relatedVehicle0 = await Vehicles.findOne({
                    offset: Math.floor(Math.random() * (await Vehicles.count())),
                });
                const VehicleCompliance0 = await VehicleCompliance.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (VehicleCompliance0?.setVehicle)
                {
                    await
                    VehicleCompliance0.
                    setVehicle(relatedVehicle0);
                }
            
                const relatedVehicle1 = await Vehicles.findOne({
                    offset: Math.floor(Math.random() * (await Vehicles.count())),
                });
                const VehicleCompliance1 = await VehicleCompliance.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (VehicleCompliance1?.setVehicle)
                {
                    await
                    VehicleCompliance1.
                    setVehicle(relatedVehicle1);
                }
            
                const relatedVehicle2 = await Vehicles.findOne({
                    offset: Math.floor(Math.random() * (await Vehicles.count())),
                });
                const VehicleCompliance2 = await VehicleCompliance.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (VehicleCompliance2?.setVehicle)
                {
                    await
                    VehicleCompliance2.
                    setVehicle(relatedVehicle2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateDocumentWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Document0 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Document0?.setCompany)
                {
                    await
                    Document0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Document1 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Document1?.setCompany)
                {
                    await
                    Document1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Document2 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Document2?.setCompany)
                {
                    await
                    Document2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateDocumentWithUploaded_by_user() {
            
                const relatedUploaded_by_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Document0 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Document0?.setUploaded_by_user)
                {
                    await
                    Document0.
                    setUploaded_by_user(relatedUploaded_by_user0);
                }
            
                const relatedUploaded_by_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Document1 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Document1?.setUploaded_by_user)
                {
                    await
                    Document1.
                    setUploaded_by_user(relatedUploaded_by_user1);
                }
            
                const relatedUploaded_by_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Document2 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Document2?.setUploaded_by_user)
                {
                    await
                    Document2.
                    setUploaded_by_user(relatedUploaded_by_user2);
                }
            
        }
        
    
        
    

    
    
    
        
            
            async function associateAuditLogWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const AuditLog0 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AuditLog0?.setCompany)
                {
                    await
                    AuditLog0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const AuditLog1 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AuditLog1?.setCompany)
                {
                    await
                    AuditLog1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const AuditLog2 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AuditLog2?.setCompany)
                {
                    await
                    AuditLog2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateAuditLogWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditLog0 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AuditLog0?.setUser)
                {
                    await
                    AuditLog0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditLog1 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AuditLog1?.setUser)
                {
                    await
                    AuditLog1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditLog2 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AuditLog2?.setUser)
                {
                    await
                    AuditLog2.
                    setUser(relatedUser2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    


module.exports = {
    up: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
                
                await Companies.bulkCreate(CompaniesData);
                
            
            
                
                await Drivers.bulkCreate(DriversData);
                
            
            
                
                await Vehicles.bulkCreate(VehiclesData);
                
            
            
                
                await Agreements.bulkCreate(AgreementsData);
                
            
            
                
                await RecurringInvoiceTemplates.bulkCreate(RecurringInvoiceTemplatesData);
                
            
            
                
                await Invoices.bulkCreate(InvoicesData);
                
            
            
                
                await ChartOfAccounts.bulkCreate(ChartOfAccountsData);
                
            
            
                
                await InvoiceLines.bulkCreate(InvoiceLinesData);
                
            
            
                
                await Payments.bulkCreate(PaymentsData);
                
            
            
                
                await PaymentAllocations.bulkCreate(PaymentAllocationsData);
                
            
            
                
                await Vendors.bulkCreate(VendorsData);
                
            
            
                
                await VehicleExpenses.bulkCreate(VehicleExpensesData);
                
            
            
                
                await DriverExpenses.bulkCreate(DriverExpensesData);
                
            
            
                
                await Bills.bulkCreate(BillsData);
                
            
            
                
                await BillLines.bulkCreate(BillLinesData);
                
            
            
                
                await BillPayments.bulkCreate(BillPaymentsData);
                
            
            
                
                await LedgerEntries.bulkCreate(LedgerEntriesData);
                
            
            
                
                await LoanSchedules.bulkCreate(LoanSchedulesData);
                
            
            
                
                await VehicleCompliance.bulkCreate(VehicleComplianceData);
                
            
            
                
                await Documents.bulkCreate(DocumentsData);
                
            
            
                
                await AuditLogs.bulkCreate(AuditLogsData);
                
            
            await Promise.all([
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateUserWithCompany(),
                    
                
            
                
                
                
                
                    
                
            
                
                
                    
                        
                        await associateDriverWithCompany(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateVehicleWithCompany(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateVehicleWithCurrent_driver(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateAgreementWithCompany(),
                    
                
                    
                
                    
                        
                        await associateAgreementWithDriver(),
                    
                
                    
                        
                        await associateAgreementWithVehicle(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateRecurringInvoiceTemplateWithCompany(),
                    
                
                    
                        
                        await associateRecurringInvoiceTemplateWithAgreement(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateInvoiceWithCompany(),
                    
                
                    
                
                    
                        
                        await associateInvoiceWithDriver(),
                    
                
                    
                        
                        await associateInvoiceWithVehicle(),
                    
                
                    
                        
                        await associateInvoiceWithAgreement(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateChartOfAccountWithCompany(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateChartOfAccountWithParent_account(),
                    
                
                    
                
            
                
                
                    
                        
                        await associateInvoiceLineWithInvoice(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateInvoiceLineWithVehicle(),
                    
                
                    
                        
                        await associateInvoiceLineWithRevenue_account(),
                    
                
                    
                        
                        await associateInvoiceLineWithCompany(),
                    
                
            
                
                
                    
                        
                        await associatePaymentWithCompany(),
                    
                
                    
                
                    
                
                    
                        
                        await associatePaymentWithDriver(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePaymentWithDeposit_account(),
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associatePaymentAllocationWithPayment(),
                    
                
                    
                        
                        await associatePaymentAllocationWithInvoice(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePaymentAllocationWithCompany(),
                    
                
            
                
                
                    
                        
                        await associateVendorWithCompany(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateVehicleExpensWithCompany(),
                    
                
                    
                
                    
                
                    
                        
                        await associateVehicleExpensWithVehicle(),
                    
                
                    
                        
                        await associateVehicleExpensWithVendor(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateVehicleExpensWithExpense_account(),
                    
                
                    
                        
                        await associateVehicleExpensWithPayment_account(),
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateDriverExpensWithCompany(),
                    
                
                    
                
                    
                        
                        await associateDriverExpensWithDriver(),
                    
                
                    
                        
                        await associateDriverExpensWithVehicle(),
                    
                
                    
                        
                        await associateDriverExpensWithAgreement(),
                    
                
                    
                        
                        await associateDriverExpensWithInvoice(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateDriverExpensWithExpense_account(),
                    
                
                    
                        
                        await associateDriverExpensWithPayment_account(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateBillWithCompany(),
                    
                
                    
                
                    
                        
                        await associateBillWithVendor(),
                    
                
                    
                        
                        await associateBillWithVehicle(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateBillLineWithBill(),
                    
                
                    
                
                    
                        
                        await associateBillLineWithExpense_account(),
                    
                
                    
                
                    
                        
                        await associateBillLineWithCompany(),
                    
                
            
                
                
                    
                        
                        await associateBillPaymentWithBill(),
                    
                
                    
                
                    
                
                    
                        
                        await associateBillPaymentWithPayment_account(),
                    
                
                    
                
                    
                        
                        await associateBillPaymentWithCompany(),
                    
                
            
                
                
                    
                        
                        await associateLedgerEntryWithCompany(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateLedgerEntryWithAccount(),
                    
                
                    
                
                    
                
                    
                        
                        await associateLedgerEntryWithDriver(),
                    
                
                    
                        
                        await associateLedgerEntryWithVehicle(),
                    
                
                    
                        
                        await associateLedgerEntryWithInvoice(),
                    
                
                    
                        
                        await associateLedgerEntryWithPayment(),
                    
                
                    
                        
                        await associateLedgerEntryWithVehicle_expense(),
                    
                
                    
                        
                        await associateLedgerEntryWithBill(),
                    
                
                    
                
                    
                
                    
                        
                        await associateLedgerEntryWithReversal_entry(),
                    
                
            
                
                
                    
                        
                        await associateLoanScheduleWithCompany(),
                    
                
                    
                        
                        await associateLoanScheduleWithVehicle(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateVehicleComplianceWithCompany(),
                    
                
                    
                        
                        await associateVehicleComplianceWithVehicle(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateDocumentWithCompany(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateDocumentWithUploaded_by_user(),
                    
                
                    
                
            
                
                
                    
                        
                        await associateAuditLogWithCompany(),
                    
                
                    
                        
                        await associateAuditLogWithUser(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            ]);
        
    },

    down: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
            await queryInterface.bulkDelete('companies', null, {});
            
            
            await queryInterface.bulkDelete('drivers', null, {});
            
            
            await queryInterface.bulkDelete('vehicles', null, {});
            
            
            await queryInterface.bulkDelete('agreements', null, {});
            
            
            await queryInterface.bulkDelete('recurring_invoice_templates', null, {});
            
            
            await queryInterface.bulkDelete('invoices', null, {});
            
            
            await queryInterface.bulkDelete('chart_of_accounts', null, {});
            
            
            await queryInterface.bulkDelete('invoice_lines', null, {});
            
            
            await queryInterface.bulkDelete('payments', null, {});
            
            
            await queryInterface.bulkDelete('payment_allocations', null, {});
            
            
            await queryInterface.bulkDelete('vendors', null, {});
            
            
            await queryInterface.bulkDelete('vehicle_expenses', null, {});
            
            
            await queryInterface.bulkDelete('driver_expenses', null, {});
            
            
            await queryInterface.bulkDelete('bills', null, {});
            
            
            await queryInterface.bulkDelete('bill_lines', null, {});
            
            
            await queryInterface.bulkDelete('bill_payments', null, {});
            
            
            await queryInterface.bulkDelete('ledger_entries', null, {});
            
            
            await queryInterface.bulkDelete('loan_schedules', null, {});
            
            
            await queryInterface.bulkDelete('vehicle_compliance', null, {});
            
            
            await queryInterface.bulkDelete('documents', null, {});
            
            
            await queryInterface.bulkDelete('audit_logs', null, {});
            
        
    },
};