X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Far.pl;h=d6f55ff812d13d28f872311c50984fd1746410a2;hb=89dd4ca84494de24ac1ecc7bd3b84fdd35e28020;hp=a6ecec82fcf626c15d1dd0c8cf44b9e650921426;hpb=4dbb09950c9f5596646537c12d991c99086fe7c1;p=kivitendo-erp.git diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index a6ecec82f..d6f55ff81 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -31,14 +31,20 @@ # #====================================================================== +use POSIX qw(strftime); use SL::AR; use SL::IS; use SL::PE; +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/report_generator.pl"; 1; + # end of main # this is for our long dates @@ -69,25 +75,38 @@ require "$form->{path}/arap.pl"; # $locale->text('Nov') # $locale->text('Dec') - sub add { $lxdebug->enter_sub(); + return $lxdebug->leave_sub() if (load_draft_maybe()); - $form->{title} = "Add"; - $form->{callback} = "$form->{script}?action=add&path=$form->{path}&login=$form->{login}&password=$form->{password}" unless $form->{callback}; + # saving the history + if(!exists $form->{addition} && ($form->{id} ne "")) { + $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; + $form->{addition} = "ADDED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history + + $form->{title} = "Add"; + $form->{callback} = + "$form->{script}?action=add&login=$form->{login}&password=$form->{password}" + 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(); } - sub edit { $lxdebug->enter_sub(); - - + # show history button + $form->{javascript} = qq||; + #/show hhistory button + $form->{javascript} .= qq||; $form->{title} = "Edit"; &create_links; @@ -96,34 +115,36 @@ sub edit { $lxdebug->leave_sub(); } - sub display_form { $lxdebug->enter_sub(); - &form_header; &form_footer; $lxdebug->leave_sub(); } - sub create_links { $lxdebug->enter_sub(); - $form->create_links("AR", \%myconfig, "customer"); $duedate = $form->{duedate}; - + $taxincluded = $form->{taxincluded}; - + my $id = $form->{id}; IS->get_customer(\%myconfig, \%$form); + $form->{taxincluded} = $taxincluded; + $form->{id} = $id; - $form->{duedate} = $duedate if $duedate; + $form->{duedate} = $duedate if $duedate; $form->{oldcustomer} = "$form->{customer}--$form->{customer_id}"; + $form->{rowcount} = 1; + + # notes + $form->{notes} = $form->{intnotes} unless $form->{notes}; # currencies - @curr = split /:/, $form->{currencies}; + @curr = split(/:/, $form->{currencies}); chomp $curr[0]; $form->{defaultcurrency} = $curr[0]; @@ -132,169 +153,108 @@ sub create_links { # customers if (@{ $form->{all_customer} }) { $form->{customer} = "$form->{customer}--$form->{customer_id}"; - map { $form->{selectcustomer} .= "\n"; - } else { - $form->{"select$key"} .= "\n"; - } - } - - $form->{$key} = $form->{"select$key"}; - # if there is a value we have an old entry - $j = 0; - for $i (1 .. scalar @{ $form->{acc_trans}{$key} }) { - if ($key eq "AR_paid") { - $j++; - $form->{"AR_paid_$j"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}"; - # reverse paid - $form->{"paid_$j"} = $form->{acc_trans}{$key}->[$i-1]->{amount} * -1; - $form->{"datepaid_$j"} = $form->{acc_trans}{$key}->[$i-1]->{transdate}; - $form->{"source_$j"} = $form->{acc_trans}{$key}->[$i-1]->{source}; - $form->{"memo_$j"} = $form->{acc_trans}{$key}->[$i-1]->{memo}; - - $form->{"forex_$j"} = $form->{"exchangerate_$i"} = $form->{acc_trans}{$key}->[$i-1]->{exchangerate}; - $form->{"AR_paid_$j"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}"; - $form->{paidaccounts}++; - } else { - - $akey = $key; - $akey =~ s/AR_//; - - if ($key eq "AR_tax") { - $form->{"${key}_$form->{acc_trans}{$key}->[$i-1]->{accno}"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}"; - $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"} = $form->round_amount($form->{acc_trans}{$key}->[$i-1]->{amount} / $exchangerate, 2); - - if ($form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"} > 0) { - $totaltax += $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"}; - $taxrate += $form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"}; - } else { - $totalwithholding += $form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"}; - $withholdingrate += $form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"}; - } - - } else { - $form->{"${akey}_$i"} = $form->round_amount($form->{acc_trans}{$key}->[$i-1]->{amount} / $exchangerate, 2); - if ($akey eq 'amount') { - $form->{rowcount}++; - $totalamount += $form->{"${akey}_$i"}; - - $form->{"oldprojectnumber_$i"} = $form->{"projectnumber_$i"} = "$form->{acc_trans}{$key}->[$i-1]->{projectnumber}"; - $form->{taxrate} = $form->{acc_trans}{$key}->[$i-1]->{rate}; - $form->{"project_id_$i"} = "$form->{acc_trans}{$key}->[$i-1]->{project_id}"; - } - $form->{"${key}_$i"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}"; - $form->{"${key}_$i"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}"; - $form->{"select${key}"} =~ /(