[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue-luca] r26 - in trunk/modules: base finance
From: |
reinhard |
Subject: |
[gnue-luca] r26 - in trunk/modules: base finance |
Date: |
Wed, 7 Mar 2007 04:15:09 -0600 (CST) |
Author: reinhard
Date: 2007-03-07 04:15:09 -0600 (Wed, 07 Mar 2007)
New Revision: 26
Modified:
trunk/modules/base/base.gcd
trunk/modules/base/currcalc.gfd
trunk/modules/finance/acc-main.gfd
trunk/modules/finance/gl.gcd
Log:
More work.
Modified: trunk/modules/base/base.gcd
===================================================================
--- trunk/modules/base/base.gcd 2007-03-01 20:23:36 UTC (rev 25)
+++ trunk/modules/base/base.gcd 2007-03-07 10:15:09 UTC (rev 26)
@@ -25,22 +25,22 @@
<module name="base" comment="Basic classes">
<class name="company">
- <property name="code" type="string(8)" nullable="False" />
- <property name="name" type="string(35)" />
+ <property name="code" type="string(8)" nullable="N"/>
+ <property name="name" type="string(32)" />
</class>
<class name="currency" filter="base_company">
- <property name="code" type="string(8)" nullable="False" />
- <property name="name" type="string(35)" />
- <property name="roundunit" type="number(14,2)" nullable="False" />
+ <property name="code" type="string(8)" nullable="N"/>
+ <property name="name" type="string(32)" />
+ <property name="roundunit" type="number(16,2)" nullable="N"/>
<!-- Conversion factors to base currency -->
<!-- Example: convbase = 100, convthis = 1376.03 means 100 units of base
currency are 1376.03 units of this currency -->
- <property name="convbase" type="number(14,2)" nullable="False" />
- <property name="convthis" type="number(14,2)" nullable="False" />
+ <property name="convbase" type="number(16,2)" nullable="N"/>
+ <property name="convthis" type="number(16,2)" nullable="N"/>
- <procedure name="round" type="number(14,2)">
- <parameter name="amount" type="number(14,2)" />
+ <procedure name="round" type="number(16,2)">
+ <parameter name="amount" type="number(16,2)" />
<![CDATA[
# Round given amount
ru = self.roundunit or 0.01
@@ -52,8 +52,8 @@
]]>
</procedure>
- <procedure name="convfrom" type="number(14,2)">
- <parameter name="amount" type="number(14,2)" />
+ <procedure name="convfrom" type="number(16,2)">
+ <parameter name="amount" type="number(16,2)" />
<![CDATA[
# Convert amount given in this currency to base currency
cb = self.convbase or 1
@@ -66,8 +66,8 @@
]]>
</procedure>
- <procedure name="convto" type="number(14,2)">
- <parameter name="amount" type="number(14,2)" />
+ <procedure name="convto" type="number(16,2)">
+ <parameter name="amount" type="number(16,2)" />
<![CDATA[
# Convert amount given in base currency to this currency
cb = self.convbase or 1
Modified: trunk/modules/base/currcalc.gfd
===================================================================
--- trunk/modules/base/currcalc.gfd 2007-03-01 20:23:36 UTC (rev 25)
+++ trunk/modules/base/currcalc.gfd 2007-03-07 10:15:09 UTC (rev 26)
@@ -32,10 +32,10 @@
<block name="blk">
<field name="fld_from_code" datatype="text" length="8"
fk_source="dts_from" fk_key="gnue_id"
fk_description="base_code"/>
- <field name="fld_from_amount" datatype="number" length="14" scale="2"/>
+ <field name="fld_from_amount" datatype="number" length="16" scale="2"/>
<field name="fld_to_code" datatype="text" length="8" fk_source="dts_to"
fk_key="gnue_id"
fk_description="base_code"/>
- <field name="fld_to_amount" datatype="number" length="14" scale="2"
editable="N"/>
+ <field name="fld_to_amount" datatype="number" length="16" scale="2"
editable="N"/>
</block>
<block name="blk_from" datasource="dts_from"/>
<block name="blk_to" datasource="dts_to"/>
Modified: trunk/modules/finance/acc-main.gfd
===================================================================
--- trunk/modules/finance/acc-main.gfd 2007-03-01 20:23:36 UTC (rev 25)
+++ trunk/modules/finance/acc-main.gfd 2007-03-07 10:15:09 UTC (rev 26)
@@ -29,33 +29,63 @@
<!-- Lookup Datasources -->
<!-- ==================================================================== -->
- <datasource name="dts_lkp_period" connection="appserver" table="gl_period"
- prequery="Y">
+ <datasource name="dts_lkp_period" connection="appserver" table="gl_period"
prequery="Y">
<condition>
<eq><cfield name="gl_active"/><cconst value="1"/></eq>
</condition>
+ <sortorder>
+ <sortfield name="gl_start"/>
+ </sortorder>
</datasource>
- <datasource name="dts_lkp_doctype" connection="appserver" table="gl_doctype"
- prequery="Y"/>
+ <datasource name="dts_lkp_doctype" connection="appserver" table="gl_doctype"
prequery="Y">
+ <sortorder>
+ <sortfield name="gl_code"/>
+ </sortorder>
+ </datasource>
- <datasource name="dts_lkp_credit" connection="appserver" table="gl_account"
- prequery="Y">
+ <datasource name="dts_lkp_credit_number" connection="appserver"
table="gl_account" prequery="Y">
<condition>
<eq><cfield name="gl_active"/><cconst value="1"/></eq>
</condition>
+ <sortorder>
+ <sortfield name="gl_number"/>
+ </sortorder>
</datasource>
- <datasource name="dts_lkp_debit" connection="appserver" table="gl_account"
- prequery="Y">
+ <datasource name="dts_lkp_credit_name" connection="appserver"
table="gl_account" prequery="Y">
<condition>
<eq><cfield name="gl_active"/><cconst value="1"/></eq>
</condition>
+ <sortorder>
+ <sortfield name="gl_name"/>
+ </sortorder>
</datasource>
- <datasource name="dts_lkp_currency" connection="appserver"
- table="base_currency" prequery="Y"/>
+ <datasource name="dts_lkp_debit_number" connection="appserver"
table="gl_account" prequery="Y">
+ <condition>
+ <eq><cfield name="gl_active"/><cconst value="1"/></eq>
+ </condition>
+ <sortorder>
+ <sortfield name="gl_number"/>
+ </sortorder>
+ </datasource>
+ <datasource name="dts_lkp_debit_name" connection="appserver"
table="gl_account" prequery="Y">
+ <condition>
+ <eq><cfield name="gl_active"/><cconst value="1"/></eq>
+ </condition>
+ <sortorder>
+ <sortfield name="gl_name"/>
+ </sortorder>
+ </datasource>
+
+ <datasource name="dts_lkp_currency" connection="appserver"
table="base_currency" prequery="Y">
+ <sortorder>
+ <sortfield name="base_code"/>
+ </sortorder>
+ </datasource>
+
<!-- ==================================================================== -->
<!-- Main Datasources -->
<!-- ==================================================================== -->
@@ -67,7 +97,7 @@
<datasource name="dts_batchitem" connection="appserver" table="gl_batchitem"
master="dts_batch" masterlink="gnue_id" detaillink="gl_batch">
<sortorder>
- <sortfield name="gl_serial" />
+ <sortfield name="gl_serial"/>
</sortorder>
</datasource>
@@ -92,22 +122,22 @@
<block name="blk_period" datasource="dts_lkp_period"/>
- <block name="blk_batch" datasource="dts_batch">
- <field name="fld_serial" field="gl_serial" datatype="number" length="6"
scale="0" editable="N"/>
+ <block name="blk_batch" datasource="dts_batch" editable="N" deletable="N">
+ <field name="fld_serial" field="gl_serial" datatype="number" length="6"
scale="0"/>
</block>
<block name="blk_batchitem" datasource="dts_batchitem" autoCommit="Y"
autoNextRecord="Y">
- <field name="fld_number" field="gl_number" datatype="text"
length="17" scale="0"/>
- <field name="fld_date" field="gl_date" datatype="date"/>
- <field name="fld_amountt" field="gl_amountt" datatype="number"
length="14" scale="2"/>
+ <field name="fld_doctype" field="gl_doctype" datatype="text"
length="8" fk_source="dts_lkp_doctype" fk_key="gnue_id"
fk_description="gl_code"/>
+ <field name="fld_number" field="gl_number" datatype="text"
length="16"/>
+ <field name="fld_date" field="gl_date" datatype="date"/>
+ <field name="fld_credit_number" field="gl_credit" datatype="text"
length="16" fk_source="dts_lkp_credit_number" fk_key="gnue_id"
fk_description="gl_number"/>
+ <field name="fld_credit_name" field="gl_credit" datatype="text"
length="32" fk_source="dts_lkp_credit_name" fk_key="gnue_id"
fk_description="gl_name"/>
+ <field name="fld_debit_number" field="gl_debit" datatype="text"
length="16" fk_source="dts_lkp_debit_number" fk_key="gnue_id"
fk_description="gl_number"/>
+ <field name="fld_debit_name" field="gl_debit" datatype="text"
length="32" fk_source="dts_lkp_debit_name" fk_key="gnue_id"
fk_description="gl_name"/>
+ <field name="fld_currency" field="gl_currency" datatype="text"
length="8" fk_source="dts_lkp_currency" fk_key="gnue_id"
fk_description="base_code"/>
+ <field name="fld_amountt" field="gl_amountt" datatype="number"
length="16" scale="2"/>
<field name="fld_empty"/>
- <field name="fld_comment" field="gl_comment"/>
- <field name="fld_doctype" field="gl_doctype"
fk_source="dts_lkp_doctype" fk_key="gnue_id" fk_description="gl_code"/>
- <field name="fld_credit_number" field="gl_credit"
fk_source="dts_lkp_credit" fk_key="gnue_id" fk_description="gl_number"/>
- <field name="fld_credit_name" field="gl_credit"
fk_source="dts_lkp_credit" fk_key="gnue_id" fk_description="gl_name"/>
- <field name="fld_debit_number" field="gl_debit"
fk_source="dts_lkp_debit" fk_key="gnue_id" fk_description="gl_number"/>
- <field name="fld_debit_name" field="gl_debit"
fk_source="dts_lkp_debit" fk_key="gnue_id" fk_description="gl_name"/>
- <field name="fld_currency" field="gl_currency"
fk_source="dts_lkp_currency" fk_key="gnue_id" fk_description="base_code"/>
+ <field name="fld_comment" field="gl_comment"/>
</block>
</logic>
@@ -115,7 +145,7 @@
<page name="page">
<vbox>
<entry name="ent_period" label="Period:" block="blk"
field="fld_period"/>
- <entry name="ent_batch" label="Batch:" block="blk_batch"
field="fld_serial"/>
+ <entry name="ent_batch" label="Batch:" block="blk_batch"
field="fld_serial" navigable="N"/>
<grid block="blk_batchitem" rows="10">
<gridline>
@@ -130,8 +160,8 @@
<entry name="ent_amountt" label="Amount"
field="fld_amountt"/>
</gridline>
<gridline>
- <entry name="ent_empty" field="fld_empty" style="label"
s:span="3"/>
- <entry name="ent_comment"
field="fld_comment" s:span="6"/>
+ <entry name="ent_empty"
field="fld_empty" style="label" s:span="3"/>
+ <entry name="ent_comment" label="Comment"
field="fld_comment" s:span="6"/>
</gridline>
</grid>
</vbox>
Modified: trunk/modules/finance/gl.gcd
===================================================================
--- trunk/modules/finance/gl.gcd 2007-03-01 20:23:36 UTC (rev 25)
+++ trunk/modules/finance/gl.gcd 2007-03-07 10:15:09 UTC (rev 26)
@@ -30,12 +30,12 @@
<!-- =================================================================== -->
<class name="year" filter="base_company" comment="Fiscal year">
- <property name="name" type="string(17)" nullable="False" />
- <property name="start" type="date" nullable="False" />
- <property name="end" type="date" nullable="False" />
+ <property name="name" type="string(16)" nullable="N"/>
+ <property name="start" type="date" nullable="N"/>
+ <property name="end" type="date" nullable="N"/>
<property name="previous" type="gl_year" />
- <property name="active" type="boolean" nullable="False" />
- <property name="last" type="number(6)" comment="Last journal serial"
/>
+ <property name="active" type="boolean" nullable="N"/>
+ <property name="last" type="number(8)" comment="Last journal serial"/>
<procedure name="OnInit">
<![CDATA[
self.active = True
@@ -49,7 +49,7 @@
# if self.active is set to False, set all periods to inactive, too
if propertyName == 'gl_active' and newValue == False:
- periods = find ('gl_period', conditions = {'gl_year': self.gnue_id})
+ periods = find('gl_period', conditions={'gl_year': self.gnue_id})
for period in periods:
period.active = False
]]>
@@ -62,15 +62,15 @@
# TODO: check: self.previous.end + 1day = self.start
# generate accounting periods
- if not find ('gl_period', conditions = {'gl_year': self.gnue_id}):
+ if not find('gl_period', conditions={'gl_year': self.gnue_id}):
import mx.DateTime
start = self.start
while start < self.end:
- startnext = start + mx.DateTime.RelativeDate (months = 1)
- end = startnext - mx.DateTime.RelativeDate (days = 1)
- period = new ('gl_period')
+ startnext = start + mx.DateTime.RelativeDate(months = 1)
+ end = startnext - mx.DateTime.RelativeDate(days = 1)
+ period = new('gl_period')
period.year = self.gnue_id
- period.name = start.strftime ('%Y-%m')
+ period.name = start.strftime('%Y-%m')
period.start = start
period.end = end
start = startnext
@@ -81,11 +81,11 @@
<class name="period" filter="base_company" comment="Accouning period">
<!-- Can't set year as filter, otherwise gl_year.OnValidate couldn't
generate the periods -->
- <property name="year" type="gl_year" nullable="False" />
- <property name="name" type="string(17)" nullable="False" />
- <property name="start" type="date" nullable="False" />
- <property name="end" type="date" nullable="False" />
- <property name="active" type="boolean" nullable="False" />
+ <property name="year" type="gl_year" nullable="N"/>
+ <property name="name" type="string(16)" nullable="N"/>
+ <property name="start" type="date" nullable="N"/>
+ <property name="end" type="date" nullable="N"/>
+ <property name="active" type="boolean" nullable="N"/>
<procedure name="OnInit">
<![CDATA[
self.active = True
@@ -109,10 +109,10 @@
</class>
<class name="account" filter="gl_year" comment="General Ledger Account">
- <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" />
+ <property name="number" type="string(16)" nullable="N"/>
+ <property name="name" type="string(32)" />
+ <property name="active" type="boolean" nullable="N"/>
+ <property name="currency" type="base_currency" nullable="N"/>
<procedure name="OnInit">
<![CDATA[
self.active = True
@@ -126,8 +126,8 @@
</class>
<class name="doctype" filter="gl_year" comment="Document type">
- <property name="code" type="string(8)" nullable="False" />
- <property name="name" type="string(35)" />
+ <property name="code" type="string(8)" nullable="N"/>
+ <property name="name" type="string(32)" />
<!-- This account will be used automatically, e.g. bank account -->
<property name="account" type="gl_account" />
</class>
@@ -137,13 +137,13 @@
<!-- =================================================================== -->
<class name="journal" filter="gl_year" comment="General Ledger Journal">
- <property name="period" type="gl_period" nullable="False" />
- <property name="serial" type="number(6)" />
- <property name="last" type="number(6)" comment="Last transact serial"
/>
- <property name="balanced" type="boolean" nullable="False">
+ <property name="period" type="gl_period" nullable="N"/>
+ <property name="serial" type="number(8)" />
+ <property name="last" type="number(8)" comment="Last transact serial"/>
+ <property name="balanced" type="boolean" nullable="N">
<![CDATA[
# Find out whether the journal is balanced
- for trans in find ('trans', conditions = {'gl_journal': self}):
+ for trans in find('trans', conditions={'gl_journal': self}):
if not trans.gl_balanced:
return False
return True
@@ -155,8 +155,8 @@
# Post the journal, which means it will not be changeable any more
import mx.DateTime
if not self.balanced:
- abort (message ('journalImbalanced'))
- self.posted = mx.DateTime.now () # Should probably be a parameter
+ abort(message('journalImbalanced'))
+ self.posted = mx.DateTime.now() # Should probably be a parameter
]]>
</procedure>
<procedure name="OnInit">
@@ -167,7 +167,7 @@
<procedure name="OnValidate">
<![CDATA[
if not self.period.active:
- abort (message ('periodInactive'))
+ abort(message('periodInactive'))
if not self.serial:
self.period.year.last += 1
self.serial = self.period.year.last
@@ -176,19 +176,19 @@
</class>
<class name="trans" filter="gl_year" comment="General Ledger Transaction">
- <property name="journal" type="gl_journal" nullable="False" />
- <property name="serial" type="number(6)" comment="Pos. in journal" />
- <property name="doctype" 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">
+ <property name="journal" type="gl_journal" nullable="N"/>
+ <property name="serial" type="number(8)" comment="Pos. in journal"/>
+ <property name="doctype" type="gl_doctype" comment="Document type"/>
+ <property name="number" type="string(16)" comment="Document number"/>
+ <property name="date" type="date" comment="Document date"/>
+ <property name="currency" type="base_currency" nullable="N"/>
+ <property name="last" type="number(8)" comment="Last entry
serial"/>
+ <property name="balanced" type="boolean" nullable="N">
<![CDATA[
# Find out whether the transaction is balanced
sum = 0
- for entry in find ('entry', conditions = {'gl_trans': self},
- properties = ['gl_credit', 'amountt']):
+ for entry in find('entry', conditions={'gl_trans': self},
+ properties=['gl_credit', 'amountt']):
if entry.credit:
sum -= entry.amountt
else:
@@ -198,14 +198,14 @@
</property>
<procedure name="OnInit">
<![CDATA[
- self.currency = (find ('base_parameters') [0]).base_currency
+ self.currency = (find('base_parameters')[0]).base_currency
]]>
</procedure>
<procedure name="OnValidate">
<![CDATA[
# Find out whether the transaction can be entered
if self.journal.posted:
- abort (message ('journalPosted'))
+ abort(message('journalPosted'))
if not self.serial:
self.journal.last += 1
self.serial = self.journal.last
@@ -215,21 +215,21 @@
</class>
<class name="entry" filter="gl_year" comment="General Ledger Entry">
- <property name="trans" type="gl_trans" nullable="False" />
- <property name="serial" type="number(6)" comment="Pos. in transaction"
/>
- <property name="account" type="gl_account" nullable="False" />
- <property name="credit" type="boolean" nullable="False" />
- <property name="amountt" type="number(14,2)" comment="in transact
currency" />
- <property name="amounta" type="number(14,2)" comment="in account currency"
/>
- <property name="amountb" type="number(14,2)" comment="in base currency" />
- <property name="comment" type="string(70)" />
+ <property name="trans" type="gl_trans" nullable="N"/>
+ <property name="serial" type="number(8)" comment="Pos. in
transaction"/>
+ <property name="account" type="gl_account" nullable="N"/>
+ <property name="credit" type="boolean" nullable="N"/>
+ <property name="amountt" type="number(16,2)" comment="in transact
currency"/>
+ <property name="amounta" type="number(16,2)" comment="in account
currency"/>
+ <property name="amountb" type="number(16,2)" comment="in base currency"/>
+ <property name="comment" type="string(64)" />
<procedure name="OnValidate">
<![CDATA[
# Find out whether the entry is valid
if not self.account.active
- abort (message ('accountInactive'))
- self.amountb = self.trans.currency.convfrom (amount = self.amountt)
- self.amounta = self.account.currency.convto (amount = self.amountt)
+ abort(message('accountInactive'))
+ self.amountb = self.trans.currency.convfrom(amount=self.amountt)
+ self.amounta = self.account.currency.convto(amount=self.amountt)
if not self.serial:
self.trans.last += 1
self.serial = self.trans.last
@@ -242,13 +242,13 @@
<!-- =================================================================== -->
<class name="batch" filter="gl_year" comment="General Ledger Batch">
- <property name="period" type="gl_period" nullable="False" />
- <property name="serial" type="number(6)" />
- <property name="last" type="number(6)" comment="Last item serial" />
- <property name="balanced" type="boolean" nullable="False">
+ <property name="period" type="gl_period" nullable="N"/>
+ <property name="serial" type="number(8)" />
+ <property name="last" type="number(8)" comment="Last item serial"/>
+ <property name="balanced" type="boolean" nullable="N">
<![CDATA[
# Find out whether the batch is balanced
- # for item in find ('batchitem', conditions = {'gl_batch': self}):
+ # for item in find('batchitem', conditions={'gl_batch': self}):
# if not item.gl_balanced:
# return False
return True
@@ -257,7 +257,7 @@
<procedure name="post">
<![CDATA[
if not self.balanced:
- abort (message ('journalImbalanced'))
+ abort(message('journalImbalanced'))
# here goes the code...
]]>
</procedure>
@@ -269,7 +269,7 @@
<procedure name="OnValidate">
<![CDATA[
if not self.period.active:
- abort (message ('periodInactive'))
+ abort(message('periodInactive'))
if not self.serial:
self.period.year.last += 1
self.serial = self.period.year.last
@@ -278,19 +278,19 @@
</class>
<class name="batchitem" filter="gl_year" comment="General Ledger Batch Item">
- <property name="batch" type="gl_batch" nullable="False" />
- <property name="serial" type="number(6)" comment="Pos. in batch" />
- <property name="doctype" 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="batch" type="gl_batch" nullable="N"/>
+ <property name="serial" type="number(8)" comment="Pos. in batch"/>
+ <property name="doctype" type="gl_doctype" comment="Document type"/>
+ <property name="number" type="string(16)" comment="Document number"/>
+ <property name="date" type="date" comment="Document date"/>
+ <property name="currency" type="base_currency" nullable="N"/>
<property name="credit" type="gl_account" />
<property name="debit" type="gl_account" />
- <property name="amountt" type="number(14,2)" />
- <property name="comment" type="string(70)" />
+ <property name="amountt" type="number(16,2)" />
+ <property name="comment" type="string(64)" />
<procedure name="OnInit">
<![CDATA[
- self.currency = (find ('base_parameters') [0]).base_currency
+ self.currency = (find('base_parameters')[0]).base_currency
]]>
</procedure>
<procedure name="OnValidate">
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue-luca] r26 - in trunk/modules: base finance,
reinhard <=