[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [1501] branches/1.2/LedgerSMB/IR.pm
- Subject: SF.net SVN: ledger-smb: [1501] branches/1.2/LedgerSMB/IR.pm
- From: ..hidden..
- Date: Sun, 02 Sep 2007 00:02:25 -0700
Revision: 1501
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1501&view=rev
Author: einhverfr
Date: 2007-09-02 00:02:25 -0700 (Sun, 02 Sep 2007)
Log Message:
-----------
Correcting bug 1753372: COGS posts to closed dates when books closed after sales invoice issued.
Modified Paths:
--------------
branches/1.2/LedgerSMB/IR.pm
Modified: branches/1.2/LedgerSMB/IR.pm
===================================================================
--- branches/1.2/LedgerSMB/IR.pm 2007-09-02 06:31:25 UTC (rev 1500)
+++ branches/1.2/LedgerSMB/IR.pm 2007-09-02 07:02:25 UTC (rev 1501)
@@ -371,39 +371,52 @@
if ($linetotal) {
$query = qq|
- INSERT INTO acc_trans
- (trans_id,
- chart_id,
- amount,
- transdate,
- project_id,
- invoice_id)
- VALUES (?, ?, ?, ?,
- ?, ?)|;
+ INSERT INTO acc_trans
+ (trans_id,
+ chart_id,
+ amount,
+ project_id,
+ invoice_id,
+ transdate)
+ VALUES (?, ?, ?, ?,
+ ?, (SELECT CASE WHEN ? > value::date
+ THEN ?
+ ELSE value::date +
+ '1 day'::interval
+ END AS value
+ FROM defaults
+ WHERE setting_key = 'closedto'
+ ))|;
my $sth = $dbh->prepare($query);
$sth->execute(
$ref->{trans_id}, $ref->{inventory_accno_id},
- $linetotal, $ref->{transdate},
- $ref->{project_id}, $invoice_id
+ $linetotal,
+ $ref->{project_id}, $invoice_id,
+ $ref->{transdate}, $ref->{transdate},
) || $form->dberror($query);
# add expense
$query = qq|
- INSERT INTO acc_trans
- (trans_id,
- chart_id,
- amount,
- transdate,
- project_id,
- invoice_id)
- VALUES (?, ?, ?, ?,
- ?, ?)|;
+ INSERT INTO acc_trans
+ (trans_id, chart_id, amount,
+ project_id, invoice_id,
+ transdate)
+ VALUES (?, ?, ?, ?,
+ ?, (SELECT CASE WHEN ? > value::date
+ THEN ?
+ ELSE value::date +
+ '1 day'::interval
+ END AS value
+ FROM defaults
+ WHERE setting_key = 'closedto'
+ ))|;
$sth = $dbh->prepare($query);
$sth->execute(
$ref->{trans_id}, $ref->{expense_accno_id},
- $linetotal * -1, $ref->{transdate},
- $ref->{project_id}, $invoice_id
+ $linetotal * -1,
+ $ref->{project_id}, $invoice_id,
+ $ref->{transdate}, $ref->{transdate},
) || $form->dberror($query);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.