bugfix
This commit is contained in:
parent
494f03ca49
commit
8b2c51e80e
@ -6,6 +6,7 @@ from ahserver.serverenv import ServerEnv
|
||||
def load_pricing():
|
||||
env = ServerEnv()
|
||||
env.write_pricing_patten = PricingProgram.write_pricing_patten
|
||||
env.pricing_program_charging = PricingProgram.charging
|
||||
env.load_pricing_data = PricingProgram.load_pricing_data
|
||||
env.get_pricing_program = pricingProgram.get_pricing_program
|
||||
env.calculate_prices = PricingProgram.pricing
|
||||
|
||||
@ -237,6 +237,29 @@ class PricingProgram:
|
||||
exception(e)
|
||||
raise Exception(e)
|
||||
|
||||
async def charging(sor, ppid, data):
|
||||
biz_date = await get_business_date(sor)
|
||||
sql = """select a.name, a.ownerid, a.providerid,
|
||||
pricing_belong, discount, b.pricing_data
|
||||
from pricing_program a, pricing_program_timing b
|
||||
where a.id = b.ppid
|
||||
and a.id = ${ppid}$
|
||||
and b.enabled_date <= ${biz_date}$
|
||||
and b.expired_date > ${biz_date}$
|
||||
order by b.enabled_date desc"""
|
||||
recs = await sor.sqlExe(sql, {
|
||||
'ppid': ppid,
|
||||
'biz_date': biz_date
|
||||
})
|
||||
if recs:
|
||||
r = recs[0]
|
||||
r.prices = PricingProgram.get_pricing_from_ymalstr(data, r.pricing_date)
|
||||
debug(f'{r.prices=}')
|
||||
amt = 0.0
|
||||
for p in r.prices:
|
||||
p.cost = p.amount * r.discount
|
||||
return r.prices
|
||||
|
||||
@staticmethod
|
||||
async def pricing(ppid, data):
|
||||
env = ServerEnv()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user