Main Web API Documentation Information
Actual Page/Function Name:
advancedMainInvoiceSearch
Human Readable Name or Caption:
Advanced Main Invoice Search
Page/Function Description:
This method will search main invoice details.
Page/Function Output Type:
API - JSON or WDDX
Categories:
eComm,invoice,reports
Extra Page/Function Notes:
This method is used to look up invoice histories and main invoice details. It's very handy for sales data and/or looking for specific events per customer or time period. This report also has two different options: details or grouped data.


Parameters
Scope Name Type Default Description Required Alternates Known Values
Arguments ALL_MONIES String Pass in a blank value for all, 1 for verified, and 0 for non-verified. No
Arguments CORP_ID Numeric 0 Pass in the corp id number. This is your corporation ID or your business world number. This is required and will be validated. The default is 0, but will be checked for a real number. Yes
Arguments CUSTOMER_NAME_FILTER String Pass in the customer name filter. This is a buddy argument with the starting letter type. If text is used, it will filter on part of the business name, first name, or last name. If an id is used, it will also try to match it according to the customer id. No
Arguments DATE_TYPE Numeric 1 Pass in a 1 for invoice date and a 2 for verified date. The default is 1. This is when the invoices are created. The verified dates are primarily used for payroll or when everything has been fully processed and recorded. No
Arguments END_INVOICE_NUMBER String Pass in the ending invoice number filter. This is a buddy argument with the start invoice number. These will only be used as a filter if both are numeric. Example: 1000 to 1500 or invoice 10 to 10 (this is how you pull just one record). No
Arguments EXTERNAL_PO_NUMBER String Pass in the external customer PO number filter. No
Arguments FROM_DATE String All Pass in the from invoice date filter. This is ok to leave blank if you want to include everything. If both the from date and to date are actual dates, they will be used. Otherwise they will be skipped. No
Arguments INVOICE_AMOUNT String Pass in the invoice amount filter. This is a buddy argument with the invoice amount match. It will be completely skipped if it's blank, but if it is numeric, it will be used. No
Arguments INVOICE_AMOUNT_MATCH Numeric 0 Pass in a 0 for exact, 1 for greater than, 2 for less than. This is a buddy argument with the invoice amount argument. No
Arguments INVOICE_NOTES String All Pass in the non-printing invoice notes filter. No
Arguments INVOICE_TYPE_ID String 1 Pass in the invoice type id filter. Ok to pass in a list of id numbers as well. 2=Customer Invoice, 3=Counter Sale, 4=Rental Ticket, 5=Internal-Repair, 6=Transfer, 7=Quote, 8=Transition Invoice. No
Arguments MAIN_SORT_BY String invoice_desc Pass in the main sort by value. This is how the main results will be sorted. Use the following strings: invoice_asc, amount_desc, amount_asc, customer_biz, customer_last, customer_first, date_desc, date_asc, location No
Arguments PAID_SWITCH Numeric 1 Pass in a 1 for all activity, 2 for paid in full, and 3 for outstanding invoices. No
Arguments PAYROLL_STATUS_ID Numeric 1 Pass in the payroll status id number. The default is 1, which means all or skip. These id numbers can be found by using the getLookUpValues method. Make sure to pass in the table name as payroll_status and the optional param as your corp id. No
Arguments PRINTABLE_INVOICE_NOTES String All Pass in the printable invoice notes filter. This field has a maximum of 255 characters. No
Arguments REPORT_TYPE Numeric 1 Pass in a 1 for details and a 2 for customer groups. Yes
Arguments SALESPERSON_ID Numeric 1 Pass in the salesperson id filter. This is actually payee ids who are assigned as the main salesperson. If this filter is not needed, pass in a 1 and it will be skipped. No
Arguments START_INVOICE_NUMBER String All Pass in the starting invoice number filter. This is a buddy argument with the end invoice number. These will only be used as a filter if both are numeric. Example: 1000 to 1500 or invoice 10 to 10 (this is how you pull just one record). No
Arguments STARTING_LETTER_TYPE Numeric 4 Pass in a 1 for business name, 2 for last name, 3 for first name, 4 for any name, and 5 for a customer id filter. Default is 4. This is a buddy argument with the customer name filter. No
Arguments STOCK String All Pass in a stock number if applicable. Use 0 if not applicable. As a note, a stock unit is a big ticket item like a vehicle, trailer, house, gun, or some other serialized item. This is a buddy tag with the stock type argument. The default is 0. No
Arguments STOCK_TYPE String units Pass in the stock type filter. You can use the string "units" to look in the line items, or if you leave this blank, it will assume that it's looking for an internal repair tied to a stock unit. The default is blank. No
Arguments STORE_ID Numeric 1 Pass in the store or location id number. This value is corporation specific and can be looked up by going to the getGeneralLookupValues method. You'll be looking for the QRY_LOCATION_INFO_ARRAY data. If this filter is not needed, use the value "1". No
Arguments TO_DATE String All Pass in the to date filter. This is ok to leave blank if you want to include everything. If both the from date and to date are actual dates, they will be used. Otherwise they will be skipped. No


Results
RET_STATUS RET_MAIN_MESSAGE RET_SECOND_MESSAGE Redirect Link Description
dataIn Please choose a report. Pass in a 1 for details and a 2 for customer groups. Use your back button and try again. This is returned if a report type has not been selected.
dataIn Unable to get a list of invoices. Missing some data Use your back button and try again. This is returned if the required arguments (corp id, date type, paid switch, or report type) are missing.
db Unable to connect to the database. Missing a list of invoices that matched your search. Use your back button and try again. This is a catch for any errors that occur while querying for the details report.
ok(1) success This is returned if we were able to successfully query the details report.
Name Type Description Notes
QRY_INVOICES_ARRAY Array This array contains the invoices. This holds data like all monies, customer id, po number, invoice amount, invoice date, notes, paid status, paid date, store id, etc.
TOTAL_SALES Numeric This is the sum of all the invoice amounts. See description.
NEW_SALES Numeric This is the sum of the invoice amounts for the new sales. See description.
PENDING_SALES Numeric This is the sum of the invoice amounts for the pending and on order sales. See description.
OKED_SALES Numeric This is the sum of the invoice amounts for OKed sales. See description.
QRY_LINE_ITEMS_ARRAY Array This array contains the line items for the receipts. This has the extended line total and the invoice number.
QRY_PAYMENTS_ARRAY Array This array contains the payments for the invoices. This contains the total amount paid and the invoice number.
db2 Unable to connect to the database. Missing a list of grouped invoices that matched your search. Use your back button and try again. This is a catch for any errors that occur while querying for the customer invoice groups report.
ok(2) success Assumes that everything went well with querying the customer invoice groups report.
Name Type Description Notes
QRY_GROUPED_INVOICES_ARRAY Array This array contains all the normal customer invoices and/or transition invoices grouped by customer id. This contains an invoice count, a total amount, customer id, business name, customer name, etc.
QRY_PAYMENTS_ARRAY Array This array contains the payments for the invoices. This contains the total amount paid and the invoice number.
COUNTER_SALE_NAME String This is the counter sale name. The default is "Counter Sales".
COUNTER_SALE_COUNT Numeric This is the invoice count for the counter sales. See description.
COUNTER_SALE_TOTAL Decimal This is the total of invoice amounts for counter sales. See description.
COUNTER_SALE_PAYMENTS Decimal This is the total amount paid for the counter sales. See description.
COUNTER_SALE_DIFF Decimal This is the total amount unpaid for counter sales. This is found by subtracting the counter sale payments from the counter sale total.
INTERNAL_TICKET_NAME String This is the internal ticket name. The default is "Internal-Repairs".
INTERNAL_TICKET_COUNT Numeric This is the invoice count for the internal-repair tickets. See description.
INTERNAL_TICKET_TOTAL Decimal This is the total of invoice amounts for the internal-repair tickets. See description.
INTERNAL_TICKET_PAYMENTS Decimal This is the total amount paid for the internal-repair tickets. See description.
INTERNAL_TICKET_DIFF Decimal This is the total amount unpaid for internal-repair tickets. This is found by subtracting the internal tickets payments from the internal tickets total.
TRANSFER_TICKET_NAME String This is the transfer ticket name. The default value is "Transfers".
TRANSFER_TICKET_COUNT Numeric This is the invoice count for the transfer tickets. See description.
TRANSFER_TICKET_TOTAL Decimal This is the total of invoice amounts for transfer tickets. See description.
TRANSFER_TICKET_PAYMENTS Decimal This is the total amount paid for the transfer tickets. See description.
TRANSFER_TICKET_DIFF Decimal This is the total amount unpaid for transfer tickets. This is found by subtracting the transfer ticket payments from the transfer ticket total.
GENERAL_TICKET_NAME String This is the general ticket name. The default is "General Invoices".
GENERAL_TICKET_COUNT Numeric This is the invoice count for the customer (general) invoices. See description.
GENERAL_TICKET_TOTAL Decimal This is the total of invoice amounts for the customer (general) invoices. See description.
GENERAL_TICKET_PAYMENTS Decimal This is the total amount paid for the customer (general) invoices. See description.
GENERAL_TICKET_DIFF Decimal This is the total amount unpaid for customer (general) invoices. This is found by subtracting the general invoices payments from the general invoices total.
GRAND_TOTAL_NAME String This is the grand total name. The default is "Grand Total".
GRAND_TOTAL_COUNT Numeric This is the grand total invoice count for the counter sales, internal-repair tickets, transfer tickets, and the general invoices. See description.
GRAND_TOTAL_TOTAL Decimal This is the total of invoice amounts for the counter sales, internal-repair tickets, transfer tickets, and the general invoices. See description.
GRAND_TOTAL_PAYMENTS Decimal This is the total amount paid for the counter sales, internal-repair tickets, transfer tickets, and the general invoices. See description.
GRAND_TOTAL_DIFF Decimal This is the total amount unpaid for counter sales, internal-repair tickets, transfer tickets, and the general invoices. This is found by subtracting the payments from the total.


Samples
Caption Text
JSON
{"API_CALL_FUNCTION_NAME": "advancedMainInvoiceSearch","CUSTOMER_NAME_FILTER": "","REPORT_TYPE": 1,"FROM_DATE": "All","STOCK_TYPE": "units","TO_DATE": "All","API_INPUT_OUTPUT_TYPE": "JSON","SALESPERSON_ID": 1,"STARTING_LETTER_TYPE": 4,"STOCK": "All","INVOICE_TYPE_ID": 1,"STORE_ID": 1,"PRINTABLE_INVOICE_NOTES": "All","INVOICE_AMOUNT_MATCH": 0,"API_USER_PASSWORD": 1234,"API_URL_ENCODING": "AUTO","INVOICE_NOTES": "All ","MAIN_SORT_BY": "invoice_desc","PAID_SWITCH": 1,"CORP_ID": 53,"API_CURRENT_PAYEE_ID": 3,"DATE_TYPE": 1,"END_INVOICE_NUMBER": "All","API_USER_NAME": "demo","API_CORP_KEY_ID": "PLA-0053","START_INVOICE_NUMBER": "All","INVOICE_AMOUNT": "All","PAYROLL_STATUS_ID": 1,"ALLMONIES": "","EXTERNAL_PO_NUMBER": "All"}