Ga naar inhoud

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

  1. Form accepts an article ID.
  2. Label displays article code.
  3. Label displays article description.
  4. Grid to display ArticleCurrentStock view for current article.
  5. Label to display total qty of ArticleCurrentStock view.
  6. Label to display record count of ArticleCurrentStock view.
  7. Grid to display ArticleCurrentStockTotals view for current article.
  8. Grid to display ArticleCurrentCustomsStockTotals view for current article.
  9. Label to display total qty of ArticleCurrentCustomStockTotals view.
  10. Grid to display ArticleReservedStock view for current article.
  11. Button to execute MovePartialQuantity action.
  12. Button to execute TransferArticleCode action.
  13. Button to execute ClearStock action.
  14. Button to execute StockCorrection action.
  15. Button to execute ChangeLotNo action.
  16. Button to execute KitArticles action.

MovePartialQuantity

  1. Enabled when Qty>0
  2. When executed, shows the MovePartialQuantity Dialog
  3. Current stock record data is passed on to the form.
  4. If the dialog is closed with mrOK, then the StockControl.PartialMove call is executed.
  5. AdaptOutCC is set to true if both from/to stockcode equal 75
  6. AdaptINVCC is set to true if From stockcode<> 75 and to stockcode= 75 (see unit43.buttonclick2 for other arguments)
  7. After return, refresh all views.

TransferArticleCode

  1. Enabled when there are stock records.
  2. When executed, shows the TransferArticles form.
  3. Current stock record data is passed on to the form.
  4. If the dialog is closed with mrOK, then the StockControl.PartialMove call is executed.
  5. AdaptOutCC is set to true if to stockcodes equals 75
  6. AdaptINVCC is set to true if to stockcode equals 75 (see unit132.BitBtn1Click for other arguments)
  7. After return, refresh all views.

ClearStock

  1. Enabled when there are stock records.
  2. When executed, asks for a quantity to be cleared.
  3. When a strictly positive quantity is entered, the StockControl.ClearStock server call is executed.
  4. After return, refresh all views.

StockCorrection

  1. Enabled when there are stock records.
  2. When executed, shows the ArticleStockCorrection form.
  3. Current stock record data is passed on to the form.
  4. 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.
  5. After return, refresh all views.

CCStockCorrection

  1. Always enabled.
  2. When executed, shows the ArticleCCStockCorrection form.
  3. 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.
  4. After return, refresh all views.

ChangeLotNo

  1. Enabled if there is an article and there is stock.
  2. When executed shows the ChangeLotNo dialog. All values are filled in from current stock record.
  3. When the dialog is closed, the Stockcontrol.ChangeLotNo service call is executed.
  4. After return, refresh all views.

KitArticles

  1. Enabled if there is an article.
  2. 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

  1. ArticleMoves When asked, the ArticleMovesParameters dialog is shown toget the parameters.
  2. ArticleCCTransactions
  3. DetailedArticleStock Before printing this report, use ArticleMovesParametersForm popup to get from and to dates. (AllowShowAllMoves must be False)
  4. ArticleLabel Before printing this, the number of copies is requested and passed on to the reporting engine.