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
- Checkbox: Not picked up. The article grid is read-only if the 'Not picked up' checkbox is checked.
- Edit: Invoice number. On enter key, execute search action. On change, clear search result.
- Button to execute search action.
- Panel with return details (disabled if "not picked up" or no search):
- Checkbox: Prepaid
- Date edit: Prepaid Date. (disabled if not picked up)
- Checkbox: Special Instructions (disabled if not picked up)
- RadioGroup: Duty Free/Duty cleared (disabled if not picked up)
- Dropdown: return reason (view ReturnReasonList) (disabled if not picked up)
- Button to execute AddInvoice action.
- Pagecontrol with 2 tabsheets
- Article details.
- 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.
- Grid with articles for invoice.
- Already added invoices
- Listbox with list of added invoice numbers. Read-only.
- Button to execute RemoveInvoice action.
- Button to execute OK action
- Button to execute Cancel action
- Property Invoices : TAddInvoiceToReturnDescriptorArray
- Property StockCode : String (set when form is created by caller)
Actions
OK
- Enabled when there is at least 1 invoice added to the 'Invoices' property.
- When executed, calls service call Returns.AddInvoiceToReturn.
- if call returns without error, closes the dialog with modal result mrOK
Cancel
- Always enabled
- When executed, closes the dialog with modal result mrCancel
Search
- Enabled when the invoice number is not empty.
- When executed, calls service Returns.FindInvoiceForReturn.
if the result is unknown, detail panel is disabled, and an exception is raised:
Invoice :InvoiceCode is unknown.
- Depending on the invoice source, the articles grid is filled with the ReturnLastYearInvoiceDetails or ReturnThisYearInvoiceDetails views.
- The details panel is enabled.
- Enable/disable prepaid combobox if AllowPrepaid is true. (set unchecked if not allowed)
- List of return reasons is filtered on country.
RemoveInvoice
- Enabled when an invoice is selected in the listbox with added invoices.
- When executed, removes the selected invoice from the array of invoices and from the listbox.
AddInvoice
- Enabled when there is an invoice of known source.
- When executed, selected invoice is added to 'Invoices' array using FileID and source.
- Selected invoice is added to listbox.
- 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.
- 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
- 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)