Table journal_main

The general journal table holds the journal entries for every transaction in PhreeBooks. The general journal is broken into two tables, main and item. The main table contains the overview settings that are common for every transaction. The item table contains each individual journal entry and is a many to one relationship with journal_main.

The table field definitions for the journal_main table are as follows:

TABLE: journal_main

Field Name
Type
Size (value)
Comment
id
integer
11

auto-increment field used to uniquely identify each journal entry.
Primary Key: YES
Indexed: YES
Unique: YES

period
integer
2
Accounting period for this journal entry.
journal_id
int
2

Code to identify what journal the entry is posted against. Valid codes are:
02 - General Journal
04 - Purchase Order Journal
06 - Purchase Journal
07 - Vendor Credit Memo Journal
08 - Payroll Journal
10 - Sales Order Journal
12 - Sales Journal
13 - Custoerm Credit Memo Journal
14 - Inventory Assembly Journal
16 - Inventory Adjustment Journal
18 - Cash Receipts Journal
19 - Point of Sale Journal
20 - Cash Distribution Journal
21 - Point of Purchase Journal
22 - Shipping Journal

post_date
date
Journal post date
store_id
varchar
15
Store id reference for this journal entry
description
varchar
32
System defined description for the journal entry (for readability purposes). The journal_id field is used by the system to track entry types.
closed
boolean
0,1

When set to 1, indicates that the journal entry has been closed. this flag will remain 0 throughout the transaction until all phases are complete. For example, with a purchase order, the transaction will remain open until all of the items have been received. Item entries for the transaction will occur over time to track actions associated with the journal entry. Once all activities have been completed, the journal entry will close.

freight
float
Holds the total freight cost of the journal entry.
shipper_code
varchar
16

Encoded shipping carrier and method. Values are separated by a colon (:). The first value represents the carrier as defined by the installed shipping modules. The second value is the service level. Service levels are defined as (US origin):

1DEam => 1 Day Early a.m.
1Dam => 1 Day a.m.
1Dpm => 1 Day p.m.
2Dam => 2 Day a.m.
2Dpm => 2 Day p.m.
3Dpm => 3 Day
GND => Ground
I2DEam => Worldwide Early Express
I2Dam => Worldwide Express
I3D => Worldwide Expedited
IGND => Ground (Canada)

Shipping service levels definitions can be found in the language file under the shipping module directory (/modules/shipping/language/en_us/language.php).

terms
varchar(32)
NULL
This field holds the encoded terms used to post the transaction.
sales_tax
float
The total sales tax for the transaction.
tax_auths
varchar
16
Contains the encoded tax authorities assigned to the journal entry. Values refer to the id of the tax authority or authorities in the tax_authorities table separated by colons (:).
total_amount
float
The total amount of the transaction.
currencies_code
char(3)
USD*
Sets the currency code used to post the entry. Note that all amounts are in the default currency. This code is used to re-generate the order based on the posted value, currency code and currency value
currencies_value
double
1.0
This holds the exchange rate used when the record was posted. If the record was posted in the default currency, this value will be 1.0. If another currency was used to post the transaction, this record will hold the exchange rate used at the time of post.
so_po_ref_id
int(11)
0
This field holds the journal record id if the refering entry to this posted record.
purchase_invoice_id
varchar
16
Holds the purchase order number, sales order number, invoice number, etc. for applicable transactions.
purch_order_id
varchar
16
Holds the reference order number, Customer PO for invoices, for example.
recur_id
int(11)
0
For recurring transactions, this holds the id assigned to this and all recurring transactions. If changes are made to a recurring transaction, this id is used to retrieve all related transactions for re-posting.
admin_id
int(11)
0
Holds the user ID for the transaction
rep_id
int(11)
0
Holds the record number of the employee posting this entry. Settable in the order form.
waiting
0, 1
0
Determines if the journal entry is waiting for more information. This is primarily used for receiving inventory when the invoice has not arrived yet. The inventory receipt can be posted without the invoice number and re-posted later when the invoice arrives.
gl_acct_id
varchar(15)
The general ledger account id. This is ostly a reference as a single journal post will use serveral gl accounts stored in table journal_item with the broken down transaction information.
bill_acct_id
int(11)
Holds the id account (contact) of the billing address used to post the entry.
bill_address_id
int(11)
Holds the id of the address book record for the billing address.
bill_primary_name
varchar
32
Holds the remit to address information for payables, sold to information for receivables.
bill_contact
varchar
32
 
bill_address1
varchar
32
 
bill_address2
varchar
32
 
bill_city_town
varchar
24
 
bill_state_province
varchar
24
 
bill_postal_code
varchar
24
 
bill_country_code
char
3
Formatted with the ISO 3 character codes , i.e. USA, ESP, AUS, etc.
ship_acct_id
int(11)
Holds the id account (contact) of the shipping address used to post the entry.
ship_address_id
int(11)
Holds the id of the address book record for the shipping address.
ship_primary_name
varchar
32
Holds ship to information for all transactions.
ship_contact
varchar
32
 
ship_address1
varchar
32
 
ship_address2
varchar
32
 
ship_city_town
varchar
24
 
ship_state_province
varchar
24
 
ship_postal_code
varchar
24
 
ship_country_code
char
3
Formatted with the ISO 3 character codes , i.e. USA, ESP, AUS, etc.
terminal_date
date

Date used as follows:
Payables:
Purchase Orders: Holds the expiration date.
Receive Inventory:

Receivables:
Sales Orders:
Invoices:

drop_ship
boolean
0, 1
Drop ship flag indicator

Notes: