Делал по
http://wiki.bgbilling.ru/index.php/Генерация_прайса_модуля_IP_телефонии_в_карточке_договора
но отображается только названия таблиц
Код:
import org.w3c.dom.*;
import bitel.billing.server.contract.bean.*;
import bitel.billing.server.util.*;
import bitel.billing.server.tariff.*;
import bitel.billing.server.tariff.voice.calc.*;
import java.sql.*;
int mid = 1;
int sid = 8;
private void addPriceItem( Element section, TariffModuleTree tree, Calendar time, int cid, String prefix, String title, Connection con )
{
item = Utils.createElement( section, "item" );
item.setAttribute( "title", title );
//
zdf = ZoneDestFinder.getZoneFinder( con, mid );
//
req = new TariffRequest();
req.setRequestParam( "time", time );
req.setRequestParam( "phone", prefix );
req.setRequestParam( "sid", sid );
req.setRequestParam( "call_type", 1 );
req.setRequestParam( "zdf", zdf );
//
tree.processRequest( req );
if( req.wasAccepted() )
{
minCost = req.getResponseParam( "min_cost" );
if( minCost != null )
{
item.setAttribute( "cost", Utils.formatCost( minCost ) );
}
}
}
public Node getVoipPrice( String cidString )
{
cid = Utils.parseIntString( cidString );
time = new GregorianCalendar();
//
ctx = getContext();
con = ctx.con;
//
doc = Utils.createDocument();
result = doc.createElement( "price" );
//
tts = new ContractManager( con ).getRealtimeTariffTreeSet( cid, time, "voiceip", mid, true );
tree = tts.getTree( time );
if( tree != null )
{
Element section = null;
//
section = Utils.createElement( result, "section" );
section.setAttribute( "title", "Территория России" );
//
addPriceItem( section, tree, time, cid, "7495", "Москва", con );
addPriceItem( section, tree, time, cid, "7347", "Уфа", con );
//
section = Utils.createElement( result, "section" );
section.setAttribute( "title", "Государства СНГ и страны Балтии" );
//
addPriceItem( section, tree, time, cid, "375", "Беларусь", con );
addPriceItem( section, tree, time, cid, "373", "Молдова", con );
}
//
Utils.serializeXML( result, System.out, "windows-1251" );
//
return result;
}
public Node getVoipPriceDiscount( String cidString, String prefixString, String titleString )
{
cid = Utils.parseIntString( cidString );
// myprefix = Utils.parseIntString( prefixString );
// mytitle = Utils.parseIntString( titleString );
time = new GregorianCalendar();
//
ctx = getContext();
con = ctx.con;
//
doc = Utils.createDocument();
result = doc.createElement( "section" );
//
tts = new ContractManager( con ).getRealtimeTariffTreeSet( cid, time, "voiceip", mid, true );
tree = tts.getTree( time );
if( tree != null )
{
Element section = null;
//
section = Utils.createElement( result, "section" );
section.setAttribute( "title", "Персональные скидки" );
//
addPriceItem( section, tree, time, cid, prefixString, titleString, con );
// addPriceItem( section, tree, time, cid, "7347", "Уфа", con );
}
//
Utils.serializeXML( result, System.out, "windows-1251" );
//
return result;
}
Код:
<?xml version="1.0" encoding="windows-1251"?><!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
<!ENTITY copy "©">
<!ENTITY reg "®">
<!ENTITY trade "™">
<!ENTITY mdash "—">
<!ENTITY ldquo "“">
<!ENTITY rdquo "”">
<!ENTITY pound "£">
<!ENTITY yen "¥">
<!ENTITY euro "€">
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:script="bitel.billing.server.util.exslt.Scripting"
version="1.0">
<xalan:component prefix="script" functions="invoke">
<xalan:script lang="javaclass" src="xalan://bitel.billing.server.util.exslt.Scripting"/>
</xalan:component>
<xsl:output encoding="windows-1251" method='xml' indent='yes' />
<xsl:template match="/">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master margin-right="1cm"
margin-left="1cm" margin-bottom="0.4cm" margin-top="0.8cm"
page-width="21cm" page-height="29.7cm" master-name="first">
<fo:region-body margin-top="0.0cm"
margin-bottom="0.0cm" />
<fo:region-before extent="0.0cm" />
<fo:region-after extent="0.0cm" />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="first">
<fo:flow flow-name="xsl-region-body">
<!-- начало таблицы с прайсом -->
<fo:table table-layout="fixed">
<fo:table-column column-width="proportional-column-width(1)"/>
<fo:table-column column-width="proportional-column-width(1)"/>
<xsl:variable name="cid" select="string(contract/@cid)"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell><fo:block>Тарифы на телефонные звонки</fo:block></fo:table-cell>
<fo:table-cell><fo:block>Руб. в минуту</fo:block></fo:table-cell>
</fo:table-row>
<xsl:for-each select="script:invoke('price','getVoipPrice', $cid)/section">
<fo:table-row>
<fo:table-cell><fo:block><xsl:value-of select="@title"/></fo:block></fo:table-cell>
<fo:table-cell><fo:block></fo:block></fo:table-cell>
</fo:table-row>
<xsl:for-each select="item">
<fo:table-row>
<fo:table-cell><fo:block><xsl:value-of select="@title"/></fo:block></fo:table-cell>
<fo:table-cell><fo:block><xsl:value-of select="@cost"/></fo:block></fo:table-cell>
</fo:table-row>
</xsl:for-each>
</xsl:for-each>
</fo:table-body>
</fo:table>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>
Код:
Клиент: вер. 5.1 сборка 487 от 11.03.2011 13:27:59
os:Windows 2003; java:Sun Microsystems Inc., v.1.6.0_24
Сервер: вер. 5.1 сборка 607 от 11.03.2011 13:27:46
os:Linux; java:Sun Microsystems Inc., v.1.6.0_22
bill вер. 5.1 сборка 227 от 10.03.2011 17:08:46
dialup вер. 5.1 сборка 174 от 14.03.2011 10:37:20
ipn вер. 5.1 сборка 223 от 14.03.2011 12:48:59
npay вер. 5.1 сборка 169 от 07.02.2011 19:19:27
phone вер. 5.1 сборка 253 от 11.03.2011 13:11:54
reports вер. 5.1 сборка 173 от 10.03.2011 17:08:39
rscm вер. 5.1 сборка 147 от 23.12.2010 15:57:03
ru.bitel.bgbilling.plugins.crm вер. 5.1 сборка 178 от 10.03.2011 19:57:45
ru.bitel.bgbilling.plugins.documents вер. 5.1 сборка 117 от 18.01.2011 13:03:56
voiceip вер. 5.1 сборка 162 от 10.03.2011 19:21:17
Подскажите что не так. Вижу разницу в версиях, но как для 5.1 сделать - хз(