Ga naar inhoud

Receptiondifferences

Form ReceptionDifferencesForm

  • Unit name: Forms.ReceptionDifferences
  • Form name: ReceptionDifferencesForm
  • Old form name: Uni12 (form12)

Synopsis

Form to show differences in reception and invoice.

Functionalities

  1. Form accepts invoice id/invoice code as parameters
  2. First Grid shows differences on scans: ScanDifferences view.
  3. Second grid shows scan details for invoice, filtered on selected record of ScanDifferences view. see Reception form.
  4. Below second grid Button to execute DeleteScanRecord Action.

Actions

DeleteScanRecord

  1. Only active if there is a record, and the date of the current record is the current day.
  2. When executed, ask for confirmation, and delete the current record.

Tables/Views

  • ScanDifferences

    With A as (
      SELECT
        INVOICE, ARTCODE, STOCKCODE, SUM(qtyin) AS QTY, LOTNO
      FROM
        INVDETAILSOP
      WHERE
        INVOICE=:Invoice
      GROUP BY
        INVOICE, ARTCODE, STOCKCODE, LOTNO
    ),
    B as (
      select
        ID, INVDETAILSOP.artcode, INVDETAILSOP, INVDETAILSOP.LOTNO
      from
        INVDETAILSOP  
      where  
        INVDETAILSOP.INVOICE=:Invoice
    )
    SELECT
      A.INVOICE, A.ARTCODE as ART, A.STOCKCODE as DEP, A.QTY as QTYIN, isnull(SUM(B.QTY), 0) as qtyx, A.Lotno
    FROM
      INVDETAILSOPSUM A
      LEFT OUTER JOIN SCANIN B ON
        (A.INVOICE=B.INVOICE)
        and (A.ARTCODE=B.ARTCODE)
        and A.STOCKCODE=B.STOCKCODE
        and isnull(A.LOTNO, '')=isnull(B.LOTNO, '')  
    GROUP BY
      A.INVOICE, A.ARTCODE, A.STOCKCODE, A.QTY, A.LOTNO
    HAVING
      A.QTY-isnull(SUM(B.QTY), '0')<>'0'
    UNION
    SELECT
      SCANIN.invoice, SCANIN.artcode as ART, SCANIN.stockcode as DEP, '0' as QTYIN, sum(qty) as qtyx, SCANIN.LOTNO
    from
      SCANIN
      LEFT JOIN B ON
        (A.INVOICE=B.INVOICE)
        and (A.ARTCODE=B.ARTCODE)
        and (A.STOCKCODE=B.STOCKCODE)
        and (A.LOTNO=B.LOTNO)  
    WHERE
      (SCANIN.INVOICE=:Invoice)
      (B.ID is null)
    GROUP BY  
      SCANIN.invoice, SCANIN.artcode, SCANIN.stockcode, SCANIN.LOTNO
    ORDER BY
      ART, Stockcode
    

  • ScanIn Filtered on current article and invoice.

Needed Service Calls

None.

Reports

None.