summaryrefslogtreecommitdiff
path: root/doc/plugins/hnb
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-07-26 12:47:54 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-07-26 12:47:54 -0400
commited41d7c70fcbeb6ca626a34a10eb4bbbf9bc4c82 (patch)
tree9e5c103d11c3e739cb7a6e147516bea353105672 /doc/plugins/hnb
parent5bea644fdd9216ace2015d1e9ca85cde21689180 (diff)
document
Diffstat (limited to 'doc/plugins/hnb')
0 files changed, 0 insertions, 0 deletions
ass="hl">#
  • # Order entry module
  • # Quotation module
  • #
  • #======================================================================
  • use LedgerSMB::OE;
  • use LedgerSMB::IR;
  • use LedgerSMB::IS;
  • use LedgerSMB::PE;
  • use LedgerSMB::Tax;
  • use LedgerSMB::Locale;
  • require "bin/arap.pl";
  • require "bin/io.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';
  • }
  • if ($form->{type} eq 'request_quotation') {
  • $form->{title} = $locale->text('Add Request for Quotation');
  • $form->{vc} = 'vendor';
  • }
  • if ($form->{type} eq 'sales_quotation') {
  • $form->{title} = $locale->text('Add Quotation');
  • $form->{vc} = 'customer';
  • }
  • $form->{callback} = "$form->{script}?action=add&type=$form->{type}&vc=$form->{vc}&login=$form->{login}&path=$form->{path}&sessionid=$form->{sessionid}" unless $form->{callback};
  • $form->{rowcount} = 0;
  • &order_links;
  • &prepare_order;
  • &display_form;
  • }
  • sub edit {
  • if ($form->{type} =~ /(purchase_order|bin_list)/) {
  • $form->{title} = $locale->text('Edit Purchase Order');
  • $form->{vc} = 'vendor';
  • $form->{type} = 'purchase_order';
  • }
  • if ($form->{type} =~ /((sales|work)_order|(packing|pick)_list)/) {
  • $form->{title} = $locale->text('Edit Sales Order');
  • $form->{vc} = 'customer';
  • $form->{type} = 'sales_order';
  • }
  • if ($form->{type} eq 'request_quotation') {
  • $form->{title} = $locale->text('Edit Request for Quotation');
  • $form->{vc} = 'vendor';
  • }
  • if ($form->{type} eq 'sales_quotation') {
  • $form->{title} = $locale->text('Edit Quotation');
  • $form->{vc} = 'customer';
  • }
  • &order_links;
  • &prepare_order;
  • &display_form;
  • }
  • sub order_links {
  • # retrieve order/quotation
  • OE->retrieve(\%myconfig, \%$form);
  • # get customer/vendor
  • $form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP", undef, $form->{transdate}, 1);
  • # currencies
  • @curr = split /:/, $form->{currencies};
  • $form->{defaultcurrency} = $curr[0];
  • chomp $form->{defaultcurrency};
  • $form->{currency} = $form->{defaultcurrency} unless $form->{currency};
  • for (@curr) { $form->{selectcurrency} .= "<option>$_\n" }
  • $form->{oldlanguage_code} = $form->{language_code};
  • $l{language_code} = $form->{language_code};
  • $l{searchitems} = 'nolabor' if $form->{vc} eq 'customer';
  • $form->get_partsgroup(\%myconfig, \%l);
  • if (@{ $form->{all_partsgroup} }) {
  • $form->{selectpartsgroup} = "<option>\n";
  • foreach $ref (@ { $form->{all_partsgroup} }) {
  • if ($ref->{translation}) {
  • $form->{selectpartsgroup} .= qq|<option value="$ref->{partsgroup}--$ref->{id}">$ref->{translation}\n|;
  • } else {
  • $form->{selectpartsgroup} .= qq|<option value="$ref->{partsgroup}--$ref->{id}">$ref->{partsgroup}\n|;
  • }
  • }
  • }
  • if (@{ $form->{all_project} }) {
  • $form->{selectprojectnumber} = "<option>\n";
  • for (@{ $form->{all_project} }) { $form->{selectprojectnumber} .= qq|<option value="$_->{projectnumber}--$_->{id}">$_->{projectnumber}\n| }
  • }
  • if (@{ $form->{"all_$form->{vc}"} }) {
  • unless ($form->{"$form->{vc}_id"}) {
  • $form->{"$form->{vc}_id"} = $form->{"all_$form->{vc}"}->[0]->{id};
  • }
  • }
  • for (qw(terms taxincluded)) { $temp{$_} = $form->{$_} }
  • $form->{shipto} = 1 if $form->{id};
  • # get customer / vendor
  • AA->get_name(\%myconfig, \%$form);
  • if ($form->{id}) {
  • for (qw(terms taxincluded)) { $form->{$_} = $temp{$_} }
  • }
  • ($form->{$form->{vc}}) = split /--/, $form->{$form->{vc}};
  • $form->{"old$form->{vc}"} = qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
  • # build selection list
  • $form->{"select$form->{vc}"} = "";
  • if (@{ $form->{"all_$form->{vc}"} }) {
  • $form->{$form->{vc}} = qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
  • for (@{ $form->{"all_$form->{vc}"} }) { $form->{"select$form->{vc}"} .= qq|<option value="$_->{name}--$_->{id}">$_->{name}\n| }
  • }
  • # departments
  • if (@{ $form->{all_department} }) {
  • $form->{selectdepartment} = "<option>\n";
  • $form->{department} = "$form->{department}--$form->{department_id}" if $form->{department_id};
  • for (@{ $form->{all_department} }) { $form->{selectdepartment} .= qq|<option value="$_->{description}--$_->{id}">$_->{description}\n| }
  • }
  • $form->{employee} = "$form->{employee}--$form->{employee_id}";
  • # sales staff
  • if (@{ $form->{all_employee} }) {
  • $form->{selectemployee} = "";
  • for (@{ $form->{all_employee} }) { $form->{selectemployee} .= qq|<option value="$_->{name}--$_->{id}">$_->{name}\n| }
  • }
  • if (@{ $form->{all_language} }) {
  • $form->{selectlanguage} = "<option>\n";
  • for (@{ $form->{all_language} }) { $form->{selectlanguage} .= qq|<option value="$_->{code}">$_->{description}\n| }
  • }
  • # forex
  • $form->{forex} = $form->{exchangerate};
  • }
  • sub prepare_order {
  • $form->{format} = "postscript" if $myconfig{printer};
  • $form->{media} = $myconfig{printer};
  • $form->{formname} = $form->{type};
  • $form->{sortby} ||= "runningnumber";
  • $form->{currency} =~ s/ //g;
  • $form->{oldcurrency} = $form->{currency};
  • if ($form->{id}) {
  • for (qw(ordnumber quonumber shippingpoint shipvia notes intnotes shiptoname shiptoaddress1 shiptoaddress2 shiptocity shiptostate shiptozipcode shiptocountry shiptocontact)) { $form->{$_} = $form->quote($form->{$_}) }
  • foreach $ref (@{ $form->{form_details} } ) {
  • $i++;
  • for (keys %$ref) { $form->{"${_}_$i"} = $ref->{$_} }
  • $form->{"projectnumber_$i"} = qq|$ref->{projectnumber}--$ref->{project_id}| if $ref->{project_id};
  • $form->{"partsgroup_$i"} = qq|$ref->{partsgroup}--$ref->{partsgroup_id}| if $ref->{partsgroup_id};