跳转至

形式发票模板下载

模板概述

专业设计的形式发票HTML模板,专为车辆翻新出口业务优化。

模板特点

  • 🎨 专业设计:商务风格,双语显示
  • 📱 响应式布局:适配各种设备
  • 🖨️ 打印优化:完美打印输出
  • 🔧 易于定制:纯HTML/CSS,无需编程

文件下载

完整模板包

下载完整模板包 - 包含所有必要文件

单独文件下载

  1. HTML模板文件
  2. Python生成脚本
  3. 示例数据文件
  4. 示例PDF发票

模板结构

HTML文件结构

<!DOCTYPE html>
<html>
<head>
    <!-- 元数据和样式 -->
    <meta charset="UTF-8">
    <title>PROFORMA INVOICE</title>
    <style>
        /* 专业CSS样式 */
    </style>
</head>
<body>
    <!-- 1. 头部区域 -->
    <div class="header">
        公司logo + 发票标题
    </div>

    <!-- 2. 公司信息 -->
    <div class="company-info">
        卖方信息 + 买方信息
    </div>

    <!-- 3. 发票详情 -->
    <div class="invoice-details">
        发票号、日期、条款等
    </div>

    <!-- 4. 产品表格 -->
    <table class="products-table">
        产品明细
    </table>

    <!-- 5. 费用总计 -->
    <div class="total-section">
        小计、运费、保险费、总金额
    </div>

    <!-- 6. 银行信息 -->
    <div class="bank-info">
        USD和CNY账户信息
    </div>

    <!-- 7. 条款条件 -->
    <div class="terms-conditions">
        标准外贸条款
    </div>

    <!-- 8. 签名区域 -->
    <div class="signature-section">
        买卖双方签名
    </div>
</body>
</html>

模板定制指南

1. 修改公司信息

找到以下部分并更新:

<!-- 卖方信息 -->
<div class="seller-info">
    <div class="info-title">SELLER / 卖方</div>
    <strong>您的公司名称</strong><br>
    Address: 您的地址<br>
    Tel: 您的电话<br>
    Email: 您的邮箱<br>
    Website: 您的网站<br>
    Tax ID: 您的税号
</div>

替换logo占位符:

<!-- 原代码 -->
<div class="logo-placeholder">
    SAIYOUBO<br>AUTO
</div>

<!-- 修改为 -->
<img src="your_logo.png" alt="公司logo" style="width: 150px; height: auto;">

3. 修改银行信息

更新银行账户信息:

<!-- USD账户 -->
<strong>For USD Payment:</strong><br>
Bank Name: 您的银行名称<br>
Account Name: 您的账户名<br>
Account No.: 您的账户号<br>
SWIFT Code: 您的SWIFT代码

<!-- CNY账户 -->
<strong>For CNY Payment:</strong><br>
Bank Name: 您的银行名称<br>
Account Name: 您的账户名<br>
Account No.: 您的账户号<br>
SWIFT Code: 您的SWIFT代码

4. 调整颜色主题

修改CSS变量:

/* 主色调 */
:root {
    --primary-color: #2c3e50;    /* 深蓝色 */
    --accent-color: #3498db;     /* 亮蓝色 */
    --highlight-color: #e74c3c;  /* 红色 */
    --background-color: #f8f9fa; /* 浅灰色背景 */
}

/* 修改颜色 */
.header {
    border-bottom: 3px solid var(--primary-color);
}

.invoice-title h1 {
    color: var(--primary-color);
}

.grand-total {
    color: var(--highlight-color);
}

模板字段说明

必填字段

字段 说明 示例
{{buyer_name}} 买方公司名称 Global Trading Solutions Inc.
{{buyer_address}} 买方地址 789 Business Avenue
{{invoice_no}} 发票编号 PI-20260131-001
{{invoice_date}} 发票日期 2026-01-31
{{items}} 产品列表 JSON数组

自动计算字段

字段 说明 生成方式
{{subtotal}} 产品小计 自动计算
{{total_amount}} 总金额 自动计算
{{amount_in_words}} 大写金额 自动转换

可选字段

字段 说明 默认值
{{shipping_cost}} 运费 0.00
{{insurance}} 保险费 0.00
{{other_charges}} 其他费用 0.00
{{warranty_period}} 保修期 6 months or 10,000 km

使用示例

基本使用

from jinja2 import Template
import pdfkit

# 1. 加载模板
with open('proforma_invoice_template.html', 'r') as f:
    template = Template(f.read())

# 2. 准备数据
data = {
    'buyer_name': '客户公司',
    'invoice_no': 'PI-20260131-001',
    # ... 其他数据
}

# 3. 渲染HTML
html = template.render(**data)

# 4. 生成PDF
pdfkit.from_string(html, 'invoice.pdf')

批量处理

import json
import os

# 读取多个数据文件
for filename in os.listdir('invoices/'):
    if filename.endswith('.json'):
        with open(f'invoices/{filename}', 'r') as f:
            data = json.load(f)

        # 生成PDF
        generate_invoice(data, f'output/{filename.replace(".json", ".pdf")}')

样式定制

修改字体

body {
    font-family: 'Microsoft YaHei', 'Arial', sans-serif;
    font-size: 12px;
}

h1, h2, h3 {
    font-family: 'SimHei', 'Arial Black', sans-serif;
}

调整表格样式

.products-table th {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    font-weight: bold;
}

.products-table tr:nth-child(even) {
    background-color: #f2f2f2;
}

.products-table tr:hover {
    background-color: #e3f2fd;
}

添加水印

body::before {
    content: "CONFIDENTIAL";
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    font-size: 80px;
    color: rgba(0,0,0,0.1);
    z-index: -1;
    pointer-events: none;
}

最佳实践

1. 版本控制

# 保存模板版本
cp proforma_invoice_template.html proforma_invoice_template_v1.0.html
cp proforma_invoice_template.html proforma_invoice_template_v1.1.html

2. 测试打印

# 生成测试PDF
python generate_invoice.py test_data.json

# 打印测试
lp test_invoice.pdf

3. 备份模板

# 定期备份
tar -czf invoice_template_backup_$(date +%Y%m%d).tar.gz *.html *.py *.json

常见问题

Q: 中文显示乱码?

A: 确保文件使用UTF-8编码,并在HTML中添加:

<meta charset="UTF-8">

Q: 表格内容溢出?

A: 调整列宽或减少内容:

.products-table td {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

Q: PDF生成慢?

A: 优化图片大小,减少CSS复杂度。

Q: 打印格式不对?

A: 使用打印媒体查询:

@media print {
    .no-print { display: none; }
    body { font-size: 10pt; }
}

更新计划

即将添加的功能

  • [ ] 多语言支持(西班牙语、俄语等)
  • [ ] 二维码支付信息
  • [ ] 电子签名支持
  • [ ] 云存储集成
  • [ ] API接口

模板版本: v1.0
最后更新: 2026-01-31
设计者: King (AI助理)
许可证: 开源,可自由修改和使用