diff --git a/src/modules/fixed-assets/components/assets/FixedAssetUsefulLifeSection.vue b/src/modules/fixed-assets/components/assets/FixedAssetUsefulLifeSection.vue
new file mode 100644
index 0000000..3424a3c
--- /dev/null
+++ b/src/modules/fixed-assets/components/assets/FixedAssetUsefulLifeSection.vue
@@ -0,0 +1,106 @@
+
+
+
+
+
+
+
+ Vida Útil
+
+
+
+
+
+
+
+
+ {{ selectedCatalog.min_years }}–{{ selectedCatalog.max_years }} años
+
+ — {{ selectedCatalog.practical_comment }}
+
+
+
+
+
+
+
+
+
+ Calculado automáticamente desde el catálogo. Puedes ajustarlo.
+
+
+
+
+
+
diff --git a/src/modules/fixed-assets/services/fixedAssetsService.ts b/src/modules/fixed-assets/services/fixedAssetsService.ts
index fa1c3e5..50718e3 100644
--- a/src/modules/fixed-assets/services/fixedAssetsService.ts
+++ b/src/modules/fixed-assets/services/fixedAssetsService.ts
@@ -1,4 +1,5 @@
import api from '../../../services/api';
+import type { UsefulLifeCatalogOption, FiscalDepreciationRateOption, UsefulLifeCalculationResult } from '../types/fixedAsset';
export interface Asset {
id: number;
@@ -12,6 +13,10 @@ export interface Asset {
book_value: string;
warranty_days: number | null;
warranty_end_date: string | null;
+ fiscal_depreciation_rate_id: number | null;
+ useful_life_catalog_id: number | null;
+ fiscal_depreciation_rate: { id: number; name: string; depreciation_rate: string } | null;
+ useful_life_catalog: { id: number; name: string; min_years: number; max_years: number } | null;
inventory_warehouse: {
id: number;
product: {
@@ -207,6 +212,21 @@ class FixedAssetsService {
}));
}
+ async getUsefulLifeCatalog(): Promise
{
+ const response = await api.get('/api/catalogs/useful-life-catalog', { params: { paginate: false } });
+ return response.data.data.data;
+ }
+
+ async getFiscalDepreciationRates(): Promise {
+ const response = await api.get('/api/catalogs/fiscal-depreciation-rates', { params: { paginate: false } });
+ return response.data.data.data;
+ }
+
+ async calculateUsefulLife(params: { useful_life_catalog_id?: number }): Promise {
+ const response = await api.get('/api/assets/options/calculate-useful-life', { params });
+ return response.data.data;
+ }
+
async downloadResguardo(assetId: number, assignmentId: number): Promise {
const response = await api.get(
`/api/assets/${assetId}/assignments/${assignmentId}/resguardo`,
diff --git a/src/modules/fixed-assets/types/fixedAsset.ts b/src/modules/fixed-assets/types/fixedAsset.ts
index 38268ba..f2cb698 100644
--- a/src/modules/fixed-assets/types/fixedAsset.ts
+++ b/src/modules/fixed-assets/types/fixedAsset.ts
@@ -1,5 +1,7 @@
export interface FixedAssetFormData {
inventory_warehouse_id: number | null;
+ useful_life_catalog_id: number | null;
+ fiscal_depreciation_rate_id: number | null;
estimated_useful_life: number | null;
depreciation_method: string;
residual_value: number | null;
@@ -8,6 +10,27 @@ export interface FixedAssetFormData {
warranty_end_date: string;
}
+export interface UsefulLifeCatalogOption {
+ id: number;
+ name: string;
+ min_years: number;
+ max_years: number;
+ practical_comment: string | null;
+ is_active: boolean;
+}
+
+export interface FiscalDepreciationRateOption {
+ id: number;
+ name: string;
+ depreciation_rate: string;
+ is_active: boolean;
+}
+
+export interface UsefulLifeCalculationResult {
+ from_useful_life_catalog?: { months: number; label: string };
+ from_fiscal_rate?: { months: number; label: string };
+}
+
export interface InventoryWarehouseOption {
id: number;
serial_number: string | null;