feat: 积分商城-供应商-对账-发票2
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"supplierId": "99999999",
|
||||
"settlementId": "TEST202609080001",
|
||||
"invoiceNumber": "20260908000000000001",
|
||||
"documentInvoiceCode": "TEST20260908",
|
||||
"invoiceDate": "2026-09-08",
|
||||
"invoiceType": 10,
|
||||
"invoiceTitle": "测试工会(开发测试)",
|
||||
"taxIdNumber": "TESTBUYER2026090801",
|
||||
"invoiceAddress": "湖北省武汉市测试路1号",
|
||||
"invoiceContact": "13800000000",
|
||||
"sellerName": "积分商城测试供应商",
|
||||
"sellerTaxId": "TESTSELLER20260901",
|
||||
"invoiceContent": "办公用品:笔记本、文件夹",
|
||||
"orderIds": "TEST_ORD_20260908_001,TEST_ORD_20260908_002",
|
||||
"orderNum": 2,
|
||||
"orderTotalPrice": 339,
|
||||
"invoiceNakedPrice": 300,
|
||||
"invoiceTaxPrice": 39,
|
||||
"taxRate": 0.13,
|
||||
"biller": "测试开票员",
|
||||
"remark": "测试数据:价税合计339.00元,其中不含税金额300.00元、税额39.00元。仅供开发测试,禁止报销。",
|
||||
"orderProducts": [
|
||||
{
|
||||
"orderId": "TEST_ORD_20260908_001",
|
||||
"sku": "TEST-NOTEBOOK",
|
||||
"name": "办公笔记本",
|
||||
"number": 10,
|
||||
"price": 11.3
|
||||
},
|
||||
{
|
||||
"orderId": "TEST_ORD_20260908_002",
|
||||
"sku": "TEST-FOLDER",
|
||||
"name": "办公文件夹",
|
||||
"number": 20,
|
||||
"price": 11.3
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { readFileSync } from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { generateMockInvoicePdf } from '../mock-invoice-pdf.js'
|
||||
|
||||
const directory = path.dirname(fileURLToPath(import.meta.url))
|
||||
const inputPath = path.join(directory, 'invoice-template-example.json')
|
||||
const outputPath = process.argv[2]
|
||||
? path.resolve(process.argv[2])
|
||||
: path.resolve(directory, '../output/pdf/test-invoice-template.pdf')
|
||||
|
||||
try {
|
||||
const invoice = JSON.parse(readFileSync(inputPath, 'utf8'))
|
||||
generateMockInvoicePdf(invoice, outputPath, { fontPath: process.argv[3] })
|
||||
console.log(`发票已生成:${outputPath}`)
|
||||
console.log(`测试金额:不含税 ${invoice.invoiceNakedPrice} 元,税额 ${invoice.invoiceTaxPrice} 元,价税合计 ${invoice.orderTotalPrice} 元`)
|
||||
} catch (error) {
|
||||
console.error(error instanceof Error ? error.message : String(error))
|
||||
process.exitCode = 1
|
||||
}
|
||||
Reference in New Issue
Block a user