Kittostockstart
Form KitToStockStart
- Unit name: Forms.KitToStockStart
- Form name: KitToStockStartForm
- Old form name: form34 (unit34)
Synopsis
Start a kit-to-stock move operation.
Functionalities
- Grid showing kitting orders as returned by KitReadyOrders view. (filled on show)
- When a line is selected, the smallest ready quantity of the selected kit is displayed in an edit and a label.
This is calculated using the KitReadyQuantity view: The smallest possible quantity is calculated using a loop:
MyQty:=floor(pickedqty/unitqty); while not QUERY1.eof do begin MyQTY1:=floor(pickedqty/unitqty); if MyQty1<MyQTY then MyQTY:=MyQty1; QUERY1.Next; end;
- Label to show maximum available items for the kit order.
- Edit to enter quantity. Default is the minimum quantity of the currently selected order in the view. (see above)
- Button to execute SelectKitOrder action.
Actions
SelectKitOrder
- Enabled when an order is selected, and the entered quantity>0 and is less (or equal to) than the rest quantity: TQty-RQty
- On Execute, shows the KitToStockFinalizeForm form and passes it
- the order kit
- quantity
- Lot number
- Expiry date from the selected kit.
Tables/Views
- KitReadyOrders
SELECT DISTINCT AVIZ AS OrderNo, B.TransitLocation, C.QTY AS TQTY, C.ReadyQTY AS RQTY, C.MLOTNO, C.MEXPIRYDATE, C.ARTCODE AS MARTCODE FROM OUT A INNER JOIN CGROUP C ON AVIZ = 'KG' + CAST (C.ID AS VARCHAR (15)), INNER JOIN OUTDETAILS B ON (A.AVIZ = B.AVIZNO) AND (B.TRANSACTIONTYPE = 'KIT') WHERE (A.SYSTEMDATE >= dateadd(DAY, - 100, getdate())) AND (pickedby <> '') AND (checkedby = '') AND isnull(C.QTY, 0) > isnull(C.ReadyQTY, 0) AND (B.PickedBy<>'') /* last condition Was: A.AVIZ NOT IN (SELECT X.AVIZNO FROM OUTDETAILS X WHERE X.AVIZNO = A.AVIZ AND (pickedby='') But since it is an inner join... */ ) ORDER BY AVIZ DESC
- KitReadyQuantity
SELECT sum(isnull(qtycf, B.qty)) as pickedqty, d.unitqty, b.artcode FROM [OUT] A INNER JOIN OUTDETAILS B ON (A.AVIZ = B.AVIZNO) AND (B.TRANSACTIONTYPE = 'KIT') INNER JOIN CGROUP C ON AVIZ = 'KG' + CAST (C.ID AS VARCHAR (15)) INNER JOIN CGROUPDET D ON (C.ID = D.IDNO) AND (B.ARTCODE = D.ARTCODE) WHERE (pickedby <> '') AND (checkedby = '') AND avizno = :AvizNo GROUP BY BlockNo, d.unitqty, b.artcode ORDER BY BLOCKNO DESC
Needed Service Calls
None.
Reports
None.