#include "770100a.h"

TOOLBAR "" 0 18 0 4
#include <toolbar.h>

BUTTON F_GESTPERC 22 2
BEGIN
  PROMPT -13 -3 "~Percipienti"   
  MESSAGE RUN,775,-0,#F_CODDITTA,#F_TIPOA,#F_CODANAGR
END

ENDPAGE

PAGE "Scheda percipienti" -1 -1 78 21

GROUPBOX DLG_NULL 78 3
BEGIN
    PROMPT 1 0 ""
END

NUMBER F_CODDITTA 5
BEGIN
  PROMPT 3 1 "Ditta  "
  FLAGS "RDGP"
  KEY 1
  CHECKTYPE REQUIRED             
  USE LF_NDITTE KEY 1
  INPUT CODDITTA F_CODDITTA
  OUTPUT F_RAGDITTA RAGSOC
  FIELD LF_SCPERC->CODDITTA
END

STRING F_RAGDITTA 50
BEGIN
    PROMPT 17 1 "Ragione "
    FLAGS "DP"
END

NUMBER F_ANNODIC 4
BEGIN
    PROMPT 52 3 "Anno dichiarazione "
    FLAGS "DRP"
END

TEXT DLG_NULL
BEGIN
  PROMPT 1 7 "@bDati percipiente"
END

LIST F_TIPOA 1 9
BEGIN
  PROMPT 1 8 ""    
  ITEM "F|Fisica"
  ITEM "G|Giuridica"
  KEY 1
  FIELD LF_SCPERC->TIPOA
END

NUMBER F_CODANAGR 5
BEGIN
  PROMPT 80 80 ""
  FLAGS "D" 
  FIELD LF_SCPERC->CODANAGR
  CHECKTYPE REQUIRED    
  KEY 1  
END

NUMBER F_CODANAGRPERC 5
BEGIN
  PROMPT 15 8 "" 
  USE LF_PERC KEY 1 SELECT ((CODDITTA=#F_CODDITTA) && (TIPOA=#F_TIPOA))
  JOIN LF_ANAG TO LF_PERC KEY 1 INTO TIPOA=TIPOA CODANAGR=CODANAGR  
  INPUT CODDITTA F_CODDITTA
  INPUT TIPOA    F_TIPOA
  INPUT CODANAGR F_CODANAGRPERC
  DISPLAY "Tipo "               TIPOA
  DISPLAY "Codice "             CODANAGR
  DISPLAY "Cognome - Nome o Ragione sociale@50"  LF_ANAG->RAGSOC
  OUTPUT F_TIPOA        TIPOA
  OUTPUT F_CODANAGRPERC CODANAGR
  OUTPUT F_RAGSOCPER    LF_ANAG->RAGSOC
  MESSAGE COPY, F_CODANAGR  
  ADD RUN 775 -0
  GROUP 2
END

NUMBER F_CODANAGRCOM 5
BEGIN
  PROMPT 15 8 "" 
  USE LF_ANAG KEY 1 SELECT (TIPOA=#F_TIPOA)
  INPUT TIPOA    F_TIPOA 
  INPUT CODANAGR F_CODANAGRCOM
  DISPLAY "Tipo "               TIPOA
  DISPLAY "Codice "             CODANAGR
  DISPLAY "Cognome - Nome o Ragione sociale@50"    RAGSOC
  OUTPUT F_TIPOA       TIPOA
  OUTPUT F_CODANAGRCOM CODANAGR
  OUTPUT F_RAGSOCCOM   RAGSOC
  MESSAGE COPY, F_CODANAGR
  ADD RUN BA4 -1
  FLAGS "H"
  GROUP 1
END

STRING F_RAGSOCCOM 50
BEGIN
  PROMPT 25 8 ""
  USE LF_ANAG KEY 2
  INPUT RAGSOC F_RAGSOCCOM
  DISPLAY "Cognome - Nome o Ragione sociale@50" RAGSOC
  DISPLAY "Tipo"   TIPOA
  DISPLAY "Codice" CODANAGR
  OUTPUT F_RAGSOCCOM    RAGSOC
  OUTPUT F_CODANAGRCOM  CODANAGR
  OUTPUT F_TIPOA        TIPOA
  ADD RUN BA4 -1
  MESSAGE COPY, F_RAGSOCPER
  GROUP 1
END            

STRING F_RAGSOCPER 50
BEGIN
  PROMPT 25 8 ""
  FLAGS "D"
  GROUP 2
END            

NUMBER F_NPROG 6
BEGIN
  PROMPT 1 10 "@bScheda numero  "  
  CHECKTYPE REQUIRED
  KEY 1                      
  FIELD LF_SCPERC->NPROG  
  USE LF_SCPERC 
  INPUT CODDITTA F_CODDITTA SELECT
  INPUT TIPOA    F_TIPOA    SELECT
  INPUT CODANAGR F_CODANAGR SELECT    
  INPUT NPROG    F_NPROG
  DISPLAY "N°"       NPROG
  DISPLAY "Data doc.@10"  DATADOC
  DISPLAY "Num.@8" NUMDOC   
  DISPLAY "Cau."   CODCAUS
  DISPLAY "Tot. doc.@15" TOTALE
  DISPLAY "Compenso@15" COMPENSO
  DISPLAY "Spese@15"    SPESE
  DISPLAY "Iva@15"      IVA
  OUTPUT F_TIPOA    TIPOA
  OUTPUT F_CODANAGR CODANAGR
  OUTPUT F_NPROG    NPROG
END

ENDPAGE

ENDMASK

