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.

209 lines
12 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

from django.db import models
from ERP_5.utils.base_model import BaseModel
# 货币种类
currency_choices = (
('CNY', '人民币'),
('USD', '美元'),
('EUR', '欧元'),
('JPY', '日元'),
('HKD', '港币')
)
# 付款类型
pay_choices = (
('1', '采购定金'),
('2', '采购货款'),
('3', '欠款还款'),
('4', '其他付款')
)
# 付款单的模型类
class PaymentModel(BaseModel):
pay_date = models.DateTimeField('付款日期')
number_code = models.CharField('单据编号,不让用户填写', max_length=28)
discount_money = models.DecimalField('优惠金额(付款优惠),最多精确到小数点后两位', max_digits=10, default=0, decimal_places=2,
blank=True, null=True)
pay_money = models.DecimalField('合计 付款金额最多精确到小数点后两位', max_digits=10, decimal_places=2, default=0)
this_money = models.DecimalField('实际 付款金额最多精确到小数点后两位', max_digits=10, decimal_places=2, default=0)
remark = models.CharField('备注', max_length=512, blank=True, null=True)
currency = models.CharField('货币种类', max_length=20, null=True, choices=currency_choices, default='CNY')
pay_category = models.CharField('付款类型', max_length=2, null=True, choices=pay_choices, default='1')
status = models.CharField('状态,0:未审核,1:已审核', max_length=1, default='0')
account = models.ForeignKey('basic_info.SettlementAccountModel', null=True, blank=True, on_delete=models.SET_NULL,
verbose_name='结算账户,审核之后不能改')
operator_user = models.ForeignKey('erp_system.UserModel', related_name='operator14_pay_list', null=True,
blank=True, on_delete=models.SET_NULL,
verbose_name='财务操作人员,不能修改')
# 增加一个冗余字段
operator_user_name = models.CharField('财务人员的真实姓名', max_length=20, null=True, blank=True)
check_user = models.ForeignKey('erp_system.UserModel', related_name='check13_pay_list', null=True, blank=True, on_delete=models.SET_NULL,
verbose_name='审核人员,不能修改')
# 增加一个冗余字段
check_user_name = models.CharField('审核人员的真实姓名', max_length=20, null=True, blank=True)
supplier = models.ForeignKey('basic_info.SupplierModel', null=True, blank=True, on_delete=models.SET_NULL,
verbose_name='供应商,审核之后不能改')
# 增加一个冗余字段
supplier_name = models.CharField('供应商名称', max_length=30, null=True, blank=True)
purchase = models.ForeignKey('purchase_info.PurchaseModel', null=True, blank=True, on_delete=models.SET_NULL,
verbose_name='采购订单,审核之后不能改')
attachment_list = models.CharField('附件的id列表字段的值为: 1,2,3,4', max_length=20, null=True, blank=True)
class Meta:
db_table = 't_payment'
verbose_name = '付款单表'
verbose_name_plural = verbose_name
ordering = ['id']
# 付款单中 付款项目的模型类
class PaymentItemModel(BaseModel):
# 冗余字段
storage_code = models.CharField('采购入库单编号,不让用户填写', max_length=28)
purchase_storage = models.ForeignKey('warehouse_info.PurchaseStorageModel', related_name='pay_item_list', null=True, blank=True,
on_delete=models.SET_NULL, verbose_name='采购入库单')
payment = models.ForeignKey('PaymentModel', null=True, blank=True, related_name='item_list', on_delete=models.SET_NULL,
verbose_name='付款单,不能改')
should_money = models.DecimalField('应该 付款金额(就是采购入库单中需要支付的金额),最多精确到小数点后两位', max_digits=10, decimal_places=2, default=0)
this_money = models.DecimalField('本次 付款金额,最多精确到小数点后两位', max_digits=10, decimal_places=2, default=0)
remark = models.CharField('备注', max_length=512, blank=True, null=True)
class Meta:
db_table = 't_payment_item'
verbose_name = '付款单中的 付款项目表'
verbose_name_plural = verbose_name
ordering = ['id']
# 收款类型
receipt_choices = (
('1', '销售定金'),
('2', '销售出库货款'),
('3', '客户还款的收款'),
('4', '其他收款')
)
# 收款单的模型类
class ReceiptModel(BaseModel):
pay_date = models.DateTimeField('收款日期')
number_code = models.CharField('单据编号,不让用户填写', max_length=28)
discount_money = models.DecimalField('优惠金额(收款优惠),最多精确到小数点后两位', max_digits=10, default=0, decimal_places=2,
blank=True, null=True)
receipt_money = models.DecimalField('合计 收款金额最多精确到小数点后两位', max_digits=10, decimal_places=2, default=0)
this_money = models.DecimalField('实际 收款金额最多精确到小数点后两位', max_digits=10, decimal_places=2, default=0)
remark = models.CharField('备注', max_length=512, blank=True, null=True)
currency = models.CharField('货币种类', max_length=20, null=True, choices=currency_choices, default='CNY')
receipt_category = models.CharField('收款类型', max_length=2, null=True, choices=receipt_choices, default='1')
status = models.CharField('状态,0:未审核,1:已审核', max_length=1, default='0')
account = models.ForeignKey('basic_info.SettlementAccountModel', null=True, blank=True, on_delete=models.SET_NULL,
verbose_name='结算账户,审核之后不能改')
operator_user = models.ForeignKey('erp_system.UserModel', related_name='operator12_pay_list', null=True,
blank=True, on_delete=models.SET_NULL,
verbose_name='财务操作人员,不能修改')
# 增加一个冗余字段
operator_user_name = models.CharField('财务人员的真实姓名', max_length=20, null=True, blank=True)
check_user = models.ForeignKey('erp_system.UserModel', related_name='operator11_pay_list', null=True, blank=True, on_delete=models.SET_NULL,
verbose_name='审核人员,不能修改')
# 增加一个冗余字段
check_user_name = models.CharField('审核人员的真实姓名', max_length=20, null=True, blank=True)
customer = models.ForeignKey('basic_info.CustomerModel', null=True, blank=True, on_delete=models.SET_NULL,
verbose_name='客户,审核之后不能改')
# 增加一个冗余字段
customer_name = models.CharField('客户名称', max_length=30, null=True, blank=True)
sale = models.ForeignKey('sale_info.SaleModel', null=True, blank=True, on_delete=models.SET_NULL,
verbose_name='销售订单,审核之后不能改')
attachment_list = models.CharField('附件的id列表字段的值为: 1,2,3,4', max_length=20, null=True, blank=True)
class Meta:
db_table = 't_receipt'
verbose_name = '收款单表'
verbose_name_plural = verbose_name
ordering = ['id']
# 收款单中 收款项目的模型类
class ReceiptItemModel(BaseModel):
# 冗余字段
storage_code = models.CharField('销售出库单编号,不让用户填写', max_length=28)
deliver_storage = models.ForeignKey('warehouse_info.SaleDeliverModel', related_name='pay_item_list', null=True, blank=True,
on_delete=models.SET_NULL, verbose_name='采购入库单')
receipt = models.ForeignKey('ReceiptModel', null=True, blank=True, related_name='item_list', on_delete=models.SET_NULL,
verbose_name='收款单,不能改')
should_money = models.DecimalField('应该 收款金额(就是采购入库单中需要支收的金额),最多精确到小数点后两位', max_digits=10, decimal_places=2, default=0)
this_money = models.DecimalField('本次 收款金额,最多精确到小数点后两位', max_digits=10, decimal_places=2, default=0)
remark = models.CharField('备注', max_length=512, blank=True, null=True)
class Meta:
db_table = 't_receipt_item'
verbose_name = '收款单中的 收款项目表'
verbose_name_plural = verbose_name
ordering = ['id']
# 收款单的模型类
# class ReceiptModel(BaseModel):
# pay_date = models.DateTimeField('收款日期')
# number_code = models.CharField('单据编号,不让用户填写', max_length=28)
# discount_money = models.DecimalField('优惠金额(收款优惠),最多精确到小数点后两位', max_digits=10, default=0, decimal_places=2,
# blank=True, null=True)
# receipt_money = models.DecimalField('合计 收款金额最多精确到小数点后两位', max_digits=10, decimal_places=2, default=0)
# this_money = models.DecimalField('实际 收款金额最多精确到小数点后两位', max_digits=10, decimal_places=2, default=0)
# remark = models.CharField('备注', max_length=512, blank=True, null=True)
# currency = models.CharField('货币种类', max_length=20, null=True, choices=currency_choices, default='CNY')
# pay_category = models.CharField('收款类型', max_length=2, null=True, choices=pay_choices, default='1')
# status = models.CharField('状态,0:未审核,1:已审核', max_length=1, default='0')
#
# account = models.ForeignKey('basic_info.SettlementAccountModel', null=True, blank=True, on_delete=models.SET_NULL,
# verbose_name='结算账户,审核之后不能改')
# operator_user = models.ForeignKey('erp_system.UserModel', related_name='operator_pay_list', null=True,
# blank=True, on_delete=models.SET_NULL,
# verbose_name='财务操作人员,不能修改')
# # 增加一个冗余字段
# operator_user_name = models.CharField('财务人员的真实姓名', max_length=20, null=True, blank=True)
# check_user = models.ForeignKey('erp_system.UserModel', related_name='operator3_pay_list', null=True, blank=True, on_delete=models.SET_NULL,
# verbose_name='审核人员,不能修改')
# # 增加一个冗余字段
# check_user_name = models.CharField('审核人员的真实姓名', max_length=20, null=True, blank=True)
#
# customer = models.ForeignKey('basic_info.CustomerModel', null=True, blank=True, on_delete=models.SET_NULL,
# verbose_name='客户,审核之后不能改')
# # 增加一个冗余字段
# customer_name = models.CharField('客户名称', max_length=30, null=True, blank=True)
# sale = models.ForeignKey('purchase_info.SaleModel', null=True, blank=True, on_delete=models.SET_NULL,
# verbose_name='销售订单,审核之后不能改')
# attachment_list = models.CharField('附件的id列表字段的值为: 1,2,3,4', max_length=20, null=True, blank=True)
#
# class Meta:
# db_table = 't_receipt'
# verbose_name = '收款单表'
# verbose_name_plural = verbose_name
# ordering = ['id']
#
#
# # 收款单中 收款项目的模型类
# class ReceiptItemModel(BaseModel):
# # 冗余字段
# storage_code = models.CharField('销售出库单编号,不让用户填写', max_length=28)
# deliver_storage = models.ForeignKey('warehouse_info.SaleDeliverModel', related_name='pay_item_list', null=True, blank=True,
# on_delete=models.SET_NULL, verbose_name='采购入库单')
#
# receipt = models.ForeignKey('ReceiptModel', null=True, blank=True, related_name='item_list', on_delete=models.SET_NULL,
# verbose_name='收款单,不能改')
# should_money = models.DecimalField('应该 收款金额(就是采购入库单中需要支收的金额),最多精确到小数点后两位', max_digits=10, decimal_places=2, default=0)
# this_money = models.DecimalField('本次 收款金额,最多精确到小数点后两位', max_digits=10, decimal_places=2, default=0)
#
# remark = models.CharField('备注', max_length=512, blank=True, null=True)
#
# class Meta:
# db_table = 't_receipt_item'
# verbose_name = '收款单中的 收款项目表'
# verbose_name_plural = verbose_name
# ordering = ['id']