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 $form->{title} = $locale->text('ADR Report');
315 # use JavaScript Calendar or not
316 $form->{jsscript} = $jscalendar;
319 if ($form->{jsscript}) {
321 # with JavaScript Calendar
323 <td><input name=from id=from size=11 title="$myconfig{dateformat}" value=$form->{from}></td>
324 <td><input type=button name=from id="trigger1" value=|
325 . $locale->text('button') . qq|></td>
328 <td width="13"><input name=to id=to size=11 title="$myconfig{dateformat}" value=$form->{to}></td>
329 <td width="4"><input type=button name=to id="trigger2" value=|
330 . $locale->text('button') . qq|></td></td>
336 Form->write_trigger(\%myconfig, "2",
342 # without JavaScript Calendar
344 qq|<td><input name=from size=11 title="$myconfig{dateformat}" value=$form->{from}></td>|;
346 qq|<td width="13"><input name=to size=11 title="$myconfig{dateformat}" value=$form->{to}></td>|;
354 <form method=post action=$form->{script}>
359 <th class=listtop>$form->{title}</th>
366 <th align=right nowrap>| . $locale->text('Year') . qq|</th>
367 <td><input name=year type=input value=$form->{year}></td>
369 <th align=right nowrap>| . $locale->text('From') . qq|</th>
373 <th align=right nowrap>| . $locale->text('Bis') . qq|</th>
378 <td><input name=format class=radio type=radio value=html checked> |
379 . $locale->text('HTML') . qq|
380 <input name=format class=radio type=radio value=csv> |
381 . $locale->text('CSV') . qq|</td>
387 <td><hr size=3 noshade></td>
391 <input type=hidden name=nextsub value=adr_report>
393 <input type=hidden name=path value=$form->{path}>
394 <input type=hidden name=login value=$form->{login}>
395 <input type=hidden name=password value=$form->{password}>
398 <input type=submit class=submit name=action value="|
399 . $locale->text('Continue') . qq|">
405 $lxdebug->leave_sub();
408 $lxdebug->enter_sub();
410 CT->adr(\%myconfig, \%$form);
412 $form->{title} = $locale->text('ADR Report');
413 if ($form->{from} || $form->{to}) {
414 $option = "Für den Zeitraum $form->{from} bis $form->{to}";
415 } elsif ($form->{year}) {
416 $option = "Für das Jahr $form->{year}";
419 if ($form->{format} eq "html") {
426 <th class=listtop>$form->{title}</th>
436 $form->sort_columns(adr_code,
443 $column_header{adr_code} =
444 qq|<th class=listheading>| . $locale->text('ADR Code') . qq|</th>|;
445 $column_header{adr_description} =
446 qq|<th class=listheading>|. $locale->text('ADR Description'). qq|</th>|;
447 $column_header{sum} =
448 qq|<th class=listheading>|. $locale->text('Quantity'). qq|</th>|;
449 $column_header{unit} =
450 qq|<th class=listheading>| . $locale->text('Unit') . qq|</th>|;
458 <tr class=listheading>
461 map { print "$column_header{$_}\n" } @column_index;
468 foreach $ref (@{ $form->{ADR} }) {
470 map { $column_data{$_} = "<td>$ref->{$_} </td>" } @column_index;
479 map { print "$column_data{$_}\n" } @column_index;
494 my $filename = "adr-report-$form->{from}-$form->{to}.csv";
496 $filename = "adr-report-$form->{year}.csv";
499 $form->sort_columns(adr_code,
504 $tmpfile = qq|ADR Code;ADR Beschreibung;Menge;Einheit\n|;
505 foreach $ref (@{ $form->{ADR} }) {
507 map { $column_data{$_} = qq|"$ref->{$_}"| } @column_index;
510 map { $line .= "$column_data{$_};" } @column_index;
512 $tmpfile .= qq|$line\n|;;
515 my $size = length($tmpfile);
517 print qq|Content-Type: application/csv
518 Content-Disposition: attachment; filename="$filename"
519 Content-Length: $size
525 $lxdebug->leave_sub();
529 $lxdebug->enter_sub();
531 CT->search(\%myconfig, \%$form);
534 "$form->{script}?action=list_names&db=$form->{db}&path=$form->{path}&login=$form->{login}&password=$form->{password}&status=$form->{status}";
538 $form->sort_columns(id, name,
539 "$form->{db}number", address,
542 taxnumber, gifi_accno,
544 invnumber, ordnumber,
547 foreach $item (@columns) {
548 if ($form->{"l_$item"} eq "Y") {
549 push @column_index, $item;
551 # add column to href and callback
552 $callback .= "&l_$item=Y";
553 $href .= "&l_$item=Y";
557 ($form->{db} eq "customer")
558 ? $locale->text('Customer Number')
559 : $locale->text('Vendor Number');
561 if ($form->{status} eq 'all') {
562 $option = $locale->text('All');
564 if ($form->{status} eq 'orphaned') {
565 $option .= $locale->text('Orphaned');
568 $callback .= "&name=" . $form->escape($form->{name}, 1);
569 $href .= "&name=" . $form->escape($form->{name});
570 $option .= "\n<br>" . $locale->text('Name') . " : $form->{name}";
572 if ($form->{contact}) {
573 $callback .= "&contact=" . $form->escape($form->{contact}, 1);
574 $href .= "&contact=" . $form->escape($form->{contact});
575 $option .= "\n<br>" . $locale->text('Contact') . " : $form->{contact}";
577 if ($form->{"$form->{db}number"}) {
579 qq|&$form->{db}number=| . $form->escape($form->{"$form->{db}number"}, 1);
581 "&$form->{db}number=" . $form->escape($form->{"$form->{db}number"});
583 "\n<br>" . $locale->text('Number') . qq| : $form->{"$form->{db}number"}|;
585 if ($form->{email}) {
586 $callback .= "&email=" . $form->escape($form->{email}, 1);
587 $href .= "&email=" . $form->escape($form->{email});
588 $option .= "\n<br>" . $locale->text('E-mail') . " : $form->{email}";
591 $form->{callback} = "$callback&sort=$form->{sort}";
592 $callback = $form->escape($form->{callback});
595 qq|<th class=listheading>| . $locale->text('ID') . qq|</th>|;
596 $column_header{"$form->{db}number"} =
597 qq|<th><a class=listheading href=$href&sort=$form->{db}number>$number</a></th>|;
598 $column_header{name} =
599 qq|<th><a class=listheading href=$href&sort=name>|
600 . $locale->text('Name')
602 $column_header{address} =
603 qq|<th><a class=listheading href=$href&sort=address>|
604 . $locale->text('Address')
606 $column_header{contact} =
607 qq|<th><a class=listheading href=$href&sort=contact>|
608 . $locale->text('Contact')
610 $column_header{phone} =
611 qq|<th><a class=listheading href=$href&sort=phone>|
612 . $locale->text('Phone')
614 $column_header{fax} =
615 qq|<th><a class=listheading href=$href&sort=fax>|
616 . $locale->text('Fax')
618 $column_header{email} =
619 qq|<th><a class=listheading href=$href&sort=email>|
620 . $locale->text('E-mail')
623 qq|<th><a class=listheading href=$href&sort=cc>|
624 . $locale->text('Cc')
627 $column_header{taxnumber} =
628 qq|<th><a class=listheading href=$href&sort=taxnumber>|
629 . $locale->text('Tax Number')
631 $column_header{gifi_accno} =
632 qq|<th><a class=listheading href=$href&sort=gifi_accno>|
633 . $locale->text('GIFI')
635 $column_header{sic_code} =
636 qq|<th><a class=listheading href=$href&sort=sic_code>|
637 . $locale->text('SIC')
639 $column_header{business} =
640 qq|<th><a class=listheading href=$href&sort=business>|
641 . $locale->text('Type of Business')
644 $column_header{invnumber} =
645 qq|<th><a class=listheading href=$href&sort=invnumber>|
646 . $locale->text('Invoice')
648 $column_header{ordnumber} =
649 qq|<th><a class=listheading href=$href&sort=ordnumber>|
650 . $locale->text('Order')
652 $column_header{quonumber} =
653 qq|<th><a class=listheading href=$href&sort=quonumber>|
654 . $locale->text('Quotation')
657 $label = ucfirst $form->{db} . "s";
658 $form->{title} = $locale->text($label);
667 <th class=listtop>$form->{title}</th>
676 <tr class=listheading>
679 map { print "$column_header{$_}\n" } @column_index;
685 $ordertype = ($form->{db} eq 'customer') ? 'sales_order' : 'purchase_order';
687 ($form->{db} eq 'customer') ? 'sales_quotation' : 'request_quotation';
689 foreach $ref (@{ $form->{CT} }) {
691 if ($ref->{id} eq $sameid) {
692 map { $column_data{$_} = "<td> </td>" } @column_index;
694 map { $column_data{$_} = "<td>$ref->{$_} </td>" } @column_index;
696 map { $column_data{$_} = "<td>$ref->{$_} </td>" }
697 (invnumber, ordnumber, quonumber);
700 "<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>";
703 $email = $ref->{email};
704 $email =~ s/</\</;
705 $email =~ s/>/\>/;
707 $column_data{email} =
708 qq|<td><a href="mailto:$ref->{email}">$email</a></td>|;
713 if ($ref->{formtype} eq 'invoice') {
714 $column_data{invnumber} =
715 "<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>";
718 if ($ref->{formtype} eq 'order') {
719 $column_data{ordnumber} =
720 "<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>";
723 if ($ref->{formtype} eq 'quotation') {
724 $column_data{quonumber} =
725 "<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>";
734 map { print "$column_data{$_}\n" } @column_index;
740 $sameid = $ref->{id};
749 <td><hr size=3 noshade></td>
754 <form method=post action=$form->{script}>
756 <input name=callback type=hidden value="$form->{callback}">
757 <input name=db type=hidden value=$form->{db}>
759 <input type=hidden name=path value=$form->{path}>
760 <input type=hidden name=login value=$form->{login}>
761 <input type=hidden name=password value=$form->{password}>
763 <input class=submit type=submit name=action value="|
764 . $locale->text('Add') . qq|">|;
766 if ($form->{menubar}) {
767 require "$form->{path}/menu.pl";
778 $lxdebug->leave_sub();
782 $lxdebug->enter_sub();
784 # $locale->text('Edit Customer')
785 # $locale->text('Edit Vendor')
787 CT->get_tuple(\%myconfig, \%$form);
789 # format " into "
790 map { $form->{$_} =~ s/\"/"/g } keys %$form;
792 $form->{title} = "Edit";
795 $form->{discount} *= 100;
800 $lxdebug->leave_sub();
804 $lxdebug->enter_sub();
806 $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
807 $form->{creditlimit} =
808 $form->format_amount(\%myconfig, $form->{creditlimit}, 0);
809 $form->{discount} = $form->format_amount(\%myconfig, $form->{discount});
811 if ($myconfig{role} eq 'admin') {
814 <th align=right nowrap>| . $locale->text('Bcc') . qq|</th>
815 <td><input name=bcc size=35 value="$form->{bcc}"></td>
819 $form->{obsolete} = "checked" if $form->{obsolete};
821 $lang = qq|<option value=""></option>|;
822 foreach $item (@{ $form->{languages} }) {
823 if ($form->{language_id} eq $item->{id}) {
824 $lang .= qq|<option value="$item->{id}" selected>$item->{description}</option>|;
826 $lang .= qq|<option value="$item->{id}">$item->{description}</option>|;
830 $payment = qq|<option value=""></option>|;
831 foreach $item (@{ $form->{payment_terms} }) {
832 if ($form->{payment_id} eq $item->{id}) {
833 $payment .= qq|<option value="$item->{id}" selected>$item->{description}</option>|;
835 $payment .= qq|<option value="$item->{id}">$item->{description}</option>|;
840 if ($form->{db} eq "customer") {
841 $form->{taxzone_id} = 0;
843 $form->{taxzone_id} = 0;
847 if (@{ $form->{TAXZONE} }) {
848 foreach $item (@{ $form->{TAXZONE} }) {
849 if ($item->{id} == $form->{taxzone_id}) {
850 $form->{selecttaxzone} .=
851 "<option value=$item->{id} selected>$item->{description}\n";
853 $form->{selecttaxzone} .=
854 "<option value=$item->{id}>$item->{description}\n";
862 <th align=right>| . $locale->text('Steuersatz') . qq|</th>
863 <td><select name=taxzone_id>$form->{selecttaxzone}</select></td>
864 <input type=hidden name=selecttaxzone value="$form->{selecttaxzone}">
868 "$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=get_contact";
870 my $pjx = new CGI::Ajax( 'get_contact' => $get_contact_url );
871 $form->{selectcontact} = "<option value=0></option>";
872 if (@{ $form->{CONTACTS} }) {
873 foreach $item (@{ $form->{CONTACTS} }) {
874 if ($item->{cp_id} == $form->{cp_id}) {
875 $form->{selectcontact} .=
876 qq|<option value=$item->{cp_id} selected>$item->{cp_name}</option>\n|;
878 $form->{selectcontact} .=
879 qq|<option value=$item->{cp_id}>$item->{cp_name}</option>\n|;
884 push(@ { $form->{AJAX} }, $pjx);
885 $ansprechpartner = qq|
887 <th align=right>| . $locale->text('Ansprechpartner') . qq|</th>
888 <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>
889 <input type=hidden name=selectcontact value="$form->{selectcontact}">
892 "$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=get_shipto";
894 my $pjy = new CGI::Ajax( 'get_shipto' => $get_shipto_url );
895 $form->{selectshipto} = "<option value=0></option>";
896 if (@{ $form->{SHIPTO} }) {
897 foreach $item (@{ $form->{SHIPTO} }) {
898 if ($item->{shipto_id} == $form->{shipto_id}) {
899 $form->{selectshipto} .=
900 "<option value=$item->{shipto_id} selected>$item->{shiptoname} $item->{shiptodepartment_1}\n";
902 $form->{selectshipto} .=
903 "<option value=$item->{shipto_id}>$item->{shiptoname} $item->{shiptodepartment_1}\n";
908 push(@ { $form->{AJAX} }, $pjy);
912 <th align=right>| . $locale->text('Shipping Address') . qq|</th>
913 <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>
914 <input type=hidden name=selectshipto value="$form->{selectshipto}">
919 "$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=get_delivery";
921 my $pjz = new CGI::Ajax( 'get_delivery' => $get_delivery_url );
923 push(@ { $form->{AJAX} }, $pjz);
927 <th align=right>| . $locale->text('Shipping Address') . qq|</th>
928 <td><select id=delivery_id name=delivery_id onChange="get_delivery(['shipto_id__' + this.value, 'from__' + from.value, 'to__' + to.value], ['delivery'])">$form->{selectshipto}</select></td>
931 foreach $item (split / /, $form->{taxaccounts}) {
932 if (($form->{tax}{$item}{taxable}) || !($form->{id})) {
934 qq| <input name="tax_$item" value=1 class=checkbox type=checkbox checked> <b>$form->{tax}{$item}{description}</b>|;
937 qq| <input name="tax_$item" value=1 class=checkbox type=checkbox> <b>$form->{tax}{$item}{description}</b>|;
947 <th align=right>| . $locale->text('Taxable') . qq|</th>
952 <td><input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}></td>
953 <th align=left>| . $locale->text('Tax Included') . qq|</th>
960 $form->{selectbusiness} = qq|<option>\n|;
962 $form->{selectbusiness} .=
963 qq|<option value=$_->{id}>$_->{description}\n|
964 } @{ $form->{all_business} };
965 if ($form->{business_save}) {
966 $form->{selectbusiness} = $form->{business_save};
968 $form->{selectbusiness} =~
969 s/<option value=$form->{business}>/<option value=$form->{business} selected>/;
971 $label = ucfirst $form->{db};
972 if ($form->{title} eq "Edit") {
973 $form->{title} = $locale->text("$form->{title} $label") . " $form->{name}";
975 $form->{title} = $locale->text("$form->{title} $label");
977 if ($form->{title_save}) {
978 $form->{title} = $form->{title_save};
980 if ($form->{db} eq 'vendor') {
982 <th align=right>| . $locale->text('Kundennummer') . qq|</th>
983 <td><input name=v_customer_id size=10 tabindex=18 maxlength=35 value="$form->{v_customer_id}"></td>
987 if ($form->{db} eq 'customer') {
990 <th align=right>| . $locale->text('KNr. beim Kunden') . qq|</th>
991 <td><input name=c_vendor_id size=10 tabindex=18 maxlength=35 value="$form->{c_vendor_id}"></td>
994 $business_salesman = "";
995 $business = "<th></th><td></td>";
997 $business_salesman = qq|
1001 <th align=right>| . $locale->text('Type of Business') . qq|</th>
1002 <td><select name=business tabindex=1>$form->{selectbusiness}</select></td>
1003 <th align=right>| . $locale->text('Salesman') . qq|</th>
1004 <td><input name=salesman tabindex=2 value="$form->{salesman}"></td>
1005 <input type=hidden name=salesman_id value="$form->{salesman_id}">
1006 <input type=hidden name=oldsalesman value="$form->{oldsalesman}">
1011 <th align=right>| . $locale->text('Username') . qq|</th>
1012 <td><input name=username maxlength=50 tabindex=22 value="$form->{username}"></td>
1013 <th align=right>| . $locale->text('Password') . qq|</th>
1014 <td><input name=user_password maxlength=12 tabindex=23 value="$form->{user_password}"></td>|;
1017 <th align=right>| . $locale->text('Type of Business') . qq|</th>
1018 <td><select name=business tabindex=22>$form->{selectbusiness}</select></td>
1022 ## LINET: Create a drop-down box with all prior titles and greetings.
1023 CT->query_titles_and_greetings(\%myconfig, \%$form);
1025 $select_title = qq| <select name=selected_cp_title><option></option>|;
1026 map({ $select_title .= qq|<option>$_</option>|; } @{ $form->{TITLES} });
1027 $select_title .= qq|</select>|;
1030 qq| <select name=selected_cp_greeting><option></option>|;
1032 { $select_greeting .= qq|<option>$_</option>|; } @{ $form->{GREETINGS} });
1033 $select_greeting .= qq|</select>|;
1035 $select_company_greeting =
1036 qq| <select name=selected_company_greeting><option></option>|;
1038 { $select_company_greeting .= qq|<option>$_</option>|; } @{ $form->{COMPANY_GREETINGS} });
1039 $select_company_greeting .= qq|</select>|;
1041 $select_department =
1042 qq| <select name=selected_cp_abteilung><option></option>|;
1044 { $select_department .= qq|<option>$_</option>|; } @{ $form->{DEPARTMENT} });
1045 $select_department .= qq|</select>|;
1048 if ($form->{db} eq 'customer') {
1050 #get pricegroup and form it
1051 $form->get_pricegroup(\%myconfig, { all => 1 });
1053 $form->{pricegroup} = "$form->{klass}";
1054 $form->{pricegroup_id} = "$form->{klass}";
1056 if (@{ $form->{all_pricegroup} }) {
1058 $form->{selectpricegroup} = qq|<option>\n|;
1060 $form->{selectpricegroup} .=
1061 qq|<option value="$_->{id}">$_->{pricegroup}\n|
1062 } @{ $form->{all_pricegroup} };
1065 if ($form->{selectpricegroup}) {
1066 $form->{selectpricegroup} = $form->unescape($form->{selectpricegroup});
1069 qq|<input type=hidden name=selectpricegroup value="|
1070 . $form->escape($form->{selectpricegroup}, 1) . qq|">|;
1072 $form->{selectpricegroup} =~
1073 s/(<option value="\Q$form->{klass}\E")/$1 selected/;
1076 qq|<select name=klass tabindex=24>$form->{selectpricegroup}</select>|;
1081 # $locale->text('Customer Number')
1082 # $locale->text('Vendor Number')
1083 $form->{fokus} = "ct.greeting";
1087 <body onLoad="fokus()">
1090 <th class=listtop>$form->{title}</th>
1095 <form method=post name="ct" action=$form->{script} onKeyUp="highlight(event)" onClick="highlight(event)">
1099 <ul id="maintab" class="shadetabs">
1100 <li class="selected"><a href="#" rel="billing">|
1101 . $locale->text('Billing Address') . qq|</a></li>
1102 <li><a href="#" rel="shipto">|
1103 . $locale->text('Shipping Address') . qq|</a></li>
1104 <li><a href="#" rel="contacts">Ansprechpartner</a></li>
1105 <li><a href="#" rel="deliveries">|
1106 . $locale->text('Lieferungen') . qq|</a></li>
1110 <div class="tabcontentstyle">
1112 <div id="billing" class="tabcontent">
1115 <tr height="5"></tr>
1118 <th align=right nowrap>| . $locale->text($label . ' Number') . qq|</th>
1119 <td><input name="$form->{db}number" size=35 maxlength=35 value="$form->{"$form->{db}number"}"></td>
1122 <th align=right nowrap>| . $locale->text('Greeting') . qq|</th>
1123 <td><input id=greeting name=greeting size=30 maxlength=30 value="$form->{greeting}">
1124 $select_company_greeting</td>
1127 <th align=right nowrap>| . $locale->text('Company Name') . qq|</th>
1128 <td><input name=name size=35 maxlength=75 value="$form->{name}"></td>
1131 <th align=right nowrap>| . $locale->text('Abteilung') . qq|</th>
1132 <td><input name=department_1 size=16 maxlength=75 value="$form->{department_1}">
1133 <input name=department_2 size=16 maxlength=75 value="$form->{department_2}"></td>
1136 <th align=right nowrap>| . $locale->text('Street') . qq|</th>
1137 <td><input name=street size=35 maxlength=75 value="$form->{street}"></td>
1140 <th align=right nowrap>|
1141 . $locale->text('Zipcode') . "/" . $locale->text('City') . qq|</th>
1142 <td><input name=zipcode size=5 maxlength=10 value="$form->{zipcode}">
1143 <input name=city size=30 maxlength=75 value="$form->{city}"></td>
1146 <th align=right nowrap>| . $locale->text('Country') . qq|</th>
1147 <td><input name=country size=35 maxlength=75 value="$form->{country}"></td>
1150 <th align=right nowrap>| . $locale->text('Contact') . qq|</th>
1151 <td><input name=contact size=28 maxlength=75 value="$form->{contact}"></td>
1154 <th align=right nowrap>| . $locale->text('Phone') . qq|</th>
1155 <td><input name=phone size=30 maxlength=30 value="$form->{phone}"></td>
1158 <th align=right nowrap>| . $locale->text('Fax') . qq|</th>
1159 <td><input name=fax size=30 maxlength=30 value="$form->{fax}"></td>
1162 <th align=right nowrap>| . $locale->text('E-mail') . qq|</th>
1163 <td><input name=email size=45 value="$form->{email}"></td>
1166 <th align=right nowrap>| . $locale->text('Homepage') . qq|</th>
1167 <td><input name=homepage size=45 value="$form->{homepage}"></td>
1172 <th align=right>| . $locale->text('Credit Limit') . qq|</th>
1173 <td><input name=creditlimit size=9 value="$form->{creditlimit}"></td>
1174 <th align=right>| . $locale->text('Terms: Net') . qq|</th>
1175 <td><input name=terms size=2 value="$form->{terms}">|
1176 . $locale->text('days') . qq|</td>
1177 <th align=right>| . $locale->text('Discount') . qq|</th>
1178 <td><input name=discount size=4 value="$form->{discount}">
1182 <th align=right>| . $locale->text('Tax Number / SSN') . qq|</th>
1183 <td><input name=taxnumber size=20 value="$form->{taxnumber}"></td>
1184 <th align=right>| . $locale->text('USt-IdNr.') . qq|</th>
1185 <td><input name=ustid size=20 value="$form->{ustid}"></td>
1189 <th align=right>| . $locale->text('Account Number') . qq|</th>
1190 <td><input name=account_number size=10 value="$form->{account_number}"></td>
1191 <th align=right>| . $locale->text('Bank Code Number') . qq|</th>
1192 <td><input name=bank_code size=10 value="$form->{bank_code}"></td>
1193 <th align=right>| . $locale->text('Bank') . qq|</th>
1194 <td><input name=bank size=30 value="$form->{bank}"></td>
1198 <th align=right>| . $locale->text('Language') . qq|</th>
1199 <td><select name=language_id tabindex=23>$lang
1202 if ($form->{db} eq 'customer') {
1205 <th align=right>| . $locale->text('Preisklasse') . qq|</th>
1206 <td>$pricegroup</td>|;
1210 <td align=right>| . $locale->text('Obsolete') . qq|</td>
1211 <td><input name=obsolete class=checkbox type=checkbox value=1 $form->{obsolete}></td>
1212 <th align=right>| . $locale->text('Payment Terms') . qq|</th>
1213 <td><select name=payment_id>$payment
1220 <th align=left nowrap>| . $locale->text('Notes') . qq|</th>
1223 <td><textarea name=notes rows=3 cols=60 wrap=soft>$form->{notes}</textarea></td>
1230 <br style="clear: left" /></div>|;
1233 <div id="shipto" class="tabcontent">
1238 <th align=right nowrap>| . $locale->text('Company Name') . qq|</th>
1239 <td><input id=shiptoname name=shiptoname size=35 maxlength=75 value="$form->{shiptoname}"></td>
1242 <th align=right nowrap>| . $locale->text('Abteilung') . qq|</th>
1243 <td><input id=shiptodepartment_1 name=shiptodepartment_1 size=16 maxlength=75 value="$form->{shiptodepartment_1}">
1244 <input id=shiptodepartment_2 name=shiptodepartment_2 size=16 maxlength=75 value="$form->{shiptodepartment_2}"></td>
1247 <th align=right nowrap>| . $locale->text('Street') . qq|</th>
1248 <td><input id=shiptostreet name=shiptostreet size=35 maxlength=75 value="$form->{shiptostreet}"></td>
1251 <th align=right nowrap>|
1252 . $locale->text('Zipcode') . "/" . $locale->text('City') . qq|</th>
1253 <td><input id=shiptozipcode name=shiptozipcode size=5 maxlength=10 value="$form->{shiptozipcode}">
1254 <input id=shiptocity name=shiptocity size=30 maxlength=75 value="$form->{shiptocity}"></td>
1257 <th align=right nowrap>| . $locale->text('Country') . qq|</th>
1258 <td><input id=shiptocountry name=shiptocountry size=35 maxlength=35 value="$form->{shiptocountry}"></td>
1261 <th align=right nowrap>| . $locale->text('Contact') . qq|</th>
1262 <td><input id=shiptocontact name=shiptocontact size=30 maxlength=75 value="$form->{shiptocontact}"></td>
1265 <th align=right nowrap>| . $locale->text('Phone') . qq|</th>
1266 <td><input id=shiptophone name=shiptophone size=30 maxlength=30 value="$form->{shiptophone}"></td>
1269 <th align=right nowrap>| . $locale->text('Fax') . qq|</th>
1270 <td><input id=shiptofax name=shiptofax size=30 maxlength=30 value="$form->{shiptofax}"></td>
1273 <th align=right nowrap>| . $locale->text('E-mail') . qq|</th>
1274 <td><input id=shiptoemail name=shiptoemail size=45 value="$form->{shiptoemail}"></td>
1284 <br style="clear: left" /></div>|;
1287 ##LINET - added fields for contact person
1289 <div id="contacts" class="tabcontent">
1293 <input type=hidden name=cp_id value=$form->{cp_id}>
1297 <th align=left nowrap>| . $locale->text('Greeting') . qq|</th>
1298 <td><input id=cp_greeting name=cp_greeting size=30 maxlength=30 value="$form->{cp_greeting}">
1299 $select_greeting</td>
1302 <th align=left nowrap>| . $locale->text('Title') . qq|</th>
1303 <td><input id=cp_title name=cp_title size=30 maxlength=30 value="$form->{cp_title}">
1307 <th align=left nowrap>| . $locale->text('Department') . qq|</th>
1308 <td><input id=cp_abteilung name=cp_abteilung size=30 maxlength=40 value="$form->{cp_abteilung}">
1309 $select_department</td>
1312 <th align=left nowrap>|
1313 . $locale->text('Given Name') . qq|</th>
1314 <td><input id=cp_givenname name=cp_givenname size=30 maxlength=40 value="$form->{cp_givenname}"></td>
1317 <th align=left nowrap>| . $locale->text('Name') . qq|</th>
1318 <td><input id=cp_name name=cp_name size=30 maxlength=40 value="$form->{cp_name}"></td>
1321 <th align=left nowrap>| . $locale->text('Phone1') . qq|</th>
1322 <td><input id=cp_phone1 name=cp_phone1 size=30 maxlength=30 value="$form->{cp_phone1}"></td>
1325 <th align=left nowrap>| . $locale->text('Phone2') . qq|</th>
1326 <td><input id=cp_phone2 name=cp_phone2 size=30 maxlength=30 value="$form->{cp_phone2}"></td>
1329 <th align=left nowrap>| . $locale->text('Fax') . qq|</th>
1330 <td><input id=cp_fax name=cp_fax size=30 maxlength=30 value="$form->{cp_fax}"></td>
1333 <th align=left nowrap>| . $locale->text('Mobile1') . qq|</th>
1334 <td><input id=cp_mobile1 name=cp_mobile1 size=30 maxlength=30 value="$form->{cp_mobile1}"></td>
1337 <th align=left nowrap>| . $locale->text('Mobile2') . qq|</th>
1338 <td><input id=cp_mobile2 name=cp_mobile2 size=30 maxlength=30 value="$form->{cp_mobile2}"></td>
1341 <th align=left nowrap>| . $locale->text('Sat. Phone') . qq|</th>
1342 <td><input id=cp_satphone name=cp_satphone size=30 maxlength=30 value="$form->{cp_satphone}"></td>
1345 <th align=left nowrap>| . $locale->text('Sat. Fax') . qq|</th>
1346 <td><input id=cp_satfax name=cp_satfax size=30 maxlength=30 value="$form->{cp_satfax}"></td>
1349 <th align=left nowrap>| . $locale->text('Project') . qq|</th>
1350 <td><input id=cp_project name=cp_project size=30 maxlength=40 value="$form->{cp_project}"></td>
1353 <th align=left nowrap>| . $locale->text('E-mail') . qq|</th>
1354 <td><input id=cp_email name=cp_email size=30 maxlength=40 value="$form->{cp_email}"></td>
1357 <th align=left nowrap>| . $locale->text('Private Phone') . qq|</th>
1358 <td><input id=cp_privatphone name=cp_privatphone size=30 maxlength=40 value="$form->{cp_privatphone}"></td>
1361 <th align=left nowrap>| . $locale->text('Private E-mail') . qq|</th>
1362 <td><input id=cp_privatemail name=cp_privatemail size=30 maxlength=40 value="$form->{cp_privatemail}"></td>
1365 <th align=left nowrap>| . $locale->text('Birthday') . qq|</th>
1366 <td><input id=cp_birthday name=cp_birthday size=30 maxlength=40 value="$form->{cp_birthday}"></td>
1372 <tr height="5"></tr>|;
1382 <br style="clear: left" /></div>
1383 <div id="deliveries" class="tabcontent">
1387 <th align=left nowrap>| . $locale->text('From') . qq|</th>
1388 <td><input id=from name=from size=10 maxlength=10 value="$form->{from}"></td>
1389 <th align=left nowrap>| . $locale->text('Bis') . qq|</th>
1390 <td><input id=to name=to size=10 maxlength=10 value="$form->{to}"></td>
1399 <br style="clear: left" /></div>
1405 $lxdebug->leave_sub();
1409 $lxdebug->enter_sub();
1411 $label = ucfirst $form->{db};
1413 ($form->{db} eq 'customer')
1414 ? $locale->text('Save and Quotation')
1415 : $locale->text('Save and RFQ');
1417 ($form->{db} eq 'customer')
1418 ? $locale->text('Save and AR Transaction')
1419 : $locale->text('Save and AP Transaction');
1422 qq|<input class=submit type=submit name=action accesskey="u" value="|
1423 . $locale->text("Update") . qq|">|;
1425 $update_button = "";
1428 ##<input class=submit type=submit name=action value="|.$locale->text("Save and Quotation").qq|">
1429 ##<input class=submit type=submit name=action value="|.$locale->text("Save and RFQ").qq|">
1430 ##<input class=submit type=submit name=action value="|.$locale->text("Save and AR Transaction").qq|">
1431 ##<input class=submit type=submit name=action value="|.$locale->text("Save and AP Transaction").qq|">
1434 <input name=id type=hidden value=$form->{id}>
1435 <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
1436 <input name=business_save type=hidden value="$form->{selectbusiness}">
1437 <input name=title_save type=hidden value="$form->{title}">
1439 <input type=hidden name=path value=$form->{path}>
1440 <input type=hidden name=login value=$form->{login}>
1441 <input type=hidden name=password value=$form->{password}>
1443 <input type=hidden name=callback value="$form->{callback}">
1444 <input type=hidden name=db value=$form->{db}>
1450 <input class=submit type=submit name=action accesskey="s" value="|
1451 . $locale->text("Save") . qq|">
1452 <input class=submit type=submit name=action accesskey="s" value="|
1453 . $locale->text("Save and Close") . qq|">
1454 <input class=submit type=submit name=action value="$arap">
1455 <input class=submit type=submit name=action value="|
1456 . $locale->text("Save and Invoice") . qq|">
1457 <input class=submit type=submit name=action value="|
1458 . $locale->text("Save and Order") . qq|">
1459 <input class=submit type=submit name=action value="$quotation">
1462 if ($form->{id} && $form->{status} eq 'orphaned') {
1463 print qq|<input class=submit type=submit name=action value="|
1464 . $locale->text('Delete')
1468 if ($form->{menubar}) {
1469 require "$form->{path}/menu.pl";
1476 <script type="text/javascript">
1477 //Start Tab Content script for UL with id="maintab" Separate multiple ids each with a comma.
1478 initializetabcontent("maintab")
1484 $lxdebug->leave_sub();
1487 sub add_transaction {
1488 $lxdebug->enter_sub();
1490 $form->isblank("name", $locale->text("Name missing!"));
1491 if ($vertreter && $form->{db} eq "customer") {
1492 $form->isblank("salesman_id", $locale->text("Salesman missing!"));
1494 &{"CT::save_$form->{db}"}("", \%myconfig, \%$form);
1496 $form->{callback} = $form->escape($form->{callback}, 1);
1497 $name = $form->escape("$form->{name}", 1);
1500 "$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}";
1504 $lxdebug->leave_sub();
1507 sub save_and_ap_transaction {
1508 $lxdebug->enter_sub();
1510 $form->{script} = "ap.pl";
1513 $lxdebug->leave_sub();
1516 sub save_and_ar_transaction {
1517 $lxdebug->enter_sub();
1519 $form->{script} = "ar.pl";
1522 $lxdebug->leave_sub();
1525 sub save_and_invoice {
1526 $lxdebug->enter_sub();
1528 $form->{script} = ($form->{db} eq 'customer') ? "is.pl" : "ir.pl";
1529 $form->{type} = "invoice";
1532 $lxdebug->leave_sub();
1536 $lxdebug->enter_sub();
1538 $form->{script} = "oe.pl";
1539 $form->{type} = "request_quotation";
1542 $lxdebug->leave_sub();
1545 sub save_and_quotation {
1546 $lxdebug->enter_sub();
1548 $form->{script} = "oe.pl";
1549 $form->{type} = "sales_quotation";
1552 $lxdebug->leave_sub();
1555 sub save_and_order {
1556 $lxdebug->enter_sub();
1558 $form->{script} = "oe.pl";
1560 ($form->{db} eq 'customer') ? "sales_order" : "purchase_order";
1563 $lxdebug->leave_sub();
1566 sub save_and_close {
1567 $lxdebug->enter_sub();
1569 # $locale->text('Customer saved!')
1570 # $locale->text('Vendor saved!')
1572 $msg = ucfirst $form->{db};
1575 $form->isblank("name", $locale->text("Name missing!"));
1576 if ($vertreter && $form->{db} eq "customer") {
1577 $form->isblank("salesman_id", $locale->text("Salesman missing!"));
1579 $rc = &{"CT::save_$form->{db}"}("", \%myconfig, \%$form);
1581 $form->error($locale->text('customernumber not unique!'));
1583 $form->redirect($locale->text($msg));
1585 $lxdebug->leave_sub();
1589 $lxdebug->enter_sub();
1591 # $locale->text('Customer saved!')
1592 # $locale->text('Vendor saved!')
1594 $msg = ucfirst $form->{db};
1597 $form->isblank("name", $locale->text("Name missing!"));
1598 if ($vertreter && $form->{db} eq "customer") {
1599 $form->isblank("salesman_id", $locale->text("Salesman missing!"));
1601 print(STDERR "SHIPTO in sub save $form->{shipto_id}\n");
1602 &{"CT::save_$form->{db}"}("", \%myconfig, \%$form);
1606 $lxdebug->leave_sub();
1610 $lxdebug->enter_sub();
1612 # $locale->text('Customer deleted!')
1613 # $locale->text('Cannot delete customer!')
1614 # $locale->text('Vendor deleted!')
1615 # $locale->text('Cannot delete vendor!')
1617 CT->delete(\%myconfig, \%$form);
1619 $msg = ucfirst $form->{db};
1620 $msg .= " deleted!";
1621 $form->redirect($locale->text($msg));
1623 $msg = "Cannot delete $form->{db}";
1624 $form->error($locale->text($msg));
1626 $lxdebug->leave_sub();
1630 $lxdebug->enter_sub();
1635 $lxdebug->leave_sub();
1639 $lxdebug->enter_sub();
1641 &check_salesman($form->{salesman});
1643 # $form->get_salesman(\%myconfig, $form->{salesman});
1645 $lxdebug->leave_sub();
1648 sub check_salesman {
1649 $lxdebug->enter_sub();
1653 my ($new_name, $new_id) = split /--/, $form->{$name};
1656 # check name, combine name and id
1657 if ($form->{"oldsalesman"} ne $form->{"salesman"}) {
1659 # return one name or a list of names in $form->{name_list}
1660 if (($i = $form->get_salesman(\%myconfig, $name)) > 1) {
1661 &select_salesman($name);
1668 $form->{"salesman_id"} = $form->{salesman_list}[0]->{id};
1669 $form->{salesman} = $form->{salesman_list}[0]->{name};
1670 $form->{"oldsalesman"} = $form->{salesman};
1674 # name is not on file
1675 # $locale->text('Customer not on file!')
1676 # $locale->text('Vendor not on file!')
1677 $msg = ucfirst $name . " not on file or locked!";
1678 $form->error($locale->text($msg));
1682 $lxdebug->leave_sub();
1687 sub select_salesman {
1688 $lxdebug->enter_sub();
1692 @column_index = qw(ndx name);
1694 $label = ucfirst $table;
1695 $column_data{ndx} = qq|<th> </th>|;
1696 $column_data{name} =
1697 qq|<th class=listheading>| . $locale->text($label) . qq|</th>|;
1699 # list items with radio button on a form
1702 $title = $locale->text('Select from one of the names below');
1707 <form method=post action=$form->{script}>
1711 <th class=listtop>$title</th>
1717 <tr class=listheading>|;
1719 map { print "\n$column_data{$_}" } @column_index;
1726 foreach $ref (@{ $form->{salesman_list} }) {
1727 $checked = ($i++) ? "" : "checked";
1729 $ref->{name} =~ s/\"/"/g;
1732 qq|<td><input name=ndx class=radio type=radio value=$i $checked></td>|;
1733 $column_data{name} =
1734 qq|<td><input name="new_name_$i" type=hidden value="$ref->{name}">$ref->{name}</td>|;
1739 <tr class=listrow$j>|;
1741 map { print "\n$column_data{$_}" } @column_index;
1746 <input name="new_id_$i" type=hidden value=$ref->{id}>
1757 <td><hr size=3 noshade></td>
1761 <input name=lastndx type=hidden value=$i>
1766 map { delete $form->{$_} } qw(action name_list header);
1768 # save all other form variables
1769 foreach $key (keys %${form}) {
1770 $form->{$key} =~ s/\"/"/g;
1771 print qq|<input name=$key type=hidden value="$form->{$key}">\n|;
1775 <input type=hidden name=nextsub value=salesman_selected>
1777 <input type=hidden name=vc value=$table>
1779 <input class=submit type=submit name=action value="|
1780 . $locale->text('Continue') . qq|">
1787 $lxdebug->leave_sub();
1790 sub salesman_selected {
1791 $lxdebug->enter_sub();
1793 # replace the variable with the one checked
1795 # index for new item
1798 $form->{salesman} = $form->{"new_name_$i"};
1799 $form->{"salesman_id"} = $form->{"new_id_$i"};
1800 $form->{"oldsalesman"} = $form->{salesman};
1802 # delete all the new_ variables
1803 for $i (1 .. $form->{lastndx}) {
1804 map { delete $form->{"new_${_}_$i"} } (id, name);
1807 map { delete $form->{$_} } qw(ndx lastndx nextsub);
1811 $lxdebug->leave_sub();
1815 $lxdebug->enter_sub();
1817 CT->get_contact(\%myconfig, \%$form);
1820 $result = "$form->{cp_name}";
1821 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);
1824 $lxdebug->leave_sub();
1830 $lxdebug->enter_sub();
1832 CT->get_shipto(\%myconfig, \%$form);
1835 $result = "$form->{shiptoname}";
1836 map { $result .= "__pjx__" . $form->{$_} } qw(shiptodepartment_1 shiptodepartment_2 shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact shiptophone shiptofax shiptoemail);
1839 $lxdebug->leave_sub();
1844 $lxdebug->enter_sub();
1846 CT->get_delivery(\%myconfig, \%$form);
1849 $form->sort_columns(shiptoname,
1860 $column_header{shiptoname} =
1861 qq|<th class=listheading>| . $locale->text('Shipping Address') . qq|</th>|;
1862 $column_header{invnumber} =
1863 qq|<th class=listheading>|. $locale->text('Invoice'). qq|</th>|;
1864 $column_header{ordnumber} =
1865 qq|<th class=listheading>|. $locale->text('Order'). qq|</th>|;
1866 $column_header{transdate} =
1867 qq|<th class=listheading>| . $locale->text('Invdate') . qq|</th>|;
1868 $column_header{description} =
1869 qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|;
1870 $column_header{adr_code} =
1871 qq|<th class=listheading>| . $locale->text('ADR') . qq|</th>|;
1872 $column_header{qty} =
1873 qq|<th class=listheading>| . $locale->text('Qty') . qq|</th>|;
1874 $column_header{unit} =
1875 qq|<th class=listheading>| . $locale->text('Unit') . qq|</th>|;
1882 <tr class=listheading>
1885 map { $result .= "$column_header{$_}\n" } @column_index;
1892 foreach $ref (@{ $form->{DELIVERY} }) {
1894 if ($ref->{shiptoname} eq $sameshiptoname) {
1895 map { $column_data{$_} = "<td>$ref->{$_} </td>" } @column_index;
1896 $column_data{shiptoname} = "<td> </td>";
1898 map { $column_data{$_} = "<td>$ref->{$_} </td>" } @column_index;
1904 <tr class=listrow$i>
1907 map { $result .= "$column_data{$_}\n" } @column_index;
1913 $sameshiptoname = $ref->{shiptoname};
1925 $lxdebug->leave_sub();
1929 sub continue { &{ $form->{nextsub} } }