Can't compute data from different table

Can't compute data from different table

  
HI, Here Am trying to compute the profit loss from the purchase and sales details but its not working.
Please refer the oml and check and tell me whats the wrong on the logic?

I think there is a misunderstanding in your datamodel... why ProfitAndLoss entity is associated the with the Product and not with the Purchase/Sales?
André Siébra wrote:
I think there is a misunderstanding in your datamodel... why ProfitAndLoss entity is associated the with the Product and not with the Purchase/Sales?
 
 I'm little confused can you tell me how to I compute profit and loss data using the sale and purchse details?
Why is there Purchased and Sales entities shouldn't they be normalised to one entity?

Or do you purchase/buy the products from a distributor then sell them on to your end customer?
George Jeffcock wrote:
Why is there Purchased and Sales entities shouldn't they be normalised to one entity?

Or do you purchase/buy the products from a distributor then sell them on to your end customer?
 
 Yes Its like I purchase from a Vendor and sell it to the end customer.
OK - Data Models are a subjective but I don't think your data model is fit for purpose. You are mixing too many business roles to each entity. I would do something like the attached oml

The snap shot files are created by batch daily hourly etc or on demand interactively.

The Stock entity is not historic it shows exactly what exists at this very moment and is updated programmatically (could be a point of failure)


BUT this would be very very very rudimentary as you would most likely need to add historic / audit  / Sales Periods / Invoice Numbers / Payments .......