Revision 8e77bd29
Von Bernd Bleßmann vor fast 7 Jahren hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
60 | 60 |
$self->_pre_render(); |
61 | 61 |
$self->render( |
62 | 62 |
'order/form', |
63 |
title => $self->type eq _sales_order_type() ? $::locale->text('Add Sales Order') |
|
64 |
: $self->type eq _purchase_order_type() ? $::locale->text('Add Purchase Order') |
|
63 |
title => $self->type eq _sales_order_type() ? $::locale->text('Add Sales Order') |
|
64 |
: $self->type eq _purchase_order_type() ? $::locale->text('Add Purchase Order') |
|
65 |
: $self->type eq _sales_quotation_type() ? $::locale->text('Add Quotation') |
|
66 |
: $self->type eq _request_quotation_type() ? $::locale->text('Add Request for Quotation') |
|
65 | 67 |
: '', |
66 | 68 |
%{$self->{template_args}} |
67 | 69 |
); |
... | ... | |
76 | 78 |
$self->_pre_render(); |
77 | 79 |
$self->render( |
78 | 80 |
'order/form', |
79 |
title => $self->type eq _sales_order_type() ? $::locale->text('Edit Sales Order') |
|
80 |
: $self->type eq _purchase_order_type() ? $::locale->text('Edit Purchase Order') |
|
81 |
title => $self->type eq _sales_order_type() ? $::locale->text('Edit Sales Order') |
|
82 |
: $self->type eq _purchase_order_type() ? $::locale->text('Edit Purchase Order') |
|
83 |
: $self->type eq _sales_quotation_type() ? $::locale->text('Edit Quotation') |
|
84 |
: $self->type eq _request_quotation_type() ? $::locale->text('Edit Request for Quotation') |
|
81 | 85 |
: '', |
82 | 86 |
%{$self->{template_args}} |
83 | 87 |
); |
... | ... | |
94 | 98 |
return $self->js->render(); |
95 | 99 |
} |
96 | 100 |
|
97 |
flash_later('info', $::locale->text('The order has been deleted')); |
|
101 |
my $text = $self->type eq _sales_order_type() ? $::locale->text('The order has been deleted') |
|
102 |
: $self->type eq _purchase_order_type() ? $::locale->text('The order has been deleted') |
|
103 |
: $self->type eq _sales_quotation_type() ? $::locale->text('The quotation has been deleted') |
|
104 |
: $self->type eq _request_quotation_type() ? $::locale->text('The rfq has been deleted') |
|
105 |
: ''; |
|
106 |
flash_later('info', $text); |
|
107 |
|
|
98 | 108 |
my @redirect_params = ( |
99 | 109 |
action => 'add', |
100 | 110 |
type => $self->type, |
... | ... | |
114 | 124 |
return $self->js->render(); |
115 | 125 |
} |
116 | 126 |
|
117 |
flash_later('info', $::locale->text('The order has been saved')); |
|
127 |
my $text = $self->type eq _sales_order_type() ? $::locale->text('The order has been saved') |
|
128 |
: $self->type eq _purchase_order_type() ? $::locale->text('The order has been saved') |
|
129 |
: $self->type eq _sales_quotation_type() ? $::locale->text('The quotation has been saved') |
|
130 |
: $self->type eq _request_quotation_type() ? $::locale->text('The rfq has been saved') |
|
131 |
: ''; |
|
132 |
flash_later('info', $text); |
|
133 |
|
|
118 | 134 |
my @redirect_params = ( |
119 | 135 |
action => 'edit', |
120 | 136 |
type => $self->type, |
... | ... | |
458 | 474 |
$self->js->flash('error', $_) foreach @{ $errors }; |
459 | 475 |
return $self->js->render(); |
460 | 476 |
} |
461 |
flash_later('info', $::locale->text('The order has been saved')); |
|
477 |
|
|
478 |
my $text = $self->type eq _sales_order_type() ? $::locale->text('The order has been saved') |
|
479 |
: $self->type eq _purchase_order_type() ? $::locale->text('The order has been saved') |
|
480 |
: $self->type eq _sales_quotation_type() ? $::locale->text('The quotation has been saved') |
|
481 |
: $self->type eq _request_quotation_type() ? $::locale->text('The rfq has been saved') |
|
482 |
: ''; |
|
483 |
flash_later('info', $text); |
|
462 | 484 |
|
463 | 485 |
my @redirect_params = ( |
464 | 486 |
controller => 'oe.pl', |
... | ... | |
480 | 502 |
$self->js->flash('error', $_) foreach @{ $errors }; |
481 | 503 |
return $self->js->render(); |
482 | 504 |
} |
483 |
flash_later('info', $::locale->text('The order has been saved')); |
|
505 |
|
|
506 |
my $text = $self->type eq _sales_order_type() ? $::locale->text('The order has been saved') |
|
507 |
: $self->type eq _purchase_order_type() ? $::locale->text('The order has been saved') |
|
508 |
: $self->type eq _sales_quotation_type() ? $::locale->text('The quotation has been saved') |
|
509 |
: $self->type eq _request_quotation_type() ? $::locale->text('The rfq has been saved') |
|
510 |
: ''; |
|
511 |
flash_later('info', $text); |
|
484 | 512 |
|
485 | 513 |
my @redirect_params = ( |
486 | 514 |
controller => 'oe.pl', |
... | ... | |
856 | 884 |
# |
857 | 885 |
|
858 | 886 |
sub init_valid_types { |
859 |
[ _sales_order_type(), _purchase_order_type() ]; |
|
887 |
[ _sales_order_type(), _purchase_order_type(), _sales_quotation_type(), _request_quotation_type() ];
|
|
860 | 888 |
} |
861 | 889 |
|
862 | 890 |
sub init_type { |
... | ... | |
872 | 900 |
sub init_cv { |
873 | 901 |
my ($self) = @_; |
874 | 902 |
|
875 |
my $cv = $self->type eq _sales_order_type() ? 'customer'
|
|
876 |
: $self->type eq _purchase_order_type() ? 'vendor'
|
|
903 |
my $cv = (any { $self->type eq $_ } (_sales_order_type(), _sales_quotation_type())) ? 'customer'
|
|
904 |
: (any { $self->type eq $_ } (_purchase_order_type(), _request_quotation_type())) ? 'vendor'
|
|
877 | 905 |
: die "Not a valid type for order"; |
878 | 906 |
|
879 | 907 |
return $cv; |
... | ... | |
1007 | 1035 |
# order here solves this problem. |
1008 | 1036 |
my $order; |
1009 | 1037 |
$order = SL::DB::Manager::Order->find_by(id => $::form->{id}) if $::form->{id}; |
1010 |
$order ||= SL::DB::Order->new(orderitems => []); |
|
1038 |
$order ||= SL::DB::Order->new(orderitems => [], |
|
1039 |
quotation => (any { $self->type eq $_ } (_sales_quotation_type(), _request_quotation_type()))); |
|
1011 | 1040 |
|
1012 | 1041 |
my $form_orderitems = delete $::form->{order}->{orderitems}; |
1013 | 1042 |
my $form_periodic_invoices_config = delete $::form->{order}->{periodic_invoices_config}; |
... | ... | |
1226 | 1255 |
$self->{all_delivery_terms} = SL::DB::Manager::DeliveryTerm->get_all_sorted(); |
1227 | 1256 |
$self->{current_employee_id} = SL::DB::Manager::Employee->current->id; |
1228 | 1257 |
$self->{periodic_invoices_status} = $self->_get_periodic_invoices_status($self->order->periodic_invoices_config); |
1258 |
$self->{order_probabilities} = [ map { { title => ($_ * 10) . '%', id => $_ * 10 } } (0..10) ]; |
|
1229 | 1259 |
|
1230 | 1260 |
my $print_form = Form->new(''); |
1231 | 1261 |
$print_form->{type} = $self->type; |
... | ... | |
1266 | 1296 |
sub _setup_edit_action_bar { |
1267 | 1297 |
my ($self, %params) = @_; |
1268 | 1298 |
|
1269 |
my $deletion_allowed = (($self->cv eq 'customer') && $::instance_conf->get_sales_order_show_delete) |
|
1270 |
|| (($self->cv eq 'vendor') && $::instance_conf->get_purchase_order_show_delete); |
|
1299 |
my $deletion_allowed = (any { $self->type eq $_ } (_sales_quotation_type(), _request_quotation_type())) |
|
1300 |
|| (($self->type eq _sales_order_type()) && $::instance_conf->get_sales_order_show_delete) |
|
1301 |
|| (($self->type eq _purchase_order_type()) && $::instance_conf->get_purchase_order_show_delete); |
|
1271 | 1302 |
|
1272 | 1303 |
for my $bar ($::request->layout->get('actionbar')) { |
1273 | 1304 |
$bar->add( |
... | ... | |
1282 | 1313 |
t8('Save and Delivery Order'), |
1283 | 1314 |
call => [ 'kivi.Order.save_and_delivery_order', $::instance_conf->get_order_warn_duplicate_parts ], |
1284 | 1315 |
checks => [ 'kivi.Order.check_save_active_periodic_invoices' ], |
1316 |
only_if => (any { $self->type eq $_ } (_sales_order_type(), _purchase_order_type())) |
|
1285 | 1317 |
], |
1286 | 1318 |
action => [ |
1287 | 1319 |
t8('Save and Invoice'), |
... | ... | |
1435 | 1467 |
'purchase_order'; |
1436 | 1468 |
} |
1437 | 1469 |
|
1470 |
sub _sales_quotation_type { |
|
1471 |
'sales_quotation'; |
|
1472 |
} |
|
1473 |
|
|
1474 |
sub _request_quotation_type { |
|
1475 |
'request_quotation'; |
|
1476 |
} |
|
1477 |
|
|
1438 | 1478 |
1; |
1439 | 1479 |
|
1440 | 1480 |
__END__ |
bin/mozilla/oe.pl | ||
---|---|---|
1035 | 1035 |
$form->{l_open} = $form->{l_closed} = "Y" if ($form->{open} && $form->{closed}); |
1036 | 1036 |
$form->{l_delivered} = "Y" if ($form->{delivered} && $form->{notdelivered}); |
1037 | 1037 |
$form->{l_periodic_invoices} = "Y" if ($form->{periodic_invoices_active} && $form->{periodic_invoices_inactive}); |
1038 |
$form->{l_edit_exp} = "Y" if $::instance_conf->get_feature_experimental && (any { $form->{type} eq $_ } qw(sales_order purchase_order)); |
|
1038 |
$form->{l_edit_exp} = "Y" if $::instance_conf->get_feature_experimental && (any { $form->{type} eq $_ } qw(sales_order purchase_order sales_quotation request_quotation));
|
|
1039 | 1039 |
map { $form->{"l_${_}"} = 'Y' } qw(order_probability expected_billing_date expected_netamount) if $form->{l_order_probability_expected_billing_date}; |
1040 | 1040 |
|
1041 | 1041 |
my $attachment_basename; |
... | ... | |
1265 | 1265 |
|
1266 | 1266 |
$row->{$ordnumber}->{link} = $edit_url . "&id=" . E($oe->{id}) . "&callback=${callback}"; |
1267 | 1267 |
|
1268 |
$row->{edit_exp}->{data} = $oe->{ordnumber}; |
|
1268 |
$row->{edit_exp}->{data} = $oe->{$ordnumber};
|
|
1269 | 1269 |
$row->{edit_exp}->{link} = build_std_url('script=controller.pl', 'action=Order/edit', "type=$form->{type}", 'id=' . E($oe->{id})); |
1270 | 1270 |
|
1271 | 1271 |
my $row_set = [ $row ]; |
js/kivi.Order.js | ||
---|---|---|
1 | 1 |
namespace('kivi.Order', function(ns) { |
2 | 2 |
ns.check_cv = function() { |
3 |
if ($('#type').val() == 'sales_order') { |
|
3 |
if ($('#type').val() == 'sales_order' || $('#type').val() == 'sales_quotation' ) {
|
|
4 | 4 |
if ($('#order_customer_id').val() === '') { |
5 | 5 |
alert(kivi.t8('Please select a customer.')); |
6 | 6 |
return false; |
... | ... | |
610 | 610 |
}); |
611 | 611 |
|
612 | 612 |
$(function(){ |
613 |
if ($('#type').val() == 'sales_order') { |
|
613 |
if ($('#type').val() == 'sales_order' || $('#type').val() == 'sales_quotation' ) {
|
|
614 | 614 |
$('#order_customer_id').change(kivi.Order.reload_cv_dependant_selections); |
615 | 615 |
} else { |
616 | 616 |
$('#order_vendor_id').change(kivi.Order.reload_cv_dependant_selections); |
617 | 617 |
} |
618 | 618 |
|
619 |
if ($('#type').val() == 'sales_order') { |
|
619 |
if ($('#type').val() == 'sales_order' || $('#type').val() == 'sales_quotation' ) {
|
|
620 | 620 |
$('#add_item_parts_id').on('set_item:PartPicker', function(e,o) { $('#add_item_sellprice_as_number').val(kivi.format_amount(o.sellprice, -2)) }); |
621 | 621 |
} else { |
622 | 622 |
$('#add_item_parts_id').on('set_item:PartPicker', function(e,o) { $('#add_item_sellprice_as_number').val(kivi.format_amount(o.lastcost, -2)) }); |
menus/user/10-order-controller.yaml | ||
---|---|---|
1 |
- parent: ar |
|
2 |
id: ar_add_quotation_experimental |
|
3 |
name: Add Quotation (experimental) |
|
4 |
icon: quotation_add |
|
5 |
order: 250 |
|
6 |
access: sales_quotation_edit & client/feature_experimental |
|
7 |
params: |
|
8 |
action: Order/add |
|
9 |
type: sales_quotation |
|
1 | 10 |
- parent: ar |
2 | 11 |
id: ar_add_sales_order_experimental |
3 | 12 |
name: Add Sales Order (experimental) |
... | ... | |
8 | 17 |
action: Order/add |
9 | 18 |
type: sales_order |
10 | 19 |
|
20 |
- parent: ap |
|
21 |
id: ap_add_rfq_experimental |
|
22 |
name: Add RFQ (experimental) |
|
23 |
icon: rfq_add |
|
24 |
order: 150 |
|
25 |
access: request_quotation_edit & client/feature_experimental |
|
26 |
params: |
|
27 |
action: Order/add |
|
28 |
type: request_quotation |
|
11 | 29 |
- parent: ap |
12 | 30 |
id: ap_add_purchase_order_experimental |
13 | 31 |
name: Add Purchase Order (experimental) |
templates/webpages/order/tabs/_second_row.html | ||
---|---|---|
6 | 6 |
|
7 | 7 |
<table> |
8 | 8 |
<tr><td colspan="100%"> |
9 |
<b>[%- 'Serial No.' | $T8 %]</b> |
|
10 |
[%- L.input_tag("order.orderitems[].serialnumber", ITEM.serialnumber, size = 15) %] |
|
9 |
[%- IF (TYPE == "sales_order" || TYPE == "purchase_order") %] |
|
10 |
<b>[%- 'Serial No.' | $T8 %]</b> |
|
11 |
[%- L.input_tag("order.orderitems[].serialnumber", ITEM.serialnumber, size = 15) %] |
|
12 |
[%- END %] |
|
11 | 13 |
<b>[%- 'Project' | $T8 %]</b> |
12 | 14 |
[% P.project.picker("order.orderitems[].project_id", ITEM.project_id, size = 15) %] |
13 |
<b>[%- 'Reqdate' | $T8 %]</b> |
|
14 |
[% L.date_tag("order.orderitems[].reqdate", ITEM.reqdate) %] |
|
15 |
[%- IF (TYPE == "sales_order" || TYPE == "purchase_order") %] |
|
16 |
<b>[%- 'Reqdate' | $T8 %]</b> |
|
17 |
[% L.date_tag("order.orderitems[].reqdate", ITEM.reqdate) %] |
|
18 |
[%- END %] |
|
15 | 19 |
<b>[%- 'Subtotal' | $T8 %]</b> |
16 | 20 |
[% L.yes_no_tag("order.orderitems[].subtotal", ITEM.subtotal) %] |
17 |
[%- IF TYPE == "sales_order" %]
|
|
21 |
[%- IF (TYPE == "sales_order" || TYPE == "sales_quotation") %]
|
|
18 | 22 |
<b>[%- 'Ertrag' | $T8 %]</b> |
19 | 23 |
<span name="linemargin"> |
20 | 24 |
<span[%- IF ITEM.marge_total < 0 -%] class="plus0"[%- END -%]> |
templates/webpages/order/tabs/basic_data.html | ||
---|---|---|
108 | 108 |
</tr> |
109 | 109 |
[% END %] |
110 | 110 |
|
111 |
[%- IF (SELF.type == "sales_order" || SELF.type == "purchase_order") -%] |
|
111 | 112 |
<tr> |
112 | 113 |
<th width="70%" align="right" nowrap>[% 'Order Number' | $T8 %]</th> |
113 | 114 |
<td>[% L.input_tag('order.ordnumber', SELF.order.ordnumber, size = 11) %]</td> |
114 | 115 |
</tr> |
116 |
[%- END -%] |
|
115 | 117 |
|
118 |
[%- IF (SELF.type == "sales_order" || SELF.type == "sales_quotation") -%] |
|
119 |
[%- SET quo_nr_txt = 'Quotation Number' -%] |
|
120 |
[%- ELSE -%] |
|
121 |
[%- SET quo_nr_txt = 'RFQ Number' -%] |
|
122 |
[%- END -%] |
|
116 | 123 |
<tr> |
117 |
<th width="70%" align="right" nowrap>[% 'Quotation Number' | $T8 %]</th>
|
|
124 |
<th width="70%" align="right" nowrap>[% quo_nr_txt | $T8 %]</th>
|
|
118 | 125 |
<td>[% L.input_tag('order.quonumber', SELF.order.quonumber, size = 11) %]</td> |
119 | 126 |
</tr> |
120 | 127 |
|
128 |
[%- IF (SELF.type == "sales_order" || SELF.type == "purchase_order") -%] |
|
121 | 129 |
<tr> |
122 | 130 |
<th width="70%" align="right" nowrap>[% 'Customer Order Number' | $T8 %]</th> |
123 | 131 |
<td>[% L.input_tag('order.cusordnumber', SELF.order.cusordnumber, size = 11) %]</td> |
124 | 132 |
</tr> |
125 |
|
|
133 |
[%- END -%] |
|
134 |
|
|
135 |
[%- IF (SELF.type == "sales_order" || SELF.type == "purchase_order") -%] |
|
136 |
[%- SET transdate_txt = 'Order Date' -%] |
|
137 |
[%- ELSIF SELF.type == "sales_quotation" -%] |
|
138 |
[%- SET transdate_txt = 'Quotation Date' -%] |
|
139 |
[%- ELSE -%] |
|
140 |
[%- SET transdate_txt = 'RFQ Date' -%] |
|
141 |
[%- END -%] |
|
126 | 142 |
<tr> |
127 |
<th width="70%" align="right" nowrap>[% 'Order Date' | $T8 %]</th>
|
|
143 |
<th width="70%" align="right" nowrap>[% transdate_txt | $T8 %]</th>
|
|
128 | 144 |
<td>[% L.date_tag('order.transdate', SELF.order.transdate) %]</td> |
129 | 145 |
</tr> |
130 | 146 |
|
147 |
[%- IF (SELF.type == "sales_order" || SELF.type == "purchase_order") -%] |
|
148 |
[%- SET reqdate_txt = 'Reqdate' -%] |
|
149 |
[%- ELSIF SELF.type == "sales_quotation" -%] |
|
150 |
[%- SET reqdate_txt = 'Valid until' -%] |
|
151 |
[%- ELSE -%] |
|
152 |
[%- SET reqdate_txt = 'Required by' -%] |
|
153 |
[%- END -%] |
|
131 | 154 |
<tr> |
132 |
<th width="70%" align="right" nowrap>[% 'Reqdate' | $T8 %]</th>
|
|
155 |
<th width="70%" align="right" nowrap>[% reqdate_txt | $T8 %]</th>
|
|
133 | 156 |
<td>[% L.date_tag('order.reqdate', SELF.order.reqdate) %]</td> |
134 | 157 |
</tr> |
135 | 158 |
|
159 |
[%- IF SELF.type == "sales_quotation" -%] |
|
160 |
<tr> |
|
161 |
<th width="70%" align="right" nowrap>[% 'Order probability' | $T8 %]</th> |
|
162 |
<td>[%- L.select_tag('order.order_probability', SELF.order_probabilities, title='title', default=SELF.order.order_probability) %]%</td> |
|
163 |
</tr> |
|
164 |
<tr> |
|
165 |
<th width="70%" align="right" nowrap>[% 'Expected billing date' | $T8 %]</th> |
|
166 |
<td>[%- L.date_tag('order.expected_billing_date', SELF.order.expected_billing_date) %]</td> |
|
167 |
</tr> |
|
168 |
[%- END %] |
|
169 |
|
|
136 | 170 |
<tr> |
137 | 171 |
<th width="70%" align="right" nowrap>[% 'Insert Date' | $T8 %]</th> |
138 | 172 |
<td>[% SELF.order.itime_as_date %]</td> |
Auch abrufbar als: Unified diff
Auftrags-Controller: auch für Angebote/Anfragen