Commit 9e7a6244 authored by Jérome Perrin's avatar Jérome Perrin

improved trial balance


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4730 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7a152191
......@@ -73,6 +73,7 @@
<key> <string>Default</string> </key>
<value>
<list>
<string>from_date</string>
<string>at_date</string>
<string>transaction_section_category</string>
<string>transaction_simulation_state</string>
......
......@@ -78,6 +78,7 @@
<string>my_transaction_section_category</string>
<string>my_from_date</string>
<string>my_at_date</string>
<string>my_expand_accounts</string>
<string>my_portal_skin</string>
</list>
</value>
......
......@@ -70,15 +70,15 @@
if kw.has_key(\'where_expression\'):\n
params[\'where_expression\'] = kw[\'where_expression\']\n
if kw.get(\'resource\'):\n
try: params[\'resource_uid\'] = context.restritedTraverse(selection_params[\'resource\'])\n
except KeyError: pass\n
try: params[\'resource_uid\'] = context.restritedTraverse(selection_params[\'resource\']).getUid()\n
except (KeyError, AttributeError): pass\n
\n
# read settings from user preference\n
preference = context.getPortalObject().portal_preferences\n
from_date = preference.getPreferredAccountingTransactionFromDate()\n
from_date = kw.get(\'from_date\', preference.getPreferredAccountingTransactionFromDate())\n
if from_date :\n
params[\'from_date\'] = from_date\n
at_date = preference.getPreferredAccountingTransactionAtDate()\n
at_date = kw.get(\'at_date\', preference.getPreferredAccountingTransactionAtDate())\n
if at_date :\n
params[\'at_date\'] = at_date\n
simulation_state = preference.getPreferredAccountingTransactionSimulationStateList()\n
......@@ -93,48 +93,84 @@ if kw.get(\'omit_input\') :\n
if kw.get(\'omit_output\') :\n
params[\'omit_output\'] = 1\n
\n
result = context.Account_zGetTotalQuantity(node_uid=context.getUid(), **params)\n
MARKER = []\n
kw = selection.getParams()\n
source_payment_uid = kw.get(\'source_payment_uid\', MARKER)\n
if source_payment_uid is not MARKER:\n
params[\'source_payment_uid\'] = source_payment_uid\n
no_source_payment = kw.get(\'no_source_payment_uid\', MARKER)\n
if no_source_payment is not MARKER:\n
params[\'no_source_payment_uid\'] = 1\n
\n
destination_section_uid = kw.get(\'destination_section_uid\', MARKER)\n
if destination_section_uid is not MARKER:\n
params[\'destination_section_uid\'] = destination_section_uid\n
no_destination_section = kw.get(\'no_destination_section\', MARKER)\n
if no_destination_section is not MARKER:\n
params[\'no_destination_section\'] = 1\n
\n
params[\'node_uid\'] = kw.get(\'node_uid\', context.getUid())\n
\n
if kw.get(\'from_date_summary\', 0) :\n
if params.has_key(\'from_date\'):\n
del params[\'from_date\']\n
\n
#context.log("SQL with %s \\n" % params, context.Account_zGetTotalQuantity(src__=1, **params))\n
result = context.Account_zGetTotalQuantity(**params)\n
row = result[0]\n
return float(\'%.02f\' % (row.quantity or 0.0) )\n
\n
# vim: syntax=python\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value> <string encoding="base64">YwAAAAAAAAAAAQAAAEAAAABzDQAAAGQBAIQAAFoAAGQAAFMoAgAAAE5jAQAAABIAAAAgAAAASwAA
AHMTAgAAaAAAfQIAdAEAfAEAZAEAgwIAZAIAgwEAbx0AAXQDAHwBAGQCAIMCAHQEAHwCAIMBAGQC
ADxuAQABdAEAfAEAZAMAgwIAZAQAgwEAb0YAAXksAHQBAHQFAGQFAIMCAHQDAHQGAGQEAIMCAIMB
AHQEAHwCAIMBAGQGADxXcZUABHQHAGoKAG8HAAEBAQFxlQABWG4BAAF0AQB0AQB0BQBkBwCDAgCD
AABkCACDAgB9CQB0AQB8CQBkCQCDAgCDAAB9CgB8CgBvFAABfAoAdAQAfAIAgwEAZAoAPG4BAAF0
AQB8CQBkCwCDAgCDAAB9CwB8CwBvFAABfAsAdAQAfAIAgwEAZAwAPG4BAAF0AQB8CQBkDQCDAgCD
AAB9DAB8DABvFAABfAwAdAQAfAIAgwEAZA4APG4BAAF0AQB8CQBkDwCDAgCDAAB9DQB8DQBvFAAB
fA0AdAQAfAIAgwEAZBAAPG4BAAF0AQB8AQBkAwCDAgBkEQCDAQBvFAABZBIAdAQAfAIAgwEAZBEA
PG4BAAF0AQB8AQBkAwCDA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AAc1YAAAAJARMBIAETATsBHQMbASQBBwEUASQBBwEUARIBBwEUARIBBwEXAhMBFwETARQCBgES
ARgBDQEUARgBDQEUAhgBDQEUARgBDQEUAjECGQEWARIDGAEPASgBAAAAcxkAAABBY2NvdW50X3N0
YXRTb3VyY2VCYWxhbmNlKAEAAABzGQAAAEFjY291bnRfc3RhdFNvdXJjZUJhbGFuY2UoAAAAACgA
AAAAcw8AAABTY3JpcHQgKFB5dGhvbilzCAAAADxtb2R1bGU+AQAAAHMAAAAA</string> </value>
</item>
<item>
<key> <string>_dav_writelocks</string> </key>
......@@ -191,11 +227,17 @@ ACgAAAAAcw8AAABTY3JpcHQgKFB5dGhvbilzCAAAADxtb2R1bGU+AQAAAHMAAAAA</string> </valu
<string>context</string>
<string>selection_params</string>
<string>KeyError</string>
<string>AttributeError</string>
<string>preference</string>
<string>from_date</string>
<string>at_date</string>
<string>simulation_state</string>
<string>section_category</string>
<string>MARKER</string>
<string>source_payment_uid</string>
<string>no_source_payment</string>
<string>destination_section_uid</string>
<string>no_destination_section</string>
<string>_apply_</string>
<string>result</string>
<string>row</string>
......
......@@ -38,14 +38,42 @@
<dictionary>
<item>
<key> <string>_data</string> </key>
<value>
<dictionary>
<item>
<key> <string>at_date</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>node_uid</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>simulation_state</string> </key>
<value>
<dictionary>
<item>
<key> <string>type</string> </key>
<value> <string>list</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>_keys</string> </key>
<value>
<list/>
<list>
<string>node_uid</string>
<string>at_date</string>
<string>simulation_state</string>
</list>
</value>
</item>
</dictionary>
......@@ -104,7 +132,9 @@
</item>
<item>
<key> <string>arguments_src</string> </key>
<value> <string></string> </value>
<value> <string>node_uid\r\n
at_date\r\n
simulation_state:list</string> </value>
</item>
<item>
<key> <string>cache_time_</string> </key>
......@@ -140,16 +170,34 @@
</item>
<item>
<key> <string>src</string> </key>
<value> <string>SELECT DISTINCT\n
<value> <string encoding="cdata"><![CDATA[
SELECT DISTINCT\n
catalog.uid,\n
catalog.path\n
catalog.path,\n
catalog.relative_url,\n
catalog.title, \n
catalog.portal_type\n
FROM\n
catalog,\n
stock\n
WHERE\n
stock.mirror_section_uid = catalog.uid\n
<dtml-if node_uid>\n
AND stock.node_uid = <dtml-sqlvar node_uid type="string">\n
</dtml-if>\n
<dtml-if at_date>\n
AND stock.date <= <dtml-sqlvar at_date type="datetime">\n
</dtml-if>\n
<dtml-if simulation_state>\n
AND ( <dtml-in simulation_state>\n
stock.simulation_state = <dtml-sqlvar sequence-item type="string"><dtml-unless sequence-end>OR </dtml-unless>\n
</dtml-in> )\n
</dtml-if>\n
ORDER BY\n
catalog.title</string> </value>
catalog.portal_type, catalog.title
]]></string> </value>
</item>
<item>
<key> <string>template</string> </key>
......@@ -183,16 +231,34 @@ ORDER BY\n
</item>
<item>
<key> <string>raw</string> </key>
<value> <string>SELECT DISTINCT\n
<value> <string encoding="cdata"><![CDATA[
SELECT DISTINCT\n
catalog.uid,\n
catalog.path\n
catalog.path,\n
catalog.relative_url,\n
catalog.title, \n
catalog.portal_type\n
FROM\n
catalog,\n
stock\n
WHERE\n
stock.mirror_section_uid = catalog.uid\n
<dtml-if node_uid>\n
AND stock.node_uid = <dtml-sqlvar node_uid type="string">\n
</dtml-if>\n
<dtml-if at_date>\n
AND stock.date <= <dtml-sqlvar at_date type="datetime">\n
</dtml-if>\n
<dtml-if simulation_state>\n
AND ( <dtml-in simulation_state>\n
stock.simulation_state = <dtml-sqlvar sequence-item type="string"><dtml-unless sequence-end>OR </dtml-unless>\n
</dtml-in> )\n
</dtml-if>\n
ORDER BY\n
catalog.title</string> </value>
catalog.portal_type, catalog.title
]]></string> </value>
</item>
</dictionary>
</state>
......
......@@ -46,6 +46,12 @@
<dictionary/>
</value>
</item>
<item>
<key> <string>destination_section_uid</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>from_date</string> </key>
<value>
......@@ -58,6 +64,18 @@
<dictionary/>
</value>
</item>
<item>
<key> <string>no_destination_section_uid</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>no_source_payment_uid</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>omit_input</string> </key>
<value>
......@@ -99,6 +117,12 @@
<dictionary/>
</value>
</item>
<item>
<key> <string>source_payment_uid</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>to_date</string> </key>
<value>
......@@ -148,6 +172,10 @@
<string>at_date</string>
<string>transaction_simulation_state</string>
<string>transaction_section_category</string>
<string>source_payment_uid</string>
<string>no_source_payment_uid</string>
<string>destination_section_uid</string>
<string>no_destination_section_uid</string>
</list>
</value>
</item>
......@@ -188,7 +216,11 @@ from_date\r\n
to_date\r\n
at_date\r\n
transaction_simulation_state:list\r\n
transaction_section_category</string> </value>
transaction_section_category\r\n
source_payment_uid\r\n
no_source_payment_uid\r\n
destination_section_uid\r\n
no_destination_section_uid</string> </value>
</item>
<item>
<key> <string>cache_time_</string> </key>
......@@ -236,14 +268,11 @@ SELECT\n
destination_section.title AS third_party,\n
IF(stock.quantity > 0, stock.quantity, 0.0) AS source_debit,\n
IF(stock.quantity < 0, - stock.quantity, 0.0) AS source_credit,\n
stock.quantity AS source_balance\n
stock.quantity AS source_balance,\n
stock.payment_uid AS source_payment_uid\n
FROM\n
movement,\n
stock\n
LEFT JOIN catalog AS destination_section \n
ON destination_section.uid = stock.mirror_section_uid\n
AND stock.node_uid = <dtml-var getUid>,\n
\n
stock,\n
catalog,\n
catalog AS transaction_line,\n
catalog AS transaction,\n
......@@ -254,9 +283,14 @@ FROM\n
<dtml-if selection_domain>, <dtml-var "selection_domain.asSqlJoinExpression()"> </dtml-if>\n
<dtml-if selection_report>, <dtml-var "selection_report.asSqlJoinExpression()"> </dtml-if>\n
<dtml-if where_expression>, category </dtml-if>\n
\n
LEFT JOIN catalog AS destination_section \n
ON destination_section.uid = stock.mirror_section_uid\n
AND stock.node_uid = <dtml-var getUid>\n
\n
WHERE stock.node_uid = <dtml-var getUid>\n
AND transaction_line.uid = stock.uid \n
AND transaction_line.portal_type <> \'Simulation Movement\'\n
AND transaction_line.parent_uid = transaction.uid\n
AND catalog.uid = stock.section_uid\n
AND movement.uid = stock.uid\n
......@@ -269,13 +303,13 @@ WHERE stock.node_uid = <dtml-var getUid>\n
)\n
</dtml-if>\n
<dtml-if from_date>\n
AND movement.stop_date >= <dtml-sqlvar from_date type="datetime">\n
AND movement.start_date >= <dtml-sqlvar from_date type="datetime">\n
</dtml-if>\n
<dtml-if at_date>\n
AND movement.stop_date <= <dtml-sqlvar at_date type="datetime">\n
AND movement.start_date <= <dtml-sqlvar at_date type="datetime">\n
</dtml-if>\n
<dtml-if to_date>\n
AND movement.stop_date < <dtml-sqlvar to_date type="datetime">\n
AND movement.start_date < <dtml-sqlvar to_date type="datetime">\n
</dtml-if>\n
<dtml-if omit_input>\n
AND stock.quantity < 0\n
......@@ -283,6 +317,18 @@ WHERE stock.node_uid = <dtml-var getUid>\n
<dtml-if omit_output>\n
AND stock.quantity > 0\n
</dtml-if>\n
<dtml-if source_payment_uid>\n
AND stock.payment_uid = <dtml-sqlvar source_payment_uid type="int">\n
</dtml-if>\n
<dtml-if no_source_payment_uid>\n
AND stock.payment_uid IS NULL\n
</dtml-if>\n
<dtml-if destination_section_uid>\n
AND stock.mirror_section_uid = <dtml-sqlvar destination_section_uid type="int">\n
</dtml-if>\n
<dtml-if no_destination_section_uid>\n
AND stock.mirror_section_uid IS NULL\n
</dtml-if>\n
<dtml-if transaction_simulation_state>\n
AND (\n
<dtml-in transaction_simulation_state>\n
......@@ -359,14 +405,11 @@ SELECT\n
destination_section.title AS third_party,\n
IF(stock.quantity > 0, stock.quantity, 0.0) AS source_debit,\n
IF(stock.quantity < 0, - stock.quantity, 0.0) AS source_credit,\n
stock.quantity AS source_balance\n
stock.quantity AS source_balance,\n
stock.payment_uid AS source_payment_uid\n
FROM\n
movement,\n
stock\n
LEFT JOIN catalog AS destination_section \n
ON destination_section.uid = stock.mirror_section_uid\n
AND stock.node_uid = <dtml-var getUid>,\n
\n
stock,\n
catalog,\n
catalog AS transaction_line,\n
catalog AS transaction,\n
......@@ -377,9 +420,14 @@ FROM\n
<dtml-if selection_domain>, <dtml-var "selection_domain.asSqlJoinExpression()"> </dtml-if>\n
<dtml-if selection_report>, <dtml-var "selection_report.asSqlJoinExpression()"> </dtml-if>\n
<dtml-if where_expression>, category </dtml-if>\n
\n
LEFT JOIN catalog AS destination_section \n
ON destination_section.uid = stock.mirror_section_uid\n
AND stock.node_uid = <dtml-var getUid>\n
\n
WHERE stock.node_uid = <dtml-var getUid>\n
AND transaction_line.uid = stock.uid \n
AND transaction_line.portal_type <> \'Simulation Movement\'\n
AND transaction_line.parent_uid = transaction.uid\n
AND catalog.uid = stock.section_uid\n
AND movement.uid = stock.uid\n
......@@ -392,13 +440,13 @@ WHERE stock.node_uid = <dtml-var getUid>\n
)\n
</dtml-if>\n
<dtml-if from_date>\n
AND movement.stop_date >= <dtml-sqlvar from_date type="datetime">\n
AND movement.start_date >= <dtml-sqlvar from_date type="datetime">\n
</dtml-if>\n
<dtml-if at_date>\n
AND movement.stop_date <= <dtml-sqlvar at_date type="datetime">\n
AND movement.start_date <= <dtml-sqlvar at_date type="datetime">\n
</dtml-if>\n
<dtml-if to_date>\n
AND movement.stop_date < <dtml-sqlvar to_date type="datetime">\n
AND movement.start_date < <dtml-sqlvar to_date type="datetime">\n
</dtml-if>\n
<dtml-if omit_input>\n
AND stock.quantity < 0\n
......@@ -406,6 +454,18 @@ WHERE stock.node_uid = <dtml-var getUid>\n
<dtml-if omit_output>\n
AND stock.quantity > 0\n
</dtml-if>\n
<dtml-if source_payment_uid>\n
AND stock.payment_uid = <dtml-sqlvar source_payment_uid type="int">\n
</dtml-if>\n
<dtml-if no_source_payment_uid>\n
AND stock.payment_uid IS NULL\n
</dtml-if>\n
<dtml-if destination_section_uid>\n
AND stock.mirror_section_uid = <dtml-sqlvar destination_section_uid type="int">\n
</dtml-if>\n
<dtml-if no_destination_section_uid>\n
AND stock.mirror_section_uid IS NULL\n
</dtml-if>\n
<dtml-if transaction_simulation_state>\n
AND (\n
<dtml-in transaction_simulation_state>\n
......
......@@ -50,12 +50,30 @@
<dictionary/>
</value>
</item>
<item>
<key> <string>destination_section_uid</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>from_date</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>no_destination_section_uid</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>no_source_payment_uid</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>node_uid</string> </key>
<value>
......@@ -91,6 +109,12 @@
</dictionary>
</value>
</item>
<item>
<key> <string>source_payment_uid</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>to_date</string> </key>
<value>
......@@ -131,6 +155,10 @@
<string>at_date</string>
<string>transaction_simulation_state</string>
<string>transaction_section_category</string>
<string>source_payment_uid</string>
<string>no_source_payment_uid</string>
<string>destination_section_uid</string>
<string>no_destination_section_uid</string>
</list>
</value>
</item>
......@@ -160,9 +188,13 @@ omit_output\r\n
resource_uid:list\r\n
from_date\r\n
to_date\r\n
at_date\n
at_date\r\n
transaction_simulation_state:list\r\n
transaction_section_category</string> </value>
transaction_section_category\r\n
source_payment_uid\r\n
no_source_payment_uid\r\n
destination_section_uid\r\n
no_destination_section_uid</string> </value>
</item>
<item>
<key> <string>cache_time_</string> </key>
......@@ -220,6 +252,7 @@ WHERE stock.node_uid = <dtml-var node_uid>\n
AND child.uid = stock.uid \n
AND child.parent_uid = catalog.uid\n
AND movement.uid = stock.uid\n
AND child.portal_type <> \'Simulation Movement\'\n
AND movement.is_accountable = 1\n
<dtml-if resource_uid>\n
AND (\n
......@@ -243,6 +276,18 @@ WHERE stock.node_uid = <dtml-var node_uid>\n
<dtml-if omit_output>\n
AND stock.quantity < 0.0\n
</dtml-if>\n
<dtml-if source_payment_uid>\n
AND stock.payment_uid = <dtml-sqlvar source_payment_uid type="int">\n
</dtml-if>\n
<dtml-if no_source_payment_uid>\n
AND stock.payment_uid IS NULL\n
</dtml-if>\n
<dtml-if destination_section_uid>\n
AND stock.mirror_section_uid = <dtml-sqlvar destination_section_uid type="int">\n
</dtml-if>\n
<dtml-if no_destination_section_uid>\n
AND stock.mirror_section_uid IS NULL\n
</dtml-if>\n
<dtml-if transaction_simulation_state>\n
AND (\n
<dtml-in transaction_simulation_state>\n
......@@ -320,6 +365,7 @@ WHERE stock.node_uid = <dtml-var node_uid>\n
AND child.uid = stock.uid \n
AND child.parent_uid = catalog.uid\n
AND movement.uid = stock.uid\n
AND child.portal_type <> \'Simulation Movement\'\n
AND movement.is_accountable = 1\n
<dtml-if resource_uid>\n
AND (\n
......@@ -343,6 +389,18 @@ WHERE stock.node_uid = <dtml-var node_uid>\n
<dtml-if omit_output>\n
AND stock.quantity < 0.0\n
</dtml-if>\n
<dtml-if source_payment_uid>\n
AND stock.payment_uid = <dtml-sqlvar source_payment_uid type="int">\n
</dtml-if>\n
<dtml-if no_source_payment_uid>\n
AND stock.payment_uid IS NULL\n
</dtml-if>\n
<dtml-if destination_section_uid>\n
AND stock.mirror_section_uid = <dtml-sqlvar destination_section_uid type="int">\n
</dtml-if>\n
<dtml-if no_destination_section_uid>\n
AND stock.mirror_section_uid IS NULL\n
</dtml-if>\n
<dtml-if transaction_simulation_state>\n
AND (\n
<dtml-in transaction_simulation_state>\n
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment