Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Thu Mar 28, 2024 9:30 am
Predictive Dialer


All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: PNL Report and Postgresql
PostPosted: Thu Oct 28, 2010 11:11 pm 
Offline

Joined: Wed Oct 06, 2010 9:11 pm
Posts: 1
Has anyone got the PNL report (Call Reports -> PNL) to work under Postgresql? Running this report gives me a blank screen and the following error in the postgresql log file:

2010-10-29 11:48:53 NZDT ERROR: function length(bigint) does not exist at character 2521
2010-10-29 11:48:53 NZDT HINT: No function matches the given name and argument types. You might need to add explicit type casts.
for the sql segment
as tf on tf.dnid=substr(cdr.dnid,1,length(tf.dnid))

I've tried adding type casts but with no luck.

Thanks

Complete error:

2010-10-29 11:48:53 NZDT ERROR: SET AUTOCOMMIT TO OFF is no longer supported
2010-10-29 11:48:53 NZDT STATEMENT: SET autocommit = 0
2010-10-29 11:48:53 NZDT ERROR: function length(bigint) does not exist at character 2521
2010-10-29 11:48:53 NZDT HINT: No function matches the given name and argument types. You might need to add explicit type casts.
2010-10-29 11:48:53 NZDT STATEMENT: create temporary table pnl_report as
select id,name,call_count,time_minutes,tall_free_buy_cost,pay_phone_buy_cost,orig_only,credits,orig_total,
tall_free_sell_cost,pay_phone_sell_cost,term_only,charges,term_total, first_use,discount,
net_revenue,(net_revenue-orig_total) as profit, (net_revenue-orig_total)/net_revenue*100 as margin
from(
select main_id as id, name,call_count,time_minutes,tall_free_buy_cost,pay_phone_buy_cost,orig_only,credits,orig_cost+credits as orig_total,
tall_free_sell_cost,pay_phone_sell_cost,term_only,charges,term_cost+charges as term_total,
first_use,discount,
((term_cost+charges))*( 1-discount/100) as net_revenue
from(
select t1.id_group as main_id,cg.name,call_count,time_minutes,tall_free_buy_cost,pay_phone_buy_cost,
orig_cost-tall_free_buy_cost-pay_phone_buy_cost as orig_only,orig_cost,
case when credits is null then 0 else credits end as credits,0 as total,
tall_free_sell_cost,pay_phone_sell_cost,term_cost-tall_free_sell_cost-pay_phone_sell_cost as term_only,term_cost,
case when charges is null then 0 else charges end as charges,
first_use,discount

from
(
select id_group,count(*) as call_count ,sum(sessiontime) / 60 as time_minutes,
sum( case when tall_free=0 then 0 else real_sessiontime/60*tf_cost end) as tall_free_buy_cost,
sum( case when pay_phone=0 then 0 else real_sessiontime/60*tf_cost end) as pay_phone_buy_cost,
sum(buycost) as orig_cost,
sum( case when tall_free=0 then 0 else real_sessiontime/60*tf_sell_cost end) as tall_free_sell_cost,
sum( case when pay_phone=0 then 0 else real_sessiontime/60*tf_sell_cost end) as pay_phone_sell_cost,
sum(sessionbill) as term_cost,
sum(discount*sessionbill)/sum(sessionbill) as discount
from (
select cc.id_group,
cdr.sessiontime,cdr.dnid,cdr.real_sessiontime,sessionbill,buycost,cc.discount,
case when tf.cost is null then 0 else tf.cost end as tf_cost,
case when tf.sell_cost is null then 0 else tf.sell_cost end as tf_sell_cost,
case when tf.dnid_type is null then 0 when tf.dnid_type=1 then 1 else 0 end as tall_free,
case when tf.dnid_type is null then 0 when tf.dnid_type=2 then 1 else 0 end as pay_phone
from cc_call cdr left join cc_card cc on cdr.card_id=cc.id left join
(select 'dnid' as dnid, 0.1 as sell_cost,0.1 as cost,0 as dnid_type union select 8887798764,0.02,0.06 ,1
) as tf on tf.dnid=substr(cdr.dnid,1,length(tf.dnid))
where
sessiontime>0 and CURRENT_TIMESTAMP - interval '6 hours' <= cdr.starttime
order by cdr.starttime desc
) as a group by id_group
) as t1 left join cc_card_group as cg on cg.id=id_group left join pnl_report_sub1 as t2 on t1.id_group=t2.id_group
left join pnl_report_sub2 as t3 on t1.id_group=t3.id_group
left join pnl_report_sub3 as t4 on t1.id_group=t4.id_group
)as result
)as final

2010-10-29 11:48:53 NZDT ERROR: relation "pnl_report" does not exist
2010-10-29 11:48:53 NZDT STATEMENT: SELECT name,call_count,time_minutes,tall_free_buy_cost,pay_phone_buy_cost,orig_only,credits,orig_total,
tall_free_sell_cost,pay_phone_sell_cost,term_only,charges,term_total, first_use,discount,
net_revenue, margin, profit, id, id FROM pnl_report ORDER BY id ASC LIMIT 10 OFFSET 0
2010-10-29 11:48:53 NZDT ERROR: relation "pnl_report" does not exist
2010-10-29 11:48:53 NZDT STATEMENT: SELECT count(*) FROM pnl_report
2010-10-29 11:48:53 NZDT ERROR: relation "pnl_report" does not exist
2010-10-29 11:48:53 NZDT STATEMENT: select 'TOTAL',sum(call_count),sum(time_minutes),sum(tall_free_buy_cost),sum(pay_phone_buy_cost),sum(orig_only),sum(credits),sum(orig_total),sum(
tall_free_sell_cost),sum(pay_phone_sell_cost),sum(term_only),sum(charges),sum(term_total),sum(first_use),(1-sum(net_revenue)/sum(term_total))*100,sum(
net_revenue),sum(profit)/sum(net_revenue)*100,sum(profit),sum(id) from pnl_report


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 
Auto Dialer Software


All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group