TOOLBAR "" 0 20 60 2

BUTTON DLG_OK 9 2
BEGIN
  PROMPT -13 -1 ""
END

BUTTON DLG_CANCEL 9 2
BEGIN
  PROMPT -23 -1 ""
END

BUTTON DLG_DELREC 9 2
BEGIN
  PROMPT -33 -1 "Elimina"
  MESSAGE EXIT,K_DEL
END

ENDPAGE

PAGE "Giacenze" -1 -1 80 23

STRING F_CODMAG 3
BEGIN
	PROMPT 2 0 "Magazzino  "
  FLAGS "U"
	FIELD CODMAG[1,3]
  USE MAG SELECT CODTAB[4,5]==""
  INPUT CODTAB F_CODMAG
  DISPLAY "Codice " CODTAB[1,3]
  DISPLAY "Denominazione mag.@50 " S0
  OUTPUT F_CODMAG CODTAB[1,3]
  OUTPUT F_DESMAG S0
  OUTPUT H_DESMAG S0
  OUTPUT H_GESTGIA B0
//  OUTPUT F_CODDEP CODTAB[4,5]
	CHECKTYPE REQUIRED

END

STRING F_CODDEP 2
BEGIN
	PROMPT 2 1 "Deposito   "
  FLAGS "U"
	FIELD CODMAG[4,5]
	USE MAG 
	INPUT CODTAB[1,3] F_CODMAG 
  INPUT CODTAB[4,5] F_CODDEP
  DISPLAY "Cod. magazzino" CODTAB[1,3]
  DISPLAY "Cod. deposito" CODTAB[4,5]
  DISPLAY "Denominazione dep.@50" S0
  OUTPUT F_CODDEP CODTAB[4,5]
  OUTPUT F_DESDEP S0
  OUTPUT F_CODMAG CODTAB[1,3]
	CHECKTYPE NORMAL
  STR_EXPR ((#H_GESTGIA=="X")&&(#F_CODDEP!=""))||(#H_GESTGIA!="X")
//	WARNING "Indicare il deposito"
END

STRING F_DESMAG 50
BEGIN
	PROMPT 22 0 ""
  USE MAG KEY 2 
  INPUT S0 F_DESMAG
  DISPLAY "Denominazione mag.@50" S0
  DISPLAY "Cod. magazzino" CODTAB[1,3]
  DISPLAY "Cod. deposito" CODTAB[4,5]
	OUTPUT F_CODMAG CODTAB[1,3]
	OUTPUT F_CODDEP CODTAB[4,5]
// GUIDO!!!!!!!!!!!!!!!!! in che ordine vengono eseguiti gli output
//					a cascata??? perchè mi ritrovo il coddep cancellato???
END


STRING F_DESDEP 50
BEGIN
	PROMPT 22 1 ""
	FLAGS "H"
	COPY USE F_DESMAG
  INPUT S0 F_DESDEP
	COPY DISPLAY F_DESMAG
  COPY OUTPUT F_DESMAG
//	MESSAGE K_TAB,F_CODDEP
END


STRING H_DESMAG 50
BEGIN
	PROMPT 22 0 ""
	FLAGS "D"
END

//Abilitazione/disabil. dei campi relativi al deposito
BOOLEAN H_GESTGIA
BEGIN
  PROMPT 1 1 ""
  FLAGS "HG"
	MESSAGE TRUE ENABLE,F_CODDEP|CHECK,F_CODDEP|SHOW,F_DESDEP|SHOW,H_DESMAG|HIDE,F_DESMAG
  MESSAGE FALSE RESET,F_CODDEP|RESET,F_DESDEP|DISABLE,F_CODDEP|HIDE,F_DESDEP|HIDE,H_DESMAG|SHOW,F_DESMAG
END

//Livelli giacenza
STRING F_LIV1 10
BEGIN
  PROMPT 2 2 "Livello 1  "
	USE GCG //SELECT CODTAB[1,1]=="1"
	JOIN FCG ALIAS 500 INTO CODTAB==CODTAB[1,1]
	INPUT CODTAB[1,1] "1" 
	INPUT CODTAB[2,11] F_LIV1
	DISPLAY	"Livello@20" 500@->S0
	DISPLAY	"Gruppo@10" CODTAB[2,20]
	DISPLAY	"Descr.@30" S0
	OUTPUT F_LIV1 CODTAB[2,12] 
	CHECKTYPE NORMAL

  MESSAGE EMPTY RESET,F_LIV2|RESET,F_LIV3|RESET,F_LIV4
END

STRING F_LIV2 6
BEGIN
  PROMPT  40 2 "Livello 2  "
	// Non mettere 	FLAGS "D" perchè disabiliterebbe tutta la colonna
	USE GCG //SELECT CODTAB[1,1]=="2"
	JOIN FCG ALIAS 500 INTO CODTAB==CODTAB[1,1]
	INPUT CODTAB[1,1] "2" 
	INPUT CODTAB[2,12] F_LIV2
	COPY DISPLAY F_LIV1
	OUTPUT F_LIV2 CODTAB[2,12] 
	CHECKTYPE NORMAL
  MESSAGE EMPTY RESET,F_LIV3|RESET,F_LIV4
END

STRING F_LIV3 6
BEGIN
  PROMPT 2 3 "Livello 3  "
	USE GCG //SELECT CODTAB[1,1]=="3"
	JOIN FCG ALIAS 500 INTO CODTAB==CODTAB[1,1]
	INPUT CODTAB[1,1] "3" 
	INPUT CODTAB[2,12] F_LIV3
	COPY DISPLAY F_LIV1
	OUTPUT F_LIV3 CODTAB[2,12] 
	CHECKTYPE NORMAL
  MESSAGE EMPTY RESET,F_LIV4
END

STRING F_LIV4 6
BEGIN
  PROMPT 40 3 "Livello 4  "
	USE GCG //SELECT CODTAB[1,1]=="4"
	JOIN FCG ALIAS 500 INTO CODTAB==CODTAB[1,1]
	INPUT CODTAB[1,1] "4" 
	INPUT CODTAB[2,12] F_LIV4
	COPY DISPLAY F_LIV1
	OUTPUT F_LIV4 CODTAB[2,12] 
	CHECKTYPE NORMAL
END

// ubicazione introdotta da tabella ubicazioni
STRING F_UBICAZ 10
BEGIN
	PROMPT 2 4 "Ubicazione "
	FIELD UBICAZ
  USE UBI 
  INPUT CODTAB F_UBICAZ
  DISPLAY "Codice" CODTAB[1,3]
  DISPLAY "Ubicazione@50 " S0
  OUTPUT F_UBICAZ CODTAB
  OUTPUT F_UBICAZD S0
	CHECKTYPE NORMAL
	STR_EXPR (#F_UBICAZ?="???")
END

// ubicazione introdotta direttamente o da tabella
STRING F_UBICAZ2 10
BEGIN
	PROMPT 2 4 "Ubicazione "
	FIELD UBICAZ
END

STRING F_UBICAZD 20
BEGIN
	PROMPT 22 4  ""
	FLAGS "D"
END


NUMBER F_SCORTAMIN	10	3
BEGIN
	PROMPT 50 4 "Scorta minima "
	FIELD SCORTAMIN
END


NUMBER F_LIVRIOR	15 3
BEGIN
	PROMPT 2 5 "Riordino: Livello "
 FIELD LIVRIOR
END

NUMBER F_LOTTORIOR	10 3
BEGIN
	PROMPT 40 5 "Lotto minimo " 
	FLAGS "U"
	FIELD LOTTORIOR
END

NUMBER F_GIORNIRIOR	2
BEGIN
	PROMPT 66 5 "Giorni "
	FLAGS "U"
	FIELD GIORNIRIOR
END

NUMBER F_GIAC 	15 5
BEGIN
	PROMPT 2 6 "Giacenza attuale           "
	FIELD GIAC
END


NUMBER F_RIM	15 5
BEGIN
	PROMPT 2 7 "Rimanenze iniziali         "
	FIELD RIM
END


NUMBER F_VRIM	18 3
BEGIN
	PROMPT 46 7 "Valore "
	FIELD VALRIM
END


NUMBER F_ACQ	15 5
BEGIN
	PROMPT 2 8 "Acquistato                 "
	FIELD ACQ
END

NUMBER F_VACQ	18 3
BEGIN
	PROMPT 46 8 "Valore "
	FIELD VALACQ
END

NUMBER F_ENTR	15 5
BEGIN
	PROMPT 2 9 "Entrato                    " 
	FIELD ENT
END

NUMBER F_VENTR	18 3
BEGIN
	PROMPT 46 9 "Valore "
	FIELD VALENT
END

NUMBER F_VEN	15 5
BEGIN
	PROMPT 2 10  "Venduto                    "
	FIELD VEN
END

NUMBER F_VVEN		18 3
BEGIN
	PROMPT 46 10 "Valore " 
	FIELD VALVEN
END

NUMBER F_USC	15 5
BEGIN
	PROMPT 2  11 "Uscito                     "
	FIELD USC
END

NUMBER F_VUSC	18 3
BEGIN
	PROMPT 46 11 "Valore "
	FIELD VALUSC
END

NUMBER F_ORDF	15 5
BEGIN
	PROMPT 2 12  "Ordinato fornitori         "
	FIELD ORDF
END

NUMBER F_VORDF	18 3
BEGIN
	PROMPT 46 12 "Valore "
	FIELD VALORDF
END

NUMBER F_ORDC	15 5
BEGIN
	PROMPT 2 13 "Ordinato clienti           "
	FIELD ORDC
END

NUMBER F_VORDC	18 3
BEGIN
	PROMPT 46 13 "Valore "
	FIELD VALORDC
END

NUMBER F_SCARTI	15 5
BEGIN
	PROMPT 2 14 "Scarti                     "
	FIELD SCARTI
END

NUMBER F_VSCARTI	18 3
BEGIN
	PROMPT 46 14 "Valore "
	FIELD VALSCARTI
END

NUMBER F_INPRODC	15 5
BEGIN
	PROMPT 2 15 "In produzione (componenti) "
	FIELD PRODCOMP
END

NUMBER F_INPRODF	15 5
BEGIN
	PROMPT 2 16 "In produzione (finiti)     "
	FIELD PRODFIN
END

NUMBER F_ACL	15 5
BEGIN
	PROMPT 2  17 "A conto lavorazione        "
	FIELD ACL
END
	
NUMBER F_INCL	15 5
BEGIN
	PROMPT 2 18 "In conto lavorazione       "
	FIELD INCL
END

NUMBER F_LABELS	10
BEGIN
	PROMPT 2 19  "Etichette da stampare      "
	FIELD NLABEL
	FLAGS "D"
END

NUMBER F_NDIST	10
BEGIN
	PROMPT 42 19  "Distinte "
	FIELD NDIST
	FLAGS "D"
END


ENDPAGE

ENDMASK
