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

# Faturalar

> Hastaya kesilen e-Fatura ve e-Arşiv belgeleri.

Fatura (`Invoice`), tahsil edilen satışın resmi mali belgesidir. Türkiye'de e-Fatura / e-Arşiv olarak Nilvera veya NES entegratörü üzerinden kesilir.

## Yapı

| Alan                                       | Açıklama                                |
| ------------------------------------------ | --------------------------------------- |
| `customer_id`                              | Alıcı hasta                             |
| `currency_id`                              | Para birimi                             |
| `document_number`                          | Belge no                                |
| `document_class`                           | Belge sınıfı                            |
| `document_type`                            | Belge tipi (e-Fatura / e-Arşiv / e-SMM) |
| `profile_id`                               | UBL-TR profil                           |
| `envelope_uuid`                            | Zarf UUID (entegratör)                  |
| `report_uuid`                              | Rapor UUID (entegratör)                 |
| `issue_date`                               | Düzenlenme tarihi                       |
| `sent_at`                                  | Karşı tarafa iletildiği an              |
| `sender_tax_number`, `receiver_tax_number` | Vergi numaraları                        |
| `status`                                   | `InvoiceStatus` enum                    |
| `is_draft`, `is_cancelled`                 | Taslak / iptal                          |
| `xml_path`                                 | Üretilen UBL-TR XML yolu                |

## Kesim akışı

Fatura kesimi **manuel tetiklenir** — firma satış kaydı üzerinden "Fatura Kes" aksiyonunu çağırır. Otomatik kesim yoktur.

```mermaid theme={null}
sequenceDiagram
    participant U as Firma (panel)
    participant F as Flextell
    participant E as Entegratör<br/>(Nilvera/NES)
    participant G as GİB

    U->>F: Satış üzerinden "Fatura Kes"
    F->>F: Invoice oluştur + UBL-TR XML üret
    F->>E: Envelope gönder
    E->>G: GİB'e ilet
    G-->>E: Onay (envelope/report UUID)
    E-->>F: Onay
    F->>F: status=Sent
```

## Hasta tarafı (`InvoiceAccount`)

Fatura kesiminde alıcının (hasta veya kurum) bilgileri `InvoiceAccount` modelinde tutulur — bkz. [Hesaplar](/documentation/finance/accounts).

## İptal

Kesilen fatura `is_cancelled=true` ile işaretlenir; GİB'e iptal bildirimi de entegratör üzerinden iletilir. Bu işlem ters yönlü `CustomerTransaction` ile finansal tarafı da düzeltir.

## Sonraki adımlar

<CardGroup cols={2}>
  <Card title="Hesaplar" icon="building-columns" href="/documentation/finance/accounts">
    Alıcı ve fatura cari bilgileri.
  </Card>

  <Card title="E-Fatura kurulum" icon="plug" href="/integrations/einvoice">
    Nilvera/NES entegrasyon kurulumu.
  </Card>
</CardGroup>
