#include "771230a.h"

TOOLBAR "" 0 18 0 4

BUTTON F_GENERA 21 2
BEGIN
  PROMPT -13 -3 "~Generazione"
END

#include <toolbar.h>

ENDPAGE

PAGE "Quadro D" -1 -1 78 18

GROUPBOX DLG_NULL 78 3
BEGIN
    PROMPT 1 0 ""
END

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

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

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

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

LIST F_TIPOA 1 12
BEGIN
  PROMPT 1 8 ""    
  ITEM "F|Fisica"
  MESSAGE COPY,F_TIPOAF
  ITEM "G|Giuridica"   
  MESSAGE COPY,F_TIPOAF  
  FIELD LF_QUAD->TIPOA
  KEY 1
END

LIST F_TIPOAF 1 12
BEGIN
  PROMPT 1 9 ""    
  ITEM "F|Fisica"
  ITEM "G|Giuridica"  
  FLAGS "H"
END

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

NUMBER F_CODANAGRPERC 5
BEGIN
  PROMPT 16 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  
  //FLAGS "P"  
  ADD RUN 775 -0
  GROUP 2
END

NUMBER F_CODANAGRCOM 5
BEGIN
  PROMPT 16 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 "HP"
  FLAGS "H" 
  GROUP 1
END

STRING F_RAGSOC 50
BEGIN
  PROMPT 25 8 ""
  FLAGS "H"
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
  //FLAGS "P"       
  ADD RUN BA4 -1
  MESSAGE COPY, F_RAGSOC
  GROUP 1
END            

STRING F_RAGSOCPER 50
BEGIN
  PROMPT 25 8 ""
  //FLAGS "DP"
  FLAGS "D"
  GROUP 2               
  MESSAGE COPY, F_RAGSOC  
END            

NUMBER F_NPROG 4
BEGIN
  PROMPT 1 10 "@bNumero  "  
  CHECKTYPE REQUIRED
  KEY 1                      
  FIELD LF_QUAD->NPROG  
  USE LF_QUAD
  INPUT CODDITTA F_CODDITTA SELECT
  INPUT TIPOA    F_TIPOA    
  INPUT CODANAGR F_CODANAGR     
  INPUT NPROG    F_NPROG 
  DISPLAY "N°" NPROG
  DISPLAY "Tipo"     TIPOA
  DISPLAY "Codice@10"   CODANAGR
  DISPLAY "Causale" CODCAUS
  DISPLAY "Totale@15" TOTALE
  DISPLAY "Somme n/sogg rit" SOMME
  DISPLAY "Imponibile@15" IMPONIBILE
  DISPLAY "Aliquota" PERC
  DISPLAY "Importo@15" IMPORTO
  DISPLAY "Netto corrisposto" NETTO
  OUTPUT F_TIPOA    TIPOA
  OUTPUT F_CODANAGR CODANAGR
  OUTPUT F_NPROG    NPROG
END  

ENDPAGE

ENDMASK

