﻿<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="OpenDentalDocumentation.xsl"?>
<database version="4.4.1">
    <table name="account">
        <summary>Used in the accounting section in chart of accounts.  Not related to patient accounts in any way.</summary>
        <column order="0" name="AccountNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="2" name="AcctType" type="tinyint">
            <summary>Enum:AccountType Asset, Liability, Equity,Revenue, Expense</summary>
            <Enumeration name="AccountType">
                <summary>Used in accounting for chart of accounts.</summary>
                <EnumValue name="Asset">0</EnumValue>
                <EnumValue name="Liability">1</EnumValue>
                <EnumValue name="Equity">2</EnumValue>
                <EnumValue name="Revenue">3</EnumValue>
                <EnumValue name="Expense">4</EnumValue>
            </Enumeration>
        </column>
        <column order="3" name="BankNumber" type="varchar(255)">
            <summary>For asset accounts, this would be the bank account number for deposit slips.</summary>
        </column>
        <column order="4" name="Inactive" type="tinyint">
            <summary>Set to true to not normally view this account in the list.</summary>
        </column>
        <column order="5" name="AccountColor" type="int(11)">
            <summary>.</summary>
        </column>
    </table>
    <table name="accountingautopay">
        <summary>In the accounting section, this automates entries into the database when user enters a payment into a patient account.  This table presents the user with a picklist specific to that payment type.  For example, a cash payment would create a picklist of cashboxes for user to put the cash into.</summary>
        <column order="0" name="AccountingAutoPayNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PayType" type="smallint" fk="definition">
            <summary>FK to definition.DefNum.</summary>
        </column>
        <column order="2" name="PickList" type="varchar(255)" fk="account">
            <summary>FK to account.AccountNum.  AccountNums separated by commas.  No spaces.</summary>
        </column>
    </table>
    <table name="adjustment">
        <summary>An adjustment in the patient account.  Usually, adjustments are very simple, just being assigned to one patient and provider.  But they can also be attached to a procedure to represent a discount on that procedure.  Attaching adjustments to procedures is not automated, so it is not very common.</summary>
        <column order="0" name="AdjNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="AdjDate" type="date">
            <summary>The date that the adjustment shows in the patient account.</summary>
        </column>
        <column order="2" name="AdjAmt" type="double">
            <summary>Amount of adjustment.  Can be pos or neg.</summary>
        </column>
        <column order="3" name="PatNum" type="mediumint" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="4" name="AdjType" type="smallint" fk="definition">
            <summary>FK to definition.DefNum.</summary>
        </column>
        <column order="5" name="ProvNum" type="mediumint" fk="provider">
            <summary>FK to provider.ProvNum.</summary>
        </column>
        <column order="6" name="AdjNote" type="text">
            <summary>Note for this adjustment.</summary>
        </column>
        <column order="7" name="ProcDate" type="date">
            <summary>Procedure date.  Not when the adjustment was entered.  This is what the aging will be based on in a future version.</summary>
        </column>
        <column order="8" name="ProcNum" type="mediumint" fk="procedurelog">
            <summary>FK to procedurelog.ProcNum.  Only used if attached to a procedure.  Otherwise, 0.</summary>
        </column>
        <column order="9" name="DateEntry" type="date">
            <summary>Timestamp automatically generated and user not allowed to change.  The actual date of entry.</summary>
        </column>
    </table>
    <table name="appointment">
        <summary>Appointments can show in the Appointments module, or they can be on the unscheduled list.  An appointment object is also used to store the Planned appointment.  The planned appointment never gets scheduled, but instead gets copied.</summary>
        <column order="0" name="AptNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="mediumint" fk="patient">
            <summary>FK to patient.PatNum.  The patient that the appointment is for.</summary>
        </column>
        <column order="2" name="AptStatus" type="tinyint">
            <summary>Enum:ApptStatus .</summary>
            <Enumeration name="ApptStatus">
                <summary>Appointment status.</summary>
                <EnumValue name="None">0- No appointment should ever have this status.</EnumValue>
                <EnumValue name="Scheduled">1- Shows as a regularly scheduled appointment.</EnumValue>
                <EnumValue name="Complete">2- Shows greyed out.</EnumValue>
                <EnumValue name="UnschedList">3- Only shows on unscheduled list.</EnumValue>
                <EnumValue name="ASAP">4- Functions the same as Scheduled for now.</EnumValue>
                <EnumValue name="Broken">5- Shows with a big X on it.</EnumValue>
                <EnumValue name="Planned">6- Planned appointment.  Only shows in Chart module. User not allowed to change this status, and it does not display as one of the options.</EnumValue>
            </Enumeration>
        </column>
        <column order="3" name="Pattern" type="varchar(255)">
            <summary>Time pattern, X for Dr time, / for assist time. Stored in 5 minute increments.  Converted as needed to 10 or 15 minute representations for display.</summary>
        </column>
        <column order="4" name="Confirmed" type="smallint" fk="definition">
            <summary>FK to definition.DefNum.  This field can also be used to show patient arrived, in chair, etc.  The Category column in the definition table is DefCat.ApptConfirmed.</summary>
        </column>
        <column order="5" name="AddTime" type="tinyint(3)">
            <summary>Amount of time to add to appointment.  Example: 2 would represent add 20 minutes.</summary>
        </column>
        <column order="6" name="Op" type="smallint" fk="operatory">
            <summary>FK to operatory.OperatoryNum.</summary>
        </column>
        <column order="7" name="Note" type="text">
            <summary>Note.</summary>
        </column>
        <column order="8" name="ProvNum" type="smallint" fk="provider">
            <summary>FK to provider.ProvNum.</summary>
        </column>
        <column order="9" name="ProvHyg" type="smallint" fk="provider">
            <summary>FK to provider.ProvNum.  Optional.  Only used if a hygienist is assigned to this appt.</summary>
        </column>
        <column order="10" name="AptDateTime" type="datetime">
            <summary>Appointment Date and time.  If you need just the date or time for an SQL query, you can use DATE(AptDateTime) and TIME(AptDateTime) in your query.</summary>
        </column>
        <column order="11" name="NextAptNum" type="mediumint" fk="appointment">
            <summary>FK to appointment.AptNum.  A better description of this field would be PlannedAptNum.  Only used to show that this apt is derived from specified planned apt. Otherwise, 0.</summary>
        </column>
        <column order="12" name="UnschedStatus" type="smallint" fk="definition">
            <summary>FK to definition.DefNum.  The definition.Category in the definition table is DefCat.RecallUnschedStatus.  Only used if this is an Unsched or Planned appt.</summary>
        </column>
        <column order="13" name="Lab" type="tinyint">
            <summary>Enum:LabCase  A lab case is expected for this appointment.</summary>
            <Enumeration name="LabCase">
                <summary>Used in the appointment edit window.</summary>
                <EnumValue name="None">0</EnumValue>
                <EnumValue name="Sent">1</EnumValue>
                <EnumValue name="Received">2</EnumValue>
                <EnumValue name="QualityChecked">3</EnumValue>
            </Enumeration>
        </column>
        <column order="14" name="IsNewPatient" type="tinyint">
            <summary>This is the first appoinment this patient has had at this office.  Somewhat automated.</summary>
        </column>
        <column order="15" name="ProcDescript" type="varchar(255)">
            <summary>A one line summary of all procedures.  Can be used in various reports, Unscheduled list, and Planned appointment tracker.  Not user editable right now, so it doesn't show on the screen.</summary>
        </column>
        <column order="16" name="Assistant" type="smallint" fk="employee">
            <summary>FK to employee.EmployeeNum.  You can assign an assistant to the appointment.</summary>
        </column>
        <column order="17" name="InstructorNum" type="mediumint" fk="instructor">
            <summary>FK to instructor.InstructorNum.  Only used in dental schools.</summary>
        </column>
        <column order="18" name="SchoolClassNum" type="mediumint" fk="schoolclass">
            <summary>FK to schoolclass.SchoolClassNum.  Only used in dental schools.</summary>
        </column>
        <column order="19" name="SchoolCourseNum" type="mediumint" fk="schoolcourse">
            <summary>FK to schoolcourse.SchoolCourseNum.  Only used in dental schools.</summary>
        </column>
        <column order="20" name="GradePoint" type="float">
            <summary>Dental School field. eg 3.5. Only a grade for this single appointment. The course grade shows on a report.</summary>
        </column>
        <column order="21" name="ClinicNum" type="smallint(6)" fk="clinic">
            <summary>FK to clinic.ClinicNum.  0 if no clinic.</summary>
        </column>
        <column order="22" name="IsHygiene" type="tinyint">
            <summary>Set true if this is a hygiene appt.  The hygiene provider's color will show.</summary>
        </column>
    </table>
    <table name="appointmentrule">
        <summary>For now, the rule is simple. It simply blocks all double booking of the specified code range.  The double booking would have to be for the same provider.  This can later be extended to provide more complex rules, such as partial double booking, time limitations, etc.</summary>
        <column order="0" name="AppointmentRuleNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="RuleDesc" type="varchar(255)">
            <summary>The description of the rule which will be displayed to the user.</summary>
        </column>
        <column order="2" name="ADACodeStart" type="varchar(15)">
            <summary>The procedure code of the start of the range.</summary>
        </column>
        <column order="3" name="ADACodeEnd" type="varchar(15)">
            <summary>The procedure code of the end of the range.</summary>
        </column>
        <column order="4" name="IsEnabled" type="tinyint">
            <summary>Usually true.  But this does allow you to turn off a rule temporarily without losing the settings.</summary>
        </column>
    </table>
    <table name="apptview">
        <summary>Enables viewing a variety of operatories or providers.  This table holds the views that the user picks between.  The apptviewitem table holds the items attached to each view.</summary>
        <column order="0" name="ApptViewNum" type="smallint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>Description of this view.  Gets displayed in Appt module.</summary>
        </column>
        <column order="2" name="ItemOrder" type="smallint">
            <summary>Order to display in lists. Every view must have a unique itemorder, but it is acceptable to have some missing itemorders in the sequence.</summary>
        </column>
        <column order="3" name="RowsPerIncr" type="tinyint">
            <summary>Number of rows per time increment.  Usually 1 or 2.  Programming note: Value updated to ContrApptSheet.RowsPerIncr to track current state.</summary>
        </column>
    </table>
    <table name="apptviewitem">
        <summary>Each item is attached to a row in the apptview table.  Each item specifies ONE of: OpNum, ProvNum, or Element.  The other two will be 0 or "".</summary>
        <column order="0" name="ApptViewItemNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="ApptViewNum" type="smallint" fk="apptview">
            <summary>FK to apptview.</summary>
        </column>
        <column order="2" name="OpNum" type="smallint" fk="operatory">
            <summary>FK to operatory.OperatoryNum.</summary>
        </column>
        <column order="3" name="ProvNum" type="smallint" fk="provider">
            <summary>FK to provider.ProvNum.</summary>
        </column>
        <column order="4" name="ElementDesc" type="varchar(255)">
            <summary>Must be one of the hard coded strings picked from the available list.</summary>
        </column>
        <column order="5" name="ElementOrder" type="tinyint">
            <summary>If this is a row Element, then this is the 0-based order.</summary>
        </column>
        <column order="6" name="ElementColor" type="int(11)">
            <summary>If this is an element, then this is the color.</summary>
        </column>
    </table>
    <table name="autocode">
        <summary>An autocode automates entering procedures.  The user only has to pick composite, for instance, and the autocode figures out the code based on the number of surfaces, and posterior vs. anterior.  Autocodes also enforce and suggest changes to a procedure code if the number of surfaces or other properties change.</summary>
        <column order="0" name="AutoCodeNum" type="smallint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>Displays meaningful decription, like "Amalgam".</summary>
        </column>
        <column order="2" name="IsHidden" type="tinyint">
            <summary>User can hide autocodes</summary>
        </column>
        <column order="3" name="LessIntrusive" type="tinyint">
            <summary>This will be true if user no longer wants to see this autocode message when closing a procedure. This makes it less intrusive, but it can still be used in procedure buttons.</summary>
        </column>
    </table>
    <table name="autocodecond">
        <summary>AutoCode condition.  Always attached to an AutoCodeItem, which is then, in turn, attached to an autocode.</summary>
        <column order="0" name="AutoCodeCondNum" type="smallint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="AutoCodeItemNum" type="smallint" fk="autocodeitem">
            <summary>FK to autocodeitem.AutoCodeItemNum.</summary>
        </column>
        <column order="2" name="Cond" type="tinyint">
            <summary>Enum:AutoCondition </summary>
            <Enumeration name="AutoCondition">
                <summary />
                <EnumValue name="Anterior">0</EnumValue>
                <EnumValue name="Posterior">1</EnumValue>
                <EnumValue name="Premolar">2</EnumValue>
                <EnumValue name="Molar">3</EnumValue>
                <EnumValue name="One_Surf">4</EnumValue>
                <EnumValue name="Two_Surf">5</EnumValue>
                <EnumValue name="Three_Surf">6</EnumValue>
                <EnumValue name="Four_Surf">7</EnumValue>
                <EnumValue name="Five_Surf">8</EnumValue>
                <EnumValue name="First">9</EnumValue>
                <EnumValue name="EachAdditional">10</EnumValue>
                <EnumValue name="Maxillary">11</EnumValue>
                <EnumValue name="Mandibular">12</EnumValue>
                <EnumValue name="Primary">13</EnumValue>
                <EnumValue name="Permanent">14</EnumValue>
                <EnumValue name="Pontic">15</EnumValue>
                <EnumValue name="Retainer">16</EnumValue>
                <EnumValue name="AgeOver18">17</EnumValue>
            </Enumeration>
        </column>
    </table>
    <table name="autocodeitem">
        <summary>Corresponds to the autocodeitem table in the database.</summary>
        <column order="0" name="AutoCodeItemNum" type="smallint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="AutoCodeNum" type="smallint">
            <summary>Foreign key to AutoCode.AutoCodeNum</summary>
        </column>
        <column order="2" name="ADACode" type="varchar(15)">
            <summary>Foreign key to ProcedureCode.ADACode</summary>
        </column>
    </table>
    <table name="benefit">
        <summary>Corresponds to the benefit table in the database which replaces the old covpat table.  A benefit is usually a percentage, deductible, limitation, max, or similar. Each row represents a single benefit.  A benefit can have a value in EITHER PlanNum OR PatPlanNum.  If it is for a PlanNum, the most common, then the benefit is attached to an insurance plan.  If it is for a PatPlanNum, then it overrides the plan benefit, usually a percentage, for a single patient.  Benefits we can't handle yet include posterior composites, COB duplication, amounts used, in/out of plan network, authorization required, missing tooth exclusion, and any date related limitations like waiting periods.  We also cannot yet handle family level benefits.  All benefits are at the individual patient level.
            Here are examples of typical usage which parallel X12 usage.
            Example fields shown in this order:
            CovCat, ADACode(- indicates blank), BenefitType, Percent, MonetaryAmt, TimePeriod, QuantityQualifier, Quantity
            Annual Max $1000: General,-,Limitations,0,1000,CalendarYear,None,0
            Restorative 80%: Restorative,-,Percentage,80,0,CalendarYear,None,0
            $50 deductible: General,-,Deductible,0,50,CalendarYear,None,0
            Deductible waived on preventive: Preventive,-,Deductible,0,0,CalendarYear,None,0
            1 pano every 5 years: General(ignored),D0330,Limitations,0,0,Years,Years,5
            2 exams per year: Preventive(or Diagnostic),-,Limitations,0,0,BenefitYear,NumberOfServices,2
            Fluoride limit 18yo: General(ignored), D1204, Limitations, 0, 0, CalendarYear(or None), AgeLimit, 18 (might require a second identical entry for D1205)
            4BW every 6 months: General(ignored), D0274, Limitations, 0, 0, None, Months, 6.
            The text above might be difficult to read.  We are trying to improve the white spacing.</summary>
        <column order="0" name="BenefitNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PlanNum" type="mediumint" fk="insplan">
            <summary>FK to insplan.PlanNum.  Most benefits should be attached using PlanNum.  The exception would be if each patient has a different percentage.  If PlanNum is used, then PatPlanNum should be 0.</summary>
        </column>
        <column order="2" name="PatPlanNum" type="mediumint" fk="patplan">
            <summary>FK to patplan.PatPlanNum.  It is rare to attach benefits this way.  Usually only used to override percentages for patients.   In this case, PlanNum should be 0.</summary>
        </column>
        <column order="3" name="CovCatNum" type="mediumint" fk="covcat">
            <summary>FK to covcat.CovCatNum.  Corresponds to X12 EB03- Service Type code.  Can never be blank.  There will be very specific categories covered by X12. Users should set their InsCovCats to the defaults we will provide.</summary>
        </column>
        <column order="4" name="ADACode" type="varchar(15)" fk="procedurecode">
            <summary>FK to procedurecode.ADACode.  Typical uses include fluoride, sealants, etc.  If a specific code is used here, then the CovCat is completely ignored.</summary>
        </column>
        <column order="5" name="BenefitType" type="tinyint">
            <summary>Enum:InsBenefitType Corresponds to X12 EB01. Examples: 1=Percentage, 2=Deductible, 3=CoPayment, 4=Exclusions, 5=Limitations. There's not really any difference between limitations and exclusions as far as the logic is concerned.</summary>
            <Enumeration name="InsBenefitType">
                <summary>Used in the benefit table.  Corresponds to X12 EB01.</summary>
                <EnumValue name="ActiveCoverage">0- Not usually used.  Would only be used if you are just indicating that the patient is covered, but without any specifics.</EnumValue>
                <EnumValue name="Percentage">1- This corresponds to the X12 Co-Insurance type.  Except it's the opposite because it's the insurance coverage percentage, whereas X12 sends the percentage as the patient's responsibility portion.</EnumValue>
                <EnumValue name="Deductible">2- The deductible amount.  Might be two entries if, for instance, deductible is waived on preventive.</EnumValue>
                <EnumValue name="CoPayment">3- A dollar amount.</EnumValue>
                <EnumValue name="Exclusions">4- Services that are simply not covered at all.</EnumValue>
                <EnumValue name="Limitations">5- Covers a variety of limitations, including Max, frequency, fee reductions, etc.</EnumValue>
            </Enumeration>
        </column>
        <column order="6" name="Percent" type="tinyint">
            <summary>Only used if BenefitType=Percentage.  Valid values are 0 to 100.</summary>
        </column>
        <column order="7" name="MonetaryAmt" type="double">
            <summary>Used for CoPayment, Limitations, and as deductible in PercentDeduct.</summary>
        </column>
        <column order="8" name="TimePeriod" type="tinyint">
            <summary>Enum:BenefitTimePeriod Corresponds to X12 EB06, Time Period Qualifier.  Examples: 0=None,1=ServiceYear,2=CalendarYear,3=Lifetime,4=Years. Might add Visit and Remaining.</summary>
            <Enumeration name="BenefitTimePeriod">
                <summary>Used in the benefit table.  Corresponds to X12 EB06.</summary>
                <EnumValue name="None">0- A timeperiod is frequenly not needed.  For example, percentages.</EnumValue>
                <EnumValue name="ServiceYear">1- The renewal month is not Jan.  In this case, we need to know the effective date so that we know which month the benefits start over in.</EnumValue>
                <EnumValue name="CalendarYear">2- Renewal month is Jan.</EnumValue>
                <EnumValue name="Lifetime">3- Usually used for ortho max.</EnumValue>
                <EnumValue name="Years">4- Wouldn't be used alone.  Years would again be specified in the quantity field along with a number.</EnumValue>
            </Enumeration>
        </column>
        <column order="9" name="QuantityQualifier" type="tinyint">
            <summary>Enum:BenefitQuantity Corresponds to X12 EB09. Not used very much. Examples: 0=None,1=NumberOfServices,2=AgeLimit,3=Visits,4=Years,5=Months</summary>
            <Enumeration name="BenefitQuantity">
                <summary>Used in the benefit table in conjunction with an integer quantity.</summary>
                <EnumValue name="None">0- This is used a lot. Most benefits do not need any sort of quantity.</EnumValue>
                <EnumValue name="NumberOfServices">1- For example, two exams per year</EnumValue>
                <EnumValue name="AgeLimit">2- For example, 18 when flouride only covered to 18 y.o.</EnumValue>
                <EnumValue name="Visits">3- For example, copay per 1 visit.</EnumValue>
                <EnumValue name="Years">4- For example, pano every 5 years.</EnumValue>
                <EnumValue name="Months">5- For example, BWs every 6 months.</EnumValue>
            </Enumeration>
        </column>
        <column order="10" name="Quantity" type="tinyint">
            <summary>Corresponds to X12 EB10. Qualify the quantity</summary>
        </column>
    </table>
    <table name="carrier">
        <summary>Every InsPlan has a Carrier.  The carrier stores the name and address.</summary>
        <column order="0" name="CarrierNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="CarrierName" type="varchar(255)">
            <summary>Name of the carrier.</summary>
        </column>
        <column order="2" name="Address" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="3" name="Address2" type="varchar(255)">
            <summary>Second line of address.</summary>
        </column>
        <column order="4" name="City" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="5" name="State" type="varchar(255)">
            <summary>2 char in the US.</summary>
        </column>
        <column order="6" name="Zip" type="varchar(255)">
            <summary>Postal code.</summary>
        </column>
        <column order="7" name="Phone" type="varchar(255)">
            <summary>Includes any punctuation.</summary>
        </column>
        <column order="8" name="ElectID" type="varchar(255)">
            <summary>E-claims electronic payer id.  5 char.</summary>
        </column>
        <column order="9" name="NoSendElect" type="tinyint">
            <summary>Do not send electronically.  It's just a default; you can still send electronically.</summary>
        </column>
    </table>
    <table name="claim">
        <summary>The claim table holds information about individual claims.  Each row represents one claim.</summary>
        <column order="0" name="ClaimNum" type="mediumint">
            <summary>Primary key</summary>
        </column>
        <column order="1" name="PatNum" type="mediumint" fk="patient">
            <summary>FK to patient.PatNum</summary>
        </column>
        <column order="2" name="DateService" type="date">
            <summary>Usually the same date as the procedures, but it can be changed if you wish.</summary>
        </column>
        <column order="3" name="DateSent" type="date">
            <summary>Usually the date it was created.  It might be sent a few days later if you don't send your e-claims every day.</summary>
        </column>
        <column order="4" name="ClaimStatus" type="char(1)">
            <summary>Single char: U,H,W,P,S,or R.  U=Unsent, H=Hold until pri received, W=Waiting in queue, P=Probably sent, S=Sent, R=Received.  A(adj) is no longer used.</summary>
        </column>
        <column order="5" name="DateReceived" type="date">
            <summary>Date the claim was received.</summary>
        </column>
        <column order="6" name="PlanNum" type="mediumint" fk="insplan">
            <summary>FK to insplan.PlanNum.  Every claim is attached to one plan.</summary>
        </column>
        <column order="7" name="ProvTreat" type="smallint" fk="provider">
            <summary>FK to provider.ProvNum.  Treating provider.</summary>
        </column>
        <column order="8" name="ClaimFee" type="double">
            <summary>Total fee of claim.</summary>
        </column>
        <column order="9" name="InsPayEst" type="double">
            <summary>Amount insurance is estimated to pay on this claim.</summary>
        </column>
        <column order="10" name="InsPayAmt" type="double">
            <summary>Amount insurance actually paid.</summary>
        </column>
        <column order="11" name="DedApplied" type="double">
            <summary>Deductible applied to this claim.</summary>
        </column>
        <column order="12" name="PreAuthString" type="varchar(40)">
            <summary>The preauth number received from ins.</summary>
        </column>
        <column order="13" name="IsProsthesis" type="char(1)">
            <summary>Single char for No, Initial, or Replacement.</summary>
        </column>
        <column order="14" name="PriorDate" type="date">
            <summary>Date prior prosthesis was placed.  Note that this is only for paper claims.  E-claims have a date field on each individual procedure.</summary>
        </column>
        <column order="15" name="ReasonUnderPaid" type="varchar(255)">
            <summary>Note for patient for why insurance didn't pay as expected.</summary>
        </column>
        <column order="16" name="ClaimNote" type="varchar(255)">
            <summary>Note to be sent to insurance. Max 255 char.  E-claims also have notes on each procedure.</summary>
        </column>
        <column order="17" name="ClaimType" type="varchar(255)">
            <summary>"P"=primary, "S"=secondary, "PreAuth"=preauth, "Other"=other, "Cap"=capitation.  Not allowed to be blank. Might need to add "Med"=medical claim.</summary>
        </column>
        <column order="18" name="ProvBill" type="smallint" fk="provider">
            <summary>FK to provider.ProvNum.  Billing provider.  Assignment can be automated from the setup section.</summary>
        </column>
        <column order="19" name="ReferringProv" type="smallint" fk="referral">
            <summary>FK to referral.ReferralNum.</summary>
        </column>
        <column order="20" name="RefNumString" type="varchar(40)">
            <summary>Referral number for this claim.</summary>
        </column>
        <column order="21" name="PlaceService" type="tinyint">
            <summary>Enum:PlaceOfService .</summary>
            <Enumeration name="PlaceOfService">
                <summary />
                <EnumValue name="Office">0. CPT code 11</EnumValue>
                <EnumValue name="PatientsHome">1. CPT code 12</EnumValue>
                <EnumValue name="InpatHospital">2. CPT code 21</EnumValue>
                <EnumValue name="OutpatHospital">3. CPT code 22</EnumValue>
                <EnumValue name="SkilledNursFac">4. CPT code 31</EnumValue>
                <EnumValue name="AdultLivCareFac">5. CPT code 33</EnumValue>
                <EnumValue name="OtherLocation">6. CPT code ?</EnumValue>
                <EnumValue name="MobileUnit">7. CPT code 15</EnumValue>
                <EnumValue name="School">8. CPT code 03</EnumValue>
                <EnumValue name="MilitaryTreatFac">9. CPT code 26</EnumValue>
                <EnumValue name="FederalHealthCenter">10. CPT code 50</EnumValue>
                <EnumValue name="PublicHealthClinic">11. CPT code 71</EnumValue>
                <EnumValue name="RuralHealthClinic">12. CPT code 72</EnumValue>
            </Enumeration>
        </column>
        <column order="22" name="AccidentRelated" type="char(1)">
            <summary>blank or A=Auto, E=Employment, O=Other.</summary>
        </column>
        <column order="23" name="AccidentDate" type="date">
            <summary>Date of accident, if applicable.</summary>
        </column>
        <column order="24" name="AccidentST" type="varchar(2)">
            <summary>Accident state.</summary>
        </column>
        <column order="25" name="EmployRelated" type="tinyint">
            <summary>Enum:YN .</summary>
            <Enumeration name="YN">
                <summary>Unknown,Yes, or No.</summary>
                <EnumValue name="Unknown">0</EnumValue>
                <EnumValue name="Yes">1</EnumValue>
                <EnumValue name="No">2</EnumValue>
            </Enumeration>
        </column>
        <column order="26" name="IsOrtho" type="tinyint">
            <summary>True if is ortho.</summary>
        </column>
        <column order="27" name="OrthoRemainM" type="tinyint">
            <summary>Remaining months of ortho. Valid values are 1-36.</summary>
        </column>
        <column order="28" name="OrthoDate" type="date">
            <summary>Date ortho appliance placed.</summary>
        </column>
        <column order="29" name="PatRelat" type="tinyint">
            <summary>Enum:Relat  Relationship to subscriber.  The relationship is copied from InsPlan when the claim is created.  It might need to be changed in both places.</summary>
            <Enumeration name="Relat">
                <summary>Relationship to subscriber for insurance.</summary>
                <EnumValue name="Self">0</EnumValue>
                <EnumValue name="Spouse">1</EnumValue>
                <EnumValue name="Child">2</EnumValue>
                <EnumValue name="Employee">3</EnumValue>
                <EnumValue name="HandicapDep">4</EnumValue>
                <EnumValue name="SignifOther">5</EnumValue>
                <EnumValue name="InjuredPlaintiff">6</EnumValue>
                <EnumValue name="LifePartner">7</EnumValue>
                <EnumValue name="Dependent">8</EnumValue>
            </Enumeration>
        </column>
        <column order="30" name="PlanNum2" type="mediumint" fk="insplan">
            <summary>FK to insplan.PlanNum.  Other coverage plan number.  0 if none.  This provides the user with total control over what other coverage shows. This obviously limits the coverage on a single claim to two insurance companies.</summary>
        </column>
        <column order="31" name="PatRelat2" type="tinyint">
            <summary>Enum:Relat  The relationship to the subscriber for other coverage on this claim.</summary>
            <Enumeration name="Relat">
                <summary>Relationship to subscriber for insurance.</summary>
                <EnumValue name="Self">0</EnumValue>
                <EnumValue name="Spouse">1</EnumValue>
                <EnumValue name="Child">2</EnumValue>
                <EnumValue name="Employee">3</EnumValue>
                <EnumValue name="HandicapDep">4</EnumValue>
                <EnumValue name="SignifOther">5</EnumValue>
                <EnumValue name="InjuredPlaintiff">6</EnumValue>
                <EnumValue name="LifePartner">7</EnumValue>
                <EnumValue name="Dependent">8</EnumValue>
            </Enumeration>
        </column>
        <column order="32" name="WriteOff" type="double">
            <summary>Sum of ClaimProc.Writeoff for this claim.</summary>
        </column>
        <column order="33" name="Radiographs" type="tinyint">
            <summary>The number of x-rays enclosed.</summary>
        </column>
        <column order="34" name="ClinicNum" type="smallint(6)" fk="clinic">
            <summary>FK to clinic.ClinicNum.  0 if no clinic.</summary>
        </column>
    </table>
    <table name="claimform">
        <summary>Stores the information for printing different types of claim forms.  Each claimform has many claimformitems attached to it, one for each field on the claimform.  This table has nothing to do with the actual claims.  It just describes how to print them.</summary>
        <column order="0" name="ClaimFormNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="varchar(50)">
            <summary>eg. ADA2002 or CA Medicaid</summary>
        </column>
        <column order="2" name="IsHidden" type="tinyint">
            <summary>If true, then it will not be displayed in various claim form lists as a choice.</summary>
        </column>
        <column order="3" name="FontName" type="varchar(255)">
            <summary>Valid font name for all text on the form.</summary>
        </column>
        <column order="4" name="FontSize" type="float">
            <summary>Font size for all text on the form.</summary>
        </column>
        <column order="5" name="UniqueID" type="varchar(255)">
            <summary>For instance OD12 or JoeDeveloper9.  If you are a developer releasing claimforms, then this should be your name or company followed by a unique number.  This will later make it easier for you to maintain your claimforms for your customers.  All claimforms that we release will be of the form OD##.  Reports that the user creates will have this field blank, protecting them from being changed by us.  So far, we have built the following claimforms: ADA2002=OD1, Denti-Cal=OD2, ADA2000=OD3, HCFA1500=OD4, HCFA1500preprinted=OD5, Canadian=OD6, Belgian=OD7</summary>
        </column>
        <column order="6" name="PrintImages" type="tinyint">
            <summary>Set to false to not print images.  This removes the background for printing on premade forms.</summary>
        </column>
        <column order="7" name="OffsetX" type="smallint(5)">
            <summary>Shifts all items by x/100th's of an inch to compensate for printer, typically less than 1/4 inch.</summary>
        </column>
        <column order="8" name="OffsetY" type="smallint(5)">
            <summary>Shifts all items by y/100th's of an inch to compensate for printer, typically less than 1/4 inch.</summary>
        </column>
    </table>
    <table name="claimformitem">
        <summary>One item is needed for each field on a claimform.</summary>
        <column order="0" name="ClaimFormItemNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="ClaimFormNum" type="mediumint" fk="claimform">
            <summary>FK to claimform.ClaimFormNum</summary>
        </column>
        <column order="2" name="ImageFileName" type="varchar(255)">
            <summary>If this item is an image.  Usually only one per claimform.  eg ADA2002.emf.  Otherwise it MUST be left blank, or it will trigger an error that the image cannot be found.</summary>
        </column>
        <column order="3" name="FieldName" type="varchar(255)">
            <summary>Must be one of the hardcoded available fieldnames for claims.</summary>
        </column>
        <column order="4" name="FormatString" type="varchar(255)">
            <summary>For dates, the format string. ie MM/dd/yyyy or M d y among many other possibilities.</summary>
        </column>
        <column order="5" name="XPos" type="float">
            <summary>The x position of the item on the claim form.  In pixels. 100 pixels per inch.</summary>
        </column>
        <column order="6" name="YPos" type="float">
            <summary>The y position of the item.</summary>
        </column>
        <column order="7" name="Width" type="float">
            <summary>Limits the printable area of the item. Set to zero to not limit.</summary>
        </column>
        <column order="8" name="Height" type="float">
            <summary>Limits the printable area of the item. Set to zero to not limit.</summary>
        </column>
    </table>
    <table name="claimpayment">
        <summary>Each row represents a single check from the insurance company.  The amount may be split between patients using claimprocs.  The amount of the check must always exactly equal the sum of all the claimprocs attached to it.  There might be only one claimproc.</summary>
        <column order="0" name="ClaimPaymentNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="CheckDate" type="date">
            <summary>Date the check was entered into this system, not the date on the check.</summary>
        </column>
        <column order="2" name="CheckAmt" type="double">
            <summary>The amount of the check.</summary>
        </column>
        <column order="3" name="CheckNum" type="varchar(25)">
            <summary>The check number.</summary>
        </column>
        <column order="4" name="BankBranch" type="varchar(25)">
            <summary>Bank and branch.</summary>
        </column>
        <column order="5" name="Note" type="varchar(255)">
            <summary>Note for this check if needed.</summary>
        </column>
        <column order="6" name="ClinicNum" type="smallint" fk="clinic">
            <summary>FK to clinic.ClinicNum.  0 if no clinic.</summary>
        </column>
        <column order="7" name="DepositNum" type="mediumint(9)" fk="deposit">
            <summary>FK to deposit.DepositNum.  0 if not attached to any deposits.</summary>
        </column>
        <column order="8" name="CarrierName" type="varchar(255)">
            <summary>Descriptive name of the carrier just for reporting purposes.</summary>
        </column>
    </table>
    <table name="claimproc">
        <summary>Links procedures to claims.  Also links ins payments to procedures or claims.  Also used for estimating procedures even if no claim yet.  Warning: One proc might be linked twice to a given claim if insurance made two payments.  Many of the important fields are actually optional.  For instance, ProcNum is only required if itemizing ins payment, and ClaimNum is blank if Status=adjustment,cap,or estimate.</summary>
        <column order="0" name="ClaimProcNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="ProcNum" type="mediumint" fk="procedurelog">
            <summary>FK to procedurelog.ProcNum.</summary>
        </column>
        <column order="2" name="ClaimNum" type="mediumint" fk="claim">
            <summary>FK to claim.ClaimNum.</summary>
        </column>
        <column order="3" name="PatNum" type="mediumint" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="4" name="ProvNum" type="smallint" fk="provider">
            <summary>FK to provider.ProvNum.</summary>
        </column>
        <column order="5" name="FeeBilled" type="double">
            <summary>Fee billed to insurance. Might not be the same as the actual fee.  The fee billed can be different than the actual procedure.  For instance, if you have set the insurance plan to bill insurance using UCR fees, then this field will contain the UCR fee instead of the fee that the patient was charged.</summary>
        </column>
        <column order="6" name="InsPayEst" type="double">
            <summary>Actual amount this carrier is expected to pay, after taking everything else into account. Considers annual max, override, percentAmt, copayAmt, deductible, etc. This estimate is computed automatically in TP module, and gets overwritten when sent to ins.</summary>
        </column>
        <column order="7" name="DedApplied" type="double">
            <summary>Deductible applied to this procedure only. If not sent to ins yet, then this will be set to an estimated amount based on the order in the TP.  Will be overwritten when actually sent to ins.</summary>
        </column>
        <column order="8" name="Status" type="tinyint">
            <summary>Enum:ClaimProcStatus .</summary>
            <Enumeration name="ClaimProcStatus">
                <summary>Claimproc Status.  The status must generally be the same as the claim, although it is sometimes not strictly enforced.</summary>
                <EnumValue name="NotReceived">0: For claims that have been created or sent, but have not been received.</EnumValue>
                <EnumValue name="Received">1: For claims that have been received.</EnumValue>
                <EnumValue name="Preauth">2: For preauthorizations.</EnumValue>
                <EnumValue name="Adjustment">3: The only place that this status is used is to make adjustments to benefits from the coverage window.  It is never attached to a claim.</EnumValue>
                <EnumValue name="Supplemental">4:This differs from Received only slightly.  It's for additional payments on procedures already received.  Most fields are blank.</EnumValue>
                <EnumValue name="CapClaim">5: CapClaim is used when you want to send a claim to a capitation insurance company.  These are similar to Supplemental in that there will always be a duplicate claimproc for a procedure. The first claimproc tracks the copay and writeoff, has a status of CapComplete, and is never attached to a claim. The second claimproc has status of CapClaim.</EnumValue>
                <EnumValue name="Estimate">6: Estimates have replaced the fields that were in the procedure table.  Once a procedure is complete, the claimprocstatus will still be Estimate.  An Estimate can be attached to a claim and status gets changed to NotReceived.</EnumValue>
                <EnumValue name="CapComplete">7: For capitation procedures that are complete.  This replaces the old procedurelog.CapCoPay field. This stores the copay and writeoff amounts.  The copay is only there for reference, while it is the writeoff that actually affects the balance. Never attached to a claim. If procedure is TP, then status will be CapEstimate.  Only set to CapComplete if procedure is Complete.</EnumValue>
                <EnumValue name="CapEstimate">8: For capitation procedures that are still estimates rather than complete.  When procedure is completed, this can be changed to CapComplete, but never to anything else.</EnumValue>
            </Enumeration>
        </column>
        <column order="9" name="InsPayAmt" type="double">
            <summary>Amount insurance actually paid.</summary>
        </column>
        <column order="10" name="Remarks" type="varchar(255)">
            <summary>The remarks that insurance sends in the EOB about procedures.</summary>
        </column>
        <column order="11" name="ClaimPaymentNum" type="mediumint" fk="claimpayment">
            <summary>FK to claimpayment.ClaimPaymentNum(the insurance check).</summary>
        </column>
        <column order="12" name="PlanNum" type="mediumint" fk="insplan">
            <summary>FK to insplan.PlanNum</summary>
        </column>
        <column order="13" name="DateCP" type="date">
            <summary>This is the date that is used for payment reports and tracks the payment date.  Always exactly matches the date of the ClaimPayment it's attached to.  See the note under Ledgers.ComputePayments.  This will eventually not be used for aging. The ProcDate will instead be used. See ProcDate.</summary>
        </column>
        <column order="14" name="WriteOff" type="double">
            <summary>Amount not covered by ins which is written off</summary>
        </column>
        <column order="15" name="CodeSent" type="varchar(15)">
            <summary>The procedure code that was sent to insurance. This is not necessarily the usual procedure code.  It will already have been trimmed to 5 char if it started with "D", or it could be the alternate code.  Not allowed to be blank if it is procedure.</summary>
        </column>
        <column order="16" name="AllowedAmt" type="double">
            <summary>-1 if blank which indicates allowed is same as fee. This is the amount that the percentage is based on. Usually the same as the fee, unless this ins plan has lower UCR. Could also be different for ins substitutions, like posterior composites. If -1, then it might be changed during Procedure.ComputeEstimates/ClaimProc.ComputeBaseEst.  But once there is a value, it is guaranteed not to be changed unless user changes it.</summary>
        </column>
        <column order="17" name="Percentage" type="tinyint(4)">
            <summary>-1 if blank.  Otherwise a number between 0 and 100.  The percentage that insurance pays on this procedure, as determined from insurance categories. Not user editable.</summary>
        </column>
        <column order="18" name="PercentOverride" type="tinyint(4)">
            <summary>-1 if blank.  Otherwise a number between 0 and 100.  Can only be changed by user.</summary>
        </column>
        <column order="19" name="CopayAmt" type="double">
            <summary>-1 if blank. Calculated automatically. User can not edit but can use CopayOverride instead.  Opposite of InsEst, because this is the patient portion estimate.  Two different uses: 1. For capitation, this automates calculation of writeoff. 2. For any other insurance, it gets deducted during calculation as shown in the edit window. Neither use directly affects patient balance.</summary>
        </column>
        <column order="20" name="OverrideInsEst" type="double">
            <summary>-1 if blank. Lets user override the percentAmt. This field is not updated when recalculating and is only changed by user.</summary>
        </column>
        <column order="21" name="NoBillIns" type="tinyint">
            <summary>Set to true to not bill to this insurance plan.</summary>
        </column>
        <column order="22" name="DedBeforePerc" type="tinyint">
            <summary>Set true to apply the deductible before the percentage instead of the usual way of applying it after.</summary>
        </column>
        <column order="23" name="OverAnnualMax" type="double">
            <summary>-1 if blank. The amount to subtract during estimating because annual benefits have maxed out.</summary>
        </column>
        <column order="24" name="PaidOtherIns" type="double">
            <summary>-1 if blank. The amount paid by another insurance. This amount is then subtracted from what the current insurance would pay. So, always blank for primary claims.</summary>
        </column>
        <column order="25" name="BaseEst" type="double">
            <summary>Always has a value. Used in TP, etc. The base estimate is the ((fee or allowedAmt)-Copay) x (percentage or percentOverride). Does not include all the extras like ded, annualMax,and paidOtherIns that InsPayEst will hold in future estimating.</summary>
        </column>
        <column order="26" name="CopayOverride" type="double">
            <summary>-1 if blank.  See description of CopayAmt.  This lets the user set a copay that will never be overwritten by automatic calculations.</summary>
        </column>
        <column order="27" name="ProcDate" type="date">
            <summary>Date of the procedure.  Currently only used for tracking annual insurance benefits remaining. Important in Adjustments to benefits.  For total claim payments, MUST be the date of the procedures to correctly figure benefits.  Will eventually transition to use this field to actually calculate aging.  See the note under Ledgers.ComputePayments.</summary>
        </column>
        <column order="28" name="DateEntry" type="date">
            <summary>Date that it was changed to status received or supplemental.  It is usually attached to a claimPayment at that point, but not if user forgets.  This is still the date that it becomes important financial data.  Only applies if Received or Supplemental.  Otherwise, the date is disregarded.  User may never edit. Important in audit trail.</summary>
        </column>
    </table>
    <table name="clearinghouse">
        <summary>Since we can send e-claims to multiple clearinghouses, this table keeps track of each clearinghouse.  Will eventually be used for individual carriers as well if they accept </summary>
        <column order="0" name="ClearinghouseNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>Description of this clearinghouse</summary>
        </column>
        <column order="2" name="ExportPath" type="text">
            <summary>The path to export the X12 file to. Includes \.</summary>
        </column>
        <column order="3" name="IsDefault" type="tinyint">
            <summary>Set to true if this is the default clearinghouse to which you want most of your e-claims sent.</summary>
        </column>
        <column order="4" name="Payors" type="text">
            <summary>A list of all payors which should have claims sent to this clearinghouse. Comma delimited with no spaces.  Not necessary if IsDefault.</summary>
        </column>
        <column order="5" name="Eformat" type="tinyint">
            <summary>Enum:ElectronicClaimFormat The format of the file that gets sent electronically.</summary>
            <Enumeration name="ElectronicClaimFormat">
                <summary>For every type of electronic claim format that Open Dental can create, there will be an item in this enumeration.  All e-claim formats are hard coded due to complexity.</summary>
                <EnumValue name="None">0-Not in database, but used in various places in program.</EnumValue>
                <EnumValue name="X12">1-The American standard. HIPAA mandated.</EnumValue>
                <EnumValue name="Renaissance">2-Proprietary format for Renaissance.</EnumValue>
            </Enumeration>
        </column>
        <column order="6" name="ReceiverID" type="varchar(255)">
            <summary>The ID of the clearinghouse. Provided by them. Usually goes on ISA08. Examples: BCBSGA or 0135WCH00(webMD)</summary>
        </column>
        <column order="7" name="SenderID" type="varchar(255)">
            <summary></summary>
        </column>
        <column order="8" name="Password" type="varchar(255)">
            <summary>Password is usually combined with the login ID for user validation.</summary>
        </column>
        <column order="9" name="ResponsePath" type="varchar(255)">
            <summary>The path that all incoming response files will be saved to. Includes \.</summary>
        </column>
        <column order="10" name="CommBridge" type="tinyint">
            <summary>Enum:EclaimsCommBridge  One of the included hard-coded communications briges.  Or none to just create the claim files without uploading.</summary>
            <Enumeration name="EclaimsCommBridge">
                <summary>Each clearinghouse can have a hard-coded comm bridge which handles all the communications of transfering the claim files to the clearinghouse/carrier.  Does not just include X12, but can include any format at all.</summary>
                <EnumValue name="None">0-No comm bridge will be activated. The claim files will be created to the specified path, but they will not be uploaded.</EnumValue>
                <EnumValue name="WebMD">1</EnumValue>
                <EnumValue name="BCBSGA">2</EnumValue>
                <EnumValue name="Renaissance">3</EnumValue>
                <EnumValue name="ClaimConnect">4</EnumValue>
                <EnumValue name="RECS">5</EnumValue>
                <EnumValue name="Inmediata">6</EnumValue>
                <EnumValue name="AOS">7</EnumValue>
                <EnumValue name="PostnTrack">8</EnumValue>
            </Enumeration>
        </column>
        <column order="11" name="ClientProgram" type="varchar(255)">
            <summary>If applicable, this is the name of the client program to launch.  It is even used by the hard-coded comm bridges, because the user may have changed the installation directory or exe name.</summary>
        </column>
        <column order="12" name="LastBatchNumber" type="smallint">
            <summary>Each clearinghouse increments their batch numbers by one each time a claim file is sent.  User never sees this number.  Maxes out at 999, then loops back to 1.  This field is skipped during all update and retreival except if specifically looking for this one field.  Defaults to 0 for brand new clearinghouses, which causes the first batch to go out as #1.</summary>
        </column>
        <column order="13" name="ModemPort" type="tinyint">
            <summary>1,2,3,or 4. The port that the modem is connected to if applicable. Always uses 9600 baud and standard settings. Will crash if port or modem not valid.</summary>
        </column>
        <column order="14" name="LoginID" type="varchar(255)">
            <summary>A clearinghouse usually has a login ID that is used with the password in order to access the remote server.  This value is not usualy used within the actual claim.</summary>
        </column>
    </table>
    <table name="clinic">
        <summary>A clinic is usually a separate physical office location.  If multiple clinics are sharing one database, then this is used.  Patients, Operatories, Claims, and many other types of objects can be assigned to a clinic.</summary>
        <column order="0" name="ClinicNum" type="smallint">
            <summary>Primary key.  Used in patient,payment,claimpayment,appointment,procedurelog</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="2" name="Address" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="3" name="Address2" type="varchar(255)">
            <summary>Second line of address.</summary>
        </column>
        <column order="4" name="City" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="5" name="State" type="varchar(255)">
            <summary>2 char in the US.</summary>
        </column>
        <column order="6" name="Zip" type="varchar(255)">
            <summary></summary>
        </column>
        <column order="7" name="Phone" type="varchar(255)">
            <summary>Does not include any punctuation.  Should be exactly 10 digits</summary>
        </column>
        <column order="8" name="BankNumber" type="varchar(255)">
            <summary>The account number for deposits.</summary>
        </column>
        <column order="9" name="DefaultPlaceService" type="tinyint">
            <summary>Enum:PlaceOfService Usually 0 unless a mobile clinic for instance.</summary>
            <Enumeration name="PlaceOfService">
                <summary />
                <EnumValue name="Office">0. CPT code 11</EnumValue>
                <EnumValue name="PatientsHome">1. CPT code 12</EnumValue>
                <EnumValue name="InpatHospital">2. CPT code 21</EnumValue>
                <EnumValue name="OutpatHospital">3. CPT code 22</EnumValue>
                <EnumValue name="SkilledNursFac">4. CPT code 31</EnumValue>
                <EnumValue name="AdultLivCareFac">5. CPT code 33</EnumValue>
                <EnumValue name="OtherLocation">6. CPT code ?</EnumValue>
                <EnumValue name="MobileUnit">7. CPT code 15</EnumValue>
                <EnumValue name="School">8. CPT code 03</EnumValue>
                <EnumValue name="MilitaryTreatFac">9. CPT code 26</EnumValue>
                <EnumValue name="FederalHealthCenter">10. CPT code 50</EnumValue>
                <EnumValue name="PublicHealthClinic">11. CPT code 71</EnumValue>
                <EnumValue name="RuralHealthClinic">12. CPT code 72</EnumValue>
            </Enumeration>
        </column>
    </table>
    <table name="clockevent">
        <summary>Each row is either a clock-in or a clock-out event.  This table will soon be significantly changed so that each row will contain both the clock-in and the clock-out.  As it is right now, it's nearly impossible to do queries that give you summary results.</summary>
        <column order="0" name="ClockEventNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="EmployeeNum" type="smallint" fk="employee">
            <summary>FK to employee.EmployeeNum</summary>
        </column>
        <column order="2" name="TimeEntered" type="datetime">
            <summary>The actual time that this entry was entered.</summary>
        </column>
        <column order="3" name="TimeDisplayed" type="datetime">
            <summary>The time to display and to use in all calculations.</summary>
        </column>
        <column order="4" name="ClockIn" type="tinyint">
            <summary>True for ClockIn, and false for ClockOut.</summary>
        </column>
        <column order="5" name="ClockStatus" type="tinyint">
            <summary>Enum:TimeClockStatus  Home, Lunch, or Break.</summary>
            <Enumeration name="TimeClockStatus">
                <summary />
                <EnumValue name="Home">0</EnumValue>
                <EnumValue name="Lunch">1</EnumValue>
                <EnumValue name="Break">2</EnumValue>
            </Enumeration>
        </column>
        <column order="6" name="Note" type="text">
            <summary>.</summary>
        </column>
    </table>
    <table name="commlog">
        <summary>Tracks all forms of communications with patients, including emails, phonecalls, postcards, etc.</summary>
        <column order="0" name="CommlogNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="mediumint" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="2" name="CommDateTime" type="datetime">
            <summary>Date of entry</summary>
        </column>
        <column order="3" name="CommType" type="tinyint">
            <summary>Enum:CommItemType .</summary>
            <Enumeration name="CommItemType">
                <summary>CommItemType of 0 is reserved for later use with user defined types.</summary>
                <EnumValue name="StatementSent">1- auto. </EnumValue>
                <EnumValue name="ApptRelated">2- Any activity related to appointment scheduling.</EnumValue>
                <EnumValue name="Insurance">3- </EnumValue>
                <EnumValue name="Financial">4- </EnumValue>
                <EnumValue name="Recall">5- </EnumValue>
                <EnumValue name="Misc">6- </EnumValue>
            </Enumeration>
        </column>
        <column order="4" name="Note" type="text">
            <summary>Note for this commlog entry.</summary>
        </column>
        <column order="5" name="Mode" type="tinyint">
            <summary>Enum:CommItemMode Phone, email, etc.</summary>
            <Enumeration name="CommItemMode">
                <summary />
                <EnumValue name="None">0- </EnumValue>
                <EnumValue name="Email">1- </EnumValue>
                <EnumValue name="Mail">2</EnumValue>
                <EnumValue name="Phone">3</EnumValue>
                <EnumValue name="InPerson">4</EnumValue>
                <EnumValue name="AutoItem">5</EnumValue>
            </Enumeration>
        </column>
        <column order="6" name="SentOrReceived" type="tinyint">
            <summary>Enum:CommSentOrReceived Neither=0,Sent=1,Received=2.</summary>
            <Enumeration name="CommSentOrReceived">
                <summary />
                <EnumValue name="Neither">0</EnumValue>
                <EnumValue name="Sent">1</EnumValue>
                <EnumValue name="Received">2</EnumValue>
            </Enumeration>
        </column>
        <column order="7" name="EmailMessageNum" type="mediumint" fk="emailmessage">
            <summary>FK to emailmessage.EmailMessageNum, if there is an associated email. Otherwise 0.</summary>
        </column>
    </table>
    <table name="computer">
        <summary>Keeps track of the computers in an office.  The list will eventually become cluttered with the names of old computers that are no longer in service.  The old rows can be safely deleted.  Although the primary key is used in at least one table, this will probably be changed, and the computername will become the primary key.</summary>
        <column order="0" name="ComputerNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="CompName" type="varchar(100)">
            <summary>Name of the computer.</summary>
        </column>
        <column order="2" name="PrinterName" type="varchar(255)">
            <summary>No longer used. Moved to printer table.  Used to hold default printer for each computer</summary>
        </column>
    </table>
    <table name="contact">
        <summary>Like a rolodex for businesses that the office interacts with.  Used to store pharmacies, etc.</summary>
        <column order="0" name="ContactNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="LName" type="varchar(255)">
            <summary>Last name or, frequently, the entire name.</summary>
        </column>
        <column order="2" name="FName" type="varchar(255)">
            <summary>First name is optional.</summary>
        </column>
        <column order="3" name="WkPhone" type="varchar(255)">
            <summary>Work phone.</summary>
        </column>
        <column order="4" name="Fax" type="varchar(255)">
            <summary>Fax number.</summary>
        </column>
        <column order="5" name="Category" type="smallint" fk="definition">
            <summary>FK to definition.DefNum</summary>
        </column>
        <column order="6" name="Notes" type="text">
            <summary>Note for this contact.</summary>
        </column>
    </table>
    <table name="county">
        <summary>Used in public health.</summary>
        <column order="0" name="CountyName" type="varchar(255)">
            <summary>Primary key, but allowed to change.  Change is programmatically synchronized.</summary>
        </column>
        <column order="1" name="CountyCode" type="varchar(255)">
            <summary>Optional. Usage varies.</summary>
        </column>
    </table>
    <table name="covcat">
        <summary>Insurance coverage categories.  They need to look like in the manual for the American calculations to work properly.</summary>
        <column order="0" name="CovCatNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="varchar(50)">
            <summary>Description of this category.</summary>
        </column>
        <column order="2" name="DefaultPercent" type="tinyint(3)">
            <summary>Default percent for this category. -1 to skip this category and not apply a percentage.</summary>
        </column>
        <column order="3" name="CovOrder" type="tinyint">
            <summary>The order in which the categories are displayed.  Includes hidden categories. 0-based.</summary>
        </column>
        <column order="4" name="IsHidden" type="tinyint">
            <summary>If true, this category will be hidden.</summary>
        </column>
        <column order="5" name="EbenefitCat" type="tinyint">
            <summary>Enum:EbenefitCategory  The X12 benefit categories.  Each CovCat can link to one X12 category.  Default is 0 (unlinked).</summary>
            <Enumeration name="EbenefitCategory">
                <summary>The X12 benefit categories.  Used to link the user-defined CovCats to the corresponding X12 category.</summary>
                <EnumValue name="None">0- Default</EnumValue>
                <EnumValue name="General">1- X12: 30 and 35. All ADA codes.</EnumValue>
                <EnumValue name="Diagnostic">2- X12: 23. ADA D0000-D0999</EnumValue>
                <EnumValue name="Periodontics">3- X12: 24. ADA D4000</EnumValue>
                <EnumValue name="Restorative">4- X12: 25. ADA D2000</EnumValue>
                <EnumValue name="Endodontics">5- X12: 26. ADA D3000</EnumValue>
                <EnumValue name="MaxillofacialProsth">6- X12: 27. ADA D5900-D5999</EnumValue>
                <EnumValue name="Crowns">7- X12: 36. Subcategory of restorative.</EnumValue>
                <EnumValue name="Accident">8- X12: 37. ADA range?</EnumValue>
                <EnumValue name="Orthodontics">9- X12: 38. ADA D8000</EnumValue>
                <EnumValue name="Prosthodontics">10- X12: 39. ADA D5000-D5899 (removable), and D6200-D6900 (fixed)</EnumValue>
                <EnumValue name="OralSurgery">11- X12: 40. ADA D7000</EnumValue>
                <EnumValue name="RoutinePreventive">12- X12: 41. ADA D1000</EnumValue>
            </Enumeration>
        </column>
    </table>
    <table name="covspan">
        <summary>Always attached to covcats, this describes the span of procedure codes to which the category applies.</summary>
        <column order="0" name="CovSpanNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="CovCatNum" type="mediumint" fk="covcat">
            <summary>FK to covcat.CovCatNum.</summary>
        </column>
        <column order="2" name="FromCode" type="varchar(15)">
            <summary>Lower range of the span.  Does not need to be a valid code.</summary>
        </column>
        <column order="3" name="ToCode" type="varchar(15)">
            <summary>Upper range of the span.  Does not need to be a valid code.</summary>
        </column>
    </table>
    <table name="definition">
        <summary>The info in the definition table is used by other tables extensively.  Almost every table in the database links to definition.  Almost all links to this table will be to a DefNum.  Using the DefNum, you can find any of the other fields of interest, usually the ItemName.  Make sure to look at the Defs class to see how the definitions are used.  Loaded into memory ahead of time for speed.  Some types of info such as operatories started out life in this table, but then got moved to their own table when more complexity was needed.</summary>
        <column order="0" name="DefNum" type="smallint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Category" type="tinyint">
            <summary>Enum:DefCat</summary>
            <Enumeration name="DefCat">
                <summary>Definition Category. Go to the definition setup window in the program to see how each of these categories is used.</summary>
                <EnumValue name="AccountColors">0- Colors to display in Account module.</EnumValue>
                <EnumValue name="AdjTypes">1- Adjustment types.</EnumValue>
                <EnumValue name="ApptConfirmed">2- Appointment confirmed types.</EnumValue>
                <EnumValue name="ApptProcsQuickAdd">3- Procedure quick add list for appointments.</EnumValue>
                <EnumValue name="BillingTypes">4- Billing types.</EnumValue>
                <EnumValue name="ClaimFormats">5- Not used.</EnumValue>
                <EnumValue name="DunningMessages">6- Not used.</EnumValue>
                <EnumValue name="FeeSchedNames">7- Fee schedule names.</EnumValue>
                <EnumValue name="MedicalNotes">8- Medical notes for quick paste.</EnumValue>
                <EnumValue name="OperatoriesOld">9- No longer used</EnumValue>
                <EnumValue name="PaymentTypes">10- Payment types.</EnumValue>
                <EnumValue name="ProcCodeCats">11- Procedure code categories.</EnumValue>
                <EnumValue name="ProgNoteColors">12- Progress note colors.</EnumValue>
                <EnumValue name="RecallUnschedStatus">13- Statuses for recall, unscheduled, and next appointments.</EnumValue>
                <EnumValue name="ServiceNotes">14- Service notes for quick paste.</EnumValue>
                <EnumValue name="DiscountTypes">15- Discount types.</EnumValue>
                <EnumValue name="Diagnosis">16- Diagnosis types.</EnumValue>
                <EnumValue name="AppointmentColors">17- Colors to display in the Appointments module.</EnumValue>
                <EnumValue name="ImageCats">18- Image categories.</EnumValue>
                <EnumValue name="ApptPhoneNotes">19- Quick add notes for the ApptPhoneNotes, which is getting phased out.</EnumValue>
                <EnumValue name="TxPriorities">20- Treatment plan priority names.</EnumValue>
                <EnumValue name="MiscColors">21- Miscellaneous color options.</EnumValue>
                <EnumValue name="ChartGraphicColors">22- Colors for the graphical tooth chart.</EnumValue>
                <EnumValue name="ContactCategories">23- Categories for the Contact list.</EnumValue>
                <EnumValue name="LetterMergeCats">24- Categories for Letter Merge.</EnumValue>
                <EnumValue name="BlockoutTypes">25- Types of Schedule Blockouts.</EnumValue>
                <EnumValue name="ProcButtonCats">26- Categories of procedure buttons in Chart module</EnumValue>
            </Enumeration>
        </column>
        <column order="2" name="ItemOrder" type="smallint">
            <summary>Order that each item shows on various lists.</summary>
        </column>
        <column order="3" name="ItemName" type="varchar(255)">
            <summary>Each category is a little different.  This field is usually the common name of the item.</summary>
        </column>
        <column order="4" name="ItemValue" type="varchar(255)">
            <summary>This field can be used to store extra info about the item.</summary>
        </column>
        <column order="5" name="ItemColor" type="int(11)">
            <summary>Some categories include a color option.</summary>
        </column>
        <column order="6" name="IsHidden" type="tinyint">
            <summary>If hidden, the item will not show on any list, but can still be referenced.</summary>
        </column>
    </table>
    <table name="deposit">
        <summary>A deposit slip.  Contains multiple insurance and patient checks.</summary>
        <column order="0" name="DepositNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="DateDeposit" type="date">
            <summary>The date of the deposit.</summary>
        </column>
        <column order="2" name="BankAccountInfo" type="text">
            <summary>User editable.  Usually includes name on the account and account number.  Possibly the bank name as well.</summary>
        </column>
        <column order="3" name="Amount" type="double">
            <summary>Total amount of the deposit. User not allowed to directly edit.</summary>
        </column>
    </table>
    <table name="disease">
        <summary>Each row is one disease that one patient has.  A disease is a medical condition or allergy.  Diseases are defined in the DiseaseDef table.</summary>
        <column order="0" name="DiseaseNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="mediumint" fk="patient">
            <summary>FK to patient.PatNum</summary>
        </column>
        <column order="2" name="DiseaseDefNum" type="mediumint" fk="diseasedef">
            <summary>FK to diseasedef.DiseaseDefNum.  The disease description is in that table.</summary>
        </column>
        <column order="3" name="PatNote" type="text">
            <summary>Any note about this disease that is specific to this patient.</summary>
        </column>
    </table>
    <table name="diseasedef">
        <summary>A list of diseases that can be assigned to patients.  Cannot be deleted if in use by any patients.</summary>
        <column order="0" name="DiseaseDefNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="DiseaseName" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="2" name="ItemOrder" type="smallint">
            <summary>The order that the diseases will show in various lists.</summary>
        </column>
        <column order="3" name="IsHidden" type="tinyint">
            <summary>If hidden, the disease will still show on any patient that it was previously attached to, but it will not be available for future patients.</summary>
        </column>
    </table>
    <table name="docattach">
        <summary>Links documents (images) to patients.  This will allow one document to be shared between multiple patients in a future version.</summary>
        <column order="0" name="DocAttachNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="mediumint" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="2" name="DocNum" type="mediumint" fk="document">
            <summary>FK to document.DocNum.</summary>
        </column>
    </table>
    <table name="document">
        <summary>It should be called image, but the name is for historical reasons.  Represents a single document in the images module.  This table indicates in which patient's folder the image can be found, but the actual attaching of the image to the patient is done by the docattach table.</summary>
        <column order="0" name="DocNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>Description of the document.</summary>
        </column>
        <column order="2" name="DateCreated" type="date">
            <summary>Date created.</summary>
        </column>
        <column order="3" name="DocCategory" type="smallint" fk="definition">
            <summary>FK to definition.DefNum. Cateories for documents.</summary>
        </column>
        <column order="4" name="WithPat" type="mediumint" fk="patient">
            <summary>FK to patient.PatNum.  Patient folder that document is in.(for sharing situations later)</summary>
        </column>
        <column order="5" name="FileName" type="varchar(255)">
            <summary>The name of the file. Does not include any directory info.</summary>
        </column>
        <column order="6" name="ImgType" type="tinyint">
            <summary>Enum:ImageType eg. document, radiograph, photo, file</summary>
            <Enumeration name="ImageType">
                <summary>The type of image for images module.</summary>
                <EnumValue name="Document">0- Includes scanned documents and screenshots.</EnumValue>
                <EnumValue name="Radiograph">1</EnumValue>
                <EnumValue name="Photo">2</EnumValue>
                <EnumValue name="File">3- For instance a Word document or a spreadsheet. Not an image.</EnumValue>
            </Enumeration>
        </column>
        <column order="7" name="IsFlipped" type="tinyint">
            <summary>True if flipped horizontally. A vertical flip would be stored as a horizontal flip plus a 180 rotation.</summary>
        </column>
        <column order="8" name="DegreesRotated" type="smallint">
            <summary>Only allowed 0,90,180, and 270.</summary>
        </column>
        <column order="9" name="ToothNumbers" type="varchar(255)">
            <summary>Incomplete.  An optional list of tooth numbers separated by commas.  The tooth numbers will be in American format and must be processed for display.  When displayed, dashes will be used for sequences of 3 or more tooth numbers.</summary>
        </column>
    </table>
    <table name="dunning">
        <summary>A message that will show on certain patient statements when printing bills.  Criteria must be met in order for the dunning message to show.</summary>
        <column order="0" name="DunningNum" type="smallint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="DunMessage" type="text">
            <summary>The actual dunning message that will go on the patient bill.</summary>
        </column>
        <column order="2" name="BillingType" type="smallint" fk="definition">
            <summary>FK to definition.DefNum.</summary>
        </column>
        <column order="3" name="AgeAccount" type="tinyint">
            <summary>This is an int field, but program forces only 0,30,60,or 90.</summary>
        </column>
        <column order="4" name="InsIsPending" type="tinyint">
            <summary>Enum:YN Set Y to only show if insurance is pending.</summary>
            <Enumeration name="YN">
                <summary>Unknown,Yes, or No.</summary>
                <EnumValue name="Unknown">0</EnumValue>
                <EnumValue name="Yes">1</EnumValue>
                <EnumValue name="No">2</EnumValue>
            </Enumeration>
        </column>
    </table>
    <table name="electid">
        <summary>Corresponds to the electid table in the database. Never editable by users.  We keep this table updated with new numbers as part of upgrades, so never edit this table as it will mess up our primary keys.  Helps with entering elecronic/payor id's as well as keeping track of the specific carrier requirements. Only used by the X12 format.</summary>
        <column order="0" name="ElectIDNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PayorID" type="varchar(255)">
            <summary>aka Electronic ID.  A simple string.</summary>
        </column>
        <column order="2" name="CarrierName" type="varchar(255)">
            <summary>As published. Not editable. Used when doing a search.</summary>
        </column>
        <column order="3" name="IsMedicaid" type="tinyint">
            <summary>True if medicaid. Then, the billing and treating providers will have their Medicaid ID's attached.</summary>
        </column>
        <column order="4" name="ProviderTypes" type="varchar(255)">
            <summary>Integers separated by commas. Each int represents a ProviderSupplementalID type that is required by this insurance. Usually only used for BCBS or other carriers that require supplemental provider id's.  Even if we don't put the supplemental types in here, the user can still add them.  This just helps by doing an additional check for known required types.</summary>
        </column>
        <column order="5" name="Comments" type="text">
            <summary>Any comments. Usually includes enrollment requirements and descriptions of how to use the provider id's supplied by the carrier because they might call them by different names.</summary>
        </column>
    </table>
    <table name="emailmessage">
        <summary>An outgoing email message is stored here.  Always attached to a commlog entry for now.</summary>
        <column order="0" name="EmailMessageNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="mediumint(9)" fk="patient">
            <summary>FK to patient.PatNum</summary>
        </column>
        <column order="2" name="ToAddress" type="text">
            <summary>Single valid email address. Bcc field will be added later.  We will never allow visible cc for privacy reasons.</summary>
        </column>
        <column order="3" name="FromAddress" type="text">
            <summary>Valid email address.</summary>
        </column>
        <column order="4" name="Subject" type="text">
            <summary>Subject line.</summary>
        </column>
        <column order="5" name="BodyText" type="text">
            <summary>Body of the email</summary>
        </column>
        <column order="6" name="MsgDateTime" type="datetime">
            <summary>Date and time the message was sent. Automated field.</summary>
        </column>
    </table>
    <table name="emailtemplate">
        <summary>A template email which can be used as the basis for a new email.</summary>
        <column order="0" name="EmailTemplateNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Subject" type="text">
            <summary>Default subject line.</summary>
        </column>
        <column order="2" name="BodyText" type="text">
            <summary>Body of the email</summary>
        </column>
    </table>
    <table name="employee">
        <summary>An employee at the dental office.</summary>
        <column order="0" name="EmployeeNum" type="smallint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="LName" type="varchar(255)">
            <summary>Employee's last name.</summary>
        </column>
        <column order="2" name="FName" type="varchar(255)">
            <summary>First name.</summary>
        </column>
        <column order="3" name="MiddleI" type="varchar(255)">
            <summary>Middle initial or name.</summary>
        </column>
        <column order="4" name="IsHidden" type="tinyint">
            <summary>If hidden, the employee will not show on the list.</summary>
        </column>
        <column order="5" name="ClockStatus" type="varchar(255)">
            <summary>This is just text used to quickly display the clockstatus.  eg Working,Break,Lunch,Home, etc.</summary>
        </column>
    </table>
    <table name="employer">
        <summary>Most insurance plans are organized by employer.  This table keeps track of the list of employers.  The address fields were added at one point, but I don't know why they don't show in the program in order to edit.  Nobody has noticed their absence even though it's been a few years, so for now we are just using the EmpName and not the address.</summary>
        <column order="0" name="EmployerNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="EmpName" type="varchar(255)">
            <summary>Name of the employer.</summary>
        </column>
        <column order="2" name="Address" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="3" name="Address2" type="varchar(255)">
            <summary>Second line of address.</summary>
        </column>
        <column order="4" name="City" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="5" name="State" type="varchar(255)">
            <summary>2 char in the US.</summary>
        </column>
        <column order="6" name="Zip" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="7" name="Phone" type="varchar(255)">
            <summary>Includes any punctuation.</summary>
        </column>
    </table>
    <table name="fee">
        <summary>There is one entry in this table for each fee for a single procedurecode.  So if there are 5 different fees stored for one procedurecode, then there will be five entries here.</summary>
        <column order="0" name="FeeNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Amount" type="double">
            <summary>The amount usually charged.  If an amount is unknown, then the entire Fee entry is deleted from the database.  The absence of a fee is sometimes shown in the user interface as a blank entry, and sometimes as 0.00.</summary>
        </column>
        <column order="2" name="ADACode" type="varchar(15)" fk="procedurelog">
            <summary>FK to procedurelog.ADACode.</summary>
        </column>
        <column order="3" name="FeeSched" type="smallint" fk="definition">
            <summary>FK to definition.DefNum.</summary>
        </column>
        <column order="4" name="UseDefaultFee" type="tinyint">
            <summary>Not used.</summary>
        </column>
        <column order="5" name="UseDefaultCov" type="tinyint">
            <summary>Not used.</summary>
        </column>
    </table>
    <table name="graphicassembly">
        <summary>All 5 of the graphic tables are completely obsolete now that we have the 3D teeth.</summary>
        <column order="0" name="GAssemblyNum" type="smallint">
            <summary></summary>
        </column>
        <column order="1" name="GTypeNum" type="smallint">
            <summary></summary>
        </column>
        <column order="2" name="GElementNum" type="smallint">
            <summary></summary>
        </column>
    </table>
    <table name="graphicelement">
        <summary></summary>
        <column order="0" name="GElementNum" type="smallint">
            <summary></summary>
        </column>
        <column order="1" name="ToothNum" type="varchar(2)">
            <summary></summary>
        </column>
        <column order="2" name="Description" type="varchar(100)">
            <summary></summary>
        </column>
        <column order="3" name="Surface" type="varchar(5)">
            <summary></summary>
        </column>
        <column order="4" name="ZOrder" type="smallint">
            <summary></summary>
        </column>
    </table>
    <table name="graphicpoint">
        <summary></summary>
        <column order="0" name="GPointNum" type="mediumint">
            <summary></summary>
        </column>
        <column order="1" name="GShapeNum" type="smallint">
            <summary></summary>
        </column>
        <column order="2" name="XPos" type="smallint">
            <summary></summary>
        </column>
        <column order="3" name="YPos" type="smallint">
            <summary></summary>
        </column>
        <column order="4" name="ItemOrder" type="smallint">
            <summary></summary>
        </column>
    </table>
    <table name="graphicshape">
        <summary></summary>
        <column order="0" name="GShapeNum" type="smallint">
            <summary></summary>
        </column>
        <column order="1" name="GElementNum" type="smallint">
            <summary></summary>
        </column>
        <column order="2" name="ShapeType" type="char(1)">
            <summary></summary>
        </column>
        <column order="3" name="Description" type="varchar(100)">
            <summary></summary>
        </column>
    </table>
    <table name="graphictype">
        <summary></summary>
        <column order="0" name="GTypeNum" type="smallint">
            <summary></summary>
        </column>
        <column order="1" name="Description" type="varchar(100)">
            <summary></summary>
        </column>
        <column order="2" name="ItemOrder" type="smallint">
            <summary></summary>
        </column>
        <column order="3" name="BrushType" type="varchar(100)">
            <summary></summary>
        </column>
        <column order="4" name="IsSameEachTooth" type="tinyint">
            <summary></summary>
        </column>
        <column order="5" name="IsHidden" type="tinyint">
            <summary></summary>
        </column>
        <column order="6" name="SpecialType" type="varchar(100)">
            <summary></summary>
        </column>
    </table>
    <table name="grouppermission">
        <summary>Every user group has certain permissions.  This defines a permission for a group.  The absense of permission would cause that row to be deleted from this table.</summary>
        <column order="0" name="GroupPermNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="NewerDate" type="date">
            <summary>Only granted permission if newer than this date.  Can be Minimum (01-01-0001) to always grant permission.</summary>
        </column>
        <column order="2" name="NewerDays" type="mediumint">
            <summary>Can be 0 to always grant permission.  Otherwise, only granted permission if item is newer than the given number of days.  1 would mean only if entered today.</summary>
        </column>
        <column order="3" name="UserGroupNum" type="mediumint" fk="usergroup">
            <summary>FK to usergroup.UserGroupNum.  The user group for which this permission is granted.  If not authorized, then this groupPermission will have been deleted.</summary>
        </column>
        <column order="4" name="PermType" type="tinyint">
            <summary>Enum:Permissions</summary>
            <Enumeration name="Permissions">
                <summary>A hard-coded list of permissions which may be granted to usergroups.</summary>
                <EnumValue name="None">0</EnumValue>
                <EnumValue name="AppointmentsModule">1</EnumValue>
                <EnumValue name="FamilyModule">2</EnumValue>
                <EnumValue name="AccountModule">3</EnumValue>
                <EnumValue name="TPModule">4</EnumValue>
                <EnumValue name="ChartModule">5</EnumValue>
                <EnumValue name="ImagesModule">6</EnumValue>
                <EnumValue name="ManageModule">7</EnumValue>
                <EnumValue name="Setup">8. Currently covers a wide variety of setup functions.</EnumValue>
                <EnumValue name="RxCreate">9</EnumValue>
                <EnumValue name="ProcComplEdit">10</EnumValue>
                <EnumValue name="ChooseDatabase">11</EnumValue>
                <EnumValue name="Schedules">12</EnumValue>
                <EnumValue name="Blockouts">13</EnumValue>
                <EnumValue name="ClaimsSentEdit">14</EnumValue>
                <EnumValue name="PaymentCreate">15</EnumValue>
                <EnumValue name="PaymentEdit">16</EnumValue>
                <EnumValue name="AdjustmentCreate">17</EnumValue>
                <EnumValue name="AdjustmentEdit">18</EnumValue>
                <EnumValue name="UserQuery">19</EnumValue>
                <EnumValue name="StartupSingleUserOld">20.  Not used anymore.</EnumValue>
                <EnumValue name="StartupMultiUserOld">21 Not used anymore.</EnumValue>
                <EnumValue name="Reports">22</EnumValue>
                <EnumValue name="ProcComplCreate">23. Includes setting procedures complete.</EnumValue>
                <EnumValue name="SecurityAdmin">24. At least one user must have this permission.</EnumValue>
                <EnumValue name="AppointmentCreate">25</EnumValue>
                <EnumValue name="AppointmentMove">26</EnumValue>
                <EnumValue name="AppointmentEdit">27</EnumValue>
                <EnumValue name="Backup">28</EnumValue>
                <EnumValue name="TimecardsEditAll">29</EnumValue>
                <EnumValue name="DepositSlips">30</EnumValue>
                <EnumValue name="AccountingEdit">31</EnumValue>
                <EnumValue name="AccountingCreate">32</EnumValue>
            </Enumeration>
        </column>
    </table>
    <table name="insplan">
        <summary>There is a separate insplan in this table for each subscriber.  Subscribers never share insplans, although multiple patients can have the plan assigned to them (with the one subscriber).  But plans can have identical information in them as other plans.  In this case, they are considered similar or identical, and some synchronization can be done.  For some offices, this synchronization will be extensive, with hundreds of identical insplans.</summary>
        <column order="0" name="PlanNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Subscriber" type="mediumint" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="2" name="DateEffective" type="date">
            <summary>Date plan became effective.</summary>
        </column>
        <column order="3" name="DateTerm" type="date">
            <summary>Date plan was terminated</summary>
        </column>
        <column order="4" name="GroupName" type="varchar(50)">
            <summary>Optional</summary>
        </column>
        <column order="5" name="GroupNum" type="varchar(20)">
            <summary>Optional.</summary>
        </column>
        <column order="6" name="PlanNote" type="text">
            <summary>Note for all plans identical to this one.  Always stays in synch with other identical plans regardless of user actions.  If they change it on one, it gets changed on all.</summary>
        </column>
        <column order="7" name="FeeSched" type="smallint" fk="definition">
            <summary>FK to definition.DefNum.  Name of fee schedule is stored in definition.ItemName.</summary>
        </column>
        <column order="8" name="ReleaseInfo" type="tinyint">
            <summary>Release of information signature is on file.</summary>
        </column>
        <column order="9" name="AssignBen" type="tinyint">
            <summary>Assignment of benefits signature is on file.</summary>
        </column>
        <column order="10" name="PlanType" type="char(1)">
            <summary>""=percentage(the default),"f"=flatCopay,"c"=capitation.</summary>
        </column>
        <column order="11" name="ClaimFormNum" type="smallint" fk="claimform">
            <summary>FK to claimform.ClaimFormNum. eg. "0" for ADA2002</summary>
        </column>
        <column order="12" name="UseAltCode" type="tinyint">
            <summary>0=no,1=yes.  could later be extended if more alternates required</summary>
        </column>
        <column order="13" name="ClaimsUseUCR" type="tinyint">
            <summary>Fee billed on claim should be the UCR fee for the patient's provider.</summary>
        </column>
        <column order="14" name="CopayFeeSched" type="smallint" fk="definition">
            <summary>FK to definition.DefNum. Not usually used. This fee schedule holds only co-pays(patient portions).  Only used for Capitation or for fixed copay plans.</summary>
        </column>
        <column order="15" name="SubscriberID" type="varchar(40)">
            <summary>Usually SSN, but can also be changed by user.  No dashes. Not allowed to be blank.</summary>
        </column>
        <column order="16" name="EmployerNum" type="mediumint" fk="employer">
            <summary>FK to employer.EmployerNum.</summary>
        </column>
        <column order="17" name="CarrierNum" type="mediumint" fk="carrier">
            <summary>FK to carrier.CarrierNum.</summary>
        </column>
        <column order="18" name="AllowedFeeSched" type="smallint" fk="Definition">
            <summary>FK to Definition.DefNum. Not usually used.  This fee schedule holds amounts allowed by carriers.</summary>
        </column>
        <column order="19" name="TrojanID" type="varchar(100)">
            <summary>.</summary>
        </column>
        <column order="20" name="DivisionNo" type="varchar(255)">
            <summary>Only used in Canada. It's a suffix to the group number.</summary>
        </column>
        <column order="21" name="BenefitNotes" type="text">
            <summary>User doesn't usually put these in.  Only used when automatically requesting benefits, such as with Trojan.  All the benefits get stored here in text form for later reference.  Specific to one plan and not synchronized because might be specific to subscriber.  If blank, we might add a function to try to find any benefitNote for a similar plan.</summary>
        </column>
        <column order="22" name="IsMedical" type="tinyint">
            <summary>True if this is medical insurance rather than dental insurance.</summary>
        </column>
        <column order="23" name="SubscNote" type="text">
            <summary>Specific to an individual plan and not synchronized in any way.  Use to store any other info that affects coverage.</summary>
        </column>
    </table>
    <table name="instructor">
        <summary>Used by dental schools.</summary>
        <column order="0" name="InstructorNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="LName" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="2" name="FName" type="varchar(255)">
            <summary>.</summary>
        </column>
        <column order="3" name="Suffix" type="varchar(100)">
            <summary>eg DMD, DDS, RDH.</summary>
        </column>
    </table>
    <table name="journalentry">
        <summary>Used in accounting to represent a single credit or debit entry.  There will always be at least 2 journal enties attached to every transaction.  All transactions balance to 0.</summary>
        <column order="0" name="JournalEntryNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="TransactionNum" type="mediumint" fk="transaction">
            <summary>FK to transaction.TransactionNum</summary>
        </column>
        <column order="2" name="AccountNum" type="mediumint" fk="account">
            <summary>FK to account.AccountNum</summary>
        </column>
        <column order="3" name="DateDisplayed" type="date">
            <summary>Always the same for all journal entries within one transaction.</summary>
        </column>
        <column order="4" name="DebitAmt" type="double">
            <summary>Negative numbers never allowed.</summary>
        </column>
        <column order="5" name="CreditAmt" type="double">
            <summary>Negative numbers never allowed.</summary>
        </column>
        <column order="6" name="Memo" type="text">
            <summary>.</summary>
        </column>
        <column order="7" name="Splits" type="text">
            <summary>A human-readable description of the splits.  Used only for display purposes.</summary>
        </column>
        <column order="8" name="CheckNumber" type="varchar(255)">
            <summary>Any user-defined string.  Usually a check number, but can also be D for deposit, Adj, etc.</summary>
        </column>
        <column order="9" name="ReconcileNum" type="mediumint" fk="reconcile">
            <summary>FK to reconcile.ReconcileNum. 0 if not attached to a reconcile. Not allowed to alter amounts if attached.</summary>
        </column>
    </table>
    <table name="language">
        <summary>This is a list of phrases that need to be translated.  The primary key is a combination of the ClassType and the English phrase.  This table is currently filled dynmically at run time, but the plan is to fill it using a tool that parses the code.</summary>
        <column order="0" name="EnglishComments" type="text">
            <summary></summary>
        </column>
        <column order="1" name="ClassType" type="text">
            <summary>A string representing the class where the translation is used. Maximum length is 25 characters.</summary>
        </column>
        <column order="2" name="English" type="text">
            <summary>The English version of the phrase, case sensitive.</summary>
        </column>
        <column order="3" name="IsObsolete" type="tinyint">
            <summary>As this gets more sophisticated, we will use this field to mark some phrases obsolete instead of just deleting them outright.  That way, translators will still have access to them.  For now, this is not used at all.</summary>
        </column>
    </table>
    <table name="languageforeign">
        <summary>Will usually only contain translations for a single foreign language, although more are allowed.  The primary key is a combination of the ClassType and the English phrase and the culture.</summary>
        <column order="0" name="ClassType" type="text">
            <summary>A string representing the class where the translation is used.</summary>
        </column>
        <column order="1" name="English" type="text">
            <summary>The English version of the phrase.  Case sensitive.</summary>
        </column>
        <column order="2" name="Culture" type="varchar(255)">
            <summary>The specific culture name.  Almost always in 5 digit format like this: en-US.</summary>
        </column>
        <column order="3" name="Translation" type="text">
            <summary>The foreign translation.  Remember we use Unicode-8, so this translation can be in any language, including Russian, Hebrew, and Chinese.</summary>
        </column>
        <column order="4" name="Comments" type="text">
            <summary>Comments for other translators for the foreign language.</summary>
        </column>
    </table>
    <table name="letter">
        <summary>These are templates that are used to send simple letters to patients.</summary>
        <column order="0" name="LetterNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>Description of the Letter.</summary>
        </column>
        <column order="2" name="BodyText" type="text">
            <summary>Text of the letter</summary>
        </column>
    </table>
    <table name="lettermerge">
        <summary>Describes the templates for letter merges to Word.</summary>
        <column order="0" name="LetterMergeNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="Description" type="varchar(255)">
            <summary>Description of this letter.</summary>
        </column>
        <column order="2" name="TemplateName" type="varchar(255)">
            <summary>The filename of the Word template. eg MyTemplate.doc.</summary>
        </column>
        <column order="3" name="DataFileName" type="varchar(255)">
            <summary>The name of the data file. eg MyTemplate.txt.</summary>
        </column>
        <column order="4" name="Category" type="smallint" fk="definition">
            <summary>FK to definition.DefNum.</summary>
        </column>
    </table>
    <table name="lettermergefield">
        <summary>When doing a lettermerge, a data file is created with certain fields.  This is a list of those fields for each lettermerge.</summary>
        <column order="0" name="FieldNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="LetterMergeNum" type="mediumint" fk="lettermerge">
            <summary>FK to lettermerge.LetterMergeNum.</summary>
        </column>
        <column order="2" name="FieldName" type="varchar(255)">
            <summary>One of the preset available field names.</summary>
        </column>
    </table>
    <table name="medication">
        <summary>A list of medications, not attached to any particular patient.  Not allowed to delete if in use by a patient.  Not allowed to edit name once created due to possibility of damage to patient record.</summary>
        <column order="0" name="MedicationNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="MedName" type="varchar(255)">
            <summary>Name of the medication.</summary>
        </column>
        <column order="2" name="GenericNum" type="mediumint" fk="medication">
            <summary>FK to medication.MedicationNum.  If this is a generic drug, then the GenericNum will be the same as the MedicationNum.</summary>
        </column>
        <column order="3" name="Notes" type="text">
            <summary>Notes.</summary>
        </column>
    </table>
    <table name="medicationpat">
        <summary>Links medications to patients.</summary>
        <column order="0" name="MedicationPatNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="mediumint" fk="patient">
            <summary>FK to patient.PatNum.</summary>
        </column>
        <column order="2" name="MedicationNum" type="mediumint" fk="medication">
            <summary>FK to medication.MedicationNum.</summary>
        </column>
        <column order="3" name="PatNote" type="text">
            <summary>Medication notes specific to this patient.</summary>
        </column>
    </table>
    <table name="operatory">
        <summary>Each row is a single operatory or column in the appts module.</summary>
        <column order="0" name="OperatoryNum" type="smallint">
            <summary>Primary key</summary>
        </column>
        <column order="1" name="OpName" type="varchar(255)">
            <summary>The full name to show in the column.</summary>
        </column>
        <column order="2" name="Abbrev" type="varchar(255)">
            <summary>5 char or less. Not used much.</summary>
        </column>
        <column order="3" name="ItemOrder" type="smallint">
            <summary>The order that this op column will show.  Changing views only hides some ops; it does not change their order.</summary>
        </column>
        <column order="4" name="IsHidden" type="tinyint">
            <summary>Used instead of deleting to hide an op that is no longer used.</summary>
        </column>
        <column order="5" name="ProvDentist" type="smallint" fk="provider">
            <summary>FK to provider.ProvNum.  The dentist assigned to this op.  If more than one dentist might be assigned to an op, then create a second op and use one for each dentist. If 0, then no dentist is assigned.</summary>
        </column>
        <column order="6" name="ProvHygienist" type="smallint" fk="provider">
            <summary>FK to provider.ProvNum.  The hygienist assigned to this op.  If 0, then no hygienist is assigned.</summary>
        </column>
        <column order="7" name="IsHygiene" type="tinyint">
            <summary>Set true if this is a hygiene operatory.  The hygienist will then be considered the main provider for this op.</summary>
        </column>
        <column order="8" name="ClinicNum" type="smallint" fk="clinic">
            <summary>FK to clinic.ClinicNum.  0 if no clinic.</summary>
        </column>
    </table>
    <table name="patfield">
        <summary>These are custom fields added and managed by the user.</summary>
        <column order="0" name="PatFieldNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PatNum" type="mediumint" fk="patient">
            <summary>FK to patient.PatNum</summary>
        </column>
        <column order="2" name="FieldName" type="varchar(255)" fk="patfielddef">
            <summary>FK to patfielddef.FieldName.  The full name is shown here for ease of use when running queries.  But the user is only allowed to change fieldNames in the patFieldDef setup window.</summary>
        </column>
        <column order="3" name="FieldValue" type="text">
            <summary>Any text that the user types in.</summary>
        </column>
    </table>
    <table name="patfielddef">
        <summary>These are the definitions for the custom patient fields added and managed by the user.</summary>
        <column order="0" name="PatFieldDefNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="FieldName" type="varchar(255)">
            <summary>The name of the field that the user will be allowed to fill in the patient info window.</summary>
        </column>
    </table>
    <table name="patient">
        <summary>One row for each patient.  Includes deleted patients.</summary>
        <column order="0" name="PatNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="LName" type="varchar(100)">
            <summary>Last name.</summary>
        </column>
        <column order="2" name="FName" type="varchar(100)">
            <summary>First name.</summary>
        </column>
        <column order="3" name="MiddleI" type="varchar(100)">
            <summary>Middle initial or name.</summary>
        </column>
        <column order="4" name="Preferred" type="varchar(100)">
            <summary>Preferred name, aka nickname.</summary>
        </column>
        <column order="5" name="PatStatus" type="tinyint">
            <summary>Enum:PatientStatus</summary>
            <Enumeration name="PatientStatus">
                <summary />
                <EnumValue name="Patient">0</EnumValue>
                <EnumValue name="NonPatient">1</EnumValue>
                <EnumValue name="Inactive">2</EnumValue>
                <EnumValue name="Archived">3</EnumValue>
                <EnumValue name="Deleted">4</EnumValue>
                <EnumValue name="Deceased">5</EnumValue>
            </Enumeration>
        </column>
        <column order="6" name="Gender" type="tinyint">
            <summary>Enum:PatientGender</summary>
            <Enumeration name="PatientGender">
                <summary />
                <EnumValue name="Male">0</EnumValue>
                <EnumValue name="Female">1</EnumValue>
                <EnumValue name="Unknown">2- This is not a joke. Required by HIPAA for privacy.</EnumValue>
            </Enumeration>
        </column>
        <column order="7" name="Position" type="tinyint">
            <summary>Enum:PatientPosition Marital status would probably be a better name for this column.</summary>
            <Enumeration name="PatientPosition">
                <summary />
                <EnumValue name="Single">0</EnumValue>
                <EnumValue name="Married">1</EnumValue>
                <EnumValue name="Child">2</EnumValue>
                <EnumValue name="Widowed">3</EnumValue>
                <EnumValue name="Divorced">4</EnumValue>
            </Enumeration>
        </column>
        <column order="8" name="Birthdate" type="date">
            <summary>Age is not stored in the database.  Age is always calculated as needed from birthdate.</summary>
        </column>
        <column order="9" name="SSN" type="varchar(100)">
            <summary>In the US, this is 9 digits, no dashes. For all other countries, any punctuation or format is allowed.</summary>
        </column>
        <column order="10" name="Address" type="varchar(100)">
            <summary>.</summary>
        </column>
        <column order="11" name="Address2" type="varchar(100)">
            <summary>.</summary>
        </column>
        <column order="12" name="City" type="varchar(100)">
            <summary>.</summary>
        </column>
        <column order="13" name="State" type="varchar(100)">
            <summary>2 Char in USA</summary>
        </column>
        <column order="14" name="Zip" type="varchar(100)">
            <summary>Postal code.</summary>
        </column>
        <column order="15" name="HmPhone" type="varchar(30)">
            <summary>Home phone. Includes any punctuation</summary>
        </column>
        <column order="16" name="WkPhone" type="varchar(30)">
            <summary>.</summary>
        </column>
        <column order="17" name="WirelessPhone" type="varchar(30)">
            <summary>.</summary>
        </column>
        <column order="18" name="Guarantor" type="mediumint" fk="patient">
            <summary>FK to patient.PatNum.  Head of household.</summary>
        </column>
        <column order="19" name="CreditType" type="char(1)">
            <summary>Single char. Shows at upper left corner of appointments.  Suggested use is A,B,or C to designate creditworthiness, but it can actually be used for any purpose.</summary>
        </column>
        <column order="20" name="Email" type="varchar(100)">
            <summary>.</summary>
        </column>
        <column order="21" name="Salutation" type="varchar(100)">
            <summary>For example: Dear Mr. Smith.  Not used by the program in any way.</summary>
        </column>
        <column order="22" name="EstBalance" type="double">
            <summary>Current patient balance.(not family). If user has checked BalancesDontSubtractIns in setup, then this will not take into account insurance.  Otherwise, the insurance estimate pending will have already been subtracted.</summary>
        </column>
        <column order="23" name="NextAptNum" type="mediumint">
            <summary>May be 0. Also see the PlannedIsDone field. Otherwise it is the foreign key to appointment.AptNum.  This is the appointment that will show in the Chart module and in the Planned appointment tracker.  It will never show in the Appointments module. In other words, it is the suggested next appoinment rather than an appointment that has already been scheduled.</summary>
        </column>
        <column order="24" name="PriProv" type="smallint" fk="provider">
            <summary>FK to provider.ProvNum.  The patient's primary provider.  Required, although the program is robust enough to handle a missing provNum, and will use the practice default instead.</summary>
        </column>
        <column order="25" name="SecProv" type="smallint" fk="provider">
            <summary>FK to provider.ProvNum.  Secondary provider (hygienist). Optional.</summary>
        </column>
        <column order="26" name="FeeSched" type="smallint" fk="definition">
            <summary>FK to definition.DefNum.  Fee schedule for this patient.  Usually not used.  If missing, the practice default fee schedule is used. If patient has insurance, then the fee schedule for the insplan is used.</summary>
        </column>
        <column order="27" name="BillingType" type="smallint" fk="definition">
            <summary>FK to definition.DefNum.  Must have a value, or the patient will not show on some reports.</summary>
        </column>
        <column order="28" name="ImageFolder" type="varchar(100)">
            <summary>Name of folder where images will be stored. Not editable for now.</summary>
        </column>
        <column order="29" name="AddrNote" type="text">
            <summary>Address or phone note.  Unlimited length in order to handle data from other programs during a conversion.</summary>
        </column>
        <column order="30" name="FamFinUrgNote" type="text">
            <summary>Family financial urgent note.  Only stored with guarantor, and shared for family.</summary>
        </column>
        <column order="31" name="MedUrgNote" type="varchar(255)">
            <summary>Individual patient note for Urgent medical.</summary>
        </column>
        <column order="32" name="ApptModNote" type="varchar(255)">
            <summary>Individual patient note for Appointment module note.</summary>
        </column>
        <column order="33" name="StudentStatus" type="char(1)">
            <summary>Single char for Nonstudent, Parttime, or Fulltime.  Blank=Nonstudent</summary>
        </column>
        <column order="34" name="SchoolName" type="varchar(30)">
            <summary>College name.</summary>
        </column>
        <column order="35" name="ChartNumber" type="varchar(20)">
            <summary>Max 15 char.  Used for reference to previous programs.</summary>
        </column>
        <column order="36" name="MedicaidID" type="varchar(20)">
            <summary>Optional. The Medicaid ID for this patient.</summary>
        </column>
        <column order="37" name="Bal_0_30" type="double">
            <summary>Aged balance from 0 to 30 days old. Aging numbers are for entire family.  Only stored with guarantor.</summary>
        </column>
        <column order="38" name="Bal_31_60" type="double">
            <summary>Aged balance from 31 to 60 days old. Aging numbers are for entire family.  Only stored with guarantor.</summary>
        </column>
        <column order="39" name="Bal_61_90" type="double">
            <summary>Aged balance from 61 to 90 days old. Aging numbers are for entire family.  Only stored with guarantor.</summary>
        </column>
        <column order="40" name="BalOver90" type="double">
            <summary>Aged balance over 90 days old. Aging numbers are for entire family.  Only stored with guarantor.</summary>
        </column>
        <column order="41" name="InsEst" type="double">
            <summary>Insurance Estimate for entire family.</summary>
        </column>
        <column order="42" name="PrimaryTeeth" type="varchar(255)">
            <summary></summary>
        </column>
        <column order="43" name="BalTotal" type="double">
            <summary>Total balance for entire family before insurance estimate.  Not the same as the sum of the 4 aging balances because this can be negative.  Only stored with guarantor.</summary>
        </column>
        <column order="44" name="EmployerNum" type="mediumint" fk="employer">
            <summary>FK to employer.EmployerNum.</summary>
        </column>
        <column order="45" name="EmploymentNote" type="varchar(255)">
            <summary>Not used since version 2.8.</summary>
        </column>
        <column order="46" name="Race" type="tinyint(4)">
            <summary>Enum:PatientRace Race and ethnicity.</summary>
            <Enumeration name="PatientRace">
                <summary>Race and ethnicity for patient. Used by public health.</summary>
                <EnumValue name="Unknown">0</EnumValue>
                <EnumValue name="Multiracial">1</EnumValue>
                <EnumValue name="HispanicLatino">2</EnumValue>
                <EnumValue name="AfricanAmerican">3</EnumValue>
                <EnumValue name="White">4</EnumValue>
                <EnumValue name="HawaiiOrPacIsland">5</EnumValue>
                <EnumValue name="AmericanIndian">6</EnumValue>
                <EnumValue name="Asian">7</EnumValue>
                <EnumValue name="Other">8</EnumValue>
                <EnumValue name="Aboriginal">9</EnumValue>
            </Enumeration>
        </column>
        <column order="47" name="County" type="varchar(255)" fk="county">
            <summary>FK to county.CountyName, although it will not crash if key absent.</summary>
        </column>
        <column order="48" name="GradeSchool" type="varchar(255)" fk="school">
            <summary>FK to school.SchoolName, although it will not crash if key absent.  Name of gradeschool or highschool.</summary>
        </column>
        <column order="49" name="GradeLevel" type="tinyint(4)">
            <summary>Enum:PatientGrade Gradelevel.</summary>
            <Enumeration name="PatientGrade">
                <summary>Grade level used in public health.</summary>
                <EnumValue name="Unknown">0</EnumValue>
                <EnumValue name="First">1</EnumValue>
                <EnumValue name="Second">2</EnumValue>
                <EnumValue name="Third">3</EnumValue>
                <EnumValue name="Fourth">4</EnumValue>
                <EnumValue name="Fifth">5</EnumValue>
                <EnumValue name="Sixth">6</EnumValue>
                <EnumValue name="Seventh">7</EnumValue>
                <EnumValue name="Eighth">8</EnumValue>
                <EnumValue name="Ninth">9</EnumValue>
                <EnumValue name="Tenth">10</EnumValue>
                <EnumValue name="Eleventh">11</EnumValue>
                <EnumValue name="Twelfth">12</EnumValue>
                <EnumValue name="PrenatalWIC">13</EnumValue>
                <EnumValue name="PreK">14</EnumValue>
                <EnumValue name="Kindergarten">15</EnumValue>
                <EnumValue name="Other">16</EnumValue>
            </Enumeration>
        </column>
        <column order="50" name="Urgency" type="tinyint(4)">
            <summary>Enum:TreatmentUrgency Used in public health screenings.</summary>
            <Enumeration name="TreatmentUrgency">
                <summary>For public health.  Unknown, NoProblems, NeedsCarE, or Urgent.</summary>
                <EnumValue name="Unknown"></EnumValue>
                <EnumValue name="NoProblems"></EnumValue>
                <EnumValue name="NeedsCare"></EnumValue>
                <EnumValue name="Urgent"></EnumValue>
            </Enumeration>
        </column>
        <column order="51" name="DateFirstVisit" type="date">
            <summary>The date that the patient first visited the office.  Automated.</summary>
        </column>
        <column order="52" name="ClinicNum" type="smallint" fk="clinic">
            <summary>FK to clinic.ClinicNum. Can be zero if not attached to a clinic or no clinics set up.</summary>
        </column>
        <column order="53" name="HasIns" type="varchar(255)">
            <summary>For now, an 'I' indicates that the patient has insurance.  This is only used when displaying appointments.  It will later be expanded.  User can't edit.</summary>
        </column>
        <column order="54" name="TrophyFolder" type="varchar(255)">
            <summary>The Trophy bridge is inadequate.  This is an attempt to make it usable for offices that have already invested in Trophy hardware.</summary>
        </column>
        <column order="55" name="PlannedIsDone" type="tinyint">
            <summary>This simply indicates whether the 'done' box is checked in the chart module.  Used to be handled as a -1 in the NextAptNum field, but now that field is unsigned.</summary>
        </column>
        <column order="56" name="Premed" type="tinyint">
            <summary>Set to true if patient needs to be premedicated for appointments, includes PAC, halcion, etc.</summary>
        </column>
    </table>
    <table name="patientnote">
        <summary>Essentially more columns in the patient table.  They are stored here because these fields can contain a lot of information, and we want to try to keep the size of the patient table a bit smaller.</summary>
        <column order="0" name="PatNum" type="mediumint" fk="patient">
            <summary>FK to patient.PatNum.  Also the primary key for this table. Always one to one relationship with patient table.  A new patient might not have an entry here until needed.</summary>
        </column>
        <column order="1" name="FamFinancial" type="text">
            <summary>Only one note per family stored with guarantor.</summary>
        </column>
        <column order="2" name="ApptPhone" type="text">
            <summary>No longer used.</summary>
        </column>
        <column order="3" name="Medical" type="text">
            <summary>Medical Summary</summary>
        </column>
        <column order="4" name="Service" type="text">
            <summary>Service notes</summary>
        </column>
        <column order="5" name="MedicalComp" type="text">
            <summary>Complete current Medical History</summary>
        </column>
        <column order="6" name="Treatment" type="text">
            <summary>Shows in the Chart module just below the graphical tooth chart.</summary>
        </column>
    </table>
    <table name="patplan">
        <summary>Each row represents the linking of one insplan to one patient for current coverage.  Dropping a plan will delete the entry in this table.  Deleting a plan will delete the actual insplan (if no dependencies).</summary>
        <column order="0" name="PatPlanNum" type="mediumint">
            <summary>Primary key</summary>
        </column>
        <column order="1" name="PatNum" type="mediumint" fk=" patient">
            <summary>FK to  patient.PatNum.  The patient who currently has the insurance.  Not the same as the subscriber.</summary>
        </column>
        <column order="2" name="PlanNum" type="mediumint" fk="insplan">
            <summary>FK to insplan.PlanNum.  The insurance plan attached to the patient.</summary>
        </column>
        <column order="3" name="Ordinal" type="tinyint">
            <summary>Number like 1, 2, 3, etc.  Represents primary ins, secondary ins, tertiary ins, etc. 0 is not used</summary>
        </column>
        <column order="4" name="IsPending" type="tinyint">
            <summary>For informational purposes only. For now, we lose the previous feature which let us set isPending without entering a plan.  Now, you have to enter the plan in order to check this box.</summary>
        </column>
        <column order="5" name="Relationship" type="tinyint">
            <summary>Enum:Relat Remember that this may need to be changed in the Claim also, if already created.</summary>
            <Enumeration name="Relat">
                <summary>Relationship to subscriber for insurance.</summary>
                <EnumValue name="Self">0</EnumValue>
                <EnumValue name="Spouse">1</EnumValue>
                <EnumValue name="Child">2</EnumValue>
                <EnumValue name="Employee">3</EnumValue>
                <EnumValue name="HandicapDep">4</EnumValue>
                <EnumValue name="SignifOther">5</EnumValue>
                <EnumValue name="InjuredPlaintiff">6</EnumValue>
                <EnumValue name="LifePartner">7</EnumValue>
                <EnumValue name="Dependent">8</EnumValue>
            </Enumeration>
        </column>
        <column order="6" name="PatID" type="varchar(100)">
            <summary>An optional patient ID which will override the SSN on eclaims if present.  Subscriber ID is part of the insplan.</summary>
        </column>
    </table>
    <table name="payment">
        <summary>A patient payment.  Always has at least one split.</summary>
        <column order="0" name="PayNum" type="mediumint">
            <summary>Primary key.</summary>
        </column>
        <column order="1" name="PayType" type="smallint" fk="definitio