Gossamer Forum
Home : Products : DBMan : Customization :

Relational Mod

Quote Reply
Relational Mod
I have a following challange to be accomplished.

I want to develop a Order Processing System in which REGISTERED user sends and order (Of course, his personal details to be picked by system) the form will all be filled manually but the calulations such as multiplication, additition, subtraction, Division, % is expected ftom the system.
The Order will than be processed by another form for which Order form provides inputs. Only some additional (approval) fields are filled by the admin.

Can it be done with DBMAN ?

Thanks in advance

Vijay

------------------
Quote Reply
Re: Relational Mod In reply to
Yep...with a lot of code hacking.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


Quote Reply
Re: Relational Mod In reply to
I would start by created a database for the user info. Get that done and we can work together on the rest of it.


------------------
JPD






Quote Reply
Re: Relational Mod In reply to
I have already created a database for the Users and also the orders placed by them.

My immidiate problem now is how to do calculations such as addidition, multiplication and % etc. in the order form

Thanks for instant response !

Regards

Vijay

Quote Reply
Re: Relational Mod In reply to
The method of doing the calculations depends on what calculations you need to do and when. I'll need more information.


------------------
JPD






Quote Reply
Re: Relational Mod In reply to
I have following calculations to be done

1) Purchase Order Form

a) Multiplication of Rate by Qty to give me Price.
b) Number of items (Upto 5 Max) wii be added in subsequent rows. I need to total the Price of all items
c) Tax @2% to be added on the total
d) some fixed amount to be added to the above amount to give grand total.

Thanks

P.S. Your instant response is way beyound any support I have experienced in support Forums. Keep it up JP Deni !

Regards

Vijay
Quote Reply
Re: Relational Mod In reply to
 Smile Well, I come here when there's nothing worth watching on tv or I don't have anything else to do -- besides cleaning house, doing laundry and other non-essential stuff. Smile

So you have the order form all worked out, right? This will then be added to a database(?). If so, then your calculations will be in sub add_record.

I kinda need to know the structure of your orders database. You say there are 5 items max per order. Does that mean your database has fields similar to the following:

ID
UserID
Date
Item1
Item1Price
Item1Quan
Item1Total
Item2
Item2Price
Item2Quan
Item2Total
Item3
Item3Price
Item3Quan
Item3Total
Item4
Item4Price
Item4Quan
Item4Total
Item5
Item5Price
Item5Quan
Item5Total
OrderTotal

Something like that?

------------------
JPD






Quote Reply
Re: Relational Mod In reply to
Here are details of my project

=============================================
I have 3 databases to have relations

My Databases Structure are as follows;

1) Members(Dealers) Database

User_Id
Dealer_Code
Company
Address
City
State
Phone
Fax
Email
CST
LST


2) Purchase Order Database (PO)

User_Id
PO_Number
Date
PO_Number
Date
Shipping_Address
Shipping_City
Shipping_State
Shipping_Mode
Required_by
Product_Code1
Description1
Quantity1
Price1
Amount1 ......(Qnantity*Price1=Amount1)
Product_Code2
Description2
Quantity2
Price2
Amount2
Product_Code3
Description3
Quantity3
Price3
Amount3
Product_Code4
Description4
Quantity4
Price4
Amount4
Product_Code5
Description5
Quantity5
Pric5
Amount5
Sub_Total ...(Amount1+Amount2...+Amount5).........say AAA
Sale_Tax ...(sub_Total*0.02) BBB
Octroi ...([sub_Total+Sales_Tax]*0.02) ccc
Shipment ...(Fixed Amount entered manually) DDD
Po_value ...(AAA+BBB+CCC+DDD)
Payment_Terms
Warranty
PO_Value_In_Words


3) Order Processing Form (OPF) Database

opf_no
date
Company
billing_address
shipping_address
cst
lst
sale_thru
Po_value ...(From PO Database) say XXX
Sale_Tax ...(From PO Database) YYY
Octroi ...(From PO Database) ZZZ
freight KKK
commission LLL
other MMM
netvalue ...(XXX-[YYY+ZZZ+KKK+LLL+MMM]) ....SAY HHH
landedcost JJJ
gross_margin..(JJJ-HHH)
Ho_approval

===========================================

Tell me if you need some more info

Regards

Vijay

You are a great help to DBMan-Kind !


Quote Reply
Re: Relational Mod In reply to
Possibly it was a typo on your part, but I see in your Purchase Order Database, that you have two fields named PO_Number. If you do have two fields with the same name, you'll need to either delete one or change one.

In your PO.cfg file, add the following:

Code:
$tax_rate = .02;
$octroi_rate = .02;
$ship_charge = 1.98;

If these change, it's easier to change the .cfg file than to change the db.cgi file, which is where all the calculations are done.

In sub add_record (the db.cgi file), before

Code:
# First we validate the record to make sure the addition is ok.
$status = &validate_record;

add

Code:
if ($db_setup eq "PO") {
$in{'Amount1'} = $in{'Quantity1'} * $in{'Price1'};
$in{'Amount2'} = $in{'Quantity2'} * $in{'Price2'};
$in{'Amount3'} = $in{'Quantity3'} * $in{'Price3'};
$in{'Amount4'} = $in{'Quantity4'} * $in{'Price4'};
$in{'Amount5'} = $in{'Quantity5'} * $in{'Price5'};
$in{'Sub_Total'} = $in{'Amount1'} + $in{'Amount2'} + $in{'Amount3'} + $in{'Amount4'} + $in{'Amount5'};
$in{'Sale_Tax'} = $in{'Sub_Total'} * $tax_rate;
$in{'Octroi'} = ($in{'Sub_Total'} + $in{'Sale_Tax) * $octroi_rate;
$in{'Shipment'} = $ship_charge;
$in{'Po_value} = $in{'Sub_Total'} + $in{'Sale_Tax'} + $in{'Octroi'} + $in{'Shipment'};
}

I'm not sure what else you need, but it looks like quite a bit. Let's make sure the above code works correctly before we go on with the rest, though. Smile


------------------
JPD