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);
810 if ($myconfig{role} eq 'admin') {
813 <th align=right nowrap>| . $locale->text('Bcc') . qq|</th>
814 <td><input name=bcc size=35 value="$form->{bcc}"></td>
818 $form->{obsolete} = "checked" if $form->{obsolete};
820 $lang = qq|<option value=""></option>|;
821 foreach $item (@{ $form->{languages} }) {
822 if ($form->{language_id} eq $item->{id}) {
823 $lang .= qq|<option value="$item->{id}" selected>$item->{description}</option>|;
825 $lang .= qq|<option value="$item->{id}">$item->{description}</option>|;
829 $payment = qq|<option value=""></option>|;
830 foreach $item (@{ $form->{payment_terms} }) {
831 if ($form->{payment_id} eq $item->{id}) {
832 $payment .= qq|<option value="$item->{id}" selected>$item->{description}</option>|;
834 $payment .= qq|<option value="$item->{id}">$item->{description}</option>|;
839 if ($form->{db} eq "customer") {
840 $form->{taxzone_id} = 0;
842 $form->{taxzone_id} = 0;
846 if (@{ $form->{TAXZONE} }) {
847 foreach $item (@{ $form->{TAXZONE} }) {
848 if ($item->{id} == $form->{taxzone_id}) {
849 $form->{selecttaxzone} .=
850 "<option value=$item->{id} selected>$item->{description}\n";
852 $form->{selecttaxzone} .=
853 "<option value=$item->{id}>$item->{description}\n";
861 <th align=right>| . $locale->text('Steuersatz') . qq|</th>
862 <td><select name=taxzone_id>$form->{selecttaxzone}</select></td>
863 <input type=hidden name=selecttaxzone value="$form->{selecttaxzone}">
867 "$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=get_contact";
869 my $pjx = new CGI::Ajax( 'get_contact' => $get_contact_url );
870 $form->{selectcontact} = "<option value=0></option>";
871 if (@{ $form->{CONTACTS} }) {
872 foreach $item (@{ $form->{CONTACTS} }) {
873 if ($item->{cp_id} == $form->{cp_id}) {
874 $form->{selectcontact} .=
875 qq|<option value=$item->{cp_id} selected>$item->{cp_name}</option>\n|;
877 $form->{selectcontact} .=
878 qq|<option value=$item->{cp_id}>$item->{cp_name}</option>\n|;
883 push(@ { $form->{AJAX} }, $pjx);
884 $ansprechpartner = qq|
886 <th align=right>| . $locale->text('Ansprechpartner') . qq|</th>
887 <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>
888 <input type=hidden name=selectcontact value="$form->{selectcontact}">
891 "$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=get_shipto";
893 my $pjy = new CGI::Ajax( 'get_shipto' => $get_shipto_url );
894 $form->{selectshipto} = "<option value=0></option>";
895 if (@{ $form->{SHIPTO} }) {
896 foreach $item (@{ $form->{SHIPTO} }) {
897 if ($item->{id} == $form->{shipto_id}) {
898 $form->{selectshipto} .=
899 "<option value=$item->{id} selected>$item->{shiptoname}\n";
901 $form->{selectshipto} .=
902 "<option value=$item->{id}>$item->{shiptoname}\n";
907 push(@ { $form->{AJAX} }, $pjy);
911 <th align=right>| . $locale->text('Shipping Address') . qq|</th>
912 <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>
913 <input type=hidden name=selectshipto value="$form->{selectshipto}">
918 "$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=get_delivery";
920 my $pjz = new CGI::Ajax( 'get_delivery' => $get_delivery_url );
922 push(@ { $form->{AJAX} }, $pjz);
926 <th align=right>| . $locale->text('Shipping Address') . qq|</th>
927 <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>
930 foreach $item (split / /, $form->{taxaccounts}) {
931 if (($form->{tax}{$item}{taxable}) || !($form->{id})) {
933 qq| <input name="tax_$item" value=1 class=checkbox type=checkbox checked> <b>$form->{tax}{$item}{description}</b>|;
936 qq| <input name="tax_$item" value=1 class=checkbox type=checkbox> <b>$form->{tax}{$item}{description}</b>|;
946 <th align=right>| . $locale->text('Taxable') . qq|</th>
951 <td><input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}></td>
952 <th align=left>| . $locale->text('Tax Included') . qq|</th>
959 $form->{selectbusiness} = qq|<option>\n|;
961 $form->{selectbusiness} .=
962 qq|<option value=$_->{id}>$_->{description}\n|
963 } @{ $form->{all_business} };
964 if ($form->{business_save}) {
965 $form->{selectbusiness} = $form->{business_save};
967 $form->{selectbusiness} =~
968 s/<option value=$form->{business}>/<option value=$form->{business} selected>/;
970 $label = ucfirst $form->{db};
971 if ($form->{title} eq "Edit") {
972 $form->{title} = $locale->text("$form->{title} $label") . " $form->{name}";
974 $form->{title} = $locale->text("$form->{title} $label");
976 if ($form->{title_save}) {
977 $form->{title} = $form->{title_save};
979 if ($form->{db} eq 'vendor') {
981 <th align=right>| . $locale->text('Kundennummer') . qq|</th>
982 <td><input name=v_customer_id size=10 tabindex=18 maxlength=35 value="$form->{v_customer_id}"></td>
986 if ($form->{db} eq 'customer') {
989 <th align=right>| . $locale->text('KNr. beim Kunden') . qq|</th>
990 <td><input name=c_vendor_id size=10 tabindex=18 maxlength=35 value="$form->{c_vendor_id}"></td>
993 $business_salesman = "";
994 $business = "<th></th><td></td>";
996 $business_salesman = qq|
1000 <th align=right>| . $locale->text('Type of Business') . qq|</th>
1001 <td><select name=business tabindex=1>$form->{selectbusiness}</select></td>
1002 <th align=right>| . $locale->text('Salesman') . qq|</th>
1003 <td><input name=salesman tabindex=2 value="$form->{salesman}"></td>
1004 <input type=hidden name=salesman_id value="$form->{salesman_id}">
1005 <input type=hidden name=oldsalesman value="$form->{oldsalesman}">
1010 <th align=right>| . $locale->text('Username') . qq|</th>
1011 <td><input name=username maxlength=50 tabindex=22 value="$form->{username}"></td>
1012 <th align=right>| . $locale->text('Password') . qq|</th>
1013 <td><input name=user_password maxlength=12 tabindex=23 value="$form->{user_password}"></td>|;
1016 <th align=right>| . $locale->text('Type of Business') . qq|</th>
1017 <td><select name=business tabindex=22>$form->{selectbusiness}</select></td>
1021 ## LINET: Create a drop-down box with all prior titles and greetings.
1022 CT->query_titles_and_greetings(\%myconfig, \%$form);
1024 $select_title = qq| <select name=selected_cp_title><option></option>|;
1025 map({ $select_title .= qq|<option>$_</option>|; } @{ $form->{TITLES} });
1026 $select_title .= qq|</select>|;
1029 qq| <select name=selected_cp_greeting><option></option>|;
1031 { $select_greeting .= qq|<option>$_</option>|; } @{ $form->{GREETINGS} });
1032 $select_greeting .= qq|</select>|;
1034 $select_company_greeting =
1035 qq| <select name=selected_company_greeting><option></option>|;
1037 { $select_company_greeting .= qq|<option>$_</option>|; } @{ $form->{COMPANY_GREETINGS} });
1038 $select_company_greeting .= qq|</select>|;
1040 $select_department =
1041 qq| <select name=selected_cp_abteilung><option></option>|;
1043 { $select_department .= qq|<option>$_</option>|; } @{ $form->{DEPARTMENT} });
1044 $select_department .= qq|</select>|;
1047 if ($form->{db} eq 'customer') {
1049 #get pricegroup and form it
1050 $form->get_pricegroup(\%myconfig, { all => 1 });
1052 $form->{pricegroup} = "$form->{klass}";
1053 $form->{pricegroup_id} = "$form->{klass}";
1055 if (@{ $form->{all_pricegroup} }) {
1057 $form->{selectpricegroup} = qq|<option>\n|;
1059 $form->{selectpricegroup} .=
1060 qq|<option value="$_->{id}">$_->{pricegroup}\n|
1061 } @{ $form->{all_pricegroup} };
1064 if ($form->{selectpricegroup}) {
1065 $form->{selectpricegroup} = $form->unescape($form->{selectpricegroup});
1068 qq|<input type=hidden name=selectpricegroup value="|
1069 . $form->escape($form->{selectpricegroup}, 1) . qq|">|;
1071 $form->{selectpricegroup} =~
1072 s/(<option value="\Q$form->{klass}\E")/$1 selected/;
1074 $pricegroup .= qq|<select name=klass>$form->{selectpricegroup}</select>|;
1079 # $locale->text('Customer Number')
1080 # $locale->text('Vendor Number')
1081 $form->{fokus} = "ct.greeting";
1085 <body onLoad="fokus()">
1088 <th class=listtop>$form->{title}</th>
1093 <form method=post name="ct" action=$form->{script} onKeyUp="highlight(event)" onClick="highlight(event)">
1097 <ul id="maintab" class="shadetabs">
1098 <li class="selected"><a href="#" rel="billing">|
1099 . $locale->text('Billing Address') . qq|</a></li>
1100 <li><a href="#" rel="shipto">|
1101 . $locale->text('Shipping Address') . qq|</a></li>
1102 <li><a href="#" rel="contacts">Ansprechpartner</a></li>
1103 <li><a href="#" rel="deliveries">|
1104 . $locale->text('Lieferungen') . qq|</a></li>
1108 <div class="tabcontentstyle">
1110 <div id="billing" class="tabcontent">
1113 <tr height="5"></tr>
1116 <th align=right nowrap>| . $locale->text($label . ' Number') . qq|</th>
1117 <td><input name="$form->{db}number" size=35 maxlength=35 value="$form->{"$form->{db}number"}"></td>
1120 <th align=right nowrap>| . $locale->text('Greeting') . qq|</th>
1121 <td><input id=greeting name=greeting size=30 maxlength=30 value="$form->{greeting}">
1122 $select_company_greeting</td>
1125 <th align=right nowrap>| . $locale->text('Company Name') . qq|</th>
1126 <td><input name=name size=35 maxlength=75 value="$form->{name}"></td>
1129 <th align=right nowrap>| . $locale->text('Abteilung') . qq|</th>
1130 <td><input name=department_1 size=16 maxlength=75 value="$form->{department_1}">
1131 <input name=department_2 size=16 maxlength=75 value="$form->{department_2}"></td>
1134 <th align=right nowrap>| . $locale->text('Street') . qq|</th>
1135 <td><input name=street size=35 maxlength=75 value="$form->{street}"></td>
1138 <th align=right nowrap>|
1139 . $locale->text('Zipcode') . "/" . $locale->text('City') . qq|</th>
1140 <td><input name=zipcode size=5 maxlength=10 value="$form->{zipcode}">
1141 <input name=city size=30 maxlength=75 value="$form->{city}"></td>
1144 <th align=right nowrap>| . $locale->text('Country') . qq|</th>
1145 <td><input name=country size=35 maxlength=75 value="$form->{country}"></td>
1148 <th align=right nowrap>| . $locale->text('Contact') . qq|</th>
1149 <td><input name=contact size=28 maxlength=75 value="$form->{contact}"></td>
1152 <th align=right nowrap>| . $locale->text('Phone') . qq|</th>
1153 <td><input name=phone size=30 maxlength=30 value="$form->{phone}"></td>
1156 <th align=right nowrap>| . $locale->text('Fax') . qq|</th>
1157 <td><input name=fax size=30 maxlength=30 value="$form->{fax}"></td>
1160 <th align=right nowrap>| . $locale->text('E-mail') . qq|</th>
1161 <td><input name=email size=45 value="$form->{email}"></td>
1164 <th align=right nowrap>| . $locale->text('Homepage') . qq|</th>
1165 <td><input name=homepage size=45 value="$form->{homepage}"></td>
1170 <th align=right>| . $locale->text('Credit Limit') . qq|</th>
1171 <td><input name=creditlimit size=9 value="$form->{creditlimit}"></td>
1172 <th align=right>| . $locale->text('Terms: Net') . qq|</th>
1173 <td><input name=terms size=2 value="$form->{terms}">|
1174 . $locale->text('days') . qq|</td>
1175 <th align=right>| . $locale->text('Discount') . qq|</th>
1176 <td><input name=discount size=4 value="$form->{discount}">
1180 <th align=right>| . $locale->text('Tax Number / SSN') . qq|</th>
1181 <td><input name=taxnumber size=20 value="$form->{taxnumber}"></td>
1182 <th align=right>| . $locale->text('USt-IdNr.') . qq|</th>
1183 <td><input name=ustid size=20 value="$form->{ustid}"></td>
1187 <th align=right>| . $locale->text('Account Number') . qq|</th>
1188 <td><input name=account_number size=10 value="$form->{account_number}"></td>
1189 <th align=right>| . $locale->text('Bank Code Number') . qq|</th>
1190 <td><input name=bank_code size=10 value="$form->{bank_code}"></td>
1191 <th align=right>| . $locale->text('Bank') . qq|</th>
1192 <td><input name=bank size=30 value="$form->{bank}"></td>
1196 <th align=right>| . $locale->text('Language') . qq|</th>
1197 <td><select name=language_id tabindex=23>$lang
1200 if ($form->{db} eq 'customer') {
1203 <th align=right>| . $locale->text('Preisklasse') . qq|</th>
1204 <td>$pricegroup</td>|;
1208 <td align=right>| . $locale->text('Obsolete') . qq|</td>
1209 <td><input name=obsolete class=checkbox type=checkbox value=1 $form->{obsolete}></td>
1210 <th align=right>| . $locale->text('Payment Terms') . qq|</th>
1211 <td><select name=payment_id>$payment
1218 <th align=left nowrap>| . $locale->text('Notes') . qq|</th>
1221 <td><textarea name=notes rows=3 cols=60 wrap=soft>$form->{notes}</textarea></td>
1228 <br style="clear: left" /></div>|;
1231 <div id="shipto" class="tabcontent">
1236 <th align=right nowrap>| . $locale->text('Company Name') . qq|</th>
1237 <td><input id=shiptoname name=shiptoname size=35 maxlength=75 value="$form->{shiptoname}"></td>
1240 <th align=right nowrap>| . $locale->text('Abteilung') . qq|</th>
1241 <td><input id=shiptodepartment_1 name=shiptodepartment_1 size=16 maxlength=75 value="$form->{shiptodepartment_1}">
1242 <input id=shiptodepartment_2 name=shiptodepartment_2 size=16 maxlength=75 value="$form->{shiptodepartment_2}"></td>
1245 <th align=right nowrap>| . $locale->text('Street') . qq|</th>
1246 <td><input id=shiptostreet name=shiptostreet size=35 maxlength=75 value="$form->{shiptostreet}"></td>
1249 <th align=right nowrap>|
1250 . $locale->text('Zipcode') . "/" . $locale->text('City') . qq|</th>
1251 <td><input id=shiptozipcode name=shiptozipcode size=5 maxlength=10 value="$form->{shiptozipcode}">
1252 <input id=shiptocity name=shiptocity size=30 maxlength=75 value="$form->{shiptocity}"></td>
1255 <th align=right nowrap>| . $locale->text('Country') . qq|</th>
1256 <td><input id=shiptocountry name=shiptocountry size=35 maxlength=35 value="$form->{shiptocountry}"></td>
1259 <th align=right nowrap>| . $locale->text('Contact') . qq|</th>
1260 <td><input id=shiptocontact name=shiptocontact size=30 maxlength=75 value="$form->{shiptocontact}"></td>
1263 <th align=right nowrap>| . $locale->text('Phone') . qq|</th>
1264 <td><input id=shiptophone name=shiptophone size=30 maxlength=30 value="$form->{shiptophone}"></td>
1267 <th align=right nowrap>| . $locale->text('Fax') . qq|</th>
1268 <td><input id=shiptofax name=shiptofax size=30 maxlength=30 value="$form->{shiptofax}"></td>
1271 <th align=right nowrap>| . $locale->text('E-mail') . qq|</th>
1272 <td><input id=shiptoemail name=shiptoemail size=45 value="$form->{shiptoemail}"></td>
1282 <br style="clear: left" /></div>|;
1285 ##LINET - added fields for contact person
1287 <div id="contacts" class="tabcontent">
1291 <input type=hidden name=cp_id value=$form->{cp_id}>
1295 <th align=left nowrap>| . $locale->text('Greeting') . qq|</th>
1296 <td><input id=cp_greeting name=cp_greeting size=30 maxlength=30 value="$form->{cp_greeting}">
1297 $select_greeting</td>
1300 <th align=left nowrap>| . $locale->text('Title') . qq|</th>
1301 <td><input id=cp_title name=cp_title size=30 maxlength=30 value="$form->{cp_title}">
1305 <th align=left nowrap>| . $locale->text('Department') . qq|</th>
1306 <td><input id=cp_abteilung name=cp_abteilung size=30 maxlength=40 value="$form->{cp_abteilung}">
1307 $select_department</td>
1310 <th align=left nowrap>|
1311 . $locale->text('Given Name') . qq|</th>
1312 <td><input id=cp_givenname name=cp_givenname size=30 maxlength=40 value="$form->{cp_givenname}"></td>
1315 <th align=left nowrap>| . $locale->text('Name') . qq|</th>
1316 <td><input id=cp_name name=cp_name size=30 maxlength=40 value="$form->{cp_name}"></td>
1319 <th align=left nowrap>| . $locale->text('Phone1') . qq|</th>
1320 <td><input id=cp_phone1 name=cp_phone1 size=30 maxlength=30 value="$form->{cp_phone1}"></td>
1323 <th align=left nowrap>| . $locale->text('Phone2') . qq|</th>
1324 <td><input id=cp_phone2 name=cp_phone2 size=30 maxlength=30 value="$form->{cp_phone2}"></td>
1327 <th align=left nowrap>| . $locale->text('Fax') . qq|</th>
1328 <td><input id=cp_fax name=cp_fax size=30 maxlength=30 value="$form->{cp_fax}"></td>
1331 <th align=left nowrap>| . $locale->text('Mobile1') . qq|</th>
1332 <td><input id=cp_mobile1 name=cp_mobile1 size=30 maxlength=30 value="$form->{cp_mobile1}"></td>
1335 <th align=left nowrap>| . $locale->text('Mobile2') . qq|</th>
1336 <td><input id=cp_mobile2 name=cp_mobile2 size=30 maxlength=30 value="$form->{cp_mobile2}"></td>
1339 <th align=left nowrap>| . $locale->text('Sat. Phone') . qq|</th>
1340 <td><input id=cp_satphone name=cp_satphone size=30 maxlength=30 value="$form->{cp_satphone}"></td>
1343 <th align=left nowrap>| . $locale->text('Sat. Fax') . qq|</th>
1344 <td><input id=cp_satfax name=cp_satfax size=30 maxlength=30 value="$form->{cp_satfax}"></td>
1347 <th align=left nowrap>| . $locale->text('Project') . qq|</th>
1348 <td><input id=cp_project name=cp_project size=30 maxlength=40 value="$form->{cp_project}"></td>
1351 <th align=left nowrap>| . $locale->text('E-mail') . qq|</th>
1352 <td><input id=cp_email name=cp_email size=30 maxlength=40 value="$form->{cp_email}"></td>
1355 <th align=left nowrap>| . $locale->text('Private Phone') . qq|</th>
1356 <td><input id=cp_privatphone name=cp_privatphone size=30 maxlength=40 value="$form->{cp_privatphone}"></td>
1359 <th align=left nowrap>| . $locale->text('Private E-mail') . qq|</th>
1360 <td><input id=cp_privatemail name=cp_privatemail size=30 maxlength=40 value="$form->{cp_privatemail}"></td>
1363 <th align=left nowrap>| . $locale->text('Birthday') . qq|</th>
1364 <td><input id=cp_birthday name=cp_birthday size=30 maxlength=40 value="$form->{cp_birthday}"></td>
1370 <tr height="5"></tr>|;
1380 <br style="clear: left" /></div>
1381 <div id="deliveries" class="tabcontent">
1385 <th align=left nowrap>| . $locale->text('From') . qq|</th>
1386 <td><input id=from name=from size=10 maxlength=10 value="$form->{from}"></td>
1387 <th align=left nowrap>| . $locale->text('Bis') . qq|</th>
1388 <td><input id=to name=to size=10 maxlength=10 value="$form->{to}"></td>
1397 <br style="clear: left" /></div>
1403 $lxdebug->leave_sub();
1407 $lxdebug->enter_sub();
1409 $label = ucfirst $form->{db};
1411 ($form->{db} eq 'customer')
1412 ? $locale->text('Save and Quotation')
1413 : $locale->text('Save and RFQ');
1415 ($form->{db} eq 'customer')
1416 ? $locale->text('Save and AR Transaction')
1417 : $locale->text('Save and AP Transaction');
1420 qq|<input class=submit type=submit name=action accesskey="u" value="|
1421 . $locale->text("Update") . qq|">|;
1423 $update_button = "";
1426 ##<input class=submit type=submit name=action value="|.$locale->text("Save and Quotation").qq|">
1427 ##<input class=submit type=submit name=action value="|.$locale->text("Save and RFQ").qq|">
1428 ##<input class=submit type=submit name=action value="|.$locale->text("Save and AR Transaction").qq|">
1429 ##<input class=submit type=submit name=action value="|.$locale->text("Save and AP Transaction").qq|">
1432 <input name=id type=hidden value=$form->{id}>
1433 <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
1434 <input name=business_save type=hidden value="$form->{selectbusiness}">
1435 <input name=title_save type=hidden value="$form->{title}">
1437 <input type=hidden name=path value=$form->{path}>
1438 <input type=hidden name=login value=$form->{login}>
1439 <input type=hidden name=password value=$form->{password}>
1441 <input type=hidden name=callback value="$form->{callback}">
1442 <input type=hidden name=db value=$form->{db}>
1448 <input class=submit type=submit name=action accesskey="s" value="|
1449 . $locale->text("Save") . qq|">
1450 <input class=submit type=submit name=action accesskey="s" value="|
1451 . $locale->text("Save and Close") . qq|">
1452 <input class=submit type=submit name=action value="$arap">
1453 <input class=submit type=submit name=action value="|
1454 . $locale->text("Save and Invoice") . qq|">
1455 <input class=submit type=submit name=action value="|
1456 . $locale->text("Save and Order") . qq|">
1457 <input class=submit type=submit name=action value="$quotation">
1460 if ($form->{id} && $form->{status} eq 'orphaned') {
1461 print qq|<input class=submit type=submit name=action value="|
1462 . $locale->text('Delete')
1466 if ($form->{menubar}) {
1467 require "$form->{path}/menu.pl";
1474 <script type="text/javascript">
1475 //Start Tab Content script for UL with id="maintab" Separate multiple ids each with a comma.
1476 initializetabcontent("maintab")
1482 $lxdebug->leave_sub();
1485 sub add_transaction {
1486 $lxdebug->enter_sub();
1488 $form->isblank("name", $locale->text("Name missing!"));
1489 &{"CT::save_$form->{db}"}("", \%myconfig, \%$form);
1491 $form->{callback} = $form->escape($form->{callback}, 1);
1492 $name = $form->escape("$form->{name}", 1);
1495 "$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}";
1499 $lxdebug->leave_sub();
1502 sub save_and_ap_transaction {
1503 $lxdebug->enter_sub();
1505 $form->{script} = "ap.pl";
1508 $lxdebug->leave_sub();
1511 sub save_and_ar_transaction {
1512 $lxdebug->enter_sub();
1514 $form->{script} = "ar.pl";
1517 $lxdebug->leave_sub();
1520 sub save_and_invoice {
1521 $lxdebug->enter_sub();
1523 $form->{script} = ($form->{db} eq 'customer') ? "is.pl" : "ir.pl";
1524 $form->{type} = "invoice";
1527 $lxdebug->leave_sub();
1531 $lxdebug->enter_sub();
1533 $form->{script} = "oe.pl";
1534 $form->{type} = "request_quotation";
1537 $lxdebug->leave_sub();
1540 sub save_and_quotation {
1541 $lxdebug->enter_sub();
1543 $form->{script} = "oe.pl";
1544 $form->{type} = "sales_quotation";
1547 $lxdebug->leave_sub();
1550 sub save_and_order {
1551 $lxdebug->enter_sub();
1553 $form->{script} = "oe.pl";
1555 ($form->{db} eq 'customer') ? "sales_order" : "purchase_order";
1558 $lxdebug->leave_sub();
1561 sub save_and_close {
1562 $lxdebug->enter_sub();
1564 # $locale->text('Customer saved!')
1565 # $locale->text('Vendor saved!')
1567 $msg = ucfirst $form->{db};
1570 $form->isblank("name", $locale->text("Name missing!"));
1571 if ($vertreter && $form->{db} eq "customer") {
1572 $form->isblank("salesman_id", $locale->text("Salesman missing!"));
1574 &{"CT::save_$form->{db}"}("", \%myconfig, \%$form);
1576 $form->redirect($locale->text($msg));
1578 $lxdebug->leave_sub();
1582 $lxdebug->enter_sub();
1584 # $locale->text('Customer saved!')
1585 # $locale->text('Vendor saved!')
1587 $msg = ucfirst $form->{db};
1590 $form->isblank("name", $locale->text("Name missing!"));
1591 if ($vertreter && $form->{db} eq "customer") {
1592 $form->isblank("salesman_id", $locale->text("Salesman missing!"));
1594 print(STDERR "SHIPTO in sub save $form->{shipto_id}\n");
1595 &{"CT::save_$form->{db}"}("", \%myconfig, \%$form);
1599 $lxdebug->leave_sub();
1603 $lxdebug->enter_sub();
1605 # $locale->text('Customer deleted!')
1606 # $locale->text('Cannot delete customer!')
1607 # $locale->text('Vendor deleted!')
1608 # $locale->text('Cannot delete vendor!')
1610 CT->delete(\%myconfig, \%$form);
1612 $msg = ucfirst $form->{db};
1613 $msg .= " deleted!";
1614 $form->redirect($locale->text($msg));
1616 $msg = "Cannot delete $form->{db}";
1617 $form->error($locale->text($msg));
1619 $lxdebug->leave_sub();
1623 $lxdebug->enter_sub();
1628 $lxdebug->leave_sub();
1632 $lxdebug->enter_sub();
1634 &check_salesman($form->{salesman});
1636 # $form->get_salesman(\%myconfig, $form->{salesman});
1638 $lxdebug->leave_sub();
1641 sub check_salesman {
1642 $lxdebug->enter_sub();
1646 my ($new_name, $new_id) = split /--/, $form->{$name};
1649 # check name, combine name and id
1650 if ($form->{"oldsalesman"} ne $form->{"salesman"}) {
1652 # return one name or a list of names in $form->{name_list}
1653 if (($i = $form->get_salesman(\%myconfig, $name)) > 1) {
1654 &select_salesman($name);
1661 $form->{"salesman_id"} = $form->{salesman_list}[0]->{id};
1662 $form->{salesman} = $form->{salesman_list}[0]->{name};
1663 $form->{"oldsalesman"} = $form->{salesman};
1667 # name is not on file
1668 # $locale->text('Customer not on file!')
1669 # $locale->text('Vendor not on file!')
1670 $msg = ucfirst $name . " not on file or locked!";
1671 $form->error($locale->text($msg));
1675 $lxdebug->leave_sub();
1680 sub select_salesman {
1681 $lxdebug->enter_sub();
1685 @column_index = qw(ndx name);
1687 $label = ucfirst $table;
1688 $column_data{ndx} = qq|<th> </th>|;
1689 $column_data{name} =
1690 qq|<th class=listheading>| . $locale->text($label) . qq|</th>|;
1692 # list items with radio button on a form
1695 $title = $locale->text('Select from one of the names below');
1700 <form method=post action=$form->{script}>
1704 <th class=listtop>$title</th>
1710 <tr class=listheading>|;
1712 map { print "\n$column_data{$_}" } @column_index;
1719 foreach $ref (@{ $form->{salesman_list} }) {
1720 $checked = ($i++) ? "" : "checked";
1722 $ref->{name} =~ s/\"/"/g;
1725 qq|<td><input name=ndx class=radio type=radio value=$i $checked></td>|;
1726 $column_data{name} =
1727 qq|<td><input name="new_name_$i" type=hidden value="$ref->{name}">$ref->{name}</td>|;
1732 <tr class=listrow$j>|;
1734 map { print "\n$column_data{$_}" } @column_index;
1739 <input name="new_id_$i" type=hidden value=$ref->{id}>
1750 <td><hr size=3 noshade></td>
1754 <input name=lastndx type=hidden value=$i>
1759 map { delete $form->{$_} } qw(action name_list header);
1761 # save all other form variables
1762 foreach $key (keys %${form}) {
1763 $form->{$key} =~ s/\"/"/g;
1764 print qq|<input name=$key type=hidden value="$form->{$key}">\n|;
1768 <input type=hidden name=nextsub value=salesman_selected>
1770 <input type=hidden name=vc value=$table>
1772 <input class=submit type=submit name=action value="|
1773 . $locale->text('Continue') . qq|">
1780 $lxdebug->leave_sub();
1783 sub salesman_selected {
1784 $lxdebug->enter_sub();
1786 # replace the variable with the one checked
1788 # index for new item
1791 $form->{salesman} = $form->{"new_name_$i"};
1792 $form->{"salesman_id"} = $form->{"new_id_$i"};
1793 $form->{"oldsalesman"} = $form->{salesman};
1795 # delete all the new_ variables
1796 for $i (1 .. $form->{lastndx}) {
1797 map { delete $form->{"new_${_}_$i"} } (id, name);
1800 map { delete $form->{$_} } qw(ndx lastndx nextsub);
1804 $lxdebug->leave_sub();
1808 $lxdebug->enter_sub();
1810 CT->get_contact(\%myconfig, \%$form);
1813 $result = "$form->{cp_name}";
1814 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);
1817 $lxdebug->leave_sub();
1823 $lxdebug->enter_sub();
1825 CT->get_shipto(\%myconfig, \%$form);
1828 $result = "$form->{shiptoname}";
1829 map { $result .= "__pjx__" . $form->{$_} } qw(shiptodepartment_1 shiptodepartment_2 shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact shiptophone shiptofax shiptoemail);
1832 $lxdebug->leave_sub();
1837 $lxdebug->enter_sub();
1839 CT->get_delivery(\%myconfig, \%$form);
1842 $form->sort_columns(shiptoname,
1853 $column_header{shiptoname} =
1854 qq|<th class=listheading>| . $locale->text('Shipping Address') . qq|</th>|;
1855 $column_header{invnumber} =
1856 qq|<th class=listheading>|. $locale->text('Invoice'). qq|</th>|;
1857 $column_header{ordnumber} =
1858 qq|<th class=listheading>|. $locale->text('Order'). qq|</th>|;
1859 $column_header{transdate} =
1860 qq|<th class=listheading>| . $locale->text('Invdate') . qq|</th>|;
1861 $column_header{description} =
1862 qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|;
1863 $column_header{adr_code} =
1864 qq|<th class=listheading>| . $locale->text('ADR') . qq|</th>|;
1865 $column_header{qty} =
1866 qq|<th class=listheading>| . $locale->text('Qty') . qq|</th>|;
1867 $column_header{unit} =
1868 qq|<th class=listheading>| . $locale->text('Unit') . qq|</th>|;
1875 <tr class=listheading>
1878 map { $result .= "$column_header{$_}\n" } @column_index;
1885 foreach $ref (@{ $form->{DELIVERY} }) {
1887 if ($ref->{shiptoname} eq $sameshiptoname) {
1888 map { $column_data{$_} = "<td>$ref->{$_} </td>" } @column_index;
1889 $column_data{shiptoname} = "<td> </td>";
1891 map { $column_data{$_} = "<td>$ref->{$_} </td>" } @column_index;
1897 <tr class=listrow$i>
1900 map { $result .= "$column_data{$_}\n" } @column_index;
1906 $sameshiptoname = $ref->{shiptoname};
1918 $lxdebug->leave_sub();
1922 sub continue { &{ $form->{nextsub} } }