X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FOE.pm;h=6b4831267aa64a57c257d8aff3bab70450e17b85;hb=713de5ed35a8a1faea940354254c4e781631c495;hp=759f962651a6aa215b24b75df6b613bd7e7c73d5;hpb=4dc48e117cfdb6e59c2d8b9d8087ef8a3bc245a4;p=kivitendo-erp.git diff --git a/SL/OE.pm b/SL/OE.pm index 759f96265..6b4831267 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -123,6 +123,7 @@ sub transactions { qq| o.marge_total, o.marge_percent, | . qq| o.exchangerate, | . qq| o.itime::DATE AS insertdate, | . + qq| o.intnotes, | . qq| department.description as department, | . qq| ex.$rate AS daily_exchangerate, | . qq| pt.description AS payment_terms, | . @@ -296,6 +297,11 @@ SQL push @values, conv_date($form->{expected_billing_date_to}); } + if ($form->{intnotes}) { + $query .= qq| AND o.intnotes ILIKE ?|; + push(@values, like($form->{intnotes})); + } + if ($form->{parts_partnumber}) { $query .= < "tz.description", "payment_terms" => "pt.description", "department" => "department.description", + "intnotes" => "o.intnotes", ); if ($form->{sort} && grep($form->{sort}, keys(%allowed_sort_columns))) { $sortorder = $allowed_sort_columns{$form->{sort}} . " ${sortdir}" . ", o.itime ${sortdir}"; @@ -979,7 +986,12 @@ sub _retrieve { if (!$form->{id}) { my $extra_days = $form->{type} eq 'sales_quotation' ? $::instance_conf->get_reqdate_interval : $form->{type} eq 'sales_order' ? $::instance_conf->get_delivery_date_interval : 1; - $form->{reqdate} = DateTime->today_local->next_workday(extra_days => $extra_days)->to_kivitendo; + if ( ($form->{type} eq 'sales_order' && !$::instance_conf->get_deliverydate_on) + || ($form->{type} eq 'sales_quotation' && !$::instance_conf->get_reqdate_on)) { + $form->{reqdate} = ''; + } else { + $form->{reqdate} = DateTime->today_local->next_workday(extra_days => $extra_days)->to_kivitendo; + } $form->{transdate} = DateTime->today_local->to_kivitendo; } @@ -1354,7 +1366,7 @@ sub order_details { partnotes serialnumber reqdate sellprice sellprice_nofmt listprice listprice_nofmt netprice netprice_nofmt discount discount_nofmt p_discount discount_sub discount_sub_nofmt nodiscount_sub nodiscount_sub_nofmt linetotal linetotal_nofmt nodiscount_linetotal nodiscount_linetotal_nofmt tax_rate projectnumber projectdescription - price_factor price_factor_name partsgroup weight weight_nofmt lineweight lineweight_nofmt); + price_factor price_factor_name partsgroup weight weight_nofmt lineweight lineweight_nofmt optional); push @arrays, map { "ic_cvar_$_->{name}" } @{ $ic_cvar_configs }; push @arrays, map { "project_cvar_$_->{name}" } @{ $project_cvar_configs }; @@ -1421,6 +1433,7 @@ sub order_details { push @{ $form->{TEMPLATE_ARRAYS}->{price_factor} }, $price_factor->{formatted_factor}; push @{ $form->{TEMPLATE_ARRAYS}->{price_factor_name} }, $price_factor->{description}; push @{ $form->{TEMPLATE_ARRAYS}->{partsgroup} }, $form->{"partsgroup_$i"}; + push @{ $form->{TEMPLATE_ARRAYS}->{optional} }, $form->{"optional_$i"}; my $sellprice = $form->parse_amount($myconfig, $form->{"sellprice_$i"}); my ($dec) = ($sellprice =~ /\.(\d+)/); @@ -1460,7 +1473,7 @@ sub order_details { $form->{non_separate_subtotal} += $linetotal; } - $form->{ordtotal} += $linetotal; + $form->{ordtotal} += $linetotal unless $form->{"optional_$i"}; $form->{nodiscount_total} += $nodiscount_linetotal; $form->{discount_total} += $discount; @@ -1508,14 +1521,16 @@ sub order_details { map { $taxrate += $form->{"${_}_rate"} } split(/ /, $form->{"taxaccounts_$i"}); - if ($form->{taxincluded}) { + unless ($form->{"optional_$i"}) { + if ($form->{taxincluded}) { - # calculate tax - $taxamount = $linetotal * $taxrate / (1 + $taxrate); - $taxbase = $linetotal / (1 + $taxrate); - } else { - $taxamount = $linetotal * $taxrate; - $taxbase = $linetotal; + # calculate tax + $taxamount = $linetotal * $taxrate / (1 + $taxrate); + $taxbase = $linetotal / (1 + $taxrate); + } else { + $taxamount = $linetotal * $taxrate; + $taxbase = $linetotal; + } } if ($taxamount != 0) {