{ "header": { "version": 1, "type": "record" }, "body": { "record1": { "<1>": "declare function rowexists, msg, post_event\r\ndeclare subroutine create_note\r\n$insert msg_equates\r\n$insert quote_sigs_equ\r\n\r\nif rowexists( 'CAR', .car_ref_id->text ) then\r\n * record already exists so see if it has been signed by the responsible user\r\n * and if so then verify that there is an anticipated in place date\r\n if .resp_signature->text <> '' then\r\n if .ant_car_inplace_date->text <> '' or .confirm_status->value = \"U\" then\r\n * ok they also have the anticipated in place date\r\n * or it is unconfirmed so it may skip to verified status when both signatures\r\n * are entered\r\n end else\r\n MsgInfo = ''\r\n MsgInfo = 'You have signed the CAR, so you must also have an anticipated in place date.'\r\n MsgInfo = 'H'\r\n Void = msg( '', MsgInfo )\r\n Void = post_event( @window:'.ANT_CAR_INPLACE_DATE', 'GOTFOCUS' )\r\n void = set_property( @window:'.ANT_CAR_INPLACE_DATE', 'FOCUS', 1 ) \r\n return 0\r\n end\r\n end\r\n * record already exists so see if it has been set in place\r\n * and if so then verify that there is an in place date\r\n if .car_inplace_signature->text <> '' then\r\n if .car_inplace_date->text <> '' then\r\n * ok they also have the in place date or it has been verified\r\n * due to an unconfirmed CAR\r\n end else\r\n MsgInfo = ''\r\n MsgInfo = 'You have signed the CAR as in place, so you must also have an in place date.'\r\n MsgInfo = 'H'\r\n Void = msg( '', MsgInfo )\r\n Void = post_event( @window:'.CAR_INPLACE_DATE', 'GOTFOCUS' )\r\n void = set_property( @window:'.CAR_INPLACE_DATE', 'FOCUS', 1 ) \r\n return 0\r\n end\r\n end\r\n OrigRespUserId = get_property( @window, '@OrigRespUserID' )\r\n CurRespUserId = .resp_user_id->text\r\n if CurRespUserId <> OrigRespUserId then\r\n if CurRespUserId then\r\n * entry person has changed the responsible person id \r\n * so re-send the message to the new person\r\n create_note( CurRespUserId, 'System', 'CAR#':.car_ref_id->text:' redefined as you being responsible', 'This CAR was modified by ':oconv( @user4, '[XLATE_CONV,LSL_USERS*FIRST_LAST]' ):' on ':oconv( date(), 'D2/' ):' at ':oconv( time(), 'MTH' ):'.', 'CAR', .car_ref_id->text )\t \t \r\n end else\r\n MsgInfo = ''\r\n MsgInfo = 'You must define a responsible person...'\r\n MsgInfo = 'H'\r\n Void = msg( '', MsgInfo )\r\n Void = post_event( @window:'.RESP_USER_ID', 'GOTFOCUS' )\r\n void = set_property( @window:'.RESP_USER_ID', 'FOCUS', 1 ) \r\n return 0\r\n end\r\n end\r\n *OrigServRep = set_property( @window, '@OrigServRep', .accountreps->text ) \r\n *CurServRep = .accountreps->text\r\n *if CurServRep <> OrigServRep then\r\n * if CurServRep then\r\n * create_note( CurServRep, 'System', 'CAR#':.car_Ref_id->text:' changed with you being the rep', 'This CAR was modified by ':oconv( @user4, '[XLATE_CONV,LSL_USERS*FIRST_LAST]' ):' on ':oconv( date(), 'D2/' ):' at ':oconv( time(), 'MTH' ):'.', 'CAR', .car_ref_id->text )\t \t \r\n * end\r\n *end\r\nend else\r\n if .resp_user_id->text <> '' then\r\n * ok they have defined the responsible user\r\n .entry_id->text = @user4 \r\n * Now send a message to the responsible person and the VIP of manufacturing\r\n SignatureInfo = xlate( 'CONFIG', 'QUOTE_SIGS', '', 'X' )\r\n VipMfg = SignatureInfo\r\n SendTo = ''\r\n SendTo<1,-1> = VipMfg\r\n SendTo<1,-1> = .resp_user_id->text\r\n if .accountreps->text <> '' then\r\n SendTo<1,-1> = .accountreps->text\r\n end\r\n create_note( SendTo, 'System', 'New CAR#':.car_ref_id->text:' created', 'This CAR was created by ':oconv( @user4, '[XLATE_CONV,LSL_USERS*FIRST_LAST]' ):' on ':oconv( date(), 'D2/' ):' at ':oconv( time(), 'MTH' ):'.', 'CAR', .car_ref_id->text )\t \t\r\n end else\r\n MsgInfo = ''\r\n MsgInfo = 'You must define a responsible person...'\r\n MsgInfo = 'H'\r\n Void = msg( '', MsgInfo )\r\n Void = post_event( @window:'.RESP_USER_ID', 'GOTFOCUS' )\r\n void = set_property( @window:'.RESP_USER_ID', 'FOCUS', 1 ) \r\n return 0\r\n end\r\nend\r\nOrigEstLossValue = get_property( @window, '@OrigEstLossValue' )\r\nif .est_loss_value->text <> OrigEstLossValue then\r\n * notify the accounting dept that there is an estimated loss value or that it has changed\r\n if OrigEstLossValue = '' then\r\n NoteText = 'This estimated loss value was entered by ':oconv( @user4, '[XLATE_CONV,LSL_USERS*FIRST_LAST]' ):' on ':oconv( date(), 'D2/' ):' at ':oconv( time(), 'MTH' ):'.'\r\n NoteSubject = 'Initial Estimated Loss'\r\n end else\r\n NoteText = 'This estimated loss value was entered by ':oconv( @user4, '[XLATE_CONV,LSL_USERS*FIRST_LAST]' ):' on ':oconv( date(), 'D2/' ):' at ':oconv( time(), 'MTH' ):' from ':OrigEstLossValue:' to ':.est_loss_value->text:'.'\r\n NoteSubject = 'Modified Estimated Loss'\r\n end\r\n create_note( 'TEMP_AR', 'System', NoteSubject, NoteText, 'CAR', .car_ref_id->text )\t \t \r\nend\r\nreturn 1\r\n" } } }