X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fic.pl;h=222a4d1d500c509e04f2369bb729419fd707c86f;hb=e967296577305948fa2e4b7fd3d256c2509b2080;hp=3eb67383cdc96123082fca1418aa998da70e4637;hpb=67079598f8f98a12e12a8acddc3afbf12bb58c5d;p=kivitendo-erp.git diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index 3eb67383c..222a4d1d5 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -38,6 +38,7 @@ use List::MoreUtils qw(any); use SL::AM; use SL::CVar; use SL::IC; +use SL::Helper::Flash; use SL::ReportGenerator; #use SL::PE; @@ -288,7 +289,6 @@ sub update_prices { # $form->header; # # print qq| -# #
# # @@ -388,8 +388,6 @@ sub update_prices { # . $locale->text('TOP100') . qq|"> # # -# -# #|; # $lxdebug->leave_sub(); #} #end list() @@ -725,8 +723,6 @@ sub addtop100 { my $colspan = $#column_index + 1; print qq| - -
@@ -977,13 +973,10 @@ sub addtop100 { print qq| - + - - - |; $lxdebug->leave_sub(); @@ -1010,7 +1003,7 @@ sub addtop100 { # bought sold onorder ordered rfq quoted # l_partnumber l_description l_serialnumber l_unit l_listprice l_sellprice l_lastcost # l_linetotal l_priceupdate l_bin l_rop l_weight l_image l_drawing l_microfiche -# l_partsgroup l_subtotal l_soldtotal l_deliverydate +# l_partsgroup l_subtotal l_soldtotal l_deliverydate l_pricegroups # # hiddens: # nextsub revers lastsort sort ndxs_counter @@ -1032,6 +1025,7 @@ sub generate_report { 'bin' => { 'text' => $locale->text('Bin'), }, 'deliverydate' => { 'text' => $locale->text('deliverydate'), }, 'description' => { 'text' => $locale->text('Part Description'), }, + 'notes' => { 'text' => $locale->text('Notes'), }, 'drawing' => { 'text' => $locale->text('Drawing'), }, 'ean' => { 'text' => $locale->text('EAN'), }, 'image' => { 'text' => $locale->text('Image'), }, @@ -1214,24 +1208,45 @@ sub generate_report { IC->all_parts(\%myconfig, \%$form); my @columns = qw( - partnumber description partsgroup bin onhand rop soldtotal unit listprice + partnumber description notes partsgroup bin onhand rop soldtotal unit listprice linetotallistprice sellprice linetotalsellprice lastcost linetotallastcost priceupdate weight image drawing microfiche invnumber ordnumber quonumber transdate name serialnumber deliverydate ean projectnumber projectdescription ); + my $pricegroups = SL::DB::Manager::Pricegroup->get_all(sort => 'id'); + my @pricegroup_columns; + my %column_defs_pricegroups; + if ($form->{l_pricegroups}) { + @pricegroup_columns = map { "pricegroup_" . $_->id } @{ $pricegroups }; + %column_defs_pricegroups = map { + "pricegroup_" . $_->id => { + text => $::locale->text('Pricegroup') . ' ' . $_->pricegroup, + visible => 1, + }, + } @{ $pricegroups }; + } + push @columns, @pricegroup_columns; + my @includeable_custom_variables = grep { $_->{includeable} } @{ $cvar_configs }; my @searchable_custom_variables = grep { $_->{searchable} } @{ $cvar_configs }; my %column_defs_cvars = map { +"cvar_$_->{name}" => { 'text' => $_->{description} } } @includeable_custom_variables; push @columns, map { "cvar_$_->{name}" } @includeable_custom_variables; - %column_defs = (%column_defs,%column_defs_cvars); # nochmal die cvars als überschrift hinzufügen - map { $column_defs{$_}->{visible} = $form->{"l_$_"} ? 1 : 0 } @columns; - map { $column_defs{$_}->{align} = 'right' } qw(onhand sellprice listprice lastcost linetotalsellprice linetotallastcost linetotallistprice rop weight soldtotal); + %column_defs = (%column_defs, %column_defs_cvars, %column_defs_pricegroups); + map { $column_defs{$_}->{visible} ||= $form->{"l_$_"} ? 1 : 0 } @columns; + map { $column_defs{$_}->{align} = 'right' } qw(onhand sellprice listprice lastcost linetotalsellprice linetotallastcost linetotallistprice rop weight soldtotal), @pricegroup_columns; + + my @hidden_variables = ( + qw(l_subtotal l_linetotal searchitems itemstatus bom l_pricegroups), + @itemstatus_keys, + @callback_keys, + map({ "cvar_$_->{name}" } @searchable_custom_variables), + map({'cvar_'. $_->{name} .'_qtyop'} grep({$_->{type} eq 'number'} @searchable_custom_variables)), + map({ "l_$_" } @columns), + ); - my @hidden_variables = (qw(l_subtotal l_linetotal searchitems itemstatus bom), @itemstatus_keys, @callback_keys, - map({ "cvar_$_->{name}" } @searchable_custom_variables), map { "l_$_" } @columns); my $callback = build_std_url('action=generate_report', grep { $form->{$_} } @hidden_variables); my @sort_full = qw(partnumber description onhand soldtotal deliverydate); @@ -1316,9 +1331,13 @@ sub generate_report { $row->{description}->{link} = $edit_link; foreach (qw(sellprice listprice lastcost)) { - $row->{$_}{data} = $form->format_amount(\%myconfig, $ref->{$_}, -2); + $row->{$_}{data} = $form->format_amount(\%myconfig, $ref->{$_}, 2); $row->{"linetotal$_"}{data} = $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{$_}, 2); } + foreach ( @pricegroup_columns ) { + $row->{$_}{data} = $form->format_amount(\%myconfig, $ref->{"$_"}, 2); + }; + map { $row->{$_}{data} = $form->format_amount(\%myconfig, $ref->{$_}); } qw(onhand rop weight soldtotal); @@ -1382,7 +1401,7 @@ sub generate_report { $idx++; } - if ($form->{"l_linetotal"}) { + if ($form->{"l_linetotal"} && !$form->{report_generator_csv_options_for_import}) { my $row = { map { $_ => { 'class' => 'listtotal', } } @columns }; map { $row->{"linetotal$_"}->{data} = $form->format_amount(\%myconfig, $totals{$_}, 2) } @subtotal_columns; @@ -1573,6 +1592,10 @@ sub form_header { IC->retrieve_buchungsgruppen(\%myconfig, $form); @{ $form->{BUCHUNGSGRUPPEN} } = grep { $_->{id} eq $form->{buchungsgruppen_id} || ($form->{id} && $form->{orphaned}) || !$form->{id} } @{ $form->{BUCHUNGSGRUPPEN} }; + if (($form->{partnumber} ne '') && !SL::TransNumber->new(number => $form->{partnumber}, type => $form->{item}, id => $form->{id})->is_unique) { + flash('info', $::locale->text('This partnumber is not unique. You should change it.')); + } + # use JavaScript Calendar or not (yes!) $form->{jsscript} = 1; @@ -1581,7 +1604,7 @@ sub form_header { $form->{defaults} = AM->get_defaults(); - $form->{fokus} = "ic.partnumber"; + $::request->{layout}->focus("#partnumber"); $form->{CUSTOM_VARIABLES} = CVar->get_custom_variables('module' => 'IC', 'trans_id' => $form->{id}); @@ -1652,15 +1675,15 @@ sub assembly_row { } my %header = ( - runningnumber => { text => $locale->text('No.'), nowrap => 1, width => '5%' }, - qty => { text => $locale->text('Qty'), nowrap => 1, width => '10%' }, - unit => { text => $locale->text('Unit'), nowrap => 1, width => '5%' }, - partnumber => { text => $locale->text('Part Number'), nowrap => 1, width => '20%' }, - description => { text => $locale->text('Part Description'), nowrap => 1, width => '50%' }, - lastcost => { text => $locale->text('Purchase Prices'), nowrap => 1, width => '50%' }, - total => { text => $locale->text('Sale Prices'), nowrap => 1, }, - bom => { text => $locale->text('BOM'), }, - partsgroup => { text => $locale->text('Group'), }, + runningnumber => { text => $locale->text('No.'), nowrap => 1, width => '5%', align => 'left',}, + qty => { text => $locale->text('Qty'), nowrap => 1, width => '10%', align => 'left',}, + unit => { text => $locale->text('Unit'), nowrap => 1, width => '5%', align => 'left',}, + partnumber => { text => $locale->text('Part Number'), nowrap => 1, width => '20%', align => 'left',}, + description => { text => $locale->text('Part Description'), nowrap => 1, width => '50%', align => 'left',}, + lastcost => { text => $locale->text('Purchase Prices'), nowrap => 1, width => '50%', align => 'right',}, + total => { text => $locale->text('Sale Prices'), nowrap => 1, align => 'right',}, + bom => { text => $locale->text('BOM'), align => 'center',}, + partsgroup => { text => $locale->text('Group'), align => 'left',}, ); my @ROWS; @@ -1677,7 +1700,7 @@ sub assembly_row { $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}); $linetotal = $form->format_amount(\%myconfig, $linetotal, 2); $line_purchase_price = $form->format_amount(\%myconfig, $line_purchase_price, 2); - $href = qq|$form->{script}?action=edit&id=$form->{"id_$i"}&rowcount=$i&previousform=$previousform|; + $href = build_std_url("action=edit", qq|id=$form->{"id_$i"}|, "rowcount=$numrows", "currow=$i", "previousform=$previousform"); map { $row{$_}{data} = "" } qw(qty unit partnumber description bom partsgroup runningnumber); # last row @@ -1697,7 +1720,8 @@ sub assembly_row { $row{bom}{data} = $form->{"bom_$i"} ? "x" : " "; $row{qty}{align} = 'right'; } else { - $row{partnumber}{data} = qq|$form->{"partnumber_$i"}|; + $row{partnumber}{data} = qq|$form->{"partnumber_$i"}|; + $row{partnumber}{link} = $href; $row{qty}{data} = qq||; $row{runningnumber}{data} = qq||; $row{bom}{data} = sprintf qq||, @@ -1705,9 +1729,14 @@ sub assembly_row { } push @row_hiddens, qw(unit description partnumber partsgroup); $row{unit}{data} = $form->{"unit_$i"}; - $row{description}{data} = $form->{"description_$i"}; - $row{partsgroup}{data} = $form->{"partsgroup_$i"}; - $row{bom}{align} = 'center'; + #Bei der Artikelbeschreibung und Warengruppe können Sonderzeichen verwendet + #werden, die den HTML Code stören. Daher sollen diese im Template escaped werden + #dies geschieht, wenn die Variable escape gesetzt ist + $row{description}{data} = $form->{"description_$i"}; + $row{description}{escape} = 1; + $row{partsgroup}{data} = $form->{"partsgroup_$i"}; + $row{partsgroup}{escape} = 1; + $row{bom}{align} = 'center'; } $row{lastcost}{data} = $line_purchase_price; @@ -1732,9 +1761,14 @@ sub update { # parse pricegroups. and no, don't rely on check_form for this... map { $form->{"price_$_"} = $form->parse_amount(\%myconfig, $form->{"price_$_"}) } 1 .. $form->{price_rows}; + $form->{sellprice} = $form->parse_amount(\%myconfig, $form->{sellprice}); - # same for lastcosts - map { $form->{"lastcost_$_"} = $form->parse_amount(\%myconfig, $form->{"lastcost_$_"}) } 1 .. $form->{"makemodel_rows"}; + # same for makemodel lastcosts + # but parse_amount not necessary for assembly component lastcosts + unless ($form->{item} eq "assembly") { + map { $form->{"lastcost_$_"} = $form->parse_amount(\%myconfig, $form->{"lastcost_$_"}) } 1 .. $form->{"makemodel_rows"}; + }; + $form->{listprice} = $form->parse_amount(\%myconfig, $form->{listprice}); if ($form->{item} eq "assembly") { my $i = $form->{assembly_rows}; @@ -1814,7 +1848,6 @@ sub save { $form->error($locale->text('Partnumber must not be set to empty!')) if $form->{id} && !$form->{partnumber}; # save part - $lxdebug->message($LXDebug::DEBUG1, "ic.pl: sellprice in save = $form->{sellprice}\n"); if (IC->save(\%myconfig, \%$form) == 3) { $form->error($locale->text('Partnumber not unique!')); } @@ -1851,7 +1884,11 @@ sub save { qw(weight listprice sellprice rop); $form->{assembly_rows}--; - $i = $form->{assembly_rows}; + if ($newform{currow}) { + $i = $newform{currow}; + } else { + $i = $form->{assembly_rows}; + } $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"}); $form->{sellprice} -= $form->{"sellprice_$i"} * $form->{"qty_$i"}; @@ -1882,8 +1919,6 @@ sub save { $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"}; foreach my $item (qw(description rate taxnumber)) { @@ -1932,7 +1967,6 @@ 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; @@ -2016,6 +2050,10 @@ sub parts_language_selection { $language->{translation} = $translation; $language->{longdescription} = $longdescription; + + $language->{translation_area} = ($language->{translation_rows} = $form->numtextrows($language->{translation}, 40)) > 1; + $language->{longdescription_rows} = max 4, $form->numtextrows($language->{longdescription}, 40); + last; } }
$form->{title}