X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Far.pl;h=f03a74b7db99e31804a02c9b305b06f4fa12fad2;hb=dbd0ae115bd9a6ba0ede24f9655a29df6bf7dc3b;hp=2094ead3ac34c7bce7ca99ec54a91d92392667e0;hpb=e2b9e1737230c4e4209904784808dcaec723f730;p=kivitendo-erp.git diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 2094ead3a..f03a74b7d 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -91,8 +91,8 @@ sub add { # 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)); + $form->{addition} = "ADDED"; + $form->save_history($form->dbconnect(\%myconfig)); } # /saving the history @@ -147,7 +147,7 @@ sub create_links { my $form = $main::form; my %myconfig = %main::myconfig; - my ($duedate, $taxincluded, @curr); + my ($duedate, $taxincluded); $form->create_links("AR", \%myconfig, "customer"); $duedate = $form->{duedate}; @@ -166,11 +166,9 @@ sub create_links { $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} .= "$_\n" } @curr; + map { $form->{selectcurrency} .= "$_\n" } $form->get_all_currencies(\%myconfig); # customers if (@{ $form->{all_customer} || [] }) { @@ -290,11 +288,11 @@ sub form_header { $exchangerate = qq| {forex}> |; - if ($form->{currency} ne $form->{defaultcurrency}) { + if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency})) { if ($form->{forex}) { $exchangerate .= qq| - | . $locale->text('Exchangerate') . qq| - {exchangerate}>$form->{exchangerate} + | . $locale->text('Exchangerate') . qq| + {exchangerate}>$form->{exchangerate} |; } else { $exchangerate .= qq| @@ -305,10 +303,10 @@ sub form_header { } $taxincluded = qq| - - {taxincluded}> - | . $locale->text('Tax Included') . qq| - + + {taxincluded}> + | . $locale->text('Tax Included') . qq| + |; if (($rows = $form->numtextrows($form->{notes}, 50)) < 2) { @@ -318,12 +316,12 @@ sub form_header { qq|$form->{notes}|; $department = qq| - - | . $locale->text('Department') . qq| - $form->{selectdepartment} - - - + + | . $locale->text('Department') . qq| + $form->{selectdepartment} + + + | if $form->{selectdepartment}; my $n = ($form->{creditremaining} =~ /-/) ? "0" : "1"; @@ -338,11 +336,11 @@ sub form_header { if ($form->{selectemployee}) { $employee = qq| - - | . $locale->text('Salesperson') . qq| - $form->{selectemployee} - - + + | . $locale->text('Salesperson') . qq| + $form->{selectemployee} + + |; } @@ -478,66 +476,66 @@ sub form_header { - - - - | . $locale->text('Customer') . qq| - $customer - - - - {terms}> - - - - - - - | . $locale->text('Credit Limit') . qq| - $form->{creditlimit} - | . $locale->text('Remaining') . qq| - $form->{creditremaining} - {creditlimit}> - {creditremaining}> - - - - - - | . $locale->text('Currency') . qq| - $form->{selectcurrency} - - {defaultcurrency}> - {fxgain_accno}> - {fxloss_accno}> - $exchangerate - - $department - $taxincluded - - - - - $employee - - | . $locale->text('Invoice Number') . qq| - - - - | . $locale->text('Order Number') . qq| - - - - | . $locale->text('Invoice Date') . qq| + + + + | . $locale->text('Customer') . qq| + $customer + + + + {terms}> + + + + + + + | . $locale->text('Credit Limit') . qq| + $form->{creditlimit} + | . $locale->text('Remaining') . qq| + $form->{creditremaining} + {creditlimit}> + {creditremaining}> + + + + + + | . $locale->text('Currency') . qq| + $form->{selectcurrency} + + {defaultcurrency}> + {fxgain_accno}> + {fxloss_accno}> + $exchangerate + + $department + $taxincluded + + + + + $employee + + | . $locale->text('Invoice Number') . qq| + + + + | . $locale->text('Order Number') . qq| + + + + | . $locale->text('Invoice Date') . qq| $button1 - - - | . $locale->text('Due Date') . qq| + + + | . $locale->text('Due Date') . qq| $button2 - + - - + + @@ -547,10 +545,10 @@ $jsscript - - | + + | . $locale->text('Account') . qq| - | + | . $locale->text('Amount') . qq| | . $locale->text('Tax') . qq| @@ -558,7 +556,7 @@ $jsscript . $locale->text('Taxkey') . qq| | . $locale->text('Project') . qq| - + |; $amount = $locale->text('Amount'); @@ -622,13 +620,13 @@ $jsscript '-default' => $form->{"project_id_$i"} )); print qq| - + $selectAR_amount {"amount_$i"}> $form->{"tax_$i"} $tax $projectnumber - + |; $amount = ""; $project = ""; @@ -650,15 +648,15 @@ $jsscript - ${ARselected} - $form->{invtotal} + ${ARselected} + $form->{invtotal} - {oldinvtotal}> - {oldtotalpaid}> + {oldinvtotal}> + {oldtotalpaid}> - + - + @@ -669,22 +667,22 @@ $jsscript - | . $locale->text('Notes') . qq| - $notes - + | . $locale->text('Notes') . qq| + $notes + - - | + + | . $locale->text('Incoming Payments') . qq| - + |; - if ($form->{currency} eq $form->{defaultcurrency}) { + if ($form->{defaultcurrency} && ($form->{currency} eq $form->{defaultcurrency})) { @column_index = qw(datepaid source memo paid AR_paid paid_project_id); } else { @column_index = qw(datepaid source memo paid exchangerate AR_paid paid_project_id); @@ -737,7 +735,7 @@ $jsscript } $exchangerate = qq| |; - if ($form->{currency} ne $form->{defaultcurrency}) { + if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency})) { if ($form->{"forex_$i"}) { $exchangerate = qq|{"exchangerate_$i"}>$form->{"exchangerate_$i"}|; @@ -1048,7 +1046,7 @@ sub post_payment { $form->error($locale->text('Cannot post payment for a closed period!')) if ($form->date_closed($form->{"datepaid_$i"}, \%myconfig)); - if ($form->{currency} ne $form->{defaultcurrency}) { + if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency})) { # $form->{"exchangerate_$i"} = $form->{exchangerate} if ($invdate == $datepaid); $form->isblank("exchangerate_$i", $locale->text('Exchangerate for payment missing!')); } @@ -1099,7 +1097,7 @@ sub post { unless grep $_*1, map $form->parse_amount(\%myconfig, $form->{"amount_$_"}), 1..$form->{rowcount}; $form->isblank("exchangerate", $locale->text('Exchangerate missing!')) - if ($form->{currency} ne $form->{defaultcurrency}); + if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency})); delete($form->{AR}); @@ -1112,7 +1110,7 @@ sub post { $form->error($locale->text('Cannot post payment for a closed period!')) if ($form->date_closed($form->{"datepaid_$i"}, \%myconfig)); - if ($form->{currency} ne $form->{defaultcurrency}) { + if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency})) { $form->{"exchangerate_$i"} = $form->{exchangerate} if ($transdate == $datepaid); $form->isblank("exchangerate_$i", $locale->text('Exchangerate for payment missing!')); } @@ -1129,7 +1127,6 @@ sub post { $form->{AR}{receivables} = $form->{ARselected}; $form->{storno} = 0; - $main::lxdebug->message(0, $form->{amount}); $form->{id} = 0 if $form->{postasnew}; $form->error($locale->text('Cannot post transaction!')) unless AR->post_transaction(\%myconfig, \%$form); @@ -1159,8 +1156,8 @@ sub post_as_new { # saving the history if(!exists $form->{addition} && $form->{id} ne "") { $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; - $form->{addition} = "POSTED AS NEW"; - $form->save_history($form->dbconnect(\%myconfig)); + $form->{addition} = "POSTED AS NEW"; + $form->save_history($form->dbconnect(\%myconfig)); } # /saving the history &post; @@ -1242,8 +1239,8 @@ sub yes { # saving the history if(!exists $form->{addition}) { $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; - $form->{addition} = "DELETED"; - $form->save_history($form->dbconnect(\%myconfig)); + $form->{addition} = "DELETED"; + $form->save_history($form->dbconnect(\%myconfig)); } # /saving the history $form->redirect($locale->text('Transaction deleted!')); @@ -1269,243 +1266,19 @@ sub search { # setup customer selection $form->all_vc(\%myconfig, "customer", "AR"); - if (@{ $form->{all_customer} || [] }) { - map { $customer .= "$_->{name}--$_->{id}\n" } - @{ $form->{all_customer} }; - $customer = qq|\n$customer|; - } else { - $customer = qq||; - } - - # departments - if (@{ $form->{all_departments} || [] }) { - $form->{selectdepartment} = "\n"; - - map { - $form->{selectdepartment} .= - "$_->{description}--$_->{id}\n" - } (@{ $form->{all_departments} || [] }); - } - - $department = qq| - - | . $locale->text('Department') . qq| - $form->{selectdepartment} - -| if $form->{selectdepartment}; - - $form->{title} = $locale->text('AR Transactions'); - - $form->{javascript} .= qq||; - - # use JavaScript Calendar or not + $form->{title} = $locale->text('AR Transactions'); $form->{jsscript} = 1; - $jsscript = ""; - if ($form->{jsscript}) { - # with JavaScript Calendar - $button1 = qq| - - text('button') . qq|> - |; - $button2 = qq| - - text('button') . qq|> - |; + $form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 1 }, + "departments" => "ALL_DEPARTMENTS", + "customers" => "ALL_VC"); - #write Trigger - $jsscript = - Form->write_trigger(\%myconfig, "2", "transdatefrom", "BR", "trigger1", - "transdateto", "BL", "trigger2"); - } else { + # constants and subs for template + $form->{jsscript} = 1; + $form->{vc_keys} = sub { "$_[0]->{name}--$_[0]->{id}" }; - # without JavaScript Calendar - $button1 = qq| - |; - $button2 = qq| - |; - } - - $form->get_lists("projects" => { "key" => "ALL_PROJECTS", - "all" => 1 }); - - my %labels = (); - my @values = (""); - foreach my $item (@{ $form->{"ALL_PROJECTS"} }) { - push(@values, $item->{"id"}); - $labels{$item->{"id"}} = $item->{"projectnumber"}; - } - my $projectnumber = - NTI($cgi->popup_menu('-name' => 'project_id', '-values' => \@values, - '-labels' => \%labels)); - - $form->{fokus} = "search.customer"; $form->header; - $onload = qq|focus()|; - $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|; - $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|; - print qq| - - -{script}> - - - $form->{title} - - - - - - | . $locale->text('Customer') . qq| - $customer - - $department - - | . $locale->text('Invoice Number') . qq| - - - - | . $locale->text('Order Number') . qq| - - - - | . $locale->text('Transaction description') . qq| - - - - | . $locale->text('Notes') . qq| - - - - | . $locale->text("Project Number") . qq| - $projectnumber - - - | . $locale->text('From') . qq| - $button1 - | . $locale->text('Bis') . qq| - $button2 - - - - - - - - - - | . $locale->text('Include in Report') . qq| - - - - - | . $locale->text('Open') . qq| - - | . $locale->text('Closed') . qq| - - - - | . $locale->text('ID') . qq| - - | . $locale->text('Invoice Number') . qq| - - | . $locale->text('Order Number') . qq| - - | . $locale->text('Invoice Date') . qq| - - - - | . $locale->text('Customer') . qq| - - | . $locale->text('Amount') . qq| - - | . $locale->text('Tax') . qq| - - | . $locale->text('Total') . qq| - - - - | . $locale->text('Date Paid') . qq| - - | . $locale->text('Paid') . qq| - - | . $locale->text('Due Date') . qq| - - | . $locale->text('Amount Due') . qq| - - - - | . $locale->text('Notes') . qq| - - | . $locale->text('Salesperson') . qq| - - | . $locale->text('Shipping Point') . qq| - - | . $locale->text('Ship via') . qq| - - - - | . $locale->text('Ertrag') . qq| - - | . $locale->text('Ertrag prozentual') . qq| - - | . $locale->text('Employee') . qq| - - - - | . $locale->text('Subtotal') . qq| - - | . $locale->text('Project Number') . qq| - - | . $locale->text('Transaction description') . qq| - - - | . $locale->text('Customer') . qq| - - - - | . $locale->text('Customer Number') . qq| - - | . $locale->text('Country') . qq| - - | . $locale->text('USt-IdNr.') . qq| - - | . $locale->text('Steuersatz') . qq| - - - - | . $locale->text('Payment Terms') . qq| - - | . $locale->text('Buchungskonto') . qq| - - - - - - - - - - - - - -{nextsub}> - - - - - - - - -$jsscript - -