X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fic.pl;h=28d41f3b3928c0aaac41a001517a5b4fe21ca44f;hb=b6133a726fa261cb97f2c105ea4a93161609d6ca;hp=b99fb25f4409c6691bfca86672b7718b5f1498f3;hpb=864b73ffb0964215f287a393ea37ec2eef6eb8eb;p=kivitendo-erp.git diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index b99fb25f4..28d41f3b3 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -32,11 +32,22 @@ #====================================================================== #$locale->text('ea'); +use POSIX qw(strftime); + use SL::IC; +use SL::ReportGenerator; #use SL::PE; -require "$form->{path}/io.pl"; +# use strict; +#use warnings; + +# global imports +our ($form, $locale, %myconfig, $lxdebug); + +require "bin/mozilla/io.pl"; +require "bin/mozilla/common.pl"; +require "bin/mozilla/reportgenerator.pl"; 1; @@ -48,7 +59,7 @@ sub add { $form->{title} = $locale->text('Add ' . ucfirst $form->{item}); $form->{callback} = - "$form->{script}?action=add&item=$form->{item}&path=$form->{path}&login=$form->{login}&password=$form->{password}" + "$form->{script}?action=add&item=$form->{item}&login=$form->{login}&password=$form->{password}" unless $form->{callback}; $form->{"unit_changeable"} = 1; @@ -63,6 +74,8 @@ sub add { sub search { $lxdebug->enter_sub(); + my ($button1, $button2, $onhand, $makemodel, $serialnumber, $l_serialnumber, $toplevel, $bought); + $form->{title} = (ucfirst $form->{searchitems}) . "s"; $form->{title} = $locale->text($form->{title}); @@ -79,8 +92,8 @@ sub search { # $locale->text('Services') # use JavaScript Calendar or not - $form->{jsscript} = $jscalendar; - $jsscript = ""; + $form->{jsscript} = 1; + my $jsscript = ""; if ($form->{jsscript}) { # with JavaScript Calendar @@ -374,7 +387,6 @@ $jsscript -{path}> {login}> {password}> @@ -397,15 +409,16 @@ $jsscript $lxdebug->leave_sub(); } #end search() - sub search_update_prices { $lxdebug->enter_sub(); + my ($onhand, $makemodel, $serialnumber, $l_serialnumber, $toplevel, $bought); + $form->{title} = $locale->text('Update prices'); IC->get_pricegroups(\%myconfig, \%$form); # use JavaScript Calendar or not -# $form->{jsscript} = $jscalendar; +# $form->{jsscript} = 1; # $jsscript = ""; # if ($form->{jsscript}) { # @@ -538,7 +551,7 @@ sub search_update_prices {
| - . $locale->text('Part Number') . qq| | -| - . $locale->text('Part Description') . qq| | +| . $locale->text('Part Number') . qq| | +| . $locale->text('Part Description') . qq| | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -658,7 +671,6 @@ sub choice { print qq| -{path}> {login}> {password}> @@ -690,9 +702,10 @@ sub choice { {extras}>|; + my ($partnumber, $description, $unit, $sellprice, $soldtotal); # if choice set data if ($form->{ndx}) { - for ($i = 0; $i < $form->{ndxs_counter}; $i++) { + for (my $i = 0; $i < $form->{ndxs_counter}; $i++) { # prepeare data $partnumber = $form->{"totop100_partnumber_$j"}; @@ -716,7 +729,7 @@ sub choice { # set data for next page if (($form->{ndxs_counter}) > 0) { - for ($i = 1; ($i < $form->{ndxs_counter} + 1); $i++) { + for (my $i = 1; ($i < $form->{ndxs_counter} + 1); $i++) { $partnumber = $form->{"totop100_partnumber_$i"}; $description = $form->{"totop100_description_$i"}; $unit = $form->{"totop100_unit_$i"}; @@ -748,20 +761,12 @@ sub choice { sub list { $lxdebug->enter_sub(); - # get parts for - if (($form->{partnumber} eq "") and ($form->{description} eq "")) { - IC->get_parts(\%myconfig, \%$form, ""); - } else { - if ((!($form->{partnumber} eq "")) and ($form->{description} eq "")) { - IC->get_parts(\%myconfig, \%$form, "partnumber"); - } else { - if (($form->{partnumber} eq "") and (!($form->{description} eq ""))) { - IC->get_parts(\%myconfig, \%$form, "description"); - } else { - IC->get_parts(\%myconfig, \%$form, "all"); - } #fi - } #fi - } #fi + our ($lastndx); + our ($partnumber, $description, $unit, $sellprice, $soldtotal); + + my @sortorders = ("", "partnumber", "description", "all"); + my $sortorder = $sortorders[($form->{description} ? 2 : 0) + ($form->{partnumber} ? 1 : 0)]; + IC->get_parts(\%myconfig, \%$form, $sortorder); $form->{title} = $locale->text('Top 100 hinzufuegen'); @@ -816,7 +821,6 @@ sub list { | " - . $form->format_amount(\%myconfig, $ref->{number}, '', " ") + . $form->format_amount(\%myconfig, $ref->{number}) . " | "; $column_data{partnumber} = "$ref->{partnumber} | "; @@ -1318,32 +1317,29 @@ sub addtop100 { $column_data{onhand} = "" - . $form->format_amount(\%myconfig, $ref->{onhand}, '', " ") + . $form->format_amount(\%myconfig, $ref->{onhand}) . " | "; $column_data{sellprice} = "" - . $form->format_amount(\%myconfig, $ref->{sellprice}, 2, " ") + . $form->format_amount(\%myconfig, $ref->{sellprice}) . " | "; $column_data{listprice} = "" - . $form->format_amount(\%myconfig, $ref->{listprice}, 2, " ") + . $form->format_amount(\%myconfig, $ref->{listprice}) . " | "; $column_data{lastcost} = "" - . $form->format_amount(\%myconfig, $ref->{lastcost}, 2, " ") + . $form->format_amount(\%myconfig, $ref->{lastcost}) . " | "; $column_data{linetotalsellprice} = "" - . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{sellprice}, - 2, " ") + . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{sellprice}, 2) . " | "; $column_data{linetotallastcost} = "" - . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{lastcost}, - 2, " ") + . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{lastcost}, 2) . " | "; $column_data{linetotallistprice} = "" - . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{listprice}, - 2, " ") + . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{listprice}, 2) . " | "; if (!$ref->{assemblyitem}) { @@ -1359,10 +1355,10 @@ sub addtop100 { $column_data{rop} = "" - . $form->format_amount(\%myconfig, $ref->{rop}, '', " ") . " | "; + . $form->format_amount(\%myconfig, $ref->{rop}) . ""; $column_data{weight} = "" - . $form->format_amount(\%myconfig, $ref->{weight}, '', " ") + . $form->format_amount(\%myconfig, $ref->{weight}) . " | "; $column_data{unit} = "$ref->{unit} | "; $column_data{bin} = "$ref->{bin} | "; @@ -1370,15 +1366,15 @@ sub addtop100 { $column_data{invnumber} = ($ref->{module} ne 'oe') - ? "{module}.pl?action=edit&type=invoice&id=$ref->{trans_id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{invnumber} | " + ? "{module}.pl?action=edit&type=invoice&id=$ref->{trans_id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{invnumber} | " : "$ref->{invnumber} | "; $column_data{ordnumber} = ($ref->{module} eq 'oe') - ? "{module}.pl?action=edit&type=$ref->{type}&id=$ref->{trans_id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{ordnumber} | " + ? "{module}.pl?action=edit&type=$ref->{type}&id=$ref->{trans_id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{ordnumber} | " : "$ref->{ordnumber} | "; $column_data{quonumber} = ($ref->{module} eq 'oe' && !$ref->{ordnumber}) - ? "{module}.pl?action=edit&type=$ref->{type}&id=$ref->{trans_id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{quonumber} | " + ? "{module}.pl?action=edit&type=$ref->{type}&id=$ref->{trans_id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{quonumber} | " : "$ref->{quonumber} | "; $column_data{name} = "$ref->{name} | "; @@ -1419,15 +1415,15 @@ sub addtop100 { map { $column_data{$_} = "" } @column_index; $column_data{linetotalsellprice} = " | " - . $form->format_amount(\%myconfig, $totalsellprice, 2, " ") + . $form->format_amount(\%myconfig, $totalsellprice, 2) . " | "; $column_data{linetotallastcost} = "" - . $form->format_amount(\%myconfig, $totallastcost, 2, " ") + . $form->format_amount(\%myconfig, $totallastcost, 2) . " | "; $column_data{linetotallistprice} = "" - . $form->format_amount(\%myconfig, $totallistprice, 2, " ") + . $form->format_amount(\%myconfig, $totallistprice, 2) . " | "; print "
" } @column_index; $subtotalonhand = 0 if ($form->{searchitems} eq 'assembly' && $form->{bom}); $column_data{onhand} = " | " - . $form->format_amount(\%myconfig, $subtotalonhand, '', " ") + . $form->format_amount(\%myconfig, $subtotalonhand) . " | "; $column_data{linetotalsellprice} = "" - . $form->format_amount(\%myconfig, $subtotalsellprice, 2, " ") + . $form->format_amount(\%myconfig, $subtotalsellprice, 2) . " | "; $column_data{linetotallistprice} = "" - . $form->format_amount(\%myconfig, $subtotallistprice, 2, " ") + . $form->format_amount(\%myconfig, $subtotallistprice, 2) . " | "; $column_data{linetotallastcost} = "" - . $form->format_amount(\%myconfig, $subtotallastcost, 2, " ") + . $form->format_amount(\%myconfig, $subtotallastcost, 2) . " | "; $subtotalonhand = 0; @@ -2062,7 +1873,9 @@ sub parts_subtotal { sub edit { $lxdebug->enter_sub(); - + # show history button + $form->{javascript} = qq||; + #/show hhistory button IC->get_part(\%myconfig, \%$form); $form->{"original_partnumber"} = $form->{"partnumber"}; @@ -2085,15 +1898,15 @@ sub link_part { split(/:/, $form->{currencies})); # parts and assemblies have the same links - $item = $form->{item}; + my $item = $form->{item}; if ($form->{item} eq 'assembly') { $item = 'part'; } # build the popup menus $form->{taxaccounts} = ""; - foreach $key (keys %{ $form->{IC_links} }) { - foreach $ref (@{ $form->{IC_links}{$key} }) { + foreach my $key (keys %{ $form->{IC_links} }) { + foreach my $ref (@{ $form->{IC_links}{$key} }) { # if this is a tax field if ($key =~ /IC_tax/) { @@ -2147,7 +1960,7 @@ sub link_part { if ($form->{item} eq 'assembly') { - foreach $i (1 .. $form->{assembly_rows}) { + foreach my $i (1 .. $form->{assembly_rows}) { if ($form->{"partsgroup_id_$i"}) { $form->{"partsgroup_$i"} = qq|$form->{"partsgroup_$i"}--$form->{"partsgroup_id_$i"}|; @@ -2170,41 +1983,24 @@ sub link_part { sub form_header { $lxdebug->enter_sub(); - my $dec = ''; - - #decimalplaces for listprice - ($dec) = ($form->{listprice} =~ /\.(\d+)/); - $dec = length $dec; - my $decimalplaces = ($dec == 2) ? $dec : 2; - $form->{listprice} = - $form->format_amount(\%myconfig, $form->{listprice}, $decimalplaces); - - #decimalplaces for sellprice and gv - ($dec) = ($form->{sellprice} =~ /\.(\d+)/); - $dec = length $dec; - my $decimalplaces = ($dec == 2) ? $dec : 2; - - map { - $form->{$_} = - $form->format_amount(\%myconfig, $form->{$_}, $decimalplaces) - } qw(sellprice gv); + my ($payment, $rows, $notes, $description, $ean, $buchungsgruppe, $partsgroup, $group, $tax, $lastcost, $eur, $linkaccounts, $weight, $n, $rop, $bin, $vegv); + my ($notdiscountableok, $notdiscountable); + my ($formula, $formula_label, $imagelinks, $obsolete, $shopok, $shop); - ($dec) = ($form->{lastcost} =~ /\.(\d+)/); - $dec = length $dec; - my $decimalplaces = ($dec == 2) ? $dec : 2; + $form->get_lists('price_factors' => 'ALL_PRICE_FACTORS'); - $form->{lastcost} = - $form->format_amount(\%myconfig, $form->{lastcost}, $decimalplaces); + map({ $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}, -2) } + qw(sellprice listprice lastcost gv)); map { $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}) } qw(weight rop stock); - foreach $item (qw(partnumber description unit notes)) { + foreach my $item (qw(partnumber description unit notes)) { $form->{$item} =~ s/\"/"/g; } $payment = qq||; - foreach $item (@{ $form->{payment_terms} }) { + foreach my $item (@{ $form->{payment_terms} }) { if ($form->{payment_id} eq $item->{id}) { $payment .= qq||; } else { @@ -2229,13 +2025,13 @@ sub form_header { $ean = qq||; - foreach $item (split / /, $form->{taxaccounts}) { + foreach my $item (split / /, $form->{taxaccounts}) { $form->{"IC_tax_$item"} = ($form->{"IC_tax_$item"}) ? "checked" : ""; } IC->retrieve_buchungsgruppen(\%myconfig, $form); if (@{ $form->{BUCHUNGSGRUPPEN} }) { - foreach $item (@{ $form->{BUCHUNGSGRUPPEN} }) { + foreach my $item (@{ $form->{BUCHUNGSGRUPPEN} }) { if ($item->{id} == $form->{buchungsgruppen_id}) { $form->{selectbuchungsgruppe} .= "|||||||||||||||||||||||
| - . $locale->text('Geschäftsvolumen') . qq| | + . $locale->text('Business Volume') . qq|{gv}> | ||||||||||||||||||||||||||
@@ -2499,7 +2298,8 @@ sub form_header { # type=submit $locale->text('Edit Service') # type=submit $locale->text('Edit Assembly') # use JavaScript Calendar or not - $form->{jsscript} = $jscalendar; + my ($jsscript, $button1); + $form->{jsscript} = 1; $jsscript = ""; if ($form->{jsscript}) { @@ -2528,6 +2328,22 @@ sub form_header { $unit_select .= AM->unit_select_html($units, "unit", $form->{"unit"}); } + my $price_factor; + if (0 < scalar @{ $form->{ALL_PRICE_FACTORS} }) { + my @values = ('', map { $_->{id} } @{ $form->{ALL_PRICE_FACTORS} }); + my %labels = map { $_->{id} => $_->{description} } @{ $form->{ALL_PRICE_FACTORS} }; + + $price_factor = + qq| | |||||||||||||||||||||||||||
| + . $locale->text('Price Factor') + . qq| | | + . NTI($cgi->popup_menu('-name' => 'price_factor_id', + '-default' => $form->{price_factor_id}, + '-values' => \@values, + '-labels' => \%labels)) + . qq| | ||||||||||||||||||||||||||
| . $locale->text('Notes') . qq| | -| . $locale->text('Formula') . qq| | +$formula_label | |||||||||||||||||||||||||
$notes | - $formel + $formula | ||||||||||||||||||||||||||
{sellprice}> | |||||||||||||||||||||||||||
| . $locale->text('Unit') . qq| | $unit_select | @@ -2688,7 +2505,6 @@ sub form_footer { } print qq| - {path}> {login}> {password}> @@ -2743,9 +2559,26 @@ sub form_footer { } } + if (!$form->{previousform}) { + if ($form->{menubar}) { + require "bin/mozilla/menu.pl"; + &menubar; + } + } +# button for saving history + if($form->{id} ne "") { + print qq| + {id} + . qq|); name=history id=history value=| + . $locale->text('history') + . qq|>|; + } +# /button for saving history print qq| +