Subject Re: [firebird-support] Righ way of doing that ?
Author Mr. John
Thanks for your advices.
For my problem "stock management" is management of IN and OUT things.For stock I'll use a single table.Application has to create various reports like "In/out from 01/07/2007 to 31/07/2007" that's way I decided to organize stock by moth. I'll take a report example :

In/out from 01/07/2007 to 31/07/2007
Id Begin quant.(on.01/07/2007) In Out Rest(on 31/07/2007)
So, the stock is organized by months,it's true that depend of I/O of every day.
Rest = Begin quant+In-Out.

----- Original Message ----
From: sasha <selectnull@...>
Sent: Saturday, August 18, 2007 4:45:09 PM
Subject: RE: [firebird-support] Righ way of doing that ?

> Hi to all !

> I develop an application based on stock management,I use VB

> .Net 2005 with FB.I also need to keep a stock table based on

> I/O in month (a table) and stock from last month (another

> table). I'm looking for the right way to do it.I'm new with

> FB, the solved way for me is using some .Net datasets (this

> is based on load needed data from server in memory, manage

> and then send to database for updating. ),but I think it's

> not the right way,it is also very slow.I thing it may be

> another way based only on firebird/stored procedure.



I don't exactly understand what you mean by stock management,

is it stock as in what they trade on Wallstreet or is stock

as in you have some products, warehouses, and customers.

In either case the basic principle is the same. I'll try to

give you a couple of hints, but it's up to you to implement

and test it.

You don't need separate tables based on current/previous

month. You need 1 table that that will be updated with triggers

(never use client code for that, in your case .Net, because it will

always be slower and you'll have a mess of code to manage), do it

once on server with stored procedures and triggers and your .Net code

will be much cleaner and easier (since there will be NO code).

Another thing is that previous months should not be handled with

stock table, they should be selected on date column from your

in/out documents. Actually, the definition of stock from last month

is a sign of wrong desing. There is no such thing. For example,

if your stock quantity changes thru the month, what is the value

of stock quantity for that month? The question has no meaning as such,

you have to change the question to what is the value on specific day

(assuming your minimum time period is 1 day, of course, because when

you are dealing with dates (no matter what platform you use) you are

not dealing with points in time but intervals in time).

What you need to understand is that these things are not Firebird

specific, if you choose another database those same problems

would apply and the solution would be the same, the only difference

would be in syntax.

On how to write stored procedures and triggers I would advise you

to read upon links given at http://www.firebird and

search thru the archive of data models at

http://www.database data_models/ index.htm

If you still have some specific questions regarding Firebird you are

welcome to post them here.



#ygrp-mlmsg {font-size:13px;font-family:arial, helvetica, clean, sans-serif;}
#ygrp-mlmsg table {font-size:inherit;font:100%;}
#ygrp-mlmsg select, input, textarea {font:99% arial, helvetica, clean, sans-serif;}
#ygrp-mlmsg pre, code {font:115% monospace;}
#ygrp-mlmsg * {line-height:1.22em;}
#ygrp-text p{
margin:0 0 1em 0;}
#ygrp-vitnav a{
padding:0 1px;}
clear:both;margin:25px 0;white-space:nowrap;color:#666;text-align:right;}
#ygrp-actbar .left{
font-family:Verdana;font-size:77%;padding:15px 0;}
font-family:verdana;font-size:77%;border-top:1px solid #666;
padding:5px 0;
#ygrp-mlmsg #logo{

background-color:#e0ecee;margin-bottom:20px;padding:2px 0 8px 8px;}
#ygrp-vital #vithd{
#ygrp-vital ul{
padding:0;margin:2px 0;}
#ygrp-vital ul li{
list-style-type:none;clear:both;border:1px solid #e0ecee;
#ygrp-vital ul li .ct{
#ygrp-vital ul li .cat{
#ygrp-vital a {

#ygrp-vital a:hover{

#ygrp-sponsor #hd{
#ygrp-sponsor #ov{
padding:6px 13px;background-color:#e0ecee;margin-bottom:20px;}
#ygrp-sponsor #ov ul{
padding:0 0 0 8px;margin:0;}
#ygrp-sponsor #ov li{
list-style-type:square;padding:6px 0;font-size:77%;}
#ygrp-sponsor #ov li a{
#ygrp-sponsor #nc {
background-color:#eee;margin-bottom:20px;padding:0 8px;}
#ygrp-sponsor .ad{
padding:8px 0;}
#ygrp-sponsor .ad #hd1{
#ygrp-sponsor .ad a{
#ygrp-sponsor .ad a:hover{
#ygrp-sponsor .ad p{
o {font-size:0;}
.MsoNormal {
margin:0 0 0 0;}
#ygrp-text tt{
blockquote{margin:0 0 0 4px;}
.replbq {margin:4;}

Yahoo! oneSearch: Finally, mobile search
that gives answers, not web links.

[Non-text portions of this message have been removed]