X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Far.pl;h=9fdf2bc8ca433a128cef1812eb8d95fa6b64d54c;hb=b2945bf61775161f9ce9be9bdbd106ad44247a14;hp=523cdee41d37ed842508d25cd16a397fec131a8a;hpb=29e31d6bf64b3944c4f33ad6343b14af95a7219d;p=kivitendo-erp.git diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 523cdee41..9fdf2bc8c 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -31,18 +31,22 @@ # #====================================================================== +use POSIX qw(strftime); +use List::Util qw(sum first); + use SL::AR; +use SL::FU; use SL::IS; use SL::PE; -use Data::Dumper; +use SL::ReportGenerator; -require "$form->{path}/arap.pl"; +require "bin/mozilla/arap.pl"; require "bin/mozilla/common.pl"; require "bin/mozilla/drafts.pl"; +require "bin/mozilla/reportgenerator.pl"; -1; - -# end of main +use strict; +#use warnings; # this is for our long dates # $locale->text('January') @@ -72,56 +76,78 @@ require "bin/mozilla/drafts.pl"; # $locale->text('Nov') # $locale->text('Dec') +my $totalpaid; + sub add { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + $main::auth->assert('general_ledger'); - return $lxdebug->leave_sub() if (load_draft_maybe()); + my $form = $main::form; + my %myconfig = %main::myconfig; + + return $main::lxdebug->leave_sub() if (load_draft_maybe()); # saving the history if(!exists $form->{addition} && ($form->{id} ne "")) { - $form->{addition} = "ADDED"; - $form->save_history($form->dbconnect(\%myconfig)); + $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; + $form->{addition} = "ADDED"; + $form->save_history($form->dbconnect(\%myconfig)); } - # /saving the history - + # /saving the history + $form->{title} = "Add"; - $form->{callback} = - "$form->{script}?action=add&path=$form->{path}&login=$form->{login}&password=$form->{password}" - unless $form->{callback}; + $form->{callback} = "ar.pl?action=add" unless $form->{callback}; AR->get_transdate(\%myconfig, $form); $form->{initial_transdate} = $form->{transdate}; &create_links; $form->{transdate} = $form->{initial_transdate}; &display_form; - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub edit { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + $main::auth->assert('general_ledger'); + + my $form = $main::form; + # show history button $form->{javascript} = qq||; #/show hhistory button - + $form->{javascript} .= qq||; $form->{title} = "Edit"; &create_links; &display_form; - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub display_form { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + $main::auth->assert('general_ledger'); + + my $form = $main::form; &form_header; &form_footer; - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub create_links { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + $main::auth->assert('general_ledger'); + + my $form = $main::form; + my %myconfig = %main::myconfig; + + my ($duedate, $taxincluded); $form->create_links("AR", \%myconfig, "customer"); $duedate = $form->{duedate}; @@ -136,159 +162,69 @@ sub create_links { $form->{oldcustomer} = "$form->{customer}--$form->{customer_id}"; $form->{rowcount} = 1; + # notes + $form->{notes} = $form->{intnotes} unless $form->{notes}; + # currencies - @curr = split(/:/, $form->{currencies}); - chomp $curr[0]; - $form->{defaultcurrency} = $curr[0]; + $form->{defaultcurrency} = $form->get_default_currency(\%myconfig); - map { $form->{selectcurrency} .= "