Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: FW: Message rejected


Message #1 by "Kim, Cardyin" <CKim@s...> on Mon, 24 Dec 2001 09:21:41 -0800
I sent this post last Friday, but it was rejected for
some strange reason.  I am reposting the message again.
I apologize if you have already recieved this
post before.

Cardyin


I am not sure that OOP would be the best way to deal with
this situation.  If you simply use the power of whatever
database engine that you use, you can replace object
collections with recordsets and get all you need
by using a well designed query.

For the sake of discussion though, I will try to
answer your question anyway.  Here is a primative 
look at my best guess at how you wanted all the 
classes to be associated:

                      Supervisor
                       /      \
                  Agent        Agent
                    |            |
                 Schedule        ...
                 /       \
        Projected        Actual
            |               | 
     Product Type        Product Type 

There are many other possibilities and levels
of complexites with collections and such, but
I'm ignoring those for right now.

Now, if I understood you correctly you are saying
that for the report you can get totals for
each agent very easily, but you would have
a hard time getting totals by product type.

Fortunately, this is not very difficult.
If you think about exactly how you would manipulate
the classes to print out your report, you
will see that you will have to get a running
total of each line item.

Because of the formatting of your report,
you will already have a collection of
Agents in memory, and you will be cycling through
them to print out each actual product
sold per agent.  

For I = 1 to colProducts.Count
  For J = 0 to colAgents.Count
    lngTotal = lngTotal + Agent(J).Schedule(1).Actual.Product(I).NumberSold
  Next J
  Debug.Print lngTotal
Next I

As you are doing this, you can simply keep 
a tally and print it when you run out of agents.

To get the totals for each Agent, simply run through 
all the products for one agent.

Hope this helps,

Cardyin

---------------------------------------
Cardyin Kim
Client/Server & Web Development Analyst
Information Services
San Antonio Community Hospital
ckim@s...     (xxx)xxx-xxxx     
---------------------------------------


-----Original Message-----
From: Matt.Brook@p... [mailto:Matt.Brook@p...]
Sent: Friday, December 21, 2001 12:08 PM
To: professional vb
Subject: [pro_vb] VB OOP A & D Question


Hello everyone, I hope you are having a Happy Thanksgiving holiday.

I'm having a hard time visuallizing a portion of an object-oriented 
analysis
and design solution for a scenario at work and was wondering if the users
in this newsgroup would be able to help me visualize it.  Here is the 
skeleton
of the scenario:

Acme Weekly Forecast
Setup:

A company sells products and hires independent agents to sell their 
products.
At the beginning of the week, each agent will tell the supervisor a weekly
estimate of how sales they expect for each type of products they sell.  At
the end of each work day, the agent will report to the supervisor how many
sales they made.

Environment:

*	Independent agents are hired throughout all year.  Each three 
months after
hire, the agents are reviewed to determine if they retained or let go ( So
agents being added to the Weekly Forecast will need to be added in a 
dynamic
fashion)

*	Products are added monthly and possible discontinued during a 
quarter-year
period. ( So product types being added to the Weekly Forecast will need to
be added in a dynamic fashion)


Requirements:

At the beginning of the week--
1.	Supervisor will enter in all agents that will work for the week.
2.	Supervosr will select which types of products all agents will sell.
3.	Supervisor will enter in agents projected sales for each prodyct 
type.

During the Week--
4.	Supervisor will enter in actual sales by agents for each product 
type.
5.	Application will keep track of projected and actual amounts by 
agent by
product type.
6.	Application will calculate the difference between between 
projected and
actual.
7.	Application will calculate the total of sales by product for each 
agent.
8.	Application will produce a report in this format:

	Agent_A	|	Agent_B	|	Agent_C	|	Totals
-----------------------------------------------------------------
Prod_A	|  20	|	35	|	24	|	79
Prod_B	|   8	|	12	|	10	|	30
Prod_C	|  37	|	25	|	28	|	90
-----------------------------------------------------------------
Tot_Proj|  85	|	70	|	65	|      220	
Tot_Act	|  65 	|	72	|	62	|      199
-----------------------------------------------------------------
Diff	| -20	|	 2	|      	-3	|      -21


Here is what I think it should look like:
Starting with a bottom-up method--

An Agent will need to have their sales entered in for that day.
Class : [cActualData]
	Properties	:	Day		- Date
				Sales		- Long


An Agent will work different hours on different days on different weeks.
Class	: [colActuals]
	Methods		:	Add		- cActualData
				Item		- cActualData
				Remove
				Count		- Long

	Properties	:	TotalActual	- Long

An Agent will have a projeced amount for each product type.
Class	: [cProjectedData]
	Properties	:	Amount		- Long

A class to perform the difference calculation.
Class	: [cProductProjection]
	Properties	:	ProductName	- String
				Difference	- Long = ( 
cProjectedData.Amount - colActuals.TotalActual
)
	

An Agent will sell different product types.
Class	: [colProductProjections]
	Methods		:	Add		- cProductProjection
				Item		- cProductProjection
				Remove
				Count		- Long

	Properties	:	TotalProjected	- Long
				TotalSales	- Long
				TotalDifference - Long

The Agent
Class	: [cAgent]
	Properties	:	Name		- String
				Projections	- colProductProjections

A Supervisor will enter in many agents.
Class	: [colAgents]
	Methods		:	Add		- cAgent
				Item		- cAgent
				Remove
				Count		- Long

O.K., please keep bearing with me.

From this model setup, it relatively easy to get totals by Agent for the
desired report.  Maybe I'm thinking about this wrong, but how do I get the
Totals by Product Type for the report?

Does any one know how to perform this?  If I am thinking about the model
wrong, please let me know.  

Thank you in Advance,
Matt

to unsubscribe send a blank email to $subst('Email.Unsub')...



  Return to Index