Re: Calculation of balance

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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@xxxxxxxxxxxxxxxxxxxxxxx
Hi 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@xxxxxxxxxxxxxxxx
Hi,

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
-----------------------------------------------------------




.



Relevant Pages

  • Re: help with microsoft ADO control/True DB Grid
    ... AutoNumber key and let it be the Primary Key. ... >> update data from a table that is in an Access 2003 database. ... >> The grid has ADODC1 selected as its data source. ...
    (microsoft.public.data.ado)
  • Custom Paging in asp.net Datgrid Using Sql
    ... I have written A SP in SQL which will be used to Bind the grid. ... prev(<) and next>on grid. ... When User clicks on Nextbutton,Sp_fill builds a querry like ... StartIndex is the Value of Primary key of last record on the current ...
    (microsoft.public.dotnet.framework.aspnet.datagridcontrol)
  • Re: Calculation of balance
    ... I suppose you can have multiple received records for one ordered record, ... the Grid control that uses the alias as its .RecordSource. ... User then use the cmdCheckIn button to add item into the lower grid ... balance column on the lower grid which is supposed to automatically ...
    (microsoft.public.fox.vfp.forms)
  • Re: Calculation of balance
    ... Imagine an order with multiple order opositions. ... Is it that I keep a primary key for purchase_item so that each record will ... the Grid control that uses the alias as its .RecordSource. ... User then use the cmdCheckIn button to add item into the lower grid ...
    (microsoft.public.fox.vfp.forms)
  • Re: Custom Paging in asp.net Datgrid Using Sql
    ... Here is a solution to dynamically return a sort result set back. ... CREATE TABLE #FileDownLoadJobs ... RowID INT IDENTITY NOT NULL PRIMARY KEY, ... I have written A SP in SQL which will be used to Bind the grid. ...
    (microsoft.public.dotnet.framework.aspnet.datagridcontrol)