start_agent_info
AgentName = "AU_NEW_LEAD"
AgentDescr = "New Customer Lead"
AgentLanguage = ""
__timer_interval = 0
__is_registered = 1
__delete_on_termination = 0
end_agent_info
start_bpm_activity "Successful Order"
start_bpm_subactivity "Communication Info"
rec = __params[1]
expr = strcat
(rec
,"=AU_NSELL"
)
call OpenFormTop
("ptEdit"
,"
AU_NSELL_E3.FM"
,"WORK.AU_NSELL"
,1
,expr
)
end_bpm_subactivity
start_bpm_subactivity "Order"
rec = __params[2]
expr = strcat
(rec
,"=EVENT"
)
call OpenFormTop
("ptEdit"
,"
Pwl_E00.FM"
,"WORK.EVENT"
,1
,expr
)
end_bpm_subactivity
end_bpm_activity
start_bpm_activity "Unsuccessful Communication"
start_bpm_subactivity "Communication Info"
rec = __params[1]
expr = strcat
(rec
,"=AU_NSELL"
)
call OpenFormTop
("ptEdit"
,"
AU_NSELL_E3.FM"
,"WORK.AU_NSELL"
,1
,expr
)
end_bpm_subactivity
end_bpm_activity
start_bpm_activity "Get Communication Info"
start_bpm_subactivity "Communication Info"
rec = __params[1]
expr = strcat
(rec
,"=AU_NSELL"
)
call OpenFormTop
("ptEdit"
,"
AU_NSELL_E2.FM"
,"WORK.AU_NSELL"
,1
,expr
)
end_bpm_subactivity
start_bpm_subactivity "New Business Partener"
rec = bpm_getrecid
(2
)
if (rec = 0
) then
call OpenFormTop
("ptApp
end"
,"
AU_BUSINESS_E.FM"
,"WORK.AU_BUSINESS"
,1
,"?=AU_BUSINESS"
)
else
expr = strcat
(rec
,"=AU_BUSINESS"
)
call OpenFormTop
("ptEdit"
,"
AU_BUSINESS_E.FM"
,"WORK.AU_BUSINESS"
,1
,expr
)
endif
end_bpm_subactivity
start_bpm_subactivity "New Contact"
rec = bpm_getrecid
(3
)
if (rec = 0
) then
call OpenFormTop
("ptApp
end"
,"
AU_CONTACT_E.FM"
,"WORK.AU_CONTACT"
,1
,"?=AU_CONTACT"
)
else
expr = strcat
(rec
,"=AU_CONTACT"
)
call OpenFormTop
("ptEdit"
,"
AU_CONTACT_E.FM"
,"WORK.AU_CONTACT"
,1
,expr
)
endif
end_bpm_subactivity
start_bpm_validation
rec = bpm_getrecid
(2
)
if (rec <= 0
) then
call message
("Must stored Business!"
)
result = 0
return
endif
rec = bpm_getrecid
(3
)
if (rec <= 0
) then
call message
("Must stored Contact!"
)
result = 0
return
endif
result = 1
end_bpm_validation
end_bpm_activity
start_bpm_activity "In Contact"
start_bpm_subactivity "Communication Info"
rec = __params[1]
expr = strcat
(rec
,"=AU_NSELL"
)
call OpenFormTop
("ptEdit"
,"
AU_NSELL_E3.FM"
,"WORK.AU_NSELL"
,1
,expr
)
end_bpm_subactivity
end_bpm_activity
start_bpm_activity "Get Messages"
start_bpm_subactivity "Communication Info"
rec = __params[1]
expr = strcat
(rec
,"=AU_NSELL"
)
call OpenFormTop
("ptEdit"
,"
AU_NSELL_E2.FM"
,"WORK.AU_NSELL"
,1
,expr
)
end_bpm_subactivity
end_bpm_activity
start_bpm_activity "In Contact
for Sale"
start_bpm_subactivity "Communication Info"
rec = __params[1]
expr = strcat
(rec
,"=AU_NSELL"
)
call OpenFormTop
("ptEdit"
,"
AU_NSELL_E3.FM"
,"WORK.AU_NSELL"
,1
,expr
)
end_bpm_subactivity
start_bpm_subactivity "Business Partener"
rec = __params[2]
expr = strcat
(rec
,"=AU_BUSINESS"
)
call OpenFormTop
("ptEdit"
,"
AU_BUSINESS_E.FM"
,"WORK.AU_BUSINESS"
,1
,expr
)
end_bpm_subactivity
start_bpm_subactivity "Contact"
rec = __params[3]
expr = strcat
(rec
,"=AU_CONTACT"
)
call OpenFormTop
("ptEdit"
,"
AU_CONTACT_E.FM"
,"WORK.AU_CONTACT"
,1
,expr
)
end_bpm_subactivity
start_bpm_subactivity "Sale Offer"
rec = __params[4]
if (rec = 0
) then
rec = bpm_getrecid
(4
)
if (rec = 0
) then
call OpenFormTop
("ptApp
end"
,"
PWL_E00.FM"
,"WORK.EVENT"
,1
,"?=EVENT"
)
else
expr = strcat
(rec
,"=EVENT"
)
call OpenFormTop
("ptEdit"
,"
PWL_E00.FM"
,"WORK.EVENT"
,1
,expr
)
endif
else
expr = strcat
(rec
,"=EVENT"
)
call OpenFormTop
("ptEdit"
,"
PWL_E00.FM"
,"WORK.EVENT"
,1
,expr
)
endif
end_bpm_subactivity
end_bpm_activity
start_bpm_activity "Credit Control"
start_bpm_subactivity "Communication Info"
rec = __params[1]
expr = strcat
(rec
,"=AU_NSELL"
)
call OpenFormTop
("ptEdit"
,"
AU_NSELL_E4.FM"
,"WORK.AU_NSELL"
,1
,expr
)
end_bpm_subactivity
end_bpm_activity
start_bpm_activity "Sales Offer Checking"
start_bpm_subactivity "Communication Info"
rec = __params[1]
expr = strcat
(rec
,"=AU_NSELL"
)
call OpenFormTop
("ptEdit"
,"
AU_NSELL_E3.FM"
,"WORK.AU_NSELL"
,1
,expr
)
end_bpm_subactivity
start_bpm_subactivity "Sales Offer"
rec = __params[2]
expr = strcat
(rec
,"=EVENT"
)
call OpenFormTop
("ptEdit"
,"
Pwl_E00.FM"
,"WORK.EVENT"
,1
,expr
)
end_bpm_subactivity
end_bpm_activity
start_bpm_activity "Sales Offer S
ending"
start_bpm_subactivity "Communication Info"
rec = __params[1]
expr = strcat
(rec
,"=AU_NSELL"
)
call OpenFormTop
("ptEdit"
,"
AU_NSELL_E3.FM"
,"WORK.AU_NSELL"
,1
,expr
)
end_bpm_subactivity
start_bpm_subactivity "Business Partener"
rec = __params[2]
expr = strcat
(rec
,"=AU_BUSINESS"
)
call OpenFormTop
("ptEdit"
,"
AU_BUSINESS_E.FM"
,"WORK.AU_BUSINESS"
,1
,expr
)
end_bpm_subactivity
start_bpm_subactivity "Contact"
rec = __params[3]
expr = strcat
(rec
,"=AU_CONTACT"
)
call OpenFormTop
("ptEdit"
,"
AU_CONTACT_E.FM"
,"WORK.AU_CONTACT"
,1
,expr
)
end_bpm_subactivity
start_bpm_subactivity "Offer"
rec = __params[4]
if (rec = 0
) then
rec = bpm_getrecid
(4
)
if (rec = 0
) then
call OpenFormTop
("ptApp
end"
,"
PWL_E00.FM"
,"WORK.EVENT"
,1
,"?=EVENT"
)
else
expr = strcat
(rec
,"=EVENT"
)
call OpenFormTop
("ptEdit"
,"
PWL_E00.FM"
,"WORK.EVENT"
,1
,expr
)
endif
else
expr = strcat
(rec
,"=EVENT"
)
call OpenFormTop
("ptEdit"
,"
PWL_E00.FM"
,"WORK.EVENT"
,1
,expr
)
endif
end_bpm_subactivity
end_bpm_activity
start_bpm_activity "Customer Booking"
start_bpm_subactivity "Communication Info"
rec = __params[1]
expr = strcat
(rec
,"=NSELL"
)
call OpenFormTop
("ptEdit"
,"
AU_NSELL_E2.FM"
,"WORK.NSELL"
,1
,expr
)
end_bpm_subactivity
start_bpm_subactivity "Business Partener"
rec = __params[2]
expr = strcat
(rec
,"=AU_BUSINESS"
)
call OpenFormTop
("ptEdit"
,"
AU_BUSINESS_E.FM"
,"WORK.AU_BUSINESS"
,1
,expr
)
end_bpm_subactivity
start_bpm_subactivity "Contact"
rec = __params[3]
expr = strcat
(rec
,"=AU_CONTACT"
)
call OpenFormTop
("ptEdit"
,"
AU_CONTACT_E.FM"
,"WORK.AU_CONTACT"
,1
,expr
)
end_bpm_subactivity
start_bpm_subactivity "Customer Booking"
rec = bpm_getrecid
()
if (rec = 0
) then
call OpenFormTop
("ptApp
end"
,"
SYNAL_E01.FM"
,"WORK.SYNAL"
,1
,"?=SYNAL"
)
else
expr = strcat
(rec
,"=SYNAL"
)
call OpenFormTop
("ptEdit"
,"
SYNAL_E01.FM"
,"WORK.SYNAL"
,1
,expr
)
endif
end_bpm_subactivity
end_bpm_activity
start_bpm_activity "New Order"
start_bpm_subactivity "Order"
rec = __params[1]
expr = strcat
(rec
,"=EVENT"
)
call OpenFormTop
("ptEdit"
,"
Pwl_E00.FM"
,"WORK.EVENT"
,1
,expr
)
end_bpm_subactivity
start_bpm_subactivity "Customer"
rec = __params[2]
expr = strcat
(rec
,"=SYNAL"
)
call OpenFormTop
("ptEdit"
,"
SYNAL_E01.FM"
,"WORK.SYNAL"
,1
,expr
)
end_bpm_subactivity
end_bpm_activity
start_bpm_activity "Successful Orderς"
start_bpm_subactivity "Subactivity Name To Change"
{.....a sample snipet of code is the following
(CHANGE IT!
)}
{.....you can add as many
(start_bpm_activity...
end_bpm_subactivity
) sections you want}
rec = __params[1] {...usualy the rec_id passed
to bpm_assign_job}
expr = strcat
(rec
,"=SOME_UNIQUE_FIELD_NAME"
)
call OpenFormTop
("ptEdit"
,"
THE_FORM_NAME_FOR_EDITING.FM"
,"WORK.THE_TABLE_NAME"
,1
,expr
)
end_bpm_subactivity
start_bpm_validation
{.....you can ommit this section
if result is always
(1
) i.e. valid!}
result = 1
end_bpm_validation
end_bpm_activity
start_action
nsell_id = __params[1]
call bpm_setprocedureowner
(__activation_user
) {.....set the procedure owner}
customer = LookUpId
("AU_NSELL"
,nsell_id
,"CUSTOMER_DESCR"
)
call bpm_setprocedurecomment
(customer
) {.....set the procedures comment}
call bpm_setstepcomment
(customer
)
callwait bpm_assign_job
( "Get Communication Info"
, ""
, "SALES SECRETARY"
, 0
, nsell_id
)
bus_id = bpm_getrecid
(2
,__au_step
) {...the AU_BUSINESS}
con_id = bpm_getrecid
(3
,__au_step
) {...the AU_CONTACT}
pel_id = 0 {...the SYNAL}
offer_id = 0 {...the EVENT
(προσφορά στον πελάτη
)}
{ ...keep informed the sales manager... }
comm = strcat
(__activation_user
," with "
, customer
)
call bpm_setstepcomment
(comm
)
step0 = bpm_assign_info
( "In Contact"
, ""
, "SALES MANAGER"
, 0
, nsell_id
, bus_id
, con_id
)
{ ...alert the sales secretary
for client messages }
call bpm_setstepcomment
(comm
)
x = bpm_assign_info
( "Get Messages"
, ""
, "SALES SECRETARY"
, 0
, nsell_id
, bus_id
, con_id
)
if (x > 0
) then
a = 1111
endif
for i = 1
to 1000
finished = LookUpId
("NSELL"
,nsell_id
,"FINISHED"
)
msg = LookUpId
("NSELL"
,nsell_id
,"COMM"
)
status = LookUpId
("NSELL"
,nsell_id
,"STATUS"
)
offer_acc = LookUpId
("NSELL"
,nsell_id
,"OFFER_ACC"
)
comm = strcat
(customer
,"
, "
,status
)
call bpm_setstepcomment
(comm
)
{...........................................................offer has been edited}
if (offer_id > 0
) then
comm = strcat
(customer
,"
, Offer is Checked"
)
call bpm_setstepcomment
(comm
)
step_id = bpm_assign_info
( "In Contact
for Sale"
, __activation_user
, ""
, 0
, nsell_id
, bus_id
, con_id
, offer_id
)
callwait bpm_assign_job
( "Credit Control"
, ""
, "FINANCIAL DEPT"
, 0
, nsell_id
)
callwait bpm_assign_job
( "Sales Offer Checking"
, ""
, "SALES MANAGER"
, 0
, nsell_id
, offer_id
)
call bpm_setstepid
(step_id
)
callwait bpm_assign_job
( "Sales Offer S
ending"
, __activation_user
, ""
, 0
, nsell_id
, bus_id
, con_id
, offer_id
)
start_sql "*" "KOSMOS"
UPDATE NSELL
WHERE (NSELL = :S
)
end_sql
st = QueryByName
()
call TSetParam
(st
,"S"
,nsell_id
)
call TSetFld
(st
,"SEND_OFFER"
,"String"
,"0"
)
call TExecute
(st
)
call FreeEmbSQL
(st
)
endif
{..........................................final offer has aproved }
if (offer_acc = 1
) then
comm = strcat
(customer
,"
, Putted an Order"
)
call bpm_setstepcomment
(comm
)
x = bpm_assign_info
( "In Contact
for Sale"
, __activation_user
, ""
, 0
, nsell_id
, bus_id
, con_id
, offer_id
)
callwait bpm_assign_job
( "Customer Booking"
, ""
, "FINANCIAL DEPT"
, 0
, nsell_id
, bus_id
, con_id
)
pel_id = bpm_getrecid
(4
,__au_step
)
callwait bpm_assign_job
( "New Order"
, ""
, "WAREHOUSE"
, 0
, offer_id
, pel_id
)
finished = 1
endif
if (finished = 1
) then
i = 1000
endif
if (finished = 0
) then
callwait bpm_assign_job
( "In Contact
for Sale"
, __activation_user
, ""
, 0
, nsell_id
, bus_id
, con_id
, offer_id
)
offer_id = bpm_getrecid
(4
,__au_step
)
endif
next
call bpm_setstepid
(step0
)
if (offer_acc = 1
) then
callwait bpm_assign_job
( "Successful Orderς"
, ""
, "SALES MANAGER"
, 0
, nsell_id
, offer_id
)
endif
if (offer_acc = 0
) then
callwait bpm_assign_job
( "Unsuccessful Communication"
, ""
, "SALES MANAGER"
, 0
, nsell_id
)
endif
end_action