build_deduction_dispute
ChatGPTUse this when the user wants to dispute or query one deduction from an X12 820 or EDIFACT REMADV, or ask why an invoice was paid short with no reason code. Give the remittance and the deduction's id from read_edi_remittance (a1, a2...), or its debit memo or invoice reference. Optionally add the 850 and 856 for that order: the dispute then states PO dates and when the ASN was sent against them. Returns how this kind of deduction is handled, a verdict when the facts support the payer, how the amount compares with any published fee, an evidence checklist and an email draft. The draft disputes only when the facts support the supplier; for agreed allowances it asks for the payer's calculation, for a short pay with no reason code it asks for the reason. Nothing is sent. It needs the 820 or REMADV. For a deduction known only from a portal, PDF or spreadsheet, call explain_deduction and draft the dispute from its evidence list and the facts the user confirms.
calculate_uk_late_payment_interest
ChatGPTUse this when a UK business was paid late, or is still waiting to be paid, by another business and wants the statutory interest and fixed compensation it can claim under the Late Payment of Commercial Debts (Interest) Act 1998. It applies the correct Bank of England base rate for each debt's six-month period from a dated table, adds 8%, calculates daily simple interest, and adds the £40/£70/£100 fixed sum per invoice. For unpaid invoices leave out paid_date: interest is counted to today and the result says how much accrues each day. Accepts up to 50 invoices; pass invoice numbers when known. Not for consumer debts, non-UK debts, or contracts that set their own late payment rate.
check_edi_for_retailer
ChatGPTUse this when someone asks whether an EDI document (X12, EDIFACT or TRADACOMS) meets a specific retailer's or network's requirements, for any of 34 retailers including Walmart, Target, Kroger, Costco, Amazon, Home Depot, Tesco, Sainsbury's and Asda. Runs the same structural checks as validate_edi_document first (counts, control numbers, check digits, totals), then checks the standard and document type against what the retailer trades, and the rules OrderSync's published requirement summary supports (SSCCs on ASNs, lot and expiry data, GS1 item numbers, PO references on invoices), plus field rules for Walmart, Target, Amazon and Costco. It is OrderSync's summary, not the retailer's implementation guide. Without a named retailer, use validate_edi_document.
check_gs1_identifiers
ChatGPTUse this to validate or correct UPC, EAN, GTIN-8/12/13/14, GLN or SSCC numbers, for example before putting them on a purchase order, ASN or carton label, or to clean a spreadsheet column of them. Reports whether each check digit is right and the recalculated value when it is wrong, groups a long list by cause with row numbers and duplicates, and recognises spreadsheet damage: UPCs that lost leading zeros and numbers turned into scientific notation. Also adds the check digit to number bodies (mode "add_check_digit") and builds case or inner-pack GTIN-14s from unit UPCs/EANs (pack_indicator 1 to 8). Accepts up to 500 numbers at once. It checks the arithmetic only; it does not look up who owns a number. To make new SSCCs use generate_sscc_numbers; for printable labels use create_sscc_labels_pdf.
check_uk_eu_trading_partner
ChatGPTUse this when someone wants to vet a UK or EU supplier or customer: whether their VAT number is registered, whether they have a valid EORI number for customs, and whether they are on the Peppol network (so they can receive e-invoices and electronic orders). Give a VAT number, an EORI number, or both. A UK VAT number also checks the usual EORI (GB + VAT number + 000), and that EORI implies the VAT number; in Ireland, Belgium, Spain, Italy and Portugal the EORI is documented as the VAT number, so it is checked too. Elsewhere (France, Germany, the Netherlands...) ask for the EORI. EU and Northern Ireland (XI) VAT is checked live in EU VIES; UK (GB) VAT is format-checked only here, not looked up at HMRC, and the result links to HMRC's checker. GB EORI is checked at HMRC, EU and XI EORI in the EU EOS service, Peppol in the SML and SMP. Results are live registry answers at the time of the check. A registry that is down is reported as unavailable, not as invalid. Does not check company credit, sanctions or Companies House.
compare_edi_documents
ChatGPTUse this to check documents for the same order against each other: a purchase order against its change (860/ORDCHG) or acknowledgment (855/ORDRSP), or the 3-way match of purchase order, ship notice (856/DESADV) and invoice (810/INVOIC). Matches lines by item and line number and reports quantity, price, unit and missing-line differences in plain words, such as short shipments and invoices that bill more than shipped. Takes two or three documents as text, one transaction each.
convert_julian_date
ChatGPTUse this when someone asks what a Julian date or lot code on a product means (24297, 4297, L24297 B2, 2024297, a JD Edwards CYYDDD date), what today's Julian date is, how to write a date as a Julian code, or what the best-by date is for a production date plus a shelf life. It reads the day of the year correctly in leap years, handles 1-digit years by choosing the decade (and says which other decades fit), separates plant or shift letters from the date, and lists other possible readings when the digits fit more than one format. Up to 500 codes or dates per call. Not for the astronomical Julian Day with a time of day, or for dates in the old Julian calendar.
create_sscc_labels_pdf
ChatGPTUse this when someone needs printable GS1-128 carton or pallet shipping labels (also called UCC-128 or SSCC-18 labels). Give either edi_856 (an X12 856 ASN, with or without its ISA envelope: one label per MAN*GM SSCC, pallets and cartons numbered separately, with addresses, carrier and PO taken from the file) or ssccs plus shipment details. If the user has neither an 856 nor SSCCs, ask for their GS1 Company Prefix and next serial and call generate_sscc_numbers first; never invent SSCCs. Reads X12 856 only, not an EDIFACT DESADV: for a DESADV pass its SSCCs and shipment details as ssccs and shipment. Returns a PDF (4x6 inch or A6, one label per page, up to 100 per PDF; for a longer shipment call again with from_label) to the user's viewer (pass embed_pdf only if the client needs the file itself). Barcode sizes follow the GS1 logistic label specification. It does not know a retailer's private label rules beyond that.
draft_edi_responses
ChatGPTUse this when a supplier has received an EDI purchase order (X12 850) and needs to reply: the 855 acknowledgment (accepts, changes or rejects the order lines), the 856 ship notice and the 810 invoice, and on request the 997 (the receipt that only confirms the file arrived in a readable format; it is not the 855). When the buyer has sent a PO change (860), pass it as change_edi_text with the original PO: the change is applied first (cancelled lines dropped, new quantities, prices and dates) and the replies follow the changed order. Lines can be accepted, backordered (in full or in part), changed (quantity or price) or rejected; the 856 and 810 follow those decisions. The 856 needs the supplier's GS1 company prefix to build SSCC carton numbers, and their ship-from name and address for compliant labels; it can be packed by carton or by pallet, with lot and best-by dates per line. Each draft gets its own control number; values the tool had to make up (control numbers, invoice and shipment numbers, dates) are listed as placeholders to replace. Every draft is validated with the same checks as validate_edi_document, and known retailer expectations (for example Walmart, Target, Kroger) are included. Returns the drafts as X12 text for the user to review and send through their own EDI provider. It does not send anything.
explain_deduction
ChatGPTUse this when the user asks why a customer charged or deducted an amount and has a deduction code, reason text or a line from a portal, PDF or spreadsheet, but no 820 or REMADV (for those use read_edi_remittance). Decodes X12 426 (ASC X9 TR 42) or EDIFACT 4465 adjustment reason codes, says how this kind of deduction is usually handled (agreed allowance, compliance fine, short delivery or price difference), lists the evidence that would reverse it, and, for retailers with a sourced chargeback schedule, the matching published fee with its source and date. It does not know the payer's dispute deadline or private terms.
explain_edi_document
ChatGPTUse this when someone asks what an EDI document is or says, the default for "what is this?" and "help me read this": the business meaning (document type, number, dates, parties, lines with statuses, totals) and what each segment means. Works for X12, EDIFACT and TRADACOMS, including a bare ST..SE fragment. For a printable PDF use render_edi_document; to check correctness use validate_edi_document; for acknowledgments use explain_edi_rejection; for remittances use read_edi_remittance.
explain_edi_rejection
ChatGPTUse this whenever the user has an acknowledgment from a trading partner (X12 997, 999, TA1 or 824 Application Advice, or EDIFACT CONTRL), whether it accepts or rejects, and wants to know what it means or what to fix. Several acknowledgments pasted together are read one by one. Decodes every AK3/AK4/AK5/AK9, IK3/IK4/IK5, TA1, OTI/TED and UCI/UCM/UCS/UCD code into plain English using the standard code lists. When the original document the acknowledgment answers is also given, it points each error at the exact segment and element in that document, shows the current value, and proposes the fix (for example the correct SE01 count or invoice total). It reads the acknowledgment only; it does not know partner-specific business rules beyond what the 824 says.
find_uk_commodity_code
ChatGPTUse this when someone needs the UK commodity code (tariff code, HS code) for goods they import, export or put on a commercial invoice or customs declaration. Give a product description (what it is, its material, its use: 'knitted cotton t-shirt') or a code of 4 to 10 digits. A description returns the closest matching declarable codes from the UK Trade Tariff's own search; a code returns every declarable code under its 4-digit heading with third country duty, VAT and the supplementary unit. Codes are 10 digits for UK imports and 8 for exports. tariff 'xi' reads the Northern Ireland tariff (EU duty rates; VAT is not listed there). Results are a guide, not a binding classification, and do not include preferential rates, quotas or licences; each code carries a GOV.UK link for those.
generate_997_acknowledgment
ChatGPTUse this when someone received an X12 document and needs the 997 functional acknowledgment, the technical receipt every X12 partner expects back. It is not the 855 purchase order acknowledgment (accepting, changing or rejecting lines): for that use draft_edi_responses, which can also include the 997 when someone is answering a purchase order. Swaps sender and receiver, acknowledges each transaction set, and rejects transactions with envelope errors (counts, control numbers, missing trailers). X12 only, one interchange and one functional group per call. Returns the 997 as text; it does not send anything.
generate_sscc_numbers
ChatGPTUse this before create_sscc_labels_pdf when the user has cartons or pallets but no SSCCs yet, or needs SSCC-18 numbers for 856 ASN MAN*GM segments. Builds consecutive SSCCs from a GS1 Company Prefix, an extension digit and the next unused serial reference (or the last SSCC already used), with correct check digits. Up to 1000 at a time. The prefix must be one licensed to the user's company by GS1; this tool does not check ownership or keep track of serials already used, so always ask where to start.
generate_x12_850_from_rows
ChatGPTUse this when someone has order lines (a CSV, a spreadsheet export, or a list) and needs an X12 EDI 850 purchase order. Rows sharing a PO number become one 850 transaction; all go in one ISA/GS envelope (version 004010). Each row needs a PO number, a quantity, and a vendor item number or a UPC/EAN/GTIN; rows with errors are skipped and listed. The output is validated with the same parser as validate_edi_document. Trading partner specific segments (such as REF department numbers) are not added. Builds purchase orders only (what a buyer sends): for a supplier's replies to a PO (855, 856, 810) use draft_edi_responses.
get_retailer_edi_requirements
ChatGPTUse this when someone asks what EDI a retailer requires from suppliers: which transactions (for example 850, 855, 856, 810 or EDIFACT ORDERS, DESADV), retailer-specific notes, setup steps, chargebacks, and official portals. Covers 34 US and UK retailers, distributors and networks, including Walmart, Target, Kroger, Costco, Amazon, Home Depot, Tesco and Sainsbury's; a retailer not on the list returns the covered names rather than a guess. Chargeback amounts are only included where a retailer source was verified.
read_edi_remittance
ChatGPTUse this when the user has an X12 820 or EDIFACT REMADV remittance advice and wants to know what was paid, what was deducted and why. Returns the payment (amount, method, date, trace number), each invoice or credit memo with invoiced, paid, discount and adjustment amounts, deductions not tied to an invoice (including debit memos sent as negative lines), decoded adjustment reason codes (ASC X12 426 via the ASC X9 TR 42 core list, or UNCL 4465), how each deduction is usually handled (agreed allowance, compliance fine, short delivery or price difference), and a reconciliation that flags short payments with no reason code. Where the payer is a retailer with a sourced chargeback schedule, matching published fees are included with their source. It does not contact the payer or dispute anything; build_deduction_dispute drafts a dispute for one deduction. Without an 820 or REMADV (a PDF, portal export or just a deduction code), use explain_deduction instead.
render_edi_document
ChatGPTUse this when someone wants to read, print or share an EDI document as a normal business document: a purchase order, PO change, acknowledgment, ship notice (packing list) or invoice. Works for X12 (850, 855, 856, 810, 860, 875, 940, 945), EDIFACT (ORDERS, ORDCHG, ORDRSP, DESADV, INVOIC) and TRADACOMS order and invoice files. Returns the document with codes decoded into words, its lines and totals, and any validation issues. The PDF (up to 1 MB) is offered as a download in the chat widget; set embed_pdf only when the client has no document viewer and needs the file itself. Other transaction types, such as 997 or 832, are not rendered.
validate_edi_document
ChatGPTUse this when someone asks whether an X12, EDIFACT or TRADACOMS document is correct or ready to send, or what is wrong with a document they are sending. Also takes a bare ST..SE or GS..GE fragment. Checks envelope structure, segment and transaction counts, control numbers (including duplicates), CTT line counts, HL hierarchy, invoice and warehouse totals, GS1 check digits on UPC/EAN/GTIN/SSCC, and dates; with retailer set, also Walmart, Target, Amazon or Costco field rules. If the document is an acknowledgment (997, 999, TA1, 824, CONTRL), use explain_edi_rejection instead; for any other named retailer, also call check_edi_for_retailer. Does not check a partner's private implementation guide.