Class QBFC::Transaction
In: lib/qbfc/transaction.rb
Parent: Element

Methods

Constants

ID_NAME = "TxnID"

External Aliases

find_by_ref_or_id -> find_by_unique_id

Public Class methods

[Source]

    # File lib/qbfc/transaction.rb, line 33
33:       def base_class_find(sess, what, q, options)
34:         q.IncludeRetElementList.Add(self::ID_NAME)
35:         q.IncludeRetElementList.Add('TxnType')
36:         list = q.response
37:         
38:         if list.nil?
39:           (what == :all) ? [] : nil
40:         else
41:           ary = (0..(list.Count - 1)).collect { |i|
42:             element = list.GetAt(i)
43:             ret_class_name = element.TxnType.GetAsString
44:             if QBFC::const_defined?(ret_class_name)
45:               ret_class = QBFC::const_get(ret_class_name)
46:               ret_class.find(sess, element.send(ret_class::ID_NAME).GetValue, options.dup)
47:             else
48:               find(sess, element.send(Transaction::ID_NAME).GetValue, options.dup.merge(:ignore_base_class => true))
49:             end
50:           }
51:           
52:           if what == :all
53:             ary
54:           else
55:             ary[0]
56:           end
57:         end
58:       end

Find by TxnID of List record. options are the same as those for in find.

[Source]

    # File lib/qbfc/transaction.rb, line 20
20:       def find_by_id(sess, id, options = {})
21:         q = create_query(sess)
22:         q.query.TxnIDList.Add(id)
23:         find(sess, :first, q, options)
24:       end

Find by Reference Number of the Transaction record. options are the same as those for in find.

[Source]

    # File lib/qbfc/transaction.rb, line 12
12:       def find_by_ref(sess, ref, options = {})
13:         q = create_query(sess)
14:         q.query.RefNumberList.Add(ref)
15:         find(sess, :first, q, options)
16:       end

Find by either ref or id. Tries id first, then ref.

[Source]

    # File lib/qbfc/transaction.rb, line 27
27:       def find_by_ref_or_id(*args)
28:         find_by_id(*args) || find_by_ref(*args)
29:       end

Public Instance methods

Change cleared status of transaction status can be one of:

  • QBFC::CsCleared (or true)
  • QBFC::CsNotCleared (or false)
  • QBFC::CsPending

[Source]

    # File lib/qbfc/transaction.rb, line 81
81:     def cleared_status=(status)
82:       req = QBFC::Request.new(@sess, "ClearedStatusMod")
83:       req.txn_id = id
84:       status = QBFC_CONST::CsCleared if status === true
85:       status = QBFC_CONST::CsNotCleared if status === false
86:       req.cleared_status = status
87:       req.submit
88:       return status
89:     end

Delete this Transaction

[Source]

    # File lib/qbfc/transaction.rb, line 68
68:     def delete
69:       req = QBFC::Request.new(@sess, "TxnDel")
70:       req.txn_del_type = QBFC_CONST::const_get("Tdt#{qb_name}")
71:       req.txn_id = id
72:       req.submit
73:       return true
74:     end

Display the Transaction add (for new records) or edit dialog box

[Source]

     # File lib/qbfc/transaction.rb, line 92
 92:     def display
 93:       if new_record?
 94:         req = QBFC::Request.new(@sess, "TxnDisplayAdd")
 95:         req.txn_display_add_type = QBFC_CONST::const_get("Tdat#{qb_name}")
 96:       else
 97:         req = QBFC::Request.new(@sess, "TxnDisplayMod")
 98:         req.txn_display_mod_type = QBFC_CONST::const_get("Tdmt#{qb_name}")
 99:         req.txn_id = id
100:       end
101:       req.submit
102:       return true
103:     end

Alias of TxnID for this record.

[Source]

    # File lib/qbfc/transaction.rb, line 63
63:     def id
64:       @ole.txn_id
65:     end

[Validate]