Re: Calculation of balance
- From: "Hii Sing Chung" <singchung@xxxxxxxxxxx>
- Date: Thu, 4 Dec 2008 22:47:41 +0800
Tom,
Is it that I keep a primary key for purchase_item so that each record will have an unique reference (the primary key) and I keep the key as a foreign key in the corresponding record in the goods_received table? So, in case of one record in purchase_item having more than one corresponding records in goods_received (like the case items ordered were delivered in different times), there I sum up the records' quantity for all the records having the same key of its purchase_item?
"tom knauf" <hbgmail@xxxxxxxxxx> wrote in message news:gh3kfc$ska$02$1@xxxxxxxxxxxxxxxxxxxx
Hi,
I suppose you can have multiple received records for one ordered record , so the relation is 1:n ?
Why not have a label on the form (in red or green) showing the balance and being triggered by onrowcolchange or valid of the entry box ?
In any way you will have to get the primary key of the itemsordered to find all corresponding items received and sum for ....
And SUM handles negative values correctly, too.
HTH
Tom
"Stefan Wuebbe" <stefan.wuebbe@xxxxxx> schrieb im Newsbeitrag news:%23K%23$8nGVJHA.5456@xxxxxxxxxxxxxxxxxxxxxxxHi Chung -
PO items, so is the record pointer still with the PO item that the user just copied to the Good Received grid? I doubt, because I can get negative figure
The record pointer of an alias does not change, as long as your
code does not move it. Or the user, navigating up and down in
the Grid control that uses the alias as its .RecordSource.
As for your "why does my calculation not work" question, you
may need to provide more details, perhaps in form of some simplified
repro code.
hth
-Stefan
"Hii Sing Chung" <singchung@xxxxxxxxxxx> schrieb im Newsbeitrag news:C058A20D-3FD1-4426-ACC3-9AF1F5680010@xxxxxxxxxxxxxxxxHi,
I've 2 grids on a form. The upper grid contains the PO items ordered, the lower grid contains the PO items received. The 2 grids are related by POnumber. The navigation buttons on the form allow user to browse up or down in the record in the PO table and the corresponding PO items (from the POItem table are listed in the upper grid). The PO table and POItem table are linked by POnumber.
User then use the cmdCheckIn button to add item into the lower grid (which is linked to GoodReceived table), basically, it copy the PO item details (except the quantity) on the upper grid and write it into the lower grid (using replace command). User is to enter the quantity in the quantity column, to indicate the quantity of item received. There is a balance column on the lower grid which is supposed to automatically calculate the balance (minus the good received quantity from the corresponding PO item's quantity). This is the part that I got lost. Every PO can have one or more PO items, so is the record pointer still with the PO item that the user just copied to the Good Received grid? I doubt, because I can get negative figure for the balance. So I know it is not right, can someone point me to the correct direction?
Thanks in advance
Sing Chung
--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------
.
- Follow-Ups:
- Re: Calculation of balance
- From: tom knauf
- Re: Calculation of balance
- References:
- Calculation of balance
- From: Hii Sing Chung
- Re: Calculation of balance
- From: Stefan Wuebbe
- Re: Calculation of balance
- From: tom knauf
- Calculation of balance
- Prev by Date: Re: recno() and "Record is out of range"
- Next by Date: Re: recno() and "Record is out of range"
- Previous by thread: Re: Calculation of balance
- Next by thread: Re: Calculation of balance
- Index(es):
Relevant Pages
|