Chapter 6. Organization Module

6.1. Requirements

This chapter is $Revision: 1.1 $ $Date: 2003/01/05 00:00:29 $.

6.1.7. Business Object Definition

					
# $RCSfile: org.html,v $ - physical address type
#                  
# Copyright (C) 2001 Free Software Foundation, Inc.
#
# This file is part of GNU Enterprise.
#
# GNU Enterprise 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, or (at your option)
# any later version.
# 
# GNU Enterprise 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 GNU Enterprise; see the file COPYING.  If not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# 02111-1307 USA.
#
# This file originally written by Neil Tiffin (neilt@gnue.org).
#
# $Revision: 1.1 $ $Date: 2003/01/05 00:00:29 $ $Author: psu_gnue $
#
include "../../../base/person/classes/person.gcd"
include "../../../base/location/classes/address.gcd"
include "../../../base/units/classes/units.gcd"
include "../../../base/currency/classes/currency.gcd"

module org
{
  # -------------------------------------------------------------------------
  # base class for instantiating person as a contact and defining a type.
  # -------------------------------------------------------------------------
  class contact
  {
    person::person  name;
    char            code<8>;  # type of contact   
  };

  # -------------------------------------------------------------------------
  # base class for instantiating address as a company address
  # -------------------------------------------------------------------------
  class address
  {
    location::address  address;
  };

  # -------------------------------------------------------------------------
  # base class for vendor and customer classes
  # -------------------------------------------------------------------------
  class organization
  {
    char                     organization_name<80>; # NOT NULL
    org::address          [] address;
    org::contact          [] contact;
    person::comm          [] comm;      # co. telephone number, fax, email etc.
    char                     keyword<100>;    # keyword for searching
    boolean                  deleted;
    
    INDEX (organization_name);
  };

  # -------------------------------------------------------------------------
  # Defines the available types of lines. For example, tax, freight, labor,
  # and material etc.
  # -------------------------------------------------------------------------
  class line_type
  {
    char    code<8>;
    char    descr<30>;
  };
  
  # -------------------------------------------------------------------------
  # define the status of the line item.  For example, open, closed, deleted,
  # and modified.
  # -------------------------------------------------------------------------
  class line_status
  {
    char   code<8>;
    char   descr<30>;
  };

  # -------------------------------------------------------------------------
  # base class for transactions headers external to company
  # -------------------------------------------------------------------------
  type header
  {
    char              order_id<10>;
    date              order_date;
    date              cust_required;
    char              ship_to_name<80>; # these fields copied from custmer
    location::address ship_to_address;  # because cust master may change
    char              bill_to_name<80>; # and we need record of who we
    location::address bill_to_address;  # actually sold to
    char              ship_via<15>;
    char              customer_ref<30>; # P.O. number, verbal name
    currency::money   total;            # total for all items
    char              notes<500>;       # special notes for this order
    
    boolean           closed;           # all transaction against this
                                        # are complete.
    org::organization   * customer;
  };
  
  # -------------------------------------------------------------------------
  # base class for transactions details external to company
  # -------------------------------------------------------------------------
  type detail
  {
    int               line_number;
    char              description<25>;
    unit::quantity    quantity;
    currency::money   unit_price;
    org::line_type   *l_type;        # freight, sales tax, item, tax service etc.
    org::line_status *status;      # open, deleted, etc.
    char              notes<255>;
    int               blank_after = 0; # print num blank lines after this line
  };
};