





















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






const Organizations = db.organizations;

const Memberships = db.memberships;

const OrganizationSettings = db.organization_settings;

const TaxCodes = db.tax_codes;

const Contacts = db.contacts;

const Products = db.products;

const Warehouses = db.warehouses;

const InventoryItems = db.inventory_items;

const Quotes = db.quotes;

const QuoteLines = db.quote_lines;

const Invoices = db.invoices;

const InvoiceLines = db.invoice_lines;

const Payments = db.payments;

const Receipts = db.receipts;

const Expenses = db.expenses;

const ApprovalRequests = db.approval_requests;

const Projects = db.projects;

const Tasks = db.tasks;

const TimeEntries = db.time_entries;

const EfrisConnections = db.efris_connections;

const EfrisSubmissions = db.efris_submissions;

const AuditEvents = db.audit_events;







const OrganizationsData = [
    
    {
    
        
        
            
                "name": "Lakeview Traders Ltd",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Kembo Imports",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Rwenzori Services Co",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Nile Fresh Foods",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Kampala Tech Hub",
            
        
    
    },
    
];



const MembershipsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "role": "viewer",
            
        
    
        
        
            
                "status": "invited",
            
        
    
        
        
            
                "joined_on": new Date('2025-01-10T09:00:00Z'),
            
        
    
        
        
            
                "invitation_email": "grace.nakato@lakeviewtraders.ug",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "role": "viewer",
            
        
    
        
        
            
                "status": "invited",
            
        
    
        
        
            
                "joined_on": new Date('2025-01-12T09:00:00Z'),
            
        
    
        
        
            
                "invitation_email": "daniel.okello@lakeviewtraders.ug",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "role": "owner",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "joined_on": new Date('2025-02-03T09:00:00Z'),
            
        
    
        
        
            
                "invitation_email": "aisha.kato@kemboimports.ug",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "role": "accountant",
            
        
    
        
        
            
                "status": "disabled",
            
        
    
        
        
            
                "joined_on": new Date('2025-02-10T09:00:00Z'),
            
        
    
        
        
            
                "invitation_email": "peter.mwangi@kemboimports.ug",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "role": "viewer",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "joined_on": new Date('2025-01-15T09:00:00Z'),
            
        
    
        
        
            
                "invitation_email": "sarah.atim@platform.example",
            
        
    
    },
    
];



const OrganizationSettingsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "default_currency_code": "UGX",
            
        
    
        
        
            
                "default_language": "en",
            
        
    
        
        
            
                "default_timezone": "Africa/Kampala",
            
        
    
        
        
            
                "invoice_prefix": "LVT-INV",
            
        
    
        
        
            
                "quote_prefix": "LVT-QUO",
            
        
    
        
        
            
                "receipt_prefix": "LVT-RCT",
            
        
    
        
        
            
                "default_vat_rate": 0.18,
            
        
    
        
        
            
                "prices_include_tax": false,
            
        
    
        
        
            
                "enable_inventory": true,
            
        
    
        
        
            
                "enable_projects": true,
            
        
    
        
        
            
                "enable_approvals": true,
            
        
    
        
        
            
                "invoice_footer_note": "Thank you for your business.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "default_currency_code": "UGX",
            
        
    
        
        
            
                "default_language": "en",
            
        
    
        
        
            
                "default_timezone": "Africa/Kampala",
            
        
    
        
        
            
                "invoice_prefix": "KIM-INV",
            
        
    
        
        
            
                "quote_prefix": "KIM-QUO",
            
        
    
        
        
            
                "receipt_prefix": "KIM-RCT",
            
        
    
        
        
            
                "default_vat_rate": 0.18,
            
        
    
        
        
            
                "prices_include_tax": true,
            
        
    
        
        
            
                "enable_inventory": true,
            
        
    
        
        
            
                "enable_projects": true,
            
        
    
        
        
            
                "enable_approvals": true,
            
        
    
        
        
            
                "invoice_footer_note": "Payments due within stated terms.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "default_currency_code": "UGX",
            
        
    
        
        
            
                "default_language": "en",
            
        
    
        
        
            
                "default_timezone": "Africa/Kampala",
            
        
    
        
        
            
                "invoice_prefix": "RSC-INV",
            
        
    
        
        
            
                "quote_prefix": "RSC-QUO",
            
        
    
        
        
            
                "receipt_prefix": "RSC-RCT",
            
        
    
        
        
            
                "default_vat_rate": 0.18,
            
        
    
        
        
            
                "prices_include_tax": true,
            
        
    
        
        
            
                "enable_inventory": false,
            
        
    
        
        
            
                "enable_projects": true,
            
        
    
        
        
            
                "enable_approvals": true,
            
        
    
        
        
            
                "invoice_footer_note": "All services are subject to engagement terms.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "default_currency_code": "UGX",
            
        
    
        
        
            
                "default_language": "en",
            
        
    
        
        
            
                "default_timezone": "Africa/Kampala",
            
        
    
        
        
            
                "invoice_prefix": "NFF-INV",
            
        
    
        
        
            
                "quote_prefix": "NFF-QUO",
            
        
    
        
        
            
                "receipt_prefix": "NFF-RCT",
            
        
    
        
        
            
                "default_vat_rate": 0.18,
            
        
    
        
        
            
                "prices_include_tax": true,
            
        
    
        
        
            
                "enable_inventory": true,
            
        
    
        
        
            
                "enable_projects": true,
            
        
    
        
        
            
                "enable_approvals": true,
            
        
    
        
        
            
                "invoice_footer_note": "Goods once sold are not returnable unless agreed.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "default_currency_code": "UGX",
            
        
    
        
        
            
                "default_language": "en",
            
        
    
        
        
            
                "default_timezone": "Africa/Kampala",
            
        
    
        
        
            
                "invoice_prefix": "KTH-INV",
            
        
    
        
        
            
                "quote_prefix": "KTH-QUO",
            
        
    
        
        
            
                "receipt_prefix": "KTH-RCT",
            
        
    
        
        
            
                "default_vat_rate": 0.18,
            
        
    
        
        
            
                "prices_include_tax": true,
            
        
    
        
        
            
                "enable_inventory": true,
            
        
    
        
        
            
                "enable_projects": true,
            
        
    
        
        
            
                "enable_approvals": true,
            
        
    
        
        
            
                "invoice_footer_note": "Late payments may incur service suspension.",
            
        
    
    },
    
];



const TaxCodesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "VAT Standard 18%",
            
        
    
        
        
            
                "code": "VAT18",
            
        
    
        
        
            
                "rate": 0.18,
            
        
    
        
        
            
                "tax_type": "excise",
            
        
    
        
        
            
                "is_default": true,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "description": "Standard VAT rate in Uganda",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "VAT Zero Rated",
            
        
    
        
        
            
                "code": "VAT0",
            
        
    
        
        
            
                "rate": 0,
            
        
    
        
        
            
                "tax_type": "none",
            
        
    
        
        
            
                "is_default": false,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "description": "Zero-rated supplies",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "VAT Standard 18%",
            
        
    
        
        
            
                "code": "VAT18",
            
        
    
        
        
            
                "rate": 0.18,
            
        
    
        
        
            
                "tax_type": "withholding",
            
        
    
        
        
            
                "is_default": true,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "description": "Standard VAT rate",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "No VAT",
            
        
    
        
        
            
                "code": "NOVAT",
            
        
    
        
        
            
                "rate": 0,
            
        
    
        
        
            
                "tax_type": "withholding",
            
        
    
        
        
            
                "is_default": true,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "description": "Non-taxable items",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Withholding 6%",
            
        
    
        
        
            
                "code": "WHT6",
            
        
    
        
        
            
                "rate": 0.06,
            
        
    
        
        
            
                "tax_type": "excise",
            
        
    
        
        
            
                "is_default": false,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "description": "Withholding tax when applicable",
            
        
    
    },
    
];



const ContactsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "contact_type": "lead",
            
        
    
        
        
            
                "display_name": "Kampala Stationers",
            
        
    
        
        
            
                "company_name": "Kampala Stationers Ltd",
            
        
    
        
        
            
                "first_name": "",
            
        
    
        
        
            
                "last_name": "",
            
        
    
        
        
            
                "email": "purchasing@kampalastationers.ug",
            
        
    
        
        
            
                "phone": "+256772111000",
            
        
    
        
        
            
                "tin": "1001122334",
            
        
    
        
        
            
                "vrn": "VRN-UG-120001",
            
        
    
        
        
            
                "billing_address_line1": "Nakasero Hill Road 3",
            
        
    
        
        
            
                "billing_address_line2": "",
            
        
    
        
        
            
                "billing_city": "Kampala",
            
        
    
        
        
            
                "billing_state_region": "Central",
            
        
    
        
        
            
                "billing_postal_code": "11000",
            
        
    
        
        
            
                "billing_country": "Uganda",
            
        
    
        
        
            
                "shipping_address_line1": "Warehouse Lane 2",
            
        
    
        
        
            
                "shipping_address_line2": "",
            
        
    
        
        
            
                "shipping_city": "Kampala",
            
        
    
        
        
            
                "shipping_state_region": "Central",
            
        
    
        
        
            
                "shipping_postal_code": "11000",
            
        
    
        
        
            
                "shipping_country": "Uganda",
            
        
    
        
        
            
                "status": "inactive",
            
        
    
        
        
            
                "notes": "Preferred delivery mornings.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "contact_type": "lead",
            
        
    
        
        
            
                "display_name": "Jinja Plastics",
            
        
    
        
        
            
                "company_name": "Jinja Plastics Co",
            
        
    
        
        
            
                "first_name": "",
            
        
    
        
        
            
                "last_name": "",
            
        
    
        
        
            
                "email": "sales@jinjaplastics.ug",
            
        
    
        
        
            
                "phone": "+256778222000",
            
        
    
        
        
            
                "tin": "1002233445",
            
        
    
        
        
            
                "vrn": "VRN-UG-120002",
            
        
    
        
        
            
                "billing_address_line1": "Industrial Road 8",
            
        
    
        
        
            
                "billing_address_line2": "",
            
        
    
        
        
            
                "billing_city": "Jinja",
            
        
    
        
        
            
                "billing_state_region": "Eastern",
            
        
    
        
        
            
                "billing_postal_code": "12000",
            
        
    
        
        
            
                "billing_country": "Uganda",
            
        
    
        
        
            
                "shipping_address_line1": "Industrial Road 8",
            
        
    
        
        
            
                "shipping_address_line2": "",
            
        
    
        
        
            
                "shipping_city": "Jinja",
            
        
    
        
        
            
                "shipping_state_region": "Eastern",
            
        
    
        
        
            
                "shipping_postal_code": "12000",
            
        
    
        
        
            
                "shipping_country": "Uganda",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "notes": "Net 30 terms.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "contact_type": "vendor",
            
        
    
        
        
            
                "display_name": "GreenMart Supermarket",
            
        
    
        
        
            
                "company_name": "GreenMart Supermarket",
            
        
    
        
        
            
                "first_name": "",
            
        
    
        
        
            
                "last_name": "",
            
        
    
        
        
            
                "email": "accounts@greenmart.ug",
            
        
    
        
        
            
                "phone": "+256779333000",
            
        
    
        
        
            
                "tin": "1003344556",
            
        
    
        
        
            
                "vrn": "VRN-UG-120003",
            
        
    
        
        
            
                "billing_address_line1": "Bweyogerere 15",
            
        
    
        
        
            
                "billing_address_line2": "",
            
        
    
        
        
            
                "billing_city": "Kampala",
            
        
    
        
        
            
                "billing_state_region": "Central",
            
        
    
        
        
            
                "billing_postal_code": "13000",
            
        
    
        
        
            
                "billing_country": "Uganda",
            
        
    
        
        
            
                "shipping_address_line1": "Bweyogerere 15",
            
        
    
        
        
            
                "shipping_address_line2": "",
            
        
    
        
        
            
                "shipping_city": "Kampala",
            
        
    
        
        
            
                "shipping_state_region": "Central",
            
        
    
        
        
            
                "shipping_postal_code": "13000",
            
        
    
        
        
            
                "shipping_country": "Uganda",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "notes": "Requires delivery note attached.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "contact_type": "lead",
            
        
    
        
        
            
                "display_name": "Fort Portal Lodge",
            
        
    
        
        
            
                "company_name": "Fort Portal Lodge",
            
        
    
        
        
            
                "first_name": "",
            
        
    
        
        
            
                "last_name": "",
            
        
    
        
        
            
                "email": "manager@fortportallodge.ug",
            
        
    
        
        
            
                "phone": "+256770444000",
            
        
    
        
        
            
                "tin": "1004455667",
            
        
    
        
        
            
                "vrn": "VRN-UG-120004",
            
        
    
        
        
            
                "billing_address_line1": "Tourism Street 1",
            
        
    
        
        
            
                "billing_address_line2": "",
            
        
    
        
        
            
                "billing_city": "Fort Portal",
            
        
    
        
        
            
                "billing_state_region": "Western",
            
        
    
        
        
            
                "billing_postal_code": "14000",
            
        
    
        
        
            
                "billing_country": "Uganda",
            
        
    
        
        
            
                "shipping_address_line1": "Tourism Street 1",
            
        
    
        
        
            
                "shipping_address_line2": "",
            
        
    
        
        
            
                "shipping_city": "Fort Portal",
            
        
    
        
        
            
                "shipping_state_region": "Western",
            
        
    
        
        
            
                "shipping_postal_code": "14000",
            
        
    
        
        
            
                "shipping_country": "Uganda",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "notes": "Interested in monthly service contract.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "contact_type": "vendor",
            
        
    
        
        
            
                "display_name": "Agro Supplies Uganda",
            
        
    
        
        
            
                "company_name": "Agro Supplies Uganda Ltd",
            
        
    
        
        
            
                "first_name": "",
            
        
    
        
        
            
                "last_name": "",
            
        
    
        
        
            
                "email": "orders@agrosupplies.ug",
            
        
    
        
        
            
                "phone": "+256771555000",
            
        
    
        
        
            
                "tin": "1005566778",
            
        
    
        
        
            
                "vrn": "VRN-UG-120005",
            
        
    
        
        
            
                "billing_address_line1": "Mukono Road 6",
            
        
    
        
        
            
                "billing_address_line2": "",
            
        
    
        
        
            
                "billing_city": "Mukono",
            
        
    
        
        
            
                "billing_state_region": "Central",
            
        
    
        
        
            
                "billing_postal_code": "15000",
            
        
    
        
        
            
                "billing_country": "Uganda",
            
        
    
        
        
            
                "shipping_address_line1": "Mukono Road 6",
            
        
    
        
        
            
                "shipping_address_line2": "",
            
        
    
        
        
            
                "shipping_city": "Mukono",
            
        
    
        
        
            
                "shipping_state_region": "Central",
            
        
    
        
        
            
                "shipping_postal_code": "15000",
            
        
    
        
        
            
                "shipping_country": "Uganda",
            
        
    
        
        
            
                "status": "inactive",
            
        
    
        
        
            
                "notes": "Supplies packaging materials weekly.",
            
        
    
    },
    
];



const ProductsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "item_type": "service",
            
        
    
        
        
            
                "name": "A4 Copy Paper Ream",
            
        
    
        
        
            
                "sku": "LVT-PAP-A4",
            
        
    
        
        
            
                "barcode": "6151002003001",
            
        
    
        
        
            
                "unit_name": "ream",
            
        
    
        
        
            
                "sales_price": 16500,
            
        
    
        
        
            
                "purchase_cost": 14000,
            
        
    
        
        
            
                "is_taxable": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reorder_level": 50,
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "description": "80gsm A4 paper for office use.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "item_type": "service",
            
        
    
        
        
            
                "name": "Ballpoint Pens Pack",
            
        
    
        
        
            
                "sku": "LVT-PEN-10",
            
        
    
        
        
            
                "barcode": "6151002003002",
            
        
    
        
        
            
                "unit_name": "pack",
            
        
    
        
        
            
                "sales_price": 12000,
            
        
    
        
        
            
                "purchase_cost": 9000,
            
        
    
        
        
            
                "is_taxable": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reorder_level": 40,
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "description": "Pack of 10 blue ballpoint pens.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "item_type": "product",
            
        
    
        
        
            
                "name": "LED Bulb 9W",
            
        
    
        
        
            
                "sku": "KIM-LED-9W",
            
        
    
        
        
            
                "barcode": "6151002004001",
            
        
    
        
        
            
                "unit_name": "piece",
            
        
    
        
        
            
                "sales_price": 8500,
            
        
    
        
        
            
                "purchase_cost": 6500,
            
        
    
        
        
            
                "is_taxable": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reorder_level": 120,
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "description": "Energy saving LED bulb, 9W.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "item_type": "service",
            
        
    
        
        
            
                "name": "Monthly Bookkeeping",
            
        
    
        
        
            
                "sku": "RSC-SVC-BK",
            
        
    
        
        
            
                "barcode": "",
            
        
    
        
        
            
                "unit_name": "month",
            
        
    
        
        
            
                "sales_price": 450000,
            
        
    
        
        
            
                "purchase_cost": 0,
            
        
    
        
        
            
                "is_taxable": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reorder_level": 0,
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "description": "Monthly bookkeeping and reporting service.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "item_type": "service",
            
        
    
        
        
            
                "name": "Packaging Carton Box",
            
        
    
        
        
            
                "sku": "NFF-BOX-CTN",
            
        
    
        
        
            
                "barcode": "6151002005001",
            
        
    
        
        
            
                "unit_name": "piece",
            
        
    
        
        
            
                "sales_price": 2200,
            
        
    
        
        
            
                "purchase_cost": 1500,
            
        
    
        
        
            
                "is_taxable": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "reorder_level": 500,
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "description": "Corrugated carton box for finished goods.",
            
        
    
    },
    
];



const WarehousesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Kampala Main Warehouse",
            
        
    
        
        
            
                "code": "LVT-KLA-01",
            
        
    
        
        
            
                "address_line1": "Industrial Area, Plot 21",
            
        
    
        
        
            
                "address_line2": "",
            
        
    
        
        
            
                "city": "Kampala",
            
        
    
        
        
            
                "state_region": "Central",
            
        
    
        
        
            
                "country": "Uganda",
            
        
    
        
        
            
                "notes": "Primary stock holding location.",
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Jinja Depot",
            
        
    
        
        
            
                "code": "LVT-JIN-01",
            
        
    
        
        
            
                "address_line1": "Jinja Road, Plot 8",
            
        
    
        
        
            
                "address_line2": "",
            
        
    
        
        
            
                "city": "Jinja",
            
        
    
        
        
            
                "state_region": "Eastern",
            
        
    
        
        
            
                "country": "Uganda",
            
        
    
        
        
            
                "notes": "Regional dispatch point.",
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Nakawa Warehouse",
            
        
    
        
        
            
                "code": "KIM-NKW-01",
            
        
    
        
        
            
                "address_line1": "Nakawa Industrial Area, Bay 4",
            
        
    
        
        
            
                "address_line2": "",
            
        
    
        
        
            
                "city": "Kampala",
            
        
    
        
        
            
                "state_region": "Central",
            
        
    
        
        
            
                "country": "Uganda",
            
        
    
        
        
            
                "notes": "Imports receiving warehouse.",
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Cold Store",
            
        
    
        
        
            
                "code": "NFF-COLD-01",
            
        
    
        
        
            
                "address_line1": "Ggaba Road, Cold Room 2",
            
        
    
        
        
            
                "address_line2": "",
            
        
    
        
        
            
                "city": "Kampala",
            
        
    
        
        
            
                "state_region": "Central",
            
        
    
        
        
            
                "country": "Uganda",
            
        
    
        
        
            
                "notes": "Temperature controlled storage.",
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Records Room",
            
        
    
        
        
            
                "code": "RSC-REC-01",
            
        
    
        
        
            
                "address_line1": "Main Street 22",
            
        
    
        
        
            
                "address_line2": "Back Office",
            
        
    
        
        
            
                "city": "Fort Portal",
            
        
    
        
        
            
                "state_region": "Western",
            
        
    
        
        
            
                "country": "Uganda",
            
        
    
        
        
            
                "notes": "Document archive room.",
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
];



const InventoryItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_on_hand": 320,
            
        
    
        
        
            
                "quantity_available": 280,
            
        
    
        
        
            
                "average_cost": 14250,
            
        
    
        
        
            
                "last_counted_at": new Date('2025-03-05T16:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_on_hand": 180,
            
        
    
        
        
            
                "quantity_available": 165,
            
        
    
        
        
            
                "average_cost": 9200,
            
        
    
        
        
            
                "last_counted_at": new Date('2025-03-05T16:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_on_hand": 90,
            
        
    
        
        
            
                "quantity_available": 85,
            
        
    
        
        
            
                "average_cost": 14300,
            
        
    
        
        
            
                "last_counted_at": new Date('2025-03-01T10:30:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_on_hand": 740,
            
        
    
        
        
            
                "quantity_available": 700,
            
        
    
        
        
            
                "average_cost": 6600,
            
        
    
        
        
            
                "last_counted_at": new Date('2025-03-02T14:20:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity_on_hand": 2200,
            
        
    
        
        
            
                "quantity_available": 2150,
            
        
    
        
        
            
                "average_cost": 1520,
            
        
    
        
        
            
                "last_counted_at": new Date('2025-03-04T09:10:00Z'),
            
        
    
    },
    
];



const QuotesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quote_number": "LVT-QUO-00031",
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "issue_date": new Date('2025-03-10T09:00:00Z'),
            
        
    
        
        
            
                "valid_until": new Date('2025-03-20T17:00:00Z'),
            
        
    
        
        
            
                "currency_code": "UGX",
            
        
    
        
        
            
                "exchange_rate": 1,
            
        
    
        
        
            
                "subtotal_amount": 330000,
            
        
    
        
        
            
                "tax_amount": 59400,
            
        
    
        
        
            
                "discount_amount": 0,
            
        
    
        
        
            
                "total_amount": 389400,
            
        
    
        
        
            
                "customer_notes": "Prices valid for 10 days.",
            
        
    
        
        
            
                "terms_and_conditions": "Payment within 14 days from invoice date.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quote_number": "LVT-QUO-00032",
            
        
    
        
        
            
                "status": "expired",
            
        
    
        
        
            
                "issue_date": new Date('2025-03-12T09:00:00Z'),
            
        
    
        
        
            
                "valid_until": new Date('2025-03-22T17:00:00Z'),
            
        
    
        
        
            
                "currency_code": "UGX",
            
        
    
        
        
            
                "exchange_rate": 1,
            
        
    
        
        
            
                "subtotal_amount": 240000,
            
        
    
        
        
            
                "tax_amount": 43200,
            
        
    
        
        
            
                "discount_amount": 0,
            
        
    
        
        
            
                "total_amount": 283200,
            
        
    
        
        
            
                "customer_notes": "Deliver to main store.",
            
        
    
        
        
            
                "terms_and_conditions": "Delivery within 2 business days after confirmation.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quote_number": "KIM-QUO-00014",
            
        
    
        
        
            
                "status": "expired",
            
        
    
        
        
            
                "issue_date": new Date('2025-03-11T11:00:00Z'),
            
        
    
        
        
            
                "valid_until": new Date('2025-03-21T17:00:00Z'),
            
        
    
        
        
            
                "currency_code": "UGX",
            
        
    
        
        
            
                "exchange_rate": 1,
            
        
    
        
        
            
                "subtotal_amount": 510000,
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "discount_amount": 15000,
            
        
    
        
        
            
                "total_amount": 495000,
            
        
    
        
        
            
                "customer_notes": "Includes promotional discount.",
            
        
    
        
        
            
                "terms_and_conditions": "Payment on delivery.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quote_number": "RSC-QUO-00005",
            
        
    
        
        
            
                "status": "expired",
            
        
    
        
        
            
                "issue_date": new Date('2025-03-15T08:30:00Z'),
            
        
    
        
        
            
                "valid_until": new Date('2025-04-15T17:00:00Z'),
            
        
    
        
        
            
                "currency_code": "UGX",
            
        
    
        
        
            
                "exchange_rate": 1,
            
        
    
        
        
            
                "subtotal_amount": 900000,
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "discount_amount": 0,
            
        
    
        
        
            
                "total_amount": 900000,
            
        
    
        
        
            
                "customer_notes": "Service proposal for 2 months.",
            
        
    
        
        
            
                "terms_and_conditions": "50% upfront, balance end of month.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quote_number": "NFF-QUO-00009",
            
        
    
        
        
            
                "status": "accepted",
            
        
    
        
        
            
                "issue_date": new Date('2025-03-09T10:00:00Z'),
            
        
    
        
        
            
                "valid_until": new Date('2025-03-19T17:00:00Z'),
            
        
    
        
        
            
                "currency_code": "UGX",
            
        
    
        
        
            
                "exchange_rate": 1,
            
        
    
        
        
            
                "subtotal_amount": 1200000,
            
        
    
        
        
            
                "tax_amount": 216000,
            
        
    
        
        
            
                "discount_amount": 0,
            
        
    
        
        
            
                "total_amount": 1416000,
            
        
    
        
        
            
                "customer_notes": "Seasonal supply offer.",
            
        
    
        
        
            
                "terms_and_conditions": "Weekly deliveries with standing order.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
];



const QuoteLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_description": "A4 Copy Paper Ream 80gsm",
            
        
    
        
        
            
                "quantity": 20,
            
        
    
        
        
            
                "unit_price": 16500,
            
        
    
        
        
            
                "discount_rate": 0,
            
        
    
        
        
            
                "line_subtotal": 330000,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "tax_amount": 59400,
            
        
    
        
        
            
                "line_total": 389400,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_description": "Ballpoint pens, pack of 10",
            
        
    
        
        
            
                "quantity": 20,
            
        
    
        
        
            
                "unit_price": 12000,
            
        
    
        
        
            
                "discount_rate": 0,
            
        
    
        
        
            
                "line_subtotal": 240000,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "tax_amount": 43200,
            
        
    
        
        
            
                "line_total": 283200,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_description": "LED Bulb 9W retail pack",
            
        
    
        
        
            
                "quantity": 60,
            
        
    
        
        
            
                "unit_price": 8500,
            
        
    
        
        
            
                "discount_rate": 0.0294,
            
        
    
        
        
            
                "line_subtotal": 510000,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "line_total": 495000,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_description": "Monthly bookkeeping for March and April",
            
        
    
        
        
            
                "quantity": 2,
            
        
    
        
        
            
                "unit_price": 450000,
            
        
    
        
        
            
                "discount_rate": 0,
            
        
    
        
        
            
                "line_subtotal": 900000,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "line_total": 900000,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_description": "Carton boxes for supply run",
            
        
    
        
        
            
                "quantity": 600,
            
        
    
        
        
            
                "unit_price": 2000,
            
        
    
        
        
            
                "discount_rate": 0,
            
        
    
        
        
            
                "line_subtotal": 1200000,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "tax_amount": 216000,
            
        
    
        
        
            
                "line_total": 1416000,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const InvoicesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "invoice_number": "LVT-INV-00108",
            
        
    
        
        
            
                "invoice_type": "standard",
            
        
    
        
        
            
                "status": "overdue",
            
        
    
        
        
            
                "issue_date": new Date('2025-03-13T09:00:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2025-03-27T17:00:00Z'),
            
        
    
        
        
            
                "currency_code": "UGX",
            
        
    
        
        
            
                "exchange_rate": 1,
            
        
    
        
        
            
                "subtotal_amount": 240000,
            
        
    
        
        
            
                "tax_amount": 43200,
            
        
    
        
        
            
                "discount_amount": 0,
            
        
    
        
        
            
                "total_amount": 283200,
            
        
    
        
        
            
                "amount_paid": 150000,
            
        
    
        
        
            
                "balance_due": 133200,
            
        
    
        
        
            
                "customer_notes": "Thank you for your order.",
            
        
    
        
        
            
                "terms_and_conditions": "Payment due in 14 days.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "invoice_number": "LVT-INV-00109",
            
        
    
        
        
            
                "invoice_type": "credit_note",
            
        
    
        
        
            
                "status": "sent",
            
        
    
        
        
            
                "issue_date": new Date('2025-03-18T09:00:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2025-04-01T17:00:00Z'),
            
        
    
        
        
            
                "currency_code": "UGX",
            
        
    
        
        
            
                "exchange_rate": 1,
            
        
    
        
        
            
                "subtotal_amount": 330000,
            
        
    
        
        
            
                "tax_amount": 59400,
            
        
    
        
        
            
                "discount_amount": 0,
            
        
    
        
        
            
                "total_amount": 389400,
            
        
    
        
        
            
                "amount_paid": 0,
            
        
    
        
        
            
                "balance_due": 389400,
            
        
    
        
        
            
                "customer_notes": "Please confirm delivery details.",
            
        
    
        
        
            
                "terms_and_conditions": "Payment due in 14 days.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "invoice_number": "KIM-INV-00044",
            
        
    
        
        
            
                "invoice_type": "debit_note",
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "issue_date": new Date('2025-03-12T12:00:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2025-03-12T17:00:00Z'),
            
        
    
        
        
            
                "currency_code": "UGX",
            
        
    
        
        
            
                "exchange_rate": 1,
            
        
    
        
        
            
                "subtotal_amount": 510000,
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "discount_amount": 15000,
            
        
    
        
        
            
                "total_amount": 495000,
            
        
    
        
        
            
                "amount_paid": 495000,
            
        
    
        
        
            
                "balance_due": 0,
            
        
    
        
        
            
                "customer_notes": "Paid on delivery.",
            
        
    
        
        
            
                "terms_and_conditions": "Payment on delivery.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "invoice_number": "RSC-INV-00007",
            
        
    
        
        
            
                "invoice_type": "debit_note",
            
        
    
        
        
            
                "status": "partially_paid",
            
        
    
        
        
            
                "issue_date": new Date('2025-03-16T08:45:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2025-03-31T17:00:00Z'),
            
        
    
        
        
            
                "currency_code": "UGX",
            
        
    
        
        
            
                "exchange_rate": 1,
            
        
    
        
        
            
                "subtotal_amount": 450000,
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "discount_amount": 0,
            
        
    
        
        
            
                "total_amount": 450000,
            
        
    
        
        
            
                "amount_paid": 0,
            
        
    
        
        
            
                "balance_due": 450000,
            
        
    
        
        
            
                "customer_notes": "Invoice for monthly services.",
            
        
    
        
        
            
                "terms_and_conditions": "Due end of month.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "invoice_number": "NFF-INV-00061",
            
        
    
        
        
            
                "invoice_type": "standard",
            
        
    
        
        
            
                "status": "void",
            
        
    
        
        
            
                "issue_date": new Date('2025-02-20T09:00:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2025-03-06T17:00:00Z'),
            
        
    
        
        
            
                "currency_code": "UGX",
            
        
    
        
        
            
                "exchange_rate": 1,
            
        
    
        
        
            
                "subtotal_amount": 800000,
            
        
    
        
        
            
                "tax_amount": 144000,
            
        
    
        
        
            
                "discount_amount": 0,
            
        
    
        
        
            
                "total_amount": 944000,
            
        
    
        
        
            
                "amount_paid": 0,
            
        
    
        
        
            
                "balance_due": 944000,
            
        
    
        
        
            
                "customer_notes": "Please prioritize settlement.",
            
        
    
        
        
            
                "terms_and_conditions": "Payment due in 14 days.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
    },
    
];



const InvoiceLinesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_description": "Ballpoint pens, pack of 10",
            
        
    
        
        
            
                "quantity": 20,
            
        
    
        
        
            
                "unit_price": 12000,
            
        
    
        
        
            
                "discount_rate": 0,
            
        
    
        
        
            
                "line_subtotal": 240000,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "tax_amount": 43200,
            
        
    
        
        
            
                "line_total": 283200,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_description": "A4 Copy Paper Ream 80gsm",
            
        
    
        
        
            
                "quantity": 20,
            
        
    
        
        
            
                "unit_price": 16500,
            
        
    
        
        
            
                "discount_rate": 0,
            
        
    
        
        
            
                "line_subtotal": 330000,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "tax_amount": 59400,
            
        
    
        
        
            
                "line_total": 389400,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_description": "LED Bulb 9W retail pack",
            
        
    
        
        
            
                "quantity": 60,
            
        
    
        
        
            
                "unit_price": 8500,
            
        
    
        
        
            
                "discount_rate": 0.0294,
            
        
    
        
        
            
                "line_subtotal": 510000,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "line_total": 495000,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_description": "Monthly bookkeeping service",
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                "unit_price": 450000,
            
        
    
        
        
            
                "discount_rate": 0,
            
        
    
        
        
            
                "line_subtotal": 450000,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "line_total": 450000,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "line_description": "Packaging carton boxes",
            
        
    
        
        
            
                "quantity": 400,
            
        
    
        
        
            
                "unit_price": 2000,
            
        
    
        
        
            
                "discount_rate": 0,
            
        
    
        
        
            
                "line_subtotal": 800000,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "tax_amount": 144000,
            
        
    
        
        
            
                "line_total": 944000,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const PaymentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payment_reference": "PAY-LVT-20250314-001",
            
        
    
        
        
            
                "payment_date": new Date('2025-03-14T10:10:00Z'),
            
        
    
        
        
            
                "amount": 150000,
            
        
    
        
        
            
                "method": "bank_transfer",
            
        
    
        
        
            
                "currency_code": "UGX",
            
        
    
        
        
            
                "exchange_rate": 1,
            
        
    
        
        
            
                "status": "pending",
            
        
    
        
        
            
                "notes": "Partial payment received.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payment_reference": "PAY-KIM-20250312-004",
            
        
    
        
        
            
                "payment_date": new Date('2025-03-12T14:00:00Z'),
            
        
    
        
        
            
                "amount": 495000,
            
        
    
        
        
            
                "method": "cash",
            
        
    
        
        
            
                "currency_code": "UGX",
            
        
    
        
        
            
                "exchange_rate": 1,
            
        
    
        
        
            
                "status": "pending",
            
        
    
        
        
            
                "notes": "Cash received at delivery.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payment_reference": "PAY-NFF-20250310-002",
            
        
    
        
        
            
                "payment_date": new Date('2025-03-10T09:30:00Z'),
            
        
    
        
        
            
                "amount": 0,
            
        
    
        
        
            
                "method": "cash",
            
        
    
        
        
            
                "currency_code": "UGX",
            
        
    
        
        
            
                "exchange_rate": 1,
            
        
    
        
        
            
                "status": "failed",
            
        
    
        
        
            
                "notes": "Customer bank transfer not received.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payment_reference": "PAY-LVT-20250320-003",
            
        
    
        
        
            
                "payment_date": new Date('2025-03-20T12:05:00Z'),
            
        
    
        
        
            
                "amount": 0,
            
        
    
        
        
            
                "method": "bank_transfer",
            
        
    
        
        
            
                "currency_code": "UGX",
            
        
    
        
        
            
                "exchange_rate": 1,
            
        
    
        
        
            
                "status": "reversed",
            
        
    
        
        
            
                "notes": "Awaiting bank confirmation.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payment_reference": "PAY-RSC-20250318-001",
            
        
    
        
        
            
                "payment_date": new Date('2025-03-18T15:40:00Z'),
            
        
    
        
        
            
                "amount": 0,
            
        
    
        
        
            
                "method": "bank_transfer",
            
        
    
        
        
            
                "currency_code": "UGX",
            
        
    
        
        
            
                "exchange_rate": 1,
            
        
    
        
        
            
                "status": "failed",
            
        
    
        
        
            
                "notes": "Pending upfront payment arrangement.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const ReceiptsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "receipt_number": "LVT-RCT-00055",
            
        
    
        
        
            
                "receipt_date": new Date('2025-03-14T10:15:00Z'),
            
        
    
        
        
            
                "receipt_amount": 150000,
            
        
    
        
        
            
                "status": "issued",
            
        
    
        
        
            
                "notes": "Receipt for partial payment.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "receipt_number": "KIM-RCT-00021",
            
        
    
        
        
            
                "receipt_date": new Date('2025-03-12T14:05:00Z'),
            
        
    
        
        
            
                "receipt_amount": 495000,
            
        
    
        
        
            
                "status": "void",
            
        
    
        
        
            
                "notes": "Receipt issued on delivery.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "receipt_number": "LVT-RCT-00056",
            
        
    
        
        
            
                "receipt_date": new Date('2025-03-20T12:10:00Z'),
            
        
    
        
        
            
                "receipt_amount": 0,
            
        
    
        
        
            
                "status": "void",
            
        
    
        
        
            
                "notes": "Provisional receipt pending confirmation.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "receipt_number": "RSC-RCT-00003",
            
        
    
        
        
            
                "receipt_date": new Date('2025-03-18T15:45:00Z'),
            
        
    
        
        
            
                "receipt_amount": 0,
            
        
    
        
        
            
                "status": "issued",
            
        
    
        
        
            
                "notes": "Receipt placeholder pending payment.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "receipt_number": "NFF-RCT-00018",
            
        
    
        
        
            
                "receipt_date": new Date('2025-03-10T09:35:00Z'),
            
        
    
        
        
            
                "receipt_amount": 0,
            
        
    
        
        
            
                "status": "void",
            
        
    
        
        
            
                "notes": "Receipt voided due to failed payment.",
            
        
    
    },
    
];



const ExpensesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "expense_number": "LVT-EXP-00041",
            
        
    
        
        
            
                "status": "approved",
            
        
    
        
        
            
                "expense_type": "bill",
            
        
    
        
        
            
                "expense_date": new Date('2025-03-06T09:00:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2025-03-21T17:00:00Z'),
            
        
    
        
        
            
                "subtotal_amount": 600000,
            
        
    
        
        
            
                "tax_amount": 108000,
            
        
    
        
        
            
                "total_amount": 708000,
            
        
    
        
        
            
                "currency_code": "UGX",
            
        
    
        
        
            
                "exchange_rate": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "memo": "Packaging materials purchase.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "expense_number": "KIM-EXP-00018",
            
        
    
        
        
            
                "status": "paid",
            
        
    
        
        
            
                "expense_type": "purchase",
            
        
    
        
        
            
                "expense_date": new Date('2025-03-08T09:00:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2025-03-22T17:00:00Z'),
            
        
    
        
        
            
                "subtotal_amount": 350000,
            
        
    
        
        
            
                "tax_amount": 63000,
            
        
    
        
        
            
                "total_amount": 413000,
            
        
    
        
        
            
                "currency_code": "UGX",
            
        
    
        
        
            
                "exchange_rate": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "memo": "Warehouse supplies and packaging.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "expense_number": "RSC-EXP-00006",
            
        
    
        
        
            
                "status": "approved",
            
        
    
        
        
            
                "expense_type": "bill",
            
        
    
        
        
            
                "expense_date": new Date('2025-03-05T09:00:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2025-03-05T17:00:00Z'),
            
        
    
        
        
            
                "subtotal_amount": 120000,
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "total_amount": 120000,
            
        
    
        
        
            
                "currency_code": "UGX",
            
        
    
        
        
            
                "exchange_rate": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "memo": "Office stationery and printing.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "expense_number": "NFF-EXP-00029",
            
        
    
        
        
            
                "status": "paid",
            
        
    
        
        
            
                "expense_type": "purchase",
            
        
    
        
        
            
                "expense_date": new Date('2025-03-07T09:00:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2025-03-21T17:00:00Z'),
            
        
    
        
        
            
                "subtotal_amount": 500000,
            
        
    
        
        
            
                "tax_amount": 90000,
            
        
    
        
        
            
                "total_amount": 590000,
            
        
    
        
        
            
                "currency_code": "UGX",
            
        
    
        
        
            
                "exchange_rate": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "memo": "Packaging items missing delivery note.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "expense_number": "LVT-EXP-00042",
            
        
    
        
        
            
                "status": "submitted",
            
        
    
        
        
            
                "expense_type": "bill",
            
        
    
        
        
            
                "expense_date": new Date('2025-03-17T09:00:00Z'),
            
        
    
        
        
            
                "due_date": new Date('2025-03-31T17:00:00Z'),
            
        
    
        
        
            
                "subtotal_amount": 240000,
            
        
    
        
        
            
                "tax_amount": 43200,
            
        
    
        
        
            
                "total_amount": 283200,
            
        
    
        
        
            
                "currency_code": "UGX",
            
        
    
        
        
            
                "exchange_rate": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "memo": "Sample order for new packaging type.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const ApprovalRequestsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "request_type": "other",
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "requested_at": new Date('2025-03-08T10:00:00Z'),
            
        
    
        
        
            
                "decided_at": new Date('2025-03-08T10:00:00Z'),
            
        
    
        
        
            
                "subject": "Approve expense LVT-EXP-00041",
            
        
    
        
        
            
                "reason": "Vendor invoice verified and goods received.",
            
        
    
        
        
            
                "decision_notes": "",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "request_type": "other",
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "requested_at": new Date('2025-03-09T09:30:00Z'),
            
        
    
        
        
            
                "decided_at": new Date('2025-03-09T11:00:00Z'),
            
        
    
        
        
            
                "subject": "Approve expense KIM-EXP-00018",
            
        
    
        
        
            
                "reason": "Monthly warehouse supplies.",
            
        
    
        
        
            
                "decision_notes": "Approved for payment.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "request_type": "credit_note",
            
        
    
        
        
            
                "status": "approved",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "requested_at": new Date('2025-03-07T12:00:00Z'),
            
        
    
        
        
            
                "decided_at": new Date('2025-03-07T15:20:00Z'),
            
        
    
        
        
            
                "subject": "Review expense NFF-EXP-00029",
            
        
    
        
        
            
                "reason": "Claim requires delivery documentation.",
            
        
    
        
        
            
                "decision_notes": "Rejected due to missing delivery note.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "request_type": "invoice_void",
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "requested_at": new Date('2025-03-19T08:15:00Z'),
            
        
    
        
        
            
                "decided_at": new Date('2025-03-19T09:00:00Z'),
            
        
    
        
        
            
                "subject": "Void request for invoice LVT-INV-00109",
            
        
    
        
        
            
                "reason": "Customer requested correction before payment.",
            
        
    
        
        
            
                "decision_notes": "Cancelled after correction issued.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "request_type": "other",
            
        
    
        
        
            
                "status": "rejected",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "requested_at": new Date('2025-03-16T13:10:00Z'),
            
        
    
        
        
            
                "decided_at": new Date('2025-03-16T13:10:00Z'),
            
        
    
        
        
            
                "subject": "Approve service contract setup",
            
        
    
        
        
            
                "reason": "New monthly service for lodge.",
            
        
    
        
        
            
                "decision_notes": "",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
    },
    
];



const ProjectsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Stationery Supply Q1",
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "start_date": new Date('2025-01-05T00:00:00Z'),
            
        
    
        
        
            
                "end_date": new Date('2025-03-31T23:59:00Z'),
            
        
    
        
        
            
                "budget_amount": 5000000,
            
        
    
        
        
            
                "notes": "Quarterly supply agreement execution.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Lodge Finance Setup",
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "start_date": new Date('2025-03-20T00:00:00Z'),
            
        
    
        
        
            
                "end_date": new Date('2025-04-30T23:59:00Z'),
            
        
    
        
        
            
                "budget_amount": 2000000,
            
        
    
        
        
            
                "notes": "Accounting processes and monthly reporting setup.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Retail Rollout Support",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "start_date": new Date('2025-02-01T00:00:00Z'),
            
        
    
        
        
            
                "end_date": new Date('2025-05-31T23:59:00Z'),
            
        
    
        
        
            
                "budget_amount": 3500000,
            
        
    
        
        
            
                "notes": "On hold pending revised scope.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Supply Optimization",
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "start_date": new Date('2025-02-15T00:00:00Z'),
            
        
    
        
        
            
                "end_date": new Date('2025-06-15T23:59:00Z'),
            
        
    
        
        
            
                "budget_amount": 4000000,
            
        
    
        
        
            
                "notes": "Improve delivery scheduling and reconciliation.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "IT Services Retainer",
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "start_date": new Date('2025-01-01T00:00:00Z'),
            
        
    
        
        
            
                "end_date": new Date('2025-12-31T23:59:00Z'),
            
        
    
        
        
            
                "budget_amount": 6000000,
            
        
    
        
        
            
                "notes": "Cancelled due to non-payment.",
            
        
    
    },
    
];



const TasksData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Prepare March delivery schedule",
            
        
    
        
        
            
                "status": "in_progress",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "start_at": new Date('2025-03-10T08:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2025-03-15T17:00:00Z'),
            
        
    
        
        
            
                "priority": 2,
            
        
    
        
        
            
                "description": "Confirm customer delivery windows and stock availability.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Reconcile invoice LVT-INV-00108 payment",
            
        
    
        
        
            
                "status": "in_progress",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "start_at": new Date('2025-03-14T11:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2025-03-16T17:00:00Z'),
            
        
    
        
        
            
                "priority": 1,
            
        
    
        
        
            
                "description": "Match mobile money confirmation and update ledger notes.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Collect opening balances",
            
        
    
        
        
            
                "status": "done",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "start_at": new Date('2025-03-20T09:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2025-03-25T17:00:00Z'),
            
        
    
        
        
            
                "priority": 1,
            
        
    
        
        
            
                "description": "Request prior period trial balance and bank statements.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Review overdue invoice NFF-INV-00061",
            
        
    
        
        
            
                "status": "in_progress",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "start_at": new Date('2025-03-08T09:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2025-03-12T17:00:00Z'),
            
        
    
        
        
            
                "priority": 1,
            
        
    
        
        
            
                "description": "Customer follow up required before escalation.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Update product pricing sheet",
            
        
    
        
        
            
                "status": "done",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "start_at": new Date('2025-03-01T09:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2025-03-03T17:00:00Z'),
            
        
    
        
        
            
                "priority": 3,
            
        
    
        
        
            
                "description": "Refresh prices for Q2 promotions.",
            
        
    
    },
    
];



const TimeEntriesData = [
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "start_time": new Date('2025-03-14T11:10:00Z'),
            
        
    
        
        
            
                "end_time": new Date('2025-03-14T12:40:00Z'),
            
        
    
        
        
            
                "hours": 1.5,
            
        
    
        
        
            
                "billable_rate": 0,
            
        
    
        
        
            
                "is_billable": false,
            
        
    
        
        
            
                "status": "billed",
            
        
    
        
        
            
                "notes": "Payment reconciliation and notes update.",
            
        
    
    },
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "start_time": new Date('2025-03-20T09:15:00Z'),
            
        
    
        
        
            
                "end_time": new Date('2025-03-20T11:15:00Z'),
            
        
    
        
        
            
                "hours": 2,
            
        
    
        
        
            
                "billable_rate": 120000,
            
        
    
        
        
            
                "is_billable": true,
            
        
    
        
        
            
                "status": "billed",
            
        
    
        
        
            
                "notes": "Kickoff call and document request list.",
            
        
    
    },
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "start_time": new Date('2025-03-01T09:10:00Z'),
            
        
    
        
        
            
                "end_time": new Date('2025-03-01T10:40:00Z'),
            
        
    
        
        
            
                "hours": 1.5,
            
        
    
        
        
            
                "billable_rate": 0,
            
        
    
        
        
            
                "is_billable": false,
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "notes": "Updated price sheet shared with sales team.",
            
        
    
    },
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "start_time": new Date('2025-03-08T10:00:00Z'),
            
        
    
        
        
            
                "end_time": new Date('2025-03-08T11:00:00Z'),
            
        
    
        
        
            
                "hours": 1,
            
        
    
        
        
            
                "billable_rate": 0,
            
        
    
        
        
            
                "is_billable": false,
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "notes": "Prepared follow up email and statement.",
            
        
    
    },
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "start_time": new Date('2025-03-11T08:30:00Z'),
            
        
    
        
        
            
                "end_time": new Date('2025-03-11T09:45:00Z'),
            
        
    
        
        
            
                "hours": 1.25,
            
        
    
        
        
            
                "billable_rate": 0,
            
        
    
        
        
            
                "is_billable": false,
            
        
    
        
        
            
                "status": "submitted",
            
        
    
        
        
            
                "notes": "Confirmed delivery dates with customer.",
            
        
    
    },
    
];



const EfrisConnectionsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "environment": "production",
            
        
    
        
        
            
                "device_number": "EFRIS-DEV-LVT-01",
            
        
    
        
        
            
                "branch_code": "001",
            
        
    
        
        
            
                "business_name_on_efris": "Lakeview Traders Limited",
            
        
    
        
        
            
                "tin_on_efris": "1012345678",
            
        
    
        
        
            
                "client_id": "lvt_client_id",
            
        
    
        
        
            
                "client_secret": "lvt_client_secret",
            
        
    
        
        
            
                "api_base_url": "https://efris.ura.go.ug/api",
            
        
    
        
        
            
                "last_connected_at": new Date('2025-03-18T08:00:00Z'),
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "last_error_message": "",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "environment": "sandbox",
            
        
    
        
        
            
                "device_number": "EFRIS-DEV-KIM-01",
            
        
    
        
        
            
                "branch_code": "002",
            
        
    
        
        
            
                "business_name_on_efris": "Kembo Imports (U) Ltd",
            
        
    
        
        
            
                "tin_on_efris": "1098765432",
            
        
    
        
        
            
                "client_id": "kim_client_id",
            
        
    
        
        
            
                "client_secret": "kim_client_secret",
            
        
    
        
        
            
                "api_base_url": "https://efris.ura.go.ug/api",
            
        
    
        
        
            
                "last_connected_at": new Date('2025-03-17T08:00:00Z'),
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "last_error_message": "",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "environment": "production",
            
        
    
        
        
            
                "device_number": "EFRIS-DEV-RSC-TEST",
            
        
    
        
        
            
                "branch_code": "003",
            
        
    
        
        
            
                "business_name_on_efris": "Rwenzori Services Company Ltd",
            
        
    
        
        
            
                "tin_on_efris": "1024681357",
            
        
    
        
        
            
                "client_id": "rsc_client_id",
            
        
    
        
        
            
                "client_secret": "rsc_client_secret",
            
        
    
        
        
            
                "api_base_url": "https://efris-sandbox.ura.go.ug/api",
            
        
    
        
        
            
                "last_connected_at": new Date('2025-03-16T08:00:00Z'),
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "last_error_message": "",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "environment": "sandbox",
            
        
    
        
        
            
                "device_number": "EFRIS-DEV-NFF-01",
            
        
    
        
        
            
                "branch_code": "004",
            
        
    
        
        
            
                "business_name_on_efris": "Nile Fresh Foods Limited",
            
        
    
        
        
            
                "tin_on_efris": "1035792468",
            
        
    
        
        
            
                "client_id": "nff_client_id",
            
        
    
        
        
            
                "client_secret": "nff_client_secret",
            
        
    
        
        
            
                "api_base_url": "https://efris.ura.go.ug/api",
            
        
    
        
        
            
                "last_connected_at": new Date('2025-03-10T08:00:00Z'),
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "last_error_message": "Token refresh failed at provider.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "environment": "sandbox",
            
        
    
        
        
            
                "device_number": "EFRIS-DEV-KTH-TEST",
            
        
    
        
        
            
                "branch_code": "005",
            
        
    
        
        
            
                "business_name_on_efris": "Kampala Tech Hub Ltd",
            
        
    
        
        
            
                "tin_on_efris": "1046803579",
            
        
    
        
        
            
                "client_id": "kth_client_id",
            
        
    
        
        
            
                "client_secret": "kth_client_secret",
            
        
    
        
        
            
                "api_base_url": "https://efris-sandbox.ura.go.ug/api",
            
        
    
        
        
            
                "last_connected_at": new Date('2025-02-28T08:00:00Z'),
            
        
    
        
        
            
                "status": "disabled",
            
        
    
        
        
            
                "last_error_message": "Connection disabled by tenant.",
            
        
    
    },
    
];



const EfrisSubmissionsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "document_type": "credit_note",
            
        
    
        
        
            
                "submission_status": "cancelled",
            
        
    
        
        
            
                "submitted_at": new Date('2025-03-13T09:05:00Z'),
            
        
    
        
        
            
                "last_attempt_at": new Date('2025-03-13T09:05:00Z'),
            
        
    
        
        
            
                "attempt_count": 1,
            
        
    
        
        
            
                "request_payload_json": "{invoiceNo:LVT-INV-00108,amount:283200}",
            
        
    
        
        
            
                "response_payload_json": "{status:ACCEPTED,efrisInvoiceNo:UG-EFR-883920}",
            
        
    
        
        
            
                "efris_invoice_no": "UG-EFR-883920",
            
        
    
        
        
            
                "efris_receipt_no": "UG-RCT-551201",
            
        
    
        
        
            
                "verification_code": "VRF-9K2L-33A1",
            
        
    
        
        
            
                "qr_code_data": "QRDATA-UG-EFR-883920",
            
        
    
        
        
            
                "error_code": "",
            
        
    
        
        
            
                "error_message": "",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "document_type": "debit_note",
            
        
    
        
        
            
                "submission_status": "submitted",
            
        
    
        
        
            
                "submitted_at": new Date('2025-03-18T09:02:00Z'),
            
        
    
        
        
            
                "last_attempt_at": new Date('2025-03-18T09:02:00Z'),
            
        
    
        
        
            
                "attempt_count": 1,
            
        
    
        
        
            
                "request_payload_json": "{invoiceNo:LVT-INV-00109,amount:389400}",
            
        
    
        
        
            
                "response_payload_json": "{status:SUBMITTED}",
            
        
    
        
        
            
                "efris_invoice_no": "",
            
        
    
        
        
            
                "efris_receipt_no": "",
            
        
    
        
        
            
                "verification_code": "",
            
        
    
        
        
            
                "qr_code_data": "",
            
        
    
        
        
            
                "error_code": "",
            
        
    
        
        
            
                "error_message": "",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "document_type": "invoice",
            
        
    
        
        
            
                "submission_status": "accepted",
            
        
    
        
        
            
                "submitted_at": new Date('2025-03-12T12:10:00Z'),
            
        
    
        
        
            
                "last_attempt_at": new Date('2025-03-12T12:10:00Z'),
            
        
    
        
        
            
                "attempt_count": 1,
            
        
    
        
        
            
                "request_payload_json": "{invoiceNo:KIM-INV-00044,amount:495000}",
            
        
    
        
        
            
                "response_payload_json": "{status:ACCEPTED,efrisInvoiceNo:UG-EFR-771120}",
            
        
    
        
        
            
                "efris_invoice_no": "UG-EFR-771120",
            
        
    
        
        
            
                "efris_receipt_no": "UG-RCT-330881",
            
        
    
        
        
            
                "verification_code": "VRF-1H7P-90Q4",
            
        
    
        
        
            
                "qr_code_data": "QRDATA-UG-EFR-771120",
            
        
    
        
        
            
                "error_code": "",
            
        
    
        
        
            
                "error_message": "",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "document_type": "invoice",
            
        
    
        
        
            
                "submission_status": "submitted",
            
        
    
        
        
            
                "submitted_at": new Date('2025-02-20T09:05:00Z'),
            
        
    
        
        
            
                "last_attempt_at": new Date('2025-03-10T08:10:00Z'),
            
        
    
        
        
            
                "attempt_count": 3,
            
        
    
        
        
            
                "request_payload_json": "{invoiceNo:NFF-INV-00061,amount:944000}",
            
        
    
        
        
            
                "response_payload_json": "{status:FAILED,error:AUTH_ERROR}",
            
        
    
        
        
            
                "efris_invoice_no": "",
            
        
    
        
        
            
                "efris_receipt_no": "",
            
        
    
        
        
            
                "verification_code": "",
            
        
    
        
        
            
                "qr_code_data": "",
            
        
    
        
        
            
                "error_code": "AUTH_ERROR",
            
        
    
        
        
            
                "error_message": "Authentication failed with EFRIS provider.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "document_type": "invoice",
            
        
    
        
        
            
                "submission_status": "accepted",
            
        
    
        
        
            
                "submitted_at": new Date('2025-03-16T08:50:00Z'),
            
        
    
        
        
            
                "last_attempt_at": new Date('2025-03-16T08:50:00Z'),
            
        
    
        
        
            
                "attempt_count": 0,
            
        
    
        
        
            
                "request_payload_json": "{invoiceNo:RSC-INV-00007,amount:450000}",
            
        
    
        
        
            
                "response_payload_json": "",
            
        
    
        
        
            
                "efris_invoice_no": "",
            
        
    
        
        
            
                "efris_receipt_no": "",
            
        
    
        
        
            
                "verification_code": "",
            
        
    
        
        
            
                "qr_code_data": "",
            
        
    
        
        
            
                "error_code": "",
            
        
    
        
        
            
                "error_message": "",
            
        
    
    },
    
];



const AuditEventsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "approve",
            
        
    
        
        
            
                "entity_name": "invoices",
            
        
    
        
        
            
                "entity_reference": "LVT-INV-00109",
            
        
    
        
        
            
                "event_time": new Date('2025-03-18T09:00:00Z'),
            
        
    
        
        
            
                "ip_address": "197.157.10.21",
            
        
    
        
        
            
                "user_agent": "Mozilla Firefox on Windows",
            
        
    
        
        
            
                "details_json": "{action:create_invoice,total:389400}",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "submit_efris",
            
        
    
        
        
            
                "entity_name": "efris_submissions",
            
        
    
        
        
            
                "entity_reference": "LVT-INV-00108",
            
        
    
        
        
            
                "event_time": new Date('2025-03-13T09:05:00Z'),
            
        
    
        
        
            
                "ip_address": "197.157.10.22",
            
        
    
        
        
            
                "user_agent": "Mozilla Chrome on macOS",
            
        
    
        
        
            
                "details_json": "{result:accepted,efrisInvoiceNo:UG-EFR-883920}",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "approve",
            
        
    
        
        
            
                "entity_name": "payments",
            
        
    
        
        
            
                "entity_reference": "PAY-KIM-20250312-004",
            
        
    
        
        
            
                "event_time": new Date('2025-03-12T14:10:00Z'),
            
        
    
        
        
            
                "ip_address": "197.157.10.23",
            
        
    
        
        
            
                "user_agent": "Mozilla Chrome on Windows",
            
        
    
        
        
            
                "details_json": "{status:posted,method:cash}",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "error",
            
        
    
        
        
            
                "entity_name": "efris_connections",
            
        
    
        
        
            
                "entity_reference": "EFRIS-DEV-NFF-01",
            
        
    
        
        
            
                "event_time": new Date('2025-03-10T08:12:00Z'),
            
        
    
        
        
            
                "ip_address": "197.157.10.24",
            
        
    
        
        
            
                "user_agent": "Mozilla Chrome on Windows",
            
        
    
        
        
            
                "details_json": "{error:Token refresh failed}",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "submit_efris",
            
        
    
        
        
            
                "entity_name": "users",
            
        
    
        
        
            
                "entity_reference": "aisha.kato@kemboimports.ug",
            
        
    
        
        
            
                "event_time": new Date('2025-03-16T08:00:00Z'),
            
        
    
        
        
            
                "ip_address": "197.157.10.25",
            
        
    
        
        
            
                "user_agent": "Mozilla Safari on iOS",
            
        
    
        
        
            
                "details_json": "{login:success}",
            
        
    
    },
    
];




    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateUserWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const User0 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (User0?.setOrganization)
                {
                    await
                    User0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const User1 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (User1?.setOrganization)
                {
                    await
                    User1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const User2 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (User2?.setOrganization)
                {
                    await
                    User2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const User3 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (User3?.setOrganization)
                {
                    await
                    User3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const User4 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (User4?.setOrganization)
                {
                    await
                    User4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
    
    
        
    

    
    
    
        
            
            async function associateMembershipWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Membership0 = await Memberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Membership0?.setOrganization)
                {
                    await
                    Membership0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Membership1 = await Memberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Membership1?.setOrganization)
                {
                    await
                    Membership1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Membership2 = await Memberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Membership2?.setOrganization)
                {
                    await
                    Membership2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Membership3 = await Memberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Membership3?.setOrganization)
                {
                    await
                    Membership3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Membership4 = await Memberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Membership4?.setOrganization)
                {
                    await
                    Membership4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    
        
            
            async function associateMembershipWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Membership0 = await Memberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Membership0?.setUser)
                {
                    await
                    Membership0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Membership1 = await Memberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Membership1?.setUser)
                {
                    await
                    Membership1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Membership2 = await Memberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Membership2?.setUser)
                {
                    await
                    Membership2.
                    setUser(relatedUser2);
                }
            
                const relatedUser3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Membership3 = await Memberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Membership3?.setUser)
                {
                    await
                    Membership3.
                    setUser(relatedUser3);
                }
            
                const relatedUser4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Membership4 = await Memberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Membership4?.setUser)
                {
                    await
                    Membership4.
                    setUser(relatedUser4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateOrganizationSettingWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OrganizationSetting0 = await OrganizationSettings.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (OrganizationSetting0?.setOrganization)
                {
                    await
                    OrganizationSetting0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OrganizationSetting1 = await OrganizationSettings.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (OrganizationSetting1?.setOrganization)
                {
                    await
                    OrganizationSetting1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OrganizationSetting2 = await OrganizationSettings.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (OrganizationSetting2?.setOrganization)
                {
                    await
                    OrganizationSetting2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OrganizationSetting3 = await OrganizationSettings.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (OrganizationSetting3?.setOrganization)
                {
                    await
                    OrganizationSetting3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OrganizationSetting4 = await OrganizationSettings.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (OrganizationSetting4?.setOrganization)
                {
                    await
                    OrganizationSetting4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateTaxCodeWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TaxCode0 = await TaxCodes.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TaxCode0?.setOrganization)
                {
                    await
                    TaxCode0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TaxCode1 = await TaxCodes.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TaxCode1?.setOrganization)
                {
                    await
                    TaxCode1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TaxCode2 = await TaxCodes.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TaxCode2?.setOrganization)
                {
                    await
                    TaxCode2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TaxCode3 = await TaxCodes.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (TaxCode3?.setOrganization)
                {
                    await
                    TaxCode3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TaxCode4 = await TaxCodes.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (TaxCode4?.setOrganization)
                {
                    await
                    TaxCode4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateContactWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Contact0 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Contact0?.setOrganization)
                {
                    await
                    Contact0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Contact1 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Contact1?.setOrganization)
                {
                    await
                    Contact1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Contact2 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Contact2?.setOrganization)
                {
                    await
                    Contact2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Contact3 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Contact3?.setOrganization)
                {
                    await
                    Contact3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Contact4 = await Contacts.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Contact4?.setOrganization)
                {
                    await
                    Contact4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateProductWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Product0 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Product0?.setOrganization)
                {
                    await
                    Product0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Product1 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Product1?.setOrganization)
                {
                    await
                    Product1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Product2 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Product2?.setOrganization)
                {
                    await
                    Product2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Product3 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Product3?.setOrganization)
                {
                    await
                    Product3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Product4 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Product4?.setOrganization)
                {
                    await
                    Product4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateProductWithTax_code() {
            
                const relatedTax_code0 = await TaxCodes.findOne({
                    offset: Math.floor(Math.random() * (await TaxCodes.count())),
                });
                const Product0 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Product0?.setTax_code)
                {
                    await
                    Product0.
                    setTax_code(relatedTax_code0);
                }
            
                const relatedTax_code1 = await TaxCodes.findOne({
                    offset: Math.floor(Math.random() * (await TaxCodes.count())),
                });
                const Product1 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Product1?.setTax_code)
                {
                    await
                    Product1.
                    setTax_code(relatedTax_code1);
                }
            
                const relatedTax_code2 = await TaxCodes.findOne({
                    offset: Math.floor(Math.random() * (await TaxCodes.count())),
                });
                const Product2 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Product2?.setTax_code)
                {
                    await
                    Product2.
                    setTax_code(relatedTax_code2);
                }
            
                const relatedTax_code3 = await TaxCodes.findOne({
                    offset: Math.floor(Math.random() * (await TaxCodes.count())),
                });
                const Product3 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Product3?.setTax_code)
                {
                    await
                    Product3.
                    setTax_code(relatedTax_code3);
                }
            
                const relatedTax_code4 = await TaxCodes.findOne({
                    offset: Math.floor(Math.random() * (await TaxCodes.count())),
                });
                const Product4 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Product4?.setTax_code)
                {
                    await
                    Product4.
                    setTax_code(relatedTax_code4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateWarehousWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Warehous0 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Warehous0?.setOrganization)
                {
                    await
                    Warehous0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Warehous1 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Warehous1?.setOrganization)
                {
                    await
                    Warehous1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Warehous2 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Warehous2?.setOrganization)
                {
                    await
                    Warehous2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Warehous3 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Warehous3?.setOrganization)
                {
                    await
                    Warehous3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Warehous4 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Warehous4?.setOrganization)
                {
                    await
                    Warehous4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateInventoryItemWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryItem0 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryItem0?.setOrganization)
                {
                    await
                    InventoryItem0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryItem1 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryItem1?.setOrganization)
                {
                    await
                    InventoryItem1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryItem2 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryItem2?.setOrganization)
                {
                    await
                    InventoryItem2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryItem3 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryItem3?.setOrganization)
                {
                    await
                    InventoryItem3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryItem4 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InventoryItem4?.setOrganization)
                {
                    await
                    InventoryItem4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    
        
            
            async function associateInventoryItemWithProduct() {
            
                const relatedProduct0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InventoryItem0 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryItem0?.setProduct)
                {
                    await
                    InventoryItem0.
                    setProduct(relatedProduct0);
                }
            
                const relatedProduct1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InventoryItem1 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryItem1?.setProduct)
                {
                    await
                    InventoryItem1.
                    setProduct(relatedProduct1);
                }
            
                const relatedProduct2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InventoryItem2 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryItem2?.setProduct)
                {
                    await
                    InventoryItem2.
                    setProduct(relatedProduct2);
                }
            
                const relatedProduct3 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InventoryItem3 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryItem3?.setProduct)
                {
                    await
                    InventoryItem3.
                    setProduct(relatedProduct3);
                }
            
                const relatedProduct4 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InventoryItem4 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InventoryItem4?.setProduct)
                {
                    await
                    InventoryItem4.
                    setProduct(relatedProduct4);
                }
            
        }
        
    
        
            
            async function associateInventoryItemWithWarehouse() {
            
                const relatedWarehouse0 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryItem0 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryItem0?.setWarehouse)
                {
                    await
                    InventoryItem0.
                    setWarehouse(relatedWarehouse0);
                }
            
                const relatedWarehouse1 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryItem1 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryItem1?.setWarehouse)
                {
                    await
                    InventoryItem1.
                    setWarehouse(relatedWarehouse1);
                }
            
                const relatedWarehouse2 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryItem2 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryItem2?.setWarehouse)
                {
                    await
                    InventoryItem2.
                    setWarehouse(relatedWarehouse2);
                }
            
                const relatedWarehouse3 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryItem3 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryItem3?.setWarehouse)
                {
                    await
                    InventoryItem3.
                    setWarehouse(relatedWarehouse3);
                }
            
                const relatedWarehouse4 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryItem4 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InventoryItem4?.setWarehouse)
                {
                    await
                    InventoryItem4.
                    setWarehouse(relatedWarehouse4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateQuoteWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Quote0 = await Quotes.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Quote0?.setOrganization)
                {
                    await
                    Quote0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Quote1 = await Quotes.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Quote1?.setOrganization)
                {
                    await
                    Quote1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Quote2 = await Quotes.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Quote2?.setOrganization)
                {
                    await
                    Quote2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Quote3 = await Quotes.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Quote3?.setOrganization)
                {
                    await
                    Quote3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Quote4 = await Quotes.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Quote4?.setOrganization)
                {
                    await
                    Quote4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    
        
            
            async function associateQuoteWithCustomer() {
            
                const relatedCustomer0 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Quote0 = await Quotes.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Quote0?.setCustomer)
                {
                    await
                    Quote0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Quote1 = await Quotes.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Quote1?.setCustomer)
                {
                    await
                    Quote1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Quote2 = await Quotes.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Quote2?.setCustomer)
                {
                    await
                    Quote2.
                    setCustomer(relatedCustomer2);
                }
            
                const relatedCustomer3 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Quote3 = await Quotes.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Quote3?.setCustomer)
                {
                    await
                    Quote3.
                    setCustomer(relatedCustomer3);
                }
            
                const relatedCustomer4 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Quote4 = await Quotes.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Quote4?.setCustomer)
                {
                    await
                    Quote4.
                    setCustomer(relatedCustomer4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    

    
    
    
        
            
            async function associateQuoteLineWithQuote() {
            
                const relatedQuote0 = await Quotes.findOne({
                    offset: Math.floor(Math.random() * (await Quotes.count())),
                });
                const QuoteLine0 = await QuoteLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QuoteLine0?.setQuote)
                {
                    await
                    QuoteLine0.
                    setQuote(relatedQuote0);
                }
            
                const relatedQuote1 = await Quotes.findOne({
                    offset: Math.floor(Math.random() * (await Quotes.count())),
                });
                const QuoteLine1 = await QuoteLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QuoteLine1?.setQuote)
                {
                    await
                    QuoteLine1.
                    setQuote(relatedQuote1);
                }
            
                const relatedQuote2 = await Quotes.findOne({
                    offset: Math.floor(Math.random() * (await Quotes.count())),
                });
                const QuoteLine2 = await QuoteLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QuoteLine2?.setQuote)
                {
                    await
                    QuoteLine2.
                    setQuote(relatedQuote2);
                }
            
                const relatedQuote3 = await Quotes.findOne({
                    offset: Math.floor(Math.random() * (await Quotes.count())),
                });
                const QuoteLine3 = await QuoteLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (QuoteLine3?.setQuote)
                {
                    await
                    QuoteLine3.
                    setQuote(relatedQuote3);
                }
            
                const relatedQuote4 = await Quotes.findOne({
                    offset: Math.floor(Math.random() * (await Quotes.count())),
                });
                const QuoteLine4 = await QuoteLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (QuoteLine4?.setQuote)
                {
                    await
                    QuoteLine4.
                    setQuote(relatedQuote4);
                }
            
        }
        
    
        
            
            async function associateQuoteLineWithProduct() {
            
                const relatedProduct0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const QuoteLine0 = await QuoteLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QuoteLine0?.setProduct)
                {
                    await
                    QuoteLine0.
                    setProduct(relatedProduct0);
                }
            
                const relatedProduct1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const QuoteLine1 = await QuoteLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QuoteLine1?.setProduct)
                {
                    await
                    QuoteLine1.
                    setProduct(relatedProduct1);
                }
            
                const relatedProduct2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const QuoteLine2 = await QuoteLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QuoteLine2?.setProduct)
                {
                    await
                    QuoteLine2.
                    setProduct(relatedProduct2);
                }
            
                const relatedProduct3 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const QuoteLine3 = await QuoteLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (QuoteLine3?.setProduct)
                {
                    await
                    QuoteLine3.
                    setProduct(relatedProduct3);
                }
            
                const relatedProduct4 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const QuoteLine4 = await QuoteLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (QuoteLine4?.setProduct)
                {
                    await
                    QuoteLine4.
                    setProduct(relatedProduct4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateQuoteLineWithTax_code() {
            
                const relatedTax_code0 = await TaxCodes.findOne({
                    offset: Math.floor(Math.random() * (await TaxCodes.count())),
                });
                const QuoteLine0 = await QuoteLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QuoteLine0?.setTax_code)
                {
                    await
                    QuoteLine0.
                    setTax_code(relatedTax_code0);
                }
            
                const relatedTax_code1 = await TaxCodes.findOne({
                    offset: Math.floor(Math.random() * (await TaxCodes.count())),
                });
                const QuoteLine1 = await QuoteLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QuoteLine1?.setTax_code)
                {
                    await
                    QuoteLine1.
                    setTax_code(relatedTax_code1);
                }
            
                const relatedTax_code2 = await TaxCodes.findOne({
                    offset: Math.floor(Math.random() * (await TaxCodes.count())),
                });
                const QuoteLine2 = await QuoteLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QuoteLine2?.setTax_code)
                {
                    await
                    QuoteLine2.
                    setTax_code(relatedTax_code2);
                }
            
                const relatedTax_code3 = await TaxCodes.findOne({
                    offset: Math.floor(Math.random() * (await TaxCodes.count())),
                });
                const QuoteLine3 = await QuoteLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (QuoteLine3?.setTax_code)
                {
                    await
                    QuoteLine3.
                    setTax_code(relatedTax_code3);
                }
            
                const relatedTax_code4 = await TaxCodes.findOne({
                    offset: Math.floor(Math.random() * (await TaxCodes.count())),
                });
                const QuoteLine4 = await QuoteLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (QuoteLine4?.setTax_code)
                {
                    await
                    QuoteLine4.
                    setTax_code(relatedTax_code4);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateQuoteLineWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const QuoteLine0 = await QuoteLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (QuoteLine0?.setOrganization)
                {
                    await
                    QuoteLine0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const QuoteLine1 = await QuoteLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (QuoteLine1?.setOrganization)
                {
                    await
                    QuoteLine1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const QuoteLine2 = await QuoteLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (QuoteLine2?.setOrganization)
                {
                    await
                    QuoteLine2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const QuoteLine3 = await QuoteLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (QuoteLine3?.setOrganization)
                {
                    await
                    QuoteLine3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const QuoteLine4 = await QuoteLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (QuoteLine4?.setOrganization)
                {
                    await
                    QuoteLine4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associateInvoiceWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Invoice0 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Invoice0?.setOrganization)
                {
                    await
                    Invoice0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Invoice1 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Invoice1?.setOrganization)
                {
                    await
                    Invoice1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Invoice2 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Invoice2?.setOrganization)
                {
                    await
                    Invoice2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Invoice3 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Invoice3?.setOrganization)
                {
                    await
                    Invoice3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Invoice4 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Invoice4?.setOrganization)
                {
                    await
                    Invoice4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    
        
            
            async function associateInvoiceWithCustomer() {
            
                const relatedCustomer0 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Invoice0 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Invoice0?.setCustomer)
                {
                    await
                    Invoice0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Invoice1 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Invoice1?.setCustomer)
                {
                    await
                    Invoice1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Invoice2 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Invoice2?.setCustomer)
                {
                    await
                    Invoice2.
                    setCustomer(relatedCustomer2);
                }
            
                const relatedCustomer3 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Invoice3 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Invoice3?.setCustomer)
                {
                    await
                    Invoice3.
                    setCustomer(relatedCustomer3);
                }
            
                const relatedCustomer4 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Invoice4 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Invoice4?.setCustomer)
                {
                    await
                    Invoice4.
                    setCustomer(relatedCustomer4);
                }
            
        }
        
    
        
            
            async function associateInvoiceWithQuote() {
            
                const relatedQuote0 = await Quotes.findOne({
                    offset: Math.floor(Math.random() * (await Quotes.count())),
                });
                const Invoice0 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Invoice0?.setQuote)
                {
                    await
                    Invoice0.
                    setQuote(relatedQuote0);
                }
            
                const relatedQuote1 = await Quotes.findOne({
                    offset: Math.floor(Math.random() * (await Quotes.count())),
                });
                const Invoice1 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Invoice1?.setQuote)
                {
                    await
                    Invoice1.
                    setQuote(relatedQuote1);
                }
            
                const relatedQuote2 = await Quotes.findOne({
                    offset: Math.floor(Math.random() * (await Quotes.count())),
                });
                const Invoice2 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Invoice2?.setQuote)
                {
                    await
                    Invoice2.
                    setQuote(relatedQuote2);
                }
            
                const relatedQuote3 = await Quotes.findOne({
                    offset: Math.floor(Math.random() * (await Quotes.count())),
                });
                const Invoice3 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Invoice3?.setQuote)
                {
                    await
                    Invoice3.
                    setQuote(relatedQuote3);
                }
            
                const relatedQuote4 = await Quotes.findOne({
                    offset: Math.floor(Math.random() * (await Quotes.count())),
                });
                const Invoice4 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Invoice4?.setQuote)
                {
                    await
                    Invoice4.
                    setQuote(relatedQuote4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    

    
    
    
        
            
            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);
                }
            
                const relatedInvoice3 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const InvoiceLine3 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InvoiceLine3?.setInvoice)
                {
                    await
                    InvoiceLine3.
                    setInvoice(relatedInvoice3);
                }
            
                const relatedInvoice4 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const InvoiceLine4 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InvoiceLine4?.setInvoice)
                {
                    await
                    InvoiceLine4.
                    setInvoice(relatedInvoice4);
                }
            
        }
        
    
        
            
            async function associateInvoiceLineWithProduct() {
            
                const relatedProduct0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InvoiceLine0 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InvoiceLine0?.setProduct)
                {
                    await
                    InvoiceLine0.
                    setProduct(relatedProduct0);
                }
            
                const relatedProduct1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InvoiceLine1 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InvoiceLine1?.setProduct)
                {
                    await
                    InvoiceLine1.
                    setProduct(relatedProduct1);
                }
            
                const relatedProduct2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InvoiceLine2 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InvoiceLine2?.setProduct)
                {
                    await
                    InvoiceLine2.
                    setProduct(relatedProduct2);
                }
            
                const relatedProduct3 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InvoiceLine3 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InvoiceLine3?.setProduct)
                {
                    await
                    InvoiceLine3.
                    setProduct(relatedProduct3);
                }
            
                const relatedProduct4 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InvoiceLine4 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InvoiceLine4?.setProduct)
                {
                    await
                    InvoiceLine4.
                    setProduct(relatedProduct4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateInvoiceLineWithTax_code() {
            
                const relatedTax_code0 = await TaxCodes.findOne({
                    offset: Math.floor(Math.random() * (await TaxCodes.count())),
                });
                const InvoiceLine0 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InvoiceLine0?.setTax_code)
                {
                    await
                    InvoiceLine0.
                    setTax_code(relatedTax_code0);
                }
            
                const relatedTax_code1 = await TaxCodes.findOne({
                    offset: Math.floor(Math.random() * (await TaxCodes.count())),
                });
                const InvoiceLine1 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InvoiceLine1?.setTax_code)
                {
                    await
                    InvoiceLine1.
                    setTax_code(relatedTax_code1);
                }
            
                const relatedTax_code2 = await TaxCodes.findOne({
                    offset: Math.floor(Math.random() * (await TaxCodes.count())),
                });
                const InvoiceLine2 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InvoiceLine2?.setTax_code)
                {
                    await
                    InvoiceLine2.
                    setTax_code(relatedTax_code2);
                }
            
                const relatedTax_code3 = await TaxCodes.findOne({
                    offset: Math.floor(Math.random() * (await TaxCodes.count())),
                });
                const InvoiceLine3 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InvoiceLine3?.setTax_code)
                {
                    await
                    InvoiceLine3.
                    setTax_code(relatedTax_code3);
                }
            
                const relatedTax_code4 = await TaxCodes.findOne({
                    offset: Math.floor(Math.random() * (await TaxCodes.count())),
                });
                const InvoiceLine4 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InvoiceLine4?.setTax_code)
                {
                    await
                    InvoiceLine4.
                    setTax_code(relatedTax_code4);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateInvoiceLineWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InvoiceLine0 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InvoiceLine0?.setOrganization)
                {
                    await
                    InvoiceLine0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InvoiceLine1 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InvoiceLine1?.setOrganization)
                {
                    await
                    InvoiceLine1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InvoiceLine2 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InvoiceLine2?.setOrganization)
                {
                    await
                    InvoiceLine2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InvoiceLine3 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InvoiceLine3?.setOrganization)
                {
                    await
                    InvoiceLine3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InvoiceLine4 = await InvoiceLines.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (InvoiceLine4?.setOrganization)
                {
                    await
                    InvoiceLine4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    

    
    
    
        
            
            async function associatePaymentWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setOrganization)
                {
                    await
                    Payment0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setOrganization)
                {
                    await
                    Payment1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setOrganization)
                {
                    await
                    Payment2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payment3 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Payment3?.setOrganization)
                {
                    await
                    Payment3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payment4 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Payment4?.setOrganization)
                {
                    await
                    Payment4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    
        
            
            async function associatePaymentWithInvoice() {
            
                const relatedInvoice0 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setInvoice)
                {
                    await
                    Payment0.
                    setInvoice(relatedInvoice0);
                }
            
                const relatedInvoice1 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setInvoice)
                {
                    await
                    Payment1.
                    setInvoice(relatedInvoice1);
                }
            
                const relatedInvoice2 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setInvoice)
                {
                    await
                    Payment2.
                    setInvoice(relatedInvoice2);
                }
            
                const relatedInvoice3 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const Payment3 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Payment3?.setInvoice)
                {
                    await
                    Payment3.
                    setInvoice(relatedInvoice3);
                }
            
                const relatedInvoice4 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const Payment4 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Payment4?.setInvoice)
                {
                    await
                    Payment4.
                    setInvoice(relatedInvoice4);
                }
            
        }
        
    
        
            
            async function associatePaymentWithCustomer() {
            
                const relatedCustomer0 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setCustomer)
                {
                    await
                    Payment0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setCustomer)
                {
                    await
                    Payment1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setCustomer)
                {
                    await
                    Payment2.
                    setCustomer(relatedCustomer2);
                }
            
                const relatedCustomer3 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Payment3 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Payment3?.setCustomer)
                {
                    await
                    Payment3.
                    setCustomer(relatedCustomer3);
                }
            
                const relatedCustomer4 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Payment4 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Payment4?.setCustomer)
                {
                    await
                    Payment4.
                    setCustomer(relatedCustomer4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateReceiptWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Receipt0 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Receipt0?.setOrganization)
                {
                    await
                    Receipt0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Receipt1 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Receipt1?.setOrganization)
                {
                    await
                    Receipt1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Receipt2 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Receipt2?.setOrganization)
                {
                    await
                    Receipt2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Receipt3 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Receipt3?.setOrganization)
                {
                    await
                    Receipt3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Receipt4 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Receipt4?.setOrganization)
                {
                    await
                    Receipt4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    
        
            
            async function associateReceiptWithPayment() {
            
                const relatedPayment0 = await Payments.findOne({
                    offset: Math.floor(Math.random() * (await Payments.count())),
                });
                const Receipt0 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Receipt0?.setPayment)
                {
                    await
                    Receipt0.
                    setPayment(relatedPayment0);
                }
            
                const relatedPayment1 = await Payments.findOne({
                    offset: Math.floor(Math.random() * (await Payments.count())),
                });
                const Receipt1 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Receipt1?.setPayment)
                {
                    await
                    Receipt1.
                    setPayment(relatedPayment1);
                }
            
                const relatedPayment2 = await Payments.findOne({
                    offset: Math.floor(Math.random() * (await Payments.count())),
                });
                const Receipt2 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Receipt2?.setPayment)
                {
                    await
                    Receipt2.
                    setPayment(relatedPayment2);
                }
            
                const relatedPayment3 = await Payments.findOne({
                    offset: Math.floor(Math.random() * (await Payments.count())),
                });
                const Receipt3 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Receipt3?.setPayment)
                {
                    await
                    Receipt3.
                    setPayment(relatedPayment3);
                }
            
                const relatedPayment4 = await Payments.findOne({
                    offset: Math.floor(Math.random() * (await Payments.count())),
                });
                const Receipt4 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Receipt4?.setPayment)
                {
                    await
                    Receipt4.
                    setPayment(relatedPayment4);
                }
            
        }
        
    
        
            
            async function associateReceiptWithInvoice() {
            
                const relatedInvoice0 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const Receipt0 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Receipt0?.setInvoice)
                {
                    await
                    Receipt0.
                    setInvoice(relatedInvoice0);
                }
            
                const relatedInvoice1 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const Receipt1 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Receipt1?.setInvoice)
                {
                    await
                    Receipt1.
                    setInvoice(relatedInvoice1);
                }
            
                const relatedInvoice2 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const Receipt2 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Receipt2?.setInvoice)
                {
                    await
                    Receipt2.
                    setInvoice(relatedInvoice2);
                }
            
                const relatedInvoice3 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const Receipt3 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Receipt3?.setInvoice)
                {
                    await
                    Receipt3.
                    setInvoice(relatedInvoice3);
                }
            
                const relatedInvoice4 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const Receipt4 = await Receipts.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Receipt4?.setInvoice)
                {
                    await
                    Receipt4.
                    setInvoice(relatedInvoice4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateExpensWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Expens0 = await Expenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Expens0?.setOrganization)
                {
                    await
                    Expens0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Expens1 = await Expenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Expens1?.setOrganization)
                {
                    await
                    Expens1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Expens2 = await Expenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Expens2?.setOrganization)
                {
                    await
                    Expens2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Expens3 = await Expenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Expens3?.setOrganization)
                {
                    await
                    Expens3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Expens4 = await Expenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Expens4?.setOrganization)
                {
                    await
                    Expens4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    
        
            
            async function associateExpensWithVendor() {
            
                const relatedVendor0 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Expens0 = await Expenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Expens0?.setVendor)
                {
                    await
                    Expens0.
                    setVendor(relatedVendor0);
                }
            
                const relatedVendor1 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Expens1 = await Expenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Expens1?.setVendor)
                {
                    await
                    Expens1.
                    setVendor(relatedVendor1);
                }
            
                const relatedVendor2 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Expens2 = await Expenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Expens2?.setVendor)
                {
                    await
                    Expens2.
                    setVendor(relatedVendor2);
                }
            
                const relatedVendor3 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Expens3 = await Expenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Expens3?.setVendor)
                {
                    await
                    Expens3.
                    setVendor(relatedVendor3);
                }
            
                const relatedVendor4 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Expens4 = await Expenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Expens4?.setVendor)
                {
                    await
                    Expens4.
                    setVendor(relatedVendor4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateExpensWithTax_code() {
            
                const relatedTax_code0 = await TaxCodes.findOne({
                    offset: Math.floor(Math.random() * (await TaxCodes.count())),
                });
                const Expens0 = await Expenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Expens0?.setTax_code)
                {
                    await
                    Expens0.
                    setTax_code(relatedTax_code0);
                }
            
                const relatedTax_code1 = await TaxCodes.findOne({
                    offset: Math.floor(Math.random() * (await TaxCodes.count())),
                });
                const Expens1 = await Expenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Expens1?.setTax_code)
                {
                    await
                    Expens1.
                    setTax_code(relatedTax_code1);
                }
            
                const relatedTax_code2 = await TaxCodes.findOne({
                    offset: Math.floor(Math.random() * (await TaxCodes.count())),
                });
                const Expens2 = await Expenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Expens2?.setTax_code)
                {
                    await
                    Expens2.
                    setTax_code(relatedTax_code2);
                }
            
                const relatedTax_code3 = await TaxCodes.findOne({
                    offset: Math.floor(Math.random() * (await TaxCodes.count())),
                });
                const Expens3 = await Expenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Expens3?.setTax_code)
                {
                    await
                    Expens3.
                    setTax_code(relatedTax_code3);
                }
            
                const relatedTax_code4 = await TaxCodes.findOne({
                    offset: Math.floor(Math.random() * (await TaxCodes.count())),
                });
                const Expens4 = await Expenses.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Expens4?.setTax_code)
                {
                    await
                    Expens4.
                    setTax_code(relatedTax_code4);
                }
            
        }
        
    
        
    
        
    

    
    
    
        
            
            async function associateApprovalRequestWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ApprovalRequest0 = await ApprovalRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ApprovalRequest0?.setOrganization)
                {
                    await
                    ApprovalRequest0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ApprovalRequest1 = await ApprovalRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ApprovalRequest1?.setOrganization)
                {
                    await
                    ApprovalRequest1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ApprovalRequest2 = await ApprovalRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ApprovalRequest2?.setOrganization)
                {
                    await
                    ApprovalRequest2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ApprovalRequest3 = await ApprovalRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ApprovalRequest3?.setOrganization)
                {
                    await
                    ApprovalRequest3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ApprovalRequest4 = await ApprovalRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (ApprovalRequest4?.setOrganization)
                {
                    await
                    ApprovalRequest4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateApprovalRequestWithRequested_by() {
            
                const relatedRequested_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ApprovalRequest0 = await ApprovalRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ApprovalRequest0?.setRequested_by)
                {
                    await
                    ApprovalRequest0.
                    setRequested_by(relatedRequested_by0);
                }
            
                const relatedRequested_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ApprovalRequest1 = await ApprovalRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ApprovalRequest1?.setRequested_by)
                {
                    await
                    ApprovalRequest1.
                    setRequested_by(relatedRequested_by1);
                }
            
                const relatedRequested_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ApprovalRequest2 = await ApprovalRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ApprovalRequest2?.setRequested_by)
                {
                    await
                    ApprovalRequest2.
                    setRequested_by(relatedRequested_by2);
                }
            
                const relatedRequested_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ApprovalRequest3 = await ApprovalRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ApprovalRequest3?.setRequested_by)
                {
                    await
                    ApprovalRequest3.
                    setRequested_by(relatedRequested_by3);
                }
            
                const relatedRequested_by4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ApprovalRequest4 = await ApprovalRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (ApprovalRequest4?.setRequested_by)
                {
                    await
                    ApprovalRequest4.
                    setRequested_by(relatedRequested_by4);
                }
            
        }
        
    
        
            
            async function associateApprovalRequestWithApproved_by() {
            
                const relatedApproved_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ApprovalRequest0 = await ApprovalRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ApprovalRequest0?.setApproved_by)
                {
                    await
                    ApprovalRequest0.
                    setApproved_by(relatedApproved_by0);
                }
            
                const relatedApproved_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ApprovalRequest1 = await ApprovalRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ApprovalRequest1?.setApproved_by)
                {
                    await
                    ApprovalRequest1.
                    setApproved_by(relatedApproved_by1);
                }
            
                const relatedApproved_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ApprovalRequest2 = await ApprovalRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ApprovalRequest2?.setApproved_by)
                {
                    await
                    ApprovalRequest2.
                    setApproved_by(relatedApproved_by2);
                }
            
                const relatedApproved_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ApprovalRequest3 = await ApprovalRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ApprovalRequest3?.setApproved_by)
                {
                    await
                    ApprovalRequest3.
                    setApproved_by(relatedApproved_by3);
                }
            
                const relatedApproved_by4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ApprovalRequest4 = await ApprovalRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (ApprovalRequest4?.setApproved_by)
                {
                    await
                    ApprovalRequest4.
                    setApproved_by(relatedApproved_by4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateProjectWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Project0 = await Projects.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Project0?.setOrganization)
                {
                    await
                    Project0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Project1 = await Projects.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Project1?.setOrganization)
                {
                    await
                    Project1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Project2 = await Projects.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Project2?.setOrganization)
                {
                    await
                    Project2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Project3 = await Projects.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Project3?.setOrganization)
                {
                    await
                    Project3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Project4 = await Projects.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Project4?.setOrganization)
                {
                    await
                    Project4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    
        
            
            async function associateProjectWithCustomer() {
            
                const relatedCustomer0 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Project0 = await Projects.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Project0?.setCustomer)
                {
                    await
                    Project0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Project1 = await Projects.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Project1?.setCustomer)
                {
                    await
                    Project1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Project2 = await Projects.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Project2?.setCustomer)
                {
                    await
                    Project2.
                    setCustomer(relatedCustomer2);
                }
            
                const relatedCustomer3 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Project3 = await Projects.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Project3?.setCustomer)
                {
                    await
                    Project3.
                    setCustomer(relatedCustomer3);
                }
            
                const relatedCustomer4 = await Contacts.findOne({
                    offset: Math.floor(Math.random() * (await Contacts.count())),
                });
                const Project4 = await Projects.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Project4?.setCustomer)
                {
                    await
                    Project4.
                    setCustomer(relatedCustomer4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateTaskWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Task0 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Task0?.setOrganization)
                {
                    await
                    Task0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Task1 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Task1?.setOrganization)
                {
                    await
                    Task1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Task2 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Task2?.setOrganization)
                {
                    await
                    Task2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Task3 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Task3?.setOrganization)
                {
                    await
                    Task3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Task4 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Task4?.setOrganization)
                {
                    await
                    Task4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    
        
            
            async function associateTaskWithProject() {
            
                const relatedProject0 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Task0 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Task0?.setProject)
                {
                    await
                    Task0.
                    setProject(relatedProject0);
                }
            
                const relatedProject1 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Task1 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Task1?.setProject)
                {
                    await
                    Task1.
                    setProject(relatedProject1);
                }
            
                const relatedProject2 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Task2 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Task2?.setProject)
                {
                    await
                    Task2.
                    setProject(relatedProject2);
                }
            
                const relatedProject3 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Task3 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Task3?.setProject)
                {
                    await
                    Task3.
                    setProject(relatedProject3);
                }
            
                const relatedProject4 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const Task4 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Task4?.setProject)
                {
                    await
                    Task4.
                    setProject(relatedProject4);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateTaskWithAssignee() {
            
                const relatedAssignee0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task0 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Task0?.setAssignee)
                {
                    await
                    Task0.
                    setAssignee(relatedAssignee0);
                }
            
                const relatedAssignee1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task1 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Task1?.setAssignee)
                {
                    await
                    Task1.
                    setAssignee(relatedAssignee1);
                }
            
                const relatedAssignee2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task2 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Task2?.setAssignee)
                {
                    await
                    Task2.
                    setAssignee(relatedAssignee2);
                }
            
                const relatedAssignee3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task3 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Task3?.setAssignee)
                {
                    await
                    Task3.
                    setAssignee(relatedAssignee3);
                }
            
                const relatedAssignee4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task4 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (Task4?.setAssignee)
                {
                    await
                    Task4.
                    setAssignee(relatedAssignee4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateTimeEntryWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TimeEntry0 = await TimeEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TimeEntry0?.setOrganization)
                {
                    await
                    TimeEntry0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TimeEntry1 = await TimeEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TimeEntry1?.setOrganization)
                {
                    await
                    TimeEntry1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TimeEntry2 = await TimeEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TimeEntry2?.setOrganization)
                {
                    await
                    TimeEntry2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TimeEntry3 = await TimeEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (TimeEntry3?.setOrganization)
                {
                    await
                    TimeEntry3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TimeEntry4 = await TimeEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (TimeEntry4?.setOrganization)
                {
                    await
                    TimeEntry4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    
        
            
            async function associateTimeEntryWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const TimeEntry0 = await TimeEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TimeEntry0?.setUser)
                {
                    await
                    TimeEntry0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const TimeEntry1 = await TimeEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TimeEntry1?.setUser)
                {
                    await
                    TimeEntry1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const TimeEntry2 = await TimeEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TimeEntry2?.setUser)
                {
                    await
                    TimeEntry2.
                    setUser(relatedUser2);
                }
            
                const relatedUser3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const TimeEntry3 = await TimeEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (TimeEntry3?.setUser)
                {
                    await
                    TimeEntry3.
                    setUser(relatedUser3);
                }
            
                const relatedUser4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const TimeEntry4 = await TimeEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (TimeEntry4?.setUser)
                {
                    await
                    TimeEntry4.
                    setUser(relatedUser4);
                }
            
        }
        
    
        
            
            async function associateTimeEntryWithProject() {
            
                const relatedProject0 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const TimeEntry0 = await TimeEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TimeEntry0?.setProject)
                {
                    await
                    TimeEntry0.
                    setProject(relatedProject0);
                }
            
                const relatedProject1 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const TimeEntry1 = await TimeEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TimeEntry1?.setProject)
                {
                    await
                    TimeEntry1.
                    setProject(relatedProject1);
                }
            
                const relatedProject2 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const TimeEntry2 = await TimeEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TimeEntry2?.setProject)
                {
                    await
                    TimeEntry2.
                    setProject(relatedProject2);
                }
            
                const relatedProject3 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const TimeEntry3 = await TimeEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (TimeEntry3?.setProject)
                {
                    await
                    TimeEntry3.
                    setProject(relatedProject3);
                }
            
                const relatedProject4 = await Projects.findOne({
                    offset: Math.floor(Math.random() * (await Projects.count())),
                });
                const TimeEntry4 = await TimeEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (TimeEntry4?.setProject)
                {
                    await
                    TimeEntry4.
                    setProject(relatedProject4);
                }
            
        }
        
    
        
            
            async function associateTimeEntryWithTask() {
            
                const relatedTask0 = await Tasks.findOne({
                    offset: Math.floor(Math.random() * (await Tasks.count())),
                });
                const TimeEntry0 = await TimeEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TimeEntry0?.setTask)
                {
                    await
                    TimeEntry0.
                    setTask(relatedTask0);
                }
            
                const relatedTask1 = await Tasks.findOne({
                    offset: Math.floor(Math.random() * (await Tasks.count())),
                });
                const TimeEntry1 = await TimeEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TimeEntry1?.setTask)
                {
                    await
                    TimeEntry1.
                    setTask(relatedTask1);
                }
            
                const relatedTask2 = await Tasks.findOne({
                    offset: Math.floor(Math.random() * (await Tasks.count())),
                });
                const TimeEntry2 = await TimeEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TimeEntry2?.setTask)
                {
                    await
                    TimeEntry2.
                    setTask(relatedTask2);
                }
            
                const relatedTask3 = await Tasks.findOne({
                    offset: Math.floor(Math.random() * (await Tasks.count())),
                });
                const TimeEntry3 = await TimeEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (TimeEntry3?.setTask)
                {
                    await
                    TimeEntry3.
                    setTask(relatedTask3);
                }
            
                const relatedTask4 = await Tasks.findOne({
                    offset: Math.floor(Math.random() * (await Tasks.count())),
                });
                const TimeEntry4 = await TimeEntries.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (TimeEntry4?.setTask)
                {
                    await
                    TimeEntry4.
                    setTask(relatedTask4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateEfrisConnectionWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EfrisConnection0 = await EfrisConnections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EfrisConnection0?.setOrganization)
                {
                    await
                    EfrisConnection0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EfrisConnection1 = await EfrisConnections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EfrisConnection1?.setOrganization)
                {
                    await
                    EfrisConnection1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EfrisConnection2 = await EfrisConnections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EfrisConnection2?.setOrganization)
                {
                    await
                    EfrisConnection2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EfrisConnection3 = await EfrisConnections.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (EfrisConnection3?.setOrganization)
                {
                    await
                    EfrisConnection3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EfrisConnection4 = await EfrisConnections.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (EfrisConnection4?.setOrganization)
                {
                    await
                    EfrisConnection4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateEfrisSubmissionWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EfrisSubmission0 = await EfrisSubmissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EfrisSubmission0?.setOrganization)
                {
                    await
                    EfrisSubmission0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EfrisSubmission1 = await EfrisSubmissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EfrisSubmission1?.setOrganization)
                {
                    await
                    EfrisSubmission1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EfrisSubmission2 = await EfrisSubmissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EfrisSubmission2?.setOrganization)
                {
                    await
                    EfrisSubmission2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EfrisSubmission3 = await EfrisSubmissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (EfrisSubmission3?.setOrganization)
                {
                    await
                    EfrisSubmission3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EfrisSubmission4 = await EfrisSubmissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (EfrisSubmission4?.setOrganization)
                {
                    await
                    EfrisSubmission4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    
        
            
            async function associateEfrisSubmissionWithInvoice() {
            
                const relatedInvoice0 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const EfrisSubmission0 = await EfrisSubmissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EfrisSubmission0?.setInvoice)
                {
                    await
                    EfrisSubmission0.
                    setInvoice(relatedInvoice0);
                }
            
                const relatedInvoice1 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const EfrisSubmission1 = await EfrisSubmissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EfrisSubmission1?.setInvoice)
                {
                    await
                    EfrisSubmission1.
                    setInvoice(relatedInvoice1);
                }
            
                const relatedInvoice2 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const EfrisSubmission2 = await EfrisSubmissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EfrisSubmission2?.setInvoice)
                {
                    await
                    EfrisSubmission2.
                    setInvoice(relatedInvoice2);
                }
            
                const relatedInvoice3 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const EfrisSubmission3 = await EfrisSubmissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (EfrisSubmission3?.setInvoice)
                {
                    await
                    EfrisSubmission3.
                    setInvoice(relatedInvoice3);
                }
            
                const relatedInvoice4 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const EfrisSubmission4 = await EfrisSubmissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (EfrisSubmission4?.setInvoice)
                {
                    await
                    EfrisSubmission4.
                    setInvoice(relatedInvoice4);
                }
            
        }
        
    
        
            
            async function associateEfrisSubmissionWithReceipt() {
            
                const relatedReceipt0 = await Receipts.findOne({
                    offset: Math.floor(Math.random() * (await Receipts.count())),
                });
                const EfrisSubmission0 = await EfrisSubmissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EfrisSubmission0?.setReceipt)
                {
                    await
                    EfrisSubmission0.
                    setReceipt(relatedReceipt0);
                }
            
                const relatedReceipt1 = await Receipts.findOne({
                    offset: Math.floor(Math.random() * (await Receipts.count())),
                });
                const EfrisSubmission1 = await EfrisSubmissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EfrisSubmission1?.setReceipt)
                {
                    await
                    EfrisSubmission1.
                    setReceipt(relatedReceipt1);
                }
            
                const relatedReceipt2 = await Receipts.findOne({
                    offset: Math.floor(Math.random() * (await Receipts.count())),
                });
                const EfrisSubmission2 = await EfrisSubmissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EfrisSubmission2?.setReceipt)
                {
                    await
                    EfrisSubmission2.
                    setReceipt(relatedReceipt2);
                }
            
                const relatedReceipt3 = await Receipts.findOne({
                    offset: Math.floor(Math.random() * (await Receipts.count())),
                });
                const EfrisSubmission3 = await EfrisSubmissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (EfrisSubmission3?.setReceipt)
                {
                    await
                    EfrisSubmission3.
                    setReceipt(relatedReceipt3);
                }
            
                const relatedReceipt4 = await Receipts.findOne({
                    offset: Math.floor(Math.random() * (await Receipts.count())),
                });
                const EfrisSubmission4 = await EfrisSubmissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (EfrisSubmission4?.setReceipt)
                {
                    await
                    EfrisSubmission4.
                    setReceipt(relatedReceipt4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateAuditEventWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AuditEvent0 = await AuditEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AuditEvent0?.setOrganization)
                {
                    await
                    AuditEvent0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AuditEvent1 = await AuditEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AuditEvent1?.setOrganization)
                {
                    await
                    AuditEvent1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AuditEvent2 = await AuditEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AuditEvent2?.setOrganization)
                {
                    await
                    AuditEvent2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AuditEvent3 = await AuditEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (AuditEvent3?.setOrganization)
                {
                    await
                    AuditEvent3.
                    setOrganization(relatedOrganization3);
                }
            
                const relatedOrganization4 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AuditEvent4 = await AuditEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (AuditEvent4?.setOrganization)
                {
                    await
                    AuditEvent4.
                    setOrganization(relatedOrganization4);
                }
            
        }
        
    
        
            
            async function associateAuditEventWithActor() {
            
                const relatedActor0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditEvent0 = await AuditEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AuditEvent0?.setActor)
                {
                    await
                    AuditEvent0.
                    setActor(relatedActor0);
                }
            
                const relatedActor1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditEvent1 = await AuditEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AuditEvent1?.setActor)
                {
                    await
                    AuditEvent1.
                    setActor(relatedActor1);
                }
            
                const relatedActor2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditEvent2 = await AuditEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AuditEvent2?.setActor)
                {
                    await
                    AuditEvent2.
                    setActor(relatedActor2);
                }
            
                const relatedActor3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditEvent3 = await AuditEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (AuditEvent3?.setActor)
                {
                    await
                    AuditEvent3.
                    setActor(relatedActor3);
                }
            
                const relatedActor4 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditEvent4 = await AuditEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 4
                });
                if (AuditEvent4?.setActor)
                {
                    await
                    AuditEvent4.
                    setActor(relatedActor4);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    


module.exports = {
    up: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
                
                await Organizations.bulkCreate(OrganizationsData);
                
            
            
                
                await Memberships.bulkCreate(MembershipsData);
                
            
            
                
                await OrganizationSettings.bulkCreate(OrganizationSettingsData);
                
            
            
                
                await TaxCodes.bulkCreate(TaxCodesData);
                
            
            
                
                await Contacts.bulkCreate(ContactsData);
                
            
            
                
                await Products.bulkCreate(ProductsData);
                
            
            
                
                await Warehouses.bulkCreate(WarehousesData);
                
            
            
                
                await InventoryItems.bulkCreate(InventoryItemsData);
                
            
            
                
                await Quotes.bulkCreate(QuotesData);
                
            
            
                
                await QuoteLines.bulkCreate(QuoteLinesData);
                
            
            
                
                await Invoices.bulkCreate(InvoicesData);
                
            
            
                
                await InvoiceLines.bulkCreate(InvoiceLinesData);
                
            
            
                
                await Payments.bulkCreate(PaymentsData);
                
            
            
                
                await Receipts.bulkCreate(ReceiptsData);
                
            
            
                
                await Expenses.bulkCreate(ExpensesData);
                
            
            
                
                await ApprovalRequests.bulkCreate(ApprovalRequestsData);
                
            
            
                
                await Projects.bulkCreate(ProjectsData);
                
            
            
                
                await Tasks.bulkCreate(TasksData);
                
            
            
                
                await TimeEntries.bulkCreate(TimeEntriesData);
                
            
            
                
                await EfrisConnections.bulkCreate(EfrisConnectionsData);
                
            
            
                
                await EfrisSubmissions.bulkCreate(EfrisSubmissionsData);
                
            
            
                
                await AuditEvents.bulkCreate(AuditEventsData);
                
            
            await Promise.all([
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateUserWithOrganization(),
                    
                
            
                
                
                
                
                    
                
            
                
                
                    
                        
                        await associateMembershipWithOrganization(),
                    
                
                    
                        
                        await associateMembershipWithUser(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateOrganizationSettingWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateTaxCodeWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateContactWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateProductWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateProductWithTax_code(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateWarehousWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateInventoryItemWithOrganization(),
                    
                
                    
                        
                        await associateInventoryItemWithProduct(),
                    
                
                    
                        
                        await associateInventoryItemWithWarehouse(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateQuoteWithOrganization(),
                    
                
                    
                        
                        await associateQuoteWithCustomer(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                    
                        
                        await associateQuoteLineWithQuote(),
                    
                
                    
                        
                        await associateQuoteLineWithProduct(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateQuoteLineWithTax_code(),
                    
                
                    
                
                    
                
                    
                        
                        await associateQuoteLineWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateInvoiceWithOrganization(),
                    
                
                    
                        
                        await associateInvoiceWithCustomer(),
                    
                
                    
                        
                        await associateInvoiceWithQuote(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
            
                
                
                    
                        
                        await associateInvoiceLineWithInvoice(),
                    
                
                    
                        
                        await associateInvoiceLineWithProduct(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateInvoiceLineWithTax_code(),
                    
                
                    
                
                    
                
                    
                        
                        await associateInvoiceLineWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associatePaymentWithOrganization(),
                    
                
                    
                        
                        await associatePaymentWithInvoice(),
                    
                
                    
                        
                        await associatePaymentWithCustomer(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateReceiptWithOrganization(),
                    
                
                    
                        
                        await associateReceiptWithPayment(),
                    
                
                    
                        
                        await associateReceiptWithInvoice(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateExpensWithOrganization(),
                    
                
                    
                        
                        await associateExpensWithVendor(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateExpensWithTax_code(),
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateApprovalRequestWithOrganization(),
                    
                
                    
                
                    
                
                    
                        
                        await associateApprovalRequestWithRequested_by(),
                    
                
                    
                        
                        await associateApprovalRequestWithApproved_by(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateProjectWithOrganization(),
                    
                
                    
                        
                        await associateProjectWithCustomer(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateTaskWithOrganization(),
                    
                
                    
                        
                        await associateTaskWithProject(),
                    
                
                    
                
                    
                
                    
                        
                        await associateTaskWithAssignee(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateTimeEntryWithOrganization(),
                    
                
                    
                        
                        await associateTimeEntryWithUser(),
                    
                
                    
                        
                        await associateTimeEntryWithProject(),
                    
                
                    
                        
                        await associateTimeEntryWithTask(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateEfrisConnectionWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateEfrisSubmissionWithOrganization(),
                    
                
                    
                        
                        await associateEfrisSubmissionWithInvoice(),
                    
                
                    
                        
                        await associateEfrisSubmissionWithReceipt(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateAuditEventWithOrganization(),
                    
                
                    
                        
                        await associateAuditEventWithActor(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            ]);
        
    },

    down: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
            await queryInterface.bulkDelete('organizations', null, {});
            
            
            await queryInterface.bulkDelete('memberships', null, {});
            
            
            await queryInterface.bulkDelete('organization_settings', null, {});
            
            
            await queryInterface.bulkDelete('tax_codes', null, {});
            
            
            await queryInterface.bulkDelete('contacts', null, {});
            
            
            await queryInterface.bulkDelete('products', null, {});
            
            
            await queryInterface.bulkDelete('warehouses', null, {});
            
            
            await queryInterface.bulkDelete('inventory_items', null, {});
            
            
            await queryInterface.bulkDelete('quotes', null, {});
            
            
            await queryInterface.bulkDelete('quote_lines', null, {});
            
            
            await queryInterface.bulkDelete('invoices', null, {});
            
            
            await queryInterface.bulkDelete('invoice_lines', null, {});
            
            
            await queryInterface.bulkDelete('payments', null, {});
            
            
            await queryInterface.bulkDelete('receipts', null, {});
            
            
            await queryInterface.bulkDelete('expenses', null, {});
            
            
            await queryInterface.bulkDelete('approval_requests', null, {});
            
            
            await queryInterface.bulkDelete('projects', null, {});
            
            
            await queryInterface.bulkDelete('tasks', null, {});
            
            
            await queryInterface.bulkDelete('time_entries', null, {});
            
            
            await queryInterface.bulkDelete('efris_connections', null, {});
            
            
            await queryInterface.bulkDelete('efris_submissions', null, {});
            
            
            await queryInterface.bulkDelete('audit_events', null, {});
            
        
    },
};