X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fic.pl;h=a6237fab3bd7e4b2e78b12a1d255e2ec73592598;hb=3de3c10083058df01ea675e9db04b1a67f9713d0;hp=f5e581d6f49bd6e320f3948d483227e6d30daf20;hpb=a8109605459d614e11b7fcf86cd0b070e0a233d0;p=kivitendo-erp.git diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index f5e581d6f..a6237fab3 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -30,8 +30,10 @@ # Inventory Control module # #====================================================================== +#$locale->text('ea'); use SL::IC; + #use SL::PE; require "$form->{path}/io.pl"; @@ -49,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; @@ -324,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| @@ -354,6 +356,8 @@ sub search { . $locale->text('Subtotal') . qq|  | . $locale->text('soldtotal') . qq| +  | + . $locale->text('deliverydate') . qq| @@ -374,6 +378,7 @@ $jsscript + @@ -390,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}> + + + + + + + + |; + $form->header; $colspan = $#column_index + 1; @@ -1616,7 +1856,7 @@ sub generate_report { $column_data{partnumber} = ""; - $column_data{description} = ""; + $column_data{description} = ""; $column_data{partsgroup} = ""; $column_data{onhand} = @@ -1706,6 +1946,8 @@ sub generate_report { . $form->format_amount(\%myconfig, $ref->{soldtotal}, '', " ") . ""; + $column_data{deliverydate} = ""; + $i++; $i %= 2; print ""; @@ -1933,18 +2175,18 @@ sub form_header { $lxdebug->enter_sub(); my $dec = ''; - + #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->{$_} = @@ -1953,7 +2195,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); @@ -1965,12 +2207,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||; @@ -1983,6 +2235,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}) { @@ -2044,7 +2317,7 @@ sub form_header { - + @@ -2123,6 +2396,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"; @@ -2168,6 +2453,17 @@ sub form_header { |; + $notdiscountableok = ($form->{not_discountable}) == 1 ? "checked" : ""; + $notdiscountable .= qq| + + + + +|; + + $formel = + qq||; $imagelinks = qq| @@ -2206,6 +2502,7 @@ sub form_header { |; + # type=submit $locale->text('Add Part') # type=submit $locale->text('Add Service') # type=submit $locale->text('Add Assembly') @@ -2227,8 +2524,7 @@ sub form_header { #write Trigger $jsscript = - Form->write_trigger(\%myconfig, "1", "priceupdate", "BL", "trigger1", "", - "", ""); + Form->write_trigger(\%myconfig, "1", "priceupdate", "BL", "trigger1"); } else { # without JavaScript Calendar @@ -2236,12 +2532,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}> @@ -2255,6 +2560,7 @@ 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(); @@ -866,7 +1097,7 @@ sub addtop100 { || $form->{rfq} || $form->{quoted}) { $form->{l_onhand} = "Y"; - } else { + } else { $form->{l_linetotalsellprice} = ""; $form->{l_linetotallastcost} = ""; } @@ -1417,8 +1648,12 @@ sub generate_report { $option .= $locale->text('soldtotal') . qq| : $form->{soldtotal}
|; } + if ($form->{l_deliverydate}) { + $callback .= "&deliverydate=$form->{deliverydate}"; + } + @columns = $form->sort_columns( - qw(partnumber description partsgroup bin onhand rop unit listprice linetotallistprice sellprice linetotalsellprice lastcost linetotallastcost priceupdate weight image drawing microfiche invnumber ordnumber quonumber name serialnumber soldtotal) + qw(partnumber description partsgroup bin onhand rop unit listprice linetotallistprice sellprice linetotalsellprice lastcost linetotallastcost priceupdate weight image drawing microfiche invnumber ordnumber quonumber name serialnumber soldtotal deliverydate) ); if ($form->{l_linetotal}) { @@ -1448,7 +1683,7 @@ sub generate_report { || $form->{rfq} || $form->{quoted}) { $form->{l_onhand} = "Y"; - } else { + } else { $form->{l_linetotalsellprice} = ""; $form->{l_linetotallastcost} = ""; } @@ -1555,6 +1790,11 @@ sub generate_report { . $locale->text('soldtotal') . qq||; + $column_header{deliverydate} = + qq|
{revers}&lastsort=$form->{lastsort}>| + . $locale->text('deliverydate') + . qq|{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} $ref->{deliverydate}
| . $locale->text('Buchungsgruppe') . qq|
| . $locale->text('COGS') . qq|| . $locale->text('Expense') . qq|
{gv}>
| + . $locale->text('Not Discountable') . qq|
@@ -2198,7 +2494,7 @@ sub form_header { |; } $shopok = $form->{shop} == 1 ? "checked" : ""; - $obsolete .= qq| + $shop .= qq|
| . $locale->text('Shopartikel') . qq|
@@ -2286,16 +2592,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|
+
@@ -2317,12 +2647,14 @@ sub form_header { $lastcost | . $locale->text('Unit') . qq| - + $unit_select $weight $rop $bin + $notdiscountable $vegv + $shop $obsolete @@ -2425,6 +2757,7 @@ sub form_footer { print qq| + @@ -2611,6 +2944,8 @@ sub assembly_row { $column_data{total} = qq|$linetotal|; + $column_data{deliverydate} = qq|$deliverydate|; + print qq| |; @@ -2646,7 +2981,7 @@ sub update { &check_form; - } else { + } else { IC->assembly_item(\%myconfig, \%$form); @@ -2690,6 +3025,7 @@ sub update { map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(sellprice listprice); &form_header; + &price_row; &form_footer; } @@ -2699,9 +3035,12 @@ sub update { sub save { $lxdebug->enter_sub(); - # check if there is a part number + # check if there is a part number - commented out, cause there is an automatic allocation of numbers # $form->isblank("partnumber", $locale->text(ucfirst $form->{item}." Part Number missing!")); + # check if there is a description + $form->isblank("description", $locale->text("Part Description missing!")); + if ($form->{obsolete}) { $form->error( $locale->text( @@ -2710,6 +3049,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!') @@ -2718,7 +3066,8 @@ sub save { # $locale->text('Assembly Number missing!') # save part - $lxdebug->message(LXDebug::DEBUG1, "ic.pl: sellprice in save = $form->{sellprice}\n"); + $lxdebug->message(LXDebug::DEBUG1, + "ic.pl: sellprice in save = $form->{sellprice}\n"); $rc = IC->save(\%myconfig, \%$form); if ($rc == 3) { $form->error($locale->text('Partnumber not unique!')); @@ -2776,7 +3125,9 @@ sub save { if ($form->{exchangerate} != 0) { $form->{"sellprice_$i"} /= $form->{exchangerate}; } - $lxdebug->message(LXDebug::DEBUG1, qq|sellprice_$i in previousform 2 = |.$form->{"sellprice_$i"}.qq|\n|); + $lxdebug->message(LXDebug::DEBUG1, + qq|sellprice_$i in previousform 2 = | + . $form->{"sellprice_$i"} . qq|\n|); map { $form->{"taxaccounts_$i"} .= "$_ " } split / /, $newform{taxaccount}; chop $form->{"taxaccounts_$i"}; @@ -2797,10 +3148,12 @@ sub save { $form->{creditremaining} -= $amount; - # redo number formatting, because invoice parse them! - $i = $form->{rowcount}; - map { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}) } - qw(weight listprice sellprice rop); + # redo number formatting, because invoice parse them! + $i = $form->{rowcount}; + map { + $form->{"${_}_$i"} = + $form->format_amount(\%myconfig, $form->{"${_}_$i"}) + } qw(weight listprice sellprice rop); } $form->{"id_$i"} = $parts_id; @@ -2822,7 +3175,10 @@ sub save { } $form->{callback} = $callback; } - $lxdebug->message(LXDebug::DEBUG1, qq|ic.pl: sellprice_$i nach sub save = |.$form->{"sellprice_$i"}.qq|\n|); + $lxdebug->message(LXDebug::DEBUG1, + qq|ic.pl: sellprice_$i nach sub save = | + . $form->{"sellprice_$i"} . qq|\n|); + # redirect $form->redirect; @@ -2833,6 +3189,7 @@ sub save_as_new { $lxdebug->enter_sub(); $form->{id} = 0; + $form->{partnumber} = ""; &save; $lxdebug->leave_sub(); @@ -3042,7 +3399,7 @@ sub price_row { for $i (1 .. $numrows) { print qq| - {"pricegroup_$i"}>$form->{"pricegroup_$i"} + $form->{"pricegroup_$i"} @@ -3058,4 +3415,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} } }