53
RE610 Advanced Database Schema

RE610 Adv DB Schema Ppt

Embed Size (px)

DESCRIPTION

Yardi DB

Citation preview

Page 1: RE610 Adv DB Schema Ppt

RE610Advanced Database Schema

Page 2: RE610 Adv DB Schema Ppt

This document, presentation and/or video (collectively, “document”) is protected by copyright, trademark and other intellectual property laws. Use of this document is subject to the terms and conditions of an authorized Yardi Systems, Inc. software license or other agreement including, but not limited to, restrictions on its use, copying, disclosure, distribution and decompilation. No part of this document may be disclosed or reproduced in any form by any means without the prior written authorization of Yardi Systems, Inc. This document contains proprietary information about software and service processes, algorithms, and data models which is confidential and constitutes trade secrets. This document is intended for utilization solely in connection with Yardi software licensees’ use of Yardi software and for no other purpose.

Yardi®, Yardi Systems, Inc., the Yardi Logo, and the names of Yardi products and services are trademarks or registered trademarks of Yardi Systems, Inc. in the United States and may be protected as trademarks in other countries. All other product, service, or company names mentioned in this document are claimed as trademarks and trade names by their respective companies.

© 2014 Yardi Systems, Inc. All Rights Reserved.

Page 3: RE610 Adv DB Schema Ppt

•Transaction Tables•TRANS table  ‐ Contains transaction header data

•DETAIL table ‐ Contains transaction line item detail data

•Summary / Reporting Tables•TOTAL (or GLTOTAL) ‐ Contains trial balance data

•GL Detail  ‐ Contains DR/CR details per transaction

Transaction Data Schema Outline

Page 4: RE610 Adv DB Schema Ppt

Trans Table

The TRANS table is the ‘hub’ of all transactional data in the system.

The transaction (TRANS) table contains header data for all transactions and also batch data. The iType field in the TRANS table is used to identify the type of the record (Batch Header, Charge, Journal etc.)

iType is set to 15 until AFTER the transaction is posted (important if you are reviewing un-posted transactions)

Page 5: RE610 Adv DB Schema Ppt

Detail Table

• Detail table contains the line item details of transactions

• Charges are unusual in that they are stored in only the Trans table.  Other transactions (Receipt, Payable, Payment, Journal) have records in the Detail table.

Page 6: RE610 Adv DB Schema Ppt

Transaction Types

Transaction Shorthand iTypeCharge C- 7

Receipt R- 6Payable/Invoice P- 3

Deposit 5Payment K- 2

Journal Entry J- 10Job Cost Adjustment 17

Bank Adjustment 18

Un-posted Transaction 15

Page 7: RE610 Adv DB Schema Ppt

Batch Transactions

Batch Transaction iTypePayment Header 9

Payable/Invoice Header 11Receipt Header 12

Journal Entry Header 13Charge Header 16

Page 8: RE610 Adv DB Schema Ppt

Primary / Foreign Keys

Trans Table

Primary Key starts with the iType, then sequential number padded to 8 digits with ‘0’.

C- iType = 7 hmy = 7xxxxxxxx (i.e. 700000328) Ctrl# 328

J- iType = 10 hmy = 10xxxxxxxx (i.e. 1000004776) Ctrl# 4776

Detail Table

Primary key is sequential number

Foreign Key(s) – hInvOrRec / hChkOrChg point to hmy of Trans table

Page 9: RE610 Adv DB Schema Ppt

TRANS Table – Selected Columns

• hMy – Primary Key• hParent1 – Pointer to related transaction (i.e. Reversing

Tran, Deposit, Bank Adj)• hParent2 – Pointer to Batch Header• hPerson – Pointer to Person or Bank record• bOpen – Open Transaction• sTotalAmount – Total Amount of Transaction• sAmountPaid – Amount paid for C- and P- records• uPostDate – Post Month

Page 10: RE610 Adv DB Schema Ppt

DETAIL Table – Selected Columns• hInvOrRec – Pointer to Invoice, Receipt, or Journal TRANS

record• hChkOrChg – Pointer to Check, Charge or $0 Receipt TRANS

record• sAmount – Dollar amount (for Journals, Positive value =

Debit, Negative = Credit)• CashPost – Post Month affecting Cash Books• AccrualPost – Post Month affecting Accrual Books

Page 11: RE610 Adv DB Schema Ppt

Charge Form

Page 12: RE610 Adv DB Schema Ppt

Charge Batch Header RecordiType = 16

Charge RecordiType = 7

Batch Trans.hMy = Charge Trans.hParent2

TRANS TableCHARGE

Table Relationship - Charge

Page 13: RE610 Adv DB Schema Ppt

Charge Queryselect p.scode as property,pe.ucode as Person,tr.hmy ‐ 700000000 as CTRL_No,ct.scode as chargecode,tr.stotalamount as amount,a.scode as account,ar.scode as AR_Account,tr.sdateoccurred as ChargeDate,tr.upostdate as postmonth,tr.hparent2 ‐1600000000 as batchnum,tr.itype as iTypefrom trans tr inner join property p on tr.hprop = p.hmyinner join person pe on pe.hmy = tr.hpersoninner join chargtyp ct on ct.hmy = tr.hretentionacctinner join acct a on a.hmy = tr.hoffsetacctinner join acct ar on ar.hmy = tr.haccrualacctwhere tr.hmy = 700000000 + 48759

Page 14: RE610 Adv DB Schema Ppt

Receipt Form

Page 15: RE610 Adv DB Schema Ppt

Table RelationshipCharge - Receipt

Charge Batch Header RecordiType = 16

Charge RecordiType = 7

Batch Trans.hMy = Charge Trans.hParent2

TRANS Table

Receipt Batch Header RecordiType = 12

Receipt RecordiType = 6

Batch Trans.hMy = Receipt Trans.hParent2

TRANS Table

Detail Records

DETAIL Table

Trans.hMy = Detail.hChkorChg Detail.hInvOrRec = Trans.hMy

CHARGE RECEIPT

Page 16: RE610 Adv DB Schema Ppt

Receipt Queryselect p.scode as property,pe.ucode as Person,tr.hmy ‐ 600000000 as CTRL_No,d.samount as amount,a.scode as CashAccount,tr.sdateoccurred as DateReceived,tr.upostdate as postmonth,tr.sUserDefined1 as CheckNum,tr.hparent2 ‐1200000000 as batchnum,d.hChkOrChg as Charge,tr.itype as iTypefrom trans tr inner join detail d on tr.hmy = d.hinvorrecinner join property p on d.hprop = p.hmyinner join person pe on pe.hmy = tr.hpersoninner join acct a on a.hmy = tr.hoffsetacctwhere tr.hmy = 600000000 + 25229

Page 17: RE610 Adv DB Schema Ppt

Receipt Form – Deposit

Page 18: RE610 Adv DB Schema Ppt

Table RelationshipCharge – Receipt - Deposit

Charge Batch Header RecordiType = 16

Charge RecordiType = 7

Trans.hMy = Trans.hParent2

TRANS Table

Receipt Batch Header RecordiType = 12

Receipt RecordiType = 6

Trans.hMy = Trans.hParent2

TRANS Table

Detail Records

DETAIL Table

Trans.hMy = Detail.hChkOrChg Detail.hInvOrRec = Trans.hMy

TRANS Table

Deposit RecordiType = 5

Receipt Trans.hParent1 = Deposit Trans.hMy

ReceiptCharge Deposit

Page 19: RE610 Adv DB Schema Ppt

Deposit Queryselect tr.hmy ‐ 500000000 as CTRL_No,tr.stotalamount as amount,tr.sdateoccurred as DepositDate,tr.uref as DepositNum,tr.itype as iTypefrom trans trwhere tr.hmy = 500000000 + 1099

Page 20: RE610 Adv DB Schema Ppt

Payable/Invoice Form

Page 21: RE610 Adv DB Schema Ppt

Table RelationshipPayable/Invoice

Payable Batch Header RecordiType = 11

Payable RecordiType = 3

TRANS TablePAYABLE/INVOICE

Detail Records

Trans.hMy = Detail.hInvOrRec

Trans.hMy = Trans.hParent2

DETAIL Table

Page 22: RE610 Adv DB Schema Ppt

Payable/Invoice Queryselect p.scode as property,pe.ucode as Person,tr.hmy ‐ 300000000 as CTRL_No,tr.uref as InvoiceNum,tr.stotalamount as TotalAmount,d.samount as amount,a.scode as ExpAccount,ac.scode as CashAccount,ap.scode as AP_Account,tr.sdateoccurred as InvDate,tr.upostdate as postmonth,tr.hparent2 ‐1100000000 as batchnum,tr.itype as iTypefrom trans tr inner join detail d on tr.hmy = d.hinvorrecinner join property p on d.hprop = p.hmyinner join person pe on pe.hmy = tr.hpersoninner join acct a on a.hmy = d.hacctinner join acct ac on ac.hmy = tr.hoffsetacctinner join acct ap on ap.hmy = tr.haccrualacctwhere tr.hmy = 300000000 + 12289

Page 23: RE610 Adv DB Schema Ppt

Payment Form

Page 24: RE610 Adv DB Schema Ppt

Payable/Invoice - Payment Relationship

Check RecordiType = 2

TRANS TableDETAIL TableCHECK

Detail.hChkOrChg = Trans.hMy

Payable Batch Header RecordiType = 11

Payable RecordiType = 3

TRANS TablePAYABLE/INVOICE

Detail Records

Trans.hMy = Detail.hInvOrRec

Trans.hMy = Trans.hParent2

Check Batch Header RecordiType = 9

Trans.hMy = Trans.hParent2

Page 25: RE610 Adv DB Schema Ppt

Payment Queryselect p.scode as property,pe.ucode as Person,b.sCode as Bank,pe.uLastName as PayeeName,tr.hmy ‐ 200000000 as CTRL_No,tr.uref as CheckNum,tr.stotalamount as TotalAmount,d.samount as amount,a.scode as CashAccount,tr.sdateoccurred as ChkDate,tr.upostdate as PostMonth,trp.hmy ‐ 300000000 as Payable_Ctrl,tr.itype as iTypefrom trans tr inner join detail d on tr.hmy = d.hchkorchginner join trans trp on d.hinvorrec = trp.hmyinner join property p on d.hprop = p.hmyinner join person pe on pe.hmy = tr.hAccrualAcctinner join acct a on a.hmy = trp.hoffsetacctinner join bank b on b.hmy = tr.hPersonwhere tr.hmy = 200000000 + 5790

Page 26: RE610 Adv DB Schema Ppt

Journal Entry Form

Page 27: RE610 Adv DB Schema Ppt

Table RelationshipJournal Entry

Journal EntryHeader RecordiType = 13

Journal RecordItype = 10

TRANS TableJOURNAL ENTRY

Detail Records

Trans.hMy = Detail.hInvOrRec

Trans.hMy = Trans.hParent2

DETAIL Table

Page 28: RE610 Adv DB Schema Ppt

Journal Entry Queryselect tr.hmy ‐ 1000000000 as CtrlNum,p.scode as Property,isnull(b.BookName, 'Both') as Book,tr.uRef Ref,tr.sOtherDate1 as JEDate,tr.uPostDate as PostMonth,a.scode as Account,d.sAmount as Amount,d.sSegment1 as Seg1from trans tr inner join detail d on tr.hmy = d.hinvOrRecinner join property p on d.hprop = p.hmyleft join books b on b.book = tr.itype2inner join acct a on a.hmy = d.hacctwhere tr.hmy = 1000000000 + 2524order by d.hmy

Page 29: RE610 Adv DB Schema Ppt

Prepayments

A Prepayment is a tenant receipt that doesn’t pay a Charge

• For prepayment transactions, detail.hChkOrChg = NULL• Receipt record Trans.bOpen is set to -1 until the prepay is

used• *scode in Detail Notes indicates which Charge Code

prepayment is held

Page 30: RE610 Adv DB Schema Ppt

Prepayments

As Prepay amounts are allocated to Charges• A new $0 Receipt Tran is created, with two offsetting Detail items

• Trans.sTotalAmount shows zero• For Detail with positive sAmount, hChkOrChg points to the Charge

being paid• For Detail with negative sAmount, hChkOrChg points to the original

Receipt • New Detail records added to original Receipt trans

• hInvOrRec points to the original Receipt• hChkOrChg points to the zero-dollar Receipt created above• hChkOrChg is null if amount still unapplied

Page 31: RE610 Adv DB Schema Ppt

Prepayment Receipt

Page 32: RE610 Adv DB Schema Ppt

Prepayment Receipt - Queryselect p.scode as property,pe.ucode as Person,tr.hmy ‐ 600000000 as CTRL_No,tr.stotalamount as ReceiptTotal,d.samount as amount,a.scode as CashAccount,tr.upostdate as postmonth,tr.sUserDefined1 as CheckNum,tr.hparent2 ‐1200000000 as batchnum,tr.itype as iType,tr.bOpen as PrepayAvailable,tr.originatePrepay as PrepayReceipt,d.hchkorchg as AssociatedChargefrom trans tr inner join detail d on tr.hmy = d.hinvorrecinner join property p on d.hprop = p.hmyinner join person pe on pe.hmy = tr.hpersoninner join acct a on a.hmy = tr.hoffsetacctwhere tr.hmy = 600000000 + 25229order by d.hmy

Page 33: RE610 Adv DB Schema Ppt

Reversing Transactions – Receipts

Page 34: RE610 Adv DB Schema Ppt

• Creates new Trans record with negative amount• Creates new Detail records with negative amounts• Both Trans records show Void = -1• Original Trans shows Voided = -1• Reverser shows Voider = -1• Link between Tran records only shown in sNotes field

Reversing Transactions – Receipts

Page 35: RE610 Adv DB Schema Ppt

Reversing Transactions – NSF

Page 36: RE610 Adv DB Schema Ppt

• Creates new Trans record with negative amount• Creates new Detail records with negative amounts• Both Trans records show Void = 0, Voided = 0, Voider = 0• Both Trans records show NSF = -1• Link between Tran records only shown in sNotes field• hParent1 of NSF Tran points to Bank Adjustment

Reversing Transactions – NSF

Page 37: RE610 Adv DB Schema Ppt

Reversing Transactions – Invoices

Page 38: RE610 Adv DB Schema Ppt

Reversing Transactions – Invoices

• Creates new Trans record with negative amount• Creates new Detail records with negative amounts• Both Trans records show Void = -1• Original Trans shows Voided = -1• Reverser shows Voider = -1• hParent1 of each Tran points to the other

Page 39: RE610 Adv DB Schema Ppt

Reversing Transactions –Voided Checks

Page 40: RE610 Adv DB Schema Ppt

Reversing Transactions –Voided Checks

• Creates new Trans record with negative amount• Creates new Detail records with negative amounts• Creates new Detail records against the Payable with

positive amounts • Both Trans records show Void = -1• Original Trans shows Voided = -1• Reverser shows Voider = -1• hParent1 of each Tran points to the other

Page 41: RE610 Adv DB Schema Ppt

Bank Transactions

• Checks (2), Deposits (5), and Bank Adjustments (18)• TRANS.hPerson points to BANK.hMy• Unreconciled:  bOpen = ‐1 • Reconciled:  bOpen = 0• Cleared: BankRec = ‐1• Uncleared: BankRec = 0• sOtherDate1 = Clear date• For Bank Adjustments, hParent1 points to originating transaction (NSF Receipt or Journal to Cash Acct)

Page 42: RE610 Adv DB Schema Ppt

Receivable Queries

Use sAmountPaid to calculate balance Notesselect p.ucode Tenant, tr.hmy‐700000000 Ctrl_No,

tr.stotalamount ‐ tr.samountpaid Balancefrom trans tr inner join person p 

on tr.hperson = p.hmywhere tr.itype=7 and tr.stotalamount<>tr.samountpaidorder by 1,2

Not date‐sensitiveIgnores prepayments

Use Receipts to offset Charges

select t.scode Tenant,sum(case tr.itypewhen 7 then tr.stotalamountelse ‐tr.stotalamount end) Balancefrom trans tr inner join tenant t 

on t.hmyperson = tr.hpersonwhere tr.itype in (6,7)Group by t.scode

Not date‐sensitiveIncludes prepayments

Page 43: RE610 Adv DB Schema Ppt

Receivable Queries

Aggregate Detail amounts – Charges Only NotesSelect t.scode Tenant, tr.hmy - 700000000 Ctl_No,

tr.stotalamount - sum(isnull(d.samount,0)) BalanceFrom tenant t

inner join trans tr on t.hmyperson = tr.hpersonleft outer join detail d on d.hchkorchg = tr.hmy

Where tr.itype=7Group by t.scode,tr.stotalamount,tr.hmyHaving tr.stotalamount<>sum(isnull(d.samount,0))

Can be date sensitiveIgnores prepaymentsHandles bill‐to tenants

Aggregate Detail amounts – Full LedgerSelect t.scode Tenant, tr.iType, case tr.itype when 6 then tr.hmy-600000000else tr.hmy-700000000 end Ctl_No,

sum(case tr.iType when 7 then tr.stotalamount else isnull(-d.samount,0) end) BalanceFrom tenant t

inner join trans tr on t.hmyperson = tr.hpersonleft outer join detail d on d.hInvOrRec = tr.hmy

Where tr.itype in (6,7)Group by t.scode,tr.hmy, tr.iType

Can be date sensitiveIncludes prepaymentsHandles bill‐to tenants

Page 44: RE610 Adv DB Schema Ppt

Payable QueriesUse sAmountPaid to calculate balance Notes

select v.ucode Vendor, tr.hmy-300000000 Ctrl_No,tr.stotalamount – tr.samountpaid Balancefrom vendor v inner join trans tr on v.hmyperson = tr.hpersonwhere tr.itype=3and tr.stotalamount <> tr.samountpaidorder by 1,2

Not date‐sensitive

Use Checks to offset Invoicesselect v.ucode Vendor,sum(case tr.itypewhen 3 then tr.stotalamountelse -tr.stotalamount end) Balance

from vendor v inner join trans tr on v.hmyperson = (case tr.itypewhen 3 then tr.hperson else tr.haccrualacct end)where tr.itype in (3,2)Group by v.ucode

Not date‐sensitive

Page 45: RE610 Adv DB Schema Ppt

Payable QueriesAggregate Detail amounts – Unpaid Invoices NotesSelect v.ucode Vendor, tr.hmy - 300000000 Ctl_No,

tr.stotalamount - sum(case when d.hchkorchg is not null then d.samount else 0 end) Balance

From vendor v inner join trans tr on v.hmyperson = tr.hpersonleft outer join detail d on d.hinvorrec = tr.hmy

Where tr.itype=3Group by v.ucode,tr.stotalamount,tr.hmyHaving tr.stotalamount<>sum(case when d.hchkorchg is not

null then d.samount else 0 end)

Can be date‐sensitive

Aggregate Detail amounts – Full LedgerSelect v.ucode Vendor, tr.hmy – tr.iType*100000000 Ctl_No,

sum(case tr.iType when 3 then d.samount else –d.samountend) Balance

From vendor v inner join trans tr on v.hmyperson = (case tr.itype when 3 then tr.hperson else tr.haccrualacct end) left outer join detail d on (tr.iType = 3 and d.hinvorrec= tr.hMy) or (tr.iType=2 and d.hChkOrChg=tr.hMy)

Where tr.itype in (2,3 )Group by v.ucode, tr.stotalamount, tr.hmy, tr.iType

Can be date‐sensitive

Page 46: RE610 Adv DB Schema Ppt

Total / GLTotal Table• If GL Segments are configured GLTotal table is used

instead of Total table• Total / GLTotal table holds aggregated transaction

information for Financial Statement Reporting• Holds General Ledger account balances and Stores

budget information by Property / Month / Book / Account (/Segment)

• Table is rebuilt through Rebuild Totals function (VWA or Voyager)

• If you make changes to prior period transactions you must rebuild the TOTAL table.

Page 47: RE610 Adv DB Schema Ppt

TOTAL Table – Selected Columns• hPpty – Pointer to PROPERTY record• uMonth – Accounting Period (always the first of the

month)• iBook – Pointer to Books (0 – Cash, 1 – Accrual, 2+

Other Books)• hAcct – Pointer to GL Acct• sBegin – Beginning Balance• sMTD – Activity in this period• sBeginBudget – Budget Beginning Balance• sBudget – Budget value for this period

Page 48: RE610 Adv DB Schema Ppt

GLDETAIL Table

• The GLDETAIL table was introduced in Voyager 6.0 to allow for faster report processing of G/L activity.

• When transactions are posted, a GLDETAIL record is created for each Debit/Credit made to the general ledger.

• The GLDETAIL table is indexed to provide optimal searching efficiency, only holding pertinent information.

• While TRANS and DETAIL tables hold raw data, the GLDETAIL table is the expanded result of the TRANS/DETAIL tables, showing the posted transactions impact on the general ledger.

Page 49: RE610 Adv DB Schema Ppt

GLDETAIL Table• One TRANS record or one DETAIL record will create

multiple GLDETAIL records depending on transaction type

• Key columns for filtering are hProp, hAcct, iBook, and dtPost

• Key columns for selection are dAmount, sTranNum, hPerson, sRef, sNotes, dtDate

• iBook: 0 is Cash, 1 is Accrual– Other books: only on JE– No iBook of 1000 in GLDetail table

Page 50: RE610 Adv DB Schema Ppt

GLDETAIL TableA/R–Charge (iType=7): 2 records per Trans

• Debit Accounts Receivable (iBook=1)• Credit Income Account (iBook=1)

–Receipt (iType=6): 4 records per Detail• Credit Accounts Receivable (iBook=1)• Debit Cash (iBook=1)• Credit Income Account (iBook=0)• Debit Cash (iBook=0)

Page 51: RE610 Adv DB Schema Ppt

GLDETAIL TableA/P–Payable (iType=3): 2 records per Detail

• Credit Accounts Payable (iBook=1)• Debit Expense Account (iBook=1)

–Check (iType=2): 4 records per Detail• Debit Accounts Payable (iBook=1)• Credit Cash (iBook=1)• Debit Expense Account (iBook=0)• Credit Cash (iBook=0)

JE - Journal (iType=10): 1 Record per Detail or 2 if ‘Both’ books

Page 52: RE610 Adv DB Schema Ppt

TIPS• Use Yardi Data Dictionary• Use the Transaction Table Document• sp_help, sp_helptext and sp_tables

commands• The Object Browser and Object Search in

Query Analyzer– In Query Analyzer F8 key

Page 53: RE610 Adv DB Schema Ppt

THANK YOU FOR ATTENDING