1 #=====================================================================
4 # Based on SQL-Ledger Version 2.1.9
5 # Web http://www.lx-office.org
7 #=====================================================================
8 # SQL-Ledger Accounting
9 # Copyright (c) 1998-2002
11 # Author: Dieter Simader
12 # Email: dsimader@sql-ledger.org
13 # Web: http://www.sql-ledger.org
15 # Contributors: Reed White <alta@alta-research.com>
17 # This program is free software; you can redistribute it and/or modify
18 # it under the terms of the GNU General Public License as published by
19 # the Free Software Foundation; either version 2 of the License, or
20 # (at your option) any later version.
22 # This program is distributed in the hope that it will be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 # GNU General Public License for more details.
26 # You should have received a copy of the GNU General Public License
27 # along with this program; if not, write to the Free Software
28 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 #======================================================================
31 # customer/vendor module
33 #======================================================================
35 # $locale->text('Customers')
36 # $locale->text('Vendors')
37 # $locale->text('Add Customer')
38 # $locale->text('Add Vendor')
50 $lxdebug->enter_sub();
52 $form->{title} = "Add";
55 "$form->{script}?action=add&db=$form->{db}&path=$form->{path}&login=$form->{login}&password=$form->{password}"
56 unless $form->{callback};
58 CT->taxaccounts(\%myconfig, \%$form);
63 $lxdebug->leave_sub();
67 $lxdebug->enter_sub();
69 $label = ucfirst $form->{db};
70 $form->{title} = $locale->text($label . "s");
72 if ($form->{db} eq 'vendor') {
74 <td><input name="l_gifi_accno" type=checkbox class=checkbox value=Y> |
75 . $locale->text('GIFI') . qq|</td>
84 <form method=post action=$form->{script}>
86 <input type=hidden name=db value=$form->{db}>
90 <th class=listtop>$form->{title}</th>
97 <th align=right nowrap>| . $locale->text($label . ' Number') . qq|</th>
98 <td><input name=$form->{db}number size=35></td>
101 <th align=right nowrap>| . $locale->text('Company Name') . qq|</th>
102 <td><input name=name size=35></td>
105 <th align=right nowrap>| . $locale->text('Contact') . qq|</th>
106 <td><input name=contact size=35></td>
109 <th align=right nowrap>| . $locale->text('E-mail') . qq|</th>
110 <td><input name=email size=35></td>
114 <td><input name=status class=radio type=radio value=all checked> |
115 . $locale->text('All') . qq|
116 <input name=status class=radio type=radio value=orphaned> |
117 . $locale->text('Orphaned') . qq|</td>
120 <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
124 <td><input name="l_id" type=checkbox class=checkbox value=Y> |
125 . $locale->text('ID') . qq|</td>
126 <td><input name="l_$form->{db}number" type=checkbox class=checkbox value=Y> |
127 . $locale->text($label . ' Number') . qq|</td>
128 <td><input name="l_name" type=checkbox class=checkbox value=Y checked> |
129 . $locale->text('Company Name') . qq|</td>
130 <td><input name="l_address" type=checkbox class=checkbox value=Y> |
131 . $locale->text('Address') . qq|</td>
134 <td><input name="l_contact" type=checkbox class=checkbox value=Y checked> |
135 . $locale->text('Contact') . qq|</td>
136 <td><input name="l_phone" type=checkbox class=checkbox value=Y checked> |
137 . $locale->text('Phone') . qq|</td>
138 <td><input name="l_fax" type=checkbox class=checkbox value=Y> |
139 . $locale->text('Fax') . qq|</td>
140 <td><input name="l_email" type=checkbox class=checkbox value=Y checked> |
141 . $locale->text('E-mail') . qq|</td>
144 <td><input name="l_taxnumber" type=checkbox class=checkbox value=Y> |
145 . $locale->text('Tax Number') . qq|</td>
147 <td><input name="l_sic_code" type=checkbox class=checkbox value=Y> |
148 . $locale->text('SIC') . qq|</td>
149 <td><input name="l_business" type=checkbox class=checkbox value=Y> |
150 . $locale->text('Type of Business') . qq|</td>
153 <td><input name="l_invnumber" type=checkbox class=checkbox value=Y> |
154 . $locale->text('Invoices') . qq|</td>
155 <td><input name="l_ordnumber" type=checkbox class=checkbox value=Y> |
156 . $locale->text('Orders') . qq|</td>
157 <td><input name="l_quonumber" type=checkbox class=checkbox value=Y> |
158 . $locale->text('Quotations') . qq|</td>
167 <td><hr size=3 noshade></td>
171 <input type=hidden name=nextsub value=list_names>
173 <input type=hidden name=path value=$form->{path}>
174 <input type=hidden name=login value=$form->{login}>
175 <input type=hidden name=password value=$form->{password}>
178 <input type=submit class=submit name=action value="|
179 . $locale->text('Continue') . qq|">
185 $lxdebug->leave_sub();
188 sub search_delivery {
189 $lxdebug->enter_sub();
191 $label = ucfirst $form->{db};
192 $form->{title} = $locale->text($label . "s");
194 if ($form->{db} eq 'vendor') {
196 <td><input name="l_gifi_accno" type=checkbox class=checkbox value=Y> |
197 . $locale->text('GIFI') . qq|</td>
206 <form method=post action=$form->{script}>
208 <input type=hidden name=db value=$form->{db}>
212 <th class=listtop>$form->{title}</th>
219 <th align=right nowrap>| . $locale->text($label . ' Number') . qq|</th>
220 <td><input name=$form->{db}number size=35></td>
223 <th align=right nowrap>| . $locale->text('Company Name') . qq|</th>
224 <td><input name=name size=35></td>
227 <th align=right nowrap>| . $locale->text('Contact') . qq|</th>
228 <td><input name=contact size=35></td>
231 <th align=right nowrap>| . $locale->text('E-mail') . qq|</th>
232 <td><input name=email size=35></td>
236 <td><input name=status class=radio type=radio value=all checked> |
237 . $locale->text('All') . qq|
238 <input name=status class=radio type=radio value=orphaned> |
239 . $locale->text('Orphaned') . qq|</td>
242 <th align=right nowrap>| . $locale->text('Include in Report') . qq|</th>
246 <td><input name="l_id" type=checkbox class=checkbox value=Y> |
247 . $locale->text('ID') . qq|</td>
248 <td><input name="l_$form->{db}number" type=checkbox class=checkbox value=Y> |
249 . $locale->text($label . ' Number') . qq|</td>
250 <td><input name="l_name" type=checkbox class=checkbox value=Y checked> |
251 . $locale->text('Company Name') . qq|</td>
252 <td><input name="l_address" type=checkbox class=checkbox value=Y> |
253 . $locale->text('Address') . qq|</td>
256 <td><input name="l_contact" type=checkbox class=checkbox value=Y checked> |
257 . $locale->text('Contact') . qq|</td>
258 <td><input name="l_phone" type=checkbox class=checkbox value=Y checked> |
259 . $locale->text('Phone') . qq|</td>
260 <td><input name="l_fax" type=checkbox class=checkbox value=Y> |
261 . $locale->text('Fax') . qq|</td>
262 <td><input name="l_email" type=checkbox class=checkbox value=Y checked> |
263 . $locale->text('E-mail') . qq|</td>
266 <td><input name="l_taxnumber" type=checkbox class=checkbox value=Y> |
267 . $locale->text('Tax Number') . qq|</td>
269 <td><input name="l_sic_code" type=checkbox class=checkbox value=Y> |
270 . $locale->text('SIC') . qq|</td>
271 <td><input name="l_business" type=checkbox class=checkbox value=Y> |
272 . $locale->text('Type of Business') . qq|</td>
275 <td><input name="l_invnumber" type=checkbox class=checkbox value=Y> |
276 . $locale->text('Invoices') . qq|</td>
277 <td><input name="l_ordnumber" type=checkbox class=checkbox value=Y> |
278 . $locale->text('Orders') . qq|</td>
279 <td><input name="l_quonumber" type=checkbox class=checkbox value=Y> |
280 . $locale->text('Quotations') . qq|</td>
289 <td><hr size=3 noshade></td>
293 <input type=hidden name=nextsub value=list_names>
295 <input type=hidden name=path value=$form->{path}>
296 <input type=hidden name=login value=$form->{login}>
297 <input type=hidden name=password value=$form->{password}>
300 <input type=submit class=submit name=action value="|
301 . $locale->text('Continue') . qq|">
307 $lxdebug->leave_sub();
311 $lxdebug->enter_sub();
313 CT->search(\%myconfig, \%$form);
316 "$form->{script}?action=list_names&db=$form->{db}&path=$form->{path}&login=$form->{login}&password=$form->{password}&status=$form->{status}";
320 $form->sort_columns(id, name,
321 "$form->{db}number", address,
324 taxnumber, gifi_accno,
326 invnumber, ordnumber,
329 foreach $item (@columns) {
330 if ($form->{"l_$item"} eq "Y") {
331 push @column_index, $item;
333 # add column to href and callback
334 $callback .= "&l_$item=Y";
335 $href .= "&l_$item=Y";
339 ($form->{db} eq "customer")
340 ? $locale->text('Customer Number')
341 : $locale->text('Vendor Number');
343 if ($form->{status} eq 'all') {
344 $option = $locale->text('All');
346 if ($form->{status} eq 'orphaned') {
347 $option .= $locale->text('Orphaned');
350 $callback .= "&name=" . $form->escape($form->{name}, 1);
351 $href .= "&name=" . $form->escape($form->{name});
352 $option .= "\n<br>" . $locale->text('Name') . " : $form->{name}";
354 if ($form->{contact}) {
355 $callback .= "&contact=" . $form->escape($form->{contact}, 1);
356 $href .= "&contact=" . $form->escape($form->{contact});
357 $option .= "\n<br>" . $locale->text('Contact') . " : $form->{contact}";
359 if ($form->{"$form->{db}number"}) {
361 qq|&$form->{db}number=| . $form->escape($form->{"$form->{db}number"}, 1);
363 "&$form->{db}number=" . $form->escape($form->{"$form->{db}number"});
365 "\n<br>" . $locale->text('Number') . qq| : $form->{"$form->{db}number"}|;
367 if ($form->{email}) {
368 $callback .= "&email=" . $form->escape($form->{email}, 1);
369 $href .= "&email=" . $form->escape($form->{email});
370 $option .= "\n<br>" . $locale->text('E-mail') . " : $form->{email}";
373 $form->{callback} = "$callback&sort=$form->{sort}";
374 $callback = $form->escape($form->{callback});
377 qq|<th class=listheading>| . $locale->text('ID') . qq|</th>|;
378 $column_header{"$form->{db}number"} =
379 qq|<th><a class=listheading href=$href&sort=$form->{db}number>$number</a></th>|;
380 $column_header{name} =
381 qq|<th><a class=listheading href=$href&sort=name>|
382 . $locale->text('Name')
384 $column_header{address} =
385 qq|<th><a class=listheading href=$href&sort=address>|
386 . $locale->text('Address')
388 $column_header{contact} =
389 qq|<th><a class=listheading href=$href&sort=contact>|
390 . $locale->text('Contact')
392 $column_header{phone} =
393 qq|<th><a class=listheading href=$href&sort=phone>|
394 . $locale->text('Phone')
396 $column_header{fax} =
397 qq|<th><a class=listheading href=$href&sort=fax>|
398 . $locale->text('Fax')
400 $column_header{email} =
401 qq|<th><a class=listheading href=$href&sort=email>|
402 . $locale->text('E-mail')
405 qq|<th><a class=listheading href=$href&sort=cc>|
406 . $locale->text('Cc')
409 $column_header{taxnumber} =
410 qq|<th><a class=listheading href=$href&sort=taxnumber>|
411 . $locale->text('Tax Number')
413 $column_header{gifi_accno} =
414 qq|<th><a class=listheading href=$href&sort=gifi_accno>|
415 . $locale->text('GIFI')
417 $column_header{sic_code} =
418 qq|<th><a class=listheading href=$href&sort=sic_code>|
419 . $locale->text('SIC')
421 $column_header{business} =
422 qq|<th><a class=listheading href=$href&sort=business>|
423 . $locale->text('Type of Business')
426 $column_header{invnumber} =
427 qq|<th><a class=listheading href=$href&sort=invnumber>|
428 . $locale->text('Invoice')
430 $column_header{ordnumber} =
431 qq|<th><a class=listheading href=$href&sort=ordnumber>|
432 . $locale->text('Order')
434 $column_header{quonumber} =
435 qq|<th><a class=listheading href=$href&sort=quonumber>|
436 . $locale->text('Quotation')
439 $label = ucfirst $form->{db} . "s";
440 $form->{title} = $locale->text($label);
449 <th class=listtop>$form->{title}</th>
458 <tr class=listheading>
461 map { print "$column_header{$_}\n" } @column_index;
467 $ordertype = ($form->{db} eq 'customer') ? 'sales_order' : 'purchase_order';
469 ($form->{db} eq 'customer') ? 'sales_quotation' : 'request_quotation';
471 foreach $ref (@{ $form->{CT} }) {
473 if ($ref->{id} eq $sameid) {
474 map { $column_data{$_} = "<td> </td>" } @column_index;
476 map { $column_data{$_} = "<td>$ref->{$_} </td>" } @column_index;
478 map { $column_data{$_} = "<td>$ref->{$_} </td>" }
479 (invnumber, ordnumber, quonumber);
482 "<td align=left><a href=$form->{script}?action=edit&id=$ref->{id}&db=$form->{db}&path=$form->{path}&login=$form->{login}&password=$form->{password}&status=$form->{status}&callback=$callback>$ref->{name} </td>";
485 $email = $ref->{email};
486 $email =~ s/</\</;
487 $email =~ s/>/\>/;
489 $column_data{email} =
490 qq|<td><a href="mailto:$ref->{email}">$email</a></td>|;
495 if ($ref->{formtype} eq 'invoice') {
496 $column_data{invnumber} =
497 "<td><a href=$ref->{module}.pl?action=edit&id=$ref->{invid}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{invnumber} </td>";
500 if ($ref->{formtype} eq 'order') {
501 $column_data{ordnumber} =
502 "<td><a href=$ref->{module}.pl?action=edit&id=$ref->{invid}&type=$ordertype&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{ordnumber} </td>";
505 if ($ref->{formtype} eq 'quotation') {
506 $column_data{quonumber} =
507 "<td><a href=$ref->{module}.pl?action=edit&id=$ref->{invid}&type=$quotationtype&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{quonumber} </td>";
516 map { print "$column_data{$_}\n" } @column_index;
522 $sameid = $ref->{id};
531 <td><hr size=3 noshade></td>
536 <form method=post action=$form->{script}>
538 <input name=callback type=hidden value="$form->{callback}">
539 <input name=db type=hidden value=$form->{db}>
541 <input type=hidden name=path value=$form->{path}>
542 <input type=hidden name=login value=$form->{login}>
543 <input type=hidden name=password value=$form->{password}>
545 <input class=submit type=submit name=action value="|
546 . $locale->text('Add') . qq|">
554 $lxdebug->leave_sub();
558 $lxdebug->enter_sub();
560 # show history button
561 $form->{javascript} = qq|<script type=text/javascript src=js/show_history.js></script>|;
562 #/show hhistory button
564 # $locale->text('Edit Customer')
565 # $locale->text('Edit Vendor')
567 CT->get_tuple(\%myconfig, \%$form);
569 # format " into "
570 map { $form->{$_} =~ s/\"/"/g } keys %$form;
572 $form->{title} = "Edit";
575 $form->{discount} *= 100;
580 $lxdebug->leave_sub();
584 $lxdebug->enter_sub();
586 $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
587 $form->{creditlimit} =
588 $form->format_amount(\%myconfig, $form->{creditlimit}, 0);
589 $form->{discount} = $form->format_amount(\%myconfig, $form->{discount});
591 if ($myconfig{role} eq 'admin') {
594 <th align=right nowrap>| . $locale->text('Bcc') . qq|</th>
595 <td><input name=bcc size=35 value="$form->{bcc}"></td>
599 $form->{obsolete} = "checked" if $form->{obsolete};
601 $lang = qq|<option value=""></option>|;
602 foreach $item (@{ $form->{languages} }) {
603 if ($form->{language_id} eq $item->{id}) {
604 $lang .= qq|<option value="$item->{id}" selected>$item->{description}</option>|;
606 $lang .= qq|<option value="$item->{id}">$item->{description}</option>|;
610 $payment = qq|<option value=""></option>|;
611 foreach $item (@{ $form->{payment_terms} }) {
612 if ($form->{payment_id} eq $item->{id}) {
613 $payment .= qq|<option value="$item->{id}" selected>$item->{description}</option>|;
615 $payment .= qq|<option value="$item->{id}">$item->{description}</option>|;
620 if ($form->{db} eq "customer") {
621 $form->{taxzone_id} = 0;
623 $form->{taxzone_id} = 0;
627 if (@{ $form->{TAXZONE} }) {
628 foreach $item (@{ $form->{TAXZONE} }) {
629 if ($item->{id} == $form->{taxzone_id}) {
630 $form->{selecttaxzone} .=
631 "<option value=$item->{id} selected>$item->{description}\n";
633 $form->{selecttaxzone} .=
634 "<option value=$item->{id}>$item->{description}\n";
642 <th align=right>| . $locale->text('Steuersatz') . qq|</th>
643 <td><select name=taxzone_id>$form->{selecttaxzone}</select></td>
644 <input type=hidden name=selecttaxzone value="$form->{selecttaxzone}">
648 "$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=get_contact";
650 my $pjx = new CGI::Ajax( 'get_contact' => $get_contact_url );
651 $form->{selectcontact} = "<option value=0></option>";
652 if (@{ $form->{CONTACTS} }) {
653 foreach $item (@{ $form->{CONTACTS} }) {
654 if ($item->{cp_id} == $form->{cp_id}) {
655 $form->{selectcontact} .=
656 qq|<option value=$item->{cp_id} selected>$item->{cp_name}</option>\n|;
658 $form->{selectcontact} .=
659 qq|<option value=$item->{cp_id}>$item->{cp_name}</option>\n|;
664 push(@ { $form->{AJAX} }, $pjx);
665 $ansprechpartner = qq|
667 <th align=right>| . $locale->text('Ansprechpartner') . qq|</th>
668 <td><select id=cp_id name=cp_id onChange="get_contact(['cp_id__' + this.value], ['cp_name', 'cp_greeting', 'cp_title', 'cp_givenname', 'cp_phone1', 'cp_phone2', 'cp_email', 'cp_abteilung', 'cp_fax', 'cp_mobile1', 'cp_mobile2', 'cp_satphone', 'cp_satfax', 'cp_project', 'cp_privatphone', 'cp_privatemail', 'cp_birthday'])">$form->{selectcontact}</select></td>
669 <input type=hidden name=selectcontact value="$form->{selectcontact}">
672 "$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=get_shipto";
674 my $pjy = new CGI::Ajax( 'get_shipto' => $get_shipto_url );
675 $form->{selectshipto} = "<option value=0></option>";
676 $form->{selectshipto} .= "<option value=0>Alle</option>";
677 if (@{ $form->{SHIPTO} }) {
678 foreach $item (@{ $form->{SHIPTO} }) {
679 if ($item->{shipto_id} == $form->{shipto_id}) {
680 $form->{selectshipto} .=
681 "<option value=$item->{shipto_id} selected>$item->{shiptoname} $item->{shiptodepartment_1}\n";
683 $form->{selectshipto} .=
684 "<option value=$item->{shipto_id}>$item->{shiptoname} $item->{shiptodepartment_1}\n";
689 push(@ { $form->{AJAX} }, $pjy);
693 <th align=right>| . $locale->text('Shipping Address') . qq|</th>
694 <td><select id=shipto_id name=shipto_id onChange="get_shipto(['shipto_id__' + this.value], ['shiptoname','shiptodepartment_1', 'shiptodepartment_2','shiptostreet','shiptozipcode','shiptocity','shiptocountry','shiptocontact','shiptophone','shiptofax','shiptoemail'])">$form->{selectshipto}</select></td>
695 <input type=hidden name=selectshipto value="$form->{selectshipto}">
700 "$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=get_delivery";
702 my $pjz = new CGI::Ajax( 'get_delivery' => $get_delivery_url );
704 push(@ { $form->{AJAX} }, $pjz);
708 <th align=right>| . $locale->text('Shipping Address') . qq|</th>
709 <td><select id=delivery_id name=delivery_id onChange="get_delivery(['shipto_id__' + this.value, 'from__' + from.value, 'to__' + to.value, 'id__' + cvid.value, 'db__' + db.value], ['delivery'])">$form->{selectshipto}</select></td>
712 foreach $item (split / /, $form->{taxaccounts}) {
713 if (($form->{tax}{$item}{taxable}) || !($form->{id})) {
715 qq| <input name="tax_$item" value=1 class=checkbox type=checkbox checked> <b>$form->{tax}{$item}{description}</b>|;
718 qq| <input name="tax_$item" value=1 class=checkbox type=checkbox> <b>$form->{tax}{$item}{description}</b>|;
728 <th align=right>| . $locale->text('Taxable') . qq|</th>
733 <td><input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}></td>
734 <th align=left>| . $locale->text('Tax Included') . qq|</th>
741 $form->{selectbusiness} = qq|<option>\n|;
743 $form->{selectbusiness} .=
744 qq|<option value=$_->{id}>$_->{description}\n|
745 } @{ $form->{all_business} };
746 if ($form->{business_save}) {
747 $form->{selectbusiness} = $form->{business_save};
749 $form->{selectbusiness} =~
750 s/<option value=$form->{business}>/<option value=$form->{business} selected>/;
752 $label = ucfirst $form->{db};
753 if ($form->{title} eq "Edit") {
754 $form->{title} = $locale->text("$form->{title} $label") . " $form->{name}";
756 $form->{title} = $locale->text("$form->{title} $label");
758 if ($form->{title_save}) {
759 $form->{title} = $form->{title_save};
761 if ($form->{db} eq 'vendor') {
763 <th align=right>| . $locale->text('Kundennummer') . qq|</th>
764 <td><input name=v_customer_id size=10 tabindex=18 maxlength=35 value="$form->{v_customer_id}"></td>
768 if ($form->{db} eq 'customer') {
771 <th align=right>| . $locale->text('KNr. beim Kunden') . qq|</th>
772 <td><input name=c_vendor_id size=10 tabindex=18 maxlength=35 value="$form->{c_vendor_id}"></td>
775 $business_salesman = "";
776 $business = "<th></th><td></td>";
778 $business_salesman = qq|
782 <th align=right>| . $locale->text('Type of Business') . qq|</th>
783 <td><select name=business tabindex=1>$form->{selectbusiness}</select></td>
784 <th align=right>| . $locale->text('Salesman') . qq|</th>
785 <td><input name=salesman tabindex=2 value="$form->{salesman}"></td>
786 <input type=hidden name=salesman_id value="$form->{salesman_id}">
787 <input type=hidden name=oldsalesman value="$form->{oldsalesman}">
792 <th align=right>| . $locale->text('Username') . qq|</th>
793 <td><input name=username maxlength=50 tabindex=22 value="$form->{username}"></td>
794 <th align=right>| . $locale->text('Password') . qq|</th>
795 <td><input name=user_password maxlength=12 tabindex=23 value="$form->{user_password}"></td>|;
798 <th align=right>| . $locale->text('Type of Business') . qq|</th>
799 <td><select name=business tabindex=22>$form->{selectbusiness}</select></td>
803 ## LINET: Create a drop-down box with all prior titles and greetings.
804 CT->query_titles_and_greetings(\%myconfig, \%$form);
806 $select_title = qq| <select name=selected_cp_title><option></option>|;
807 map({ $select_title .= qq|<option>$_</option>|; } @{ $form->{TITLES} });
808 $select_title .= qq|</select>|;
811 qq| <select name=selected_cp_greeting><option></option>|;
813 { $select_greeting .= qq|<option>$_</option>|; } @{ $form->{GREETINGS} });
814 $select_greeting .= qq|</select>|;
816 $select_company_greeting =
817 qq| <select name=selected_company_greeting><option></option>|;
819 { $select_company_greeting .= qq|<option>$_</option>|; } @{ $form->{COMPANY_GREETINGS} });
820 $select_company_greeting .= qq|</select>|;
823 qq| <select name=selected_cp_abteilung><option></option>|;
825 { $select_department .= qq|<option>$_</option>|; } @{ $form->{DEPARTMENT} });
826 $select_department .= qq|</select>|;
829 if ($form->{db} eq 'customer') {
831 #get pricegroup and form it
832 $form->get_pricegroup(\%myconfig, { all => 1 });
834 $form->{pricegroup} = "$form->{klass}";
835 $form->{pricegroup_id} = "$form->{klass}";
837 if (@{ $form->{all_pricegroup} }) {
839 $form->{selectpricegroup} = qq|<option>\n|;
841 $form->{selectpricegroup} .=
842 qq|<option value="$_->{id}">$_->{pricegroup}\n|
843 } @{ $form->{all_pricegroup} };
846 if ($form->{selectpricegroup}) {
847 $form->{selectpricegroup} = $form->unescape($form->{selectpricegroup});
850 qq|<input type=hidden name=selectpricegroup value="|
851 . $form->escape($form->{selectpricegroup}, 1) . qq|">|;
853 $form->{selectpricegroup} =~
854 s/(<option value="\Q$form->{klass}\E")/$1 selected/;
857 qq|<select name=klass tabindex=24>$form->{selectpricegroup}</select>|;
862 # $locale->text('Customer Number')
863 # $locale->text('Vendor Number')
864 $form->{fokus} = "ct.greeting";
865 $form->{jsscript} = 1;
869 <body onLoad="fokus()">
872 <th class=listtop>$form->{title}</th>
877 <form method=post name="ct" action=$form->{script} onKeyUp="highlight(event)" onClick="highlight(event)">
881 <ul id="maintab" class="shadetabs">
882 <li class="selected"><a href="#" rel="billing">|
883 . $locale->text('Billing Address') . qq|</a></li>
884 <li><a href="#" rel="shipto">|
885 . $locale->text('Shipping Address') . qq|</a></li>
886 <li><a href="#" rel="contacts">Ansprechpartner</a></li>
887 <li><a href="#" rel="deliveries">|
888 . $locale->text('Lieferungen') . qq|</a></li>
892 <div class="tabcontentstyle">
894 <div id="billing" class="tabcontent">
900 <th align=right nowrap>| . $locale->text($label . ' Number') . qq|</th>
901 <td><input name="$form->{db}number" size=35 maxlength=35 value="$form->{"$form->{db}number"}"></td>
904 <th align=right nowrap>| . $locale->text('Greeting') . qq|</th>
905 <td><input id=greeting name=greeting size=30 maxlength=30 value="$form->{greeting}">
906 $select_company_greeting</td>
909 <th align=right nowrap>| . $locale->text('Company Name') . qq|</th>
910 <td><input name=name size=35 maxlength=75 value="$form->{name}"></td>
913 <th align=right nowrap>| . $locale->text('Abteilung') . qq|</th>
914 <td><input name=department_1 size=16 maxlength=75 value="$form->{department_1}">
915 <input name=department_2 size=16 maxlength=75 value="$form->{department_2}"></td>
918 <th align=right nowrap>| . $locale->text('Street') . qq|</th>
919 <td><input name=street size=35 maxlength=75 value="$form->{street}"></td>
922 <th align=right nowrap>|
923 . $locale->text('Zipcode') . "/" . $locale->text('City') . qq|</th>
924 <td><input name=zipcode size=5 maxlength=10 value="$form->{zipcode}">
925 <input name=city size=30 maxlength=75 value="$form->{city}"></td>
928 <th align=right nowrap>| . $locale->text('Country') . qq|</th>
929 <td><input name=country size=35 maxlength=75 value="$form->{country}"></td>
932 <th align=right nowrap>| . $locale->text('Contact') . qq|</th>
933 <td><input name=contact size=28 maxlength=75 value="$form->{contact}"></td>
936 <th align=right nowrap>| . $locale->text('Phone') . qq|</th>
937 <td><input name=phone size=30 maxlength=30 value="$form->{phone}"></td>
940 <th align=right nowrap>| . $locale->text('Fax') . qq|</th>
941 <td><input name=fax size=30 maxlength=30 value="$form->{fax}"></td>
944 <th align=right nowrap>| . $locale->text('E-mail') . qq|</th>
945 <td><input name=email size=45 value="$form->{email}"></td>
948 <th align=right nowrap>| . $locale->text('Homepage') . qq|</th>
949 <td><input name=homepage size=45 value="$form->{homepage}"></td>
954 <th align=right>| . $locale->text('Credit Limit') . qq|</th>
955 <td><input name=creditlimit size=9 value="$form->{creditlimit}"></td>
956 <input type="hidden" name="terms" value="$form->{terms}">
957 <th align=right>| . $locale->text('Payment Terms') . qq|</th>
958 <td><select name=payment_id>$payment</select></td>
959 <th align=right>| . $locale->text('Discount') . qq|</th>
960 <td><input name=discount size=4 value="$form->{discount}">
964 <th align=right>| . $locale->text('Tax Number / SSN') . qq|</th>
965 <td><input name=taxnumber size=20 value="$form->{taxnumber}"></td>
966 <th align=right>| . $locale->text('USt-IdNr.') . qq|</th>
967 <td><input name="ustid" maxlength="14" size="20" value="$form->{ustid}"></td>
971 <th align=right>| . $locale->text('Account Number') . qq|</th>
972 <td><input name=account_number size=10 value="$form->{account_number}"></td>
973 <th align=right>| . $locale->text('Bank Code Number') . qq|</th>
974 <td><input name=bank_code size=10 value="$form->{bank_code}"></td>
975 <th align=right>| . $locale->text('Bank') . qq|</th>
976 <td><input name=bank size=30 value="$form->{bank}"></td>
980 <th align=right>| . $locale->text('Language') . qq|</th>
981 <td><select name=language_id tabindex=23>$lang
984 if ($form->{db} eq 'customer') {
987 <th align=right>| . $locale->text('Preisklasse') . qq|</th>
988 <td>$pricegroup</td>|;
992 <td align=right>| . $locale->text('Obsolete') . qq|</td>
993 <td><input name=obsolete class=checkbox type=checkbox value=1 $form->{obsolete}></td>
999 <th align=left nowrap>| . $locale->text('Notes') . qq|</th>
1002 <td><textarea name=notes rows=3 cols=60 wrap=soft>$form->{notes}</textarea></td>
1009 <br style="clear: left" /></div>|;
1012 <div id="shipto" class="tabcontent">
1017 <th align=right nowrap>| . $locale->text('Company Name') . qq|</th>
1018 <td><input id=shiptoname name=shiptoname size=35 maxlength=75 value="$form->{shiptoname}"></td>
1021 <th align=right nowrap>| . $locale->text('Abteilung') . qq|</th>
1022 <td><input id=shiptodepartment_1 name=shiptodepartment_1 size=16 maxlength=75 value="$form->{shiptodepartment_1}">
1023 <input id=shiptodepartment_2 name=shiptodepartment_2 size=16 maxlength=75 value="$form->{shiptodepartment_2}"></td>
1026 <th align=right nowrap>| . $locale->text('Street') . qq|</th>
1027 <td><input id=shiptostreet name=shiptostreet size=35 maxlength=75 value="$form->{shiptostreet}"></td>
1030 <th align=right nowrap>|
1031 . $locale->text('Zipcode') . "/" . $locale->text('City') . qq|</th>
1032 <td><input id=shiptozipcode name=shiptozipcode size=5 maxlength=10 value="$form->{shiptozipcode}">
1033 <input id=shiptocity name=shiptocity size=30 maxlength=75 value="$form->{shiptocity}"></td>
1036 <th align=right nowrap>| . $locale->text('Country') . qq|</th>
1037 <td><input id=shiptocountry name=shiptocountry size=35 maxlength=35 value="$form->{shiptocountry}"></td>
1040 <th align=right nowrap>| . $locale->text('Contact') . qq|</th>
1041 <td><input id=shiptocontact name=shiptocontact size=30 maxlength=75 value="$form->{shiptocontact}"></td>
1044 <th align=right nowrap>| . $locale->text('Phone') . qq|</th>
1045 <td><input id=shiptophone name=shiptophone size=30 maxlength=30 value="$form->{shiptophone}"></td>
1048 <th align=right nowrap>| . $locale->text('Fax') . qq|</th>
1049 <td><input id=shiptofax name=shiptofax size=30 maxlength=30 value="$form->{shiptofax}"></td>
1052 <th align=right nowrap>| . $locale->text('E-mail') . qq|</th>
1053 <td><input id=shiptoemail name=shiptoemail size=45 value="$form->{shiptoemail}"></td>
1063 <br style="clear: left" /></div>|;
1066 ##LINET - added fields for contact person
1068 <div id="contacts" class="tabcontent">
1072 <input type=hidden name=cp_id value=$form->{cp_id}>
1076 <th align=left nowrap>| . $locale->text('Greeting') . qq|</th>
1077 <td><input id=cp_greeting name=cp_greeting size=30 maxlength=30 value="$form->{cp_greeting}">
1078 $select_greeting</td>
1081 <th align=left nowrap>| . $locale->text('Title') . qq|</th>
1082 <td><input id=cp_title name=cp_title size=30 maxlength=30 value="$form->{cp_title}">
1086 <th align=left nowrap>| . $locale->text('Department') . qq|</th>
1087 <td><input id=cp_abteilung name=cp_abteilung size=30 maxlength=40 value="$form->{cp_abteilung}">
1088 $select_department</td>
1091 <th align=left nowrap>|
1092 . $locale->text('Given Name') . qq|</th>
1093 <td><input id=cp_givenname name=cp_givenname size=30 maxlength=40 value="$form->{cp_givenname}"></td>
1096 <th align=left nowrap>| . $locale->text('Name') . qq|</th>
1097 <td><input id=cp_name name=cp_name size=30 maxlength=40 value="$form->{cp_name}"></td>
1100 <th align=left nowrap>| . $locale->text('Phone1') . qq|</th>
1101 <td><input id=cp_phone1 name=cp_phone1 size=30 maxlength=30 value="$form->{cp_phone1}"></td>
1104 <th align=left nowrap>| . $locale->text('Phone2') . qq|</th>
1105 <td><input id=cp_phone2 name=cp_phone2 size=30 maxlength=30 value="$form->{cp_phone2}"></td>
1108 <th align=left nowrap>| . $locale->text('Fax') . qq|</th>
1109 <td><input id=cp_fax name=cp_fax size=30 maxlength=30 value="$form->{cp_fax}"></td>
1112 <th align=left nowrap>| . $locale->text('Mobile1') . qq|</th>
1113 <td><input id=cp_mobile1 name=cp_mobile1 size=30 maxlength=30 value="$form->{cp_mobile1}"></td>
1116 <th align=left nowrap>| . $locale->text('Mobile2') . qq|</th>
1117 <td><input id=cp_mobile2 name=cp_mobile2 size=30 maxlength=30 value="$form->{cp_mobile2}"></td>
1120 <th align=left nowrap>| . $locale->text('Sat. Phone') . qq|</th>
1121 <td><input id=cp_satphone name=cp_satphone size=30 maxlength=30 value="$form->{cp_satphone}"></td>
1124 <th align=left nowrap>| . $locale->text('Sat. Fax') . qq|</th>
1125 <td><input id=cp_satfax name=cp_satfax size=30 maxlength=30 value="$form->{cp_satfax}"></td>
1128 <th align=left nowrap>| . $locale->text('Project') . qq|</th>
1129 <td><input id=cp_project name=cp_project size=30 maxlength=40 value="$form->{cp_project}"></td>
1132 <th align=left nowrap>| . $locale->text('E-mail') . qq|</th>
1133 <td><input id=cp_email name=cp_email size=30 maxlength=40 value="$form->{cp_email}"></td>
1136 <th align=left nowrap>| . $locale->text('Private Phone') . qq|</th>
1137 <td><input id=cp_privatphone name=cp_privatphone size=30 maxlength=40 value="$form->{cp_privatphone}"></td>
1140 <th align=left nowrap>| . $locale->text('Private E-mail') . qq|</th>
1141 <td><input id=cp_privatemail name=cp_privatemail size=30 maxlength=40 value="$form->{cp_privatemail}"></td>
1144 <th align=left nowrap>| . $locale->text('Birthday') . qq|</th>
1145 <td><input id=cp_birthday name=cp_birthday size=30 maxlength=40 value="$form->{cp_birthday}"></td>
1151 <tr height="5"></tr>|;
1161 <br style="clear: left" /></div>
1162 <div id="deliveries" class="tabcontent">
1166 <th align=left nowrap>| . $locale->text('From') . qq|</th>
1167 <td><input id=from name=from size=10 maxlength=10 value="$form->{from}">
1168 <input type="button" name="fromB" id="trigger_from" value="?"></td>
1169 <th align=left nowrap>| . $locale->text('To (time)') . qq|</th>
1170 <td><input id=to name=to size=10 maxlength=10 value="$form->{to}">
1171 <input type="button" name="toB" id="trigger_to" value="?"></td>
1180 <br style="clear: left" /></div>
1184 | . $form->write_trigger(\%myconfig, 2, "fromB", "BL", "trigger_from",
1185 "toB", "BL", "trigger_to");
1187 $lxdebug->leave_sub();
1191 $lxdebug->enter_sub();
1193 $label = ucfirst $form->{db};
1195 ($form->{db} eq 'customer')
1196 ? $locale->text('Save and Quotation')
1197 : $locale->text('Save and RFQ');
1199 ($form->{db} eq 'customer')
1200 ? $locale->text('Save and AR Transaction')
1201 : $locale->text('Save and AP Transaction');
1204 qq|<input class=submit type=submit name=action accesskey="u" value="|
1205 . $locale->text("Update") . qq|">|;
1207 $update_button = "";
1210 ##<input class=submit type=submit name=action value="|.$locale->text("Save and Quotation").qq|">
1211 ##<input class=submit type=submit name=action value="|.$locale->text("Save and RFQ").qq|">
1212 ##<input class=submit type=submit name=action value="|.$locale->text("Save and AR Transaction").qq|">
1213 ##<input class=submit type=submit name=action value="|.$locale->text("Save and AP Transaction").qq|">
1216 <input name=id type=hidden id=cvid value=$form->{id}>
1217 <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
1218 <input name=business_save type=hidden value="$form->{selectbusiness}">
1219 <input name=title_save type=hidden value="$form->{title}">
1221 <input type=hidden name=path value=$form->{path}>
1222 <input type=hidden name=login value=$form->{login}>
1223 <input type=hidden name=password value=$form->{password}>
1225 <input type=hidden name=callback value="$form->{callback}">
1226 <input type=hidden name=db id=db value=$form->{db}>
1232 <input class=submit type=submit name=action accesskey="s" value="|
1233 . $locale->text("Save") . qq|">
1234 <input class=submit type=submit name=action accesskey="s" value="|
1235 . $locale->text("Save and Close") . qq|">
1236 <input class=submit type=submit name=action value="$arap">
1237 <input class=submit type=submit name=action value="|
1238 . $locale->text("Save and Invoice") . qq|">
1239 <input class=submit type=submit name=action value="|
1240 . $locale->text("Save and Order") . qq|">
1241 <input class=submit type=submit name=action value="$quotation">
1244 if ($form->{id} && $form->{status} eq 'orphaned') {
1245 print qq|<input class=submit type=submit name=action value="|
1246 . $locale->text('Delete')
1250 # button for saving history
1251 if($form->{id} ne "") {
1253 <input type=button class=submit onclick=set_history_window(|
1255 . qq|); name=history id=history value=|
1256 . $locale->text('history')
1259 # /button for saving history
1264 <script type="text/javascript">
1265 //Start Tab Content script for UL with id="maintab" Separate multiple ids each with a comma.
1266 initializetabcontent("maintab")
1272 $lxdebug->leave_sub();
1275 sub add_transaction {
1276 $lxdebug->enter_sub();
1278 # # saving the history
1279 # if(!exists $form->{addition}) {
1280 # $form->{addition} = "ADD TRANSACTION";
1281 # $form->save_history($form->dbconnect(\%myconfig));
1283 # # /saving the history
1285 $form->isblank("name", $locale->text("Name missing!"));
1286 if ($vertreter && $form->{db} eq "customer") {
1287 $form->isblank("salesman_id", $locale->text("Salesman missing!"));
1289 &{"CT::save_$form->{db}"}("", \%myconfig, \%$form);
1291 $form->{callback} = $form->escape($form->{callback}, 1);
1292 $name = $form->escape("$form->{name}", 1);
1295 "$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=add&vc=$form->{db}&$form->{db}_id=$form->{id}&$form->{db}=$name&type=$form->{type}&callback=$form->{callback}";
1298 $lxdebug->leave_sub();
1301 sub save_and_ap_transaction {
1302 $lxdebug->enter_sub();
1304 $form->{script} = "ap.pl";
1305 # saving the history
1306 if(!exists $form->{addition}) {
1307 $form->{addition} = "SAVED";
1308 $form->save_history($form->dbconnect(\%myconfig));
1310 # /saving the history
1312 $lxdebug->leave_sub();
1315 sub save_and_ar_transaction {
1316 $lxdebug->enter_sub();
1318 $form->{script} = "ar.pl";
1319 # saving the history
1320 if(!exists $form->{addition}) {
1321 $form->{addition} = "SAVED";
1322 $form->save_history($form->dbconnect(\%myconfig));
1324 # /saving the history
1326 $lxdebug->leave_sub();
1329 sub save_and_invoice {
1330 $lxdebug->enter_sub();
1332 $form->{script} = ($form->{db} eq 'customer') ? "is.pl" : "ir.pl";
1333 $form->{type} = "invoice";
1334 # saving the history
1335 if(!exists $form->{addition}) {
1336 $form->{addition} = "SAVED";
1337 $form->save_history($form->dbconnect(\%myconfig));
1339 # /saving the history
1341 $lxdebug->leave_sub();
1345 $lxdebug->enter_sub();
1347 $form->{script} = "oe.pl";
1348 $form->{type} = "request_quotation";
1349 # saving the history
1350 if(!exists $form->{addition}) {
1351 $form->{addition} = "SAVED";
1352 $form->save_history($form->dbconnect(\%myconfig));
1354 # /saving the history
1356 $lxdebug->leave_sub();
1359 sub save_and_quotation {
1360 $lxdebug->enter_sub();
1362 $form->{script} = "oe.pl";
1363 $form->{type} = "sales_quotation";
1364 # saving the history
1365 if(!exists $form->{addition}) {
1366 $form->{addition} = "SAVED";
1367 $form->save_history($form->dbconnect(\%myconfig));
1369 # /saving the history
1371 $lxdebug->leave_sub();
1374 sub save_and_order {
1375 $lxdebug->enter_sub();
1377 $form->{script} = "oe.pl";
1379 ($form->{db} eq 'customer') ? "sales_order" : "purchase_order";
1380 # saving the history
1381 if(!exists $form->{addition}) {
1382 $form->{addition} = "SAVED";
1383 $form->save_history($form->dbconnect(\%myconfig));
1385 # /saving the history
1387 $lxdebug->leave_sub();
1390 sub save_and_close {
1391 $lxdebug->enter_sub();
1393 # $locale->text('Customer saved!')
1394 # $locale->text('Vendor saved!')
1396 $msg = ucfirst $form->{db};
1399 $form->isblank("name", $locale->text("Name missing!"));
1400 if ($vertreter && $form->{db} eq "customer") {
1401 $form->isblank("salesman_id", $locale->text("Salesman missing!"));
1403 $rc = &{"CT::save_$form->{db}"}("", \%myconfig, \%$form);
1405 $form->error($locale->text('customernumber not unique!'));
1407 # saving the history
1408 if(!exists $form->{addition}) {
1409 $form->{addition} = "SAVED";
1410 $form->save_history($form->dbconnect(\%myconfig));
1412 # /saving the history
1413 $form->redirect($locale->text($msg));
1415 $lxdebug->leave_sub();
1419 $lxdebug->enter_sub();
1421 # $locale->text('Customer saved!')
1422 # $locale->text('Vendor saved!')
1424 $msg = ucfirst $form->{db};
1427 $form->isblank("name", $locale->text("Name missing!"));
1428 if ($vertreter && $form->{db} eq "customer") {
1429 $form->isblank("salesman_id", $locale->text("Salesman missing!"));
1432 my $res = &{"CT::save_$form->{db}"}("", \%myconfig, \%$form);
1435 if ($form->{"db"} eq "customer") {
1436 $form->error($locale->text('This customer number is already in use.'));
1438 $form->error($locale->text('This vendor number is already in use.'));
1441 # saving the history
1442 if(!exists $form->{addition}) {
1443 $form->{addition} = "SAVED";
1444 $form->save_history($form->dbconnect(\%myconfig));
1446 # /saving the history
1449 $lxdebug->leave_sub();
1453 $lxdebug->enter_sub();
1455 # $locale->text('Customer deleted!')
1456 # $locale->text('Cannot delete customer!')
1457 # $locale->text('Vendor deleted!')
1458 # $locale->text('Cannot delete vendor!')
1460 CT->delete(\%myconfig, \%$form);
1462 $msg = ucfirst $form->{db};
1463 $msg .= " deleted!";
1464 # saving the history
1465 if(!exists $form->{addition}) {
1466 $form->{addition} = "DELETED";
1467 $form->save_history($form->dbconnect(\%myconfig));
1469 # /saving the history
1470 $form->redirect($locale->text($msg));
1472 $msg = "Cannot delete $form->{db}";
1473 $form->error($locale->text($msg));
1475 $lxdebug->leave_sub();
1479 $lxdebug->enter_sub();
1484 $lxdebug->leave_sub();
1488 $lxdebug->enter_sub();
1490 &check_salesman($form->{salesman});
1492 # $form->get_salesman(\%myconfig, $form->{salesman});
1494 $lxdebug->leave_sub();
1497 sub check_salesman {
1498 $lxdebug->enter_sub();
1502 my ($new_name, $new_id) = split /--/, $form->{$name};
1505 # check name, combine name and id
1506 if ($form->{"oldsalesman"} ne $form->{"salesman"}) {
1508 # return one name or a list of names in $form->{name_list}
1509 if (($i = $form->get_salesman(\%myconfig, $name)) > 1) {
1510 &select_salesman($name);
1517 $form->{"salesman_id"} = $form->{salesman_list}[0]->{id};
1518 $form->{salesman} = $form->{salesman_list}[0]->{name};
1519 $form->{"oldsalesman"} = $form->{salesman};
1523 # name is not on file
1524 # $locale->text('Customer not on file!')
1525 # $locale->text('Vendor not on file!')
1526 $msg = ucfirst $name . " not on file or locked!";
1527 $form->error($locale->text($msg));
1531 $lxdebug->leave_sub();
1536 sub select_salesman {
1537 $lxdebug->enter_sub();
1541 @column_index = qw(ndx name);
1543 $label = ucfirst $table;
1544 $column_data{ndx} = qq|<th> </th>|;
1545 $column_data{name} =
1546 qq|<th class=listheading>| . $locale->text($label) . qq|</th>|;
1548 # list items with radio button on a form
1551 $title = $locale->text('Select from one of the names below');
1556 <form method=post action=$form->{script}>
1560 <th class=listtop>$title</th>
1566 <tr class=listheading>|;
1568 map { print "\n$column_data{$_}" } @column_index;
1575 foreach $ref (@{ $form->{salesman_list} }) {
1576 $checked = ($i++) ? "" : "checked";
1578 $ref->{name} =~ s/\"/"/g;
1581 qq|<td><input name=ndx class=radio type=radio value=$i $checked></td>|;
1582 $column_data{name} =
1583 qq|<td><input name="new_name_$i" type=hidden value="$ref->{name}">$ref->{name}</td>|;
1588 <tr class=listrow$j>|;
1590 map { print "\n$column_data{$_}" } @column_index;
1595 <input name="new_id_$i" type=hidden value=$ref->{id}>
1606 <td><hr size=3 noshade></td>
1610 <input name=lastndx type=hidden value=$i>
1615 map { delete $form->{$_} } qw(action name_list header);
1617 # save all other form variables
1618 foreach $key (keys %${form}) {
1619 $form->{$key} =~ s/\"/"/g;
1620 print qq|<input name=$key type=hidden value="$form->{$key}">\n|;
1624 <input type=hidden name=nextsub value=salesman_selected>
1626 <input type=hidden name=vc value=$table>
1628 <input class=submit type=submit name=action value="|
1629 . $locale->text('Continue') . qq|">
1636 $lxdebug->leave_sub();
1639 sub salesman_selected {
1640 $lxdebug->enter_sub();
1642 # replace the variable with the one checked
1644 # index for new item
1647 $form->{salesman} = $form->{"new_name_$i"};
1648 $form->{"salesman_id"} = $form->{"new_id_$i"};
1649 $form->{"oldsalesman"} = $form->{salesman};
1651 # delete all the new_ variables
1652 for $i (1 .. $form->{lastndx}) {
1653 map { delete $form->{"new_${_}_$i"} } (id, name);
1656 map { delete $form->{$_} } qw(ndx lastndx nextsub);
1660 $lxdebug->leave_sub();
1664 $lxdebug->enter_sub();
1666 CT->get_contact(\%myconfig, \%$form);
1669 $result = "$form->{cp_name}";
1670 map { $result .= "__pjx__" . $form->{$_} } qw(cp_greeting cp_title cp_givenname cp_phone1 cp_phone2 cp_email cp_abteilung cp_fax cp_mobile1 cp_mobile2 cp_satphone cp_satfax cp_project cp_privatphone cp_privatemail cp_birthday);
1673 $lxdebug->leave_sub();
1678 $lxdebug->enter_sub();
1680 CT->get_shipto(\%myconfig, \%$form);
1683 $result = "$form->{shiptoname}";
1684 map { $result .= "__pjx__" . $form->{$_} } qw(shiptodepartment_1 shiptodepartment_2 shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact shiptophone shiptofax shiptoemail);
1687 $lxdebug->leave_sub();
1692 $lxdebug->enter_sub();
1694 CT->get_delivery(\%myconfig, \%$form );
1697 $form->sort_columns(shiptoname,
1707 $column_header{shiptoname} =
1708 qq|<th class=listheading>| . $locale->text('Shipping Address') . qq|</th>|;
1709 $column_header{invnumber} =
1710 qq|<th class=listheading>|. $locale->text('Invoice'). qq|</th>|;
1711 $column_header{ordnumber} =
1712 qq|<th class=listheading>|. $locale->text('Order'). qq|</th>|;
1713 $column_header{transdate} =
1714 qq|<th class=listheading>| . $locale->text('Invdate') . qq|</th>|;
1715 $column_header{description} =
1716 qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|;
1717 $column_header{qty} =
1718 qq|<th class=listheading>| . $locale->text('Qty') . qq|</th>|;
1719 $column_header{unit} =
1720 qq|<th class=listheading>| . $locale->text('Unit') . qq|</th>|;
1727 <tr class=listheading>
1730 map { $result .= "$column_header{$_}\n" } @column_index;
1737 foreach $ref (@{ $form->{DELIVERY} }) {
1739 if ($ref->{shiptoname} eq $sameshiptoname) {
1740 map { $column_data{$_} = "<td>$ref->{$_} </td>" } @column_index;
1741 $column_data{shiptoname} = "<td> </td>";
1743 map { $column_data{$_} = "<td>$ref->{$_} </td>" } @column_index;
1749 <tr class=listrow$i>
1752 map { $result .= "$column_data{$_}\n" } @column_index;
1758 $sameshiptoname = $ref->{shiptoname};
1770 $lxdebug->leave_sub();
1774 sub continue { &{ $form->{nextsub} } }