ORDERS
Repository name :   SampDB1
Repository location : C:\Versata_55\Samples\SampDB1
Analysis date :   Tue Sep 16 16:10:05 PDT 2003
Analysis run on machine : TYLER_DELL
Analysis run by user : Tyler
DataObject Name : ORDERS
Description : Orders taken from customers
Attributes Caption Nullability Persistent DataType Business Rule
OrderNumber Order# Optional Persistent AutoNumber
OrderTotal Order Total Optional Persistent Currency Formula(If ( IsPaidByAutoBucks = true ) Then $value = Freight + TaxElse $value = Freight + Tax + AmountItemsEnd If )
OrderPaid Paid Optional Persistent Boolean Default( False )
AmountItems Amount Optional Persistent Currency Sum(OrderItems(ORDERITEM), Amount, RepositoryName = SampDB1 and AttrName = AmountItems and DataObjectName = ORDERS)
Tax Tax Optional Persistent Currency Formula(If ( Inserting OR ( AmountItems <> :Old. AmountItems) ) Then $value = AmountItems * TaxRate( getplacedByCustomer().getState(), getPlacedDate() ) End If /* or, you could code this....If ( Inserting OR ( AmountItems <> :Old. AmountItems) ) Then $value = AmountItems * GetSqlValue(('select taxrate as taxrate from state_tax_schedule where State =''' + getState() + ''' and DateHighRange >= ''' + getPlacedDate().toDefaultSQLServerTimeStampFormat(getMyLocale()) + ''' order by datehighrange'), ('taxrate') ) see corp re-use... */ )
Freight Freight Optional Persistent Currency Formula(If ( AmountItems <= GetFreightBulkDiscountValue() ) Then $value = AmountItems * 0.20Else $value = AmountItems * GetFreightBulkDiscountRate() /* eg, 10% */End If /* For GetFreightBulk.., use Repository Explorer (File View). and examine the CorpReuseExtRulesDataObject */)
ShippedFlag Shipped Optional Persistent Boolean Default(False)
SumAutoBucksEarned Auto Bucks Earned Optional Persistent Currency Sum(OrderItems(ORDERITEM), AutoBucksEarned, RepositoryName = SampDB1 and AttrName = SumAutoBucksEarned and DataObjectName = ORDERS)
AutoBucksUsed Auto Bucks Used Optional Derived Currency Formula(If ( IsPaidByAutoBucks = True /* Yes */ ) Then $value = AmountItems /* discount does not apply */Else $value = 0End If )
IsPaidByAutoBucks Use Auto Bucks Optional Persistent Boolean Default(False)
PlacedDate Placed Date Optional Persistent DateTime Default(date())
DueDate Due Date Optional Persistent DateTime Formula(if inserting and DueDate IS NULL then $value = Add_Months( PlacedDate , 1)end If)
ShipDate Ship Date Optional Persistent DateTime
CurrentYear This Year Optional Persistent Boolean Formula( InCurrentYear( PlacedDate ) )
SalesRepID SalesRep ID Optional Persistent Long
EmpType Employee Type Optional Derived VarChar(1) ParentReplicate(SalesRep(EMPLOYEES), EmpType, Maintained)
CustNum Cust# Required Persistent Long
Constraints When Constraint Error Message
NoDeleteShipped RejectWhen Deleting AND isCurrentEvent( 'ORDERS.Purge') = false AND :Old.ShippedFlag != false AND :Old.OrderPaid != false Shipped order may not be deleted, only purged after payment.
NoRemovalUnpaid RejectWhen Deleting and :Old.ShippedFlag != false and :Old.OrderPaid = false Orders cannot be deleted or purged if they are shipped but not paid
OnlySalesRepsHaveOrders AcceptWhen EmpType = 'C' /* Commission */ Sorry, Only Sales Reps Can Place Orders
Event Condition Action Condition Action
bigOrder OrderTotal > 20000 and ( Inserting or :Old.OrderTotal < 20000) and isNull( 'SalesRepID' ) = false sendMail( getSalesRep().getEmail(), getSalesRep().getReportingDepartment().getManagedBy().getEmail(), 'Large Order from ' + getplacedByCustomer().getName(), 'Congratulations go to ' + getSalesRep().getName() + ' for closing a deal worth $' + getAmountItems().toString() + '! (Order Number: ' + getData('OrderNumber').toString() + ')' , 1);
SetLastOrder Inserting getplacedByCustomer().setLastOrderNum(OrderNumber);getplacedByCustomer().save()
Parent Relationships Parent Child Enforced
ORDERS_JN_ORDERITEM ORDERS (Order) ORDERITEM (OrderItems) Enforced
Child Relationships Child Parent Enforced
CUSTOMERS_JN_ORDERS ORDERS (hasOrders) CUSTOMERS (placedByCustomer) Enforced
EMPLOYEES_JN_ORDERS ORDERS (Orders) EMPLOYEES (SalesRep) Enforced
Indexes
CustNum_PlacedDate_ORDERS CustNum || PlacedDate ||
User Defined Methods Method Signature
addListeners public void SampDB1.ORDERSImpl.addListeners()
getNewObject public static SampDB1.ORDERSImpl SampDB1.ORDERSImpl.getNewObject(versata.vls.Session,boolean)
beforeCommit public void SampDB1.ORDERSImpl.beforeCommit(versata.vls.Session,versata.vls.Response)
sendBigOrderMail public void SampDB1.ORDERSImpl.sendBigOrderMail(long,long,long) throws versata.vls.ServerException
purge public void SampDB1.ORDERSImpl.purge()
Used By Used In
CUSTOMERS Sum OrderTotal
CUSTOMERS Sum OrderTotal
CUSTOMERS Sum SumAutoBucksEarned
CUSTOMERS Sum AutoBucksUsed
CUSTOMERS Count
CUSTOMERS Count
EMPLOYEES Sum OrderTotal
ORDERITEM ParentReplicate ShippedFlag
OrderJoinOptSalesRep QUERY
OrderJoinSalesRep QUERY
OrderJoinSalesRepAndMgr QUERY
OrderJoinSalesRepCust QUERY
OrderJoinSalesRepForTree QUERY
OrdersNoVirtuals QUERY
OrderTotalSalesByCust QUERY
ORDERS FORM Controls_Date:pORDERS
ORDERS FORM Controls_Tree:pORDERS
ORDERS FORM Events_Actions:pORDERS_Grid
ORDERS FORM Events_Tracing:pCUSTOMERS
ORDERS FORM Events_Tracing:pORDERS
ORDERS FORM ShoppingCart:pORDERS
ORDERS FORM PDX_Basic_HTML:pCustomerOrders
ORDERS FORM PDX_Basic_HTML:pCustomerOrders
ORDERS FORM PDX_Basic_HTML:pEditOrder
ORDERS FORM PDX_Basic_Layout:pCUSTOMERS
ORDERS FORM PDX_Basic_Layout:pCUSTOMERS
ORDERS FORM PDX_Conditional_Branching:pORDERS4
ORDERS FORM PDX_Dynamic_Hide_Show_Style:pORDERS_Grid
ORDERS FORM PDX_Groups:pEMPLOYEES
ORDERS FORM PDX_Inclusion:pORDERS8_Grid
ORDERS FORM PDX_Inclusion:pORDERS
ORDERS FORM PDX_Menu_Tabs:pEMPLOYEES
ORDERS FORM PDX_Menu_Tabs:pCUSTOMERS
ORDERS FORM PDX_Menu_Tabs:pORDERS
ORDERS FORM PDX_Return_Command:pCUSTOMERS_ORDERS
ORDERS FORM PDX_Return_Command:pORDERS
ORDERS FORM PDX_Return_Command:gsORDERS
ORDERS FORM SortCombo:pORDERS_Grid
ORDERS FORM _Pick:fEmployee
ORDERS FORM MDI_Application:fCUSTOMERS
ORDERS FORM MDI_Application:fCUSTOMERS
ORDERS FORM Server_Event_Commit:fORDERS
ORDERS FORM Server_Extended_Rules_Functions:ADDORDERS
ORDERS FORM VFC_Swing_Controls:demoVSGridTree
ORDERS FORM VFC_Swing_Controls:demoVSGridTree
ORDERS FORM Client_Formatting_I18N:ORDERS