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_SALE_CONTRACT_OFFER_COORDINATOR

AutoScript

start_agent_info
   AgentName = "AU_SALE_CONTRACT_OFFER_COORDINATOR"
   AgentDescr = "Sale Contract Offer Coordinator"
   PR_FNAME = "AU_CONTRACT_E.FM"   
   PR_TNAME = "AU_GOOD"   
   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 Offer"
start_bpm_subactivity "Offer"
    
    rec = __params[1]
    expr = strcat(rec,"=AU_EVENT")
    call OpenFormTop("ptEdit","AU_EVENT_SALE_OFFER_E.FM","WORK.AU_EVENT",1,expr)
    
end_bpm_subactivity
end_bpm_activity

start_bpm_activity "BOM Creation"
start_bpm_subactivity "Offer"
    
    rec = __params[1]
    expr = strcat(rec,"=AU_EVENT")    
    call OnOpenForm_DisablePost()
    call OpenFormTop("ptEdit","AU_EVENT_SALE_OFFER_E.FM","WORK.AU_EVENT",1,expr)
    
end_bpm_subactivity
start_bpm_subactivity "BOM"
        
    rec = __params[2]
    expr = strcat(rec,"=AU_PROD_FORM")
    call OpenFormTop("ptEdit";"AU_PROD_FORM_E.FM";"WORK.AU_PROD_FORM";1,expr,__params[1])
    
end_bpm_subactivity
start_bpm_subactivity "BOM Expanded"
        
    rec = __params[2]
    call OpenFormTop("ptBrowse","AU_PROD_FORM_GOOD_B.FM","QRY.DATA","BOM_MODE",rec)
   
end_bpm_subactivity
end_bpm_activity

start_bpm_activity "BOM in Laboratory"
start_bpm_subactivity "BOM"
        
    rec = __params[2]
    expr = strcat(rec,"=AU_PROD_FORM")
    call OpenFormTop("ptEdit";"AU_PROD_FORM_E.FM";"WORK.AU_PROD_FORM";1;expr,__params[1])
    
end_bpm_subactivity
start_bpm_subactivity "BOM Expanded"
        
    rec = __params[2]
    call OpenFormTop("ptBrowse","AU_PROD_FORM_GOOD_B.FM","QRY.DATA","BOM_MODE",rec)
   
end_bpm_subactivity
end_bpm_activity

start_bpm_activity "BOM Approval"
start_bpm_subactivity "BOM"
        
    rec = __params[2]
    expr = strcat(rec,"=AU_PROD_FORM")
    call OpenFormTop("ptEdit";"AU_PROD_FORM_E.FM";"WORK.AU_PROD_FORM";1;expr,__params[1])
    
end_bpm_subactivity
start_bpm_subactivity "BOM Expanded"
        
    rec = __params[2]
    call OpenFormTop("ptBrowse","AU_PROD_FORM_GOOD_B.FM","QRY.DATA","BOM_MODE",rec)
   
end_bpm_subactivity
start_bpm_subactivity "Standard Cost"
        
    rec = __params[1]
   call OpenFormTop("ptBrowse";"AU_STANDARDCOST_B.FM";"QRY.DATA","EVENT_MODE",rec)
   
end_bpm_subactivity
end_bpm_activity

start_bpm_activity "Send Speciments and Wait"
start_bpm_subactivity "Offer"
    
    rec = __params[1]
    expr = strcat(rec,"=AU_EVENT")
    call OpenFormTop("ptEdit","AU_EVENT_SALE_OFFER_E.FM","WORK.AU_EVENT",1,expr)
    
end_bpm_subactivity
start_bpm_subactivity "BOMs"

    rec = __params[1]
    call OpenFormTop("ptBrowse";"AU_PROD_RECIPIE_B.FM";"QRY.DATA","SOFFER_MODE",rec)
                
end_bpm_subactivity
end_bpm_activity

start_bpm_activity "Offer Costing"
start_bpm_subactivity "Offer"
    
    rec = __params[1]
    expr = strcat(rec,"=AU_EVENT")
    call OpenFormTop("ptEdit","AU_EVENT_SALE_OFFER_E.FM","WORK.AU_EVENT",1,expr)
    
end_bpm_subactivity
start_bpm_subactivity "BOMs"

    rec = __params[1]
    call OpenFormTop("ptBrowse";"AU_PROD_RECIPIE_B.FM";"QRY.DATA","SOFFER_MODE",rec)
                
end_bpm_subactivity
end_bpm_activity

start_bpm_activity "Send Offer and Wait"
start_bpm_subactivity "Offer"
    
    rec = __params[1]
    expr = strcat(rec,"=AU_EVENT")
    call OpenFormTop("ptEdit","AU_EVENT_SALE_OFFER_E.FM","WORK.AU_EVENT",1,expr)
    
end_bpm_subactivity
start_bpm_subactivity "BOMs"

    rec = __params[1]
    call OpenFormTop("ptBrowse";"AU_PROD_RECIPIE_B.FM";"QRY.DATA","SOFFER_MODE",rec)
                
end_bpm_subactivity
start_bpm_subactivity "Standard Cost"
        
    rec = __params[1]
   call OpenFormTop("ptBrowse";"AU_STANDARDCOST_B.FM";"QRY.DATA","EVENT_MODE",rec)
   
end_bpm_subactivity
end_bpm_activity

start_bpm_activity "BOM Costing"
start_bpm_subactivity "BOM"
        
    rec = __params[2]
    expr = strcat(rec,"=AU_PROD_FORM")
    call OpenFormTop("ptEdit";"AU_PROD_FORM_E.FM";"WORK.AU_PROD_FORM";1;expr,__params[1])
    
end_bpm_subactivity
start_bpm_subactivity "BOM Expanded"
        
    rec = __params[2]
    call OpenFormTop("ptBrowse","AU_PROD_FORM_GOOD_B.FM","QRY.DATA","BOM_MODE",rec)
   
end_bpm_subactivity
start_bpm_subactivity "Standard Cost"
        
    rec = __params[1]
   call OpenFormTop("ptBrowse";"AU_STANDARDCOST_B.FM";"QRY.DATA","EVENT_MODE",rec)
   
end_bpm_subactivity
end_bpm_activity

start_bpm_activity "New Contract Offer"
start_bpm_subactivity "Contract Offered"
__params[1] = 162
    rec = __params[1]
    expr = strcat(rec,"=AU_GOOD")
    call OpenFormTop("ptEdit","AU_CONTRACT_E.FM","WORK.AU_GOOD",1,expr)
    
end_bpm_subactivity
start_bpm_subactivity "Offer"
__params[2] = 9
    rec = __params[2]
    expr = strcat(rec,"=AU_EVENT")
    call OpenFormTop("ptEdit","AU_EVENT_SALE_OFFER_E.FM","WORK.AU_EVENT",1,expr)
    
end_bpm_subactivity
start_bpm_validation

    result = 0
    resp_id = LookUpId("AU_GOOD",__params[1],"RESP_USER")
    if (resp_id > 0) then
       result = 1
    else
       call message("Input Responsible Associate!")
    endif            
    
end_bpm_validation
end_bpm_activity

start_bpm_activity "RFQ Completion"
start_bpm_subactivity "Contract Offered"
 __params[1] = 162    
    rec = __params[1]
    expr = strcat(rec,"=AU_GOOD")
    call OnOpenForm_DisablePost()
    call OpenFormTop("ptEdit","AU_CONTRACT_E.FM","WORK.AU_GOOD",1,expr)
    
end_bpm_subactivity
start_bpm_subactivity "Offer"
__params[2] = 9
    rec = __params[2]
    expr = strcat(rec,"=AU_EVENT")
    call OpenFormTop("ptEdit","AU_EVENT_SALE_OFFER_E.FM","WORK.AU_EVENT",1,expr)
    
end_bpm_subactivity
start_bpm_subactivity "RFQ"
 
__params[3] = 17
    rec = __params[3]
    call OpenFormTop("ptBrowse";"AU_BOM_RFQ.FM";"QRY.DATA","BOM_MODE",rec)
    
end_bpm_subactivity
start_bpm_subactivity "BOM by Source"
__params[2] = 9
__params[3] = 17
    rec    = __params[2]
    rfq_id = __params[3]
    call OpenFormTop("ptBrowse";"AU_BOM_B.FM";"QRY.DATA","EVENT_MODE",rec,rfq_id)
   
end_bpm_subactivity
end_bpm_activity

start_bpm_activity "BOM Purchace Orders"
start_bpm_subactivity "Process Form"
    
    rec = __params[1]
    expr = strcat(rec,"=AU_GOOD")
    call OpenFormTop("ptEdit","AU_CONTRACT_E.FM","WORK.AU_GOOD",1,expr)
    
end_bpm_subactivity
start_bpm_validation
    
    result = 1
    
end_bpm_validation
end_bpm_activity

start_bpm_activity "BOM Completion"
start_bpm_subactivity "Contract Offered"
__params[1] = 162
    rec = __params[1]
    expr = strcat(rec,"=AU_GOOD")
    call OpenFormTop("ptEdit","AU_CONTRACT_E.FM","WORK.AU_GOOD",1,expr)
    
end_bpm_subactivity
start_bpm_subactivity "Offer"
__params[2] = 9
    rec = __params[2]    
    expr = strcat(rec,"=AU_EVENT")    
    call OpenFormTop("ptEdit","AU_EVENT_SALE_OFFER_E.FM","WORK.AU_EVENT",1,expr)
    
end_bpm_subactivity
start_bpm_subactivity "BOM Detailed"
__params[2] = 9
    rec = __params[2]
    call OpenFormTop("ptBrowse","AU_PROD_FORM_GOOD_B.FM","QRY.DATA","EVENT_MODE",rec)    
    
end_bpm_subactivity
start_bpm_subactivity "BOM by Source"
__params[2] = 9
__params[3] = 17
    rec    = __params[2]
    rfq_id = __params[3]
    call OpenFormTop("ptBrowse";"AU_BOM_B.FM";"QRY.DATA","EVENT_MODE",rec,rfq_id)
   
end_bpm_subactivity
end_bpm_activity

start_bpm_activity "Quality Specifications of BOM"
start_bpm_subactivity "Contract Offered"
__params[1] = 162
    rec = __params[1]
    expr = strcat(rec,"=AU_GOOD")
    call OnOpenForm_DisablePost()
    call OpenFormTop("ptEdit","AU_CONTRACT_E.FM","WORK.AU_GOOD",1,expr)
    
end_bpm_subactivity
start_bpm_subactivity "Quality Specifications"
__params[2] = 9
    rec = __params[2]
    call OpenFormTop("ptBrowse";"AU_BOM_QA_B.FM";"QRY.DATA","EVENT_MODE",rec)
   
end_bpm_subactivity
end_bpm_activity

start_bpm_activity "RFQ Evaluation"
start_bpm_subactivity "Contract Offered"
 __params[1] = 162    
    rec = __params[1]
    expr = strcat(rec,"=AU_GOOD")
    call OnOpenForm_DisablePost()
    call OpenFormTop("ptEdit","AU_CONTRACT_E.FM","WORK.AU_GOOD",1,expr)
      
end_bpm_subactivity
start_bpm_subactivity "Offer"
__params[2] = 9
    rec = __params[2]
    expr = strcat(rec,"=AU_EVENT")
    call OnOpenForm_DisablePost()    
    call OpenFormTop("ptEdit","AU_EVENT_SALE_OFFER_E.FM","WORK.AU_EVENT",1,expr)
    
end_bpm_subactivity
start_bpm_subactivity "BOM Standard Cost"
__params[2] = 9
     rec = __params[2]
     call OpenFormTop("ptBrowse";"AU_STANDARDCOST_B.FM";"QRY.DATA","EVENT_MODE",rec)
     
end_bpm_subactivity
end_bpm_activity

start_bpm_activity "Labor Costing"
start_bpm_subactivity "Contract Offered"
 __params[1] = 162    
    rec = __params[1]
    expr = strcat(rec,"=AU_GOOD")
    call OnOpenForm_DisablePost()
    call OpenFormTop("ptEdit","AU_CONTRACT_E.FM","WORK.AU_GOOD",1,expr)
      
end_bpm_subactivity
end_bpm_activity

start_bpm_activity "Finalize Cost and Offer"
start_bpm_subactivity "Contract Offered"
 __params[1] = 162    
    rec = __params[1]
    expr = strcat(rec,"=AU_GOOD")
    call OnOpenForm_DisablePost()
    call OpenFormTop("ptEdit","AU_CONTRACT_E.FM","WORK.AU_GOOD",1,expr)
      
end_bpm_subactivity
start_bpm_subactivity "Offer"
__params[2] = 9
    rec = __params[2]
    expr = strcat(rec,"=AU_EVENT")
    call OnOpenForm_DisablePost()    
    call OpenFormTop("ptEdit","AU_EVENT_SALE_OFFER_E.FM","WORK.AU_EVENT",1,expr)
    
end_bpm_subactivity
start_bpm_subactivity "BOM Standard Cost"
__params[2] = 9
     rec = __params[2]
     call OpenFormTop("ptBrowse";"AU_STANDARDCOST_B.FM";"QRY.DATA","EVENT_MODE",rec)
     
end_bpm_subactivity
start_bpm_subactivity "RFQ"
 
__params[3] = 17
    rec = __params[3]
    call OpenFormTop("ptBrowse";"AU_BOM_RFQ.FM";"QRY.DATA","BOM_MODE",rec)
    
end_bpm_subactivity
end_bpm_activity

start_bpm_activity "Send Offer to Customer"
start_bpm_subactivity "Contract Offered"
 __params[1] = 162    
    rec = __params[1]
    expr = strcat(rec,"=AU_GOOD")
    call OnOpenForm_DisablePost()
    call OpenFormTop("ptEdit","AU_CONTRACT_E.FM","WORK.AU_GOOD",1,expr)
      
end_bpm_subactivity
start_bpm_subactivity "Offer"
__params[2] = 9
    rec = __params[2]
    expr = strcat(rec,"=AU_EVENT")
    call OnOpenForm_DisablePost()    
    call OpenFormTop("ptEdit","AU_EVENT_SALE_OFFER_E.FM","WORK.AU_EVENT",1,expr)
    
end_bpm_subactivity
start_bpm_subactivity "BOM Standard Cost"
__params[2] = 9
     rec = __params[2]
     call OpenFormTop("ptBrowse";"AU_STANDARDCOST_B.FM";"QRY.DATA","EVENT_MODE",rec)
     
end_bpm_subactivity
start_bpm_subactivity "RFQ"
 
__params[3] = 17
    rec = __params[3]
    call OpenFormTop("ptBrowse";"AU_BOM_RFQ.FM";"QRY.DATA","BOM_MODE",rec)
    
end_bpm_subactivity
end_bpm_activity

start_bpm_activity "Wait Customer for Offer"
start_bpm_subactivity "Contract Offered"
 __params[1] = 162    
    rec = __params[1]
    expr = strcat(rec,"=AU_GOOD")
    call OnOpenForm_DisablePost()
    call OpenFormTop("ptEdit","AU_CONTRACT_E.FM","WORK.AU_GOOD",1,expr)
      
end_bpm_subactivity
start_bpm_subactivity "Offer"
__params[2] = 9
    rec = __params[2]
    expr = strcat(rec,"=AU_EVENT")
    call OnOpenForm_DisablePost()    
    call OpenFormTop("ptEdit","AU_EVENT_SALE_OFFER_E.FM","WORK.AU_EVENT",1,expr)
    
end_bpm_subactivity
start_bpm_subactivity "BOM Standard Cost"
__params[2] = 9
     rec = __params[2]
     call OpenFormTop("ptBrowse";"AU_STANDARDCOST_B.FM";"QRY.DATA","EVENT_MODE",rec)
     
end_bpm_subactivity
start_bpm_subactivity "RFQ"
 
__params[3] = 17
    rec = __params[3]
    call OpenFormTop("ptBrowse";"AU_BOM_RFQ.FM";"QRY.DATA","BOM_MODE",rec)
    
end_bpm_subactivity
end_bpm_activity

start_action

     {.....The process starts over the Appendign of a Contract with a prospective or existing Customer}
     {.....the only thing that exists until now is a half-completed Contract (AU_GOOD)}

     contr_id = __params[1]
     comm = SelectFrom("SELECT TITLE FROM AU_GOOD WHERE (AU_GOOD=",contr_id,")")
     cust_id = SelectFrom("SELECT CUSTOMER FROM AU_GOOD WHERE (AU_GOOD=",contr_id,")")

     call bpm_setprocedurecomment(comm)
     call bpm_setprocedureowner(__activation_user)
     call bpm_setprocedurebusiness(cust_id)

     {....A Sales Offer record is created to acompaing the Contract}
     {....this is an AU_EVENT record}

     t_event = SelectFrom("SELECT AU_T_EVENT FROM AU_T_EVENT WHERE (CODE='AU_OFFER')")
     rec_id = InsertInto("AU_EVENT","BUSINESS_TO",cust_id,"DATE",crDate,"AU_T_EVENT",t_event,"SUBJECT",comm,"")

     {...The first activitiy is presented to the starter (Project Manager)
     {...the Project Manager defines the Products offered on the Offer}
     
     call bpm_openatonce(1)
     callwait bpm_assign_job ( "New Contract Offer" , __activation_user , "" , 0 , contr_id, rec_id )

     resp_id = LookUpId("AU_GOOD",contr_id,"RESP_USER")
     resp = LookUpId("AU_USER",resp_id,"UNAME")

     {...Create RFQ event (AU_EVENT) for the purcheased Goods}

     t_event = SelectFrom("SELECT AU_T_EVENT FROM AU_T_EVENT WHERE (CODE='AU_OFFER')")
     rfq_id = InsertInto("AU_EVENT","BUSINESS_TO",cust_id,"DATE",crDate,"AU_T_EVENT",t_event,"SUBJECT",comm,"TBL_NAME","AU_EVENT","TBL_REC",rec_id,"TBL_RELAT","BOMFROMSOFFER","")

     {.....start a relation between the AU_EVENT and the AU_PROD_FORM}
     call ExecuteServer("ADD_RELATION", "AU_OFFERTOBOM", "AU_OFFERTOBOM", rfq_id, "", "" ) {....start relations}

     {...The Project Manager completes the Bill Of Materials by creating or taking into account detailed BOM for each subproduct}
     {...the Project Manager defines also wich products will be assemblied and wich will purchase from the market}
     {...so two groups of materials are defined, the Purchased and the Manufactured}

     callwait bpm_assign_job ( "BOM Completion" , resp , "" , 0 , contr_id, rec_id, rfq_id )
                                                                
     {...The Quality Assurance Manager defines detailed specifications for the Products}
     {...this consists in the detailed update for each Product in the final Bill Of Materials}

     callwait bpm_assign_job ( "Quality Specifications of BOM" , resp , "QUALITY ASSURANCE" , 0 , contr_id, rec_id )

     {...The Fnalncial and Purchase Departmens start Requests for Quotation from the market Request for Quoatation..}
     {...for the Purchased Materials. The reqests are acompaigned with the Quality Specifications}
     {...the Purchase department sends RFQ to Suppliers. The received answers to RFQs are evaluated by..}
     {...(Cost and Delivery Time)...}
     {...the Financial Department. Finally for every Purchased material the Preffered Provider is defined}
     {...Additionaly the Financial Department defines Cost Values for Labor (in order to complete the BOM Costing)}

     split_in_branch
        callwait bpm_assign_job ( "RFQ Completion" , "" , "PURCHASE" , 0 , contr_id, rec_id, bom_id )
     and_branch
        callwait bpm_assign_job ( "RFQ Evaluation" , "" , "FINANCIAL" , 0 , contr_id, rec_id, bom_id )
     join_branches

     {...Finall Cost factors are added to the Offer. Offer is now Coplete}

     callwait bpm_assign_job ( "Finalize Cost and Offer" , resp , "" , 0 , contr_id, rec_id, bom_id )

     {...Send Offer to Customer}

     callwait bpm_assign_job ( "Send Offer to Customer" , resp , "" , 0 , contr_id, rec_id, bom_id )

     {....Wait for Customer answer.................................}

     callwait bpm_assign_job ( "Wait Customer for Offer" , resp , "" , 0 , contr_id, rec_id, bom_id )
     check = LookUpId()

     if (check = 1) then

        {....Define Scheduled Manufacturing Plan taking into account Just In Time Delivery from the Suppliers}

        callwait bpm_assign_job ( "Scheduled Manufacturing Plan" , "" , "PURCHASE" , 0 , contr_id, rec_id )

        split_in_branch
         callwait bpm_assign_job ( "Scheduled Purchace Orders" , "" , "PURCHASE" , 0 , contr_id, rec_id )
        and_branch
         callwait bpm_assign_job ( "Scheduled Manufacturing Orders" , "" , "MANUFACTURING" , 0 , contr_id, rec_id )
        join_branches

     endif

end_action