Re: Calculation of balance

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Tom,
Most of the time, the item quantity ordered and received are equal, but we need to tackle situations where the received item are less than the ordered item, and letting the receiver know that more item are yet to be delivered for that PO.
Currently in the Purchase_item table, there isn't any field or fields that can be used to uniquely identify a record, therefore, if we can't get hold of the current record pointing position, I can't think of a way to tell the program to go to which record in the purchase_item table to take out its quantity and minus the current value of the quantity in the lower grid. In fact I thought of assigning every item in the Purchase_item an item number, so that POnumber + itemnumber I can uniquely identify a record in the Purchase_item table. From this, I can grab the item number of the the purchase item record, and plus its purchase number, take out the quantity, do the calculation. Is this the right way, or something else?

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




.


Quantcast