Do not let any software impress you!

Only let it convince your intellect.
Slider img 1
Do not look for a business paradise!

It is a waste of time.
Slider img 2
Only yourself can push you uphill.

There is no easy road to prizes.
Slider img 3
Productivity is the name of the game.

And you have to conquer it.
Slider img 4
As long as you understand it,

you will start to build your know-how.
Slider img 5
We can help with that.

We have the tools and the method.
Slider img 6
Procedure : AU_COMPLAINT_COORDINATOR

AutoScript

start_agent_info
   AgentName = "AU_COMPLAINT_COORDINATOR"
   AgentDescr = "Customer Complaint Coordinator"
   AgentLanguage = ""
   __timer_interval = 0 {....define (in seconds) the timer interval for the wake up}
   __delete_on_termination = 0 {....1=the agent frees itself when terminates its task}
end_agent_info

start_bpm_activity "New Customer Complaint"
start_bpm_subactivity "Complaint Form"
                        
     rec = __params[1]
     form = __params[2]
     expr = strcat(rec,"=AU_COMPLAINT")     
     call OnOpenForm_DisableAllFields()
     call OnOpenForm_EnableField("F_CUSTOMER_ID_TITLE")
     call OnOpenForm_EnableField("BYPHONE_FLAG")
     call OnOpenForm_EnableField("INPLACE_FLAG")
     call OnOpenForm_EnableField("COMPLAINT_SUBJECT")
     call OnOpenForm_EnableField("COMPLAINT_COMMENTS")
     call OnOpenForm_EnableField("F_PRODUCT_TITLE")
     call OnOpenForm_EnableField("LOT_NUMBER")
     call OnOpenForm_EnableField("PRODUCT_QANT")     
     call OnOpenForm_EnableField("ODATE")     
     call OnOpenForm_EnableField("F_INSPECTOR_ASSOCIATE_UNAME")     
     call OpenFormTop("ptEdit",form,"WORK.AU_COMPLAINT",1,expr)     
    
end_bpm_subactivity
start_bpm_validation
                        
     rec = __params[1]

     {....check 1}
     sinsp_id = LookUpId("AU_COMPLAINT",rec,"INSPECTOR_ASSOCIATE")
     if (sinsp_id > 0) then
        result = 1        
     else
        call message("You must define the (Sales Inspector Assosiate)")
        result = 0
     endif     
     
     {....check 2}
     byphone_flag = LookUpId("AU_COMPLAINT",rec,"BYPHONE_FLAG")
     inplace_flag = LookUpId("AU_COMPLAINT",rec,"INPLACE_FLAG")
     byphone_flag = val(byphone_flag)
     inplace_flag = val(inplace_flag)
     sum = byphone_flag + inplace_flag
     if (sum <> 1) then
        call message("You must define (By Phone) or (In Place)")
        result = 0                
     endif          
     
     {....check 3}
     comm= LookUpId("AU_COMPLAINT",rec,"COMPLAINT_COMMENTS")
     len = Length(comm)
     if (len > 0) then
     else
        call message("You must write some comments about the complaint")
        result = 0
     endif     
     

end_bpm_validation
end_bpm_activity

start_bpm_activity "Inspect Complaint Valitity"
start_bpm_subactivity "Complaint Form"
                        
     rec = __params[1]
     form = __params[2]
     
     expr = strcat(rec,"=AU_COMPLAINT")     
     call OnOpenForm_DisableAllFields()
     call OnOpenForm_EnableField("INSPECTOR_YES")
     call OnOpenForm_EnableField("INSPECTOR_NO")     
     call OpenFormTop("ptEdit",form,"WORK.AU_COMPLAINT",1,expr)     
    
end_bpm_subactivity
start_bpm_validation
                        
     rec = __params[1]
     
     {....check 1}
     yes_flag = LookUpId("AU_COMPLAINT",rec,"INSPECTOR_YES")
     no_flag = LookUpId("AU_COMPLAINT",rec,"INSPECTOR_NO")
     if (yes_flag <> 1) and (no_flag <> 1) then
        call message("You must accept or reject the complaint")
        result = 0
     else
        result = 1
     endif          
     
end_bpm_validation
end_bpm_activity

start_bpm_activity "Assign Complaint Roles"
start_bpm_subactivity "Complaint Form"
                        
     rec = __params[1]
     form = __params[2]

     expr = strcat(rec,"=CUST_COMPLAINT")
     call OnOpenForm_DisableAllFields()
     call OnOpenForm_EnableField("F_CUSTOMER_RESP_ASSOCIATE_UNAME")
     call OnOpenForm_EnableField("F_POS_INSPECTOR_POS_D")     
     call OpenFormTop("ptEdit",form,"WORK.AU_COMPLAINT",1,expr)     
    
end_bpm_subactivity
start_bpm_subactivity "Complaint Evaluation"
                        
     rec = __params[1]     
     expr = strcat(rec,"=AU_COMPLAINT")     
     call OpenFormTop("ptEdit","AU_COMPLAINT_E1.FM","WORK.AU_COMPLAINT",1,expr)     
    
end_bpm_subactivity
start_bpm_validation
                        
     rec = __params[1]     
     
     {....check 1}
     insp_pos_id = LookUpId("AU_COMPLAINT",rec,"POS_INSPECTOR")
     resp_assos_id = LookUpId("AU_COMPLAINT",rec,"CUSTOMER_RESP_ASSOCIATE")
     if (insp_pos_id > 0) and (resp_assos_id > 0) then
        result = 1
     else
        call message("You must define (Inspecting Department) and (Responding Assosiate)")
        result = 0
     endif                              
     
end_bpm_validation
end_bpm_activity

start_bpm_activity "Inspect Complaint"
start_bpm_subactivity "Complaint Form"
                        
     rec = __params[1]
     form = __params[2]

     expr = strcat(rec,"=AU_COMPLAINT")
     call OnOpenForm_DisableAllFields()     
     call OnOpenForm_EnableField("COMM_INSPECTOR")     
     call OpenFormTop("ptEdit",form,"WORK.AU_COMPLAINT",1,expr)     
    
end_bpm_subactivity
start_bpm_validation
                        
     rec = __params[1]

     {....check 1}
     comm= LookUpId("AU_COMPLAINT",rec,"COMM_INSPECTOR")
     len = Length(comm)
     if (len > 0) then
        result = 1
     else
        call message("You must write some comments about the cause of complaint")
        result = 0
     endif     
     
end_bpm_validation
end_bpm_activity

start_bpm_activity "Respond Customer for Complaint"
start_bpm_subactivity "Complaint Form"
                        
     rec = __params[1]
     form = __params[2]

     expr = strcat(rec,"=AU_COMPLAINT")
     call OnOpenForm_DisableAllFields()     
     call OnOpenForm_EnableField("CUSTOMER_RESP_COMM")     
     call OpenFormTop("ptEdit",form,"WORK.AU_COMPLAINT",1,expr)     
    
end_bpm_subactivity
start_bpm_validation
                        
     rec = __params[1]

     {....check 1}
     comm= LookUpId("AU_COMPLAINT",rec,"CUSTOMER_RESP_COMM")
     len = Length(comm)
     if (len > 0) then
        result = 1
     else
        call message("You must write what you answered the Customer")
        result = 0
     endif     
     
end_bpm_validation
end_bpm_activity

start_bpm_activity "Customer Complaint Information"
start_bpm_subactivity "Complaint Form"
                        
     rec = __params[1]
     form = __params[2]

     expr = strcat(rec,"=AU_COMPLAINT")
     call OnOpenForm_DisableAllFields()     
     call OnOpenForm_EnableField("CEO_COMMENTS")     
     call OpenFormTop("ptEdit",form,"WORK.AU_COMPLAINT",1,expr)     
    
end_bpm_subactivity
start_bpm_validation
                        
     rec = __params[1]
  
     {....check 1}
     comm= LookUpId("AU_COMPLAINT",rec,"CEO_COMMENTS")
     len = Length(comm)
     if (len > 0) then
        result = 1
     else
        call message("You must add some final comments")
        result = 0
     endif     
     
end_bpm_validation
end_bpm_activity

start_bpm_activity "Prev Corr Action"
start_bpm_subactivity "Complaint Form"
                        
     rec = __params[1]
     form = __params[2]

     expr = strcat(rec,"=AU_COMPLAINT")
     call OnOpenForm_DisablePost()     
     call OpenFormTop("ptEdit",form,"WORK.AU_COMPLAINT",1,expr)     
    
end_bpm_subactivity
end_bpm_activity

start_bpm_activity "Preventive and Corrective Action"
start_bpm_subactivity "Complaint Form"
                        
     rec = __params[1]
     form = __params[2]

     expr = strcat(rec,"=AU_COMPLAINT")
     call OnOpenForm_DisablePost()     
     call OpenFormTop("ptEdit",form,"WORK.AU_COMPLAINT",1,expr)     
    
end_bpm_subactivity
end_bpm_activity

start_action

     compl_id = __params[1] {...the first parameter is the complaint record id}
     form     = __params[2]

     call bpm_setprocedureowner(__activation_user)                     {.....set the procedure owner}

     {...................................................define check points}
     call bpm_addcheckpoint("Place Complaint",100)
     call bpm_addcheckpoint("Inspect Validity",100)
     call bpm_addcheckpoint("Assign Roles",100)
     call bpm_addcheckpoint("Inspecting",100)
     call bpm_addcheckpoint("Responding",100)
     call bpm_addcheckpoint("Inform CEO",100)
     call bpm_addcheckpoint("Prev and Corr Action",100)
     call bpm_addcheckpoint("Finished",0)

     {.........................give the registering assosiate and complaint number.......................}

     assos_id = SelectFrom("SELECT AU_USER FROM AU_USER WHERE (UNAME='",__activation_user,"')")

     num = SelectFrom("SELECT MAX(COMPLAINT_NUM) FROM AU_COMPLAINT")
     num = num + 1
     call UpdateField("AU_COMPLAINT",compl_id,"COMPLAINT_NUM",num,"IDATE",crDate,"REG_ASSOSIATE",assos_id)

     cust_id = LookUpId("AU_COMPLAINT",compl_id,"CUSTOMER_ID")
     cust_name = LookUpId("AU_BUSINESS",cust_id,"TITLE")

     call bpm_setprocedurebusiness(cust_id)           {....we can relate processes with businesses!}

     {...........................comlpete the initial form completion...............................}

     call bpm_setcheckpoint("Place Complaint",1)
     call bpm_openatonce(0)
     callwait bpm_assign_job ( "New Customer Complaint" , __activation_user , "" , 0 , compl_id, form )

     sinsp_id = LookUpId("AU_COMPLAINT",compl_id,"INSPECTOR_ASSOCIATE")
     sinsp_name = LookUpId("AU_USER",sinsp_id,"UNAME")
     subj      = LookUpId("AU_COMPLAINT",compl_id,"COMPLAINT_SUBJECT")

     comm = strcat(cust_name," / ",subj)
     comm = Copy(comm,1,80)
     call bpm_setprocedurecomment(comm) {.....set the procedures comment}

     {.............Sales Inspector aproves or rejects the complaint.....................}

     call bpm_setcheckpoint("Inspect Validity",1)
     callwait bpm_assign_job ( "Inspect Complaint Valitity" , sinsp_name, "" , 0 , compl_id, form )

     accept_flag = LookUpId("AU_COMPLAINT",compl_id,"INSPECTOR_YES")

     {.............the complaint has been accepted by the sales inspector................}

     if (accept_flag = 1) then {_b}

        {...to the Quality Assurance Manager to assign the responsible assosiates }

        call bpm_setcheckpoint("Assign Roles",1)
        callwait bpm_assign_job ( "Assign Complaint Roles" , "", "QUALITY ASSURANCE MANAGER" , 0 , compl_id, form )

        {.....inspecting position}
        insp_pos_id = LookUpId("AU_COMPLAINT",compl_id,"POS_INSPECTOR")
        insp_pos_name = LookUpId("AU_POS",insp_pos_id,"POS_D")
        {.....responding assosiate}
        resp_assos_id = LookUpId("AU_COMPLAINT",compl_id,"CUSTOMER_RESP_ASSOCIATE")
        resp_assos_name = LookUpId("AU_USER",resp_assos_id,"UNAME")

        {...inspect complaint.......}
        call bpm_setcheckpoint("Inspecting",1)
        callwait bpm_assign_job ( "Inspect Complaint" , "", insp_pos_name, 0 , compl_id, form )

        {...respond to customer..................}                                
        call bpm_setcheckpoint("Responding",1)
        callwait bpm_assign_job ( "Respond Customer for Complaint" , resp_assos_name, "" , 0 , compl_id, form )

        {......to CEO..................}
        call bpm_setcheckpoint("Inform CEO",1)
        callwait bpm_assign_job ( "Customer Complaint Information" , "", "CEO" , 0 , compl_id, form )

        call bpm_setcheckpoint("Prev and Corr Action",1)
        callwait bpm_assign_job ( "Preventive and Corrective Action" , "", "QUALITY ASSURANCE MANAGER" , 0 , compl_id, form )

     
     endif                     {_b}

     {.......define the complaint as finished.......}
     call UpdateField("AU_COMPLAINT",compl_id,"FINISHED_FLAG","1")

     call bpm_setcheckpoint("Finished",1)
     
end_action