X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fgl.pl;h=5154a3fcfb613637575545fb3182555151bad666;hb=9fd46de37d7906b7c104c17112b34bae7d534d67;hp=f88a0eb7a11da5d4625208020d2f9b8b1c22ca14;hpb=4dbb09950c9f5596646537c12d991c99086fe7c1;p=kivitendo-erp.git diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index f88a0eb7a..5154a3fcf 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -31,17 +31,15 @@ # #====================================================================== - use SL::GL; use SL::PE; -use Data::Dumper; - require "$form->{path}/arap.pl"; +require "bin/mozilla/common.pl"; 1; -# end of main +# end of main # this is for our long dates # $locale->text('January') @@ -71,145 +69,192 @@ require "$form->{path}/arap.pl"; # $locale->text('Nov') # $locale->text('Dec') - sub add { $lxdebug->enter_sub(); $form->{title} = "Add"; - - $form->{callback} = "$form->{script}?action=add&path=$form->{path}&login=$form->{login}&password=$form->{password}" unless $form->{callback}; + + $form->{callback} = + "$form->{script}?action=add&path=$form->{path}&login=$form->{login}&password=$form->{password}" + unless $form->{callback}; # we use this only to set a default date GL->transaction(\%myconfig, \%$form); - map { $chart .= "{accno}--$_->{taxkey_id}\">$_->{accno}--$_->{description}" } @{ $form->{chart} }; - map { $tax .= qq|$_->{taxdescription} |.($_->{rate} * 100).qq| %|} @{ $form->{TAX} }; - - $form->{chart} = $chart; + map { + $tax .= + qq|$_->{taxdescription} | + . ($_->{rate} * 100) . qq| %| + } @{ $form->{TAX} }; - $form->{debitchart} = $chart; - $form->{creditchart} = $chart; - $form->{taxchart} = $tax; - - $form->{debit} = 0; + $form->{rowcount} = 2; + + $form->{debit} = 0; $form->{credit} = 0; - $form->{tax} = 0; - - $form->{creditrowcount} = 2; - $form->{debitrowcount} = 2; - + $form->{tax} = 0; # departments $form->all_departments(\%myconfig); if (@{ $form->{all_departments} }) { $form->{selectdepartment} = "\n"; - map { $form->{selectdepartment} .= "$_->{description}--$_->{id}\n" } (@{ $form->{all_departments} }); + map { + $form->{selectdepartment} .= + "$_->{description}--$_->{id}\n" + } (@{ $form->{all_departments} }); } - - &display_form; - + + &display_form(1); $lxdebug->leave_sub(); -} +} sub edit { $lxdebug->enter_sub(); GL->transaction(\%myconfig, \%$form); - map { if ($form->{debitaccno} eq $_->{accno}) {$form->{debitchart} .= "{accno}--$_->{taxkey_id}\">$_->{accno}--$_->{description}"} } @{ $form->{chart} }; - map { if ($form->{creditaccno} eq $_->{accno}) {$form->{creditchart} .= "{accno}--$_->{taxkey_id}\">$_->{accno}--$_->{description}"} } @{ $form->{chart} }; - map { $tax .= qq|$_->{taxdescription} |.($_->{rate} * 100).qq| %|} @{ $form->{TAX} }; - - if ($form->{creditrowcount} > 2) { - for $i (2 .. $form->{creditrowcount}) { - map { if ($form->{"creditchartselected_$i"} eq $_->{accno}) {$form->{"creditchartselected_$i"} = "$_->{accno}--$_->{taxkey_id}" }} @{ $form->{chart} }; - map { if ($form->{"taxchartselected_$i"} eq $_->{taxkey}) {$form->{"taxchartselected_$i"} = "$_->{taxkey}--$_->{rate}" }} @{ $form->{TAX} }; - } - } - if ($form->{debitrowcount} > 2) { - for $i (2 .. $form->{debitrowcount}) { - map { if ($form->{"debitchartselected_$i"} eq $_->{accno}) {$form->{"debitchartselected_$i"} = "$_->{accno}--$_->{taxkey_id}" }} @{ $form->{chart} }; - map { if ($form->{"taxchartselected_$i"} eq $_->{taxkey}) {$form->{"taxchartselected_$i"} = "$_->{taxkey}--$_->{rate}" }} @{ $form->{TAX} }; - } - } - map { $chart .= "{accno}--$_->{taxkey_id}\">$_->{accno}--$_->{description}" } @{ $form->{chart} }; - $form->{chart} = $chart; - map { $tax .= qq|$_->{taxdescription} |.($_->{rate} * 100).qq| %|} @{ $form->{TAX} }; - $form->{taxchart} = $tax; - - if ($form->{tax} < 0) { - $form->{tax} = $form->{tax} * (-1); - } - - $form->{amount}=$form->format_amount(\%myconfig, $form->{amount}, 2); - + map { + $tax .= + qq|$_->{taxdescription} | + . ($_->{rate} * 100) . qq| %| + } @{ $form->{TAX} }; + + $form->{amount} = $form->format_amount(\%myconfig, $form->{amount}, 2); + # departments $form->all_departments(\%myconfig); if (@{ $form->{all_departments} }) { $form->{selectdepartment} = "\n"; - map { $form->{selectdepartment} .= "$_->{description}--$_->{id}\n" } (@{ $form->{all_departments} }); + map { + $form->{selectdepartment} .= + "$_->{description}--$_->{id}\n" + } (@{ $form->{all_departments} }); } - - $form->{locked} = ($form->datetonum($form->{transdate}, \%myconfig) <= $form->datetonum($form->{closedto}, \%myconfig)); - $form->{title} = "Edit"; - - &form_header; + my $i = 1; + my $tax = 0; + my $taxaccno = ""; + foreach $ref (@{ $form->{GL} }) { + $j = $i - 1; + if ($tax && ($ref->{accno} eq $taxaccno)) { + $form->{"tax_$j"} = abs($ref->{amount}); + $form->{"taxchart_$j"} = $ref->{id} . "--" . $ref->{taxrate}; + if ($form->{taxincluded}) { + if ($ref->{amount} < 0) { + $form->{"debit_$j"} += $form->{"tax_$j"}; + } else { + $form->{"credit_$j"} += $form->{"tax_$j"}; + } + } + $form->{"project_id_$j"} = $ref->{project_id}; + } else { + $form->{"accno_$i"} = "$ref->{accno}--$ref->{tax_id}"; + for (qw(fx_transaction source memo)) { $form->{"${_}_$i"} = $ref->{$_} } + if ($ref->{amount} < 0) { + $form->{totaldebit} -= $ref->{amount}; + $form->{"debit_$i"} = $ref->{amount} * -1; + } else { + $form->{totalcredit} += $ref->{amount}; + $form->{"credit_$i"} = $ref->{amount}; + } + $form->{"taxchart_$i"} = "0--0.00"; + $form->{"project_id_$i"} = $ref->{project_id}; + $i++; + } + if ($ref->{taxaccno} && !$tax) { + $taxaccno = $ref->{taxaccno}; + $tax = 1; + } else { + $taxaccno = ""; + $tax = 0; + } + } + + $form->{rowcount} = $i; + $form->{locked} = + ($form->datetonum($form->{transdate}, \%myconfig) <= + $form->datetonum($form->{closedto}, \%myconfig)); + $form->{title} = "Edit"; + + &form_header; + &display_rows; &form_footer; - $lxdebug->leave_sub(); -} - +} sub search { $lxdebug->enter_sub(); $form->{title} = $locale->text('Buchungsjournal'); - + $form->all_departments(\%myconfig); + # departments if (@{ $form->{all_departments} }) { $form->{selectdepartment} = "\n"; - map { $form->{selectdepartment} .= "$_->{description}--$_->{id}\n" } (@{ $form->{all_departments} }); + map { + $form->{selectdepartment} .= + "$_->{description}--$_->{id}\n" + } (@{ $form->{all_departments} }); } - + $department = qq| - |.$locale->text('Department').qq| + | . $locale->text('Department') . qq| $form->{selectdepartment} | if $form->{selectdepartment}; - + + $form->get_lists("projects" => { "key" => "ALL_PROJECTS", + "all" => 1 }); + + my %project_labels = (); + my @project_values = (""); + foreach my $item (@{ $form->{"ALL_PROJECTS"} }) { + push(@project_values, $item->{"id"}); + $project_labels{$item->{"id"}} = $item->{"projectnumber"}; + } + + my $projectnumber = + NTI($cgi->popup_menu('-name' => "project_id", + '-values' => \@project_values, + '-labels' => \%project_labels)); + # use JavaScript Calendar or not $form->{jsscript} = $jscalendar; $jsscript = ""; - if ($form->{jsscript}) - { + if ($form->{jsscript}) { + # with JavaScript Calendar $button1 = qq| - text('button').qq|> + text('button') . qq|> |; - $button2 = qq| + $button2 = qq| - text('button').qq|> + text('button') . qq|> |; - #write Trigger - $jsscript = Form->write_trigger(\%myconfig,"2","datefrom","BR","trigger1","dateto","BL","trigger2"); - } - else - { - # without JavaScript Calendar - $button1 = qq||; - $button2 = qq||; - } + + #write Trigger + $jsscript = + Form->write_trigger(\%myconfig, "2", "datefrom", "BR", "trigger1", + "dateto", "BL", "trigger2"); + } else { + + # without JavaScript Calendar + $button1 = + qq||; + $button2 = + qq||; + } $form->header; @@ -229,67 +274,79 @@ sub search { - |.$locale->text('Reference').qq| + | . $locale->text('Reference') . qq| - |.$locale->text('Source').qq| + | . $locale->text('Source') . qq| $department - |.$locale->text('Description').qq| + | . $locale->text('Description') . qq| - |.$locale->text('Notes').qq| + | . $locale->text('Notes') . qq| - |.$locale->text('From').qq| + | . $locale->text('Project Number') . qq| + $projectnumber + + + | . $locale->text('From') . qq| $button1 + | . $locale->text('To (time)') . qq| $button2 - |.$locale->text('Include in Report').qq| + | . $locale->text('Include in Report') . qq| - |.$locale->text('All').qq| - |.$locale->text('Asset').qq| - |.$locale->text('Liability').qq| - |.$locale->text('Revenue').qq| - |.$locale->text('Expense').qq| + | + . $locale->text('All') . qq| + | + . $locale->text('Asset') . qq| + | + . $locale->text('Liability') . qq| + | + . $locale->text('Revenue') . qq| + | + . $locale->text('Expense') . qq| - |.$locale->text('ID').qq| + | . $locale->text('ID') . qq| - |.$locale->text('Date').qq| + | . $locale->text('Date') . qq| - |.$locale->text('Reference').qq| + | . $locale->text('Reference') . qq| - |.$locale->text('Description').qq| + | . $locale->text('Description') . qq| - |.$locale->text('Notes').qq| + | . $locale->text('Notes') . qq| - |.$locale->text('Debit').qq| + | . $locale->text('Debit') . qq| - |.$locale->text('Credit').qq| + | . $locale->text('Credit') . qq| - |.$locale->text('Source').qq| + | . $locale->text('Source') . qq| - |.$locale->text('Account').qq| + | . $locale->text('Account') . qq| - |.$locale->text('GIFI').qq| + | . $locale->text('GIFI') . qq| - |.$locale->text('Subtotal').qq| + | . $locale->text('Subtotal') . qq| + + | . $locale->text('Project Number') . qq| @@ -312,7 +369,8 @@ $jsscript {password}> - +