Jump to content

Pushing a Receipt from FM to QB with different line quantities than the PO


This topic is 787 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I'm having trouble with pushing a receipt from FileMaker (Trayse Inventory) to QuickBooks where the receipt line quantity might be less than the order line quantity.

If the receipt line quantities were always the same as the order line quantities, then I could use the LinkToTxnID in the header data:

# header data
PCQB_RqNew [ Select; Results: $rqNew_itemReceiptAdd; Request Type: "ItemReceiptAdd" ]

PCQB_RqAddFieldWithValue [ Select; Results: $rqAddFieldWithValue; QB Field Name: "VendorRef::ListID" ; Field Value: $vendorQbListID ]
PCQB_RqAddFieldWithValue [ Select; Results: $rqAddFieldWithValue; QB Field Name: "TxnDate" ; Field Value: RECEIPT::receiveDate ]
PCQB_RqAddFieldWithValue [ Select; Results: $rqAddFieldWithValue; QB Field Name: "RefNumber" ; Field Value: RECEIPT::referenceNum ]
PCQB_RqAddFieldWithValue [ Select; Results: $rqAddFieldWithValue; QB Field Name: "LinkToTxnID" ; Field Value: $poTxnID ]

This works nicely. A receipt is created and related to the PO. The PO quantities are all received, so the PO is closed.


But the receipt line quantities are not always the same as the order line quantities. I can leave out the LinkToTxnID and still get a Receipt document in QuickBooks but the receipt doesn't connect to the PO. They are just two separate documents. Here's what that look like:

# header data
PCQB_RqAddFieldWithValue [ Select; Results: $rqAddFieldWithValue; QB Field Name: "VendorRef::ListID" ; Field Value: $vendorQbListID ]
PCQB_RqAddFieldWithValue [ Select; Results: $rqAddFieldWithValue; QB Field Name: "TxnDate" ; Field Value: RECEIPT::receiveDate ]
PCQB_RqAddFieldWithValue [ Select; Results: $rqAddFieldWithValue; QB Field Name: "RefNumber" ; Field Value: RECEIPT::referenceNum ]


# line data (in a loop, GTRR; abbreviated here for simplicity)
PCQB_RqAddRelatedRecord [ Select; Record Type: "ItemLineAdd" ]

PCQB_RqAddFieldWithValue [ Select; Results: $rqAddFieldWithValue; QB Field Name: "ItemRef::ListID" ; Field Value: ITEM::qbListID ]
PCQB_RqAddFieldWithValue [ Select; Results: $rqAddFieldWithValue; QB Field Name: "Desc" ; Field Value: ITEM::description  ]
PCQB_RqAddFieldWithValue [ Select; Results: $rqAddFieldWithValue; QB Field Name: "Quantity" ; Field Value: RECEIPTLINE::qtyReceived ]
PCQB_RqAddFieldWithValue [ Select; Results: $rqAddFieldWithValue; QB Field Name: "Cost" ; Field Value: ORDERLINE::cost ]


I tried adding the TxnLineID to the line data like so:

# line data
PCQB_RqAddFieldWithValue [ Select; Results: $rqAddFieldWithValue; QB Field Name: "Quantity" ; Field Value: RECEIPTLINE::qtyReceived ]
PCQB_RqAddFieldWithValue [ Select; Results: $rqAddFieldWithValue; QB Field Name: "LinkToTxn::TxnLineID" ; Field Value: $txnLineID ]


Worth Noting

  • The Purchase Orders push to QB as expected.
  • I retrieve the TxnID for the PO head and the TxnLineID for the PO Lines. In other words, header and line both have a unique QB ID.


Any thoughts on what I'm missing? I'm starting to think that maybe I should push the receipt with the LinkToTxnID to make sure:

  1. it relates to the PO
  2. Has all the lines

and then modify the receipt using ItemReceiptMod

Would love to hear any insights.

Link to comment
Share on other sites

What problem are you seeing?

Adding the TxnLineID to the line data is, IIRC, the right approach. Keep in mind that you cannot also pass a LinkToTxnID in the "header" section. Where the ItemReceipt's ItemLineAdd Quantity is less than the PO's PurchaseOrderLine Quantity, the PO will remain open until you use the PurchaseOrderMod and pass an IsManuallyClosed = True element.

HTH!

Geoffrey Gerhard
Creative Solutions Incorporated

14000 Creekside Drive
Matthews, NC 28105
704.814.6852

 I found my notes on this, doubtless cribbed from Intuit's Developer pages or forum.

Rules for linking item receipts and bills to purchase orders
The following rules are enforced during runtime, and are listed here to help you avoid runtime errors, some of which may not be obvious to track down and fix.

Rule 1: Don’t use the same TxnID in a LinkToTxnID element and a LinkToTxn aggregate in the same item receipt or bill.
Rule 2: If you link to specific line items with the LinkToTxn aggregate, you must maintain the order of lines between the item receipt or bill and the purchase order. For example, you may not list a LinkToTxn aggregate for purchase order line #2 and then list a LinkToTxn aggregate for purchase order line #1. The LinkToTxn aggregate specifying purchase order line #1 must precede the LinkToTxn aggregate specifying purchase order line #2, and so on.
Rule 3: If you use LinkToTxn aggregates, you cannot mix lines from different purchase orders in the ItemReceipt or Bill. That is, you cannot specify line #1 of purchase order A, then line #1 of purchase order B followed by line #2 of purchase order A, and so on. You must list all of the desired lines of purchase order A, in order, before speciflying any lines of purchase order B.
Rule 4: If a purchase order contains a group line item, you must link to the individual lines within the group, not to the group itself. A group item is essentially a UI convenience and is not linkable.
Rule 5: When linking an item receipt or bill to a purchase order, the vendors (in the VendorRef aggregates) for each of these must match.
Rule 6: You may only link to receivable purchase order lines. That is, for that purchase order line, the ReceivedQuantity element must exist, it cannot be marked manually closed, and the Quantity must be greater than the ReceivedQuantity.
Rule 7: You cannot specify both an ItemRef and a LinkToTxn aggregate within the same line item. You will get a conflict error.

HTH!

Geoffrey Gerhard
Creative Solutions Incorporated
14000 Creekside Drive
Matthews, NC 28105
704.814.6852

  • Like 1
Link to comment
Share on other sites

Thanks Geoffrey.

I'm good on Rules 1-5. I'll need to take a deeper look at Rules 6 & 7.

In the meantime, to answer your first question about what problems I'm seeing:

A. No header, no line 
If I do not include LinkToTxnID in header and not include LinkToTxn::TxnLineID in the lines:
• A receipt is created in QB.
• It is properly linked to the vendor (a VendorRef::ListID was used in the request).
• It does not linked to the PO.
• The line items in the receipt are the correct quantity passed from FileMaker.

B. Yes header, no line
If I include LinkToTxnID in header and not LinkToTxn::TxnLineID in the lines:
• A receipt is created in QB
• It is properly linked to the PO.
• The line items in the receipt are the order quantity, not the received quantity I passed.
• The line items in the PO are received in full.

C. No header, yes line option 1 (LinkToTxn::TxnLineID)
If I include LinkToTxn::TxnLineID in the line and not LinkToTxnID in header
• No receipt is created.
• PCQB_SGetXML ("Response") does not update. It contains the XML from the previous request.
• PCQB_SGetStatus = CODE: 0 SEVERITY: Success MESSAGE: Success

Since the response XML didn't change, I suspect the status is from the previous request.

I'm guessing there is a syntax error in my request.


D. No header, yes line option 2 (LinkToTxn::TxnID)
If I include LinkToTxn::TxnID in the line and not LinkToTxnID in header:
• Same result as C.


Notes:
• LinkToTxnID in the header in B is the same value as LinkToTxn::TxnID in D. Namely, the TxnID, stored in FileMaker and created when pushing the PO.
• I ran a PurchaseOrderQuery to verify TxnID and EditSequence values I have in FileMaker are correct.

 

 

I did the testing and gathered notes before I read your addendum with the Rules. I'll test C and D again but comment out the ItemRef. I'll keep you posted.  Thanks for your help!

Updated testing:

 

E. No header, yes line option 1 (LinkToTxn::TxnLineID); only using Quantity and LinkToTxn::TxnLineID in request. (Compliance with Rule 7)
• Same result as C.

F. No header, yes line option 1 (LinkToTxn::TxnID); only using Quantity and LinkToTxn::TxnLineID in request. (Compliance with Rule 7)
• Same result as C.

 

I do believe I'm in compliance with the rules. But my syntax is incorrect. I'm not sure how to proceed with testing. Any suggesting?

Edited by Daniel Shanahan
Originally, my list was 1-4, but I changed to A-D so as not to confuse with the Rules numbered 1-7
Link to comment
Share on other sites

Got it!

The OSR made reference to a developer's guide. I found that PDF here: https://static.developer.intuit.com/qbSDK-current/doc/pdf/QBSDK_ProGuide.pdf

 

Page 239 clarified my syntax problem. Namely, I need to pass LinkToTxn::TxnID AND LinkToTxn::TxnLineID

I presumed just passing the line was sufficient as QB would be able to deduce the parent. But for this activity - receiving partial lines - it needs both.

Thanks for your help, Geoffrey.

Link to comment
Share on other sites

So the answer was found at the intersection of E & F...good catch. Both are identified as required in the OSR, and that structure is what allows a single ItemReceipt to span multiple POs. Thanks for posting the missing link.

Geoffrey Gerhard
Creative Solutions Incorporated
14000 Creekside Drive
Matthews, NC 28105
704.814.6852

Link to comment
Share on other sites

This topic is 787 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.