Merge pull request #2191 from monishdeb/CRM-13710
[civicrm-core.git] / xml / schema / Financial / FinancialTrxn.xml
1 <?xml version="1.0" encoding="iso-8859-1" ?>
2
3 <table>
4 <base>CRM/Financial</base>
5 <class>FinancialTrxn</class>
6 <name>civicrm_financial_trxn</name>
7 <add>1.3</add>
8 <log>true</log>
9 <field>
10 <name>id</name>
11 <type>int unsigned</type>
12 <required>true</required>
13 <add>1.3</add>
14 </field>
15 <primaryKey>
16 <name>id</name>
17 <autoincrement>true</autoincrement>
18 </primaryKey>
19 <field>
20 <name>from_account_id</name>
21 <type>int unsigned</type>
22 <comment>FK to financial_account table.</comment>
23 <add>3.2</add>
24 <drop>4.3</drop>
25 </field>
26 <foreignKey>
27 <name>from_account_id</name>
28 <table>civicrm_financial_account</table>
29 <key>id</key>
30 <add>3.2</add>
31 <drop>4.3</drop>
32 </foreignKey>
33 <field>
34 <name>to_account_id</name>
35 <type>int unsigned</type>
36 <comment>FK to financial_account table.</comment>
37 <add>3.2</add>
38 <drop>4.3</drop>
39 </field>
40 <foreignKey>
41 <name>to_account_id</name>
42 <table>civicrm_financial_account</table>
43 <key>id</key>
44 <add>3.2</add>
45 <drop>4.3</drop>
46 </foreignKey>
47 <field>
48 <name>from_financial_account_id</name>
49 <type>int unsigned</type>
50 <comment>FK to financial_account table.</comment>
51 <add>4.3</add>
52 <pseudoconstant>
53 <table>civicrm_financial_account</table>
54 <keyColumn>id</keyColumn>
55 <labelColumn>name</labelColumn>
56 </pseudoconstant>
57 <html>
58 <type>Select</type>
59 </html>
60 </field>
61 <foreignKey>
62 <name>from_financial_account_id</name>
63 <table>civicrm_financial_account</table>
64 <key>id</key>
65 <add>4.3</add>
66 </foreignKey>
67 <field>
68 <name>to_financial_account_id</name>
69 <type>int unsigned</type>
70 <comment>FK to financial_financial_account table.</comment>
71 <add>4.3</add>
72 <pseudoconstant>
73 <table>civicrm_financial_account</table>
74 <keyColumn>id</keyColumn>
75 <labelColumn>name</labelColumn>
76 </pseudoconstant>
77 <html>
78 <type>Select</type>
79 </html>
80 </field>
81 <foreignKey>
82 <name>to_financial_account_id</name>
83 <table>civicrm_financial_account</table>
84 <key>id</key>
85 <add>4.3</add>
86 </foreignKey>
87 <field>
88 <name>trxn_date</name>
89 <type>datetime</type>
90 <default>NULL</default>
91 <comment>date transaction occurred</comment>
92 <add>1.3</add>
93 </field>
94 <field>
95 <name>trxn_type</name>
96 <type>enum</type>
97 <values>Debit,Credit</values>
98 <required>true</required>
99 <add>1.3</add>
100 <drop>4.3</drop>
101 </field>
102 <field>
103 <name>total_amount</name>
104 <type>decimal</type>
105 <required>true</required>
106 <comment>amount of transaction</comment>
107 <add>1.3</add>
108 </field>
109 <field>
110 <name>fee_amount</name>
111 <type>decimal</type>
112 <comment>actual processor fee if known - may be 0.</comment>
113 <add>1.3</add>
114 </field>
115 <field>
116 <name>net_amount</name>
117 <type>decimal</type>
118 <comment>actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.</comment>
119 <add>1.3</add>
120 </field>
121 <field>
122 <name>currency</name>
123 <type>varchar</type>
124 <length>3</length>
125 <default>NULL</default>
126 <import>true</import>
127 <headerPattern>/cur(rency)?/i</headerPattern>
128 <dataPattern>/^[A-Z]{3}$/</dataPattern>
129 <comment>3 character string, value from config setting or input via user.</comment>
130 <add>1.3</add>
131 <pseudoconstant>
132 <table>civicrm_currency</table>
133 <keyColumn>name</keyColumn>
134 <labelColumn>full_name</labelColumn>
135 <nameColumn>numeric_code</nameColumn>
136 </pseudoconstant>
137 <html>
138 <type>Select</type>
139 </html>
140 </field>
141 <field>
142 <name>payment_processor</name>
143 <type>varchar</type>
144 <length>64</length>
145 <required>true</required>
146 <comment>derived from Processor setting in civicrm.settings.php.</comment>
147 <add>1.3</add>
148 <drop>4.3</drop>
149 </field>
150 <field>
151 <name>trxn_id</name>
152 <type>varchar</type>
153 <length>255</length>
154 <comment>user-specified unique processor transaction id, bank id + trans id,... depending on payment_method</comment>
155 <add>1.3</add>
156 </field>
157 <field>
158 <name>trxn_result_code</name>
159 <type>varchar</type>
160 <length>255</length>
161 <comment>processor result code</comment>
162 <add>1.3</add>
163 </field>
164 <field>
165 <name>status_id</name>
166 <title>Financial Transaction Status Id</title>
167 <type>int unsigned</type>
168 <import>true</import>
169 <export>true</export>
170 <comment>pseudo FK to civicrm_option_value of financial_item status option_group</comment>
171 <headerPattern>/status/i</headerPattern>
172 <add>4.3</add>
173 </field>
174 <field>
175 <name>payment_processor_id</name>
176 <type>int unsigned</type>
177 <comment>Payment Processor for this financial transaction</comment>
178 <add>4.3</add>
179 </field>
180 <foreignKey>
181 <name>payment_processor_id</name>
182 <table>civicrm_payment_processor</table>
183 <key>id</key>
184 <onDelete>SET NULL</onDelete>
185 <add>4.3</add>
186 </foreignKey>
187 <field>
188 <name>payment_instrument_id</name>
189 <uniqueName>financial_trxn_payment_instrument_id</uniqueName>
190 <title>Payment Instrument</title>
191 <type>int unsigned</type>
192 <comment>FK to payment_instrument option group values</comment>
193 <pseudoconstant>
194 <optionGroupName>payment_instrument</optionGroupName>
195 </pseudoconstant>
196 <html>
197 <type>Select</type>
198 </html>
199 <add>4.3</add>
200 </field>
201 <index>
202 <name>UI_ftrxn_payment_instrument_id</name>
203 <fieldName>payment_instrument_id</fieldName>
204 <add>4.3</add>
205 </index>
206 <field>
207 <name>check_number</name>
208 <uniqueName>financial_trxn_check_number</uniqueName>
209 <title>Check Number</title>
210 <comment>Check number</comment>
211 <type>varchar</type>
212 <length>255</length>
213 <html>
214 <type>Text</type>
215 <size>SIX</size>
216 </html>
217 <add>4.3</add>
218 </field>
219 <index>
220 <name>UI_ftrxn_check_number</name>
221 <fieldName>check_number</fieldName>
222 <add>4.3</add>
223 </index>
224 </table>
225