diff --git a/backend/api/v1/modules/a76/general_catalogs/company/models.py b/backend/api/v1/modules/a76/general_catalogs/company/models.py index ae94fc89..fdcc0262 100644 --- a/backend/api/v1/modules/a76/general_catalogs/company/models.py +++ b/backend/api/v1/modules/a76/general_catalogs/company/models.py @@ -61,9 +61,9 @@ class Company(Base, TimestampMixin): # Configuración básica logo: Mapped[Optional[str]] = mapped_column(String(255)) - has_express_line: Mapped[Optional[bool]] = mapped_column(Boolean, default=False) + has_express_line: Mapped[Optional[str]] = mapped_column(String(2), default="N") order_format_type: Mapped[Optional[str]] = mapped_column(String(19)) - is_service_company: Mapped[Optional[bool]] = mapped_column(Boolean, default=False) + is_service_company: Mapped[Optional[str]] = mapped_column(String(2), default="N") client_name: Mapped[Optional[str]] = mapped_column(String(300)) subassembly_mode: Mapped[Optional[str]] = mapped_column(String(7)) @@ -78,6 +78,7 @@ class Company(Base, TimestampMixin): parts_replacement: Mapped[Optional[int]] = mapped_column(SmallInteger) activate_facmexame: Mapped[Optional[int]] = mapped_column(SmallInteger) part_reference: Mapped[Optional[int]] = mapped_column(SmallInteger) + part_reference: Mapped[Optional[int]] = mapped_column(SmallInteger) international_firm: Mapped[Optional[int]] = mapped_column(SmallInteger) # Configuraciones simples diff --git a/backend/api/v1/modules/a76/general_catalogs/company/routes.py b/backend/api/v1/modules/a76/general_catalogs/company/routes.py index cc59a1bc..6aadda85 100644 --- a/backend/api/v1/modules/a76/general_catalogs/company/routes.py +++ b/backend/api/v1/modules/a76/general_catalogs/company/routes.py @@ -312,68 +312,14 @@ async def update_company( return CompanyResponseDTO.model_validate(updated_company) -@router.post( - "/{company_id}/upload-logo", - response_model=dict, - summary="Upload company logo", -) -async def upload_company_logo( - company_id: int, - file: UploadFile = File(...), - db: Session = Depends(get_core_db), - current_user: dict = Depends(get_current_user), -): - """Upload logo for a company""" - tenant_id = current_user.get("tenant_id") - if not tenant_id: - raise HTTPException( - status_code=status.HTTP_400_BAD_REQUEST, - detail="Tenant ID not found in user data", - ) - # 1. Verify company exists - company = CompanyService.get_by_id(db, company_id, tenant_id, 0) - if not company: - raise HTTPException( - status_code=status.HTTP_404_NOT_FOUND, - detail="Company not found", - ) - - # 2. Define upload path - # Use a persistent path: 'app_data/logos/{company_id}' - upload_dir = Path(f"app_data/logos/{company_id}") - upload_dir.mkdir(parents=True, exist_ok=True) - - # 3. Save file - # Preserve original filename - filename = file.filename or "logo.png" - file_path = upload_dir / filename - - try: - # Check if file exists and remove it to avoid accumulation if needed, - # or just overwrite (shutil.copyfileobj overwrites) - with open(file_path, "wb") as buffer: - shutil.copyfileobj(file.file, buffer) - except Exception as e: - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, - detail=f"Could not save file: {e}", - ) - - # 4. Returns the absolute path keys - abs_path = str(file_path.absolute()) - - return {"path": abs_path} @router.get( "/{company_id}/logo/image", summary="Get company logo image", ) -@router.get( - "/{company_id}/logo/image", - summary="Get company logo image", -) + async def get_company_logo_image( company_id: int, db: Session = Depends(get_core_db), diff --git a/backend/api/v1/modules/a76/general_catalogs/company/service.py b/backend/api/v1/modules/a76/general_catalogs/company/service.py index 63835cd1..5ed24feb 100644 --- a/backend/api/v1/modules/a76/general_catalogs/company/service.py +++ b/backend/api/v1/modules/a76/general_catalogs/company/service.py @@ -112,7 +112,14 @@ class CompanyService: # Update only provided fields update_data = company_data.model_dump(exclude_unset=True) + boolean_fields_str = ["has_express_line", "is_service_company"] + for field, value in update_data.items(): + if field in boolean_fields_str: + # Convert boolean to "S"/"N" + if isinstance(value, bool): + value = "S" if value else "N" + setattr(company, field, value) try: @@ -177,6 +184,11 @@ class CompanyService: # 1. Preparar datos obj_data = data.model_dump(exclude_unset=True) + boolean_fields_str = ["has_express_line", "is_service_company"] + for field in boolean_fields_str: + if field in obj_data and isinstance(obj_data[field], bool): + obj_data[field] = "S" if obj_data[field] else "N" + # 2. Crear objeto SQLAlchemy db_obj = Company(**obj_data, tenant_id=tenant_id) diff --git a/frontend/src/lib/api/dashboard/a76/general_catalogs/units-of-measure.ts b/frontend/src/lib/api/dashboard/a76/general_catalogs/units-of-measure.ts index f680bae3..7b731651 100644 --- a/frontend/src/lib/api/dashboard/a76/general_catalogs/units-of-measure.ts +++ b/frontend/src/lib/api/dashboard/a76/general_catalogs/units-of-measure.ts @@ -183,7 +183,7 @@ export interface UnitOfMeasureGeneralUpdate { } export interface UnitOfMeasureGeneralListResponse { - items: UnitOfMeasureGeneral[]; + items: UnitOfMeasureGeneral[]; total: number; page: number; page_size: number; diff --git a/frontend/src/lib/components/sidebar/team-switcher.svelte b/frontend/src/lib/components/sidebar/team-switcher.svelte index c61c8a3d..088b02df 100644 --- a/frontend/src/lib/components/sidebar/team-switcher.svelte +++ b/frontend/src/lib/components/sidebar/team-switcher.svelte @@ -10,10 +10,10 @@ const sidebar = useSidebar(); - // Derivar la URL del logo + // Derivar la URL del logo usando el endpoint específico let activeCompanyLogoUrl = $derived( companyStore.activeCompany?.logo - ? getBackendAssetUrl(companyStore.activeCompany.logo) + ? getBackendAssetUrl(`v1/a76/company/${companyStore.activeCompany.id}/logo/image?t=${new Date().getTime()}`) : null ); @@ -89,7 +89,7 @@
{#if company.logo} {company.name} diff --git a/frontend/src/lib/stores/company.svelte.ts b/frontend/src/lib/stores/company.svelte.ts index b3da0f1f..9f04bcdb 100644 --- a/frontend/src/lib/stores/company.svelte.ts +++ b/frontend/src/lib/stores/company.svelte.ts @@ -144,6 +144,30 @@ class CompanyStore { } } + /** + * Actualiza los datos de une empresa en el store localmente + * Útil para reflejar cambios inmediatos (ej: cambio de logo) sin recargar + */ + updateCompany(id: number, data: Partial) { + // 1. Actualizar en la lista + const index = this._companies.findIndex(c => c.id === id); + if (index !== -1) { + this._companies[index] = { ...this._companies[index], ...data }; + + // 2. Si es la activa, actualizar también + if (this._activeCompany?.id === id) { + this._activeCompany = { ...this._activeCompany, ...data }; + // Actualizar persistencia si es necesario + if (typeof window !== 'undefined') { + // Disparar evento para notificar cambios a componentes que no usan el store reactivo directo (si los hay) + window.dispatchEvent(new CustomEvent('companyChanged', { + detail: { companyId: id } + })); + } + } + } + } + /** * Restaura la compañía activa desde localStorage */ diff --git a/frontend/src/routes/dashboard/general_catalogs/company_information/edit/[[id]]/+page.svelte b/frontend/src/routes/dashboard/general_catalogs/company_information/edit/[[id]]/+page.svelte index 136f81ff..290ce649 100644 --- a/frontend/src/routes/dashboard/general_catalogs/company_information/edit/[[id]]/+page.svelte +++ b/frontend/src/routes/dashboard/general_catalogs/company_information/edit/[[id]]/+page.svelte @@ -14,6 +14,7 @@ uploadCompanyLogo, type Company } from '$lib/api/dashboard/a76/general_catalogs/company'; + import { companyStore } from '$lib/stores/company.svelte'; import { getBackendAssetUrl } from '$lib/utils'; import { ArrowLeft, LoaderCircle, Save, Upload, X, Building2, FileText, User, Settings } from 'lucide-svelte'; @@ -25,15 +26,18 @@ let loading = $state(false); let uploading = $state(false); let error = $state(null); + let activeTab = $state('general'); + let logoFile = $state(null); let logoPreview = $state(null); let currentLogo = $state(null); let uploadingLogo = $state(false); - let activeTab = $state('general'); - + // URL completa del logo derivada let currentLogoUrl = $derived( - logoPreview || getBackendAssetUrl(currentLogo) || '' + logoPreview + ? logoPreview + : (currentLogo ? getBackendAssetUrl(`v1/a76/company/${id}/logo/image?t=${new Date().getTime()}`) : '') ); // 2. Estado Inicial (Reset) @@ -104,7 +108,15 @@ is_service_company: item.is_service_company || false, order_format_type: item.order_format_type || '', ctpat_svi: item.ctpat_svi || '', - trusted_exporter_number: item.trusted_exporter_number || '' + trusted_exporter_number: item.trusted_exporter_number || '', + logo: item.logo || '', + previous_code: item.previous_code || 0, + client_name: item.client_name || '', + subassembly_mode: item.subassembly_mode || '', + broker_company: item.broker_company || '', + inter_db_name: item.inter_db_name || '', + prevalidator_key: item.prevalidator_key || '', + seventh_amendment: item.seventh_amendment || false }; // Guardar la URL del logo actual si existe if (item.logo) { @@ -118,6 +130,9 @@ } } + + const clean = (value: any) => (typeof value === 'string' ? value.trim() || null : value); + function handleLogoChange(event: Event) { const target = event.target as HTMLInputElement; const file = target.files?.[0]; @@ -170,6 +185,9 @@ currentLogo = response.data.logo_path; logoFile = null; logoPreview = null; + + // Actualizar el store reactivamente + companyStore.updateCompany(companyId, { logo: response.data.logo_path }); } } catch (e: any) { error = `Error al subir el logo: ${e.message}`; @@ -178,33 +196,6 @@ } } - const clean = (value: any) => (typeof value === 'string' ? value.trim() || null : value); - - async function handleFileSelect(e: Event) { - const input = e.target as HTMLInputElement; - if (!input.files || input.files.length === 0) return; - - const file = input.files[0]; - if (!isEdit) { - alert("Primero debes guardar la empresa antes de subir un logo."); - return; - } - - uploading = true; - try { - const res = await uploadCompanyLogo(Number(id), file); - if (res.data) { - formData.logo = res.data.path; - } else if (res.error) { - alert("Error al subir imagen: " + res.error); - } - } catch (err) { - alert("Error al intentar subir la imagen"); - } finally { - uploading = false; - } - } - async function handleSubmit() { error = null; loading = true; @@ -222,6 +213,7 @@ main_activity: clean(formData.main_activity), program: clean(formData.program), program_number: clean(formData.program_number), + prosec: Number(formData.prosec) || 0, prosec_authorization: clean(formData.prosec_authorization), responsible_name: clean(formData.responsible_name), responsible_last_name: clean(formData.responsible_last_name), @@ -239,7 +231,10 @@ broker_company: clean(formData.broker_company), inter_db_name: clean(formData.inter_db_name), prevalidator_key: clean(formData.prevalidator_key), - seventh_amendment: formData.seventh_amendment + seventh_amendment: formData.seventh_amendment, + // Ensure optional booleans are passed correctly or default to false/null if needed + has_express_line: formData.has_express_line, + is_service_company: formData.is_service_company }; const response = isEdit @@ -285,6 +280,8 @@
+ +
@@ -344,36 +341,9 @@
-
-
- -
- - {#if isEdit} -
- - -
- {/if} -
-

Sube una imagen para obtener su ruta local.

-
-
- - -
+
+ +
diff --git a/schema_dump.txt b/schema_dump.txt new file mode 100644 index 00000000..fbdc9a3b --- /dev/null +++ b/schema_dump.txt @@ -0,0 +1,151 @@ + Table "a76.company" + Column | Type | Collation | Nullable | Default +------------------------------+-----------------------------+-----------+----------+----------------------------------------- + id | integer | | not null | nextval('a76.company_id_seq'::regclass) + tenant_id | integer | | not null | + name | character varying(256) | | | + rfc | character varying(30) | | | + curp | character varying(19) | | | + main_activity | character varying(80) | | | + program | character varying(7) | | | + program_number | character varying(40) | | | + prosec | smallint | | | + prosec_authorization | character varying(20) | | | + sector1 | character varying(150) | | | + sector2 | character varying(150) | | | + sector3 | character varying(5) | | | + manufacturer_id | character varying(25) | | | + broker_company | character varying(6) | | | + responsible | character varying(80) | | | + responsible_name | character varying(20) | | | + responsible_last_name | character varying(20) | | | + responsible_mother_last_name | character varying(20) | | | + responsible_rfc | character varying(30) | | | + position | character varying(30) | | | + logo | character varying(255) | | | + has_express_line | character varying(2) | | | + order_format_type | character varying(19) | | | + is_service_company | boolean | | | + client_name | character varying(300) | | | + subassembly_mode | character varying(7) | | | + previous_code | smallint | | | + active_labels | smallint | | | + active_fractions | smallint | | | + activate_caat | smallint | | | + trans_interface | smallint | | | + american_costs | smallint | | | + scaf_readonly | smallint | | | + parts_replacement | smallint | | | + activate_facmexame | smallint | | | + part_reference | smallint | | | + international_firm | smallint | | | + ftp_key | character varying(10) | | | + sifra_path | character varying(255) | | | + version_type | character varying(20) | | | + sql_language | character varying(19) | | | + balance_operation_mode | character varying(50) | | | + inter_db_name | character varying(100) | | | + created_at | timestamp without time zone | | not null | now() + updated_at | timestamp without time zone | | not null | now() + deleted_at | timestamp without time zone | | | +Indexes: + "company_pkey" PRIMARY KEY, btree (id) + "ix_a76_company_tenant_id" btree (tenant_id) +Foreign-key constraints: + "company_tenant_id_fkey" FOREIGN KEY (tenant_id) REFERENCES core.tenants(id) +Referenced by: + TABLE "a76."CompanyVU"" CONSTRAINT "CompanyVU_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) ON DELETE CASCADE + TABLE "a76.classes" CONSTRAINT "classes_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.classification_concepts" CONSTRAINT "classification_concepts_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.clients_and_providers_address" CONSTRAINT "clients_and_providers_address_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.clients_and_providers" CONSTRAINT "clients_and_providers_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.clients_and_providers_programs" CONSTRAINT "clients_and_providers_programs_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.company_address" CONSTRAINT "company_address_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) ON DELETE CASCADE + TABLE "a76.company_certification" CONSTRAINT "company_certification_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) ON DELETE CASCADE + TABLE "a76.company_cfdi" CONSTRAINT "company_cfdi_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) ON DELETE CASCADE + TABLE "a76.company_digital_certificate" CONSTRAINT "company_digital_certificate_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) ON DELETE CASCADE + TABLE "a76.company_electronic_agent" CONSTRAINT "company_electronic_agent_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) ON DELETE CASCADE + TABLE "a76.company_prevalidator" CONSTRAINT "company_prevalidator_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) ON DELETE CASCADE + TABLE "core.company_roles" CONSTRAINT "company_roles_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.country_rule_oct" CONSTRAINT "country_rule_oct_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.ctm_receipts" CONSTRAINT "ctm_receipts_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.customs_brokers" CONSTRAINT "customs_brokers_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.customs_brokers_personnel" CONSTRAINT "customs_brokers_personnel_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.customs_brokers_vu" CONSTRAINT "customs_brokers_vu_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.depreciation_catalog" CONSTRAINT "depreciation_catalog_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.document_types_digitization" CONSTRAINT "document_types_digitization_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.doda_american_pedimentos" CONSTRAINT "doda_american_pedimentos_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.doda" CONSTRAINT "doda_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.doda_container_seals" CONSTRAINT "doda_container_seals_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.doda_containers" CONSTRAINT "doda_containers_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.doda_pedimentos" CONSTRAINT "doda_pedimentos_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.driver" CONSTRAINT "driver_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.electronic_notices" CONSTRAINT "electronic_notices_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.equivalencies" CONSTRAINT "equivalencies_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.equivalency_items" CONSTRAINT "equivalency_items_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.error_catalogs" CONSTRAINT "error_catalogs_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.error_classifications" CONSTRAINT "error_classifications_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.exchange_rate" CONSTRAINT "exchange_rate_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a24.fa_classes" CONSTRAINT "fa_classes_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a24.fa_item_lines" CONSTRAINT "fa_item_lines_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a24.fa_partes" CONSTRAINT "fa_partes_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.fda_catalog" CONSTRAINT "fda_catalog_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.fraction_rule_octave" CONSTRAINT "fraction_rule_octave_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.identifier_details" CONSTRAINT "identifier_details_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.identifiers" CONSTRAINT "identifiers_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.inpc" CONSTRAINT "inpc_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a24.inv_partes" CONSTRAINT "inv_partes_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.invoice_collections" CONSTRAINT "invoice_collections_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.invoice_compliance_mx" CONSTRAINT "invoice_compliance_mx_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.invoice_financials" CONSTRAINT "invoice_financials_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.invoice_header" CONSTRAINT "invoice_header_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.invoice_logistics" CONSTRAINT "invoice_logistics_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.invoice_sales_details" CONSTRAINT "invoice_sales_details_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.item_line_series" CONSTRAINT "item_line_series_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.item_lines" CONSTRAINT "item_lines_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.items" CONSTRAINT "items_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.legends" CONSTRAINT "legends_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.multi_currency_types" CONSTRAINT "multi_currency_types_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.packages" CONSTRAINT "packages_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.packing_lists" CONSTRAINT "packing_lists_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.parts" CONSTRAINT "parts_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.pedimento_config_additional" CONSTRAINT "pedimento_config_additional_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.pedimento_config_calculations" CONSTRAINT "pedimento_config_calculations_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.pedimento_config_parameters" CONSTRAINT "pedimento_config_parameters_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.pedimento_config_surcharges" CONSTRAINT "pedimento_config_surcharges_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.pedimento_config_update_rectification" CONSTRAINT "pedimento_config_update_rectification_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.pedimento_config_updates" CONSTRAINT "pedimento_config_updates_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.pedimento_containers" CONSTRAINT "pedimento_containers_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.pedimento_contributions" CONSTRAINT "pedimento_contributions_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.pedimento_customs_offices" CONSTRAINT "pedimento_customs_offices_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.pedimento_dates" CONSTRAINT "pedimento_dates_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.pedimento_decrementables" CONSTRAINT "pedimento_decrementables_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.pedimento_guides" CONSTRAINT "pedimento_guides_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.pedimento_incrementables" CONSTRAINT "pedimento_incrementables_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.pedimento_indexes" CONSTRAINT "pedimento_indexes_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.pedimento_packages" CONSTRAINT "pedimento_packages_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.pedimento_payments" CONSTRAINT "pedimento_payments_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.pedimento_rectification_destination" CONSTRAINT "pedimento_rectification_destination_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.pedimento_rectification_origin" CONSTRAINT "pedimento_rectification_origin_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.pedimento_seals" CONSTRAINT "pedimento_seals_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.pedimento_transport_carriers" CONSTRAINT "pedimento_transport_carriers_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.pedimento_transport_means" CONSTRAINT "pedimento_transport_means_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.pedimento_validation" CONSTRAINT "pedimento_validation_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.pedimentos" CONSTRAINT "pedimentos_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.permission_rule_oct" CONSTRAINT "permission_rule_oct_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.ports" CONSTRAINT "ports_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.prevalidators" CONSTRAINT "prevalidators_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "core.role_permissions" CONSTRAINT "role_permissions_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.seal" CONSTRAINT "seal_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.signatures" CONSTRAINT "signatures_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.subassembly_entries" CONSTRAINT "subassembly_entries_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.trailer" CONSTRAINT "trailer_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.transporter" CONSTRAINT "transporter_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.unit_conversions" CONSTRAINT "unit_conversions_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.units_of_measure" CONSTRAINT "units_of_measure_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.units_of_measure_general" CONSTRAINT "units_of_measure_general_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "core.user_company_permissions" CONSTRAINT "user_company_permissions_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "core.user_company_roles" CONSTRAINT "user_company_roles_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "core.user_tenants" CONSTRAINT "user_tenants_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) + TABLE "a76.vehicle" CONSTRAINT "vehicle_company_id_fkey" FOREIGN KEY (company_id) REFERENCES a76.company(id) +