Form ArticleStock
- Unit name: Forms.Grids.ArticleStock
- Form name: TArticleStockForm
- Old form name: unit5 (Form5)
Synopsis
Form to display the stock of an article.
Functionalities
- Form accepts an article ID.
- Label displays article code.
- Label displays article description.
- Grid to display ArticleCurrentStock view for current article.
- Label to display total qty of ArticleCurrentStock view.
- Label to display record count of ArticleCurrentStock view.
- Grid to display ArticleCurrentStockTotals view for current article.
- Grid to display ArticleCurrentCustomsStockTotals view for current article.
- Label to display total qty of ArticleCurrentCustomStockTotals view.
- Grid to display ArticleReservedStock view for current article.
- Button to execute MovePartialQuantity action.
- Button to execute TransferArticleCode action.
- Button to execute ClearStock action.
- Button to execute StockCorrection action.
- Button to execute ChangeLotNo action.
- Button to execute KitArticles action.
MovePartialQuantity
- Enabled when Qty>0
- When executed, shows the MovePartialQuantity Dialog
- Current stock record data is passed on to the form.
- If the dialog is closed with mrOK, then the StockControl.PartialMove call is executed.
- AdaptOutCC is set to true if both from/to stockcode equal 75
- AdaptINVCC is set to true if From stockcode<> 75 and to stockcode= 75 (see unit43.buttonclick2 for other arguments)
- After return, refresh all views.
TransferArticleCode
- Enabled when there are stock records.
- When executed, shows the TransferArticles form.
- Current stock record data is passed on to the form.
- If the dialog is closed with mrOK, then the StockControl.PartialMove call is executed.
- AdaptOutCC is set to true if to stockcodes equals 75
- AdaptINVCC is set to true if to stockcode equals 75 (see unit132.BitBtn1Click for other arguments)
- After return, refresh all views.
ClearStock
- Enabled when there are stock records.
- When executed, asks for a quantity to be cleared.
- When a strictly positive quantity is entered, the StockControl.ClearStock server call is executed.
- After return, refresh all views.
StockCorrection
- Enabled when there are stock records.
- When executed, shows the ArticleStockCorrection form.
- Current stock record data is passed on to the form.
- When the form is closed with modal result mrOK, then the service call StockControl.StockCorrection is executed. Depending on Minus/Plus, the Quantity field of the correction descriptor is set as positive or negative.
- After return, refresh all views.
CCStockCorrection
- Always enabled.
- When executed, shows the ArticleCCStockCorrection form.
- When the form is closed with modal result mrOK, then the service call StockControl.CCStockCorrection is executed. Depending on Minus/Plus, the Quantity field of the correction descriptor is set as positive or negative.
- After return, refresh all views.
ChangeLotNo
- Enabled if there is an article and there is stock.
- When executed shows the ChangeLotNo dialog. All values are filled in from current stock record.
- When the dialog is closed, the Stockcontrol.ChangeLotNo service call is executed.
- After return, refresh all views.
KitArticles
- Enabled if there is an article.
- When executed shows the Kit articles Grid Form, passing it the current article.
Tables/Views
- ArticleCurrentStock
SELECT A.STOCKCODE, A.Location, A.Lotno, A.ExpiryDate, A.SUPPLIER, A.FDATE, SUM(A.QTYIN-ISNULL(A.QTYOUT, 0)) AS QTY FROM FSTOCTOTAL(:ArticleID) A LEFT OUTER JOIN ARTICLE B ON (A.ARTCODE=B.NAME) WHERE -- Superfluous ? B.NAME=+'+FORM5.CB.TEXT+' QTYIN-ISNULL(QTYOUT, 0)<>0 GROUP BY A.STOCKCODE, A.Location, A.Lotno, A.ExpiryDate, A.SUPPLIER, A.FDATE, HAVING SUM(A.QTYIN-ISNULL(A.QTYOUT, 0))>0 ORDER BY A.Location asc
- ArticleCurrentStockTotals
SELECT STOCKCODE, SUM(QTYIN-ISNULL(QTYOUT, 0)) AS QTY, ORDID FROM FSTOCTOTAL(:ArticleID) A STOCKCODE B INNER JOIN (A.STOCKCODE=B.NAME ) WHERE QTYIN-ISNULL(QTYOUT, 0)>0 GROUP BY STOCKCODE, ORDID having SUM(QTYIN-ISNULL(QTYOUT, 0))>0 order by ORDID asc
-
ArticleCurrentCustomsStockTotals
SELECT STOCKCODE AS ST, SUM(QTY) AS QTY FROM FSTOCTOTALCC(:ArticleID) GROUP BY STOCKCODE HAVING SUM(QTY)<>0 ORDER BY stockcode asc
-
ArticleReservedStock
SELECT B.LOCATION, a.stockcode as SC, Sum(A.qty) as QTY, 'R-'+A.AVIZNO+' '+isnull(X.Comments,'') as STATUS FROM OUTDETAILS A INNER JOIN INVDETAILS B ON (B.ID = a.INVOICENO) and (B.ARTCODE = A.Artcode) INNER JOIN ARTICLE C ON (a.artcode=c.name) INNER JOIN OUT D (A.AVIZNO=D.AVIZ) LEFT OUTER JOIN CGROUP X on 'KG'+CAST(X.ID AS VARCHAR(15))=A.AVIZNO, WHERE (A.ARTCODE = :ArticleID) and isnull(pickedby, '')='' and isnull(A.TransactionType, 'xx') in ('ORD', 'KIT') and left(A.AvizNo,2)<>'M-' GROUP BY B.LOCATION, A.Stockcode, A.AVIZNO, X.Comments, X.ID UNION SELECT A.TransitLocation as Location, A.stockcode as SC, sum(a.qty) as QTY, 'P-'+A.AVIZNO+' '+isnull(X.Comments,'') as STATUS FROM OUTDETAILS A INNER JOIN INVDETAILS B ON (B.ID = a.INVOICENO) and (B.ARTCODE = A.Artcode) INNER JOIN ARTICLE C ON (a.artcode=c.name) LEFT OUTER JOIN CGROUP X on 'KG'+CAST(X.ID AS VARCHAR(15))=A.AVIZNO, WHERE (A.ARTCODE = :ArticleID) AND isnull(pickedby, '')<>'' AND isnull(checkedby, '')='' AND isnull(A.TransactionType, 'xx')='KIT' AND left(A.AvizNo,2)<>'M-' AND isnull(A.TransitLocation, '')<>'' GROUP BY A.TransitLocation, A.Stockcode, A.AVIZNO, X.Comments, X.ID ORDER BY Status
Needed Service Calls
StockControl.PartialMove
Needed for various actions.
StockControl.ClearStock
Needed for ClearStock action.
StockControl.StockCorrection
Needed for StockCorrection action.
Reports
- ArticleMoves When asked, the ArticleMovesParameters dialog is shown toget the parameters.
- ArticleCCTransactions
- DetailedArticleStock Before printing this report, use ArticleMovesParametersForm popup to get from and to dates. (AllowShowAllMoves must be False)
- ArticleLabel Before printing this, the number of copies is requested and passed on to the reporting engine.