delivery_vendor_id => { type => 'integer' },
department_id => { type => 'integer' },
employee_id => { type => 'integer' },
+ expected_billing_date => { type => 'date' },
globalproject_id => { type => 'integer' },
id => { type => 'integer', not_null => 1, sequence => 'id' },
intnotes => { type => 'text' },
mtime => { type => 'timestamp' },
netamount => { type => 'numeric', precision => 15, scale => 5 },
notes => { type => 'text' },
+ order_probability => { type => 'integer', default => '0', not_null => 1 },
ordnumber => { type => 'text', not_null => 1 },
payment_id => { type => 'integer' },
proforma => { type => 'boolean', default => 'false' },
qq| ct.${vc}number AS vcnumber, ct.country, ct.ustid, ct.business_id, | .
qq| tz.description AS taxzone | .
$periodic_invoices_columns .
+ qq| , o.order_probability, o.expected_billing_date, (o.netamount * o.order_probability / 100) AS expected_netamount | .
qq|FROM oe o | .
qq|JOIN $vc ct ON (o.${vc}_id = ct.id) | .
qq|LEFT JOIN employee e ON (o.employee_id = e.id) | .
$query .= qq| AND ${not} COALESCE(pcfg.active, 'f')|;
}
+ if (($form->{order_probability_value} || '') ne '') {
+ my $op = $form->{order_probability_value} eq 'le' ? '<=' : '>=';
+ $query .= qq| AND (o.order_probability ${op} ?)|;
+ push @values, $form->{order_probability_value};
+ }
+
+ if ($form->{expected_billing_date_from}) {
+ $query .= qq| AND (o.expected_billing_date >= ?)|;
+ push @values, conv_date($form->{expected_billing_date_from});
+ }
+
+ if ($form->{expected_billing_date_to}) {
+ $query .= qq| AND (o.expected_billing_date <= ?)|;
+ push @values, conv_date($form->{expected_billing_date_to});
+ }
+
my $sortdir = !defined $form->{sortdir} ? 'ASC' : $form->{sortdir} ? 'ASC' : 'DESC';
my $sortorder = join(', ', map { "${_} ${sortdir} " } ("o.id", $form->sort_columns("transdate", $ordnumber, "name")));
my %allowed_sort_columns = (
delivered = ?, proforma = ?, quotation = ?, department_id = ?, language_id = ?,
taxzone_id = ?, shipto_id = ?, payment_id = ?, delivery_vendor_id = ?, delivery_customer_id = ?,delivery_term_id = ?,
globalproject_id = ?, employee_id = ?, salesman_id = ?, cp_id = ?, transaction_description = ?, marge_total = ?, marge_percent = ?
+ , order_probability = ?, expected_billing_date = ?
WHERE id = ?|;
@values = ($form->{ordnumber} || '', $form->{quonumber},
conv_i($form->{salesman_id}), conv_i($form->{cp_id}),
$form->{transaction_description},
$form->{marge_total} * 1, $form->{marge_percent} * 1,
+ $form->{order_probability} * 1, conv_date($form->{expected_billing_date}),
conv_i($form->{id}));
do_query($form, $dbh, $query, @values);
d.description AS department, o.payment_id, o.language_id, o.taxzone_id,
o.delivery_customer_id, o.delivery_vendor_id, o.proforma, o.shipto_id,
o.globalproject_id, o.delivered, o.transaction_description, o.delivery_term_id
+ , o.order_probability, o.expected_billing_date
FROM oe o
JOIN ${vc} cv ON (o.${vc}_id = cv.id)
LEFT JOIN employee e ON (o.employee_id = e.id)
is_pur_ord => scalar ($form->{type} =~ /purchase_order$/),
);
+ $TMPL_VAR{ORDER_PROBABILITIES} = [ map { { title => ($_ * 10) . '%', id => $_ * 10 } } (0..10) ];
+
print $form->parse_html_template("oe/form_header", { %TMPL_VAR });
$main::lxdebug->leave_sub();
# constants and subs for template
$form->{vc_keys} = sub { "$_[0]->{name}--$_[0]->{id}" };
+ $form->{ORDER_PROBABILITIES} = [ map { { title => ($_ * 10) . '%', id => $_ * 10 } } (0..10) ];
+
$form->header();
print $form->parse_html_template('oe/search', {
"vcnumber", "ustid",
"country", "shippingpoint",
"taxzone",
+ "order_probability", "expected_billing_date", "expected_netamount",
);
# only show checkboxes if gotten here via sales_order form.
$form->{l_delivered} = "Y" if ($form->{delivered} && $form->{notdelivered});
$form->{l_periodic_invoices} = "Y" if ($form->{periodic_invoices_active} && $form->{periodic_invoices_inactive});
+ map { $form->{"l_${_}"} = 'Y' } qw(order_probability expected_billing_date expected_netamount) if $form->{l_order_probability_expected_billing_date};
+
my $attachment_basename;
if ($form->{vc} eq 'vendor') {
if ($form->{type} eq 'purchase_order') {
push @hidden_variables, "l_subtotal", $form->{vc}, qw(l_closed l_notdelivered open closed delivered notdelivered ordnumber quonumber cusordnumber
transaction_description transdatefrom transdateto type vc employee_id salesman_id
reqdatefrom reqdateto projectnumber project_id periodic_invoices_active periodic_invoices_inactive
- business_id shippingpoint taxzone_id);
+ business_id shippingpoint taxzone_id
+ order_probability_op order_probability_value expected_billing_date_from expected_billing_date_to);
my @keys_for_url = grep { $form->{$_} } @hidden_variables;
push @keys_for_url, 'taxzone_id' if $form->{taxzone_id} ne ''; # taxzone_id could be 0
'periodic_invoices' => { 'text' => $locale->text('Per. Inv.'), },
'shippingpoint' => { 'text' => $locale->text('Shipping Point'), },
'taxzone' => { 'text' => $locale->text('Steuersatz'), },
+ 'order_probability' => { 'text' => $locale->text('Order probability'), },
+ 'expected_billing_date' => { 'text' => $locale->text('Exp. bill. date'), },
+ 'expected_netamount' => { 'text' => $locale->text('Exp. netamount'), },
);
foreach my $name (qw(id transdate reqdate quonumber ordnumber cusordnumber name employee salesman shipvia transaction_description shippingpoint taxzone)) {
$column_defs{$name}->{link} = $href . "&sort=$name&sortdir=$sortdir";
}
- my %column_alignment = map { $_ => 'right' } qw(netamount tax amount curr remaining_amount remaining_netamount);
+ my %column_alignment = map { $_ => 'right' } qw(netamount tax amount curr remaining_amount remaining_netamount order_probability expected_billing_date expected_netamount);
$form->{"l_type"} = "Y";
map { $column_defs{$_}->{visible} = $form->{"l_${_}"} ? 1 : 0 } @columns;
push @options, $locale->text('Steuersatz') . " : " . SL::DB::TaxZone->new(id => $form->{taxzone_id})->load->description;
}
+ if (($form->{order_probability_value} || '') ne '') {
+ push @options, $::locale->text('Order probability') . ' ' . ($form->{order_probability_op} eq 'le' ? '<=' : '>=') . ' ' . $form->{order_probability_value} . '%';
+ }
+
+ if ($form->{expected_billing_date_from} or $form->{expected_billing_date_to}) {
+ push @options, $locale->text('Expected billing date');
+ push @options, $locale->text('From') . " " . $locale->date(\%myconfig, $form->{expected_billing_date_from}, 1) if $form->{expected_billing_date_from};
+ push @options, $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{expected_billing_date_to}, 1) if $form->{expected_billing_date_to};
+ }
+
$report->set_options('top_info_text' => join("\n", @options),
'raw_top_info_text' => $form->parse_html_template('oe/orders_top'),
'raw_bottom_info_text' => $form->parse_html_template('oe/orders_bottom', { 'SHOW_CONTINUE_BUTTON' => $allow_multiple_orders }),
my $callback = $form->escape($href);
my @subtotal_columns = qw(netamount amount marge_total marge_percent remaining_amount remaining_netamount);
+ push @subtotal_columns, 'expected_netamount' if $form->{l_order_probability_expected_billing_date};
my %totals = map { $_ => 0 } @subtotal_columns;
my %subtotals = map { $_ => 0 } @subtotal_columns;
$subtotals{marge_percent} = $subtotals{netamount} ? ($subtotals{marge_total} * 100 / $subtotals{netamount}) : 0;
$totals{marge_percent} = $totals{netamount} ? ($totals{marge_total} * 100 / $totals{netamount} ) : 0;
- map { $oe->{$_} = $form->format_amount(\%myconfig, $oe->{$_}, 2) } qw(netamount tax amount marge_total marge_percent remaining_amount remaining_netamount);
+ map { $oe->{$_} = $form->format_amount(\%myconfig, $oe->{$_}, 2) } qw(netamount tax amount marge_total marge_percent remaining_amount remaining_netamount expected_netamount);
+
+ $oe->{order_probability} = ($oe->{order_probability} || 0) . '%';
my $row = { };
'Existing file on server' => 'Auf dem Server existierende Datei',
'Existing pending follow-ups for this item' => 'Noch nicht erledigte Wiedervorlagen für dieses Dokument',
'Existing profiles' => 'Existierende Profile',
+ 'Exp. bill. date' => 'Vorauss. Abr.datum',
+ 'Exp. netamount' => 'Vorauss. Summe',
'Expected Tax' => 'Erwartete Steuern',
+ 'Expected billing date' => 'Voraussichtliches Abrechnungsdatum',
'Expense' => 'Aufwandskonto',
'Expense Account' => 'Aufwandskonto',
'Expense/Asset' => 'Aufwand/Anlagen',
'Options' => 'Optionen',
'Or download the whole Installation Documentation as PDF (350kB) for off-line study (currently in German Language): ' => 'Oder laden Sie die komplette Installationsbeschreibung als PDF (350kB) herunter: ',
'Order' => 'Auftrag',
- 'Order Date' => 'Auftragsdatum',
'Order Date missing!' => 'Auftragsdatum fehlt!',
- 'Order Number' => 'Auftragsnummer',
+ 'Order Date' => 'Auftragsdatum',
'Order Number missing!' => 'Auftragsnummer fehlt!',
+ 'Order Number' => 'Auftragsnummer',
'Order amount' => 'Auftragswert',
'Order deleted!' => 'Auftrag gelöscht!',
+ 'Order probability & expected billing date' => 'Auftragswahrscheinlichkeit & vorrauss. Abrechnungsdatum',
+ 'Order probability' => 'Auftragswahrscheinlichkeit',
'Order/Item row name' => 'Name der Auftrag-/Positions-Zeilen',
'OrderItem' => 'Position',
+ 'Ordered' => 'Vom Kunde bestellt',
'Ordered' => 'Von Kunden bestellt',
'Orders' => 'Aufträge',
'Orders / Delivery Orders deleteable' => 'Aufträge / Lieferscheine löschbar',
--- /dev/null
+-- @tag: sales_quotation_order_probability_expected_billing_date
+-- @charset: utf-8
+-- @description: Weitere Felder im Angebot: Angebotswahrscheinlichkeit, voraussichtliches Abrechnungsdatum
+ALTER TABLE oe
+ ADD COLUMN order_probability INTEGER,
+ ADD COLUMN expected_billing_date DATE;
+
+UPDATE oe SET order_probability = 0;
+
+ALTER TABLE oe
+ ALTER COLUMN order_probability SET DEFAULT 0,
+ ALTER COLUMN order_probability SET NOT NULL;
[%- L.select_tag('globalproject_id', ALL_PROJECTS, title_key='projectnumber', default=globalproject_id, with_empty='1', onChange="document.getElementById('update_button').click();") %]
</td>
</tr>
+[%- IF type == 'sales_quotation' %]
+ <tr>
+ <th width="70%" align="right" nowrap>[% 'Order probability' | $T8 %]</th>
+ <td nowrap>
+ [%- L.select_tag('order_probability', ORDER_PROBABILITIES, title='title', default=order_probability) %]%
+ </td>
+ </tr>
+ <tr>
+ <th width="70%" align="right" nowrap>[% 'Expected billing date' | $T8 %]</th>
+ <td nowrap>
+ [%- L.date_tag('expected_billing_date', expected_billing_date 'BL') %]
+ </td>
+ </tr>
+[%- END %]
</table>
</td>
</tr>
[% L.date_tag('reqdateto') %]
</td>
</tr>
+[%- IF type == 'sales_quotation' %]
+ <tr>
+ <th align="right">[% 'Expected billing date' | $T8 %] [% 'From' | $T8 %]</th>
+ <td>
+ [% L.date_tag('expected_billing_date_from', '' 'BL') %]
+ </td>
+ <th align="right">[% 'Expected billing date' | $T8 %] [% 'Bis' | $T8 %]</th>
+ <td>
+ [% L.date_tag('expected_billing_date_to', '' 'BL') %]
+ </td>
+ </tr>
+ <tr>
+ <th align="right">[% 'Order probability' | $T8 %]</th>
+ <td colspan="3">
+ [% L.select_tag('order_probability_op', [[ 'ge', '>=' ], [ 'le', '<=' ]]) %]
+ [% L.select_tag('order_probability_value', ORDER_PROBABILITIES, title='title', with_empty=1) %]
+ </td>
+ </tr>
+[%- END %]
<tr>
<th align="right">[% 'Include in Report' | $T8 %]</th>
<td colspan="5">
<label for="l_salesman">[% 'Salesman' | $T8 %]</label>
</td>
</tr>
+[% IF type == 'sales_quotation' %]
+ <tr>
+ <td colspan="2">
+ <input name="l_order_probability_expected_billing_date" id="l_order_probability_expected_billing_date" class="checkbox" type="checkbox" value="Y">
+ <label for="l_order_probability_expected_billing_date">[% 'Order probability & expected billing date' | $T8 %]</label>
+ </td>
+ </tr>
+[%- END %]
<tr>
<td>
<input name="l_remaining_amount" id="l_remaining_amount" class="checkbox" type="checkbox" value="Y">