Skip to content

Hóa đơn GTGT

Hóa đơn GTGT là hóa đơn thuế đầy đủ được sử dụng cho các giao dịch B2B, nơi người mua cần khấu trừ thuế.

Tổng quan

Thuộc tínhGiá trị
Dịch vụVATInvoiceService
Được khấu trừ thuế
Thông tin Người muaBắt buộc
Gửi CQTBắt buộc

Các trường Bắt buộc

Thông tin Người bán

typescript
seller: {
  taxCode: '0123456789',      // Mã số thuế công ty
  name: 'Tên Công ty Của Bạn', // Tên pháp lý công ty
  address: '123 Đường phố',    // Địa chỉ đăng ký
  bankAccount: '1234567890',   // Tài khoản ngân hàng (tùy chọn)
  bankName: 'Vietcombank',     // Tên ngân hàng (tùy chọn)
}

Thông tin Người mua

typescript
buyer: {
  taxCode: '9876543210',       // Bắt buộc cho hóa đơn GTGT
  name: 'Công ty Khách hàng',
  address: '456 Đại lộ',
  email: 'buyer@company.com',  // Tùy chọn
}

Các mặt hàng Hóa đơn

typescript
items: [
  {
    itemName: 'Sản phẩm A',
    unitName: 'Cái',
    quantity: 10,
    unitPrice: 100000,
    amount: 1000000,           // quantity * unitPrice
    vatRate: 10,               // 0, 5, 8, hoặc 10
    vatAmount: 100000,         // amount * vatRate / 100
  },
]

Tạo Hóa đơn GTGT

typescript
import { inject } from '@venizia/ignis';
import { VATInvoiceService } from '@nx-3rd/iiapi';

class InvoiceController {
  constructor(
    @inject({ key: 'services.VATInvoiceService' })
    private vatService: VATInvoiceService,
  ) {}

  async createInvoice(orderData: OrderData) {
    const invoice = await this.vatService.create({
      // Người bán (công ty của bạn)
      seller: {
        taxCode: process.env.COMPANY_TAX_CODE,
        name: process.env.COMPANY_NAME,
        address: process.env.COMPANY_ADDRESS,
      },

      // Người mua (khách hàng)
      buyer: {
        taxCode: orderData.customerTaxCode,
        name: orderData.customerName,
        address: orderData.customerAddress,
      },

      // Chi tiết hóa đơn
      invoiceDate: new Date(),
      currencyCode: 'VND',
      exchangeRate: 1,

      // Các mặt hàng
      items: orderData.items.map(item => ({
        itemName: item.name,
        unitName: item.unit,
        quantity: item.quantity,
        unitPrice: item.price,
        amount: item.quantity * item.price,
        vatRate: 10,
        vatAmount: item.quantity * item.price * 0.1,
      })),

      // Tổng cộng
      totalAmount: orderData.subtotal,
      totalVatAmount: orderData.tax,
      totalPayment: orderData.total,
    });

    return invoice;
  }
}

Thuế suất VAT

Thuế suấtMô tảVí dụ
0%Xuất khẩu, quốc tếHàng hóa xuất khẩu
5%Hàng hóa thiết yếuY tế, giáo dục
8%Mức giảmMột số dịch vụ nhất định
10%Mức tiêu chuẩnHầu hết hàng hóa/dịch vụ

Vòng đời Hóa đơn

Gửi đến T-VAN

typescript
const result = await this.invoiceManagementService.submit({
  invoiceId: invoice.id,
  clientName: 'default',
});

// Kết quả chứa:
// - Số hóa đơn (tự động gán)
// - Chữ ký số
// - ID tham chiếu T-VAN

Liên quan

Proprietary and Confidential. Unauthorized copying, distribution, or use of this software is strictly prohibited.