473,407 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

the relation between the order and the production (business logic)

mseo
181 100+
I have a database for orders and production
I will explain everything in detail:
The database contains 4 tables
1- tbl_order (OrderID PK , OrderNo, Employee_ID, Customer_ID, OrderDate)
2- tbl_Orderdetails( OrderDetailID, OrderID FK, ProductID, Quantity , Date Required, UnitPrice)
3- tbl_Production (BatchNo, Employee_ID, DateEntered)
4- tbl_ProductionDetail ( BatchNO, Date, Machine_ID, Employee_ID, Product_ID, Quantity, Defective, OvertimeQuantity, OvertimeDefective)

in the second table (tbl_Orderdetails) I made the field orderdetailID as PK in order to allow duplicating the product
because the order will be like that:
Product Product quantity daterequired
So I can have the same product more than one time but the daterequired will be different.
Assume that I have this order
Expand|Select|Wrap|Line Numbers
  1. Product    Quantity    Date Required
  2. T.V    10    1/6/2010
  3. T.V            3             1/8/2010
  4. VCR    17    1/15/2010
  5. Camera    4    1/14/2010
the order will be entered into the database like that above-shown
and the production department will receive the same order to carry it out
and the will enter units produced into the database like that:
Expand|Select|Wrap|Line Numbers
  1. Product    Quantity    Date
  2. T.V    2    1/7/2010
  3. VCR    6    1/2/2010
  4. Camera    1    1/10/2010
  5. TV    2    1/4/2010
  6. Camera    2    1/5/2010
so I need to develop a form to calculate how many units need to be produced for which date ( the daterequired that mentioned in the order):

in other words i want to compare between the production and orders depending on the order date required of every product, it's now 8 days looking for any piece of information to make this query
Mar 20 '10 #1
11 2288
NeoPa
32,556 Expert Mod 16PB
So, if I understand you correctly, you have a table that was called [tbl_Order Details], but is now [tbl_OrderDetails], that has details of all ordered items ([ProductID]) and when they are required by ([Date Required]), and you also have a table that was called [tbl_Production detail], but is now [tbl_ProductionDetail], that has details of all items ([Product_ID]) produced and when they were (Was [Date Produced], but is now apparently just [Date]).

There appears to be no deleting of any of these records from the table triggered by their relevance expiring (such as when orders are completed etc), so all orders from the beginning of time are available.

You want to be able to design a query that shows totals of all the products where there are quantities that have been ordered but not yet produced, but these totals should be shown grouped by [Date Required].

Is that about right, or have I misunderstood somewhere?
Mar 22 '10 #2
mseo
181 100+
hi,
You understood me very clearly, but you drew my attention to very important points such as (the deleting of the records from the table triggered by their relevance expireing such as when orders are completed etc)
but how can I do so? because it is the first time I know that I can do something like that
If you have any useful advices that would be nice from you, but without deleting any tables because I designed a lot of forms depending on the tables of orderdetail and productiondetail
thank you very much
Mar 22 '10 #3
NeoPa
32,556 Expert Mod 16PB
As a general rule, I would not recommend deleting these records. I would simply create a flag instead, which would indicate which records are done with. That way the historical data and the current data can be maintained together (No extra complication of designing new tables into the structure) with a simple value to indicate which is which.

If you consider this necessary, then you can copy expired records to a separate table and delete the originals. Sometimes (quite rare but does happen), the number of records to process makes this approach more sensible.

That said, you didn't really answer my question from the previous post so it's hard for me to give further help at this time.
Mar 23 '10 #4
mseo
181 100+
hi,
I told you that you understood what I need to do and this is the answer of your last question, have you asked me any other questions?
ok, I don't like to copy the records to another tables or deleting them i just need this query to use it within a form this form will be used for showing the status of the orders ( the quantities have not undelivered yet) from all products for each customer.
please help me to do this because this query that I will use within a form for following-up the orders
the names of the fields I just write it for making it simple for everyone to know what I mean and in my post I told you it isn't about the code it's all about business logic so the names of tables and fields shouldn't be as I did in my design
thank you for any help you may provide me
Mar 26 '10 #5
mseo
181 100+
hi,
attached to this post the design of the database
please help me solving this dilemma
thank you for any solution you may provide me
Apr 4 '10 #6
NeoPa
32,556 Expert Mod 16PB
MSEO,

I do apologise for the delay in replying to this thread. I know I wrote the above, but I can't see what I meant without much reconsideration. I do accept that I will need to look again carefully at this. You deserve that. However, for various reasons I'm finding time hard to devote at the moment. I was hoping to have a look over Easter, but barely got on my PC at all during that weekend.

I will try to have a look again at it tonight for you. Maybe I can at least make sense of what I wrote.
Apr 8 '10 #7
mseo
181 100+
Thank you very much for your interest, Neopa
I hope that you may have spent a happy Easter Holiday
I really appreciate your reply
and for saving your valuable time
the attached file is topher23's answer for my thread (Query between two tables with no relationship)
but after making a little change in the report to get the remainder in stead of getting the on-hand After Fulfillment and i want to make the line number 3 of the product milk to be 300 rather than 446 because it would duplicate the values of the above quantities and filter the report to contain the remainder only I tried to filter the report but the running sum of order quantities will start from the first record according to the query criteria
thank you again
Apr 8 '10 #8
NeoPa
32,556 Expert Mod 16PB
It's nearly 02:00 in the morning here & I find I haven't yet had a chance to look at this. I have not forgotten. Just very busy.
Apr 9 '10 #9
NeoPa
32,556 Expert Mod 16PB
It's a bit hard to get back into this now, especially as you have proceeded with the conversation somewhat in my absence (my fault mainly of course). What I will try to do is to explain my thinking about how you would use the original table structure, all pretty well linked together, to get access to all the information relative to each product.

The Orders and the Productions then all appear together as grouped data. The sum of one can be subtracted from the sum of the other and the result is what you need. Your date filtering would be handled in the WHERE clause of course (not HAVING, as is easy to be left with if working with Access Query Design View).

Does that all make sense?
Apr 12 '10 #10
mseo
181 100+
thank you Mr. NeoPa
I appreciate your reply
that make sense for me but the report has all the product even if the remainder equal zero and I want to view the products that have a remainder value greater than zero
the second problem for me the second line in the report of the product milk has a value 146 so the third line should be 300 not 446
please help me to do this
it's long time looking for any solution for this
I really appreciate your help
Apr 12 '10 #11
NeoPa
32,556 Expert Mod 16PB
QUOTE=mseo;3561536
that make sense for me but the report has all the product even if the remainder equal zero and I want to view the products that have a remainder value greater than zero
/QUOTE
If you saw what I said in my last post about using WHERE instead of HAVING, then you need to wipe your memory. Ignore that suggestion as it's rubbish :(

Aggregate functions (Sum(), Max(), Avg(), etc) can never appear in the WHERE clause. They must always be filtered in the HAVING clause.

QUOTE=mseo;3561536
the second problem for me the second line in the report of the product milk has a value 146 so the third line should be 300 not 446
/QUOTE
Remember, I have no information with which to understand what you're saying here. I would need to see your SQL and some data to be able to follow what you're saying. What seems particularly strange at the moment is that you're talking of multiple records for the same item when I'm thinking they're all grouped together into one. Makes no sense at all for now.
Apr 13 '10 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Simon Harvey | last post by:
Hello Chaps, Me and a collegue have been talking about where the best place to put business logic is. I think that the best place is where Microsoft suggest - in a seperate business logic...
2
by: deko | last post by:
ALTER TABLE DROP CONSTRAINT ; Is this syntax correct? The error I'm getting is: Error Number 3199: Could not find reference. I tried it without the curly braces, but no luck.
5
by: Shibu | last post by:
Hi, I have a situation where I need to convert business objects to a flat table. The reverse is also required. I am using c# and Oracle ODP. I am looking for an easier method to do the below...
25
by: Stuart Hilditch | last post by:
Hi all, I am hoping that someone with some experience developing nTier apps can give me some advice here. I am writing an nTier web app that began with a Data Access Layer (DAL), Business...
104
by: Beowulf | last post by:
I have the view below and if I use vwRouteReference as the rowsource for a combo box in an MS Access form or run "SELECT * FROM vwRouteReference" in SQL Query Analyzer, the rows don't come through...
0
by: Jason Minton | last post by:
Please email your resume to me if at: JMinton@Emdeon.com if you feel you could excel in the below position as a Siebel Production Engineer. Compensation for this position is such that only the...
16
by: MS newsgroup | last post by:
I don't have clear reasons why we need business logic layer and data logic layer instead of having only data logic layer. Are there any good reasons for that?
2
by: Chris Zopers | last post by:
Hello, I would like to know what's the best way to implement a business logic layer between my user interface and my database. I would say I'd make a dll-project for the business logic layer...
9
by: SAL | last post by:
Hello, I have a Dataset that I have table adapters in I designed using the designer (DataLayer). I have a business logic layer that immulates the DataLayer which may/may not have additional logic...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.