Function SET176C

LANSA

Function SET176C

********** COMMENT(=======================================================);
********** COMMENT(Process ........: SET_176);
********** COMMENT(Function .......: SET176C);
********** COMMENT(Created on .....: 25/05/00 at 12:03:09);
********** COMMENT(Description ....: Simulate Order Entry);
********** COMMENT(Version.........: 1);
********** COMMENT();
********** COMMENT(Full Description: This function displays the current);
********** COMMENT(customers' credit details and allows input of an order);
********** COMMENT(amount. Note this is provided as a means of simulating);
********** COMMENT(what normally would be done by a proper order entry);
********** COMMENT(program.);
********** COMMENT();
********** COMMENT(Disclaimer: The following material is supplied as);
********** COMMENT(sample material only. No warranty concerning the);
********** COMMENT(material or its use in any way whatsoever is);
********** COMMENT(expressed or implied.);
********** COMMENT();
********** COMMENT(Minimum Release of LANSA: 8.0);
********** COMMENT();
********** COMMENT(=======================================================);
********** COMMENT(Function control options);
FUNCTION OPTIONS(*DIRECT *WEBEVENT);
********** COMMENT(Group and field definitions);
DEF_LIST NAME(#S_176CUSL) FIELDS((#S_176CNAM)(#S_176LIMI)(#S_176CRED)(#S_176OAMT *INPUT)(#S_176CCOD *HIDDEN));
DEFINE FIELD(#ACCU_CRED) REFFLD(#S_176CRED);
DEFINE FIELD(#EMAIL_MGR) TYPE(*CHAR) LENGTH(255) DEFAULT(*S_176CREDITMGREMAIL);
GROUP_BY NAME(#PANELDATA) FIELDS((#S_BUTTON *HIDDEN)(#STDRENTRY *HIDDEN)(#S_HOSTPRT *HIDDEN)(#S_HOSTURL *HIDDEN)(#EMAIL_MGR));
********** COMMENT();
********** COMMENT(Mainline);
********** COMMENT();
IF COND('#stdrentry *ne Y');
CHANGE FIELD(#STDRENTRY) TO(Y);
GOTO LABEL(SEL);
ENDIF;
********** COMMENT(Reset credit details of shipped orders.);
IF COND('#S_BUTTON = R');
CALL PROCESS(*DIRECT) FUNCTION(SET176A);
GOTO LABEL(SEL);
ENDIF;
********** COMMENT(Check if the values for host location and port have);
********** COMMENT(changed. If they have, call SETCHSV to update to);
********** COMMENT(the changed values.);
EXECUTE SUBROUTINE(CHK_SYSVAR);
********** COMMENT(Read browselist and verify whether the credit limit);
********** COMMENT(has been exceeded. If it hasn't, automatically approve);
********** COMMENT(the order. Otherwise, set the order status to PENDING,);
********** COMMENT(in which case a trigger will execute.);
SELECTLIST NAMED(#S_176CUSL) GET_ENTRYS(*ALTERED);
CHANGE FIELD(#S_176CRED) TO('#s_176cred + #s_176oamt');
IF COND('#s_176cred > #s_176limi');
CHANGE FIELD(#S_176STAT) TO(PENDING);
ELSE;
CHANGE FIELD(#S_176STAT) TO(APPROVED);
ENDIF;
EXECUTE SUBROUTINE(CREATE_ORD);
ENDSELECT;
********** COMMENT();
********** COMMENT();
SEL: CLR_LIST NAMED(#S_176CUSL);
CHANGE FIELD(#S_176OAMT) TO(*ZERO);
SELECT FIELDS(*ALL) FROM_FILE(SETCUS);
ADD_ENTRY TO_LIST(#S_176CUSL);
ENDSELECT;
********** COMMENT();
REQUEST FIELDS(#PANELDATA) BROWSELIST(#S_176CUSL) EXIT_KEY(*NO) MENU_KEY(*NO) PROMPT_KEY(*NO);
********** COMMENT();
SUBROUTINE NAME(CREATE_ORD);
********** COMMENT();
CHANGE FIELD(#ACCU_CRED) TO(#S_176CRED);
FETCH FIELDS((#S_176CRED)(#S_176PORD)) FROM_FILE(SETCUS) WITH_KEY(#S_176CCOD);
CHANGE FIELD(#S_176CRED) TO(#ACCU_CRED);
UPDATE FIELDS(#S_176CRED) IN_FILE(SETCUS);
CHANGE FIELD(#S_176ORNO) TO('#s_176PORD + 1');
INSERT FIELDS(*ALL) TO_FILE(SETORD);
ENDROUTINE;
********** COMMENT();
SUBROUTINE NAME(CHK_SYSVAR);
********** COMMENT();
DEF_LIST NAME(#PARM_NAME) FIELDS(#S_SVNAME) TYPE(*WORKING);
DEF_LIST NAME(#PARM_VALU) FIELDS(#S_SVCHVAL) TYPE(*WORKING);
CLR_LIST NAMED(#PARM_VALU);
CLR_LIST NAMED(#PARM_NAME);
********** COMMENT();
IF COND('#email_mgr *ne *s_176creditmgremail');
CHANGE FIELD(#S_SVNAME) TO('''*S_176CREDITMGREMAIL''');
CHANGE FIELD(#S_SVCHVAL) TO(#EMAIL_MGR);
ADD_ENTRY TO_LIST(#PARM_VALU);
ADD_ENTRY TO_LIST(#PARM_NAME);
ENDIF;
********** COMMENT();
IF COND('#s_hosturl *ne *s_hosturl');
CHANGE FIELD(#S_SVNAME) TO('''*S_HOSTURL''');
CHANGE FIELD(#S_SVCHVAL) TO(#S_HOSTURL);
ADD_ENTRY TO_LIST(#PARM_VALU);
ADD_ENTRY TO_LIST(#PARM_NAME);
ENDIF;
********** COMMENT();
IF COND('#s_hostprt *ne *s_hostport');
CHANGE FIELD(#S_SVNAME) TO('''*S_HOSTPORT''');
CHANGE FIELD(#S_SVCHVAL) TO(#S_HOSTPRT);
ADD_ENTRY TO_LIST(#PARM_VALU);
ADD_ENTRY TO_LIST(#PARM_NAME);
ENDIF;
********** COMMENT();
IF COND('(#s_hostprt *ne *s_hostport) or (#s_hosturl *ne *s_hosturl) or (#email_mgr *ne *s_176creditmgremail)');
CALL PROCESS(*DIRECT) FUNCTION(SETCHSV) PASS_LST(#PARM_NAME #PARM_VALU );
ENDIF;
********** COMMENT();
ENDROUTINE;