Ga naar inhoud

Form AddInvoiceToReturnForm

  • Unit name: Forms.AddInvoiceToReturn
  • Form name: TAddInvoiceToReturnForm
  • Old form name: form51 (unit51) of scanner application

Synopsis

Dialog to collect data about invoices to be added to a return.

Functionalities

  1. Checkbox: Not picked up. The article grid is read-only if the 'Not picked up' checkbox is checked.
  2. Edit: Invoice number. On enter key, execute search action. On change, clear search result.
  3. Button to execute search action.
  4. Panel with return details (disabled if "not picked up" or no search):
  5. Checkbox: Prepaid
  6. Date edit: Prepaid Date. (disabled if not picked up)
  7. Checkbox: Special Instructions (disabled if not picked up)
  8. RadioGroup: Duty Free/Duty cleared (disabled if not picked up)
  9. Dropdown: return reason (view ReturnReasonList) (disabled if not picked up)
  10. Button to execute AddInvoice action.
  11. Pagecontrol with 2 tabsheets
  12. Article details.
    1. Grid with articles for invoice.
      • The grid is read-only if the 'Not picked up' checkbox is checked.
      • Color lines:
        • Red for Damaged (D)
        • Green for Returned (Y)
        • Normal color for not returned. (N)
      • Clicking a line rotates between the colors/status.
  13. Already added invoices
    1. Listbox with list of added invoice numbers. Read-only.
    2. Button to execute RemoveInvoice action.
  14. Button to execute OK action
  15. Button to execute Cancel action
  16. Property Invoices : TAddInvoiceToReturnDescriptorArray
  17. Property StockCode : String (set when form is created by caller)

Actions

OK

  1. Enabled when there is at least 1 invoice added to the 'Invoices' property.
  2. When executed, calls service call Returns.AddInvoiceToReturn.
  3. if call returns without error, closes the dialog with modal result mrOK

Cancel

  1. Always enabled
  2. When executed, closes the dialog with modal result mrCancel
  1. Enabled when the invoice number is not empty.
  2. When executed, calls service Returns.FindInvoiceForReturn. if the result is unknown, detail panel is disabled, and an exception is raised:
    Invoice :InvoiceCode is unknown.
    
  3. Depending on the invoice source, the articles grid is filled with the ReturnLastYearInvoiceDetails or ReturnThisYearInvoiceDetails views.
  4. The details panel is enabled.
  5. Enable/disable prepaid combobox if AllowPrepaid is true. (set unchecked if not allowed)
  6. List of return reasons is filtered on country.

RemoveInvoice

  1. Enabled when an invoice is selected in the listbox with added invoices.
  2. When executed, removes the selected invoice from the array of invoices and from the listbox.

AddInvoice

  1. Enabled when there is an invoice of known source.
  2. When executed, selected invoice is added to 'Invoices' array using FileID and source.
  3. Selected invoice is added to listbox.
  4. If not picked up, details are:
    • Date is today.
    • Stockcode is 75
    • CustomsClearedCode is 99
    • Prepaid is false
    • Special instructions is false.
    • Return reason as determined by search.
  5. If picked up, enter details as provided by user in panel:
    • Date from date picker.
    • Stockcode as determined by property.
    • CustomsClearedCode is 25/99 depending on customs cleared or duty free.
    • Special Instructions from checkbox
    • Prepaid from checkbox and articles
  6. Clear edit box, disable panel with details, clear article grid: reset form for new search.

Tables/Views

ReturnThisYearInvoiceDetails

SELECT
  B.SeqNo as SQ, B.skuID As Artcode, B.itemQty as Qty, 'Y' as ST, B.ID
FROM
  DBPrefix.GR_PRINTFILE_INVOICE A,
  INNER JOIN DBPrefix.GR_PRINTFILE_INVOICE_ITEMS B ON
    (A.InvoiceNumber=B.InvoiceNumber)
    AND (A.FILEID=B.FILEID)
WHERE
  (A.FILEID=:FileID)
  AND (A.InvoiceNumber = :InvoiceCode)
ORDER BY
  SQ asc

ReturnLastYearInvoiceDetails

SELECT
  '0' as SQ, B.skuID As Artcode, B.itemQty as Qty, 'Y' as ST, ID
FROM
  DBPrefix.LCWExtractPreviousYear B
WHERE
  (B.InvoiceNumber = :InvoiceCode)
ORDER BY
  SQ asc

Needed Service Calls

Returns.FindInvoiceForReturn

Returns.AddInvoiceToReturn

(only for OK)

Reports