> ## Documentation Index
> Fetch the complete documentation index at: https://docs.filexpress.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Import landed costs (retaceos)

> Distribute freight, insurance, tariffs and other expenses among imported products and update their cost

When you import merchandise, the supplier's invoice price is not what it really costs you: freight, insurance, tariffs and customs expenses are missing. The **retaceo** (landed cost allocation) spreads those expenses among the purchased products and obtains the **real cost delivered to the warehouse** of each one (*landed cost*). Optionally, that cost is applied to inventory.

## How it works

A retaceo combines three things:

1. **Merchandise**: one or more purchases already recorded. Their lines marked as inventory are taken.
2. **Expenses**: freight, insurance, tariffs, customs expenses or others. Each expense is distributed among the merchandise lines.
3. **Result**: for each line, the prorated expense, the total cost and the unit cost delivered to the warehouse.

```
Costo total de la línea   = cantidad × costo de compra + gastos prorrateados
Costo unitario            = costo total ÷ cantidad
```

## Statuses

| Status | What it means | What you can do |
| - | - | - |
| **Draft** | Calculated and saved, with no effect on inventory. | Edit, calculate, delete or apply. |
| **Applied** | The cost of the products has already been updated. | View the detail or revert. It cannot be edited or deleted. |

> [!NOTE]
>
> To correct an applied retaceo, first **Revert**: it goes back to draft and then you can edit or delete it.

## Create a retaceo

**1. Go to Purchases → Retaceos → New retaceo**

**2. Import details**

Enter the reference (DUCA, policy, BL), the date, the proration basis and how the cost is updated:

| Option | Description |
| - | - |
| **Prorate expenses by** | Default basis for distributing expenses: **Value**, **Quantity** or **Weight**. Each expense can use a different one. |
| **Inventory cost** | **Weighted average** (blends the previous stock with the new cost) or **Last cost** (replaces the product's cost). |

**3. Select the merchandise purchases**

Search by supplier, document number or generation code. A purchase cannot be in two retaceos.

Only purchases that meet all of the following appear:

* **Processed** status,
* from the same environment of the business (production or testing),
* not voided or deleted,
* that are not credit or debit notes.

The 50 most recent that match the search are listed; those already in another retaceo are marked.

**4. Add the expenses**

Add one row per expense: **Freight**, **Insurance**, **Tariffs**, **Customs expenses** or **Other**, with its description and amount.

* Use amounts **without VAT (IVA)**: the tax credit is not part of the cost.
* Each expense can have its own **Prorate by** basis; if you leave it empty it uses the retaceo's.
* **Registered invoice (optional)** links the expense to a purchase already entered (the freight invoice, the customs agent's invoice). It is a reference to know where the amount comes from; the amount that counts is the one you type in the row.

**5. Calculate and save**

**Calculate** shows the result without saving. **Save** leaves the retaceo in draft; you can edit it again as many times as you want as long as you do not apply it.

## Proration bases

Each expense is distributed among the lines in proportion to their basis:

| Basis | The line receives more expense when... | Use it for |
| - | - | - |
| **Value** | its quantity × purchase cost is higher | insurance, ad valorem tariffs |
| **Quantity** | it has more units | per-package or handling expenses |
| **Weight** | its quantity × unit weight is higher | sea or air freight |

To prorate by **weight**, enter the **Unit weight** of each line in the results table. If any expense uses weight and the lines have no weight, the system does not calculate and tells you. The same happens with value or quantity when all lines add up to zero.

> [!TIP]
>
> You can mix bases in the same retaceo: for example, freight by **weight**, insurance by **value** and tariff by **value**.

### Rounding

Each part is rounded to 4 decimals. The cent left over or missing due to rounding is assigned to the line with the highest basis, so that **the sum of what is prorated is always exactly the expense amount**.

## Example

Two imported products, with these expenses:

| Product | Quantity | Purchase cost | Total | Unit weight |
| - | - | - | - | - |
| A | 100 | \$10.00 | \$1,000.00 | 2 |
| B | 50 | \$20.00 | \$1,000.00 | 8 |

| Expense | Amount | Proration |
| - | - | - |
| Freight | \$200.00 | Value |
| Tariffs | \$150.00 | Quantity |
| Insurance | \$100.00 | Weight |

Distribution of each expense:

| Expense | Product A | Product B |
| - | - | - |
| Freight (by value, 50% / 50%) | \$100.00 | \$100.00 |
| Tariffs (by quantity, 100 / 50) | \$100.00 | \$50.00 |
| Insurance (by weight, 200 / 400) | \$33.33 | \$66.67 |
| **Prorated expenses** | **\$233.33** | **\$216.67** |

Result:

| | Product A | Product B |
| - | - | - |
| Total cost | \$1,233.33 | \$1,216.67 |
| **Unit cost** | **\$12.3333** | **\$24.3333** |

The cost of A goes from $10.00 to $12.33 per unit and that of B from $20.00 to $24.33.

## Apply to inventory

**Apply to inventory** updates the cost of each product and changes the retaceo to **Applied**. Products are located by **SKU** within the retaceo's branch. For each one, the previous and the new cost are saved.

| Method | New product cost |
| - | - |
| **Last cost** | The retaceo's unit cost delivered to the warehouse. |
| **Weighted average** | `(existencia previa × costo actual + cantidad del retaceo × costo unitario nuevo) ÷ (existencia previa + cantidad del retaceo)` |

In the weighted average, the **previous stock** is the current stock minus this retaceo's quantity, because the current stock already includes the purchase. Following the example, if product A had 40 units at \$11.00 before the purchase:

```
(40 × 11.00 + 100 × 12.3333) ÷ 140 = $11.9524
```

If the product had no previous stock or its cost was zero, it takes the retaceo's unit cost directly.

> [!WARNING]
>
> Apply the retaceo shortly after receiving the merchandise. If you have already sold part of the stock, the previous stock used by the average is lower and the new cost weighs more.

### Products without an inventory record

If a line does not match any product in the branch by SKU, the system warns you when calculating and saving with the list of those products. Those lines are **not modified** when applying. Create the product with the same SKU and calculate again.

## Revert

**Revert** gives each product back the cost it had before applying and returns the retaceo to draft.

Only products whose cost **is still the one the retaceo left** are reverted. If the cost changed afterwards (another retaceo, manual adjustment, new purchase), it is kept and the reversal notice lists it.

## Delete

Only a retaceo in **draft** can be deleted. When it is deleted, the purchases are free to enter another one.

## What it does not do

> [!WARNING]
>
> **The retaceo does not load values into the Purchase Book.** The book is built only from registered purchases (their totals, taxable, exempt and VAT); the retaceo does not create or modify any purchase, so the book's amounts do not change when you calculate, apply or revert a retaceo.

It also does not:

* **Generate accounting entries** for inventory adjustment.
* **Modify the original purchases**, their totals or their VAT.
* **Record the import expenses.** The freight or customs agent invoice is recorded like any purchase in Expenses and that purchase is the one that appears in the book. In the retaceo only its amount is used to distribute it.

The only thing that changes when applying is the **product cost**. That cost is used by the **profit and margin** reports (cost of goods sold) and by inventory valuation, so those numbers are affected on sales calculated from that moment on, not the purchase book.

## Frequently asked questions

> [accordion] I can't find the merchandise purchase
>
> Check that it is in **Processed** status, that it belongs to the right environment, that it is not voided and that it is not a credit or debit note. If it is already in another retaceo it appears marked.

> [accordion] The calculation says it can't prorate by weight
>
> That expense (or the whole retaceo) uses the **Weight** basis and the lines have no **Unit weight**. Enter each product's weight or change the basis.

> [accordion] My purchase has products that are not inventory
>
> Only lines marked as inventory and with a quantity greater than zero are included. The others do not receive expenses.

> [accordion] I made a mistake in an applied retaceo
>
> Revert it, fix it in draft and apply it again. If any product's cost changed in the meantime, it will not be overwritten: review the notice.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.