﻿// activate for JavaScript debugging:
//ProcessingOption debugJS="On"

SelectFile name="va01_pdf_url" filter="*.pdf" directory="F:\orders"

if not V[va01_pdf_url]
  Return "E: No file selected!"
endif

StatusMessage title="PDF Import" addString="Uploading file..."

// read pdf
CallJS va01_pdf_sourceid = PDFguixt.getSourceId "&V[va01_pdf_url]"
StatusMessage addString="Acquired source ID"

CallJS va01_pdf_lang = PDFguixt.sendMessageToChatPDF "&V[va01_pdf_sourceid]" "What is the language of the item descriptions? Only include the uppercase two letter ISO-639 code of the language in your reply."
CallJS va01_pdf_soldacct = PDFguixt.sendMessageToChatPDF "&V[va01_pdf_sourceid]" "What is the account number of the customer the order is to be sold to? Only include the number without line breaks in your reply."
CallJS va01_pdf_shipacct = PDFguixt.sendMessageToChatPDF "&V[va01_pdf_sourceid]" "What is the account number of the customer the order is to be shipped to? Only include the number without line breaks in your reply."
CallJS va01_pdf_soldto = PDFguixt.sendMessageToChatPDF "&V[va01_pdf_sourceid]" "What is the address the order is to be sold to? Only include the address without line breaks in your reply."
CallJS va01_pdf_shipto = PDFguixt.sendMessageToChatPDF "&V[va01_pdf_sourceid]" "What is the address the order is to be shipped to? Only include the address without line breaks in your reply."
CallJS va01_pdf_name1 = PDFguixt.sendMessageToChatPDF "&V[va01_pdf_sourceid]" "What is the name of the company? Only include the name without line breaks in your reply."
CallJS va01_pdf_ordernum = PDFguixt.sendMessageToChatPDF "&V[va01_pdf_sourceid]" "What is the order number? Only include the number without line breaks in your reply."
CallJS va01_pdf_cref = PDFguixt.sendMessageToChatPDF "&V[va01_pdf_sourceid]" "What is the customer reference? Only include the reference without line breaks in your reply."
StatusMessage addString="Acquired singular data"
CallJS va01_pdf_items = PDFguixt.sendMessageToChatPDF "&V[va01_pdf_sourceid]" "Return the ID, quantity, unit and description of each item, listing only the values, row by row, separating each value with only one LF character. Treat unit and quantity as individual values."
StatusMessage -remove

Return
