X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDO.pm;h=d83c49b3ef1b46e57887e76a61270ab3a09b0f74;hb=19064edf6bd7859e831fdf37cd465f7f933be6f3;hp=15f1c8d0825c1f4b3ef97c5c4a806585c7f40179;hpb=c312836ce432677d4f7876f1e3a2b6d99f433cd6;p=kivitendo-erp.git diff --git a/SL/DO.pm b/SL/DO.pm index 15f1c8d08..d83c49b3e 100644 --- a/SL/DO.pm +++ b/SL/DO.pm @@ -130,6 +130,11 @@ sub transactions { push @where, ($form->{delivered} ? "" : "NOT ") . "COALESCE(dord.delivered, FALSE)"; } + if ($form->{serialnumber}) { + push @where, 'dord.id IN (SELECT doi.delivery_order_id FROM delivery_order_items doi WHERE doi.serialnumber LIKE ?)'; + push @values, '%' . $form->{serialnumber} . '%'; + } + if($form->{transdatefrom}) { push @where, qq|dord.transdate >= ?|; push @values, conv_date($form->{transdatefrom}); @@ -140,6 +145,16 @@ sub transactions { push @values, conv_date($form->{transdateto}); } + if($form->{reqdatefrom}) { + push @where, qq|dord.reqdate >= ?|; + push @values, conv_date($form->{reqdatefrom}); + } + + if($form->{reqdateto}) { + push @where, qq|dord.reqdate <= ?|; + push @values, conv_date($form->{reqdateto}); + } + if (@where) { $query .= " WHERE " . join(" AND ", map { "($_)" } @where); } @@ -352,7 +367,8 @@ sub save { shippingpoint = ?, shipvia = ?, notes = ?, intnotes = ?, closed = ?, delivered = ?, department_id = ?, language_id = ?, shipto_id = ?, globalproject_id = ?, employee_id = ?, salesman_id = ?, cp_id = ?, transaction_description = ?, - is_sales = ?, taxzone_id = ?, taxincluded = ?, terms = ?, currency_id = (SELECT id FROM currencies WHERE name = ?) + is_sales = ?, taxzone_id = ?, taxincluded = ?, terms = ?, currency_id = (SELECT id FROM currencies WHERE name = ?), + delivery_term_id = ? WHERE id = ?|; @values = ($form->{donumber}, $form->{ordnumber}, @@ -367,6 +383,7 @@ sub save { $form->{transaction_description}, $form->{type} =~ /^sales/ ? 't' : 'f', conv_i($form->{taxzone_id}), $form->{taxincluded} ? 't' : 'f', conv_i($form->{terms}), $form->{currency}, + conv_i($form->{delivery_term_id}), conv_i($form->{id})); do_query($form, $dbh, $query, @values); @@ -577,7 +594,8 @@ sub retrieve { d.description AS department, dord.language_id, dord.shipto_id, dord.globalproject_id, dord.delivered, dord.transaction_description, - dord.taxzone_id, dord.taxincluded, dord.terms, (SELECT cu.name FROM currencies cu WHERE cu.id=dord.currency_id) AS currency + dord.taxzone_id, dord.taxincluded, dord.terms, (SELECT cu.name FROM currencies cu WHERE cu.id=dord.currency_id) AS currency, + dord.delivery_term_id FROM delivery_orders dord JOIN ${vc} cv ON (dord.${vc}_id = cv.id) LEFT JOIN employee e ON (dord.employee_id = e.id) @@ -876,6 +894,9 @@ sub order_details { $h_pg->finish(); $h_bin_wh->finish(); + $form->{delivery_term} = SL::DB::Manager::DeliveryTerm->find_by(id => $form->{delivery_term_id} || undef); + $form->{delivery_term}->description_long($form->{delivery_term}->translated_attribute('description_long', $form->{language_id})) if $form->{delivery_term} && $form->{language_id}; + $form->{username} = $myconfig->{name}; $main::lxdebug->leave_sub();