--- /dev/null
+
+import report
+import wizard
--- /dev/null
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+{
+ "name" : "Accounting Reports",
+ "version" : "1.0",
+ "depends" : [
+ "account",
+ "account_voucher"
+ ],
+ "author" : "Tiny ERP",
+ "description": """Accounting Reports
+Modules gives the 2 most Important Reports for the Accounting
+* Profit and Loss Account
+* Balance Sheet
+ """,
+ "website" : "http://tinyerp.com/module_account.html",
+ "category" : "Generic Modules/Accounting",
+ "init_xml" : [
+ ],
+ "demo_xml" : [
+
+ ],
+ "update_xml" : [
+ "wizard/account_pl_report_view.xml",
+ "wizard/account_bs_report_view.xml"
+ ],
+ "active": False,
+ "installable": True
+}
--- /dev/null
+
+import report_bs
+import report_pl
--- /dev/null
+<?xml version="1.0"?>
+<document filename="test.pdf">
+ <template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
+ <pageTemplate id="first">
+ <frame id="first" x1="28.0" y1="28.0" width="539" height="786"/>
+ </pageTemplate>
+ </template>
+ <stylesheet>
+ <blockTableStyle id="Standard_Outline">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Heading">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Company_Name">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Date_from_To">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Account_Line_Title">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,0" stop="0,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,0" stop="2,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEAFTER" colorName="#cccccc" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,0" stop="3,-1"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table5">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Net_Profit_Loss">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEAFTER" colorName="#cccccc" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table1">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,0" stop="0,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,0" stop="2,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEAFTER" colorName="#cccccc" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,0" stop="3,-1"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table2">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table3">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEAFTER" colorName="#cccccc" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
+ </blockTableStyle>
+ <initialize>
+ <paraStyle name="all" alignment="justify"/>
+ </initialize>
+ <paraStyle name="P1" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="P2" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="Standard" fontName="Times-Roman"/>
+ <paraStyle name="Heading" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="Caption" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="Index" fontName="Helvetica" fontSize="9.0" leading="11"/>
+ <paraStyle name="Footer" fontName="Times-Roman"/>
+ <paraStyle name="Table Contents" fontName="Times-Roman"/>
+ <paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
+ <paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
+ <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Right_9_Bold" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_2" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ </stylesheet>
+ <images/>
+ <story>
+ <para style="Standard">
+ <font color="white"> </font>
+ </para>
+ <blockTable colWidths="539.0" style="Table_Heading">
+ <tr>
+ <td>
+ <para style="terp_header_Centre">[[ get_company(data['form']) ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <blockTable colWidths="539.0" style="Table_Company_Name">
+ <tr>
+ <td>
+ <para style="terp_header_Centre">Balance Sheet</para>
+ </td>
+ </tr>
+ </blockTable>
+ <blockTable colWidths="539.0" style="Table_Date_from_To">
+ <tr>
+ <td>
+ <para style="terp_header_Centre">From : [[ formatLang(data['form']['date_from'],date=True) ]] To: [[ formatLang(data['form']['date_to'], date=True) ]]</para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="terp_default_8">[[ get_data(data['form']) ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <blockTable colWidths="100.0,326.0,113.0" style="Table_Account_Line_Title" repeatRows="1">
+ <tr>
+ <td>
+ <para style="terp_default_Bold_9">Code</para>
+ </td>
+ <td>
+ <para style="terp_default_Bold_9">Liabilities</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details_Right">Total Amount([[ get_currency(data['form']) ]])</para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="terp_default_9"><font face="Times-Roman">[[ repeatIn(get_lines_another('liability'), 'a') ]]</font>[[ a['code'] ]]<font>[[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]]</font></para>
+ </td>
+ <td>
+ <para style="terp_default_9"><font color="white">[[ '. '*(a['level']-1) ]]</font><font>[[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]][[ a['name'] ]]</font></para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9_Bold">[[ formatLang(abs(a['balance'])) ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <blockTable colWidths="426.0,113.0" style="Table_Net_Profit_Loss">
+ <tr>
+ <td>
+ <para style="terp_default_Bold_9">Balance:([[ get_currency(data['form']) ]])</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9_Bold"><u>[[ formatLang(sum_dr()) ]]</u></para>
+ </td>
+ </tr>
+ </blockTable>
+ <condPageBreak height="20cm"/>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ <blockTable colWidths="100.0,326.0,113.0" style="Table1" repeatRows="1">
+ <tr>
+ <td>
+ <para style="terp_default_Bold_9">Code</para>
+ </td>
+ <td>
+ <para style="terp_default_Bold_9">Assets</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details_Right">Total Amount([[ get_currency(data['form']) ]])</para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="terp_default_9"><font face="Times-Roman">[[ repeatIn(get_lines_another('asset'), 'a') ]]</font>[[ a['code'] ]]<font>[[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]]</font></para>
+ </td>
+ <td>
+ <para style="terp_default_9">[[ a['code'] ]]<font>[[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]][[ a['name'] ]]</font></para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9_Bold">[[ formatLang(abs(a['balance'])) ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <blockTable colWidths="426.0,113.0" style="Table3">
+ <tr>
+ <td>
+ <para style="terp_default_Bold_9">Balance:([[ get_currency(data['form']) ]])</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9_Bold"><u>[[ formatLang(sum_cr()) ]]</u></para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="Standard">
+ <font color="white"> </font>
+ </para>
+ </story>
+</document>
--- /dev/null
+<?xml version="1.0"?>
+<document filename="test.pdf">
+ <template pageSize="(1120.0,770.0)" title="Test" author="Martin Simon" allowSplitting="20" >
+ <pageTemplate id="first">
+ <frame id="first" x1="22.0" y1="15.0" width="1080" height="680"/>
+ <pageGraphics>
+ <setFont name="Helvetica-Bold" size="9"/>
+ <!--COL 1-->
+ <drawString x="1.3cm" y="25.50cm">[[ get_company(data['form']) ]]</drawString>
+ <!--COL 2-->
+ <setFont name="Helvetica" size="9"/>
+ <drawString x="1.3cm" y="0.50cm"> [[ formatLang(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),date_time = True) ]]</drawString>
+ <drawString x="37.20cm" y="0.50cm">Page <pageNumber/></drawString>
+
+ <lineMode width="0.7"/>
+ <lines>1.3cm 24.9cm 38.3cm 24.9cm</lines>
+ <setFont name="Helvetica" size="8"/>
+ </pageGraphics>
+ </pageTemplate>
+ </template>
+ <stylesheet>
+ <blockTableStyle id="Standard_Outline">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Heading">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Company_Name">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Date_from_To">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Account_Line_Title">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,0" stop="0,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,0" stop="2,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="4,0" stop="4,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="4,0" stop="4,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,0" stop="4,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="5,0" stop="5,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="5,0" stop="5,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="5,0" stop="5,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="6,0" stop="6,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="6,0" stop="6,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="6,0" stop="6,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="7,0" stop="7,-1"/>
+ <lineStyle kind="LINEAFTER" colorName="#cccccc" start="7,0" stop="7,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="7,0" stop="7,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="7,0" stop="7,-1"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Main_Content">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Liability_side">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Asset_Side_Content">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Net_Profit_Loss">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="4,0" stop="4,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="4,0" stop="4,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="5,0" stop="5,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="5,0" stop="5,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="5,-1" stop="5,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="6,0" stop="6,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="6,0" stop="6,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="6,-1" stop="6,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="7,0" stop="7,-1"/>
+ <lineStyle kind="LINEAFTER" colorName="#cccccc" start="7,0" stop="7,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="7,0" stop="7,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="7,-1" stop="7,-1"/>
+ </blockTableStyle>
+ <initialize>
+ <paraStyle name="all" alignment="justify"/>
+ </initialize>
+ <paraStyle name="P1" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="P2" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="P3" rightIndent="0.0" leftIndent="1.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="P4" rightIndent="121.0" leftIndent="-1.0" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="Standard" fontName="Times-Roman"/>
+ <paraStyle name="Heading" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="Caption" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="Index" fontName="Helvetica" fontSize="9.0" leading="11"/>
+ <paraStyle name="Footer" fontName="Times-Roman"/>
+ <paraStyle name="Table Contents" fontName="Times-Roman"/>
+ <paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
+ <paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
+ <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Right_9_Bold" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_2" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ </stylesheet>
+ <images/>
+ <story>
+ <para style="Standard">
+ <font color="white"> </font>
+ </para>
+ <blockTable colWidths="1049.0" style="Table_Company_Name">
+ <tr>
+ <td>
+ <para style="terp_header_Centre">Balance Sheet </para>
+ </td>
+ </tr>
+ </blockTable>
+ <blockTable colWidths="1049.0" style="Table_Date_from_To">
+ <tr>
+ <td>
+ <para style="terp_header_Centre">From : [[ formatLang(data['form']['date_from'],date=True) ]] To: [[ formatLang(data['form']['date_to'], date=True) ]]</para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="terp_default_8">[[ get_data(data['form']) ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <blockTable colWidths="100.0,308.16,116.32,100.0,308.16,116.32" style="Table_Account_Line_Title" repeatRows="1">
+ <tr>
+ <td>
+ <para style="terp_default_Bold_9">Code</para>
+ </td>
+ <td>
+ <para style="terp_default_Bold_9">Liabilities</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details_Right">Total Amount([[ get_currency(data['form']) ]])</para>
+ </td>
+ <td>
+ <para style="terp_default_Bold_9">Code</para>
+ </td>
+ <td>
+ <para style="terp_default_Bold_9">Assets</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details_Right">Total Amount([[ get_currency(data['form']) ]])</para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="terp_default_9"><font face="Times-Roman">[[ repeatIn(get_lines(), 'a') ]]</font> <font>[[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]]</font><font>[[ a['code'] ]]</font></para>
+ </td>
+ <td>
+ <para style="terp_default_9"><font color="white">[[ '. '*(a['level']-1) ]]</font><font>[[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]][[ a['name'] ]]</font></para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9_Bold">[[ formatLang(abs(a['balance'])) ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_9"><font>[[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]]</font><font>[[ a['code1'] ]]</font></para>
+ </td>
+ <td>
+ <para style="terp_default_9"><font color="white">[[ '. '*(a['level1']-1) ]]</font><font>[[ a['level1']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]][[ a['name1'] ]]</font></para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9_Bold">[[ formatLang(abs(a['balance1'])) ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <blockTable colWidths="408.16,116.32,408.16,116.32" style="Table_Net_Profit_Loss">
+ <tr>
+ <td>
+ <para style="terp_default_Bold_9">Balance:([[ get_currency(data['form']) ]])</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9_Bold"><u>[[ formatLang(abs(sum_dr())) ]]</u></para>
+ </td>
+ <td>
+ <para style="terp_default_Bold_9">Balance:([[ get_currency(data['form']) ]])</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9_Bold"><u>[[ formatLang(abs(sum_cr())) ]]</u></para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="terp_default_Right_9">
+ <font color="white"> </font>
+ </para>
+ </story>
+</document>
+
--- /dev/null
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import pooler
+import time
+import mx.DateTime
+import rml_parse
+from report import report_sxw
+from account_report_india.report import report_pl
+
+class report_balancesheet_horizontal(rml_parse.rml_parse):
+ def __init__(self, cr, uid, name, context):
+ super(report_balancesheet_horizontal, self).__init__(cr, uid, name, context)
+ self.obj_pl=report_pl.report_pl_account_horizontal(cr, uid, name, context)
+ self.result_sum_dr=0.0
+ self.result_sum_cr=0.0
+ self.result = {}
+ self.res_pl={}
+ self.result_temp=[]
+ self.localcontext.update({
+ 'time': time,
+ 'get_lines' : self.get_lines,
+ 'get_lines_another' : self.get_lines_another,
+ 'get_company': self.get_company,
+ 'get_currency': self._get_currency,
+ 'sum_dr' : self.sum_dr,
+ 'sum_cr' : self.sum_cr,
+ 'get_data':self.get_data,
+ 'get_pl_balance':self.get_pl_balance,
+
+ })
+ self.context = context
+
+ def sum_dr(self):
+ if self.res_pl['type'] == 'Net Profit':
+ self.result_sum_dr += self.res_pl['balance']
+ return self.result_sum_dr or 0.0
+
+ def sum_cr(self):
+ if self.res_pl['type'] == 'Net Loss':
+ self.result_sum_cr += self.res_pl['balance']
+ return self.result_sum_cr or 0.0
+
+ def get_pl_balance(self):
+ return self.res_pl or 0.0
+
+ def get_data(self,form):
+ cr, uid = self.cr, self.uid
+ db_pool = pooler.get_pool(self.cr.dbname)
+
+ #Getting Profit or Loss Balance from profit and Loss report
+ result_pl=self.obj_pl.get_data(form)
+ self.res_pl=self.obj_pl.final_result()
+
+ type_pool = db_pool.get('account.account.type')
+ account_pool = db_pool.get('account.account')
+ year_pool = db_pool.get('account.fiscalyear')
+
+ types = [
+ 'liability',
+ 'asset'
+ ]
+
+ ctx = self.context.copy()
+ ctx['state'] = form['context'].get('state','all')
+ ctx['fiscalyear'] = form['fiscalyear']
+ if form['state']=='byperiod' :
+ ctx['periods'] = form['periods']
+ elif form['state']== 'bydate':
+ ctx['date_from'] = form['date_from']
+ ctx['date_to'] = form['date_to']
+ elif form['state'] == 'all' :
+ ctx['periods'] = form['periods']
+ ctx['date_from'] = form['date_from']
+ ctx['date_to'] = form['date_to']
+
+ cal_list={}
+ pl_dict = {}
+ account_dict = {}
+ account_id = [form['Account_list']]
+ account_ids = account_pool._get_children_and_consol(cr, uid, account_id, context=ctx)
+ accounts = account_pool.browse(cr, uid, account_ids, context=ctx)
+
+ if self.res_pl['type'] == 'Net Profit C.F.B.L.':
+ self.res_pl['type'] = 'Net Profit'
+ else:
+ self.res_pl['type'] = 'Net Loss'
+ pl_dict = {
+ 'code' : False,
+ 'name' : self.res_pl['type'],
+ 'level': False,
+ 'balance':self.res_pl['balance'],
+ }
+ for typ in types:
+ accounts_temp = []
+ for account in accounts:
+ if (account.user_type.report_type) and (account.user_type.report_type == typ):
+ account_dict = {
+ 'id' : account.id,
+ 'code' : account.code,
+ 'name' : account.name,
+ 'level': account.level,
+ 'balance':account.balance,
+ }
+ if typ == 'liability' and account.type <> 'view' and (account.debit <> account.credit):
+ self.result_sum_dr += abs(account.debit - account.credit)
+ if typ == 'asset' and account.type <> 'view' and (account.debit <> account.credit):
+ self.result_sum_cr += abs(account.debit - account.credit)
+ if form['display_account'] == 'bal_mouvement':
+ if account.credit > 0 or account.debit > 0 or account.balance > 0 :
+ accounts_temp.append(account_dict)
+ elif form['display_account'] == 'bal_solde':
+ if account.balance != 0:
+ accounts_temp.append(account_dict)
+ else:
+ accounts_temp.append(account_dict)
+ if account.id == form['reserve_account_id']:
+ pl_dict['level'] = account['level'] + 1
+ accounts_temp.append(pl_dict)
+
+ self.result[typ] = accounts_temp
+ cal_list[typ]=self.result[typ]
+ if cal_list:
+ temp={}
+ for i in range(0,max(len(cal_list['liability']),len(cal_list['asset']))):
+ if i < len(cal_list['liability']) and i < len(cal_list['asset']):
+ temp={
+ 'code' : cal_list['liability'][i]['code'],
+ 'name' : cal_list['liability'][i]['name'],
+ 'level': cal_list['liability'][i]['level'],
+ 'balance':cal_list['liability'][i]['balance'],
+ 'code1' : cal_list['asset'][i]['code'],
+ 'name1' : cal_list['asset'][i]['name'],
+ 'level1': cal_list['asset'][i]['level'],
+ 'balance1':cal_list['asset'][i]['balance'],
+ }
+ self.result_temp.append(temp)
+ else:
+ if i < len(cal_list['asset']):
+ temp={
+ 'code' : '',
+ 'name' : '',
+ 'level': False,
+ 'balance':False,
+ 'code1' : cal_list['asset'][i]['code'],
+ 'name1' : cal_list['asset'][i]['name'],
+ 'level1': cal_list['asset'][i]['level'],
+ 'balance1':cal_list['asset'][i]['balance'],
+ }
+ self.result_temp.append(temp)
+ if i < len(cal_list['liability']):
+ temp={
+ 'code' : cal_list['liability'][i]['code'],
+ 'name' : cal_list['liability'][i]['name'],
+ 'level': cal_list['liability'][i]['level'],
+ 'balance':cal_list['liability'][i]['balance'],
+ 'code1' : '',
+ 'name1' : '',
+ 'level1': False,
+ 'balance1':False,
+ }
+ self.result_temp.append(temp)
+ return None
+
+ def get_lines(self):
+ return self.result_temp
+
+ def get_lines_another(self, group):
+ return self.result.get(group, [])
+
+ def _get_currency(self, form):
+ return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).currency_id.code
+
+ def get_company(self,form):
+ comp_obj=pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr,self.uid,form['company_id'])
+ return comp_obj.name
+
+report_sxw.report_sxw('report.account.balancesheet.horizontal', 'account.account',
+ 'addons/account_report_india/report/report_balance_sheet_horizontal.rml',parser=report_balancesheet_horizontal,
+ header=False)
+
+report_sxw.report_sxw('report.account.balancesheet', 'account.account',
+ 'addons/account_report_india/report/report_balance_sheet.rml',parser=report_balancesheet_horizontal,
+ header=False)
--- /dev/null
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import pooler
+import time
+import mx.DateTime
+import rml_parse
+from report import report_sxw
+
+class report_pl_account_horizontal(rml_parse.rml_parse):
+ def __init__(self, cr, uid, name, context):
+ super(report_pl_account_horizontal, self).__init__(cr, uid, name, context)
+ self.result_sum_dr=0.0
+ self.result_sum_cr=0.0
+ self.res_pl ={}
+ self.result = {}
+ self.result_temp=[]
+ self.localcontext.update( {
+ 'time': time,
+ 'get_lines' : self.get_lines,
+ 'get_lines_another' : self.get_lines_another,
+ 'get_company': self.get_company,
+ 'get_currency': self._get_currency,
+ 'get_data': self.get_data,
+ 'sum_dr' : self.sum_dr,
+ 'sum_cr' : self.sum_cr,
+ 'final_result' : self.final_result,
+ })
+ self.context = context
+
+ def final_result(self):
+ return self.res_pl
+
+ def sum_dr(self):
+ if self.res_pl['type'] == 'Net Profit C.F.B.L.':
+ self.result_sum_dr += self.res_pl['balance']
+ return self.result_sum_dr or 0.0
+
+ def sum_cr(self):
+ if self.res_pl['type'] == 'Net Loss C.F.B.L.':
+ self.result_sum_cr += self.res_pl['balance']
+ return self.result_sum_cr or 0.0
+
+ def get_data(self,form):
+ cr, uid = self.cr, self.uid
+ db_pool = pooler.get_pool(self.cr.dbname)
+
+ type_pool = db_pool.get('account.account.type')
+ account_pool = db_pool.get('account.account')
+ year_pool = db_pool.get('account.fiscalyear')
+
+ types = [
+ 'expense',
+ 'income'
+ ]
+
+ ctx = self.context.copy()
+ ctx['state'] = form['context'].get('state','all')
+ ctx['fiscalyear'] = form['fiscalyear']
+ if form['state']=='byperiod' :
+ ctx['periods'] = form['periods']
+ elif form['state']== 'bydate':
+ ctx['date_from'] = form['date_from']
+ ctx['date_to'] = form['date_to']
+ elif form['state'] == 'all' :
+ ctx['periods'] = form['periods']
+ ctx['date_from'] = form['date_from']
+ ctx['date_to'] = form['date_to']
+
+ cal_list={}
+ account_id = [form['Account_list']]
+ account_ids = account_pool._get_children_and_consol(cr, uid, account_id, context=ctx)
+ accounts = account_pool.browse(cr, uid, account_ids, context=ctx)
+
+ for typ in types:
+ accounts_temp = []
+ for account in accounts:
+ if (account.user_type.report_type) and (account.user_type.report_type == typ):
+ if typ == 'expense' and account.type <> 'view' and (account.debit <> account.credit):
+ self.result_sum_dr += abs(account.debit - account.credit)
+ if typ == 'income' and account.type <> 'view' and (account.debit <> account.credit):
+ self.result_sum_cr += abs(account.debit - account.credit)
+ if form['display_account'] == 'bal_mouvement':
+ if account.credit > 0 or account.debit > 0 or account.balance > 0 :
+ accounts_temp.append(account)
+ elif form['display_account'] == 'bal_solde':
+ if account.balance != 0:
+ accounts_temp.append(account)
+ else:
+ accounts_temp.append(account)
+ if self.result_sum_dr > self.result_sum_cr:
+ self.res_pl['type'] = 'Net Loss C.F.B.L.'
+ self.res_pl['balance'] = (self.result_sum_dr - self.result_sum_cr)
+ else:
+ self.res_pl['type'] = 'Net Profit C.F.B.L.'
+ self.res_pl['balance'] = (self.result_sum_cr - self.result_sum_dr)
+ self.result[typ] = accounts_temp
+ cal_list[typ]=self.result[typ]
+ if cal_list:
+ temp={}
+ for i in range(0,max(len(cal_list['expense']),len(cal_list['income']))):
+ if i < len(cal_list['expense']) and i < len(cal_list['income']):
+ temp={
+ 'code' : cal_list['expense'][i].code,
+ 'name' : cal_list['expense'][i].name,
+ 'level': cal_list['expense'][i].level,
+ 'balance':cal_list['expense'][i].balance,
+ 'code1' : cal_list['income'][i].code,
+ 'name1' : cal_list['income'][i].name,
+ 'level1': cal_list['income'][i].level,
+ 'balance1':cal_list['income'][i].balance,
+ }
+ self.result_temp.append(temp)
+ else:
+ if i < len(cal_list['income']):
+ temp={
+ 'code' : '',
+ 'name' : '',
+ 'level': False,
+ 'balance':False,
+ 'code1' : cal_list['income'][i].code,
+ 'name1' : cal_list['income'][i].name,
+ 'level1': cal_list['income'][i].level,
+ 'balance1':cal_list['income'][i].balance,
+ }
+ self.result_temp.append(temp)
+ if i < len(cal_list['expense']):
+ temp={
+ 'code' : cal_list['expense'][i].code,
+ 'name' : cal_list['expense'][i].name,
+ 'level': cal_list['expense'][i].level,
+ 'balance':cal_list['expense'][i].balance,
+ 'code1' : '',
+ 'name1' : '',
+ 'level1': False,
+ 'balance1':False,
+ }
+ self.result_temp.append(temp)
+ return None
+
+ def get_lines(self):
+ return self.result_temp
+
+ def get_lines_another(self, group):
+ return self.result.get(group, [])
+
+ def _get_currency(self, form):
+ return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).currency_id.code
+
+ def get_company(self,form):
+ comp_obj=pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr,self.uid,form['company_id'])
+ return comp_obj.name
+
+report_sxw.report_sxw('report.pl.account.horizontal', 'account.account',
+ 'addons/account_report_india/report/report_pl_account_horizontal.rml',parser=report_pl_account_horizontal, header=False)
+
+report_sxw.report_sxw('report.pl.account', 'account.account',
+ 'addons/account_report_india/report/report_pl_account.rml',parser=report_pl_account_horizontal, header=False)
+
--- /dev/null
+<?xml version="1.0"?>
+<document filename="test.pdf">
+ <template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
+ <pageTemplate id="first">
+ <frame id="first" x1="28.0" y1="28.0" width="539" height="786"/>
+ </pageTemplate>
+ </template>
+ <stylesheet>
+ <blockTableStyle id="Standard_Outline">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Heading">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Company_Name">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Date_from_To">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Account_Line_Title">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,0" stop="0,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,0" stop="2,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEAFTER" colorName="#cccccc" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,0" stop="3,-1"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table6">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Net_Profit_Loss">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEAFTER" colorName="#cccccc" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table2">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,0" stop="0,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,0" stop="2,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEAFTER" colorName="#cccccc" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,0" stop="3,-1"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table3">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table4">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEAFTER" colorName="#cccccc" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Final_Result">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEAFTER" colorName="#cccccc" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
+ </blockTableStyle>
+ <initialize>
+ <paraStyle name="all" alignment="justify"/>
+ </initialize>
+ <paraStyle name="P1" rightIndent="2.0" leftIndent="0.0" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="P2" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="Standard" fontName="Times-Roman"/>
+ <paraStyle name="Heading" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="Caption" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="Index" fontName="Helvetica" fontSize="9.0" leading="11"/>
+ <paraStyle name="Footer" fontName="Times-Roman"/>
+ <paraStyle name="Table Contents" fontName="Times-Roman"/>
+ <paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
+ <paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
+ <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Right_9_Bold" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_2" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ </stylesheet>
+ <images/>
+ <story>
+ <para style="Standard">
+ <font color="white"> </font>
+ </para>
+ <blockTable colWidths="539.0" style="Table_Heading">
+ <tr>
+ <td>
+ <para style="terp_header_Centre">[[ get_company(data['form']) ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <blockTable colWidths="539.0" style="Table_Company_Name">
+ <tr>
+ <td>
+ <para style="terp_header_Centre">Profit And Loss Account</para>
+ </td>
+ </tr>
+ </blockTable>
+ <blockTable colWidths="539.0" style="Table_Date_from_To">
+ <tr>
+ <td>
+ <para style="terp_header_Centre">From : [[ formatLang(data['form']['date_from'],date=True) ]] To: [[ formatLang(data['form']['date_to'], date=True) ]]</para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="P2">[[ get_data(data['form']) ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <blockTable colWidths="100.0,326.0,113.0" style="Table_Account_Line_Title" repeatRows="1">
+ <tr>
+ <td>
+ <para style="terp_default_Bold_9">Code</para>
+ </td>
+ <td>
+ <para style="terp_default_Bold_9">Expenses</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details_Right">Total Amount([[ get_currency(data['form']) ]])</para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="terp_default_9">
+ <font face="Times-Roman">[[ repeatIn(get_lines_another('expense'),'a' ) ]] </font>[[ a.code ]]<font>[[ a.level<3 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]]</font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_default_9">
+ <font color="white">[[ '. '*(a.level-1) ]]</font><font>[[ a.level<3 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]][[ a.name ]]</font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9_Bold">[[ formatLang(abs(a.balance)) ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <blockTable colWidths="100.0,326.0,113.0" style="Table_Net_Profit_Loss">
+ <tr>
+ <td>
+ <para style="terp_default_Bold_9"></para>
+ </td>
+ <td>
+ <para style="terp_default_Bold_9">[[ final_result()['type'] == 'Net Profit C.F.B.L.' and final_result()['type'] or removeParentNode('blockTable') ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9_Bold">[[ final_result()['type'] == 'Net Profit C.F.B.L.' and formatLang(abs(final_result()['balance'])) or '' ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <blockTable colWidths="426.0,113.0" style="Table_Net_Profit_Loss">
+ <tr>
+ <td>
+ <para style="terp_default_Bold_9">Total:([[ get_currency(data['form']) ]])</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9_Bold"><u>[[ formatLang(abs(sum_dr())) ]]</u></para>
+ </td>
+ </tr>
+ </blockTable>
+ <condPageBreak height="20cm"/>
+ <para style="terp_default_Right_9_Bold">
+ <font color="white"> </font>
+ </para>
+ <blockTable colWidths="100.0,326.0,113.0" style="Table2" repeatRows="1">
+ <tr>
+ <td>
+ <para style="terp_default_Bold_9">Code</para>
+ </td>
+ <td>
+ <para style="terp_default_Bold_9">Incomes</para>
+ </td>
+ <td>
+ <para style="P1">Total Amount([[ get_currency(data['form']) ]])</para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="terp_default_9">
+ <font face="Times-Roman">[[ repeatIn(get_lines_another('income'),'a') ]] </font>[[ a.code ]]<font>[[ a.level<3 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]]</font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_default_9">
+ <font color="white">[[ '. '*(a.level-1) ]]</font><font>[[ a.level<3 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]][[ a.name ]]</font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9_Bold">[[ formatLang(abs(a.balance)) ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <blockTable colWidths="100.0,326.0,113.0" style="Table4">
+ <tr>
+ <td>
+ <para style="terp_default_Bold_9"></para>
+ </td>
+ <td>
+ <para style="terp_default_Bold_9">[[ final_result()['type'] == 'Net Loss C.F.B.L.' and final_result()['type'] or removeParentNode('blockTable') ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9_Bold">[[ final_result()['type'] == 'Net Loss C.F.B.L.' and formatLang(abs(final_result()['balance'])) or '' ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <blockTable colWidths="426.0,113.0" style="Table4">
+ <tr>
+ <td>
+ <para style="terp_default_Bold_9">Total:([[ get_currency(data['form']) ]])</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9_Bold"><u>[[ formatLang(abs(sum_cr())) ]]</u></para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="Standard">
+ <font color="white"> </font>
+ </para>
+ <para style="terp_default_Right_9_Bold">
+ <font color="white"> </font>
+ </para>
+ </story>
+</document>
--- /dev/null
+<?xml version="1.0"?>
+<document filename="test.pdf">
+ <template pageSize="(1120.0,770.0)" title="Test" author="Martin Simon" allowSplitting="20" >
+ <pageTemplate id="first">
+ <frame id="first" x1="22.0" y1="15.0" width="1080" height="680"/>
+ <pageGraphics>
+ <setFont name="Helvetica-Bold" size="9"/>
+ <!--COL 1-->
+ <drawString x="1.3cm" y="25.50cm">[[ get_company(data['form']) ]]</drawString>
+ <!--COL 2-->
+ <setFont name="Helvetica" size="9"/>
+ <drawString x="1.3cm" y="0.50cm"> [[ formatLang(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),date_time = True) ]]</drawString>
+ <drawString x="37.20cm" y="0.50cm">Page <pageNumber/></drawString>
+
+ <lineMode width="0.7"/>
+ <lines>1.3cm 24.9cm 38.3cm 24.9cm</lines>
+ <setFont name="Helvetica" size="8"/>
+ </pageGraphics>
+ </pageTemplate>
+ </template>
+ <stylesheet>
+ <blockTableStyle id="Standard_Outline">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Heading">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Company_Name">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Date_from_To">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_debit_credit">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Account_Line_Title">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,0" stop="0,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,0" stop="2,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="4,0" stop="4,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="4,0" stop="4,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,0" stop="4,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="5,0" stop="5,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="5,0" stop="5,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="5,0" stop="5,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="6,0" stop="6,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="6,0" stop="6,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="6,0" stop="6,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="7,0" stop="7,-1"/>
+ <lineStyle kind="LINEAFTER" colorName="#cccccc" start="7,0" stop="7,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="7,0" stop="7,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="7,0" stop="7,-1"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Main_Content">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Expense_Content">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Income_Content">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Net_Profit_Loss">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="4,0" stop="4,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="4,0" stop="4,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="5,0" stop="5,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="5,0" stop="5,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="5,-1" stop="5,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="6,0" stop="6,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="6,0" stop="6,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="6,-1" stop="6,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="7,0" stop="7,-1"/>
+ <lineStyle kind="LINEAFTER" colorName="#cccccc" start="7,0" stop="7,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="7,0" stop="7,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="7,-1" stop="7,-1"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table_Final_Result">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEAFTER" colorName="#cccccc" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
+ </blockTableStyle>
+ <initialize>
+ <paraStyle name="all" alignment="justify"/>
+ </initialize>
+ <paraStyle name="P1" rightIndent="2.0" leftIndent="0.0" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="P2" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="Standard" fontName="Times-Roman"/>
+ <paraStyle name="Heading" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="Caption" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="Index" fontName="Helvetica" fontSize="9.0" leading="11"/>
+ <paraStyle name="Footer" fontName="Times-Roman"/>
+ <paraStyle name="Table Contents" fontName="Times-Roman"/>
+ <paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
+ <paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
+ <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Right_9_Bold" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_2" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ </stylesheet>
+ <images/>
+ <story>
+ <para style="Standard">
+ <font color="white"> </font>
+ </para>
+ <blockTable colWidths="1049.0" style="Table_Company_Name">
+ <tr>
+ <td>
+ <para style="terp_header_Centre">Profit And Loss Account </para>
+ </td>
+ </tr>
+ </blockTable>
+ <blockTable colWidths="1049.0" style="Table_Date_from_To">
+ <tr>
+ <td>
+ <para style="terp_header_Centre">From : [[ formatLang(data['form']['date_from'],date=True) ]] To: [[ formatLang(data['form']['date_to'], date=True) ]]</para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="terp_default_9">[[ get_data(data['form']) ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <blockTable colWidths="100.0,308.16,116.32,100.0,308.16,116.32" style="Table_Account_Line_Title" repeatRows="1">
+ <tr>
+ <td>
+ <para style="terp_default_Bold_9">Code</para>
+ </td>
+ <td>
+ <para style="terp_default_Bold_9">Perticular</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details_Right">Total Amount([[ get_currency(data['form'])]])</para>
+ </td>
+ <td>
+ <para style="terp_default_Bold_9">Code</para>
+ </td>
+ <td>
+ <para style="terp_default_Bold_9">Perticular</para>
+ </td>
+ <td>
+ <para style="P1">Total Amount([[ get_currency(data['form'])]])</para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="terp_default_9">
+ <font face="Times-Roman">[[ repeatIn(get_lines(),'a' ) ]] </font>[[ a['code'] ]]<font>[[ a['level']<3 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]]</font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_default_9">
+ <font color="white">[[ '. '*(a['level']-1) ]]</font><font>[[ a['level']<3 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]][[ a['name'] ]]</font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9_Bold">[[ formatLang(abs(a['balance'])) ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_9">
+ [[ a['code1'] ]]<font>[[ a['level1']<3 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]]</font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_default_9">
+ <font color="white">[[ '. '*(a['level1']-1) ]]</font><font>[[ a['level1']<3 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) ]][[ a['name1'] ]]</font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9_Bold">[[ formatLang(abs(a['balance1'])) ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <blockTable colWidths="100.0,308.16,116.32,100.0,308.16,116.32" style="Table_Net_Profit_Loss">
+ <tr>
+ <td>
+ <para style="terp_default_Bold_9"></para>
+ </td>
+ <td>
+ <para style="terp_default_Bold_9">[[ final_result()['type'] == 'Net Profit C.F.B.L.' and final_result()['type'] or '' ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9_Bold">[[ final_result()['type'] == 'Net Profit C.F.B.L.' and formatLang(abs(final_result()['balance'])) or '' ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_Bold_9"></para>
+ </td>
+ <td>
+ <para style="terp_default_Bold_9">[[ final_result()['type'] == 'Net Loss C.F.B.L.' and final_result()['type'] or '' ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9_Bold">[[ final_result()['type'] == 'Net Loss C.F.B.L.' and formatLang(abs(final_result()['balance'])) or '' ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+
+ <blockTable colWidths="408.16,116.32,408.16,116.32" style="Table_Net_Profit_Loss">
+ <tr>
+ <td>
+ <para style="terp_default_Bold_9">Total:([[ get_currency(data['form']) ]])</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9_Bold"><u>[[ formatLang(abs(sum_dr())) ]]</u></para>
+ </td>
+ <td>
+ <para style="terp_default_Bold_9">Total:([[ get_currency(data['form']) ]])</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9_Bold"><u>[[ formatLang(abs(sum_cr())) ]]</u></para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="terp_default_8">
+ <font color="white"> </font>
+ </para>
+ </story>
+</document>
+
--- /dev/null
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+from report import report_sxw
+import xml.dom.minidom
+import os, time
+import osv
+import re
+import tools
+import pooler
+import re
+import sys
+
+
+class rml_parse(report_sxw.rml_parse):
+ def __init__(self, cr, uid, name, context):
+ super(rml_parse, self).__init__(cr, uid, name, context=None)
+ self.localcontext.update({
+ 'comma_me': self.comma_me,
+ 'format_date': self._get_and_change_date_format_for_swiss,
+ 'strip_name' : self._strip_name,
+ 'explode_name' : self._explode_name,
+ })
+
+ def comma_me(self,amount):
+ #print "#" + str(amount) + "#"
+ if not amount:
+ amount = 0.0
+ if type(amount) is float :
+ amount = str('%.2f'%amount)
+ else :
+ amount = str(amount)
+ if (amount == '0'):
+ return ' '
+ orig = amount
+ new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount)
+ if orig == new:
+ return new
+ else:
+ return self.comma_me(new)
+
+ def _ellipsis(self, string, maxlen=100, ellipsis = '...'):
+ ellipsis = ellipsis or ''
+ try:
+ return string[:maxlen - len(ellipsis) ] + (ellipsis, '')[len(string) < maxlen]
+ except Exception, e:
+ return False
+
+ def _strip_name(self, name, maxlen=50):
+ return self._ellipsis(name, maxlen, '...')
+
+ def _get_and_change_date_format_for_swiss (self,date_to_format):
+ date_formatted=''
+ if date_to_format:
+ date_formatted = strptime (date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y')
+ return date_formatted
+
+ def _explode_name(self,chaine,length):
+ # We will test if the size is less then account
+ full_string = ''
+ if (len(str(chaine)) <= length):
+ return chaine
+ #
+ else:
+ chaine = unicode(chaine,'utf8').encode('iso-8859-1')
+ rup = 0
+ for carac in chaine:
+ rup = rup + 1
+ if rup == length:
+ full_string = full_string + '\n'
+ full_string = full_string + carac
+ rup = 0
+ else:
+ full_string = full_string + carac
+
+ return full_string
+
+ def makeAscii(self,str):
+ try:
+ Stringer = str.encode("utf-8")
+ except UnicodeDecodeError:
+ try:
+ Stringer = str.encode("utf-16")
+ except UnicodeDecodeError:
+ print "UTF_16 Error"
+ Stringer = str
+ else:
+ return Stringer
+ else:
+ return Stringer
+ return Stringer
+
+ def explode_this(self,chaine,length):
+ #chaine = self.repair_string(chaine)
+ chaine = rstrip(chaine)
+ ast = list(chaine)
+ i = length
+ while i <= len(ast):
+ ast.insert(i,'\n')
+ i = i + length
+ chaine = str("".join(ast))
+ return chaine
+
+ def repair_string(self,chaine):
+ ast = list(chaine)
+ UnicodeAst = []
+ _previouslyfound = False
+ i = 0
+ #print str(ast)
+ while i < len(ast):
+ elem = ast[i]
+ try:
+ Stringer = elem.encode("utf-8")
+ except UnicodeDecodeError:
+ to_reencode = elem + ast[i+1]
+ print str(to_reencode)
+ Good_char = to_reencode.decode('utf-8')
+ UnicodeAst.append(Good_char)
+ i += i +2
+ else:
+ UnicodeAst.append(elem)
+ i += i + 1
+ return "".join(UnicodeAst)
+
+ def ReencodeAscii(self,str):
+ print sys.stdin.encoding
+ try:
+ Stringer = str.decode("ascii")
+ except UnicodeEncodeError:
+ print "REENCODING ERROR"
+ return str.encode("ascii")
+ except UnicodeDecodeError:
+ print "DECODING ERROR"
+ return str.encode("ascii")
+ else:
+ print Stringer
+ return Stringer
+
+ def _add_header(self, node, header=1):
+ if header==2:
+ rml_head = self.rml_header2
+ else:
+ rml_head = self.rml_header
+ rml_head = rml_head.replace('<pageGraphics>','''<pageGraphics> <image x="10" y="26cm" height="770.0" width="1120.0" >[[company.logo]] </image> ''')
+ return True
+
+
+
--- /dev/null
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import account_bs_report
+import account_pl_report
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+import time
+
+from osv import osv, fields
+from tools.translate import _
+
+class account_bs_report(osv.osv_memory):
+ """
+ This wizard will provide the account balance sheet report by periods, between any two dates.
+ """
+ _name = 'account.bs.report'
+ _description = 'Account Balance Sheet Report'
+ _columns = {
+ 'Account_list': fields.many2one('account.account', 'Chart account',
+ required=True, domain = [('parent_id','=',False)]),
+ 'company_id': fields.many2one('res.company', 'Company', required=True),
+ 'display_account': fields.selection([('bal_movement','With movements'),
+ ('bal_solde','With balance is not equal to 0'),
+ ('bal_all','All'),
+ ],'Display accounts'),
+ 'display_type': fields.boolean("Landscape Mode"),
+ 'reserve_account_id': fields.many2one('account.account', 'Reserve & Surplus Account',required = True,
+ help='This Account is used for trasfering Profit/Loss(If It is Profit : Amount will be added, Loss : Amount will be duducted.), Which is calculated from Profilt & Loss Report', domain = [('type','=','payable')]),
+ 'fiscalyear': fields.many2one('account.fiscalyear', 'Fiscal year', help='Keep empty for all open fiscal year'),
+ 'state': fields.selection([('bydate','By Date'),
+ ('byperiod','By Period'),
+ ('all','By Date and Period'),
+ ('none','No Filter')
+ ],'Date/Period Filter'),
+ 'periods': fields.many2many('account.period', 'period_account_balance_rel',
+ 'report_id', 'period_id', 'Periods',
+ help='Keep empty for all open fiscal year'),
+ 'date_from': fields.date('Start date', required=True),
+ 'date_to': fields.date('End date', required=True),
+ }
+
+ def _get_company(self, cr, uid, context=None):
+ user_obj = self.pool.get('res.users')
+ company_obj = self.pool.get('res.company')
+ user = user_obj.browse(cr, uid, uid, context=context)
+ if user.company_id:
+ return user.company_id.id
+ else:
+ return company_obj.search(cr, uid, [('parent_id', '=', False)])[0]
+
+ _defaults={
+ 'state' : 'none',
+ 'date_from' : time.strftime('%Y-01-01'),
+ 'date_to' : time.strftime('%Y-%m-%d'),
+ 'company_id' : _get_company,
+ 'fiscalyear' : False,
+ 'display_account': 'bal_all',
+ 'display_type': True,
+ }
+
+ def next_view(self, cr, uid, ids, context=None):
+ obj_model = self.pool.get('ir.model.data')
+ if context is None:
+ context = {}
+ data = self.read(cr, uid, ids, [])[0]
+ context.update({'Account_list': data['Account_list'],'reserve_account_id':data['reserve_account_id']})
+ model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'),('name','=','account_bs_report_view')])
+ resource_id = obj_model.read(cr, uid, model_data_ids, fields=['res_id'])[0]['res_id']
+ return {
+ 'view_type': 'form',
+ 'view_mode': 'form',
+ 'res_model': 'account.bs.report',
+ 'views': [(resource_id,'form')],
+ 'type': 'ir.actions.act_window',
+ 'target': 'new',
+ 'context': context
+ }
+
+ def check_state(self, cr, uid, ids, context=None):
+ if context is None:
+ context = {}
+ data={}
+ data['ids'] = context['active_ids']
+ data['form'] = self.read(cr, uid, ids, ['date_from', 'company_id', 'state', 'periods', 'date_to', 'display_account', 'display_type', 'fiscalyear'])[0]
+ data['form']['Account_list'] = context.get('Account_list',[])
+ data['form']['reserve_account_id'] = context.get('reserve_account_id',[])
+ data['form']['context'] = context
+ if data['form']['Account_list']:
+ data['model'] = 'ir.ui.menu'
+ else:
+ data['model'] = 'account.account'
+
+ if data['form']['state'] == 'bydate' :
+ return self._check_date(cr, uid, data, context)
+ elif data['form']['state'] == 'byperiod':
+ if not data['form']['periods']:
+ raise osv.except_osv(_('Warning'),_('Please Enter Periods ! '))
+ if data['form']['display_type']:
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'account.balancesheet.horizontal',
+ 'datas': data,
+ 'nodestroy':True,
+ }
+ else:
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'account.balancesheet',
+ 'datas': data,
+ 'nodestroy':True,
+ }
+
+ def _check_date(self, cr, uid, data, context=None):
+ if context is None:
+ context = {}
+ sql = """
+ SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where %s between f.date_start and f.date_stop """
+ cr.execute(sql,(data['form']['date_from'],))
+ res = cr.dictfetchall()
+ if res:
+
+ if (data['form']['date_to'] > res[0]['date_stop'] or data['form']['date_to'] < res[0]['date_start']):
+ raise osv.except_osv(_('UserError'),_('Date to must be set between %s and %s') % (res[0]['date_start'], res[0]['date_stop']))
+ else:
+ if data['form']['display_type']:
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'account.balancesheet.horizontal',
+ 'datas': data,
+ 'nodestroy':True,
+ }
+ else:
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'account.balancesheet',
+ 'datas': data,
+ 'nodestroy':True,
+ }
+ else:
+ raise osv.except_osv(_('UserError'),_('Date not in a defined fiscal year'))
+
+account_bs_report()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+
+ <record id="account_bs_report_view" model="ir.ui.view">
+ <field name="name">Select period</field>
+ <field name="model">account.bs.report</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Select period">
+ <field name="company_id"/>
+ <field name="display_account" required = "True"/>
+ <newline/>
+ <field name="fiscalyear"/>
+ <label colspan="2" string="(Keep empty for all open fiscal years)" align="0.0"/>
+ <field name="display_type"/>
+ <newline/>
+ <separator string="Filters" colspan="4"/>
+ <field name="state" required="True"/>
+ <newline/>
+ <group attrs="{'invisible':[('state','=','none')]}" colspan="4">
+ <group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4">
+ <separator string="Date Filter" colspan="4"/>
+ <field name="date_from"/>
+ <field name="date_to"/>
+ </group>
+ <group attrs="{'invisible':[('state','=','bydate')]}" colspan="4">
+ <separator string="Filter on Periods" colspan="4"/>
+ <field name="periods" colspan="4" nolabel="1"/>
+ </group>
+ </group>
+ <newline/>
+ <group colspan="4" col="6">
+ <label string ="" colspan="2"/>
+ <button special="cancel" string="Cancel" icon="gtk-cancel"/>
+ <button name="check_state" string="Print" type="object" icon="gtk-print" default_focus="1"/>
+ </group>
+ </form>
+ </field>
+ </record>
+
+ <record id="action_account_bs_report" model="ir.actions.act_window">
+ <field name="name">Account Balance Sheet</field>
+ <field name="res_model">account.bs.report</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">form</field>
+ <field name="view_id" ref="account_bs_report_view"/>
+ <field name="target">new</field>
+ </record>
+
+ <record id="account_bs_report_account_view" model="ir.ui.view">
+ <field name="name">Account Chart</field>
+ <field name="model">account.bs.report</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Select Chart">
+ <field name="Account_list" />
+ <field name="reserve_account_id"/>
+ <separator colspan="4"/>
+ <button icon="gtk-cancel" special="cancel" string="Cancel" colspan="2"/>
+ <button name="next_view" string="Next" type="object" icon="gtk-go-forward" default_focus="1" colspan="2"/>
+ </form>
+ </field>
+ </record>
+
+ <record id="action_bs_balance_account_report" model="ir.actions.act_window">
+ <field name="name">Select Account</field>
+ <field name="res_model">account.bs.report</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">tree,form</field>
+ <field name="view_id" ref="account_bs_report_account_view"/>
+ <field name="context">{'record_id':active_id}</field>
+ <field name="target">new</field>
+ </record>
+
+ <menuitem icon="STOCK_PRINT"
+ name="Balance Sheet"
+ action="action_bs_balance_account_report"
+ id="menu_account_bs_report"
+ parent="final_accounting_reports"/>
+
+ </data>
+</openerp>
--- /dev/null
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+import time
+
+from osv import osv, fields
+from tools.translate import _
+
+class account_pl_report(osv.osv_memory):
+ """
+ This wizard will provide the account profit and loss report by periods, between any two dates.
+ """
+ _name = 'account.pl.report'
+ _description = 'Account Profit And Loss Report'
+ _columns = {
+ 'Account_list': fields.many2one('account.account', 'Chart account',
+ required=True, domain = [('parent_id','=',False)]),
+ 'company_id': fields.many2one('res.company', 'Company', required=True),
+ 'display_account': fields.selection([('bal_movement','With movements'),
+ ('bal_solde','With balance is not equal to 0'),
+ ('bal_all','All'),
+ ],'Display accounts'),
+ 'display_type': fields.boolean("Landscape Mode"),
+ 'fiscalyear': fields.many2one('account.fiscalyear', 'Fiscal year', help='Keep empty for all open fiscal year'),
+ 'state': fields.selection([('bydate','By Date'),
+ ('byperiod','By Period'),
+ ('all','By Date and Period'),
+ ('none','No Filter')
+ ],'Date/Period Filter'),
+ 'periods': fields.many2many('account.period', 'period_account_balance_rel',
+ 'report_id', 'period_id', 'Periods',
+ help='Keep empty for all open fiscal year'),
+ 'date_from': fields.date('Start date', required=True),
+ 'date_to': fields.date('End date', required=True),
+ }
+
+ def _get_company(self, cr, uid, context=None):
+ user_obj = self.pool.get('res.users')
+ company_obj = self.pool.get('res.company')
+ user = user_obj.browse(cr, uid, uid, context=context)
+ if user.company_id:
+ return user.company_id.id
+ else:
+ return company_obj.search(cr, uid, [('parent_id', '=', False)])[0]
+
+ _defaults={
+ 'state' : 'none',
+ 'date_from' : time.strftime('%Y-01-01'),
+ 'date_to' : time.strftime('%Y-%m-%d'),
+ 'company_id' : _get_company,
+ 'fiscalyear' : False,
+ 'display_account': 'bal_all',
+ 'display_type': True,
+ }
+
+ def next_view(self, cr, uid, ids, context=None):
+ obj_model = self.pool.get('ir.model.data')
+ if context is None:
+ context = {}
+ data = self.read(cr, uid, ids, [])[0]
+ context.update({'Account_list': data['Account_list']})
+ model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'),('name','=','account_pl_report_view')])
+ resource_id = obj_model.read(cr, uid, model_data_ids, fields=['res_id'])[0]['res_id']
+ return {
+ 'view_type': 'form',
+ 'view_mode': 'form',
+ 'res_model': 'account.pl.report',
+ 'views': [(resource_id,'form')],
+ 'type': 'ir.actions.act_window',
+ 'target': 'new',
+ 'context': context
+ }
+
+ def check_state(self, cr, uid, ids, context=None):
+ if context is None:
+ context = {}
+ data={}
+ data['ids'] = context['active_ids']
+ data['form'] = self.read(cr, uid, ids, ['date_from', 'company_id', 'state', 'periods', 'date_to', 'display_account', 'display_type', 'fiscalyear'])[0]
+ data['form']['Account_list'] = context.get('Account_list',[])
+ data['form']['context'] = context
+ if data['form']['Account_list']:
+ data['model'] = 'ir.ui.menu'
+ else:
+ data['model'] = 'account.account'
+
+ if data['form']['state'] == 'bydate' :
+ return self._check_date(cr, uid, data, context)
+ elif data['form']['state'] == 'byperiod':
+ if not data['form']['periods']:
+ raise osv.except_osv(_('Warning'),_('Please Enter Periods ! '))
+ if data['form']['display_type']:
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'pl.account.horizontal',
+ 'datas': data,
+ 'nodestroy':True,
+ }
+ else:
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'pl.account',
+ 'datas': data,
+ 'nodestroy':True,
+ }
+
+ def _check_date(self, cr, uid, data, context=None):
+ if context is None:
+ context = {}
+ sql = """
+ SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where %s between f.date_start and f.date_stop """
+ cr.execute(sql,(data['form']['date_from'],))
+ res = cr.dictfetchall()
+ if res:
+
+ if (data['form']['date_to'] > res[0]['date_stop'] or data['form']['date_to'] < res[0]['date_start']):
+ raise osv.except_osv(_('UserError'),_('Date to must be set between %s and %s') % (res[0]['date_start'], res[0]['date_stop']))
+ else:
+ if data['form']['display_type']:
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'pl.account.horizontal',
+ 'datas': data,
+ 'nodestroy':True,
+ }
+ else:
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'pl.account',
+ 'datas': data,
+ 'nodestroy':True,
+ }
+ else:
+ raise osv.except_osv(_('UserError'),_('Date not in a defined fiscal year'))
+
+account_pl_report()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+
+ <record id="account_pl_report_view" model="ir.ui.view">
+ <field name="name">Select period</field>
+ <field name="model">account.pl.report</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Select period">
+ <field name="company_id"/>
+ <field name="display_account" required = "True"/>
+ <newline/>
+ <field name="fiscalyear"/>
+ <label colspan="2" string="(Keep empty for all open fiscal years)" align="0.0"/>
+ <field name="display_type"/>
+ <newline/>
+ <separator string="Filters" colspan="4"/>
+ <field name="state" required="True"/>
+ <newline/>
+ <group attrs="{'invisible':[('state','=','none')]}" colspan="4">
+ <group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4">
+ <separator string="Date Filter" colspan="4"/>
+ <field name="date_from"/>
+ <field name="date_to"/>
+ </group>
+ <group attrs="{'invisible':[('state','=','bydate')]}" colspan="4">
+ <separator string="Filter on Periods" colspan="4"/>
+ <field name="periods" colspan="4" nolabel="1"/>
+ </group>
+ </group>
+ <newline/>
+ <group colspan="4" col="6">
+ <label string ="" colspan="2"/>
+ <button special="cancel" string="Cancel" icon="gtk-cancel"/>
+ <button name="check_state" string="Print" type="object" icon="gtk-print" default_focus="1"/>
+ </group>
+ </form>
+ </field>
+ </record>
+
+ <record id="action_account_pl_report" model="ir.actions.act_window">
+ <field name="name">Account Profit And Loss</field>
+ <field name="res_model">account.pl.report</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">form</field>
+ <field name="view_id" ref="account_pl_report_view"/>
+ <field name="target">new</field>
+ </record>
+
+ <record id="account_pl_report_account_view" model="ir.ui.view">
+ <field name="name">Account Chart</field>
+ <field name="model">account.pl.report</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Select Chart">
+ <field name="Account_list"/>
+ <separator colspan="4"/>
+ <button icon="gtk-cancel" special="cancel" string="Cancel"/>
+ <button name="next_view" string="Next" type="object" icon="gtk-go-forward" default_focus="1"/>
+ </form>
+ </field>
+ </record>
+
+ <record id="action_pl_balance_account_report" model="ir.actions.act_window">
+ <field name="name">Select Account</field>
+ <field name="res_model">account.pl.report</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">tree,form</field>
+ <field name="view_id" ref="account_pl_report_account_view"/>
+ <field name="context">{'record_id':active_id}</field>
+ <field name="target">new</field>
+ </record>
+
+ <menuitem
+ parent="account.menu_finance_legal_statement"
+ id="final_accounting_reports"
+ name="Accounting Reports"/>
+
+ <menuitem icon="STOCK_PRINT"
+ name="Profit And Loss"
+ action="action_pl_balance_account_report"
+ id="menu_account_pl_report"
+ parent="final_accounting_reports"/>
+
+ </data>
+</openerp>