Ga naar inhoud

Form ReceptionForm

  • Unit name: Forms.Reception
  • Form name: TReceptionForm
  • Old form name: Form2

Synopsis

This form controls reception of articles from suppliers. It allows to view and add articles to the stock manually, or import articles from files.

Functionalities

  1. The form displays a list of articles of a particular invoice in a (read-only) grid. (For a list of columns, see Form2, unit22)
  2. The form has a published property 'InitialInvoice' (String).
    If non-empty, it will set the necessary parameters (supplier, invoice)
    and show the selected invoice when the form is shown.
  3. A panel allows to select or create the invoice in the following manner:
  4. Supplier The suppliers can be selected from a combobox.
    When a supplier is selected, the invoices dropdown is filled with invoice numbers.
    The invoices are sorted on descending date.
  5. Invoice Here an invoice of the selected supplier can be entered or selected.
    The invoices can be selected by number from a combobox, which is filled with all
    invoices from the supplier of the last month, not starting with one of
    • COR-
    • COR+
    • M-0
    • M-1
  6. A 'Search' button activates the Search action.
  7. Pressing 'Enter' in the invoice combobox will execute the search action.
  8. A 'All' button activates the ShowAll action.
  9. The article grid can further be filtered on:
  10. Article code Selectable from a dropdown.
  11. A button allows to execute AddArticle action.
  12. A button allows to execute the 'DeleteInvoice' action.
  13. A button allows to execute the 'DeleteRow' action.
  14. A button allows to execute the 'ConfirmReception' action.
  15. A button allows to execute the 'ChangeLocation' action.
  16. A button allows to execute the 'ChangeArticleQuantity' action.
  17. A button allows to execute the 'SaveToCSV' action.
  18. A button allows to execute the 'SaveToExcel' action.
  19. A report 'Unloading List' (see form16) must be printable in the form. The invoice's supplier/invoice/id are passed as parameters to the report.
  20. A report 'Pallet label' (see form133) must be printable in the form. The invoice's supplier/invoice/id are passed as parameters to the report.

Actions

  • The button can only be used if a supplier and invoice were entered.
  • This will locate the INV record and show the details.
  • If none is found, the program offers to create one, and if the user confirms, action CreateInv is executed.

ShowAll

  1. An 'All' button displays a modal dialog where a list of all invoices of the last year is shown.
  2. The list is sorted on invoice (ascending) or date (descending)
  3. The sort order is easily selectable using a radiobutton.
  4. a checkbox 'All years' removes the filter on year.
  5. An invoice can be selected using double click or 'OK' button, and the supplier and invoice are entered in the respective comboboxes.

CreateInv

  1. Only active if a supplier was selected
  2. When executed, shows a dialog with
  3. a message asking the user if he wants to create an invoice,
  4. A date picker to allow entering a date for the invoice.
  5. The date is set to today by default.
    The invoice is created with the CreateInvoice call.
  6. If an invoice is selected/created, the articles in the invoice are displayed in the grid.

AddArticle

Allows to add an article line to the invoice. 1. Only active when an invoice is displayed. 2. When executed, pops up a stay-on-top Add Dialog. The add dialog is initialized with the values of the filter fields. 3. On add, a record with the entered values is added to the invoice.

DeleteInvoice

Deletes the currently displayed invoice. 1. Only active when an invoice is shown. 2. The program asks for a confirmation from the user. 3. When user confirms, the service call Stock.DeleteInvoice is executed. 4. if the call was successful, the display is refreshed: 1. clear the invoice selection 2. clear grid.

DeleteRow

The selected row(s) in the grid can be deleted.
1. Only active when one or more rows are selected in the invoice details. 2. When executed, asks the user for a confirmation.
3. if the user confirmed, the rows are deleted using the Stock.DeleteInvoiceArticles call. 4. After the call was successful, the grid is refreshed.

ConfirmReception

This confirm the quantities. 1. Only active if the article grid contains data. 2. When executed, it asks the user for for confirmation. 3. If the user confirms, it calls 'Stock.ConfirmQuantities' 4. The grid is refreshed after the call returned. (regardless of errors)

ChangeLocation

change the location for the currently selected records. 1. Only active when there are selected article records in the grid. 2. When executed, asks for a new location. 3. When user selected a location, the location is checked for existence: it must exist. 5. If it exists, it is entered in the selected records. 6. Changes are pushed to the server.

ChangeArticleQuantity

allows to set the quantity of the current record 1. Active only if 1 article record is selected. 2. Before prompting for a new value, the program checks whether there any OUTDETAILS records associated with the record. If any such records exist, an error message is shown with the connected records. 3. After the user has entered a new (positive) value, the quantity for the current field is updated. (sample code see unit2 TForm2.BitBtn1Click)

SaveToCSV

Creates a CSV file with the contents of the invoice. 1. Only active when the article list is not empty.
2. When executed, a CSV is created with the following data:

SELECT
  A.INVOICE as Reception, B.InvoiceID as ReceptionID, A.ArtCode as ArticleCode,
  sum(A.QTYIN) AS InitQTY, sum(A.QTY) as RealQty, Max(A.ID) AS Row_ID,
  B.FILLDATE as SystemDate,  A.Stockcode, A.ExpiryDate, A.LotNo,
  A.TransactionType, B.SUPPL  as Supplier
from
  INVDETAILS A
  INNER JOIN INV B on (B.INVOICE=A.INVOICE)
WHERE
  (B.INVOICE=:invoice) and (B.SUPPL=:Supplier)
group by
  A.INVOICE, B.InvoiceID, A.ARTCODE, B.FILLDATE, A.Stockcode,
  A.ExpiryDate, A.LotNo, A.TransactionType, B.Suppl
order by
  A.INVOICE, ROW_ID
3. The name of the file by default is 'R-'+Invoice code+'.csv'

SaveToExcel

creates an excel file with the contents of the invoice.

  1. Only active when the article list is not empty.
  2. When executed, an excel file is created with the following data:
SELECT
  A.INVOICE, sum(A.qty) as QTY, A.ARTCODE AS ARTICLE,
  C.NAME2 AS DESCRIPTION, A.LOCATION, A.STOCKCODE, A.LOTNO, A.EXPIRYDATE
FROM
   INVDETAILS A
   INNER JOIN INV B on (B.INVOICE=A.INVOICE)
   INNER JOIN ARTICLE C on (A.ARTCODE=C.NAME )
WHERE  
   (B.INVOICE=:Invoice) and (B.SUPPL=:Supplier)
GROUP BY
  A.INVOICE,  A.ARTCODE ,  C.NAME2, A.LOCATION,
  A.STOCKCODE, A.LOTNO, A.EXPIRYDATE
ORDER BY
  A.ARTCODE

Tables/Views

  • StockCode for filtering on StockCode
  • Suppliers for filtering on Supplier
  • INV For filtering on invoice
  • Article For the list of articles being displayed.
  • LOCATION For the list of valid locations.
  • OUTDETAILS For the list of connected outdetails actions.

Needed Service Calls

Stock.CreateInvoice()

Used to create a new invoice.

Stock.DeleteInvoice()

Used to remove an invoice and its details.

Stock.AddArticleToInvoice()

Used to add an article to an invoice.

Stock.DeleteInvoiceArticles()

Used to delete one or more articles from an invoice.

Reports

  1. PaletteLabel
  2. UnloadingList