X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fic.pl;h=7ecd3a24cff3a0dbf679738de0617ed0b70c7c61;hb=b5ef28b5f726161fa6be4a9191f7d3f4e2972ceb;hp=daddf6a0c2dde444cf7a7a5f115aa554648f1216;hpb=89903af3c6f64c4d14e97d6654d1bb247f67a31f;p=kivitendo-erp.git diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index daddf6a0c..7ecd3a24c 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; @@ -183,7 +185,7 @@ sub search {   | . $locale->text('From') . qq| $button1 - | . $locale->text('To') . qq| + | . $locale->text('To (time)') . qq| $button2 @@ -233,7 +235,7 @@ sub search { | . $locale->text('From') . qq| $button1 - | . $locale->text('To') . qq| + | . $locale->text('To (time)') . qq| $button2 @@ -267,6 +269,8 @@ sub search { | . $locale->text('Part Number') . qq| + | . $locale->text('EAN') . qq| + | @@ -324,7 +328,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 +358,8 @@ sub search { . $locale->text('Subtotal') . qq|  | . $locale->text('soldtotal') . qq| +  | + . $locale->text('deliverydate') . qq| @@ -374,6 +380,7 @@ $jsscript + @@ -390,6 +397,231 @@ $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{partnumber} = ""; @@ -1081,32 +1317,29 @@ sub addtop100 { $column_data{onhand} = ""; $column_data{sellprice} = ""; $column_data{listprice} = ""; $column_data{lastcost} = ""; $column_data{linetotalsellprice} = ""; $column_data{linetotallastcost} = ""; $column_data{linetotallistprice} = ""; if (!$ref->{assemblyitem}) { @@ -1122,10 +1355,10 @@ sub addtop100 { $column_data{rop} = ""; + . $form->format_amount(\%myconfig, $ref->{rop}) . ""; $column_data{weight} = ""; $column_data{unit} = ""; $column_data{bin} = ""; @@ -1182,15 +1415,15 @@ sub addtop100 { map { $column_data{$_} = "" } @column_index; $column_data{linetotalsellprice} = ""; $column_data{linetotallastcost} = ""; $column_data{linetotallistprice} = ""; print ""; @@ -1240,14 +1473,8 @@ sub addtop100 { |; - - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } + . $locale->text('choice') . qq|"> - print qq| @@ -1365,7 +1592,7 @@ sub generate_report { if ($form->{transdateto}) { $callback .= "&transdateto=$form->{transdateto}"; $option .= "\n
" - . $locale->text('To') + . $locale->text('To (time)') . " " . $locale->date(\%myconfig, $form->{transdateto}, 1); } @@ -1417,8 +1644,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 +1679,7 @@ sub generate_report { || $form->{rfq} || $form->{quoted}) { $form->{l_onhand} = "Y"; - } else { + } else { $form->{l_linetotalsellprice} = ""; $form->{l_linetotallastcost} = ""; } @@ -1555,6 +1786,11 @@ sub generate_report { . $locale->text('soldtotal') . qq||; + $column_header{deliverydate} = + qq||; + $form->header; $colspan = $#column_index + 1; @@ -1616,37 +1852,34 @@ sub generate_report { $column_data{partnumber} = ""; - $column_data{description} = ""; + $column_data{description} = ""; $column_data{partsgroup} = ""; $column_data{onhand} = ""; $column_data{sellprice} = ""; $column_data{listprice} = ""; $column_data{lastcost} = ""; $column_data{linetotalsellprice} = ""; $column_data{linetotallastcost} = ""; $column_data{linetotallistprice} = ""; if (!$ref->{assemblyitem}) { @@ -1662,10 +1895,10 @@ sub generate_report { $column_data{rop} = ""; + . $form->format_amount(\%myconfig, $ref->{rop}) . ""; $column_data{weight} = ""; $column_data{unit} = ""; $column_data{bin} = ""; @@ -1703,9 +1936,11 @@ sub generate_report { $column_data{soldtotal} = ""; + $column_data{deliverydate} = ""; + $i++; $i %= 2; print ""; @@ -1726,15 +1961,15 @@ sub generate_report { map { $column_data{$_} = "" } @column_index; $column_data{linetotalsellprice} = ""; $column_data{linetotallastcost} = ""; $column_data{linetotallistprice} = ""; print ""; @@ -1767,14 +2002,8 @@ sub generate_report { print qq| |; - - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } + . $locale->text('Add') . qq|"> - print qq| @@ -1792,20 +2021,20 @@ sub parts_subtotal { $column_data{onhand} = ""; $column_data{linetotalsellprice} = ""; $column_data{linetotallistprice} = ""; $column_data{linetotallastcost} = ""; $subtotalonhand = 0; @@ -1826,9 +2055,13 @@ 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"}; + $form->{title} = $locale->text('Edit ' . ucfirst $form->{item}); &link_part; @@ -1843,8 +2076,8 @@ sub link_part { IC->create_links("IC", \%myconfig, \%$form); # currencies - map { $form->{selectcurrency} .= "|; + 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||; @@ -1979,10 +2199,33 @@ sub form_header { qq||; } + $ean = qq||; + foreach $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} }) { + if ($item->{id} == $form->{buchungsgruppen_id}) { + $form->{selectbuchungsgruppe} .= + " + + + |; + + # set option foreach $item (qw(IC IC_income IC_expense)) { if ($form->{$item}) { @@ -2044,7 +2287,7 @@ sub form_header { - + @@ -2059,11 +2302,6 @@ 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(); @@ -797,6 +1029,10 @@ sub addtop100 { $callback .= "&partnumber=$form->{partnumber}"; $option .= $locale->text('Part Number') . qq| : $form->{partnumber}
|; } + if ($form->{ean}) { + $callback .= "&partnumber=$form->{ean}"; + $option .= $locale->text('EAN') . qq| : $form->{ean}
|; + } if ($form->{partsgroup}) { $callback .= "&partsgroup=$form->{partsgroup}"; $option .= $locale->text('Group') . qq| : $form->{partsgroup}
|; @@ -836,7 +1072,7 @@ sub addtop100 { } @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) + qw(number partnumber ean 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}) { @@ -866,7 +1102,7 @@ sub addtop100 { || $form->{rfq} || $form->{quoted}) { $form->{l_onhand} = "Y"; - } else { + } else { $form->{l_linetotalsellprice} = ""; $form->{l_linetotallastcost} = ""; } @@ -1072,7 +1308,7 @@ sub addtop100 { $column_data{number} = "
" - . $form->format_amount(\%myconfig, $ref->{number}, '', " ") + . $form->format_amount(\%myconfig, $ref->{number}) . "$ref->{partnumber} " - . $form->format_amount(\%myconfig, $ref->{onhand}, '', " ") + . $form->format_amount(\%myconfig, $ref->{onhand}) . "" - . $form->format_amount(\%myconfig, $ref->{sellprice}, 2, " ") + . $form->format_amount(\%myconfig, $ref->{sellprice}) . "" - . $form->format_amount(\%myconfig, $ref->{listprice}, 2, " ") + . $form->format_amount(\%myconfig, $ref->{listprice}) . "" - . $form->format_amount(\%myconfig, $ref->{lastcost}, 2, " ") + . $form->format_amount(\%myconfig, $ref->{lastcost}) . "" - . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{sellprice}, - 2, " ") + . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{sellprice}, 2) . "" - . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{lastcost}, - 2, " ") + . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{lastcost}, 2) . "" - . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{listprice}, - 2, " ") + . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{listprice}, 2) . "" - . $form->format_amount(\%myconfig, $ref->{rop}, '', " ") . "" - . $form->format_amount(\%myconfig, $ref->{weight}, '', " ") + . $form->format_amount(\%myconfig, $ref->{weight}) . "$ref->{unit} $ref->{bin}  " - . $form->format_amount(\%myconfig, $totalsellprice, 2, " ") + . $form->format_amount(\%myconfig, $totalsellprice, 2) . "" - . $form->format_amount(\%myconfig, $totallastcost, 2, " ") + . $form->format_amount(\%myconfig, $totallastcost, 2) . "" - . $form->format_amount(\%myconfig, $totallistprice, 2, " ") + . $form->format_amount(\%myconfig, $totallistprice, 2) . "
{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} " - . $form->format_amount(\%myconfig, $ref->{onhand}, '', " ") + . $form->format_amount(\%myconfig, $ref->{onhand}) . "" - . $form->format_amount(\%myconfig, $ref->{sellprice}, 2, " ") + . $form->format_amount(\%myconfig, $ref->{sellprice}, -2) . "" - . $form->format_amount(\%myconfig, $ref->{listprice}, 2, " ") + . $form->format_amount(\%myconfig, $ref->{listprice}, -2) . "" - . $form->format_amount(\%myconfig, $ref->{lastcost}, 2, " ") + . $form->format_amount(\%myconfig, $ref->{lastcost}, -2) . "" - . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{sellprice}, - 2, " ") + . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{sellprice}, 2) . "" - . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{lastcost}, - 2, " ") + . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{lastcost}, 2) . "" - . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{listprice}, - 2, " ") + . $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{listprice}, 2) . "" - . $form->format_amount(\%myconfig, $ref->{rop}, '', " ") . "" - . $form->format_amount(\%myconfig, $ref->{weight}, '', " ") + . $form->format_amount(\%myconfig, $ref->{weight}) . "$ref->{unit} $ref->{bin} " - . $form->format_amount(\%myconfig, $ref->{soldtotal}, '', " ") + . $form->format_amount(\%myconfig, $ref->{soldtotal}) . "$ref->{deliverydate}
 " - . $form->format_amount(\%myconfig, $totalsellprice, 2, " ") + . $form->format_amount(\%myconfig, $totalsellprice, 2) . "" - . $form->format_amount(\%myconfig, $totallastcost, 2, " ") + . $form->format_amount(\%myconfig, $totallastcost, 2) . "" - . $form->format_amount(\%myconfig, $totallistprice, 2, " ") + . $form->format_amount(\%myconfig, $totallistprice, 2) . "
" - . $form->format_amount(\%myconfig, $subtotalonhand, '', " ") + . $form->format_amount(\%myconfig, $subtotalonhand) . "" - . $form->format_amount(\%myconfig, $subtotalsellprice, 2, " ") + . $form->format_amount(\%myconfig, $subtotalsellprice, 2) . "" - . $form->format_amount(\%myconfig, $subtotallistprice, 2, " ") + . $form->format_amount(\%myconfig, $subtotallistprice, 2) . "" - . $form->format_amount(\%myconfig, $subtotallastcost, 2, " ") + . $form->format_amount(\%myconfig, $subtotallastcost, 2) . "
| . $locale->text('Buchungsgruppe') . qq|
| . $locale->text('COGS') . qq|| . $locale->text('Expense') . qq|
{weight}> -   - $form->{weightunit} - {weightunit}> -
@@ -2094,11 +2332,6 @@ sub form_header {  $form->{weight} {weight}> - -   - $form->{weightunit} - {weightunit}> - @@ -2123,6 +2356,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 +2413,17 @@ sub form_header { {gv}> |; + $notdiscountableok = ($form->{not_discountable}) == 1 ? "checked" : ""; + $notdiscountable .= qq| + + | + . $locale->text('Not Discountable') . qq| + + +|; + + $formel = + qq||; $imagelinks = qq| @@ -2198,7 +2454,7 @@ sub form_header { |; } $shopok = $form->{shop} == 1 ? "checked" : ""; - $obsolete .= qq| + $shop .= qq| | . $locale->text('Shopartikel') . qq| @@ -2206,6 +2462,7 @@ sub form_header { |; + # type=submit $locale->text('Add Part') # type=submit $locale->text('Add Service') # type=submit $locale->text('Add Assembly') @@ -2227,8 +2484,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 +2492,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 +2520,8 @@ sub form_header { {rowcount}> + + @@ -2286,16 +2553,47 @@ 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('EAN-Code') . qq|
+ + + $ean +
+ + + + + +
| . $locale->text('Payment Terms') . qq|
+
@@ -2317,12 +2615,14 @@ sub form_header { $lastcost | . $locale->text('Unit') . qq| - + $unit_select $weight $rop $bin + $notdiscountable $vegv + $shop $obsolete @@ -2421,11 +2721,22 @@ sub form_footer { &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|
+ + |; @@ -2611,6 +2922,8 @@ sub assembly_row { $column_data{total} = qq|$linetotal|; + $column_data{deliverydate} = qq|$deliverydate|; + print qq| |; @@ -2646,7 +2959,7 @@ sub update { &check_form; - } else { + } else { IC->assembly_item(\%myconfig, \%$form); @@ -2687,9 +3000,10 @@ sub update { } if ($form->{item} eq 'service') { - map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } - qw(sellprice listprice); + map({ $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } + qw(sellprice listprice lastcost)); &form_header; + &price_row; &form_footer; } @@ -2699,17 +3013,29 @@ 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( "Inventory quantity must be zero before you can set this $form->{item} obsolete!" )) - if ($form->{onhand}); + if ($form->{onhand} * 1); + } + + 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,11 +3044,18 @@ 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!')); } + # saving the history + if(!exists $form->{addition}) { + $form->{addition} = "SAVED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history $parts_id = $form->{id}; # load previous variables @@ -2776,7 +3109,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 +3132,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 +3159,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; @@ -2832,15 +3172,29 @@ sub save { sub save_as_new { $lxdebug->enter_sub(); + # saving the history + if(!exists $form->{addition}) { + $form->{addition} = "SAVED AS NEW"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history $form->{id} = 0; + if ($form->{"original_partnumber"} && + ($form->{"partnumber"} eq $form->{"original_partnumber"})) { + $form->{partnumber} = ""; + } &save; - $lxdebug->leave_sub(); } sub delete { $lxdebug->enter_sub(); - + # saving the history + if(!exists $form->{addition}) { + $form->{addition} = "DELETED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history $rc = IC->delete(\%myconfig, \%$form); # redirect @@ -2850,181 +3204,6 @@ sub delete { $lxdebug->leave_sub(); } -sub stock_assembly { - $lxdebug->enter_sub(); - - $form->{title} = $locale->text('Stock Assembly'); - - $form->header; - - print qq| - - -
{script}> - - - - - - - - - - -
$form->{title}
- - - - - - - - - - -
| - . $locale->text('Part Number') . qq| 
| - . $locale->text('Part Description') . qq|
-

- -{path}> -{login}> -{password}> - - - -
- -
- - - -|; - - $lxdebug->leave_sub(); -} - -sub list_assemblies { - $lxdebug->enter_sub(); - - IC->retrieve_assemblies(\%myconfig, \%$form); - - $column_header{partnumber} = - qq|| . $locale->text('Part Number') . qq||; - $column_header{description} = - qq|| . $locale->text('Part Description') . qq||; - $column_header{bin} = - qq|| . $locale->text('Bin') . qq||; - $column_header{onhand} = - qq|| . $locale->text('Qty') . qq||; - $column_header{rop} = - qq|| . $locale->text('ROP') . qq||; - $column_header{stock} = - qq|| . $locale->text('Add') . qq||; - - @column_index = (qw(partnumber description bin onhand rop stock)); - - $form->{title} = $locale->text('Stock Assembly'); - - $form->{callback} = - "$form->{script}?action=stock_assembly&path=$form->{path}&login=$form->{login}&password=$form->{password}"; - - $form->header; - - $colspan = $#column_index + 1; - - print qq| - - -
{script}> - - - - - - - |; - - map { print "\n$column_header{$_}" } @column_index; - - print qq| - -|; - - $i = 1; - foreach $ref (@{ $form->{assembly_items} }) { - - map { $ref->{$_} =~ s/\"/"/g } qw(partnumber description); - - $column_data{partnumber} = qq||; - $column_data{description} = - qq||; - $column_data{bin} = qq||; - $column_data{onhand} = - qq||; - $column_data{rop} = - qq||; - $column_data{stock} = qq||; - - $j++; - $j %= 2; - print - qq|{id}>\n|; - - map { print "\n$column_data{$_}" } @column_index; - - print qq| - -|; - - $i++; - - } - - $i--; - print qq| - - -
$form->{title}
$ref->{partnumber}$ref->{description} $ref->{bin} | - . $form->format_amount(\%myconfig, $ref->{onhand}, '', " ") - . qq|| - . $form->format_amount(\%myconfig, $ref->{rop}, '', " ") - . qq|

-
- - -{path}> -{login}> -{password}> - - - - - -
- - -
- - - -|; - - $lxdebug->leave_sub(); -} - -sub restock_assemblies { - $lxdebug->enter_sub(); - - $form->redirect($locale->text('Assemblies restocked!')) - if (IC->restock_assemblies(\%myconfig, \%$form)); - $form->error($locale->text('Cannot stock assemblies!')); - - $lxdebug->leave_sub(); -} - sub price_row { $lxdebug->enter_sub(); @@ -3058,4 +3237,36 @@ 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} } }