Sage 50 functions are available throughout the Articles report script editor. They decode numeric codes stored in the Sage 50 database into human-readable descriptions, and provide utilities specific to Sage 50 data structures. These functions are only relevant when Articles is connected to a Sage 50 data source.
The codes shown here represent a shortened subset of the full list.
AttachmentBundle_ItemType
Returns the description for an attachment bundle item type code.
AttachmentBundle_ItemType(ItemType: Variant): String
| Code | Description |
|---|---|
| 0 | Customer |
| 1 | Vendor |
| 2 | Employee |
| 3 | Inventory Item |
Result := AttachmentBundle_ItemType([Attachments.ItemType]);
// 0 returns 'Customer', 2 returns 'Employee'
AuditTrail_ActionCode
Returns the description for an audit trail action code.
AuditTrail_ActionCode(ActionCode: Variant): String
| Code | Description |
|---|---|
| 0 | Delete |
| 1 | Add |
| 2 | Change |
| 3 | Void |
Result := AuditTrail_ActionCode([AuditTrail.ActionCode]);
// 1 returns 'Add', 3 returns 'Void'
// Flag deletions in an audit report
if AuditTrail_ActionCode([AuditTrail.ActionCode]) = 'Delete' then
Result := '** DELETED **';
CashFlow_TransactionType
Returns the description for a cash flow transaction type code.
CashFlow_TransactionType(TransactionType: Variant): String
| Code | Description |
|---|---|
| 1 | Invoice |
| 2 | Receipt |
| 12 | Payroll |
| 13 | Payment |
Result := CashFlow_TransactionType([CashFlow.TransactionType]);
// 1 returns 'Invoice', 13 returns 'Payment'
Chart_AccountType
Returns the full description for a chart of accounts type code.
Chart_AccountType(AccountType: Variant): String
| Code | Description |
|---|---|
| 0 | Cash |
| 1 | Accounts Receivable |
| 2 | Inventory |
| 10 | Accounts Payable |
| 21 | Income |
| 23 | Cost of Sales |
| 24 | Expenses |
Result := Chart_AccountType([Chart.AccountType]);
// 21 returns 'Income', 24 returns 'Expenses'
Chart_AccountTypeShort
Returns the abbreviated description for a chart of accounts type code. Use this where space is limited.
Chart_AccountTypeShort(AccountType: Variant): String
| Code | Description |
|---|---|
| 0 | Cash |
| 1 | AR |
| 2 | Inventory |
| 10 | AP |
| 21 | Income |
| 23 | Cost of Sales |
| 24 | Expenses |
Result := Chart_AccountTypeShort([Chart.AccountType]);
// 1 returns 'AR', 10 returns 'AP'
CompanyInformation_CompanyType
Returns the description for a company type code.
CompanyInformation_CompanyType(CompanyType: Variant): String
| Code | Description |
|---|---|
| 0 | Corporation |
| 1 | S Corporation |
| 2 | Partnership |
| 3 | Sole Proprietorship |
Result := CompanyInformation_CompanyType([Company.CompanyType]);
// 0 returns 'Corporation', 3 returns 'Sole Proprietorship'
Customers_CreditStatus
Returns the description for a customer credit status code.
Customers_CreditStatus(CreditStatus: Variant): String
| Code | Description |
|---|---|
| 0 | No Credit Limit |
| 1 | Notify Over Limit |
| 2 | Always Notify |
| 3 | Hold Over Limit |
| 4 | Always Hold |
Result := Customers_CreditStatus([Customer.CreditStatus]);
// 3 returns 'Hold Over Limit', 4 returns 'Always Hold'
// Flag customers on hold
if [Customer.CreditStatus] >= 3 then
Result := '** CREDIT HOLD: ' + Customers_CreditStatus([Customer.CreditStatus]) + ' **';
Employees_EthnicOrigin
Returns the description for an employee ethnic origin code.
Employees_EthnicOrigin(EthnicOrigin: Variant): String
| Code | Description |
|---|---|
| 1 | American Indian / Alaska Native |
| 2 | Asian |
| 3 | Black / African American |
| 4 | Hispanic / Latino |
Result := Employees_EthnicOrigin([Employee.EthnicOrigin]);
Employees_FederalFilingStatus
Returns the description for an employee federal filing status code.
Employees_FederalFilingStatus(FederalFilingStatus: Variant): String
Result := Employees_FederalFilingStatus([Employee.FederalFilingStatus]);
// Returns values such as 'Single', 'Married', 'Head of Household'
Employees_I9VerificationStatus
Returns the description for an employee I-9 verification status code.
Employees_I9VerificationStatus(I9VerificationStatus: Variant): String
| Code | Description |
|---|---|
| 0 | Not Specified |
| 1 | Yes |
| 2 | No |
| 3 | Pending |
Result := Employees_I9VerificationStatus([Employee.I9VerificationStatus]);
// 3 returns 'Pending'
Employees_MaritalStatus
Returns the description for an employee marital status code.
Employees_MaritalStatus(MaritalStatus: Variant): String
| Code | Description |
|---|---|
| 0 | Not Specified |
| 1 | Married |
| 2 | Single |
| 3 | Divorced |
| 4 | Widowed |
| 5 | Other |
Result := Employees_MaritalStatus([Employee.MaritalStatus]);
// 1 returns 'Married', 2 returns 'Single'
Employees_PayFrequency
Returns the description for an employee pay frequency code.
Employees_PayFrequency(PayFrequency: Variant): String
| Code | Description |
|---|---|
| 0 | Weekly |
| 1 | Bi-Weekly |
| 2 | Semi-Monthly |
| 3 | Monthly |
| 6 | Annually |
Result := Employees_PayFrequency([Employee.PayFrequency]);
// 1 returns 'Bi-Weekly', 3 returns 'Monthly'
Employees_PayMethod
Returns the description for an employee pay method code.
Employees_PayMethod(PayMethod: Variant): String
| Code | Description |
|---|---|
| -1 / 0 | Salary |
| 1 | Hourly per pay period |
| 2 | Hourly time ticket |
| 3 | Hourly E-ticket |
Result := Employees_PayMethod([Employee.PayMethod]);
// 1 returns 'Hourly per pay period'
Eventlog_EventCategory
Returns the description for an event log category code.
Eventlog_EventCategory(EventCategory: Variant): String
| Code | Description |
|---|---|
| 0 | Activity |
| 1 | Quote Sent |
| 4 | Invoice Sent |
| 13 | Paycheck |
Result := Eventlog_EventCategory([EventLog.EventCategory]);
Eventlog_EventType
Returns the description for an event log type code.
Eventlog_EventType(EventType: Variant): String
| Code | Description |
|---|---|
| 1 | Customer / Prospect |
| 2 | Employee / Sales Rep |
| 3 | Vendor |
| 4 | Todo |
Result := Eventlog_EventType([EventLog.EventType]);
// 1 returns 'Customer / Prospect', 4 returns 'Todo'
GetPeachtreeFlavor
Returns the Sage 50 product edition (First, Pro, Complete, etc.) based on the company data folder version file.
GetPeachtreeFlavor(DataLocation: String): String
| Parameter | Type | Description |
|---|---|---|
| DataLocation | String | The path to the Sage 50 company data folder |
Result := GetPeachtreeFlavor([Company.DataPath]);
// Returns: 'Complete', 'Pro', 'First', etc.
// Show edition in a report header
Result := 'Sage 50 ' + GetPeachtreeFlavor([Company.DataPath]);
InventoryCost_Code
Returns the description for an inventory cost code.
InventoryCost_Code(Code: Variant): String
| Code | Description |
|---|---|
| 10 | Received |
| 20 | Returned Sale |
| 30 | Returned Purchase |
| 40 | Sale |
| 50 | Balance |
Result := InventoryCost_Code([InventoryCost.Code]);
// 40 returns 'Sale', 10 returns 'Received'
InventoryCost_RecordCode
Returns the description for an inventory cost record code.
InventoryCost_RecordCode(RecordCode: Variant): String
| Code | Description |
|---|---|
| 1 | Receipt |
| 3 | Sale |
| 7 | Inventory Adjustment |
| 15 | Balance |
Result := InventoryCost_RecordCode([InventoryCost.RecordCode]);
// 1 returns 'Receipt', 7 returns 'Inventory Adjustment'
JrnlHdr_JournalEx
Returns the extended journal description for a journal code.
JrnlHdr_JournalEx(JournalEx: Variant): String
| Code | Description |
|---|---|
| 1 | General |
| 3 | Cash Receipt |
| 8 | Sales Invoice |
Result := JrnlHdr_JournalEx([JournalHeader.JournalEx]);
JrnlHdr_JrnlTypeEx
Returns the extended journal type description for a journal type code.
JrnlHdr_JrnlTypeEx(JrnlTypeEx: Variant): String
| Code | Description |
|---|---|
| 1 | Write Check |
| 2 | Customer Credit Memo |
| 3 | Vendor Credit Memo |
Result := JrnlHdr_JrnlTypeEx([JournalHeader.JrnlTypeEx]);
// 1 returns 'Write Check'
Jrnlhdr_PayMethod
Returns the payroll pay method or frequency description for a journal header pay method code.
Jrnlhdr_PayMethod(PayMethod: Variant): String
Result := Jrnlhdr_PayMethod([JournalHeader.PayMethod]);
// Returns salary or time ticket variant descriptions
JrnlRow_TrxType
Returns the description for a journal row transaction type code.
JrnlRow_TrxType(TrxType: Variant): String
| Code | Description |
|---|---|
| 0 | Normal |
| 1 | COGS |
| 2 | Inventory Charge |
| 5 | Sales Tax |
| 6 | Freight |
Result := JrnlRow_TrxType([JournalRow.TrxType]);
// 5 returns 'Sales Tax', 6 returns 'Freight'
JrnlSNo_TransactionClass
Returns the description for a journal transaction class code.
JrnlSNo_TransactionClass(TransactionClass: Variant): String
| Code | Description |
|---|---|
| 0 | Reserved |
| 1 | Origination |
| 2 | Intermediate |
| 3 | Sale |
| 4 | Return |
| 5 | Adjustment |
Result := JrnlSNo_TransactionClass([Journal.TransactionClass]);
// 3 returns 'Sale', 4 returns 'Return'
JournalDescription
Returns the full journal description for a journal code.
JournalDescription(JournalCode: Variant): String
| Code | Description |
|---|---|
| 0 | General Journal |
| 1 | Cash Receipts |
| 2 | Cash Disbursements |
| 3 | Sales Journal |
| 4 | Purchases Journal |
| 5 | Payroll Journal |
Result := JournalDescription([Journal.JournalCode]);
// 0 returns 'General Journal', 1 returns 'Cash Receipts'
JournalDescriptionShort
Returns the abbreviated journal code description. Use this where space is limited.
JournalDescriptionShort(JournalCode: Variant): String
| Code | Description |
|---|---|
| 0 | GL |
| 1 | CRJ |
| 2 | CDJ |
| 3 | SJ |
| 4 | PJ |
| 5 | PYR |
Result := JournalDescriptionShort([Journal.JournalCode]);
// 0 returns 'GL', 1 returns 'CRJ'
LineItems_CostingMethod
Returns the description for an inventory costing method code.
LineItems_CostingMethod(CostingMethod: Variant): String
| Code | Description |
|---|---|
| -1 | None |
| 0 | Average |
| 1 | FIFO |
| 2 | LIFO |
| 3 | Specific |
Result := LineItems_CostingMethod([Item.CostingMethod]);
// 1 returns 'FIFO', 2 returns 'LIFO'
LineItem_ItemClass
Returns the description for a line item class code.
LineItem_ItemClass(ItemClass: Variant): String
| Code | Description |
|---|---|
| 0 | Non Stock |
| 1 | Stock |
| 2 | Description |
| 3 | Assembly |
| 4 | Service |
| 5 | Labor |
Result := LineItem_ItemClass([LineItem.ItemClass]);
// 1 returns 'Stock', 4 returns 'Service'
LineItem_WarrantyPeriod
Returns the description for a warranty period unit code.
LineItem_WarrantyPeriod(WarrantyPeriod: Variant): String
| Code | Description |
|---|---|
| 0 | Days |
| 1 | Months |
| 2 | Years |
Result := IntToStr([LineItem.WarrantyLength]) + ' ' +
LineItem_WarrantyPeriod([LineItem.WarrantyPeriod]);
// Returns: '12 Months' or '2 Years'
NumberOfDistributions
Returns the number of distributions for a journal entry.
NumberOfDistributions(ConnectionDef: String; PostOrder: Integer): Integer
| Parameter | Type | Description |
|---|---|---|
| ConnectionDef | String | The connection definition name |
| PostOrder | Integer | The journal post order number |
var count := NumberOfDistributions([ConnectionDef], [Journal.PostOrder]);
Result := IntToStr(count) + ' ' + Pluralize(count, 'distribution', 'distributions');
SagePeriodEndDate
Returns the end date for a specified Sage 50 accounting period.
SagePeriodEndDate(ConnectionDef: String; PeriodNumber: Integer): TDateTime
| Parameter | Type | Description |
|---|---|---|
| ConnectionDef | String | The connection definition name |
| PeriodNumber | Integer | The accounting period number (1-12) |
Result := DateToStr(SagePeriodEndDate([ConnectionDef], [Param.Period]));
// Returns the last date of the specified period
// Show the period range
Result := DateToStr(SagePeriodStartDate([ConnectionDef], [Param.Period])) +
' to ' +
DateToStr(SagePeriodEndDate([ConnectionDef], [Param.Period]));
SagePeriodStartDate
Returns the start date for a specified Sage 50 accounting period.
SagePeriodStartDate(ConnectionDef: String; PeriodNumber: Integer): TDateTime
| Parameter | Type | Description |
|---|---|---|
| ConnectionDef | String | The connection definition name |
| PeriodNumber | Integer | The accounting period number (1-12) |
Result := DateToStr(SagePeriodStartDate([ConnectionDef], [Param.Period]));
// Returns the first date of the specified period
// Use to set a date range for the period
var startDate := SagePeriodStartDate([ConnectionDef], [Param.Period]);
var endDate := SagePeriodEndDate([ConnectionDef], [Param.Period]);
Result := FormatDateRange(startDate, endDate);
Ticket_BillingStatus
Returns the description for a ticket billing status code.
Ticket_BillingStatus(BillingStatus: Variant): String
| Code | Description |
|---|---|
| 1 | Billable |
| 2 | Non-Billable |
| 3 | No Charge |
| 4 | Hold |
Result := Ticket_BillingStatus([Ticket.BillingStatus]);
// 1 returns 'Billable', 4 returns 'Hold'
Ticket_BillingType
Returns the description for a ticket billing type code.
Ticket_BillingType(BillingType: Variant): String
| Code | Description |
|---|---|
| 0 | Admin |
| 1 | Employee Rate |
| 2 | Activity Rate |
| 3 | Override |
| 4 | Flat Fee |
Result := Ticket_BillingType([Ticket.BillingType]);
// 1 returns 'Employee Rate', 4 returns 'Flat Fee'
Ticket_CustJobAdmin
Returns the description for a ticket class code indicating whether the ticket is for a customer, job, or administrative purpose.
Ticket_CustJobAdmin(CustJobAdmin: Variant): String
| Code | Description |
|---|---|
| 1 | Customer |
| 2 | Job |
| 3 | Administrative |
Result := Ticket_CustJobAdmin([Ticket.CustJobAdmin]);
// 1 returns 'Customer', 2 returns 'Job'
Ticket_ItemClass
Returns the description for a ticket item class code.
Ticket_ItemClass(ItemClass: Variant): String
| Code | Description |
|---|---|
| 0 | Time Ticket |
| 1 | Expense Ticket |
Result := Ticket_ItemClass([Ticket.ItemClass]);
// 0 returns 'Time Ticket', 1 returns 'Expense Ticket'
UPSShipment_ServiceLevel
Returns the description for a UPS shipment service level code.
UPSShipment_ServiceLevel(ServiceLevel: Variant): String
| Code | Description |
|---|---|
| 1 | Next Day Air |
| 2 | Second Day Air |
| 3 | Ground |
Result := UPSShipment_ServiceLevel([Shipment.ServiceLevel]);
// 1 returns 'Next Day Air', 3 returns 'Ground'
VendorInsurance_InsuranceType
Returns the description for a vendor insurance type code.
VendorInsurance_InsuranceType(InsuranceType: Variant): String
| Code | Description |
|---|---|
| 1 | Workers Comp |
| 2 | General Liability |
| 3 | Umbrella |
| 4 | Automobile |
Result := VendorInsurance_InsuranceType([VendorInsurance.InsuranceType]);
// 1 returns 'Workers Comp', 2 returns 'General Liability'
Vendors_Type1099
Returns the description for a vendor 1099 type code.
Vendors_Type1099(Type1099: Variant): String
| Code | Description |
|---|---|
| 0 | None |
| 1 | Interest |
| 2 | Misc |
| 3 | Rent |
| 4 | Dividends |
Result := Vendors_Type1099([Vendor.Type1099]);
// 2 returns 'Misc', 3 returns 'Rent'
// Flag vendors that require a 1099
if [Vendor.Type1099] > 0 then
Result := '1099 Required: ' + Vendors_Type1099([Vendor.Type1099]);