Dieser Commit entfernt lediglich Leerzeichen am Ende der Zeilen.
$query =
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, tax_id, chart_link) | .
qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, | .
- qq| (SELECT taxkey_id FROM chart WHERE accno = ?),| .
- qq| (SELECT tax_id| .
- qq| FROM taxkeys| .
- qq| WHERE chart_id= (SELECT id | .
- qq| FROM chart| .
- qq| WHERE accno = ?)| .
- qq| AND startdate <= ?| .
+ qq| (SELECT taxkey_id FROM chart WHERE accno = ?),| .
+ qq| (SELECT tax_id| .
+ qq| FROM taxkeys| .
+ qq| WHERE chart_id= (SELECT id | .
+ qq| FROM chart| .
+ qq| WHERE accno = ?)| .
+ qq| AND startdate <= ?| .
qq| ORDER BY startdate DESC LIMIT 1),| .
qq| (SELECT c.link FROM chart c WHERE c.accno = ?))|;
@values = ($form->{id}, $form->{AP_amounts}{payables}, $form->{payables},
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey, tax_id, chart_link) | .
qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, | .
qq| (SELECT taxkey_id FROM chart WHERE accno = ?),| .
- qq| (SELECT tax_id| .
- qq| FROM taxkeys| .
- qq| WHERE chart_id= (SELECT id | .
- qq| FROM chart| .
- qq| WHERE accno = ?)| .
- qq| AND startdate <= ?| .
+ qq| (SELECT tax_id| .
+ qq| FROM taxkeys| .
+ qq| WHERE chart_id= (SELECT id | .
+ qq| FROM chart| .
+ qq| WHERE accno = ?)| .
+ qq| AND startdate <= ?| .
qq| ORDER BY startdate DESC LIMIT 1),| .
qq| (SELECT c.link FROM chart c WHERE c.accno = ?))|;
@values = ($form->{id}, $form->{AP_payables}, $amount,
$query =
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, gldate, source, memo, project_id, taxkey, tax_id, chart_link) | .
qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?, ?, ?, | .
- qq| (SELECT taxkey_id FROM chart WHERE accno = ?), | .
+ qq| (SELECT taxkey_id FROM chart WHERE accno = ?), | .
qq| (SELECT tax_id| .
- qq| FROM taxkeys| .
- qq| WHERE chart_id= (SELECT id | .
- qq| FROM chart| .
- qq| WHERE accno = ?)| .
- qq| AND startdate <= ?| .
+ qq| FROM taxkeys| .
+ qq| WHERE chart_id= (SELECT id | .
+ qq| FROM chart| .
+ qq| WHERE accno = ?)| .
+ qq| AND startdate <= ?| .
qq| ORDER BY startdate DESC LIMIT 1),| .
qq| (SELECT c.link FROM chart c WHERE c.accno = ?))|;
@values = ($form->{id}, $form->{"AP_paid_account_$i"}, $form->{"paid_$i"},
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared, project_id, taxkey, tax_id, chart_link) | .
qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, 't', 'f', ?, | .
qq| (SELECT taxkey_id FROM chart WHERE accno = ?), | .
- qq| (SELECT tax_id| .
- qq| FROM taxkeys| .
- qq| WHERE chart_id= (SELECT id | .
- qq| FROM chart| .
- qq| WHERE accno = ?)| .
- qq| AND startdate <= ?| .
+ qq| (SELECT tax_id| .
+ qq| FROM taxkeys| .
+ qq| WHERE chart_id= (SELECT id | .
+ qq| FROM chart| .
+ qq| WHERE accno = ?)| .
+ qq| AND startdate <= ?| .
qq| ORDER BY startdate DESC LIMIT 1),| .
qq| (SELECT c.link FROM chart c WHERE c.accno = ?))|;
@values = ($form->{id}, $form->{"AP_paid_account_$i"}, $amount,
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared, project_id, taxkey, tax_id, chart_link) | .
qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, 't', 'f', ?, | .
qq| (SELECT taxkey_id FROM chart WHERE accno = ?)| .
- qq| (SELECT tax_id| .
- qq| FROM taxkeys| .
- qq| WHERE chart_id= (SELECT id | .
- qq| FROM chart| .
- qq| WHERE accno = ?)| .
- qq| AND startdate <= ?| .
+ qq| (SELECT tax_id| .
+ qq| FROM taxkeys| .
+ qq| WHERE chart_id= (SELECT id | .
+ qq| FROM chart| .
+ qq| WHERE accno = ?)| .
+ qq| AND startdate <= ?| .
qq| ORDER BY startdate DESC LIMIT 1),| .
qq| (SELECT c.link FROM chart c WHERE c.accno = ?))|;
- @values = ($form->{id},
+ @values = ($form->{id},
($amount > 0) ? $form->{fxgain_accno} : $form->{fxloss_accno},
$amount, conv_date($form->{"datepaid_$i"}), $project_id,
($amount > 0) ? $form->{fxgain_accno} : $form->{fxloss_accno},
# add recievables
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, tax_id, chart_link)
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, (SELECT taxkey_id FROM chart WHERE accno = ?),
- (SELECT tax_id
- FROM taxkeys
- WHERE chart_id= (SELECT id
- FROM chart
- WHERE accno = ?)
- AND startdate <= ?
+ (SELECT tax_id
+ FROM taxkeys
+ WHERE chart_id= (SELECT id
+ FROM chart
+ WHERE accno = ?)
+ AND startdate <= ?
ORDER BY startdate DESC LIMIT 1),
(SELECT c.link FROM chart c WHERE c.accno = ?))|;
@values = (conv_i($form->{id}), $form->{AR_amounts}{receivables}, conv_i($form->{receivables}), conv_date($form->{transdate}),
# add receivable
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey, tax_id, chart_link)
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, (SELECT taxkey_id FROM chart WHERE accno = ?),
- (SELECT tax_id
- FROM taxkeys
- WHERE chart_id= (SELECT id
- FROM chart
- WHERE accno = ?)
- AND startdate <= ?
+ (SELECT tax_id
+ FROM taxkeys
+ WHERE chart_id= (SELECT id
+ FROM chart
+ WHERE accno = ?)
+ AND startdate <= ?
ORDER BY startdate DESC LIMIT 1),
(SELECT c.link FROM chart c WHERE c.accno = ?))|;
@values = (conv_i($form->{id}), $form->{AR}{receivables}, $amount, conv_date($form->{"datepaid_$i"}), $project_id, $form->{AR}{receivables}, $form->{AR}{receivables}, conv_date($form->{"datepaid_$i"}),
$amount = $form->{"paid_$i"} * -1;
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, gldate, source, memo, project_id, taxkey, tax_id, chart_link)
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?, ?, ?, (SELECT taxkey_id FROM chart WHERE accno = ?),
- (SELECT tax_id
- FROM taxkeys
- WHERE chart_id= (SELECT id
- FROM chart
- WHERE accno = ?)
- AND startdate <= ?
+ (SELECT tax_id
+ FROM taxkeys
+ WHERE chart_id= (SELECT id
+ FROM chart
+ WHERE accno = ?)
+ AND startdate <= ?
ORDER BY startdate DESC LIMIT 1),
(SELECT c.link FROM chart c WHERE c.accno = ?))|;
@values = (conv_i($form->{id}), $form->{AR}{"paid_$i"}, $amount, conv_date($form->{"datepaid_$i"}), $gldate, $form->{"source_$i"}, $form->{"memo_$i"}, $project_id, $form->{AR}{"paid_$i"},
if ($amount != 0) {
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared, project_id, taxkey, tax_id, chart_link)
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, 't', 'f', ?, (SELECT taxkey_id FROM chart WHERE accno = ?),
- (SELECT tax_id
- FROM taxkeys
- WHERE chart_id= (SELECT id
- FROM chart
- WHERE accno = ?)
- AND startdate <= ?
+ (SELECT tax_id
+ FROM taxkeys
+ WHERE chart_id= (SELECT id
+ FROM chart
+ WHERE accno = ?)
+ AND startdate <= ?
ORDER BY startdate DESC LIMIT 1),
(SELECT c.link FROM chart c WHERE c.accno = ?))|;
@values = (conv_i($form->{id}), $form->{AR}{"paid_$i"}, $amount, conv_date($form->{"datepaid_$i"}), $project_id, $form->{AR}{"paid_$i"},
my $accno = ($amount > 0) ? $form->{fxgain_accno} : $form->{fxloss_accno};
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared, project_id, taxkey, tax_id, chart_link)
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, 't', 'f', ?, (SELECT taxkey_id FROM chart WHERE accno = ?),
- (SELECT tax_id
- FROM taxkeys
- WHERE chart_id= (SELECT id
- FROM chart
- WHERE accno = ?)
- AND startdate <= ?
+ (SELECT tax_id
+ FROM taxkeys
+ WHERE chart_id= (SELECT id
+ FROM chart
+ WHERE accno = ?)
+ AND startdate <= ?
ORDER BY startdate DESC LIMIT 1),
(SELECT c.link FROM chart c WHERE c.accno = ?))|;
@values = (conv_i($form->{id}), $accno, $amount, conv_date($form->{"datepaid_$i"}), $project_id, $accno, $accno, conv_date($form->{"datepaid_$i"}), $accno);
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate,
source, memo, project_id, taxkey, tax_id, chart_link)
VALUES (?, (SELECT chart_id FROM tax WHERE id = ?),
- ?, ?, ?, ?, ?, ?, ?, (SELECT link
- FROM chart
- WHERE id = (SELECT chart_id
- FROM tax
+ ?, ?, ?, ?, ?, ?, ?, (SELECT link
+ FROM chart
+ WHERE id = (SELECT chart_id
+ FROM tax
WHERE id = ?)))|;
@values = (conv_i($form->{id}), conv_i($form->{"tax_id_$i"}),
$tax, conv_date($form->{transdate}), $form->{"source_$i"},
my $transdate = "";
if ($form->{type} eq "invoice") {
- $transdate = $form->{deliverydate} ? $dbh->quote($form->{deliverydate})
- : $form->{invdate} ? $dbh->quote($form->{invdate})
+ $transdate = $form->{deliverydate} ? $dbh->quote($form->{deliverydate})
+ : $form->{invdate} ? $dbh->quote($form->{invdate})
: "current_date";
} else {
$transdate = $form->{transdate} ? $dbh->quote($form->{transdate}) : "current_date";