1 #=====================================================================
2 # SQL-Ledger Accounting
5 # Author: Dieter Simader
6 # Email: dsimader@sql-ledger.org
7 # Web: http://www.sql-ledger.org
9 # Contributors: Reed White <alta@alta-research.com>
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2 of the License, or
14 # (at your option) any later version.
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #======================================================================
25 # customer/vendor module
27 #======================================================================
38 $form->{title} = "Add";
39 # $locale->text('Add Customer')
40 # $locale->text('Add Vendor')
42 $form->{callback} = "$form->{script}?action=add&db=$form->{db}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}" unless $form->{callback};
44 CT->create_links(\%myconfig, \%$form);
54 # $locale->text('Customer History')
55 # $locale->text('Vendor History')
58 $label = ucfirst $form->{db};
61 if ($form->{db} eq 'customer') {
62 $invlabel = $locale->text('Sales Invoices');
63 $ordlabel = $locale->text('Sales Orders');
64 $quolabel = $locale->text('Quotations');
66 $invlabel = $locale->text('Vendor Invoices');
67 $ordlabel = $locale->text('Purchase Orders');
68 $quolabel = $locale->text('Request for Quotations');
71 $form->{title} = $locale->text($label);
73 $form->{nextsub} = "list_history";
84 <td><input name=type type=radio class=radio value=invoice checked> $invlabel</td>
87 <td><input name=type type=radio class=radio value=order> $ordlabel</td>
90 <td><input name="type" type=radio class=radio value=quotation> $quolabel</td>
97 <th>|.$locale->text('From').qq|</th>
98 <td><input name=transdatefrom size=11 title="$myconfig{dateformat}"></td>
99 <th>|.$locale->text('To').qq|</th>
100 <td><input name=transdateto size=11 title="$myconfig{dateformat}"></td>
105 <input name="open" type=checkbox class=checkbox value=Y checked> |.$locale->text('Open').qq|
106 <input name="closed" type=checkbox class=checkbox value=Y checked> |.$locale->text('Closed').qq|
119 <th align=right nowrap>|.$locale->text('Include in Report').qq|</th>
123 <td><input name=history type=radio class=radio value=summary checked> |.$locale->text('Summary').qq|</td>
124 <td><input name=history type=radio class=radio value=detail> |.$locale->text('Detail').qq|
129 <input name="l_partnumber" type=checkbox class=checkbox value=Y checked> |.$locale->text('Part Number').qq|
132 <input name="l_description" type=checkbox class=checkbox value=Y checked> |.$locale->text('Description').qq|
135 <input name="l_sellprice" type=checkbox class=checkbox value=Y checked> |.$locale->text('Sell Price').qq|
138 <input name="l_curr" type=checkbox class=checkbox value=Y> |.$locale->text('Currency').qq|
143 <input name="l_qty" type=checkbox class=checkbox value=Y> |.$locale->text('Qty').qq|
146 <input name="l_unit" type=checkbox class=checkbox value=Y> |.$locale->text('Unit').qq|
149 <input name="l_discount" type=checkbox class=checkbox value=Y> |.$locale->text('Discount').qq|
154 <input name="l_deliverydate" type=checkbox class=checkbox value=Y> |.$locale->text('Delivery Date').qq|
157 <input name="l_projectnumber" type=checkbox class=checkbox value=Y> |.$locale->text('Project Number').qq|
160 <input name="l_serialnumber" type=checkbox class=checkbox value=Y> |.$locale->text('Serial Number').qq|
175 if ($form->{db} eq 'customer') {
176 $translabel = $locale->text('AR Transactions');
177 $invlabel = $locale->text('Sales Invoices');
178 $ordlabel = $locale->text('Sales Orders');
179 $quolabel = $locale->text('Quotations');
181 $translabel = $locale->text('AP Transactions');
182 $invlabel = $locale->text('Vendor Invoices');
183 $ordlabel = $locale->text('Purchase Orders');
184 $quolabel = $locale->text('Request for Quotations');
197 <td><input name="l_transnumber" type=checkbox class=checkbox value=Y> $translabel</td>
200 <td><input name="l_invnumber" type=checkbox class=checkbox value=Y> $invlabel</td>
203 <td><input name="l_ordnumber" type=checkbox class=checkbox value=Y> $ordlabel</td>
206 <td><input name="l_quonumber" type=checkbox class=checkbox value=Y> $quolabel</td>
213 <th>|.$locale->text('From').qq|</th>
214 <td><input name=transdatefrom size=11 title="$myconfig{dateformat}"></td>
215 <th>|.$locale->text('To').qq|</th>
216 <td><input name=transdateto size=11 title="$myconfig{dateformat}"></td>
221 <input name="open" type=checkbox class=checkbox value=Y checked> |.$locale->text('Open').qq|
222 <input name="closed" type=checkbox class=checkbox value=Y checked> |.$locale->text('Closed').qq|
228 <input name="l_amount" type=checkbox class=checkbox value=Y checked> |.$locale->text('Amount').qq|
229 <input name="l_tax" type=checkbox class=checkbox value=Y checked> |.$locale->text('Tax').qq|
230 <input name="l_total" type=checkbox class=checkbox value=Y checked> |.$locale->text('Total').qq|
231 <input name="l_subtotal" type=checkbox class=checkbox value=Y> |.$locale->text('Subtotal').qq|
245 sub include_in_report {
247 $label = ucfirst $form->{db};
249 if ($myconfig{role} =~ /(admin|manager)/) {
251 <td><input name="l_bcc" type=checkbox class=checkbox value=Y> |.$locale->text('Bcc').qq|</td>
255 if ($form->{db} eq 'customer') {
257 <td><input name="l_employee" type=checkbox class=checkbox value=Y> |.$locale->text('Salesperson').qq|</td>
261 <td><input name="l_pricegroup" type=checkbox class=checkbox value=Y> |.$locale->text('Pricegroup').qq|</td>
266 <td><input name="l_employee" type=checkbox class=checkbox value=Y> |.$locale->text('Employee').qq|</td>
271 <td><input name="l_manager" type=checkbox class=checkbox value=Y> |.$locale->text('Manager').qq|</td>
276 <th align=right nowrap>|.$locale->text('Include in Report').qq|</th>
280 <td><input name="l_id" type=checkbox class=checkbox value=Y> |.$locale->text('ID').qq|</td>
281 <td><input name="l_$form->{db}number" type=checkbox class=checkbox value=Y> |.$locale->text($label . ' Number').qq|</td>
282 <td><input name="l_name" type=checkbox class=checkbox value=Y $form->{l_name}> |.$locale->text('Company Name').qq|</td>
283 <td><input name="l_contact" type=checkbox class=checkbox value=Y $form->{l_contact}> |.$locale->text('Contact').qq|</td>
284 <td><input name="l_email" type=checkbox class=checkbox value=Y $form->{l_email}> |.$locale->text('E-mail').qq|</td>
287 <td><input name="l_address" type=checkbox class=checkbox value=Y> |.$locale->text('Address').qq|</td>
288 <td><input name="l_city" type=checkbox class=checkbox value=Y> |.$locale->text('City').qq|</td>
289 <td><input name="l_state" type=checkbox class=checkbox value=Y> |.$locale->text('State/Province').qq|</td>
290 <td><input name="l_zipcode" type=checkbox class=checkbox value=Y> |.$locale->text('Zip/Postal Code').qq|</td>
291 <td><input name="l_country" type=checkbox class=checkbox value=Y> |.$locale->text('Country').qq|</td>
294 <td><input name="l_phone" type=checkbox class=checkbox value=Y $form->{l_phone}> |.$locale->text('Phone').qq|</td>
295 <td><input name="l_fax" type=checkbox class=checkbox value=Y> |.$locale->text('Fax').qq|</td>
296 <td><input name="l_cc" type=checkbox class=checkbox value=Y> |.$locale->text('Cc').qq|</td>
298 <td><input name="l_notes" type=checkbox class=checkbox value=Y> |.$locale->text('Notes').qq|</td>
299 <td><input name="l_discount" type=checkbox class=checkbox value=Y> |.$locale->text('Discount').qq|</td>
302 <td><input name="l_taxnumber" type=checkbox class=checkbox value=Y> |.$locale->text('Tax Number').qq|</td>
304 <td><input name="l_sic_code" type=checkbox class=checkbox value=Y> |.$locale->text('SIC').qq|</td>
305 <td><input name="l_iban" type=checkbox class=checkbox value=Y> |.$locale->text('IBAN').qq|</td>
306 <td><input name="l_bic" type=checkbox class=checkbox value=Y> |.$locale->text('BIC').qq|</td>
310 <td><input name="l_business" type=checkbox class=checkbox value=Y> |.$locale->text('Type of Business').qq|</td>
312 <td><input name="l_language" type=checkbox class=checkbox value=Y> |.$locale->text('Language').qq|</td>
315 <td><input name="l_startdate" type=checkbox class=checkbox value=Y> |.$locale->text('Startdate').qq|</td>
316 <td><input name="l_enddate" type=checkbox class=checkbox value=Y> |.$locale->text('Enddate').qq|</td>
328 # $locale->text('Customers')
329 # $locale->text('Vendors')
331 $form->{title} = $locale->text('Search') unless $form->{title};
333 map { $form->{"l_$_"} = 'checked' } qw(name contact phone email);
335 $form->{nextsub} = "list_names";
340 <td><input name=status class=radio type=radio value=all checked> |.$locale->text('All').qq|
341 <input name=status class=radio type=radio value=orphaned> |.$locale->text('Orphaned').qq|</td>
345 if ($form->{db} eq 'vendor') {
347 <td><input name="l_gifi_accno" type=checkbox class=checkbox value=Y> |.$locale->text('GIFI').qq|</td>
360 $label = ucfirst $form->{db};
368 <form method=post action=$form->{script}>
370 <input type=hidden name=db value=$form->{db}>
374 <th class=listtop>$form->{title}</th>
381 <th align=right nowrap>|.$locale->text($label . ' Number').qq|</th>
382 <td><input name=$form->{db}number size=32></td>
385 <th align=right nowrap>|.$locale->text('Company Name').qq|</th>
386 <td><input name=name size=64></td>
389 <th align=right nowrap>|.$locale->text('Address').qq|</th>
390 <td><input name=address size=64></td>
393 <th align=right nowrap>|.$locale->text('City').qq|</th>
394 <td><input name=city size=32></td>
397 <th align=right nowrap>|.$locale->text('State/Province').qq|</th>
398 <td><input name=state size=32></td>
401 <th align=right nowrap>|.$locale->text('Zip/Postal Code').qq|</th>
402 <td><input name=zipcode size=10></td>
405 <th align=right nowrap>|.$locale->text('Country').qq|</th>
406 <td><input name=country size=32></td>
409 <th align=right nowrap>|.$locale->text('Contact').qq|</th>
410 <td><input name=contact size=64></td>
413 <th align=right nowrap>|.$locale->text('E-mail').qq|</th>
414 <td><input name=email size=32></td>
417 <th align=right nowrap>|.$locale->text('Notes').qq|</th>
418 <td><input name=notes size=64></td>
431 <td><hr size=3 noshade></td>
435 <input type=hidden name=nextsub value=$form->{nextsub}>
437 <input type=hidden name=path value=$form->{path}>
438 <input type=hidden name=login value=$form->{login}>
439 <input type=hidden name=sessionid value=$form->{sessionid}>
442 <input type=submit class=submit name=action value="|.$locale->text('Continue').qq|">
453 CT->search(\%myconfig, \%$form);
455 $href = "$form->{script}?action=list_names&direction=$form->{direction}&oldsort=$form->{oldsort}&db=$form->{db}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&status=$form->{status}&l_subtotal=$form->{l_subtotal}";
459 $callback = "$form->{script}?action=list_names&direction=$form->{direction}&oldsort=$form->{oldsort}&db=$form->{db}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&status=$form->{status}&l_subtotal=$form->{l_subtotal}";
461 @columns = $form->sort_columns(id, name, "$form->{db}number", address,
462 city, state, zipcode, country, contact,
463 phone, fax, email, cc, bcc, employee,
464 manager, notes, discount,
465 taxnumber, gifi_accno, sic_code, business,
466 pricegroup, language, iban, bic,
468 invnumber, invamount, invtax, invtotal,
469 ordnumber, ordamount, ordtax, ordtotal,
470 quonumber, quoamount, quotax, quototal);
472 foreach $item (qw(inv ord quo)) {
473 if ($form->{"l_${item}number"}) {
474 map { $form->{"l_$item$_"} = $form->{"l_$_"} } qw(amount tax total);
479 $form->{open} = $form->{closed} = "" if !$openclosed;
481 if ($form->{l_transnumber}) {
482 map { $form->{"l_inv$_"} = $form->{"l_$_"} } qw(amount tax total);
486 if ($removeemployee) {
487 @columns = grep !/(employee|manager)/, @columns;
491 foreach $item (@columns) {
492 if ($form->{"l_$item"} eq "Y") {
493 push @column_index, $item;
495 # add column to href and callback
496 $callback .= "&l_$item=Y";
497 $href .= "&l_$item=Y";
501 foreach $item (qw(amount tax total transnumber)) {
502 if ($form->{"l_$item"} eq "Y") {
503 $callback .= "&l_$item=Y";
504 $href .= "&l_$item=Y";
509 if ($form->{status} eq 'all') {
510 $option = $locale->text('All');
512 if ($form->{status} eq 'orphaned') {
513 $option .= $locale->text('Orphaned');
516 $callback .= "&name=".$form->escape($form->{name},1);
517 $href .= "&name=".$form->escape($form->{name});
518 $option .= "\n<br>".$locale->text('Name')." : $form->{name}";
520 if ($form->{address}) {
521 $callback .= "&address=".$form->escape($form->{address},1);
522 $href .= "&address=".$form->escape($form->{address});
523 $option .= "\n<br>".$locale->text('Address')." : $form->{address}";
526 $callback .= "&city=".$form->escape($form->{city},1);
527 $href .= "&city=".$form->escape($form->{city});
528 $option .= "\n<br>".$locale->text('City')." : $form->{city}";
530 if ($form->{state}) {
531 $callback .= "&state=".$form->escape($form->{state},1);
532 $href .= "&state=".$form->escape($form->{state});
533 $option .= "\n<br>".$locale->text('State')." : $form->{state}";
535 if ($form->{zipcode}) {
536 $callback .= "&zipcode=".$form->escape($form->{zipcode},1);
537 $href .= "&zipcode=".$form->escape($form->{zipcode});
538 $option .= "\n<br>".$locale->text('Zip/Postal Code')." : $form->{zipcode}";
540 if ($form->{country}) {
541 $callback .= "&country=".$form->escape($form->{country},1);
542 $href .= "&country=".$form->escape($form->{country});
543 $option .= "\n<br>".$locale->text('Country')." : $form->{country}";
545 if ($form->{contact}) {
546 $callback .= "&contact=".$form->escape($form->{contact},1);
547 $href .= "&contact=".$form->escape($form->{contact});
548 $option .= "\n<br>".$locale->text('Contact')." : $form->{contact}";
550 if ($form->{notes}) {
551 $callback .= "¬es=".$form->escape($form->{notes},1);
552 $href .= "¬es=".$form->escape($form->{notes});
553 $option .= "\n<br>".$locale->text('Notes')." : $form->{notes}";
555 if ($form->{"$form->{db}number"}) {
556 $callback .= qq|&$form->{db}number=|.$form->escape($form->{"$form->{db}number"},1);
557 $href .= "&$form->{db}number=".$form->escape($form->{"$form->{db}number"});
558 $option .= "\n<br>".$locale->text('Number').qq| : $form->{"$form->{db}number"}|;
560 if ($form->{email}) {
561 $callback .= "&email=".$form->escape($form->{email},1);
562 $href .= "&email=".$form->escape($form->{email});
563 $option .= "\n<br>".$locale->text('E-mail')." : $form->{email}";
565 if ($form->{transdatefrom}) {
566 $callback .= "&transdatefrom=$form->{transdatefrom}";
567 $href .= "&transdatefrom=$form->{transdatefrom}";
568 $option .= "\n<br>" if ($option);
569 $option .= $locale->text('From')." ".$locale->date(\%myconfig, $form->{transdatefrom}, 1);
571 if ($form->{transdateto}) {
572 $callback .= "&transdateto=$form->{transdateto}";
573 $href .= "&transdateto=$form->{transdateto}";
574 if ($form->{transdatefrom}) {
577 $option .= "\n<br>" if ($option);
579 $option .= $locale->text('To')." ".$locale->date(\%myconfig, $form->{transdateto}, 1);
582 $callback .= "&open=$form->{open}";
583 $href .= "&open=$form->{open}";
584 $option .= "\n<br>" if ($option);
585 $option .= $locale->text('Open');
587 if ($form->{closed}) {
588 $callback .= "&closed=$form->{closed}";
589 $href .= "&closed=$form->{closed}";
590 $option .= "\n<br>" if ($option);
591 $option .= $locale->text('Closed');
595 $form->{callback} = "$callback&sort=$form->{sort}";
596 $callback = $form->escape($form->{callback});
598 $column_header{id} = qq|<th class=listheading>|.$locale->text('ID').qq|</th>|;
599 $column_header{"$form->{db}number"} = qq|<th><a class=listheading href=$href&sort=$form->{db}number>|.$locale->text('Number').qq|</a></th>|;
600 $column_header{name} = qq|<th><a class=listheading href=$href&sort=name>|.$locale->text('Name').qq|</a></th>|;
601 $column_header{address} = qq|<th class=listheading>|.$locale->text('Address').qq|</th>|;
602 $column_header{city} = qq|<th><a class=listheading href=$href&sort=city>|.$locale->text('City').qq|</a></th>|;
603 $column_header{state} = qq|<th><a class=listheading href=$href&sort=state>|.$locale->text('State/Province').qq|</a></th>|;
604 $column_header{zipcode} = qq|<th><a class=listheading href=$href&sort=zipcode>|.$locale->text('Zip/Postal Code').qq|</a></th>|;
605 $column_header{country} = qq|<th><a class=listheading href=$href&sort=country>|.$locale->text('Country').qq|</a></th>|;
606 $column_header{contact} = qq|<th><a class=listheading href=$href&sort=contact>|.$locale->text('Contact').qq|</a></th>|;
607 $column_header{phone} = qq|<th><a class=listheading href=$href&sort=phone>|.$locale->text('Phone').qq|</a></th>|;
608 $column_header{fax} = qq|<th><a class=listheading href=$href&sort=fax>|.$locale->text('Fax').qq|</a></th>|;
609 $column_header{email} = qq|<th><a class=listheading href=$href&sort=email>|.$locale->text('E-mail').qq|</a></th>|;
610 $column_header{cc} = qq|<th><a class=listheading href=$href&sort=cc>|.$locale->text('Cc').qq|</a></th>|;
611 $column_header{bcc} = qq|<th><a class=listheading href=$href&sort=cc>|.$locale->text('Bcc').qq|</a></th>|;
612 $column_header{notes} = qq|<th><a class=listheading href=$href&sort=notes>|.$locale->text('Notes').qq|</a></th>|;
613 $column_header{discount} = qq|<th class=listheading>%</th>|;
615 $column_header{taxnumber} = qq|<th><a class=listheading href=$href&sort=taxnumber>|.$locale->text('Tax Number').qq|</a></th>|;
616 $column_header{gifi_accno} = qq|<th><a class=listheading href=$href&sort=gifi_accno>|.$locale->text('GIFI').qq|</a></th>|;
617 $column_header{sic_code} = qq|<th><a class=listheading href=$href&sort=sic_code>|.$locale->text('SIC').qq|</a></th>|;
618 $column_header{business} = qq|<th><a class=listheading href=$href&sort=business>|.$locale->text('Type of Business').qq|</a></th>|;
619 $column_header{iban} = qq|<th class=listheading>|.$locale->text('IBAN').qq|</th>|;
620 $column_header{bic} = qq|<th class=listheading>|.$locale->text('BIC').qq|</th>|;
621 $column_header{startdate} = qq|<th><a class=listheading href=$href&sort=startdate>|.$locale->text('Startdate').qq|</a></th>|;
622 $column_header{enddate} = qq|<th><a class=listheading href=$href&sort=enddate>|.$locale->text('Enddate').qq|</a></th>|;
624 $column_header{invnumber} = qq|<th><a class=listheading href=$href&sort=invnumber>|.$locale->text('Invoice').qq|</a></th>|;
625 $column_header{ordnumber} = qq|<th><a class=listheading href=$href&sort=ordnumber>|.$locale->text('Order').qq|</a></th>|;
626 $column_header{quonumber} = qq|<th><a class=listheading href=$href&sort=quonumber>|.$locale->text('Quotation').qq|</a></th>|;
628 if ($form->{db} eq 'customer') {
629 $column_header{employee} = qq|<th><a class=listheading href=$href&sort=employee>|.$locale->text('Salesperson').qq|</a></th>|;
631 $column_header{employee} = qq|<th><a class=listheading href=$href&sort=employee>|.$locale->text('Employee').qq|</a></th>|;
633 $column_header{manager} = qq|<th><a class=listheading href=$href&sort=manager>|.$locale->text('Manager').qq|</a></th>|;
635 $column_header{pricegroup} = qq|<th><a class=listheading href=$href&sort=pricegroup>|.$locale->text('Pricegroup').qq|</a></th>|;
636 $column_header{language} = qq|<th><a class=listheading href=$href&sort=language>|.$locale->text('Language').qq|</a></th>|;
639 $amount = $locale->text('Amount');
640 $tax = $locale->text('Tax');
641 $total = $locale->text('Total');
643 $column_header{invamount} = qq|<th class=listheading>$amount</th>|;
644 $column_header{ordamount} = qq|<th class=listheading>$amount</th>|;
645 $column_header{quoamount} = qq|<th class=listheading>$amount</th>|;
647 $column_header{invtax} = qq|<th class=listheading>$tax</th>|;
648 $column_header{ordtax} = qq|<th class=listheading>$tax</th>|;
649 $column_header{quotax} = qq|<th class=listheading>$tax</th>|;
651 $column_header{invtotal} = qq|<th class=listheading>$total</th>|;
652 $column_header{ordtotal} = qq|<th class=listheading>$total</th>|;
653 $column_header{quototal} = qq|<th class=listheading>$total</th>|;
656 if ($form->{status}) {
657 $label = ucfirst $form->{db}."s";
658 $form->{title} = $locale->text($label);
660 $label = ucfirst $form->{db};
661 $form->{title} = $locale->text($label ." Transactions");
671 <th class=listtop>$form->{title}</th>
680 <tr class=listheading>
683 map { print "$column_header{$_}\n" } @column_index;
689 $ordertype = ($form->{db} eq 'customer') ? 'sales_order' : 'purchase_order';
690 $quotationtype = ($form->{db} eq 'customer') ? 'sales_quotation' : 'request_quotation';
693 foreach $ref (@{ $form->{CT} }) {
695 if ("$ref->{$form->{sort}}$ref->{id}" ne $sameitem && $form->{l_subtotal}) {
698 map { $column_data{$_} = "<td> </td>" } @column_index;
703 if ("$ref->{$form->{sort}}$ref->{id}" eq $sameitem && $form->{sort} eq 'name') {
704 map { $column_data{$_} = "<td> </td>" } @column_index;
707 map { $column_data{$_} = "<td>$ref->{$_} </td>" } @column_index;
708 $column_data{$form->{sort}} = "<td> </td>" if $ref->{$form->{sort}} eq $sameitem && $form->{l_subtotal};
710 $column_data{address} = "<td>$ref->{address1} $ref->{address2} </td>";
711 $column_data{name} = "<td><a href=$form->{script}?action=edit&id=$ref->{id}&db=$form->{db}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&status=$form->{status}&callback=$callback>$ref->{name} </td>";
714 if ($form->{sort} =~ /(email|cc)/) {
715 if ("$ref->{$form->{sort}}$ref->{id}" ne $sameitem) {
723 foreach $item (qw(email cc bcc)) {
725 $email = $ref->{$item};
726 $email =~ s/</\</;
727 $email =~ s/>/\>/;
729 $column_data{$item} = qq|<td><a href="mailto:$ref->{$item}">$email</a></td>|;
735 if ($ref->{formtype} eq 'invoice') {
736 $column_data{invnumber} = "<td><a href=$ref->{module}.pl?action=edit&id=$ref->{invid}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{invnumber} </td>";
738 $column_data{invamount} = "<td align=right>".$form->format_amount(\%myconfig, $ref->{netamount}, 2, " ")."</td>";
739 $column_data{invtax} = "<td align=right>".$form->format_amount(\%myconfig, $ref->{amount} - $ref->{netamount}, 2, " ")."</td>";
740 $column_data{invtotal} = "<td align=right>".$form->format_amount(\%myconfig, $ref->{amount}, 2, " ")."</td>";
742 $invamountsubtotal += $ref->{netamount};
743 $invtaxsubtotal += ($ref->{amount} - $ref->{netamount});
744 $invtotalsubtotal += $ref->{amount};
747 if ($ref->{formtype} eq 'order') {
748 $column_data{ordnumber} = "<td><a href=$ref->{module}.pl?action=edit&id=$ref->{invid}&type=$ordertype&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{ordnumber} </td>";
750 $column_data{ordamount} = "<td align=right>".$form->format_amount(\%myconfig, $ref->{netamount}, 2, " ")."</td>";
751 $column_data{ordtax} = "<td align=right>".$form->format_amount(\%myconfig, $ref->{amount} - $ref->{netamount}, 2, " ")."</td>";
752 $column_data{ordtotal} = "<td align=right>".$form->format_amount(\%myconfig, $ref->{amount}, 2, " ")."</td>";
754 $ordamountsubtotal += $ref->{netamount};
755 $ordtaxsubtotal += ($ref->{amount} - $ref->{netamount});
756 $ordtotalsubtotal += $ref->{amount};
759 if ($ref->{formtype} eq 'quotation') {
760 $column_data{quonumber} = "<td><a href=$ref->{module}.pl?action=edit&id=$ref->{invid}&type=$quotationtype&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{quonumber} </td>";
762 $column_data{quoamount} = "<td align=right>".$form->format_amount(\%myconfig, $ref->{netamount}, 2, " ")."</td>";
763 $column_data{quotax} = "<td align=right>".$form->format_amount(\%myconfig, $ref->{amount} - $ref->{netamount}, 2, " ")."</td>";
764 $column_data{quototal} = "<td align=right>".$form->format_amount(\%myconfig, $ref->{amount}, 2, " ")."</td>";
766 $quoamountsubtotal += $ref->{netamount};
767 $quotaxsubtotal += ($ref->{amount} - $ref->{netamount});
768 $quototalsubtotal += $ref->{amount};
771 if ($form->{l_discount}) {
772 $column_data{discount} = "<td align=right>".$form->format_amount(\%myconfig, $ref->{discount} * 100, "", " ")."</td>";
780 map { print "$column_data{$_}\n" } @column_index;
786 $sameitem = "$ref->{$form->{sort}}$ref->{id}";
791 if ($form->{l_subtotal}) {
792 map { $column_data{$_} = "<td> </td>" } @column_index;
797 if ($myconfig{acs} !~ /AR--AR/) {
798 if ($form->{db} eq 'customer') {
799 $button{'AR--Customers-Add Customer'}{code} = qq|<input class=submit type=submit name=action value="|.$locale->text('Add Customer').qq|"> |;
800 $button{'AR--Customers--Add Customer'}{order} = $i++;
803 if ($myconfig{acs} !~ /AP--AP/) {
804 if ($form->{db} eq 'vendor') {
805 $button{'AP--Vendors--Add Vendor'}{code} = qq|<input class=submit type=submit name=action value="|.$locale->text('Add Vendor').qq|"> |;
806 $button{'AP--Vendors--Add Vendor'}{order} = $i++;
810 foreach $item (split /;/, $myconfig{acs}) {
811 delete $button{$item};
819 <td><hr size=3 noshade></td>
824 <form method=post action=$form->{script}>
826 <input name=callback type=hidden value="$form->{callback}">
827 <input name=db type=hidden value=$form->{db}>
829 <input type=hidden name=path value=$form->{path}>
830 <input type=hidden name=login value=$form->{login}>
831 <input type=hidden name=sessionid value=$form->{sessionid}>
834 if ($form->{status}) {
835 foreach $item (sort { $a->{order} <=> $b->{order} } %button) {
840 if ($form->{menubar}) {
841 require "$form->{path}/menu.pl";
857 $column_data{invamount} = "<td align=right>".$form->format_amount(\%myconfig, $invamountsubtotal, 2, " ")."</td>";
858 $column_data{invtax} = "<td align=right>".$form->format_amount(\%myconfig, $invtaxsubtotal, 2, " ")."</td>";
859 $column_data{invtotal} = "<td align=right>".$form->format_amount(\%myconfig, $invtotalsubtotal, 2, " ")."</td>";
861 $invamountsubtotal = 0;
863 $invtotalsubtotal = 0;
865 $column_data{ordamount} = "<td align=right>".$form->format_amount(\%myconfig, $ordamountsubtotal, 2, " ")."</td>";
866 $column_data{ordtax} = "<td align=right>".$form->format_amount(\%myconfig, $ordtaxsubtotal, 2, " ")."</td>";
867 $column_data{ordtotal} = "<td align=right>".$form->format_amount(\%myconfig, $ordtotalsubtotal, 2, " ")."</td>";
869 $ordamountsubtotal = 0;
871 $ordtotalsubtotal = 0;
873 $column_data{quoamount} = "<td align=right>".$form->format_amount(\%myconfig, $quoamountsubtotal, 2, " ")."</td>";
874 $column_data{quotax} = "<td align=right>".$form->format_amount(\%myconfig, $quotaxsubtotal, 2, " ")."</td>";
875 $column_data{quototal} = "<td align=right>".$form->format_amount(\%myconfig, $quototalsubtotal, 2, " ")."</td>";
877 $quoamountsubtotal = 0;
879 $quototalsubtotal = 0;
882 <tr class=listsubtotal>
884 map { print "$column_data{$_}\n" } @column_index;
896 CT->get_history(\%myconfig, \%$form);
898 $href = "$form->{script}?action=list_history&direction=$form->{direction}&oldsort=$form->{oldsort}&db=$form->{db}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&type=$form->{type}&transdatefrom=$form->{transdatefrom}&transdateto=$form->{transdateto}&history=$form->{history}";
902 $callback = "$form->{script}?action=list_history&direction=$form->{direction}&oldsort=$form->{oldsort}&db=$form->{db}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&type=$form->{type}&transdatefrom=$form->{transdatefrom}&transdateto=$form->{transdateto}&history=$form->{history}";
904 $form->{l_fxsellprice} = $form->{l_curr};
905 @columns = $form->sort_columns(partnumber, description, qty, unit, sellprice, fxsellprice, curr, discount, deliverydate, projectnumber, serialnumber);
907 if ($form->{history} eq 'summary') {
908 @columns = $form->sort_columns(partnumber, description, qty, unit, sellprice, curr);
911 foreach $item (@columns) {
912 if ($form->{"l_$item"} eq "Y") {
913 push @column_index, $item;
915 # add column to href and callback
916 $callback .= "&l_$item=Y";
917 $href .= "&l_$item=Y";
921 if ($form->{history} eq 'detail') {
922 $option = $locale->text('Detail');
924 if ($form->{history} eq 'summary') {
925 $option .= $locale->text('Summary');
928 $callback .= "&name=".$form->escape($form->{name},1);
929 $href .= "&name=".$form->escape($form->{name});
930 $option .= "\n<br>".$locale->text('Name')." : $form->{name}";
932 if ($form->{contact}) {
933 $callback .= "&contact=".$form->escape($form->{contact},1);
934 $href .= "&contact=".$form->escape($form->{contact});
935 $option .= "\n<br>".$locale->text('Contact')." : $form->{contact}";
937 if ($form->{"$form->{db}number"}) {
938 $callback .= qq|&$form->{db}number=|.$form->escape($form->{"$form->{db}number"},1);
939 $href .= "&$form->{db}number=".$form->escape($form->{"$form->{db}number"});
940 $option .= "\n<br>".$locale->text('Number').qq| : $form->{"$form->{db}number"}|;
942 if ($form->{email}) {
943 $callback .= "&email=".$form->escape($form->{email},1);
944 $href .= "&email=".$form->escape($form->{email});
945 $option .= "\n<br>".$locale->text('E-mail')." : $form->{email}";
947 if ($form->{transdatefrom}) {
948 $callback .= "&transdatefrom=$form->{transdatefrom}";
949 $href .= "&transdatefrom=$form->{transdatefrom}";
950 $option .= "\n<br>" if ($option);
951 $option .= $locale->text('From')." ".$locale->date(\%myconfig, $form->{transdatefrom}, 1);
953 if ($form->{transdateto}) {
954 $callback .= "&transdateto=$form->{transdateto}";
955 $href .= "&transdateto=$form->{transdateto}";
956 if ($form->{transdatefrom}) {
959 $option .= "\n<br>" if ($option);
961 $option .= $locale->text('To')." ".$locale->date(\%myconfig, $form->{transdateto}, 1);
964 $callback .= "&open=$form->{open}";
965 $href .= "&open=$form->{open}";
966 $option .= "\n<br>" if ($option);
967 $option .= $locale->text('Open');
969 if ($form->{closed}) {
970 $callback .= "&closed=$form->{closed}";
971 $href .= "&closed=$form->{closed}";
972 $option .= "\n<br>" if ($option);
973 $option .= $locale->text('Closed');
977 $form->{callback} = "$callback&sort=$form->{sort}";
978 $callback = $form->escape($form->{callback});
980 $column_header{partnumber} = qq|<th><a class=listheading href=$href&sort=partnumber>|.$locale->text('Part Number').qq|</a></th>|;
981 $column_header{description} = qq|<th><a class=listheading href=$href&sort=description>|.$locale->text('Description').qq|</a></th>|;
983 if ($form->{history} eq 'summary') {
984 $column_header{sellprice} = qq|<th class=listheading>|.$locale->text('Total').qq|</th>|;
986 $column_header{sellprice} = qq|<th class=listheading>|.$locale->text('Sell Price').qq|</th>|;
988 $column_header{fxsellprice} = qq|<th> </th>|;
990 $column_header{curr} = qq|<th class=listheading>|.$locale->text('Curr').qq|</th>|;
991 $column_header{discount} = qq|<th class=listheading>|.$locale->text('Discount').qq|</th>|;
992 $column_header{qty} = qq|<th class=listheading>|.$locale->text('Qty').qq|</th>|;
993 $column_header{unit} = qq|<th class=listheading>|.$locale->text('Unit').qq|</th>|;
994 $column_header{deliverydate} = qq|<th><a class=listheading href=$href&sort=deliverydate>|.$locale->text('Delivery Date').qq|</a></th>|;
995 $column_header{projectnumber} = qq|<th><a class=listheading href=$href&sort=projectnumber>|.$locale->text('Project Number').qq|</a></th>|;
996 $column_header{serialnumber} = qq|<th><a class=listheading href=$href&sort=serialnumber>|.$locale->text('Serial Number').qq|</a></th>|;
999 # $locale->text('Customer History')
1000 # $locale->text('Vendor History')
1002 $label = ucfirst $form->{db};
1003 $form->{title} = $locale->text($label." History");
1005 $colspan = $#column_index + 1;
1014 <th class=listtop>$form->{title}</th>
1016 <tr height="5"></tr>
1023 <tr class=listheading>
1026 map { print "$column_header{$_}\n" } @column_index;
1034 if ($form->{db} eq 'customer') {
1035 $invlabel = $locale->text('Sales Invoice');
1036 $ordlabel = $locale->text('Sales Order');
1037 $quolabel = $locale->text('Quotation');
1039 $ordertype = 'sales_order';
1040 $quotationtype = 'sales_quotation';
1041 if ($form->{type} eq 'invoice') {
1045 $invlabel = $locale->text('Vendor Invoice');
1046 $ordlabel = $locale->text('Purchase Order');
1047 $quolabel = $locale->text('RFQ');
1049 $ordertype = 'purchase_order';
1050 $quotationtype = 'request_quotation';
1051 if ($form->{type} eq 'invoice') {
1057 foreach $ref (@{ $form->{CT} }) {
1059 if ($ref->{id} ne $sameid) {
1062 <tr class=listheading>
1063 <th colspan=$colspan><a class=listheading href=$form->{script}?action=edit&id=$ref->{ctid}&db=$form->{db}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{name} $ref->{address}</a></th>
1068 if ($form->{type} ne 'invoice') {
1069 $ref->{fxsellprice} = $ref->{sellprice};
1070 $ref->{sellprice} *= $ref->{exchangerate};
1073 if ($form->{history} eq 'detail' and $ref->{invid} ne $sameinvid) {
1074 # print inv, ord, quo number
1078 <tr class=listrow$i>
1081 if ($form->{type} eq 'invoice') {
1082 print qq|<th align=left colspan=$colspan><a href=${module}.pl?action=edit&id=$ref->{invid}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$invlabel $ref->{invnumber} / $ref->{employee}</a></th>|;
1085 if ($form->{type} eq 'order') {
1086 print qq|<th align=left colspan=$colspan><a href=${module}.pl?action=edit&id=$ref->{invid}&type=$ordertype&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ordlabel $ref->{ordnumber} / $ref->{employee}</a></th>|;
1089 if ($form->{type} eq 'quotation') {
1090 print qq|<th align=left colspan=$colspan><a href=${module}.pl?action=edit&id=$ref->{invid}&type=$quotationtype&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$quolabel $ref->{quonumber} / $ref->{employee}</a></th>|;
1098 map { $column_data{$_} = "<td>$ref->{$_} </td>" } @column_index;
1100 if ($form->{l_curr}) {
1101 $column_data{fxsellprice} = qq|<td align=right>|.$form->format_amount(\%myconfig, $ref->{fxsellprice}, 2)."</td>";
1103 $column_data{sellprice} = qq|<td align=right>|.$form->format_amount(\%myconfig, $ref->{sellprice}, 2)."</td>";
1105 $column_data{qty} = qq|<td align=right>|.$form->format_amount(\%myconfig, $ref->{qty})."</td>";
1106 $column_data{discount} = qq|<td align=right>|.$form->format_amount(\%myconfig, $ref->{discount} * 100, "", " ")."</td>";
1107 $column_data{partnumber} = qq|<td><a href=ic.pl?action=edit&id=$ref->{pid}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{partnumber}</td>|;
1112 <tr class=listrow$i>
1115 map { print "$column_data{$_}\n" } @column_index;
1121 $sameid = $ref->{id};
1122 $sameinvid = $ref->{invid};
1132 <td><hr size=3 noshade></td>
1138 if ($form->{menubar}) {
1139 require "$form->{path}/menu.pl";
1156 # $locale->text('Edit Customer')
1157 # $locale->text('Edit Vendor')
1159 CT->create_links(\%myconfig, \%$form);
1161 map { $form->{$_} = $form->quote($form->{$_}) } keys %$form;
1163 $form->{title} = "Edit";
1166 $form->{discount} *= 100;
1176 $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
1177 $form->{creditlimit} = $form->format_amount(\%myconfig, $form->{creditlimit}, 0);
1179 if ($myconfig{role} =~ /(admin|manager)/) {
1182 <th align=right nowrap>|.$locale->text('Bcc').qq|</th>
1183 <td><input name=bcc size=35 value="$form->{bcc}"></td>
1189 map { $form->{selectcurrency} .= "<option>$_\n" } split /:/, $form->{currencies};
1190 $form->{selectcurrency} =~ s/option>($form->{curr})/option selected>$1/;
1192 foreach $item (split / /, $form->{taxaccounts}) {
1193 if ($form->{tax}{$item}{taxable}) {
1194 $taxable .= qq| <input name="tax_$item" value=1 class=checkbox type=checkbox checked> <b>$form->{tax}{$item}{description}</b>|;
1196 $taxable .= qq| <input name="tax_$item" value=1 class=checkbox type=checkbox> <b>$form->{tax}{$item}{description}</b>|;
1203 <th align=right>|.$locale->text('Taxable').qq|</th>
1208 <td><input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}></td>
1209 <th align=left>|.$locale->text('Tax Included').qq|</th>
1217 $typeofbusiness = qq|
1222 if (@{ $form->{all_business} }) {
1223 $form->{selectbusiness} = qq|<option>\n|;
1224 map { $form->{selectbusiness} .= qq|<option value="$_->{description}--$_->{id}">$_->{description}\n| } @{ $form->{all_business} };
1226 $form->{selectbusiness} =~ s/(<option value="\Q$form->{business}--$form->{business_id}\E")>/$1 selected>/;
1228 $typeofbusiness = qq|
1229 <th align=right>|.$locale->text('Type of Business').qq|</th>
1230 <td><select name=business>$form->{selectbusiness}</select></td>
1241 if (@{ $form->{all_pricegroup} } && $form->{db} eq 'customer') {
1242 $form->{selectpricegroup} = qq|<option>\n|;
1243 map { $form->{selectpricegroup} .= qq|<option value="$_->{pricegroup}--$_->{id}">$_->{pricegroup}\n| } @{ $form->{all_pricegroup} };
1245 $form->{selectpricegroup} =~ s/(<option value="\Q$form->{pricegroup}--$form->{pricegroup_id}\E")/$1 selected/;
1248 <th align=right>|.$locale->text('Pricegroup').qq|</th>
1249 <td><select name=pricegroup>$form->{selectpricegroup}</select></td>
1258 if (@{ $form->{all_language} }) {
1259 $form->{selectlanguage} = qq|<option>\n|;
1260 map { $form->{selectlanguage} .= qq|<option value="$_->{description}--$_->{code}">$_->{description}\n| } @{ $form->{all_language} };
1262 $form->{selectlanguage} =~ s/(<option value="\Q$form->{language}--$form->{language_code}\E")/$1 selected/;
1265 <th align=right>|.$locale->text('Language').qq|</th>
1266 <td><select name=language>$form->{selectlanguage}</select></td>
1271 $employeelabel = $locale->text('Salesperson');
1273 $form->{selectemployee} = qq|<option>\n|;
1274 map { $form->{selectemployee} .= qq|<option value="$_->{name}--$_->{id}">$_->{name}\n| } @{ $form->{all_employee} };
1276 $form->{selectemployee} =~ s/(<option value="\Q$form->{employee}--$form->{employee_id}\E")/$1 selected/;
1278 if ($form->{db} eq 'vendor') {
1280 <th align=right>|.$locale->text('Sub-contract GIFI').qq|</th>
1281 <td><input name=gifi_accno size=9 value="$form->{gifi_accno}"></td>
1283 $employeelabel = $locale->text('Employee');
1287 if (@{ $form->{all_employee} }) {
1289 <th align=right>$employeelabel</th>|;
1291 if ($myconfig{role} ne 'user' || !$form->{id}) {
1293 <td><select name=employee>$form->{selectemployee}</select></td>
1297 <td>$form->{employee}</td>
1298 <input type=hidden name=employee value="$form->{employee}--$form->{employee_id}">|;
1303 # $locale->text('Customer Number')
1304 # $locale->text('Vendor Number')
1306 $label = ucfirst $form->{db};
1307 $form->{title} = $locale->text("$form->{title} $label");
1314 <form method=post action=$form->{script}>
1318 <th class=listtop>$form->{title}</th>
1320 <tr height="5"></tr>
1327 <tr class=listheading>
1328 <th class=listheading colspan=2 width=50%>|.$locale->text('Billing Address').qq|</th>
1330 <th align=right nowrap>|.$locale->text($label .' Number').qq|</th>
1331 <td><input name="$form->{db}number" size=35 maxlength=32 value="$form->{"$form->{db}number"}"></td>
1334 <th align=right nowrap>|.$locale->text('Company Name').qq|</th>
1335 <td><input name=name size=35 maxlength=64 value="$form->{name}"></td>
1338 <th align=right nowrap>|.$locale->text('Address').qq|</th>
1339 <td><input name=address1 size=35 maxlength=32 value="$form->{address1}"></td>
1343 <td><input name=address2 size=35 maxlength=32 value="$form->{address2}"></td>
1346 <th align=right nowrap>|.$locale->text('City').qq|</th>
1347 <td><input name=city size=35 maxlength=32 value="$form->{city}"></td>
1350 <th align=right nowrap>|.$locale->text('State/Province').qq|</th>
1351 <td><input name=state size=35 maxlength=32 value="$form->{state}"></td>
1354 <th align=right nowrap>|.$locale->text('Zip/Postal Code').qq|</th>
1355 <td><input name=zipcode size=10 maxlength=10 value="$form->{zipcode}"></td>
1358 <th align=right nowrap>|.$locale->text('Country').qq|</th>
1359 <td><input name=country size=35 maxlength=32 value="$form->{country}"></td>
1362 <th align=right nowrap>|.$locale->text('Contact').qq|</th>
1363 <td><input name=contact size=35 maxlength=64 value="$form->{contact}"></td>
1366 <th align=right nowrap>|.$locale->text('Phone').qq|</th>
1367 <td><input name=phone size=20 maxlength=20 value="$form->{phone}"></td>
1370 <th align=right nowrap>|.$locale->text('Fax').qq|</th>
1371 <td><input name=fax size=20 maxlength=20 value="$form->{fax}"></td>
1374 <th align=right nowrap>|.$locale->text('E-mail').qq|</th>
1375 <td><input name=email size=35 value="$form->{email}"></td>
1378 <th align=right nowrap>|.$locale->text('Cc').qq|</th>
1379 <td><input name=cc size=35 value="$form->{cc}"></td>
1387 <th class=listheading colspan=2>|.$locale->text('Shipping Address').qq|</th>
1390 <td><input name=none size=35 value=|. ("=" x 35) .qq|></td>
1393 <td><input name=shiptoname size=35 maxlength=64 value="$form->{shiptoname}"></td>
1396 <td><input name=shiptoaddress1 size=35 maxlength=32 value="$form->{shiptoaddress1}"></td>
1399 <td><input name=shiptoaddress2 size=35 maxlength=32 value="$form->{shiptoaddress2}"></td>
1402 <td><input name=shiptocity size=35 maxlength=32 value="$form->{shiptocity}"></td>
1405 <td><input name=shiptostate size=35 maxlength=32 value="$form->{shiptostate}"></td>
1408 <td><input name=shiptozipcode size=10 maxlength=10 value="$form->{shiptozipcode}"></td>
1411 <td><input name=shiptocountry size=35 maxlength=32 value="$form->{shiptocountry}"></td>
1414 <td><input name=shiptocontact size=35 maxlength=64 value="$form->{shiptocontact}"></td>
1417 <td><input name=shiptophone size=20 maxlength=20 value="$form->{shiptophone}"></td>
1420 <td><input name=shiptofax size=20 maxlength=20 value="$form->{shiptofax}"></td>
1423 <td><input name=shiptoemail size=35 value="$form->{shiptoemail}"></td>
1436 <th align=right>|.$locale->text('Startdate').qq|</th>
1437 <td><input name=startdate size=11 title="$myconfig{dateformat}" value=$form->{startdate}></td>
1438 <th align=right>|.$locale->text('Enddate').qq|</th>
1439 <td><input name=enddate size=11 title="$myconfig{dateformat}" value=$form->{enddate}></td>
1442 <th align=right>|.$locale->text('Credit Limit').qq|</th>
1443 <td><input name=creditlimit size=9 value="$form->{creditlimit}"></td>
1444 <th align=right>|.$locale->text('Terms').qq|</th>
1445 <td><input name=terms size=2 value="$form->{terms}"> <b>|.$locale->text('days').qq|</b></td>
1446 <th align=right>|.$locale->text('Discount').qq|</th>
1447 <td><input name=discount size=4 value="$form->{discount}">
1451 <th align=right>|.$locale->text('Tax Number / SSN').qq|</th>
1452 <td><input name=taxnumber size=20 value="$form->{taxnumber}"></td>
1454 <th align=right>|.$locale->text('SIC').qq|</th>
1455 <td><input name=sic size=6 maxlength=6 value="$form->{sic}"></td>
1459 <th align=right>|.$locale->text('BIC').qq|</th>
1460 <td><input name=bic size=11 maxlength=11 value="$form->{bic}"></td>
1461 <th align=right>|.$locale->text('IBAN').qq|</th>
1462 <td><input name=iban size=24 maxlength=34 value="$form->{iban}"></td>
1467 <th>|.$locale->text('Currency').qq|</th>
1468 <td><select name=curr>$form->{selectcurrency}</select></td>
1475 <th align=left nowrap>|.$locale->text('Notes').qq|</th>
1476 <td><textarea name=notes rows=3 cols=40 wrap=soft>$form->{notes}</textarea></td>
1485 <td><hr size=3 noshade></td>
1497 if ($form->{db} eq 'customer') {
1498 if ($myconfig{acs} !~ /AR--AR/) {
1499 $button{'AR--Add Transaction'}{code} = qq|<input class=submit type=submit name=action value="|.$locale->text('AR Transaction').qq|"> |;
1500 $button{'AR--Add Transaction'}{order} = $i++;
1501 $button{'AR--Sales Invoice'}{code} = qq|<input class=submit type=submit name=action value="|.$locale->text('Sales Invoice').qq|"> |;
1502 $button{'AR--Sales Invoice'}{order} = $i++;
1504 if ($myconfig{acs} !~ /Order Entry--Order Entry/) {
1505 $button{'Order Entry--Sales Order'}{code} = qq|<input class=submit type=submit name=action value="|.$locale->text('Sales Order').qq|"> |;
1506 $button{'Order Entry--Sales Order'}{order} = $i++;
1508 if ($myconfig{acs} !~ /Quotations--Quotations/) {
1509 $button{'Quotations--Quotation'}{code} = qq|<input class=submit type=submit name=action value="|.$locale->text('Quotation').qq|"> |;
1510 $button{'Quotations--Quotation'}{order} = $i++;
1513 if ($form->{db} eq 'vendor') {
1514 if ($myconfig{acs} !~ /AP--AP/) {
1515 $button{'AP--Add Transaction'}{code} = qq|<input class=submit type=submit name=action value="|.$locale->text('AP Transaction').qq|"> |;
1516 $button{'AP--Add Transaction'}{order} = $i++;
1517 $button{'AP--Vendor Invoice'}{code} = qq|<input class=submit type=submit name=action value="|.$locale->text('Vendor Invoice').qq|"> |;
1518 $button{'AP--Vendor Invoice'}{order} = $i++;
1520 if ($myconfig{acs} !~ /Order Entry--Order Entry/) {
1521 $button{'Order Entry--Purchase Order'}{code} = qq|<input class=submit type=submit name=action value="|.$locale->text('Purchase Order').qq|"> |;
1522 $button{'Order Entry--Purchase Order'}{order} = $i++;
1524 if ($myconfig{acs} !~ /Quotations--Quotations/) {
1525 $button{'Quotations--RFQ'}{code} = qq|<input class=submit type=submit name=action value="|.$locale->text('RFQ').qq|"> |;
1526 $button{'Quotations--RFQ'}{order} = $i++;
1529 if ($myconfig{acs} !~ /Goods & Services--Goods & Services/) {
1530 $myconfig{acs} =~ s/(Goods & Services--Add )(Service|Assembly).*;/$1--Add Part/g;
1531 $button{'Goods & Services--Add Part'}{code} = qq|<input class=submit type=submit name=action value="|.$locale->text('Pricelist').qq|"> |;
1532 $button{'Goods & Services--Add Part'}{order} = $i++;
1535 foreach $item (split /;/, $myconfig{acs}) {
1536 delete $button{$item};
1540 <input name=id type=hidden value=$form->{id}>
1541 <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
1543 <input type=hidden name=path value=$form->{path}>
1544 <input type=hidden name=login value=$form->{login}>
1545 <input type=hidden name=sessionid value=$form->{sessionid}>
1547 <input type=hidden name=callback value="$form->{callback}">
1548 <input type=hidden name=db value=$form->{db}>
1553 if ($form->{db} eq 'customer') {
1554 $item = 'AR--Customers--Add Customer';
1556 if ($form->{db} eq 'vendor') {
1557 $item = 'AP--Vendors--Add Vendor';
1560 if ($myconfig{acs} !~ /$item/) {
1562 <input class=submit type=submit name=action value="|.$locale->text("Save").qq|">
1564 if ($form->{id} && $form->{status} eq 'orphaned') {
1565 print qq|<input class=submit type=submit name=action value="|.$locale->text('Delete').qq|">\n|;
1569 foreach $item (sort { $a->{order} <=> $b->{order} } %button) {
1570 print $item->{code};
1573 if ($form->{menubar}) {
1574 require "$form->{path}/menu.pl";
1591 $form->isblank("name", $locale->text('Name missing!'));
1593 CT->pricelist(\%myconfig, \%$form);
1595 foreach $ref (@{ $form->{"all_partspricelist"} }) {
1597 map { $form->{"${_}_$i"} = $ref->{$_} } keys %$ref;
1599 $form->{rowcount} = $i;
1602 @curr = split /:/, $form->{currencies};
1603 map { $form->{selectcurrency} .= "<option>$_\n" } @curr;
1605 if (@ { $form->{all_partsgroup} }) {
1606 $form->{selectpartsgroup} = "<option>\n";
1607 foreach $ref (@ { $form->{all_partsgroup} }) {
1608 $form->{selectpartsgroup} .= qq|<option value="$ref->{partsgroup}--$ref->{id}">$ref->{partsgroup}\n|;
1612 map { delete $form->{$_} } ("currencies", "all_partsgroup", "all_partspricelist");
1614 foreach $i (1 .. $form->{rowcount}) {
1616 if ($form->{db} eq 'customer') {
1618 $form->{"pricebreak_$i"} = $form->format_amount(\%myconfig, $form->{"pricebreak_$i"});
1620 ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
1622 $decimalplaces = ($dec > 2) ? $dec : 2;
1624 $form->{"sellprice_$i"} = $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces);
1628 if ($form->{db} eq 'vendor') {
1630 $form->{"leadtime_$i"} = $form->format_amount(\%myconfig, $form->{"leadtime_$i"});
1631 ($dec) = ($form->{"lastcost_$i"} =~ /\.(\d+)/);
1633 $decimalplaces = ($dec > 2) ? $dec : 2;
1635 $form->{"lastcost_$i"} = $form->format_amount(\%myconfig, $form->{"lastcost_$i"}, $decimalplaces);
1640 $form->{rowcount}++;
1641 &{ "$form->{db}_pricelist" };
1646 sub customer_pricelist {
1648 @flds = qw(runningnumber id partnumber description sellprice unit partsgroup pricebreak curr validfrom validto);
1650 $form->{rowcount}--;
1653 if ($form->{rowcount}) {
1655 foreach $i (1 .. $form->{rowcount}) {
1657 map { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) } qw(pricebreak sellprice);
1659 ($a, $b) = split /\./, $form->{"pricebreak_$i"};
1662 $whole = ($whole > $a) ? $whole : $a;
1663 $dec = ($dec > $b) ? $dec : $b;
1665 $pad1 = '0' x $whole;
1668 foreach $i (1 .. $form->{rowcount}) {
1669 ($a, $b) = split /\./, $form->{"pricebreak_$i"};
1671 $a = substr("$pad1$a", -$whole);
1672 $b = substr("$b$pad2", 0, $dec);
1673 $ndx{qq|$form->{"partnumber_$i"}_$form->{"id_$i"}_$a$b|} = $i;
1677 map { $form->{"runningnumber_$ndx{$_}"} = $i++ } sort keys %ndx;
1679 foreach $i (1 .. $form->{rowcount}) {
1680 if ($form->{"partnumber_$i"} && $form->{"sellprice_$i"}) {
1681 if ($form->{"id_$i"} eq $sameid) {
1683 next if ($form->{"id_$j"} eq $sameid && !$form->{"pricebreak_$i"});
1689 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
1692 $sameid = $form->{"id_$i"};
1695 $form->redo_rows(\@flds, \@a, $count, $form->{rowcount});
1696 $form->{rowcount} = $count;
1700 $form->{rowcount}++;
1709 sub vendor_pricelist {
1711 @flds = qw(runningnumber id sku partnumber description lastcost unit partsgroup curr leadtime);
1713 $form->{rowcount}--;
1716 if ($form->{rowcount}) {
1718 foreach $i (1 .. $form->{rowcount}) {
1720 map { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) } qw(leadtime lastcost);
1721 $var = ($form->{"partnumber_$i"}) ? $form->{"sku_$i"} : qq|_$form->{"sku_$i"}|;
1727 map { $form->{"runningnumber_$ndx{$_}"} = $i++ } sort keys %ndx;
1729 foreach $i (1 .. $form->{rowcount}) {
1730 if ($form->{"sku_$i"}) {
1734 map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
1739 $form->redo_rows(\@flds, \@a, $count, $form->{rowcount});
1740 $form->{rowcount} = $count;
1744 $form->{rowcount}++;
1754 sub pricelist_header {
1756 $form->{title} = $form->{name};
1763 <form method=post action="$form->{script}">
1767 <th class=listtop>$form->{title}</th>
1769 <tr height="5"></tr>
1772 if ($form->{db} eq 'customer') {
1773 @column_index = qw(partnumber description);
1774 push @column_index, "partsgroup" if $form->{selectpartsgroup};
1775 push @column_index, qw(pricebreak sellprice curr validfrom validto);
1777 $column_header{pricebreak} = qq|<th class=listheading nowrap>|.$locale->text('Break').qq|</th>|;
1778 $column_header{sellprice} = qq|<th class=listheading nowrap>|.$locale->text('Sell Price').qq|</th>|;
1779 $column_header{validfrom} = qq|<th class=listheading nowrap>|.$locale->text('From').qq|</th>|;
1780 $column_header{validto} = qq|<th class=listheading nowrap>|.$locale->text('To').qq|</th>|;
1783 if ($form->{db} eq 'vendor') {
1784 @column_index = qw(sku partnumber description);
1785 push @column_index, "partsgroup" if $form->{selectpartsgroup};
1786 push @column_index, qw(lastcost curr leadtime);
1789 $column_header{sku} = qq|<th class=listheading nowrap>|.$locale->text('SKU').qq|</th>|;
1790 $column_header{leadtime} = qq|<th class=listheading nowrap>|.$locale->text('Leadtime').qq|</th>|;
1791 $column_header{lastcost} = qq|<th class=listheading nowrap>|.$locale->text('Cost').qq|</th>|;
1794 $column_header{partnumber} = qq|<th class=listheading nowrap>|.$locale->text('Number').qq|</th>|;
1795 $column_header{description} = qq|<th class=listheading nowrap width=80%>|.$locale->text('Description').qq|</th>|;
1796 $column_header{partsgroup} = qq|<th class=listheading nowrap>|.$locale->text('Group').qq|</th>|;
1797 $column_header{curr} = qq|<th class=listheading nowrap>|.$locale->text('Curr').qq|</th>|;
1803 <tr class=listheading>
1806 map { print "\n$column_header{$_}" } @column_index;
1813 foreach $i (1 .. $form->{rowcount}) {
1815 $selectcurrency = $form->{selectcurrency};
1816 $selectcurrency =~ s/option>\Q$form->{"curr_$i"}\E/option selected>$form->{"curr_$i"}/;
1818 if ($form->{selectpartsgroup}) {
1819 if ($i < $form->{rowcount}) {
1820 ($partsgroup) = split /--/, $form->{"partsgroup_$i"};
1821 $column_data{partsgroup} = qq|<td>$partsgroup</td>
1822 <input type=hidden name="partsgroup_$i" value="$form->{"partsgroup_$i"}">|;
1827 if ($i < $form->{rowcount}) {
1829 if ($form->{"id_$i"} eq $sameid) {
1830 map { $column_data{$_} = qq|<td> </td>
1831 <input type=hidden name="${_}_$i" value="|.$form->quote($form->{"${_}_$i"}).qq|">| } qw(partnumber description partsgroup);
1835 $column_data{sku} = qq|<td><input name="sku_$i" value="$form->{"sku_$i"}"></td>|;
1836 $column_data{partnumber} = qq|<td><input name="partnumber_$i" value="$form->{"partnumber_$i"}"></td>|;
1838 $column_data{description} = qq|<td>$form->{"description_$i"} </td>
1839 <input type=hidden name="description_$i" value="|.$form->quote($form->{"description_$i"}).qq|">|;
1843 $column_data{partnumber} .= qq|
1844 <input type=hidden name="id_$i" value="$form->{"id_$i"}">|;
1848 if ($form->{db} eq 'customer') {
1849 $column_data{partnumber} = qq|<td><input name="partnumber_$i" value="$form->{"partnumber_$i"}"></td>|;
1851 $column_data{partnumber} = qq|<td> </td>|;
1854 $column_data{partnumber} .= qq|
1855 <input type=hidden name="id_$i" value="$form->{"id_$i"}">|;
1857 $column_data{sku} = qq|<td><input name="sku_$i" value="$form->{"sku_$i"}"></td>|;
1858 $column_data{description} = qq|<td><input name="description_$i" value="$form->{"description_$i"}"></td>|;
1860 if ($form->{selectpartsgroup}) {
1861 $column_data{partsgroup} = qq|<td><select name="partsgroup_$i">$form->{selectpartsgroup}</select></td>|;
1867 if ($form->{db} eq 'customer') {
1868 ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
1870 $decimalplaces = ($dec > 2) ? $dec : 2;
1872 $column_data{pricebreak} = qq|<td align=right><input name="pricebreak_$i" size=5 value=|.$form->format_amount(\%myconfig, $form->{"pricebreak_$i"}).qq|></td>|;
1873 $column_data{sellprice} = qq|<td align=right><input name="sellprice_$i" size=10 value=|.$form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces).qq|></td>|;
1875 $column_data{validfrom} = qq|<td><input name="validfrom_$i" size=11 value=$form->{"validfrom_$i"}></td>|;
1876 $column_data{validto} = qq|<td><input name="validto_$i" size=11 value=$form->{"validto_$i"}></td>|;
1879 if ($form->{db} eq 'vendor') {
1880 ($dec) = ($form->{"lastcost_$i"} =~ /\.(\d+)/);
1882 $decimalplaces = ($dec > 2) ? $dec : 2;
1884 $column_data{leadtime} = qq|<td align=right><input name="leadtime_$i" size=5 value=|.$form->format_amount(\%myconfig, $form->{"leadtime_$i"}).qq|></td>|;
1885 $column_data{lastcost} = qq|<td align=right><input name="lastcost_$i" size=10 value=|.$form->format_amount(\%myconfig, $form->{"lastcost_$i"}, $decimalplaces).qq|></td>|;
1889 $column_data{curr} = qq|<td><select name="curr_$i">$selectcurrency</select></td>|;
1892 print qq|<tr valign=top>|;
1894 map { print "\n$column_data{$_}" } @column_index;
1898 $sameid = $form->{"id_$i"};
1907 <td><hr size=3 noshade></td>
1913 foreach $i (1 .. $form->{rowcount}) {
1914 map { delete $form->{"${_}_$i"} } (@column_index, "id");
1916 map { delete $form->{$_} } qw(title titlebar script none header action);
1921 sub pricelist_footer {
1924 <input class=submit type=submit name=action value="|.$locale->text('Update').qq|">
1925 <input class=submit type=submit name=action value="|.$locale->text('Save Pricelist').qq|">|;
1941 $i = $form->{rowcount};
1944 if ($form->{db} eq 'customer') {
1945 $additem = 1 if ! (($form->{"partnumber_$i"} eq "") && ($form->{"description_$i"} eq "") && ($form->{"partsgroup_$i"} eq ""));
1947 if ($form->{db} eq 'vendor') {
1948 if (! (($form->{"sku_$i"} eq "") && ($form->{"description_$i"} eq "") && ($form->{"partsgroup_$i"} eq ""))) {
1950 $form->{"partnumber_$i"} = $form->{"sku_$i"};
1956 CT->retrieve_item(\%myconfig, \%$form);
1958 $rows = scalar @{ $form->{item_list} };
1969 $sellprice = $form->{"sellprice_$i"};
1970 $pricebreak = $form->{"pricebreak_$i"};
1971 $lastcost = $form->{"lastcost_$i"};
1973 map { $form->{item_list}[$i]{$_} = $form->quote($form->{item_list}[$i]{$_}) } qw(partnumber description);
1974 map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} } keys %{ $form->{item_list}[0] };
1976 if ($form->{db} eq 'customer') {
1979 $form->{"sellprice_$i"} = $sellprice;
1982 ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
1984 $decimalplaces = ($dec > 2) ? $dec : 2;
1986 $form->{"sellprice_$i"} = $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces);
1988 $form->{"pricebreak_$i"} = $pricebreak;
1992 foreach $j (1 .. $form->{rowcount}) {
1993 if ($form->{"sku_$j"} eq $form->{"partnumber_$i"}) {
1994 $form->error($locale->text('Item already on pricelist!'));
1999 $form->{"lastcost_$i"} = $lastcost;
2002 ($dec) = ($form->{"lastcost_$i"} =~ /\.(\d+)/);
2004 $decimalplaces = ($dec > 2) ? $dec : 2;
2006 $form->{"lastcost_$i"} = $form->format_amount(\%myconfig, $form->{"lastcost_$i"}, $decimalplaces);
2008 $form->{"sku_$i"} = $form->{"partnumber_$i"};
2009 delete $form->{"partnumber_$i"};
2013 $form->{rowcount}++;
2019 $form->error($locale->text('Item not on file!'));
2024 &{ "$form->{db}_pricelist" };
2032 @column_index = qw(ndx partnumber description partsgroup unit sellprice lastcost);
2034 $column_data{ndx} = qq|<th> </th>|;
2035 $column_data{partnumber} = qq|<th class=listheading>|.$locale->text('Number').qq|</th>|;
2036 $column_data{description} = qq|<th class=listheading>|.$locale->text('Description').qq|</th>|;
2037 $column_data{partsgroup} = qq|<th class=listheading>|.$locale->text('Group').qq|</th>|;
2038 $column_data{unit} = qq|<th class=listheading>|.$locale->text('Unit').qq|</th>|;
2039 $column_data{sellprice} = qq|<th class=listheading>|.$locale->text('Sell Price').qq|</th>|;
2040 $column_data{lastcost} = qq|<th class=listheading>|.$locale->text('Cost').qq|</th>|;
2044 $title = $locale->text('Select from one of the items below');
2049 <form method=post action="$form->{script}">
2053 <th class=listtop>$title</th>
2055 <tr height="5"></tr>
2062 <tr class=listheading>|;
2064 map { print "\n$column_data{$_}" } @column_index;
2071 foreach $ref (@{ $form->{item_list} }) {
2072 $checked = ($i++) ? "" : "checked";
2074 map { $ref->{$_} = $form->quote($ref->{$_}) } qw(partnumber description unit);
2076 $column_data{ndx} = qq|<td><input name=ndx class=radio type=radio value=$i $checked></td>|;
2078 map { $column_data{$_} = qq|<td>$ref->{$_} </td>| } qw(partnumber description partsgroup unit);
2080 $column_data{sellprice} = qq|<td align=right>|.$form->format_amount(\%myconfig, $ref->{sellprice}, 2, " ").qq|</td>|;
2081 $column_data{lastcost} = qq|<td align=right>|.$form->format_amount(\%myconfig, $ref->{lastcost}, 2, " ").qq|</td>|;
2086 <tr class=listrow$j>|;
2088 map { print "\n$column_data{$_}" } @column_index;
2093 <input name="new_partnumber_$i" type=hidden value="$ref->{partnumber}">
2094 <input name="new_description_$i" type=hidden value="$ref->{description}">
2095 <input name="new_partsgroup_$i" type=hidden value="$ref->{partsgroup}">
2096 <input name="new_partsgroup_id_$i" type=hidden value="$ref->{partsgroup_id}">
2097 <input name="new_sellprice_$i" type=hidden value=$ref->{sellprice}>
2098 <input name="new_lastcost_$i" type=hidden value=$ref->{lastcost}>
2099 <input name="new_unit_$i" type=hidden value="$ref->{unit}">
2101 <input name="new_id_$i" type=hidden value=$ref->{id}>
2112 <td><hr size=3 noshade></td>
2116 <input name=lastndx type=hidden value=$i>
2120 # delete action variable
2121 map { delete $form->{$_} } qw(action item_list header);
2126 <input type=hidden name=nextsub value=item_selected>
2129 <input class=submit type=submit name=action value="|.$locale->text('Continue').qq|">
2141 # replace the last row with the checked row
2142 $i = $form->{rowcount};
2144 # index for new item
2147 @new = qw(id partnumber description unit);
2148 push @new, "sellprice" if ! $form->{"sellprice_$i"};
2149 push @new, "lastcost" if ! $form->{"lastcost_$i"};
2151 map { $form->{"${_}_$i"} = $form->{"new_${_}_$j"} } @new;
2153 $form->{"partsgroup_$i"} = qq|$form->{"new_partsgroup_$j"}--$form->{"new_partsgroup_id_$j"}|;
2155 map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(sellprice lastcost);
2157 push @new, qw(partsgroup partsgroup_id);
2159 # delete all the new_ variables
2160 for $i (1 .. $form->{lastndx}) {
2161 map { delete $form->{"new_${_}_$i"} } @new;
2164 map { delete $form->{$_} } qw(ndx lastndx nextsub);
2167 map { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2) } qw(sellprice lastcost);
2169 foreach $j (1 .. $form->{rowcount}) {
2170 if ($form->{"sku_$j"} eq $form->{"partnumber_$i"}) {
2171 $form->error($locale->text('Item already on pricelist!'));
2175 $form->{"sku_$i"} = $form->{"partnumber_$i"};
2176 delete $form->{"partnumber_$i"} if $form->{db} eq 'vendor';
2178 $form->{rowcount}++;
2179 &{ "$form->{db}_pricelist" };
2186 sub save_pricelist {
2188 &{ "CT::save_$form->{db}" }("", \%myconfig, \%$form);
2190 $rc = CT->save_pricelist(\%myconfig, \%$form);
2192 $form->{callback} = "$form->{script}?action=edit&db=$form->{db}&id=$form->{id}&login=$form->{login}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
2194 $form->redirect if $rc;
2195 $form->error($locale->text('Could not save pricelist!'));
2201 sub add_transaction {
2203 $form->isblank("name", $locale->text("Name missing!"));
2205 &{ "CT::save_$form->{db}" }("", \%myconfig, \%$form);
2207 $form->{callback} = $form->escape($form->{callback},1);
2208 $name = $form->escape($form->{name},1);
2210 $form->{callback} = "$form->{script}?login=$form->{login}&path=$form->{path}&sessionid=$form->{sessionid}&action=add&vc=$form->{db}&$form->{db}_id=$form->{id}&$form->{db}=$name&type=$form->{type}&callback=$form->{callback}";
2216 sub ap_transaction {
2218 $form->{script} = "ap.pl";
2219 $form->{type} = "ap_transaction";
2225 sub ar_transaction {
2227 $form->{script} = "ar.pl";
2228 $form->{type} = "ar_transaction";
2236 $form->{script} = "is.pl";
2237 $form->{type} = "invoice";
2243 sub vendor_invoice {
2245 $form->{script} = "ir.pl";
2246 $form->{type} = "invoice";
2254 $form->{script} = "oe.pl";
2255 $form->{type} = "request_quotation";
2263 $form->{script} = "oe.pl";
2264 $form->{type} = "sales_quotation";
2272 $form->{script} = "oe.pl";
2273 $form->{type} = "sales_order";
2279 sub purchase_order {
2281 $form->{script} = "oe.pl";
2282 $form->{type} = "purchase_order";
2290 # $locale->text('Customer saved!')
2291 # $locale->text('Vendor saved!')
2293 $msg = ucfirst $form->{db};
2296 $form->isblank("name", $locale->text("Name missing!"));
2297 &{ "CT::save_$form->{db}" }("", \%myconfig, \%$form);
2299 $form->redirect($locale->text($msg));
2306 # $locale->text('Customer deleted!')
2307 # $locale->text('Cannot delete customer!')
2308 # $locale->text('Vendor deleted!')
2309 # $locale->text('Cannot delete vendor!')
2311 CT->delete(\%myconfig, \%$form);
2313 $msg = ucfirst $form->{db};
2314 $msg .= " deleted!";
2315 $form->redirect($locale->text($msg));
2317 $msg = "Cannot delete $form->{db}";
2318 $form->error($locale->text($msg));
2323 sub continue { &{ $form->{nextsub} } };
2325 sub add_customer { &add };
2326 sub add_vendor { &add };