Author Topic: Modify Bill  (Read 1294 times)

trebor

  • Member
  • *
  • Posts: 57
Modify Bill
« on: July 31, 2014, 09:51:21 AM »
I am trying to modify a Bill listed in the "Pay Bills"  List.  I would like to do two things:

1) Mark it for printing (IsToBePrinted)

2) Apply a discount to certain bills when applicable (can handle with an if - then)

My stumbling block is Modifying the bill.  I am using BillPaymentCheckMod but it is failing on the TxnID.

The first thing I do is pull the bills using BillQuery (Limited by a vendor FullName and FromTxnDate) and pull the TxnID and EditSequence.  This way I can use the TxnID and EditSequence to Modify the Bill.

Problem is that it is complaining that the TxnID cannot be found when I use the "BillPaymentCheckMod"

CODE: 3120
SEVERITY: Error
MESSAGE: Object "1F16A7-1406817341" specified in the request cannot be found.

Should I be pulling bills using something different like "BillPaymentCheckQuery" to get the TxnID?  Problem is that particular query does not include an EditSequence field, which I think i s necessary to edit records.

Below is the Modification script, note I commented out the discount I am trying to add and am limiting ti just applying the "IsToBePrinted" as a first step.  After that can be applied I will move on to the Discount.

Thanks
Rob



Geoffrey Gerhard

  • Guru
  • Member
  • ****
  • Posts: 468
Re: Modify Bill
« Reply #1 on: July 31, 2014, 11:48:18 AM »
The first problem is the Request type. If you're trying to modify a Bill, you'd create a BillMod Request with that Bill's TxnID and EditSequence values.

[ edit: removed erroneous assertion ]

Assuming that what you really want to Modify is a BillPaymentCheck, there may be a second problem: I believe you cannot set that value if it already has a ref number or if it has already been printed (printing it will automatically enter a RefNumber.) It may be possible to empty QB's RefNumber field in one Mod request, and then modify the IsToBePrinted field in another, but I don't recall trying it.

HTH!

Geoffrey Gerhard
Creative Solutions Incorporated
14000 Creekside Drive
Matthews, NC  28105
704) 814-6852
« Last Edit: August 01, 2014, 08:07:24 AM by Geoffrey Gerhard »

trebor

  • Member
  • *
  • Posts: 57
Re: Modify Bill
« Reply #2 on: July 31, 2014, 01:59:43 PM »
Have a problem with Discounts................

If I run a BillQuery, the item I want to add a discount to comes over.   TxnID, EditSequence etc.  The problem is I want to add a discount to that bill, but discounts can only be applied by way of BillPaymentCheckMod, not through a BillMod.

If I put it on a Check, I can modify it to a point (ie IsToBePrinted can be toggled) , but cannot add discounts as a related record.

Each time I use BillPaymentCheckMod it fails on the discount.  Most likely because it is not Modifying the related record, it actually needs to create one (because the discount does not exist). The TxnID is required for the discount to be modified, but if it has not been created there is no TxnID to use.   So when I use the TxnID I got from the bill, it is not correct, fails. Makes sense.

But now I am back to where i began, how to Modify a check to add a discount to it before the check has been printed? 

Modifying things like the IsToBePrinted works fine, after putting it on a check and running the BillPaymentCheckMod. It is adding the discount now that is a pickle to me.

BillPaymentCheckMod script below.






Geoffrey Gerhard

  • Guru
  • Member
  • ****
  • Posts: 468
Re: Modify Bill
« Reply #3 on: August 01, 2014, 08:19:17 AM »
I'm not clear on the situation: Does the BillPaymentCheck transaction already exist? If not, you'll need to use the Add version in your Request.

Just to clarify: A BillPaymentCheck has its own TxnID value, completely separate from the TxnID values of the Bills it pays. To set a discount to a Bill, you'll need to pass that Bill's TxnID within the AppliedToTxnAdd (or AppliedToTxnMod) node. Your script appears to be using the same TxnID value for both the BillPaymentCheck and the Bill.

HTH!

Geoffrey Gerhard
Creative Solutions Incorporated
14000 Creekside Drive
Matthews, NC  28105
704) 814-6852