Commit inicial: fuentes MBS ERP (Genero 6) + .gitignore + docs/SETUP_PC_MBS.md
This commit is contained in:
@@ -0,0 +1,125 @@
|
||||
# Property of Four Js*
|
||||
# (c) Copyright Four Js 1995, 2019. All Rights Reserved.
|
||||
# * Trademark of Four Js Development Tools Europe Ltd
|
||||
# in the United States and elsewhere
|
||||
#
|
||||
# Four Js and its suppliers do not warrant or guarantee that these
|
||||
# samples are accurate and suitable for your purposes. Their inclusion is
|
||||
# purely for information purposes only.
|
||||
|
||||
DEFINE fname,last VARCHAR(50)
|
||||
DEFINE donations DYNAMIC ARRAY OF RECORD
|
||||
p_date DATE,
|
||||
p_amount MONEY,
|
||||
p_reason VARCHAR(250)
|
||||
END RECORD
|
||||
|
||||
DEFINE m_details RECORD
|
||||
clubmember INT,
|
||||
otherdetail CHAR(50)
|
||||
END RECORD
|
||||
|
||||
MAIN
|
||||
DEFINE state STRING
|
||||
DEFINE flag INT
|
||||
OPTIONS INPUT WRAP
|
||||
OPEN FORM f FROM "Folder_old"
|
||||
DISPLAY FORM f
|
||||
CALL fill_arrays()
|
||||
--manage the 'state' variable to jump into different dialogs depending
|
||||
--on the state value
|
||||
LET fname="Willi"
|
||||
LET state="master" --initially go to the master input
|
||||
WHILE state="master" OR state="page1" OR state="page2"
|
||||
LET int_flag=FALSE
|
||||
CASE state
|
||||
--master input
|
||||
WHEN "master"
|
||||
LET state="invalid"
|
||||
INPUT BY NAME fname, last WITHOUT DEFAULTS
|
||||
--no master
|
||||
ON ACTION page1 LET state="page1" ACCEPT INPUT
|
||||
ON ACTION page2 LET state="page2" ACCEPT INPUT
|
||||
ON ACTION accept LET state="ok" ACCEPT INPUT
|
||||
AFTER INPUT
|
||||
IF int_flag THEN
|
||||
LET state="cancel"
|
||||
EXIT INPUT
|
||||
END IF
|
||||
--some checking if we changed things
|
||||
IF FIELD_TOUCHED(fname) OR FIELD_TOUCHED(last) THEN
|
||||
DISPLAY "AFTER INPUT master, save to the database"
|
||||
END IF
|
||||
END INPUT
|
||||
--donations input
|
||||
WHEN "page1"
|
||||
LET state="invalid"
|
||||
INPUT ARRAY donations WITHOUT DEFAULTS FROM donations.* ATTRIBUTES(UNBUFFERED)
|
||||
ON ACTION master LET state="master" ACCEPT INPUT
|
||||
--no page1
|
||||
ON ACTION page2 LET state="page2" ACCEPT INPUT
|
||||
ON ACTION accept LET state="ok" ACCEPT INPUT
|
||||
AFTER FIELD p_amount
|
||||
IF donations[arr_curr()].p_amount<2.0 THEN
|
||||
ERROR "must be at least 2 dollar:-)"
|
||||
NEXT FIELD CURRENT
|
||||
END IF
|
||||
AFTER ROW
|
||||
DISPLAY "AFTER ROW donations arr_curr:",arr_curr(),",arr_count:",arr_count()
|
||||
IF int_flag THEN --check int_flag in AFTER ROW in contradiction to
|
||||
--checking int_flag for INPUT in AFTER INPUT
|
||||
LET state="cancel"
|
||||
EXIT INPUT
|
||||
END IF
|
||||
IF arr_curr()<=arr_count() THEN
|
||||
DISPLAY "AFTER ROW donations:check row and save to database"
|
||||
END IF
|
||||
AFTER INPUT
|
||||
DISPLAY "AFTER INPUT donations,state:",state
|
||||
END INPUT
|
||||
--more details input
|
||||
WHEN "page2"
|
||||
LET state="invalid"
|
||||
INPUT m_details.* FROM details.* ATTRIBUTES(UNBUFFERED,WITHOUT DEFAULTS=flag)
|
||||
ON ACTION master LET state="master" ACCEPT INPUT
|
||||
ON ACTION page1 LET state="page1" ACCEPT INPUT
|
||||
--no page2
|
||||
ON ACTION accept LET state="ok" ACCEPT INPUT
|
||||
AFTER FIELD otherdetail
|
||||
--just have a uselesse contraint here to check we come thru
|
||||
--in case of leaving the folder
|
||||
IF m_details.otherdetail<>'o' THEN
|
||||
ERROR "otherdetail must be 'o'"
|
||||
NEXT FIELD otherdetail
|
||||
END IF
|
||||
AFTER INPUT
|
||||
IF int_flag THEN
|
||||
LET state="cancel"
|
||||
EXIT INPUT
|
||||
END IF
|
||||
DISPLAY "AFTER INPUT details,state:",state
|
||||
--some checking if we changed things
|
||||
IF FIELD_TOUCHED(details.*) THEN
|
||||
DISPLAY "Update detail in the database"
|
||||
LET flag=1
|
||||
END IF
|
||||
END INPUT
|
||||
END CASE
|
||||
END WHILE
|
||||
CASE state
|
||||
WHEN "ok"
|
||||
DISPLAY "save"
|
||||
WHEN "cancel"
|
||||
DISPLAY "cancel"
|
||||
WHEN "invalid"
|
||||
DISPLAY "error occured"
|
||||
END CASE
|
||||
END MAIN
|
||||
|
||||
FUNCTION fill_arrays()
|
||||
DEFINE i INT
|
||||
FOR i=1 TO 5
|
||||
LET donations[i].p_date = TODAY -10 +i
|
||||
LET donations[i].p_amount = i+1
|
||||
END FOR
|
||||
END FUNCTION
|
||||
Reference in New Issue
Block a user