[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
r6201 - in trunk/gnue-packages: base finance
From: |
reinhard |
Subject: |
r6201 - in trunk/gnue-packages: base finance |
Date: |
Tue, 24 Aug 2004 17:32:03 -0500 (CDT) |
Author: reinhard
Date: 2004-08-24 17:32:03 -0500 (Tue, 24 Aug 2004)
New Revision: 6201
Added:
trunk/gnue-packages/base/base-C.gld
trunk/gnue-packages/base/base-de.gld
trunk/gnue-packages/base/base.gcd
trunk/gnue-packages/base/currcalc.gfd
Modified:
trunk/gnue-packages/finance/gl.gcd
Log:
Introduced currency class with a simple currency calculater form.
Added: trunk/gnue-packages/base/base-C.gld
===================================================================
--- trunk/gnue-packages/base/base-C.gld 2004-08-24 17:35:13 UTC (rev 6200)
+++ trunk/gnue-packages/base/base-C.gld 2004-08-24 22:32:03 UTC (rev 6201)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Base Module - Standard labels
+
+ Copyright 2004 Free Software Foundation
+
+ This file is part of GNU Enterprise.
+
+ GNU Enterprise is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of
+ the License, or (at your option) any later version.
+
+ GNU Enterprise 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Enterprise; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ $Id$ -->
+
+<labels module="base" language="C">
+ <class name="currency">
+ <property name="code" pos="100" label="Code" search="100" />
+ <property name="symbol" pos="200" label="Symbol" search="200" />
+ <property name="name" pos="300" label="Name" search="300" />
+ <property name="formatstr" pos="400" label="Format String" />
+ <property name="roundunit" pos="500" label="Rounding Unit" />
+ <property name="convbase" pos="600" label="Conversion amount in base
currency" />
+ <property name="convthis" pos="601" label="Conversion amount in this
currency" />
+ </class>
+</labels>
Property changes on: trunk/gnue-packages/base/base-C.gld
___________________________________________________________________
Name: svn:keywords
+ Id
Added: trunk/gnue-packages/base/base-de.gld
===================================================================
--- trunk/gnue-packages/base/base-de.gld 2004-08-24 17:35:13 UTC (rev
6200)
+++ trunk/gnue-packages/base/base-de.gld 2004-08-24 22:32:03 UTC (rev
6201)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!-- Base Module - German labels
+
+ Copyright 2004 Free Software Foundation
+
+ This file is part of GNU Enterprise.
+
+ GNU Enterprise is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of
+ the License, or (at your option) any later version.
+
+ GNU Enterprise 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Enterprise; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ $Id$ -->
+
+<labels module="base" language="de">
+ <class name="currency">
+ <property name="code" pos="100" label="Code" search="100" />
+ <property name="symbol" pos="200" label="Symbol" search="200" />
+ <property name="name" pos="300" label="Name" search="300" />
+ <property name="formatstr" pos="400" label="Format" />
+ <property name="roundunit" pos="500" label="Rundungseinheit" />
+ <property name="convbase" pos="600" label="Konvertierungsbetrag
Basisw�hrung" />
+ <property name="convthis" pos="601" label="Konvertierungsbetrag diese
W�hrung" />
+ </class>
+</labels>
Property changes on: trunk/gnue-packages/base/base-de.gld
___________________________________________________________________
Name: svn:keywords
+ Id
Added: trunk/gnue-packages/base/base.gcd
===================================================================
--- trunk/gnue-packages/base/base.gcd 2004-08-24 17:35:13 UTC (rev 6200)
+++ trunk/gnue-packages/base/base.gcd 2004-08-24 22:32:03 UTC (rev 6201)
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Base Module
+
+ Copyright 2004 Free Software Foundation
+
+ This file is part of GNU Enterprise.
+
+ GNU Enterprise is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of
+ the License, or (at your option) any later version.
+
+ GNU Enterprise 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Enterprise; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ $Id$ -->
+
+<module name="base" comment="Basic classes">
+ <class name="currency" comment="Currency">
+ <!-- For the base currency, code is None -->
+ <property name="code" type="string(8)" />
+ <property name="symbol" type="string(8)" />
+ <property name="name" type="string(35)" />
+ <!-- Format string - currently not in use because forms can't handle it -->
+ <property name="formatstr" type="string(35)" />
+ <property name="roundunit" type="number(15)" />
+ <!-- Conversion factors to base currency -->
+ <!-- Example: convbase = 100, convthis = 1376 means 100 units of base
+ currency are 1376 units of this currency -->
+ <property name="convbase" type="number(15)" />
+ <property name="convthis" type="number(15)" />
+
+ <procedure name="round" type="number(15)">
+ <parameter name="amount" type="number(15)" />
+ <![CDATA[
+ # Round given amount
+ ru = self.roundunit or 1
+ if amount < 0:
+ x = amount - ru / 2
+ else:
+ x = amount + ru / 2
+ return int (x / ru) * ru
+ ]]>
+ </procedure>
+
+ <procedure name="convfrom" type="number(15)">
+ <parameter name="amount" type="number(15)" />
+ <![CDATA[
+ # Convert amount given in this currency to base currency
+ cb = self.convbase or 1
+ ct = self.convthis or 1
+ # baselist = find ('currency', {'code': None})
+ # if length (base) == 1:
+ # for base in baselist:
+ # break
+ # return base.round (amount * cb / ct)
+ # else:
+ # Emergency - Base currency not defined
+ return self.round (amount = amount * cb / ct)
+ ]]>
+ </procedure>
+
+ <procedure name="convto" type="number(15)">
+ <parameter name="amount" type="number(15)" />
+ <![CDATA[
+ # Convert amount given in base currency to this currency
+ cb = self.convbase or 1
+ ct = self.convthis or 1
+ return self.round (amount = amount * ct / cb)
+ ]]>
+ </procedure>
+ </class>
+</module>
Property changes on: trunk/gnue-packages/base/base.gcd
___________________________________________________________________
Name: svn:keywords
+ Id
Added: trunk/gnue-packages/base/currcalc.gfd
===================================================================
--- trunk/gnue-packages/base/currcalc.gfd 2004-08-24 17:35:13 UTC (rev
6200)
+++ trunk/gnue-packages/base/currcalc.gfd 2004-08-24 22:32:03 UTC (rev
6201)
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="iso8859-1"?>
+
+<form title="GNUe Currency Calculator">
+ <datasource
+ name="dtsFromCurrency"
+ connection="appserver"
+ table="base_currency"
+ prequery="Y" />
+ <datasource
+ name="dtsToCurrency"
+ connection="appserver"
+ table="base_currency"
+ prequery="Y" />
+ <logic>
+ <block name="blk">
+ <field name="fldFromSymbol" fk_source="dtsFromCurrency" fk_key="gnue_id"
+ fk_description="base_symbol" />
+ <field name="fldFromAmount" />
+ <field name="fldToSymbol" fk_source="dtsToCurrency" fk_key="gnue_id"
+ fk_description="base_symbol" />
+ <field name="fldToAmount" />
+ </block>
+ <block name="blkFromCurrency" datasource="dtsFromCurrency" />
+ <block name="blkToCurrency" datasource="dtsToCurrency" />
+ </logic>
+ <layout xmlns:Char="GNUe:Layout:Char" Char:height="4" Char:width="37">
+ <page name="page">
+ <entry name="entFromSymbol"
+ Char:height="1" Char:width="8" Char:x="1" Char:y="1"
+ block="blk" field="fldFromSymbol" style="dropdown" />
+ <entry name="entFromAmount"
+ Char:height="1" Char:width="8" Char:x="9" Char:y="1"
+ block="blk" field="fldFromAmount" />
+ <label text="="
+ Char:height="1" Char:width="1" Char:x="18" Char:y="1" />
+ <entry name="entToSymbol"
+ Char:height="1" Char:width="8" Char:x="20" Char:y="1"
+ block="blk" field="fldToSymbol" style="dropdown" />
+ <entry name="entToAmount"
+ Char:height="1" Char:width="8" Char:x="28" Char:y="1"
+ block="blk" field="fldToAmount"/>
+ <button name="Calculate"
+ Char:height="1" Char:width="35" Char:x="1" Char:y="3"
+ label="Calculate">
+ <trigger name="trigger" type="ON-ACTION">
+ # FIXME: should not have to manually navigate to current record...
+ dtsFromCurrency.createResultSet ({'gnue_id':
blk.fldFromSymbol.get()})
+ dtsToCurrency.createResultSet ({'gnue_id': blk.fldToSymbol.get ()})
+
+ f = int (blk.fldFromAmount.get ())
+ b = dtsFromCurrency.call ('base_convfrom', {'amount': f})
+ t = dtsToCurrency.call ('base_convto', {'amount': b})
+ blk.fldToAmount.set (t)
+ </trigger>
+ </button>
+ </page>
+ </layout>
+</form>
Property changes on: trunk/gnue-packages/base/currcalc.gfd
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: trunk/gnue-packages/finance/gl.gcd
===================================================================
--- trunk/gnue-packages/finance/gl.gcd 2004-08-24 17:35:13 UTC (rev 6200)
+++ trunk/gnue-packages/finance/gl.gcd 2004-08-24 22:32:03 UTC (rev 6201)
@@ -74,11 +74,11 @@
</class>
<class name="account" comment="General Ledger Account">
- <property name="year" type="gl_year" nullable="False" />
- <property name="number" type="string(17)" nullable="False" />
- <property name="name" type="string(35)" />
- <property name="active" type="boolean" nullable="False" />
- <!-- property name="currency" -->
+ <property name="year" type="gl_year" nullable="False" />
+ <property name="number" type="string(17)" nullable="False" />
+ <property name="name" type="string(35)" />
+ <property name="active" type="boolean" nullable="False" />
+ <property name="currency" type="base_currency" nullable="False" />
<procedure name="OnChange">
<![CDATA[
# TODO: number may not be changed if account was already used
@@ -132,14 +132,14 @@
</class>
<class name="trans" comment="General Ledger Transaction">
- <property name="journal" type="gl_journal" nullable="False" />
- <property name="serial" type="number(6)" comment="Pos. in journal" />
- <property name="source" type="gl_doctype" comment="Document type" />
- <property name="number" type="string(17)" comment="Document number" />
- <property name="date" type="date" comment="Document date" />
- <!-- property name="currency" -->
- <property name="last" type="number(6)" comment="Last entry serial" />
- <property name="balanced" type="boolean" nullable="False">
+ <property name="journal" type="gl_journal" nullable="False" />
+ <property name="serial" type="number(6)" comment="Pos. in journal" />
+ <property name="source" type="gl_doctype" comment="Document type" />
+ <property name="number" type="string(17)" comment="Document number" />
+ <property name="date" type="date" comment="Document date" />
+ <property name="currency" type="base_currency" nullable="False" />
+ <property name="last" type="number(6)" comment="Last entry serial"
/>
+ <property name="balanced" type="boolean" nullable="False">
<![CDATA[
# Find out whether the transaction is balanced
sum = 0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- r6201 - in trunk/gnue-packages: base finance,
reinhard <=