Skip to content

Instantly share code, notes, and snippets.

@mixmix
Last active August 29, 2015 14:05
Show Gist options
  • Save mixmix/c0e4715e584cbce70b34 to your computer and use it in GitHub Desktop.
Save mixmix/c0e4715e584cbce70b34 to your computer and use it in GitHub Desktop.
This is a collection of Invoices which have more than one payment with the exact same value.
**Invoice 267** 4 payments, sub_total: 1439.08
#635 | $100.0 2013-09-19 12:00:00 +1200 CashPayment
#649 | $100.0 2013-10-22 13:00:00 +1300 CashPayment
#650 | $100.0 2013-11-15 13:00:00 +1300 CashPayment
#709 | $1354.94 2013-10-10 13:00:00 +1300 CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=3e76f7bc-6e2c-4eac-a577-a2822ba1b841
**Invoice 325** 5 payments, sub_total: 2049.2
#427 | $1500.0 2013-09-26 12:00:00 +1200 CashPayment
#428 | $165.5 2013-11-11 13:00:00 +1300 CashPayment
#643 | $200.0 2013-10-03 13:00:00 +1300 CashPayment
#645 | $291.08 2013-10-24 13:00:00 +1300 CashPayment
#644 | $200.0 2013-10-14 13:00:00 +1300 CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=ba2226d5-b510-4877-8618-5ef51622138e
**Invoice 348** 6 payments, sub_total: 978.52
#625 | $0.3 2014-01-28 16:10:52 +1300 CreditNotePayment
#637 | $200.0 2013-10-03 13:00:00 +1300 CashPayment
#638 | $500.0 2013-10-14 13:00:00 +1300 CashPayment
#639 | $200.0 2013-10-17 13:00:00 +1300 CashPayment
#640 | $125.0 2014-01-28 16:09:51 +1300 BankTransferPayment
#636 | $100.3 2013-10-01 13:00:00 +1300 CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=fb49867b-0679-4012-a4f7-a054324b5dfd
@mixmix
Copy link
Author

mixmix commented Aug 21, 2014

Notes:

'subtotal' : what the back-end has stored as the sum of the line-items for the invoice. May need to check whether this includes tax

dates : e.g 2014-05-08 14:07:55 +1200 - this is the date this database record was created on. There is also a DATE stored on each payment record which may be different to this created_at date. Please get in touch if you need that.

@mixmix
Copy link
Author

mixmix commented Aug 21, 2014

For Developer refrernce

pivotal card : https://www.pivotaltracker.com/story/show/75944712

script that generated this:

i_ids = Payment.where(id: payments_to_check.flatten).map(&:invoice_id).uniq

i_s = Invoice.where(id: i_ids)

results = []
i_s.includes(:payments).includes(:invoice_line_items).each_with_index do |i,n|
  link = "https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=#{i.xero_id}"

  result = [i.id, i.payments.count, i.sub_total, link].map(&:to_s)
  i.payments.each do |p|
    result << [ "##{p.id}", '|', "$#{p.amount}", p.created_at, p.type ].map(&:to_s)
  end
  results << result
end ; p "DONE fetching"

results.each do |r|
  print "Invoice #{r[0]}  #{r[1]} payments, sub_total: #{r[2]}\n"

  r.each do |line|
    next unless line.is_a? Array
    print "  #{line.join('   ')}\n"
  end
  print "#{r[3]} \n\n"
end ; p "DONE printing"

@mixmix
Copy link
Author

mixmix commented Aug 22, 2014

backup: an earlier list, kept as a record, please ignore

Invoice 1208  3 payments, sub_total: 1308.94
  #1637   |   $450.0   2014-05-06 16:20:23 +1200   DebitCardPayment
  #1862   |   $1055.28   2014-07-07 07:56:05 +1200   CashPayment
  #1924   |   $1055.28   2014-07-18 08:21:42 +1200   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=7dbdd510-0270-4974-8adf-917025be549c 

Invoice 1277  2 payments, sub_total: 366.08000000000004
  #1786   |   $420.99   2014-06-16 18:14:04 +1200   CashPayment
  #1918   |   $420.99   2014-07-17 11:42:28 +1200   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=cce44608-7cd5-419b-b123-6e501d3960db 

Invoice 267  4 payments, sub_total: 1439.08
  #635   |   $100.0   2013-09-19 12:00:00 +1200   CashPayment
  #649   |   $100.0   2013-10-22 13:00:00 +1300   CashPayment
  #650   |   $100.0   2013-11-15 13:00:00 +1300   CashPayment
  #709   |   $1354.94   2013-10-10 13:00:00 +1300   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=3e76f7bc-6e2c-4eac-a577-a2822ba1b841 

Invoice 1327  2 payments, sub_total: 145.0
  #1859   |   $166.75   2014-07-07 07:56:05 +1200   CashPayment
  #1933   |   $166.75   2014-07-24 07:48:00 +1200   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=02e60de8-7105-4282-9bfb-2f97054b6957 

Invoice 1381  3 payments, sub_total: 145.0
  #1860   |   $166.75   2014-07-07 07:56:05 +1200   CashPayment
  #1917   |   $166.75   2014-07-17 11:42:28 +1200   CashPayment
  #1934   |   $166.75   2014-07-24 07:48:00 +1200   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=afd9550f-9651-4c40-a286-d13728f1907f 

Invoice 678  2 payments, sub_total: 34.78
  #1363   |   $40.0   2014-03-20 07:51:35 +1300   CashPayment
  #1474   |   $40.0   2014-03-20 07:51:39 +1300   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=ce7d9dff-f574-4c57-ba0d-fd59f5299179 

Invoice 689  2 payments, sub_total: 337.2
  #1357   |   $387.78   2014-03-20 07:51:35 +1300   CashPayment
  #1469   |   $387.78   2014-03-20 07:51:39 +1300   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=84206612-e269-4365-bb98-090652d1f447 

Invoice 140  2 payments, sub_total: 26.09
  #311    |   $30.0   2013-08-30 12:00:00 +1200   CashPayment
  #1186   |   $30.0   2014-03-20 07:51:29 +1300   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=de5d3f9f-1631-46e9-8fcf-f0938745856f 

Invoice 151  2 payments, sub_total: 26.09
  #310    |   $30.0   2013-08-30 12:00:00 +1200   CashPayment
  #1195   |   $30.0   2014-03-20 07:51:30 +1300   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=b37562ef-3180-418b-bfa3-fed2020fa993 

Invoice 260  3 payments, sub_total: 185.65
  #361   |   $213.5   2013-10-31 13:00:00 +1300   CashPayment
  #890   |   $213.5   2014-03-20 07:51:14 +1300   CashPayment
  #1158   |   $213.5   2014-03-20 07:51:25 +1300   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=ac5e6a6c-b1fc-4edf-83ed-ea0ccbea00e3 

Invoice 325  5 payments, sub_total: 2049.2
  #427   |   $1500.0   2013-09-26 12:00:00 +1200   CashPayment
  #428   |   $165.5   2013-11-11 13:00:00 +1300   CashPayment
  #643   |   $200.0   2013-10-03 13:00:00 +1300   CashPayment
  #645   |   $291.08   2013-10-24 13:00:00 +1300   CashPayment
  #644   |   $200.0   2013-10-14 13:00:00 +1300   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=ba2226d5-b510-4877-8618-5ef51622138e 

Invoice 348  6 payments, sub_total: 978.52
  #625   |   $0.3   2014-01-28 16:10:52 +1300   CreditNotePayment
  #637   |   $200.0   2013-10-03 13:00:00 +1300   CashPayment
  #638   |   $500.0   2013-10-14 13:00:00 +1300   CashPayment
  #639   |   $200.0   2013-10-17 13:00:00 +1300   CashPayment
  #640   |   $125.0   2014-01-28 16:09:51 +1300   BankTransferPayment
  #636   |   $100.3   2013-10-01 13:00:00 +1300   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=fb49867b-0679-4012-a4f7-a054324b5dfd 

Invoice 366  2 payments, sub_total: 667.88
  #1151   |   $768.06   2014-03-20 07:51:25 +1300   CashPayment
  #1154   |   $768.06   2014-03-20 07:51:25 +1300   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=a092217e-34a8-487d-a49a-c35a3090ece2 

Invoice 432  2 payments, sub_total: 142.5
  #315   |   $163.88   2013-10-17 13:00:00 +1300   CashPayment
  #888   |   $163.88   2014-03-20 07:51:14 +1300   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=ff4b0803-23da-4814-addb-83fe40bc4cba 

Invoice 433  2 payments, sub_total: 34.78
  #317   |   $40.0   2013-10-17 13:00:00 +1300   CashPayment
  #889   |   $40.0   2014-03-20 07:51:14 +1300   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=2748c7f2-914a-4fd9-aadb-f0692b2b0310 

Invoice 578  2 payments, sub_total: 361.03999999999996
  #1079   |   $415.2   2014-03-20 07:51:22 +1300   CashPayment
  #1468   |   $415.2   2014-03-20 07:51:39 +1300   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=e55d04b8-36bd-4814-95e5-2e29e463e413 

Invoice 671  4 payments, sub_total: 391.58
  #1362   |   $58.59   2014-03-20 07:51:35 +1300   CashPayment
  #1374   |   $172.6   2014-03-20 07:51:36 +1300   CashPayment
  #1385   |   $219.13   2014-03-20 07:51:36 +1300   CashPayment
  #1473   |   $58.59   2014-03-20 07:51:39 +1300   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=a498e0cc-2e66-48f0-9f2a-c1d36dc41413 

Invoice 636  2 payments, sub_total: 202.75
  #723    |   $233.16   2013-12-11 13:00:00 +1300   CashPayment
  #1512   |   $233.16   2014-03-20 07:51:41 +1300   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=911042e1-1483-4e72-88a8-c9a3798532c9 

Invoice 610  2 payments, sub_total: 1217.35
  #1162   |   $1399.95   2014-03-20 07:51:28 +1300   CashPayment
  #1467   |   $1399.95   2014-03-20 07:51:39 +1300   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=57a3d67b-9722-49b1-841a-3449b6d12040 

Invoice 687  2 payments, sub_total: 34.78
  #1359   |   $40.0   2014-03-20 07:51:35 +1300   CashPayment
  #1875   |   $40.0   2014-07-07 07:56:06 +1200   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=a1ecdd3b-31d4-4170-bace-1bd4c81fccee 

Invoice 708  3 payments, sub_total: 34.78
  #1366   |   $20.0   2014-03-20 07:51:36 +1300   CashPayment
  #1369   |   $20.0   2014-03-20 07:51:36 +1300   CashPayment
  #1666   |   $20.0   2014-05-08 14:07:56 +1200   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=8573e9de-3bf7-4f57-bd3e-c31a810049e3 

Invoice 765  2 payments, sub_total: 822.13
  #736    |   $945.45   2014-01-30 13:00:00 +1300   CashPayment
  #1505   |   $945.45   2014-03-20 07:51:40 +1300   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=01ebe1d5-1e8b-4e9b-a853-3fb8d47d8a9a 

Invoice 714  2 payments, sub_total: 34.78
  #737   |   $40.0   2014-01-20 13:00:00 +1300   CashPayment
  #1733  |   $40.0   2014-06-04 07:44:25 +1200   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=3de84f74-e16c-4c50-b15b-139bf0f1d453 

Invoice 747  2 payments, sub_total: 26.09
  #738   |   $30.0   2014-01-20 13:00:00 +1300   CashPayment
  #1660  |   $30.0   2014-05-08 14:07:56 +1200   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=96982d7a-3934-450a-a6f3-c683b30a06b9 

Invoice 688  2 payments, sub_total: 394.52
  #745   |   $453.7   2013-12-19 13:00:00 +1300   CashPayment
  #1489  |   $453.7   2014-03-20 07:51:40 +1300   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=40fd8fd1-36ae-439a-8fff-1dffac2dc582 

Invoice 738  2 payments, sub_total: 141.1
  #744   |   $162.27   2014-02-18 08:39:09 +1300   ChequePayment
  #1490   |   $162.27   2014-03-20 07:51:40 +1300   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=3928ec18-05e3-484a-bb48-27e76d821546 

Invoice 813  2 payments, sub_total: 662.06
  #741   |   $761.37   2014-02-04 13:00:00 +1300   CashPayment
  #1497  |   $761.37   2014-03-20 07:51:40 +1300   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=c4c8546b-6d82-425d-a881-9943ef307748 

Invoice 798  2 payments, sub_total: 506.73
  #742   |   $582.74   2014-01-29 13:00:00 +1300   CashPayment
  #1492  |   $582.74   2014-03-20 07:51:40 +1300   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=e31b2b5e-8360-4904-abc3-b1eaef21b29d 

Invoice 998  2 payments, sub_total: 424.78
  #1646   |   $488.5   2014-05-08 14:07:55 +1200   CashPayment
  #2016   |   $488.5   2014-08-21 09:29:24 +1200   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=9148639c-f027-4fd0-8bde-5b6f3ecc8478 

Invoice 963  2 payments, sub_total: 758.5
  #1647   |   $872.28   2014-05-08 14:07:55 +1200   CashPayment
  #2017   |   $872.28   2014-08-21 09:29:24 +1200   CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=868f852c-cdbd-4141-b92a-9b204eeba11e 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment