bugfix
This commit is contained in:
parent
74875afcc3
commit
438dd6042f
10
README.md
10
README.md
@ -1,3 +1,11 @@
|
||||
# pricing
|
||||
|
||||
定价模块
|
||||
定价模块
|
||||
|
||||
## 定价概念
|
||||
|
||||
* 定价类型规范了一类业务的定价标准,并用定价类型规格细化定价名细
|
||||
* 定价项定义为什么定价,定价项目时序说明某个定价的有效时间段, 定价项规定了某个定价规格的具体定价和成本
|
||||
|
||||
## 使用
|
||||
在资源中选择定价项目,
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
{
|
||||
"tblname": "pricing_program",
|
||||
"title": "定价项目",
|
||||
"tblname": "pricing_program_timing",
|
||||
"title": "定价项目时序",
|
||||
"params": {
|
||||
"sortby": "name",
|
||||
"logined_userorgid": "ownerid",
|
||||
"browserfields": {
|
||||
"exclouded": ["id", "ownerid" ],
|
||||
@ -13,7 +12,7 @@
|
||||
],
|
||||
"subtables":[
|
||||
{
|
||||
"field": "ppid",
|
||||
"field": "pptid",
|
||||
"title": "定价细项",
|
||||
"icon": "{{entire_url('/pricing/imgs/pricing_item.svg')}}",
|
||||
"subtable": "pricing_item"
|
||||
|
||||
23
json/pricing_program_timing.json
Normal file
23
json/pricing_program_timing.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"tblname": "pricing_program",
|
||||
"title": "定价项目",
|
||||
"params": {
|
||||
"sortby": "name",
|
||||
"logined_userorgid": "ownerid",
|
||||
"browserfields": {
|
||||
"exclouded": ["id", "ownerid" ],
|
||||
"alters": {}
|
||||
},
|
||||
"editexclouded": [
|
||||
"id", "ownerid"
|
||||
],
|
||||
"subtables":[
|
||||
{
|
||||
"field": "ppid",
|
||||
"title": "定价项目时序",
|
||||
"icon": "{{entire_url('/pricing/imgs/pricing_program_timing.svg')}}",
|
||||
"subtable": "pricing_program_timing"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
BIN
models/pricing_program_timing.xlsx
Normal file
BIN
models/pricing_program_timing.xlsx
Normal file
Binary file not shown.
@ -20,10 +20,26 @@ class PricingProgram:
|
||||
self.pricing_type = await self.sor.R('pricing_type',
|
||||
{'id': self.ptid})
|
||||
|
||||
async def get_items(self):
|
||||
recs = await self.sor.R('pricing_item', {'ppid': self.id})
|
||||
async def get_items(self, biz_date=None):
|
||||
if biz_date is None:
|
||||
env = ServerEnv()
|
||||
biz_date = await env.get_business_date(self.sor)
|
||||
ppts = await self.get_program_timing(biz_date)
|
||||
if lne(ppts) < 1:
|
||||
return None
|
||||
ppt = ppts[0]
|
||||
recs = await self.sor.R('pricing_item', {'pptid': ppt.id})
|
||||
return recs
|
||||
|
||||
async def get_program_timing(self, biz_date):
|
||||
sql = """select * from pricing_program_timing
|
||||
where enabled_date >= ${biz_date}$
|
||||
and expired_date < ${biz_date}$
|
||||
and ppid = ${ppid}$
|
||||
"""
|
||||
return await self.sor.sqlExe(sql, {'ppid':self.ppid,
|
||||
'biz_date': biz_date})
|
||||
|
||||
async def get_specs(self):
|
||||
recs = await self.sor.R('pricing_spec', {'ptid': self.ptid})
|
||||
return recs
|
||||
@ -57,7 +73,11 @@ async def get_remote_pricing(sor, charge, data):
|
||||
async def pricing_program_charging(sor, pricing_program_id, data):
|
||||
pp = PricingProgram(pricing_program_id, sor)
|
||||
await pp.init()
|
||||
pp_items = await pp.get_items()
|
||||
env = ServerEnv()
|
||||
if not data.get('biz_date'):
|
||||
biz_date = await env.get_business_date(self.sor)
|
||||
data['biz_date'] = biz_date
|
||||
pp_items = await pp.get_items(biz_date=data['biz_date'])
|
||||
charges = []
|
||||
for item in pp_items:
|
||||
charge = item.copy()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user