#===================================================================== # SQL-Ledger, Accounting # Copyright (c) 1998-2002 # # Author: Dieter Simader # Email: dsimader@sql-ledger.org # Web: http://www.sql-ledger.org # # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #====================================================================== # # Order entry module # #====================================================================== use SL::OE; use SL::IR; use SL::IS; use SL::PE; require "$form->{path}/io.pl"; require "$form->{path}/arap.pl"; 1; # end of main sub add { if ($form->{type} eq 'purchase_order') { $form->{title} = $locale->text('Add Purchase Order'); $form->{vc} = 'vendor'; } if ($form->{type} eq 'sales_order') { $form->{title} = $locale->text('Add Sales Order'); $form->{vc} = 'customer'; } &order_links; &prepare_order; &display_form; } sub edit { if ($form->{type} eq 'purchase_order') { $form->{title} = $locale->text('Edit Purchase Order'); $form->{vc} = 'vendor'; } if ($form->{type} eq 'sales_order') { $form->{title} = $locale->text('Edit Sales Order'); $form->{vc} = 'customer'; } &order_links; &prepare_order; &display_form; } sub order_links { # get vendors / customers $form->all_vc(\%myconfig, $form->{vc}); # retrieve order OE->retrieve_order(\%myconfig, \%$form); $taxincluded = $form->{taxincluded}; $form->{shipto} = 1 if $form->{id}; # get customer / vendor if ($form->{type} eq 'purchase_order') { IR->get_vendor(\%myconfig, \%$form); } if ($form->{type} eq 'sales_order') { IS->get_customer(\%myconfig, \%$form); } ($form->{$form->{vc}}) = split /--/, $form->{$form->{vc}}; $form->{"old$form->{vc}"} = qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|; # build the popup menus if (@{ $form->{"all_$form->{vc}"} }) { $form->{$form->{vc}} = qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|; map { $form->{"select$form->{vc}"} .= "