X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=SL%2FGL.pm;h=ada29ac6ad12e3a9837c82119edf0ba2e8e60f6c;hb=d8ac08282dad52789b8bea785e8cddae44085483;hp=5783fbfd338d7a1cc7999f2650ecbe5a8169f57d;hpb=03ff37cb621e68f7d224d2520099ee86f612f833;p=kivitendo-erp.git diff --git a/SL/GL.pm b/SL/GL.pm index 5783fbfd3..ada29ac6a 100644 --- a/SL/GL.pm +++ b/SL/GL.pm @@ -157,11 +157,11 @@ sub post_transaction { if ($amount != 0) { $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, - source, memo, project_id, taxkey, ob_transaction, cb_transaction, tax_id) + source, memo, project_id, taxkey, ob_transaction, cb_transaction, tax_id, chart_link) VALUES (?, (SELECT id FROM chart WHERE accno = ?), - ?, ?, ?, ?, ?, ?, ?, ?, ?)|; + ?, ?, ?, ?, ?, ?, ?, ?, ?, (SELECT link FROM chart WHERE accno = ?))|; @values = (conv_i($form->{id}), $accno, $amount, conv_date($form->{transdate}), - $form->{"source_$i"}, $form->{"memo_$i"}, $project_id, $taxkey, $form->{ob_transaction} ? 't' : 'f', $form->{cb_transaction} ? 't' : 'f', conv_i($form->{"tax_id_$i"})); + $form->{"source_$i"}, $form->{"memo_$i"}, $project_id, $taxkey, $form->{ob_transaction} ? 't' : 'f', $form->{cb_transaction} ? 't' : 'f', conv_i($form->{"tax_id_$i"}), $accno); do_query($form, $dbh, $query, @values); } @@ -169,12 +169,16 @@ sub post_transaction { # add taxentry $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, - source, memo, project_id, taxkey, tax_id) + 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 + WHERE id = ?)))|; @values = (conv_i($form->{id}), conv_i($form->{"tax_id_$i"}), $tax, conv_date($form->{transdate}), $form->{"source_$i"}, - $form->{"memo_$i"}, $project_id, $taxkey, conv_i($form->{"tax_id_$i"})); + $form->{"memo_$i"}, $project_id, $taxkey, conv_i($form->{"tax_id_$i"}), conv_i($form->{"tax_id_$i"})); do_query($form, $dbh, $query, @values); } } @@ -194,6 +198,7 @@ sub post_transaction { dbh => $dbh, from => $transdate, to => $transdate, + trans_id => $form->{id}, ); $datev->export; @@ -280,10 +285,8 @@ sub all_transactions { push(@arvalues, '%' . $form->{description} . '%'); push(@apvalues, '%' . $form->{description} . '%'); } - - if ($form->{employee} =~ /--/) { - ($form->{employee_id},$form->{employee_name}) = split(/--/,$form->{employee}); - #if ($form->{employee_id}) { + + if ($form->{employee_id}) { $glwhere .= " AND g.employee_id = ? "; $arwhere .= " AND a.employee_id = ? "; $apwhere .= " AND a.employee_id = ? "; @@ -366,7 +369,7 @@ sub all_transactions { 'source' => { 'gl' => 'ac.source', 'arap' => 'ac.source', }, 'description' => { 'gl' => 'g.description', 'arap' => 'ct.name', }, ); - + # sortdir = sort direction (ascending or descending) my $sortdir = !defined $form->{sortdir} ? 'ASC' : $form->{sortdir} ? 'ASC' : 'DESC'; my $sortkey = $sort_columns{$form->{sort}} ? $form->{sort} : $form->{datesort}; # default used to be transdate @@ -799,5 +802,24 @@ sub get_chart_balances { $main::lxdebug->leave_sub(); } +sub get_tax_dropdown { + my $myconfig = \%main::myconfig; + my $form = $main::form; + + my $dbh = $form->get_standard_dbh($myconfig); + + my $query = qq|SELECT category FROM chart WHERE accno = ?|; + my ($category) = selectrow_query($form, $dbh, $query, $form->{accno}); + + $query = qq|SELECT * FROM tax WHERE chart_categories like '%$category%' order by taxkey, rate|; + + my $sth = prepare_execute_query($form, $dbh, $query); + + $form->{TAX_ACCOUNTS} = []; + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { + push(@{ $form->{TAX_ACCOUNTS} }, $ref); + } + +} 1;