diff --git a/backend/api/v1/modules/a76/invoices/models.py b/backend/api/v1/modules/a76/invoices/models.py index a5337664..10d22c0c 100644 --- a/backend/api/v1/modules/a76/invoices/models.py +++ b/backend/api/v1/modules/a76/invoices/models.py @@ -38,7 +38,7 @@ class InvoiceHeader(Base, TenantScopedMixin, TimestampMixin): id: Mapped[int] = mapped_column(BigInteger, primary_key=True, autoincrement=True) # Identifiers - system: Mapped[Optional[str]] = mapped_column(String(10)) # SISTEMA / Sistema de origen <-- no tiene campo en la antigua base de datos, sera para fixed-asset(scaf), inventory(scaii) + system: Mapped[Optional[str]] = mapped_column(String(12)) # SISTEMA / Sistema de origen <-- no tiene campo en la antigua base de datos, sera para fixed_asset(scaf), inventory(scaii) operation_type: Mapped[OperationType] = mapped_column(String(10)) # TIPOMOVIMIENTO / Clasifica imp/exp/sm/ctm invoice_type: Mapped[Optional[str]] = mapped_column(ForeignKey("public.invoice_types.key")) # TIPOFACTURA / TIPODOC invoice_number: Mapped[Optional[str]] = mapped_column(String(20)) # FACTURAIMPO/FACTURAEXPO/FACTURAREMISION/FACTURAENVIO/FACTURASALIDA diff --git a/backend/api/v1/modules/a76/invoices/schemas.py b/backend/api/v1/modules/a76/invoices/schemas.py index 2afaec50..16c77e70 100644 --- a/backend/api/v1/modules/a76/invoices/schemas.py +++ b/backend/api/v1/modules/a76/invoices/schemas.py @@ -9,7 +9,7 @@ from .models import OperationType class InvoiceHeaderBase(BaseModel): """Base fields for Invoice Header""" system: Optional[str] = Field( - None, max_length=10, description="System of origin") + None, max_length=12, description="System of origin") operation_type: Optional[OperationType] = Field( None, max_length=10, description="Operation type: imp/exp/sm/ctm") invoice_type: Optional[str] = Field( diff --git a/backend/api/v1/modules/a76/items/models.py b/backend/api/v1/modules/a76/items/models.py index df310160..eb9c57a4 100644 --- a/backend/api/v1/modules/a76/items/models.py +++ b/backend/api/v1/modules/a76/items/models.py @@ -28,14 +28,9 @@ class Item(Base, TenantScopedMixin, TimestampMixin): } id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) - invoice_id: Mapped[int] = mapped_column(ForeignKey("a76.invoice_header.id")) # CONSECUTIVO - # Type: IMPORT_TEMP, IMPORT_DEF, EXPORT, REPAIR, etc. - item_type: Mapped[str] = mapped_column(String(20)) - system_origin: Mapped[str] = mapped_column(String(10)) # SCAF or SCAII + invoice_id: Mapped[int] = mapped_column(ForeignKey("a76.invoice_header.id")) # CONSECUTIVO # Item references - invoice_number: Mapped[Optional[str]] = mapped_column( - String(15)) # FACTURAIMPO/FACTURAEXPO reference_number: Mapped[Optional[str]] = mapped_column( String(20)) # NUMREFERENCIA order: Mapped[Optional[str]] = mapped_column( @@ -44,8 +39,6 @@ class Item(Base, TenantScopedMixin, TimestampMixin): String(50)) # NUMEROGUIA/NUMERODEGUIA # Dates - invoice_date: Mapped[Optional[int]] = mapped_column( - Integer) # FECHAFACTURA depreciation_date: Mapped[Optional[int]] = mapped_column( Integer) # FECHADEPRECIACION diff --git a/backend/api/v1/modules/a76/items/schemas.py b/backend/api/v1/modules/a76/items/schemas.py index 85fe6c2f..3503bab1 100644 --- a/backend/api/v1/modules/a76/items/schemas.py +++ b/backend/api/v1/modules/a76/items/schemas.py @@ -24,14 +24,6 @@ from .line_items.schemas import ( class ItemBase(BaseModel): """Base schema for items""" invoice_id: int = Field(..., description="Invoice ID") - item_type: str = Field(..., max_length=20, - description="Item type: IMPORT_TEMP, IMPORT_DEF, EXPORT, REPAIR") - system_origin: str = Field(..., max_length=10, - description="System origin: SCAF or SCAII") - - # Item references - invoice_number: Optional[str] = Field( - None, max_length=15, description="Invoice number") reference_number: Optional[str] = Field( None, max_length=20, description="Reference number") order: Optional[str] = Field(None, max_length=50, description="Order") @@ -39,7 +31,6 @@ class ItemBase(BaseModel): None, max_length=50, description="Guide number") # Dates - invoice_date: Optional[int] = Field(None, description="Invoice date") depreciation_date: Optional[int] = Field( None, description="Depreciation date") @@ -60,10 +51,6 @@ class ItemCreate(ItemBase): class ItemUpdate(ItemBase): """Schema for updating item""" invoice_id: Optional[int] = Field(None, description="Invoice ID") - item_type: Optional[str] = Field( - None, max_length=20, description="Item type") - system_origin: Optional[str] = Field( - None, max_length=10, description="System origin") lines: Optional[list[LineItemUpdate]] = Field( None, description="List of line items to update") diff --git a/frontend/src/lib/api/dashboard/a76/invoices.ts b/frontend/src/lib/api/dashboard/a76/invoices.ts index e245f335..7dbb1c0d 100644 --- a/frontend/src/lib/api/dashboard/a76/invoices.ts +++ b/frontend/src/lib/api/dashboard/a76/invoices.ts @@ -232,10 +232,10 @@ export interface InvoiceListResponse { } export interface CreateInvoiceData { - system?: string | null; - operation_type?: OperationType | null; - invoice_type?: string | null; - invoice_number?: string | null; + system: string; + operation_type: OperationType; + invoice_type: string; + invoice_number: string; project_number?: string | null; purchase_order?: string | null; related_doc_id?: number | null; diff --git a/frontend/src/lib/api/dashboard/a76/items.ts b/frontend/src/lib/api/dashboard/a76/items.ts index 94ea69d5..2dc3e26e 100644 --- a/frontend/src/lib/api/dashboard/a76/items.ts +++ b/frontend/src/lib/api/dashboard/a76/items.ts @@ -8,14 +8,10 @@ import { api } from '$lib/api'; export interface Item { id?: number; - invoice_id: number; - item_type: string; - system_origin: string; - invoice_number?: string; + invoice_id: number; reference_number?: string; order?: string; - guide_number?: string; - invoice_date?: number; + guide_number?: string; depreciation_date?: number; rectification?: number; warehouse?: string; @@ -33,13 +29,9 @@ export interface ItemListResponse { export interface CreateItemData { invoice_id: number; - item_type: string; - system_origin: string; - invoice_number?: string; reference_number?: string; order?: string; - guide_number?: string; - invoice_date?: number; + guide_number?: string; depreciation_date?: number; rectification?: number; warehouse?: string; @@ -47,13 +39,9 @@ export interface CreateItemData { } export interface UpdateItemData { - item_type?: string; - system_origin?: string; - invoice_number?: string; reference_number?: string; order?: string; - guide_number?: string; - invoice_date?: number; + guide_number?: string; depreciation_date?: number; rectification?: boolean; warehouse?: string; diff --git a/frontend/src/lib/components/dashboard/invoices/edit/general-tab-form.svelte b/frontend/src/lib/components/dashboard/invoices/edit/general-tab-form.svelte index 5f9e640d..508208a7 100644 --- a/frontend/src/lib/components/dashboard/invoices/edit/general-tab-form.svelte +++ b/frontend/src/lib/components/dashboard/invoices/edit/general-tab-form.svelte @@ -203,8 +203,7 @@

Clientes - Proveedores - Agente Aduanal

-
- +
{/each} - +
-
- +
-
- +
-
-
- - { - formData.customs_broker_id = v || null; - }} - > - - - {formData.customs_broker_id - ? customsBrokers.find(cb => cb.broker_key === formData.customs_broker_id)?.name || '...' - : '...'} - - - - {#each customsBrokers as broker} - - {broker.name} - - {/each} - - -
+ +
+ + { + formData.customs_broker_id = v || null; + }} + > + + + {formData.customs_broker_id + ? customsBrokers.find(cb => cb.broker_key === formData.customs_broker_id)?.name || '...' + : '...'} + + + + {#each customsBrokers as broker} + + {broker.name} + + {/each} + + +
-
- - { - formData.customs_broker_us_id = v || null; - }} - > - - - {formData.customs_broker_us_id - ? customsBrokers.find(cb => cb.broker_key === formData.customs_broker_us_id)?.name || '...' - : '...'} - - - - {#each customsBrokers as broker} - - {broker.name} - - {/each} - - -
-
+
+ + { + formData.customs_broker_us_id = v || null; + }} + > + + + {formData.customs_broker_us_id + ? customsBrokers.find(cb => cb.broker_key === formData.customs_broker_us_id)?.name || '...' + : '...'} + + + + {#each customsBrokers as broker} + + {broker.name} + + {/each} + + +
diff --git a/frontend/src/lib/components/dashboard/invoices/edit/items/fa/item-configuration.svelte b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/item-configuration.svelte new file mode 100644 index 00000000..374d4067 --- /dev/null +++ b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/item-configuration.svelte @@ -0,0 +1,72 @@ + + +
+ +
+
+ Is + +
+ + +
+
+ + +
+
+
+ +
+ Continue Sub-Items + +
+ + +
+
+ + +
+
+
+
+ + +
+
+ +
+ +
+
+ +
+ + +
+ +
+ + +
+
+
diff --git a/frontend/src/lib/components/dashboard/invoices/edit/items/fa/item-sheet-fa.svelte b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/item-sheet-fa.svelte new file mode 100644 index 00000000..ae9cdac2 --- /dev/null +++ b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/item-sheet-fa.svelte @@ -0,0 +1,124 @@ + + + + + + + + + Temporary Import Item + + + Order Number: {invoice?.invoice_number || 'N/A'} | Line: 1 + + + +
+ +
+ +
+ +
+ + + +
+ + + + + 1) General + 2) Continuation + 3) Series + 4) Labeling + 5) Identifiers + + + + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ + +
+
+
+
\ No newline at end of file diff --git a/frontend/src/lib/components/dashboard/invoices/edit/items/fa/main-data.svelte b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/main-data.svelte new file mode 100644 index 00000000..6230db8e --- /dev/null +++ b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/main-data.svelte @@ -0,0 +1,74 @@ + + +
+ Main Data + + +
+
+ +
+ +
+
+
+ + +
+
+ + +
+
+ +
+
+ - +
+
+
+
+ + +
+
+ +
+ + USD +
+
+
+ +
+ +
+
+
+ + +
+
+ +
+ +
+
+
+ + +
+
+ +
+ 0.00 +
+
+
+
diff --git a/frontend/src/lib/components/dashboard/invoices/edit/items/fa/packages-section.svelte b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/packages-section.svelte new file mode 100644 index 00000000..dfc5fd75 --- /dev/null +++ b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/packages-section.svelte @@ -0,0 +1,86 @@ + + +
+ PACKAGES + +
+
+ + +
+
+ + +
+
+
+
+ +
+
+ +
+
+ +
+
+ + +
+
WEIGHTS
+
+
+ + +
+
+ + +
+
+ + KILOS +
+
+
+ +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ + Advalorem: 0.00 +
+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+
diff --git a/frontend/src/lib/components/dashboard/invoices/edit/items/fa/summary-section.svelte b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/summary-section.svelte new file mode 100644 index 00000000..186aedfe --- /dev/null +++ b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/summary-section.svelte @@ -0,0 +1,46 @@ + + +
+
+ GENERAL DATA + +
RETURN QUANTITY SUB-ITEMS
+
+
Temporary: 0.00000000
+
Replacement or Change: 0.00000000
+
Definitive: 0.00000000
+
Returned Values: 0.00000000
+
Returned Values: 0.00000000
+
+ +
+
WEIGHTS (KILOS)
+
WEIGHTS (Pounds)
+
Net: 0.00000000
+
0.00000000
+
Whole: 0.00000000
+
0.00000000
+
+
+ + +
+ COSTS AND VALUES + +
+
(Dollars)
+
(Pesos)
+
Cost: 0.00000000
+
0.00000000
+
Value: 0.00000000
+
0.00000000
+
+ +
+
Capture Cost: 0.00000000 USD
+
Capture Value: 0.00000000 USD
+
Customs Value: 0.00000000 USD
+
+
+
diff --git a/frontend/src/lib/components/dashboard/invoices/edit/items/fa/tab-continuation.svelte b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/tab-continuation.svelte new file mode 100644 index 00000000..cd4ff233 --- /dev/null +++ b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/tab-continuation.svelte @@ -0,0 +1,133 @@ + + +
+ +
+ +
+
+ TAX PAID + +
+ + +
+
+ + +
+
+
+
+
+ +
+ +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ Has Certificate of Origin? + +
+ + +
+
+ + +
+
+
+
+ + + +
+
+ + +
+
+ +
+ +
+ +
+
+ + +
+ + +
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+ +
+
+ +
+ +
+
+
+
+ + +
+
+ + +
+
+
+ + +
+ + +
+ + +
+ + +
+
+
diff --git a/frontend/src/lib/components/dashboard/invoices/edit/items/fa/tab-identifiers.svelte b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/tab-identifiers.svelte new file mode 100644 index 00000000..63974265 --- /dev/null +++ b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/tab-identifiers.svelte @@ -0,0 +1,39 @@ + + +
+ Identifiers + +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ +
+ + +
+
diff --git a/frontend/src/lib/components/dashboard/invoices/edit/items/fa/tab-labeling.svelte b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/tab-labeling.svelte new file mode 100644 index 00000000..3dd58e63 --- /dev/null +++ b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/tab-labeling.svelte @@ -0,0 +1,28 @@ + + +
+ Labeling + +
+
+ + +
+
+ + +
+
+ +
+ + +
+
diff --git a/frontend/src/lib/components/dashboard/invoices/edit/items/fa/tab-series.svelte b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/tab-series.svelte new file mode 100644 index 00000000..d5f242f6 --- /dev/null +++ b/frontend/src/lib/components/dashboard/invoices/edit/items/fa/tab-series.svelte @@ -0,0 +1,20 @@ + + +
+ Serial Numbers + +
+ + +
+ +
+ You can enter multiple serial numbers, one per line +
+
diff --git a/frontend/src/lib/components/dashboard/invoices/edit/items/inv/item-sheet-inv.svelte b/frontend/src/lib/components/dashboard/invoices/edit/items/inv/item-sheet-inv.svelte new file mode 100644 index 00000000..4b697771 --- /dev/null +++ b/frontend/src/lib/components/dashboard/invoices/edit/items/inv/item-sheet-inv.svelte @@ -0,0 +1,274 @@ + + + + + + {isEditMode ? 'Editar Item' : 'Agregar Nuevo Item'} - SCAII (Inventario) + + {isEditMode ? 'Modifica los campos del inventario y guarda los cambios.' : 'Completa la información del nuevo item de inventario.'} + + + + + + General + Clasificación + Cantidades + Otros + + + + + +
+

Información de la Factura (SCAII - Inventario)

+ {#if !invoice?.id} +
+ ⚠️ Esta factura aún no se ha guardado. Los items se asociarán cuando guardes la factura. +
+ {:else} +
+
+ ID Factura: + {invoice.id} +
+
+ Tipo Operación: + {invoice.operation_type || 'N/A'} +
+
+ Número de Factura: + {invoice.invoice_number || 'Pendiente'} +
+
+ Sistema: + SCAII (Inventory) +
+
+ {/if} +
+ +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ + +
+ + +
+ +
+
+ + +
+
+ + +
+
+
+ + + +
+
+ + +
+ +
+
+ + +
+
+ + +
+
+ +
+ + +
+ +
+
+ + +
+
+ + +
+
+
+
+ + + +
+
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+
+
+ + + +
+
+ + +
+ +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ +
+ + +
+
+
+
+ + + + + +
+
diff --git a/frontend/src/lib/components/dashboard/invoices/edit/items-tab-form.svelte b/frontend/src/lib/components/dashboard/invoices/edit/items/items-tab-form.svelte similarity index 63% rename from frontend/src/lib/components/dashboard/invoices/edit/items-tab-form.svelte rename to frontend/src/lib/components/dashboard/invoices/edit/items/items-tab-form.svelte index 6abacb33..e30f3a3d 100644 --- a/frontend/src/lib/components/dashboard/invoices/edit/items-tab-form.svelte +++ b/frontend/src/lib/components/dashboard/invoices/edit/items/items-tab-form.svelte @@ -1,16 +1,14 @@