Results 1 to 1 of 1
  1. #1
    Join Date
    Feb 2002
    Location
    New Jersey
    Posts
    39

    Unanswered: creating a costing component

    The following scenario is driving me nuts.

    An inventory/cost system for a restaurant.

    User is presented with a form where they select a non-standard
    unit of measure and set it equal to some weight of an ingredient.

    The left side defaults to one(1);

    1 slice == 1.5 ounce of roast beef
    1 slice == .25 ounce whole wheat bread
    1 smear == .75 ounce butter

    and so on....

    Later the user can use these custom weights in association with the
    ingredient they specified earlier.

    A user can define a custom weight for as many ingredients as they like,
    and the application must use the proper weight/ingredient factors.

    Example: cost calulations

    1 smear butter
    2 slice bread-whole wheat
    5 slice roast beef

    My question then is:

    How do I design such a component?

    Current DB structure:

    #
    # Table structure for table `custom_conversion`
    #

    DROP TABLE IF EXISTS custom_conversion;
    CREATE TABLE custom_conversion (
    custom_id int(11) NOT NULL auto_increment,
    custom_name varchar(15) NOT NULL default '',
    custom_amt double NOT NULL default '0',
    custom_conv double NOT NULL default '0',
    custom_type varchar(15) NOT NULL default '',
    parent_amt double NOT NULL default '0',
    parent_conv double NOT NULL default '0',
    parent_type varchar(15) NOT NULL default '',
    PRIMARY KEY (custom_id)
    ) TYPE=MyISAM;

    #
    # Dumping data for table `custom_conversion`
    #

    INSERT INTO custom_conversion VALUES (2, 'schmear', '1', '1', 'each', '2', '0.03125', 'tablespoon');
    # --------------------------------------------------------

    #
    # Table structure for table `equivalence`
    #

    DROP TABLE IF EXISTS equivalence;
    CREATE TABLE equivalence (
    equiv_id int(3) unsigned zerofill NOT NULL auto_increment,
    unit1_id varchar(11) NOT NULL default '0',
    unit2_id varchar(11) NOT NULL default '0',
    bind_to varchar(35) NOT NULL default '',
    multiplier float NOT NULL default '0',
    PRIMARY KEY (equiv_id)
    ) TYPE=MyISAM;

    #
    # Dumping data for table `equivalence`
    #

    INSERT INTO equivalence VALUES (002, 'id3d887c1f3', 'eq3d887c1f3', 'butter', '2');
    # --------------------------------------------------------



    #
    # Table structure for table `measurement`
    #

    DROP TABLE IF EXISTS measurement;
    CREATE TABLE measurement (
    measurement_id tinyint(4) NOT NULL auto_increment,
    portion_type varchar(11) NOT NULL default '',
    portion_conversion double NOT NULL default '0',
    PRIMARY KEY (measurement_id,measurement_id),
    UNIQUE KEY portion_type (portion_type),
    KEY portion_type_2 (portion_type)
    ) TYPE=MyISAM;

    #
    # Dumping data for table `measurement`
    #

    INSERT INTO measurement VALUES (1, 'ounce', '0.0625');
    INSERT INTO measurement VALUES (2, 'pound', '1');
    INSERT INTO measurement VALUES (4, 'each', '1');
    INSERT INTO measurement VALUES (5, 'head', '1');
    INSERT INTO measurement VALUES (7, 'slice', '1');
    INSERT INTO measurement VALUES (8, 'bunch', '1');
    INSERT INTO measurement VALUES (9, '1/4 cup', '0.015625');
    INSERT INTO measurement VALUES (10, '1/2 cup', '0.03125');
    INSERT INTO measurement VALUES (11, 'cup', '0.0625');
    INSERT INTO measurement VALUES (12, 'tablespoon', '0.03125');
    INSERT INTO measurement VALUES (13, 'pint', '0.125');
    INSERT INTO measurement VALUES (14, 'quart', '0.25');
    INSERT INTO measurement VALUES (15, 'gallon', '1');
    INSERT INTO measurement VALUES (16, 'fluid_ounce', '0.0625');
    # --------------------------------------------------------

    #
    # Table structure for table `units`
    #

    DROP TABLE IF EXISTS units;
    CREATE TABLE units (
    unit_id int(3) unsigned zerofill NOT NULL auto_increment,
    unit_name varchar(15) NOT NULL default '',
    unit_code varchar(11) NOT NULL default '',
    PRIMARY KEY (unit_id),
    UNIQUE KEY unit_code (unit_code)
    ) TYPE=MyISAM;

    #
    # Dumping data for table `units`
    #

    INSERT INTO units VALUES (002, 'schmear', 'id3d887c1f3');

    Last edited by phpPete; 09-22-02 at 13:22.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •