X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fic.pl;h=63ce108ca604537abf59830273263ea20a32a6f0;hb=1936914faa606aa5114592851c0d94913f6a005d;hp=b2a4da64a9da486cb8a38a97677ea9be11798207;hpb=a2a806917f032855799eebba851e67eff2e377ef;p=kivitendo-erp.git diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index b2a4da64a..63ce108ca 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -51,8 +51,8 @@ sub add { "$form->{script}?action=add&item=$form->{item}&path=$form->{path}&login=$form->{login}&password=$form->{password}" unless $form->{callback}; - $form->{unit} = - ($form->{item} eq 'service') ? $locale->text('hr') : $locale->text('ea'); + $form->{"unit_changeable"} = 1; + IC->get_pricegroups(\%myconfig, \%$form); &link_part; &display_form; @@ -326,7 +326,7 @@ sub search { . $locale->text('List Price') . qq|  | . $locale->text('Sell Price') . qq| -  | +  | . $locale->text('Last Cost') . qq|  | . $locale->text('Line Total') . qq| @@ -378,6 +378,7 @@ $jsscript + @@ -394,6 +395,232 @@ $jsscript $lxdebug->leave_sub(); } #end search() + +sub search_update_prices { + $lxdebug->enter_sub(); + + $form->{title} = $locale->text('Update prices'); + IC->get_pricegroups(\%myconfig, \%$form); + + # use JavaScript Calendar or not +# $form->{jsscript} = $jscalendar; +# $jsscript = ""; +# if ($form->{jsscript}) { +# +# # with JavaScript Calendar +# $button1 = qq| +# +# text('button') . qq|> +# |; +# $button2 = qq| +# +# text('button') . qq|> +# |; +# +# #write Trigger +# $jsscript = +# Form->write_trigger(\%myconfig, "2", "transdatefrom", "BL", "trigger1", +# "transdateto", "BL", "trigger2"); +# } else { +# +# # without JavaScript Calendar +# $button1 = qq| +# |; +# $button2 = qq| +# |; +# } + + $onhand = qq| +  | + . $locale->text('On Hand') . qq| +  | + . $locale->text('Short') . qq| +|; + + $makemodel = qq| + + | . $locale->text('Make') . qq| + + | . $locale->text('Model') . qq| + + +|; + + $serialnumber = qq| + | . $locale->text('Serial Number') . qq| + +|; + + $l_serialnumber = qq| +  | + . $locale->text('Serial Number') . qq| +|; + + + + $form->header; + + print qq| + + +
{script}> + + + + + + + + "; - $column_data{description} = ""; + $column_data{description} = ""; $column_data{partsgroup} = ""; $column_data{onhand} = @@ -1844,6 +2071,8 @@ sub edit { IC->get_part(\%myconfig, \%$form); + $form->{"original_partnumber"} = $form->{"partnumber"}; + $form->{title} = $locale->text('Edit ' . ucfirst $form->{item}); &link_part; @@ -1952,14 +2181,14 @@ sub form_header { #decimalplaces for listprice ($dec) = ($form->{listprice} =~ /\.(\d+)/); $dec = length $dec; - my $decimalplaces = ($dec > 2) ? $dec : 2; + 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; + my $decimalplaces = ($dec == 2) ? $dec : 2; map { $form->{$_} = @@ -1968,7 +2197,7 @@ sub form_header { ($dec) = ($form->{lastcost} =~ /\.(\d+)/); $dec = length $dec; - my $decimalplaces = ($dec > 2) ? $dec : 2; + my $decimalplaces = ($dec == 2) ? $dec : 2; $form->{lastcost} = $form->format_amount(\%myconfig, $form->{lastcost}, $decimalplaces); @@ -1980,12 +2209,22 @@ sub form_header { $form->{$item} =~ s/\"/"/g; } + $payment = qq||; + foreach $item (@{ $form->{payment_terms} }) { + if ($form->{payment_id} eq $item->{id}) { + $payment .= qq||; + } else { + $payment .= qq||; + } + } + + if (($rows = $form->numtextrows($form->{notes}, 40)) < 2) { - $rows = 2; + $rows = 4; } $notes = - qq||; + qq||; if (($rows = $form->numtextrows($form->{description}, 40)) > 1) { $description = qq||; @@ -1998,6 +2237,27 @@ sub form_header { $form->{"IC_tax_$item"} = ($form->{"IC_tax_$item"}) ? "checked" : ""; } + IC->retrieve_buchungsgruppen(\%myconfig, $form); + if (@{ $form->{BUCHUNGSGRUPPEN} }) { + foreach $item (@{ $form->{BUCHUNGSGRUPPEN} }) { + if ($item->{id} == $form->{buchungsgruppen_id}) { + $form->{selectbuchungsgruppe} .= + " + + + |; + + # set option foreach $item (qw(IC IC_income IC_expense)) { if ($form->{$item}) { @@ -2138,6 +2398,18 @@ sub form_header { |; } + $linkaccounts = qq||; + + if ($form->{IC_cogs_default}) { + $form->{IC_expense_default} = $form->{IC_cogs_default}; + } + + if (($form->{item} eq "service") || ($form->{item} eq "part")) { + $linkaccounts .= qq||; + } + if ($form->{item} eq "part") { + $linkaccounts .= qq||; + } if ($form->{item} ne 'service') { $n = ($form->{onhand} > 0) ? "1" : "0"; @@ -2183,6 +2455,17 @@ sub form_header { |; + $notdiscountableok = ($form->{not_discountable}) == 1 ? "checked" : ""; + $notdiscountable .= qq| + + + + +|; + + $formel = + qq||; $imagelinks = qq| @@ -2221,6 +2504,7 @@ sub form_header { |; + # type=submit $locale->text('Add Part') # type=submit $locale->text('Add Service') # type=submit $locale->text('Add Assembly') @@ -2250,12 +2534,21 @@ sub form_header { |; } + my $unit_select = ''; + if (!$form->{"unit_changeable"}) { + $unit_select .= '' . $form->{"unit"}; + } else { + my $units = AM->retrieve_units(\%myconfig, $form, $form->{"item"} eq "service" ? "service" : "dimension"); + $unit_select .= AM->unit_select_html($units, "unit", $form->{"unit"}); + } + $form->{fokus} = "ic.partnumber"; $form->header; print qq| - + + {script}> @@ -2269,6 +2562,8 @@ sub form_header { {rowcount}> + +
$form->{title}
+ + + + + + + + + + + + + $serialnumber + + $makemodel + + + + + + + $toplevel + + + + + $bought + + + + |; + print qq| + + + + + +
| . $locale->text('Part Number') . qq|
| + . $locale->text('Part Description') . qq|
| . $locale->text('Group') . qq|
| . $locale->text('Drawing') . qq|| . $locale->text('Microfiche') . qq|
+  | + . $locale->text('Active') . qq| + $onhand +  | + . $locale->text('Obsolete') . qq| +  | + . $locale->text('Orphaned') . qq| +
+
+
+ + + + + + + + + + + + + + + + +|; + for $i (1 .. $form->{price_rows}) { + print qq| + + + + + + +|; + } + + print qq| +
| . $locale->text('Preisklasse') . qq|| . $locale->text('Preis') . qq|| . $locale->text('Prozentual/Absolut') . qq|
| . $locale->text('Sell Price') . qq|/
| . $locale->text('List Price') . qq|/
$form->{"pricegroup_$i"}/
+

+ +{price_rows}> + +{path}> +{login}> +{password}> + +
+ + + + + +|; + $lxdebug->leave_sub(); +} #end search() + +sub confirm_price_update { + $lxdebug->enter_sub(); + + + $form->{nextsub} = "update_prices"; + $form->header; + + print qq| + + +
{script}> +|; + + # delete action variable + map { delete $form->{$_} } qw(action header); + + foreach $key (keys %$form) { + $form->{$key} =~ s/\"/"/g; + print qq|\n|; + } + + print qq| +

| . $locale->text('Confirm!') . qq|

+ +

| + . $locale->text('Are you sure you want to update the prices') +. qq|

+ +

+ +

+|; + + $lxdebug->leave_sub(); +} + +sub update_prices { + $lxdebug->enter_sub(); + + if (IC->update_prices(\%myconfig, \%$form)) { + $form->redirect($form->{update_count} . $locale->text('prices updated!')); + } else { + $form->error($locale->text('Could not update prices!')); + } + + $lxdebug->leave_sub(); +} + sub choice { $lxdebug->enter_sub(); @@ -870,7 +1097,7 @@ sub addtop100 { || $form->{rfq} || $form->{quoted}) { $form->{l_onhand} = "Y"; - } else { + } else { $form->{l_linetotalsellprice} = ""; $form->{l_linetotallastcost} = ""; } @@ -1456,7 +1683,7 @@ sub generate_report { || $form->{rfq} || $form->{quoted}) { $form->{l_onhand} = "Y"; - } else { + } else { $form->{l_linetotalsellprice} = ""; $form->{l_linetotallastcost} = ""; } @@ -1629,7 +1856,7 @@ sub generate_report { $column_data{partnumber} = "
{script}?action=edit&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{partnumber} $ref->{description} {script}?action=edit&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description} $ref->{partsgroup} 
| . $locale->text('Buchungsgruppe') . qq|
{gv}>
| + . $locale->text('Not Discountable') . qq|
@@ -2213,7 +2496,7 @@ sub form_header { |; } $shopok = $form->{shop} == 1 ? "checked" : ""; - $obsolete .= qq| + $shop .= qq|
| . $locale->text('Shopartikel') . qq|
@@ -2300,16 +2595,40 @@ sub form_header {
+ . $locale->text('') . qq| - $linkaccounts + + - + + + + + + +
| - . $locale->text('Link Accounts') . qq|
+ + $buchungsgruppe + $linkaccounts +
+
| . $locale->text('Notes') . qq|| . $locale->text('Formula') . qq|
+ $notes + $formel +
+ +
+ + + + + +
| . $locale->text('Payment Terms') . qq|
+
@@ -2331,12 +2650,14 @@ sub form_header { $lastcost | . $locale->text('Unit') . qq| - + $unit_select $weight $rop $bin + $notdiscountable $vegv + $shop $obsolete @@ -2439,6 +2760,7 @@ sub form_footer { print qq| + @@ -2662,7 +2984,7 @@ sub update { &check_form; - } else { + } else { IC->assembly_item(\%myconfig, \%$form); @@ -2706,6 +3028,7 @@ sub update { map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(sellprice listprice); &form_header; + &price_row; &form_footer; } @@ -2729,6 +3052,15 @@ sub save { if ($form->{onhand}); } + if (!$form->{buchungsgruppen_id}) { + $form->error($locale->text("Parts must have an entry type.") . " " . + $locale->text("If you see this message, you most likely just setup your LX-Office and haven't added any entry types. If this is the case, the option is accessible for administrators in the System menu.") + ); + } + + $form->error($locale->text('Description must not be empty!')) unless $form->{description}; + $form->error($locale->text('Partnumber must not be set to empty!')) if $form->{id} && !$form->{partnumber}; + # expand dynamic strings # $locale->text('Inventory quantity must be zero before you can set this part obsolete!') # $locale->text('Inventory quantity must be zero before you can set this assembly obsolete!') @@ -2860,6 +3192,10 @@ sub save_as_new { $lxdebug->enter_sub(); $form->{id} = 0; + if ($form->{"original_partnumber"} && + ($form->{"partnumber"} eq $form->{"original_partnumber"})) { + $form->{partnumber} = ""; + } &save; $lxdebug->leave_sub(); @@ -3085,4 +3421,37 @@ sub price_row { $lxdebug->leave_sub(); } + +sub parts_language_selection { + $lxdebug->enter_sub(); + + + my $languages = IC->retrieve_languages(\%myconfig, $form); + + + my $callback = "$form->{script}?action=parts_language_selection&"; + map({ $callback .= "$_=" . $form->escape($form->{$_}) . "&" } + (qw(login path password name input_name), grep({ /^[fl]_/ } keys %$form))); + + my @header_sort = qw(name longdescription); + my %header_title = ( "name" => $locale->text("Name"), + "longdescription" => $locale->text("Long Description"), + ); + + my @header = + map(+{ "column_title" => $header_title{$_}, + "column" => $_, + "callback" => $callback, + }, + @header_sort); + + $form->{"title"} = $locale->text("Language Values"); + $form->header(); + print($form->parse_html_template("ic/parts_language_selection", { "HEADER" => \@header, + "LANGUAGES" => $languages, + "onload" => $onload })); + + $lxdebug->leave_sub(); +} + sub continue { &{ $form->{nextsub} } }