My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
Documentation_1_1  
This is the main documentation of the system.
Updated Nov 16, 2014 by gzoli71

Short description

Megadyne Calculator is a web application that can be used by some partners of Megadyne to calculate the prices of some products. The base data (like description, properties and prices) is read from an excel file. The calculation is done by the application. The partner needs to log in and choose a product (family, type, width or length)and qty and finally he gets the price of the chosen product.

Installation

In order to make the system work one will need to install the following software components:

  • Apache HTTP server 2.2 or better(or another http server that can support php)
  • PHP 5.4.0
  • Megadyne Calculator (includes Smarty 3.1.8 and ExcelReader)

The MegadyneCalculator software is shipped in a zip file whose content needs to be unzipped and copied to the server where the https server runs. The zip file contains the following directory structure:

MegadyneCalculator

  • cache (needed by smarty)
  • classes (contains the Megadyne calculator classes )
    • ExcelReader (ExcelReader lib for reading excel files)
    • Smarty-3.1.8 (view layer templates handling library)
  • config (contains the MegadyneCalculator config file)
  • docs (contains this documentation)
  • db (contains the serialized data extracted from the uploaded excel)
  • excels (contains the excel files uploaded)
  • templates (contains the smarty templates)
  • templates_c (needed by smarty)
  • web (contains the public web pages that is reachable by the partners)
The directory structure above contains two important directories. The config directory contains the config.php file that should be modified after copying the directory structure to the server. The descriptions of the variables can be found in the config.php file as comments. See the content of the config file below. The "web" directory contains the web pages that is reachable by the partners. All the other directories should be protected by a .htaccess file or some other way.

Configuration

config.php

#The smarty library root directory
define('SMARTY_DIR', '../classes/Smarty-3.1.8/libs/');

#The current version
$version = "2.2";

#The admin name
$adminName="";

#The admin password
$adminPassword="";

#The EUR/HUF exchange rate
$HUFEUR=300;

#The email address of Megadyne where the orders/inquiries should be sent
$companyEmailTo = "";

#The email address of Megadyne from where the orders/inquiries should be sent
$companyEmailFrom = "";

php.ini file

log_errors = On error_log parameter should be display_errors = Off

Apache config

The directory where php has been installed should be set in apache http.conf

Excel file description

The following rules should be used during editing or creating the excel file containing the base data. No formulas should be found between the cells that are parsed by the program. Also care must be taken not to have non-printable characters in the cells.

The USERID sheet should contain the usernames and password that can be used by the partners to login. It is good if this sheet is the first one in the excel, because the program will be faster. The first raw should contain the header of the data. It is skipped by the program. The column A should contain the partner/company names. The column B should contain the usernames while the column C should contain the passwords. Column D should (currency) contains the words "EUR" or "HUF". It contains the currency that is used when showing the prices to the partner. Column E should contain the default name of the person where the orders/inquiries should be sent Column F should contain the default email address where the order/inquiry should be sent column G should contain the default phone number of the partner.

The FAMILIES sheet contains the discounts for each partner by product families. The first row contains the partner names (except the first three cells that is ignored by the program). The partner names should be exactly the same (case sensitively) as on the USERID sheet.

The column A should contain product family names together with the category. The column B should contain the description of the Families.

The column C should contain the Configuration number. The Configuration contains the Product Configurations described here. These control the behavior of the program on family level.

The column D contains the tags. In each row there is a list of tags that belongs to a product family separated by comma. A tag can contain spaces as well. The tags can be used by the user on the web page on the top of menu. The user can choose one or more tags from the list of tags given at the product families. The menu will change according to the tags found by the product families. A product family will be shown in the menu if all the tags can be found at the product family that was given by the user on page.

Each of the following columns should contain the discounts for a partner. The first row contains the partner name while other cells in the rows the discounts. The discount should be a number between 0 and 100. The discount can be a '-' sign as well. If the discount is - in a cell then the appropriate product family (row of the cell) is omited from the menu on the web site for the given partner (column of the cell).

The PRICELIST sheet contains the prices of the products. The first raw is ignored by the program totally. The column A should contain the item numbers (required). The column B should contain the product family names together with the category. The same names should be used as in the FAMILIES sheet. The category and family names appear on the page concatenated (required). The column C should contain the Profile (required). The column D contains the Description that appears to the user on the web page (required). There are more columns that affect the behavior of the application. For each ProductConfigurations different column combination is used, so not all the columns should be filled for all the products. The union of the column for every ProductConfigurations is this:

  • pitch (column E, optional in mm)
  • width (column F, optional contains the width for some products in inch or mm)
  • width uom (column G, the unit of measure for the width column, can be 'inch' , 'rib' or 'mm', optional).
  • unit price ( column H contains the price of one unit in euros, can be empty as well, or it can contain the word 'onrequest' if the partner should ask for the price)
  • sleeve price ( column I, possible value in the column can be empty or the price of one sleeve or it can contain the word 'onrequest' if the partner should ask for the price)
  • cutting cost used in Config 3. It can be empty or 0 or 1. For config 3 it can be 0 or 1. It contains the number of ribs or mm's added during price calculation as cutting cost.

Upload page

There's a page for uploading an excel file. The excel file must be in a format like this:

<something>
YYYYMMDD.xls. The
<something>
part can be anything and the YYYYMMDD is the a day that is used as version of the excel file. This date will be visible on the main page's title afterwards. So we can always know which version of excel is active.

How the system works

The program is not using the excel file directly but php objects are created from excel that are serialized to the file system. When the partner is logging in, the serialized data is read for the usernames and passwords to authenticate the user. After this the discounts for the user are read and the pricelist as well. The serialized data is loaded each time a page request arrives to the server.

Note: the calculator doesn't recognizes the number if it is written with coma only with point.

Comment by project member gzoli71, Aug 20, 2012

material column should be excluded from the excel

Comment by project member gzoli71, Jan 14, 2013

"cutting cost" column has been added to excel description.

Powered by Google Project Hosting