70 lines
2.6 KiB
Python
70 lines
2.6 KiB
Python
|
DKVU2XML = {
|
||
|
"Ký hiệu mẫu hóa đơn": "form_no",
|
||
|
"Ký hiệu hóa đơn": "serial_no",
|
||
|
"Số hóa đơn": "invoice_no",
|
||
|
"Ngày, tháng, năm lập hóa đơn": "issue_date",
|
||
|
"Tên người bán": "seller_name",
|
||
|
"Mã số thuế người bán": "seller_tax_code",
|
||
|
"Thuế suất": "tax_rate",
|
||
|
"Thuế GTGT đủ điều kiện khấu trừ thuế": "VAT_input_amount",
|
||
|
"Mặt hàng": "item",
|
||
|
"Đơn vị tính": "unit",
|
||
|
"Số lượng": "quantity",
|
||
|
"Đơn giá": "unit_price",
|
||
|
"Doanh số mua chưa có thuế": "amount"
|
||
|
}
|
||
|
|
||
|
key_dict = {
|
||
|
'Ký hiệu mẫu hóa đơn': ['mausoformno', 'mauso'],
|
||
|
'Ký hiệu hóa đơn': ['kyhieuserialno', 'kyhieuserial', 'kyhieu'],
|
||
|
'Số hóa đơn': ['soinvoiceno', 'invoiceno'],
|
||
|
'Ngày, tháng, năm lập hóa đơn': [],
|
||
|
'Tên người bán': ['donvibanseller', 'donvibanhangsalesunit', 'donvibanhangseller', 'kyboisignedby'],
|
||
|
'Mã số thuế người bán': ['masothuetaxcode', 'maxsothuetaxcodenumber', 'masothue'],
|
||
|
'Thuế suất': ['thuesuatgtgttaxrate', 'thuesuatgtgt'],
|
||
|
'Thuế GTGT đủ điều kiện khấu trừ thuế': ['tienthuegtgtvatamount', 'tienthuegtgt'],
|
||
|
# 'Ghi chú': [],
|
||
|
# 'Ngày': ['ngayday', 'ngay', 'day'],
|
||
|
# 'Tháng': ['thangmonth', 'thang', 'month'],
|
||
|
# 'Năm': ['namyear', 'nam', 'year']
|
||
|
}
|
||
|
|
||
|
header_dict = {
|
||
|
'Mặt hàng': ['tenhanghoa,dichvu', 'danhmuc,dichvu', 'dichvusudung', 'tenquycachhanghoa','description', 'descriptionofgood', 'itemdescription'],
|
||
|
'Đơn vị tính': ['donvitinh', 'dvtunit'],
|
||
|
'Số lượng': ['soluong', 'quantity', 'invoicequantity', 'soluongquantity'],
|
||
|
'Đơn giá': ['dongia', 'dongiaprice'],
|
||
|
'Doanh số mua chưa có thuế': ['thanhtien', 'thanhtientruocthuegtgt', 'tienchuathue'],
|
||
|
}
|
||
|
|
||
|
extra_dict = {
|
||
|
'Số hóa đơn': ['sono', 'so'],
|
||
|
'Mã số thuế người bán': ['mst'],
|
||
|
'Tên người bán': ['kyboi'],
|
||
|
'Ngày, tháng, năm lập hóa đơn': ['kyngay', 'kyngaydate'],
|
||
|
'Mặt hàng': ['tenhanghoa','sanpham'],
|
||
|
'Số lượng': ['sl', 'qty'],
|
||
|
'Đơn vị tính': ['dvt'],
|
||
|
}
|
||
|
|
||
|
date_dict = {
|
||
|
'day': ['ngayday', 'ngaydate', 'ngay', 'day'],
|
||
|
'month': ['thangmonth', 'thang', 'month'],
|
||
|
'year': ['namyear', 'nam', 'year']
|
||
|
}
|
||
|
|
||
|
def get_dict(type: str):
|
||
|
if type == "key":
|
||
|
return key_dict
|
||
|
elif type == "header":
|
||
|
return header_dict
|
||
|
elif type == "extra":
|
||
|
return extra_dict
|
||
|
elif type == "date":
|
||
|
return date_dict
|
||
|
elif type == "kvu2xml":
|
||
|
return DKVU2XML
|
||
|
else:
|
||
|
raise ValueError(f'[ERROR] Dictionary type of {type} is not supported')
|
||
|
|