X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fic.pl;h=a6237fab3bd7e4b2e78b12a1d255e2ec73592598;hb=3de3c10083058df01ea675e9db04b1a67f9713d0;hp=33a78b94dbe452263aaa16456a7c2fa75194c6ad;hpb=d319704a66e9be64da837ccea10af6774c2b0838;p=kivitendo-erp.git diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index 33a78b94d..a6237fab3 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -30,9 +30,12 @@ # Inventory Control module # #====================================================================== +#$locale->text('ea'); use SL::IC; +#use SL::PE; + require "$form->{path}/io.pl"; 1; @@ -48,9 +51,9 @@ 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; @@ -84,14 +87,12 @@ sub search { $button1 = qq| text('button') - . qq|> + . $locale->text('button') . qq|> |; $button2 = qq| text('button') - . qq|> + . $locale->text('button') . qq|> |; #write Trigger @@ -132,8 +133,7 @@ sub search { $l_serialnumber = qq|  | - . $locale->text('Serial Number') - . qq| + . $locale->text('Serial Number') . qq| |; } @@ -272,8 +272,7 @@ sub search { | - . $locale->text('Part Description') - . qq| + . $locale->text('Part Description') . qq| @@ -310,71 +309,55 @@ sub search { | - . $locale->text('Include in Report') - . qq| + . $locale->text('Include in Report') . qq| + . $locale->text('Part Number') . qq| + . $locale->text('Part Description') . qq| $l_serialnumber + . $locale->text('Unit of measure') . qq| + . $locale->text('List Price') . qq| - + . $locale->text('Sell Price') . qq| + + . $locale->text('Line Total') . qq| + . $locale->text('Updated') . qq| + . $locale->text('Bin') . qq| + . $locale->text('ROP') . qq| + . $locale->text('Weight') . qq| + . $locale->text('Image') . qq| + . $locale->text('Drawing') . qq| + . $locale->text('Microfiche') . qq| + . $locale->text('Group') . qq| + . $locale->text('Subtotal') . qq| + . $locale->text('soldtotal') . qq| +
 | - . $locale->text('Part Number') - . qq|  | - . $locale->text('Part Description') - . qq| | - . $locale->text('Unit of measure') - . qq|
 | - . $locale->text('List Price') - . qq|  | - . $locale->text('Sell Price') - . qq| | - . $locale->text('Last Cost') - . qq| | + . $locale->text('Last Cost') . qq|  | - . $locale->text('Line Total') - . qq|
 | - . $locale->text('Updated') - . qq|  | - . $locale->text('Bin') - . qq|  | - . $locale->text('ROP') - . qq|  | - . $locale->text('Weight') - . qq|
 | - . $locale->text('Image') - . qq|  | - . $locale->text('Drawing') - . qq|  | - . $locale->text('Microfiche') - . qq|  | - . $locale->text('Group') - . qq|
 | - . $locale->text('Subtotal') - . qq|  | - . $locale->text('soldtotal') - . qq| | + . $locale->text('deliverydate') . qq|
@@ -395,6 +378,7 @@ $jsscript + @@ -411,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}> + + + + + + + + @@ -2322,10 +2633,9 @@ sub form_header {
$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(); @@ -433,11 +643,9 @@ sub choice { + . $locale->text('Part Number') . qq| + . $locale->text('Part Description') . qq| @@ -527,7 +735,7 @@ sub choice { print qq| + . $locale->text('list') . qq|"> @@ -858,10 +1066,9 @@ sub addtop100 { $option .= $locale->text('soldtotal') . qq| : $form->{soldtotal}
|; } - @columns = - $form->sort_columns( + @columns = $form->sort_columns( qw(number partnumber description partsgroup bin onhand rop unit listprice linetotallistprice sellprice linetotalsellprice lastcost linetotallastcost priceupdate weight image drawing microfiche invnumber ordnumber quonumber name serialnumber soldtotal) - ); + ); if ($form->{l_linetotal}) { $form->{l_onhand} = "Y"; @@ -890,7 +1097,7 @@ sub addtop100 { || $form->{rfq} || $form->{quoted}) { $form->{l_onhand} = "Y"; - } else { + } else { $form->{l_linetotalsellprice} = ""; $form->{l_linetotallastcost} = ""; } @@ -1262,7 +1469,7 @@ sub addtop100 { print qq| - + |; @@ -1441,10 +1648,13 @@ sub generate_report { $option .= $locale->text('soldtotal') . qq| : $form->{soldtotal}
|; } - @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) - ); + 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 deliverydate) + ); if ($form->{l_linetotal}) { $form->{l_onhand} = "Y"; @@ -1473,7 +1683,7 @@ sub generate_report { || $form->{rfq} || $form->{quoted}) { $form->{l_onhand} = "Y"; - } else { + } else { $form->{l_linetotalsellprice} = ""; $form->{l_linetotallastcost} = ""; } @@ -1580,6 +1790,11 @@ sub generate_report { . $locale->text('soldtotal') . qq||; + $column_header{deliverydate} = + qq||; + $form->header; $colspan = $#column_index + 1; @@ -1641,7 +1856,7 @@ sub generate_report { $column_data{partnumber} = ""; - $column_data{description} = ""; + $column_data{description} = ""; $column_data{partsgroup} = ""; $column_data{onhand} = @@ -1731,6 +1946,8 @@ sub generate_report { . $form->format_amount(\%myconfig, $ref->{soldtotal}, '', " ") . ""; + $column_data{deliverydate} = ""; + $i++; $i %= 2; print ""; @@ -1921,7 +2138,9 @@ sub link_part { delete $form->{amount}; $form->get_partsgroup(\%myconfig, { all => 1 }); + $form->{partsgroup} = "$form->{partsgroup}--$form->{partsgroup_id}"; + if (@{ $form->{all_partsgroup} }) { $form->{selectpartsgroup} = 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||; @@ -1996,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}) { @@ -2008,6 +2268,7 @@ sub form_header { } } } + if ($form->{selectpartsgroup}) { $form->{selectpartsgroup} = $form->unescape($form->{selectpartsgroup}); $partsgroup = @@ -2034,8 +2295,7 @@ sub form_header { $lastcost = qq| + . $locale->text('Last Cost') . qq| |; @@ -2057,7 +2317,7 @@ sub form_header { - + @@ -2136,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"; @@ -2143,8 +2415,7 @@ sub form_header { + . $form->format_amount(\%myconfig, $form->{onhand}) . qq| |; @@ -2173,17 +2444,26 @@ sub form_header { $vegv = qq| + . $locale->text('Verrechnungseinheit') . qq| + . $locale->text('Geschäftsvolumen') . qq| |; + $notdiscountableok = ($form->{not_discountable}) == 1 ? "checked" : ""; + $notdiscountable .= qq| + + + + +|; + + $formel = + qq||; $imagelinks = qq| + . $locale->text('Shopartikel') . qq| |; + # type=submit $locale->text('Add Part') # type=submit $locale->text('Add Service') # type=submit $locale->text('Add Assembly') @@ -2239,14 +2519,12 @@ sub form_header { $button1 = qq| + . $locale->text('button') . qq|> |; #write Trigger $jsscript = - Form->write_trigger(\%myconfig, "1", "priceupdate", "BL", "trigger1", "", - "", ""); + Form->write_trigger(\%myconfig, "1", "priceupdate", "BL", "trigger1"); } else { # without JavaScript Calendar @@ -2254,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}> @@ -2273,6 +2560,7 @@ sub form_header { {rowcount}> +
| - . $locale->text('Part Number') - . qq| | - . $locale->text('Part Description') - . 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('Last Cost') - . qq| {lastcost}>
| . $locale->text('COGS') . qq|| . $locale->text('Expense') . qq|
| . $locale->text('On Hand') . qq|  | - . $form->format_amount(\%myconfig, $form->{onhand}) - . qq|
| - . $locale->text('Verrechnungseinheit') - . qq| {ve}>
| - . $locale->text('Geschäftsvolumen') - . qq| {gv}>
| + . $locale->text('Not Discountable') . qq|
@@ -2214,15 +2494,15 @@ sub form_header { |; } $shopok = $form->{shop} == 1 ? "checked" : ""; - $obsolete .= qq| + $shop .= qq|
| - . $locale->text('Shopartikel') - . qq|
text('button') - . qq|>
@@ -2304,17 +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|
+
+ . $locale->text('Updated') . qq| $button1 - + @@ -2337,12 +2647,14 @@ sub form_header { $lastcost - + $weight $rop $bin + $notdiscountable $vegv + $shop $obsolete
| - . $locale->text('Updated') - . qq|
| . $locale->text('List Price') . qq| {listprice}>
| . $locale->text('Unit') . qq|$unit_select
@@ -2351,7 +2663,7 @@ sub form_header { $imagelinks - + $jsscript |; $lxdebug->leave_sub(); @@ -2368,11 +2680,9 @@ sub form_footer { + . $locale->text('Total') . qq|  + . $form->format_amount(\%myconfig, $form->{assemblytotal}, 2) . qq|
| - . $locale->text('Total') - . qq|  | - . $form->format_amount(\%myconfig, $form->{assemblytotal}, 2) - . qq|
@@ -2405,6 +2715,9 @@ sub form_footer { |; } + print qq| + {price_rows}>|; + print qq| |; @@ -2444,6 +2757,7 @@ sub form_footer { print qq| + @@ -2630,6 +2944,8 @@ sub assembly_row { $column_data{total} = qq|$linetotal|; + $column_data{deliverydate} = qq|$deliverydate|; + print qq| |; @@ -2665,7 +2981,7 @@ sub update { &check_form; - } else { + } else { IC->assembly_item(\%myconfig, \%$form); @@ -2708,8 +3024,8 @@ sub update { if ($form->{item} eq 'service') { map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(sellprice listprice); - &form_header; + &price_row; &form_footer; } @@ -2719,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( @@ -2730,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!') @@ -2738,6 +3066,8 @@ sub save { # $locale->text('Assembly Number missing!') # save part + $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!')); @@ -2792,11 +3122,12 @@ sub save { map { $form->{"${_}_$i"} = $newform{$_} } qw(partnumber description bin unit listprice inventory_accno income_accno expense_accno sellprice); $form->{"sellprice_$i"} = $newform{lastcost} if ($form->{vendor_id}); - if ($form->{exchangerate} != 0) { $form->{"sellprice_$i"} /= $form->{exchangerate}; } - + $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"}; @@ -2817,6 +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); } $form->{"id_$i"} = $parts_id; @@ -2838,6 +3175,9 @@ sub save { } $form->{callback} = $callback; } + $lxdebug->message(LXDebug::DEBUG1, + qq|ic.pl: sellprice_$i nach sub save = | + . $form->{"sellprice_$i"} . qq|\n|); # redirect $form->redirect; @@ -2849,6 +3189,7 @@ sub save_as_new { $lxdebug->enter_sub(); $form->{id} = 0; + $form->{partnumber} = ""; &save; $lxdebug->leave_sub(); @@ -2888,15 +3229,13 @@ sub stock_assembly { + . $locale->text('Part Number') . qq| + . $locale->text('Part Description') . qq|
| - . $locale->text('Part Number') - . qq|  
| - . $locale->text('Part Description') - . qq|
@@ -3043,5 +3382,70 @@ sub restock_assemblies { $lxdebug->leave_sub(); } -sub continue { &{ $form->{nextsub} } } +sub price_row { + $lxdebug->enter_sub(); + + my ($numrows) = @_; + + print qq| + + + + + + + +|; + for $i (1 .. $numrows) { + print qq| + + + + + +|; + } + + print qq| +
| . $locale->text('Preisklasse') . qq|| . $locale->text('Preis') . qq|
$form->{"pricegroup_$i"}
+ + +|; + + $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} } }