You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
2.5 KiB
40 lines
2.5 KiB
/**
|
|
* 文件作用:保存已确认入库的有效报销发票台账。
|
|
* 职责范围:提供唯一判重依据、台账查询和月度统计数据。
|
|
* 不负责:保存被拦截的重复上传单据。
|
|
*/
|
|
'use strict';
|
|
|
|
module.exports = dc => {
|
|
const DataTypes = dc.ORM;
|
|
const FinanceInvoice = dc.orm.define('FinanceInvoice', {
|
|
id: { type: DataTypes.BIGINT, primaryKey: true, autoIncrement: true },
|
|
invoiceCode: { type: DataTypes.STRING(50), field: 'invoice_code' },
|
|
invoiceNumber: { type: DataTypes.STRING(50), allowNull: false, field: 'invoice_number' },
|
|
invoiceType: { type: DataTypes.STRING(50), field: 'invoice_type' },
|
|
invoiceDate: { type: DataTypes.DATEONLY, field: 'invoice_date' },
|
|
buyerName: { type: DataTypes.STRING(255), field: 'buyer_name' },
|
|
sellerName: { type: DataTypes.STRING(255), field: 'seller_name' },
|
|
commodityName: { type: DataTypes.TEXT, field: 'commodity_name' },
|
|
taxExclusiveAmount: { type: DataTypes.DECIMAL(18, 2), field: 'tax_exclusive_amount' },
|
|
taxAmount: { type: DataTypes.DECIMAL(18, 2), field: 'tax_amount' },
|
|
totalAmount: { type: DataTypes.DECIMAL(18, 2), allowNull: false, field: 'total_amount' },
|
|
sourceUploadItemId: { type: DataTypes.BIGINT, allowNull: false, unique: true, field: 'source_upload_item_id' },
|
|
reimbursementUserId: { type: DataTypes.BIGINT, field: 'reimbursement_user_id' },
|
|
reimbursementUserName: { type: DataTypes.STRING(100), field: 'reimbursement_user_name' },
|
|
reimbursementDepartmentId: { type: DataTypes.BIGINT, field: 'reimbursement_department_id' },
|
|
reimbursementDepartmentName: { type: DataTypes.STRING(100), field: 'reimbursement_department_name' },
|
|
storageDate: { type: DataTypes.DATEONLY, allowNull: false, field: 'storage_date' },
|
|
status: { type: DataTypes.STRING(20), allowNull: false, defaultValue: 'active' },
|
|
createdBy: { type: DataTypes.BIGINT, allowNull: false, field: 'created_by' },
|
|
createdAt: { type: DataTypes.DATE, allowNull: false, defaultValue: dc.orm.literal('CURRENT_TIMESTAMP'), field: 'created_at' },
|
|
updatedAt: { type: DataTypes.DATE, allowNull: false, defaultValue: dc.orm.literal('CURRENT_TIMESTAMP'), field: 'updated_at' },
|
|
}, {
|
|
tableName: 'finance_invoice',
|
|
timestamps: false,
|
|
indexes: [{ unique: true, fields: ['invoice_number'] }],
|
|
comment: '财务有效发票台账',
|
|
});
|
|
dc.models.FinanceInvoice = FinanceInvoice;
|
|
return FinanceInvoice;
|
|
};
|
|
|