diff --git a/ps/ps0713.cpp b/ps/ps0713.cpp index 980901705..23b90e04e 100755 --- a/ps/ps0713.cpp +++ b/ps/ps0713.cpp @@ -10,9 +10,9 @@ int main(int argc, char** argv) case 0: ps0713100(argc, argv); break; //Esportazione righe IVA case 1: ps0713200(argc, argv); break; //Importazione commesse //case 2: ps0713300(argc, argv); break; //Importazione fatture di acquisto per ATS - case 3: ps0713400(argc, argv); break; //Importazione fatture di vendita per ATS + case 3: ps0713400(argc, argv); break; //Importazione fatture di vendita //case 4: ps0713500(argc, argv); break; //Importazione spese per ATS -//case 5: ps0713600(argc, argv); break; //Importazione fatture fornitori / fatture da ricevere + case 5: ps0713600(argc, argv); break; //Importazione fatture fornitori / fatture da ricevere default: ps0713100(argc, argv); break; //Esportazione righe IVA } exit(0); diff --git a/ps/ps0713600.cpp b/ps/ps0713600.cpp new file mode 100755 index 000000000..528e3be2b --- /dev/null +++ b/ps/ps0713600.cpp @@ -0,0 +1,705 @@ +#include +#include +#include +#include +#include + +#include "ps0713600a.h" + +#include +#include +#include + +#include "../ca/calib01.h" +#include "../ca/calib02.h" +#include "../ca/movana.h" +#include "../ca/rmovana.h" + + + //////////////////////////////////// + //// TIMPORTA_FAT_FOR_MSK //// + //////////////////////////////////// + +//Classe TImporta_fat_for_msk +class TImporta_fat_for_msk : public TAutomask +{ +protected: + virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); + +public: + TImporta_fat_for_msk(const char* name); +}; + +TImporta_fat_for_msk::TImporta_fat_for_msk(const char* name) + :TAutomask(name) {} + +//ON_FIELD_EVENT: metodo che gestisce i comportamenti dei vari campi della maschera +//(per adesso segnaposto) +bool TImporta_fat_for_msk::on_field_event(TOperable_field& f, TField_event e, long jolly) +{ + return true; +} + + //////////////////////////////////// + //// TIMPORTA_FAT_FOR_REC //// + //////////////////////////////////// + +//Classe TImporta_fat_for_rec +class TImporta_fat_for_rec : public TCSV_recordset +{ + protected: + virtual TRecnotype new_rec(const char* buf = NULL); + + public: + TImporta_fat_for_rec(const char * fileName); +}; + +TRecnotype TImporta_fat_for_rec::new_rec(const char* buf) +{ + TToken_string str(256,'\t'); //nuovo record tab separator + + if(buf && *buf) + { + bool apici=false; + + for (const char* c = buf; *c ; c++) + { + if (*c == '"') + { + apici = !apici; + } + else + { + if (*c == ',') + { + if (!apici) + str << str.separator(); + else + str << *c; + } + else + str << *c; + + } + } + } + + const TRecnotype n = TText_recordset::new_rec(str); + + if (n >= 0) + row(n).separator(str.separator()); + + return n; +} + + +TImporta_fat_for_rec::TImporta_fat_for_rec(const char * fileName) + : TCSV_recordset("CSV(,)") +{ + load_file(fileName); +} + ////////////////////////////////////// + //// TIMPORTA_FAT_FOR_ANROW //// + ////////////////////////////////////// + +//classe TImporta_fat_for_anrow +class TImporta_fat_for_anrow: public TToken_string +{ +public: + const long idlavoro(); + const int gruppo(); + const int conto(); + const int sotco(); + + TImporta_fat_for_anrow& operator= (const char* key){ set(key); return *this; } + + TImporta_fat_for_anrow(const long idlavoro, const int gruppo, const int conto, const int sotco); + TImporta_fat_for_anrow(const char* key):TToken_string(key){} + TImporta_fat_for_anrow(const TToken_string& key):TToken_string(key){} + TImporta_fat_for_anrow(const TImporta_fat_for_anrow& key):TToken_string(key){} + TImporta_fat_for_anrow():TToken_string(){} +}; + +//IDLAVORO: metodo che restituisce l'Idlavoro +const long TImporta_fat_for_anrow::idlavoro() +{ + return get_long(0); +} + +//GRUPPO: metodo che restituisce il gruppo +const int TImporta_fat_for_anrow::gruppo() +{ + return get_int(1); +} + +//CONTO: metodo che restituisce il conto +const int TImporta_fat_for_anrow::conto() +{ + return get_int(2); +} + +//SOTCO: metodo che restituisce il sottoconto +const int TImporta_fat_for_anrow::sotco() +{ + return get_int(3); +} + +//metodo costruttore +TImporta_fat_for_anrow::TImporta_fat_for_anrow(const long idlavoro, const int gruppo, const int conto, const int sotco) +{ + add(idlavoro); + add(gruppo); + add(conto); + add(sotco); +} + + //////////////////////////////////// + //// TIMPORTA_FAT_FOR_APP //// + //////////////////////////////////// + +//classe TImporta_fat_for_app +class TImporta_fat_for_app : public TSkeleton_application +{ + TImporta_fat_for_msk* _msk; +protected: + virtual bool check_autorization() const { return false; } + virtual const char * extra_modules() const { return "ve"; } + virtual void main_loop(); + +public: + //metodi per l'acquisizione dei dati da file e i calcoli da effettura eprima dell'importazione + void scan_file(TImporta_fat_for_rec& file, TAssoc_array& righean, TAssoc_array& righecg) const; + bool calcola_quadratura(TAssoc_array& righean, TImporta_fat_for_anrow& kmax, real& quad); + bool importa(const TFilename& name, TAssoc_array& righean, TAssoc_array& righecg); + //metodi per l'importazione vera e propria + long genera_movcg(); + void genera_analitica(TAssoc_array& righean, TImporta_fat_for_anrow& kmax, const real& quad, const long numregcg); + void importa_fat(TAssoc_array& righecg, TImporta_fat_for_anrow& kmax, const real& quad, TConfig* configfile, const long numregcg); + void importa_fat_ric(TAssoc_array& righecg, TImporta_fat_for_anrow& kmax, const real& quad, TConfig* configfile, const long numregcg); + void gestione_ini(TAssoc_array& righecg, TImporta_fat_for_anrow& kmax, const real& quad, const long numregcg); + bool transfer(); +}; + +void TImporta_fat_for_app::scan_file(TImporta_fat_for_rec& file, TAssoc_array& righean, TAssoc_array& righecg) const +{ + TProgind pi(file.items(), "Scansione file in corso ...", true, true); + + //scorro il file, saltando le eventuali righe vuote, e riempio i due array, + //quello delle righe di analitica e quello delle righe di contabilità generale; + //l'analitica va raggruppata per CODCMS - GRUPPO - CONTO - SOTTOCONTO, + //metre la contabilità generale solo per CODCMS (che corrisponde all'IDLAVORO) + for (bool ok = file.move_first(); ok ;ok = file.move_next()) + { + if (!pi.addstatus(1)) + break; + + //evito di analizzare eventuali righe vuote + if(file.empty()) + continue; + + //idlavoro + const long idlavoro = file.get(0).as_int(); + + //imponibile + TString16 tmp = file.get(1).as_string(); + tmp.replace(',','.'); + tmp.strip("\""); + const real imp = tmp; + + //gruppo + const int gruppo = file.get(2).as_int(); + + //gruppo + const int conto = file.get(3).as_int(); + + //gruppo + const int sotco = file.get(4).as_int(); + + //chiave del TAssoc_array dell'analatica + TImporta_fat_for_anrow keyan(idlavoro, gruppo, conto, sotco); + + //riempio l'array dell'analitica + if(righean.is_key(keyan)) + { + real& imponibile = *(real*)righean.objptr(keyan); + imponibile += imp; + } + else + righean.add(keyan, imp); + + //riempio l'array della contabilità generale + if(righecg.is_key((TString)idlavoro)) + { + real& imponibile = *(real*)righecg.objptr((TString)idlavoro); + imponibile += imp; + } + else + righecg.add((TString)idlavoro, imp); + } +} + +//CALCOLA_QUADRATURA: metodo che calcola l'ammontare dell'evetuale riga di quadratura del documento +bool TImporta_fat_for_app::calcola_quadratura(TAssoc_array& righean, TImporta_fat_for_anrow& kmax, real& quad) +{ + //calcolo qaul'è la massima tolleranza consentita + //(da analisi la tolleranza è un centesimo per riga) + const real quadmax = righean.items() * 0.01; + + real quadra = ZERO; + real max = ZERO; + + bool ok = true; + + real totimp = ZERO; + + //scorro tutte le righe, eventualmente ragguppate, tenendo traccia di qual'è quella che ha imponibile maggiore + //e arrotondando i vari imponibili a due decimali + FOR_EACH_ASSOC_OBJECT(righean, obj, key, itm) + { + real& imp = *(real*)itm; + + if(imp > max) + { + max = imp; + kmax = key; + } + + const real tmp = imp; + + imp.round(2); + + quadra += tmp - imp; + totimp += tmp; + } + + if(quadra <= quadmax) + { + quad = quadra; + quad.round(2); + } + else + { + error_box(TR("L'arrotondamento effettuato sul documento supera la tolleranza consentita")); + quad = ZERO; + ok = false; + } + + if(totimp != _msk->get_real(F_IMPON)) + { + error_box(TR("Il totale Imponibile delle righe non corrisponde al valore riportato sulla maschera")); + ok = false; + } + return ok; +} + +//IMPORTA: metodo che popola l'assoc_array delle righe e calcola la quadratura +bool TImporta_fat_for_app::importa(const TFilename& name, TAssoc_array& righean, TAssoc_array& righecg) +{ + TImporta_fat_for_rec file(name); + + scan_file(file, righean, righecg); + + return true; +} + +long TImporta_fat_for_app::genera_movcg() +{ + TISAM_recordset movrec(TR("USE MOV")); + movrec.move_last(); + long numreg = movrec.get(MOV_NUMREG).as_int(); numreg++; + + TLocalisamfile mov(LF_MOV); + mov.put(MOV_NUMREG, numreg); + mov.rewrite(); + + return numreg; +} + +void TImporta_fat_for_app::genera_analitica(TAssoc_array& righean, TImporta_fat_for_anrow& kmax, const real& quad, const long numregcg) +{ + TProgind pi(righean.items(), "Importazione in corso...", true, true); + + TToken_string key; + key.add(_msk->get(F_CODCAU)); + key.add(1); + key.add(1); + const TRectype& causale = cache().get(LF_RCAUSALI, key); + const int anno = _msk->get_date(F_DATADOC).year(); + + TAnal_mov anmo(0); + anmo.put(MOVANA_NUMREGCG, numregcg); + anmo.put(MOVANA_DATACOMP, _msk->get_date(F_DATAREG)); + anmo.put(MOVANA_DATAREG, _msk->get_date(F_DATAREG)); + anmo.put(MOVANA_CODCAUS, _msk->get(F_CODCAU)); + + if(_msk->get_int(F_TIPOFAT) == 1) + { + const real iva = cache().get("%IVA", _msk->get(F_CODIVA), "R0"); + real totimponibile = ZERO; + real totimposta = ZERO; + + //calcolo dei totali + FOR_EACH_ASSOC_OBJECT(righean, obj, keyar, itm) + { + real& imp = *(real*)itm; imp.round(2); + totimponibile += imp; + + real imposta = imp * iva / CENTO; imposta.round(2); + totimposta += imposta; + } + if (quad > ZERO) + { + totimponibile += quad; + real imposta = quad * iva / CENTO; imposta.round(2); + totimposta += imposta; + } + const real totdoc = totimponibile + totimposta; + + anmo.put(MOVANA_DATADOC, _msk->get_date(F_DATADOC)); + anmo.put(MOVANA_NUMDOC, _msk->get_long(F_NDOC)); + anmo.put(MOVANA_TOTDOC, totdoc.string()); + } + + FOR_EACH_ASSOC_OBJECT(righean, obj, keyar, itm) + { + if (!pi.addstatus(1)) + break; + + TImporta_fat_for_anrow& row = (TImporta_fat_for_anrow)keyar; + const long idlav = row.idlavoro(); + const int gruppo = row.gruppo(); TString8 grup; grup.format("%03d", gruppo); + const int conto = row.conto(); TString8 cont; cont.format("%03d", conto); + const int sotco = row.sotco(); TString16 sotc; sotc.format("%06ld", sotco); + TString80 codconto; codconto << grup << cont << sotc; + + real& imp = *(real*)itm; imp.round(2); + + if (!imp.is_zero()) + { + TRectype& ranmo = anmo.new_row(); + ranmo.put(RMOVANA_ANNOES, anno); + ranmo.put(RMOVANA_SEZIONE, causale.get("SEZIONE")); + ranmo.put(RMOVANA_CODCONTO, codconto); + ranmo.put(RMOVANA_CODCMS, idlav); + ranmo.put(RMOVANA_IMPORTO, imp); + } + } + + if(quad > ZERO) + { + TImporto importo(causale.get("SEZIONE")[0], quad); + const int gruppo = kmax.gruppo(); TString8 grup; grup.format("%03d", gruppo); + const int conto = kmax.conto(); TString8 cont; cont.format("%03d", conto); + const int sotco = kmax.sotco(); TString16 sotc; sotc.format("%06ld", sotco); + TString80 codconto; codconto << grup << cont << sotc; + + TRectype& ranmo = anmo.new_row(); + ranmo.put(RMOVANA_ANNOES, anno); + ranmo.put(RMOVANA_SEZIONE, causale.get("SEZIONE")); + ranmo.put(RMOVANA_CODCONTO, codconto); + ranmo.put(RMOVANA_CODCMS, kmax.idlavoro()); + ranmo.put(RMOVANA_IMPORTO, importo.valore().string()); + } +} + +void TImporta_fat_for_app::importa_fat(TAssoc_array& righecg, TImporta_fat_for_anrow& kmax, const real& quad, TConfig* configfile, const long numregcg) +{ + const TDate datareg = _msk->get_date(F_DATAREG); + const TDate datadoc = _msk->get_date(F_DATADOC); + const long ndoc = _msk->get_long(F_NDOC); + const TString4 codiva = _msk->get(F_CODIVA); + const long codcf = _msk->get_long(F_CODFOR); + const TString4 codcau = _msk->get(F_CODCAU); + const int anno = datadoc.year(); + + TToken_string key; + key.add(codcau); + key.add(1); + const TRectype& causale = cache().get(LF_RCAUSALI, key); + + const real iva = cache().get("%IVA", codiva, "R0"); + real totimponibile = ZERO; + real totimposta = ZERO; + + //calcolo dei totali + FOR_EACH_ASSOC_OBJECT(righecg, obj, keyar, itm) + { + real& imp = *(real*)itm; imp.round(2); + totimponibile += imp; + + real imposta = imp * iva / CENTO; imposta.round(2); + totimposta += imposta; + } + if (quad > ZERO) + { + totimponibile += quad; + real imposta = quad * iva / CENTO; imposta.round(2); + totimposta += imposta; + } + + const real totdoc = totimponibile + totimposta; + + TProgind pi(righecg.items(), "Importazione in corso...", true, true); + + configfile->set_paragraph("23"); //setto il paragrafo [23] del file ini (testata) + configfile->set(MOV_NUMREG, numregcg); + configfile->set(MOV_DATAREG, datareg); + configfile->set(MOV_DATADOC, datadoc); + configfile->set(MOV_NUMDOC, ndoc); + configfile->set(MOV_CODCAUS, codcau); + configfile->set(MOV_TIPO, 'F'); + configfile->set(MOV_CODCF, codcf); + configfile->set(MOV_TOTDOC, totdoc.string()); + + int nrigaiv = 0; + + FOR_EACH_ASSOC_OBJECT(righecg, obj, keyar1, itm1) + { + if (!pi.addstatus(1)) + break; + + TString80 idlav(keyar1); + + real& imp = *(real*)itm1; imp.round(2); + + if (!imp.is_zero()) + { + TString8 paragraph; + paragraph.format("%d,%d", LF_RMOVIVA, ++nrigaiv); + configfile->set_paragraph(paragraph); + configfile->set(RMI_NUMRIG, nrigaiv); + + TImporto importo('D', imp); + + real rimposta = imp * iva / CENTO; rimposta.round(2); + + configfile->set(RMI_ANNOES, anno); + configfile->set(RMI_IMPONIBILE, importo.valore().string()); + configfile->set(RMI_CODIVA, codiva); + configfile->set(RMI_IMPOSTA, rimposta.string()); + configfile->set(RMI_CODCMS, idlav); + configfile->set(RMI_TIPOATT, 1); + } + } + + if(quad > ZERO) + { + TString8 paragraph; + paragraph.format("%d,%d", LF_RMOVIVA, ++nrigaiv); + configfile->set_paragraph(paragraph); + configfile->set(RMI_NUMRIG, nrigaiv); + + TImporto importo('D', quad); + + real rimposta = importo.valore() * iva / CENTO; rimposta.round(2); + + configfile->set(RMI_ANNOES, anno); + configfile->set(RMI_IMPONIBILE, importo.valore().string()); + configfile->set(RMI_CODIVA, codiva); + configfile->set(RMI_IMPOSTA, rimposta.string()); + configfile->set(RMI_CODCMS, kmax.idlavoro()); + configfile->set(RMI_TIPOATT, 1); + } + + TString8 paragraph; + paragraph.format("%d,%d", LF_RMOVIVA, ++nrigaiv); + configfile->set_paragraph(paragraph); +} + +void TImporta_fat_for_app::importa_fat_ric(TAssoc_array& righecg, TImporta_fat_for_anrow& kmax, const real& quad, TConfig* configfile, const long numregcg) +{ + const TDate datareg = _msk->get_date(F_DATAREG); + const TDate datadoc = _msk->get_date(F_DATADOC); + const long ndoc = _msk->get_long(F_NDOC); + const TString4 codiva = _msk->get(F_CODIVA); + const long codcf = _msk->get_long(F_CODFOR); + const TString4 codcau = _msk->get(F_CODCAU); + const int anno = datadoc.year(); + + TToken_string key; + key.add(codcau, 0); + key.add(1, 1); + const TRectype& causale = cache().get(LF_RCAUSALI, key); + + const real iva = cache().get("%IVA", codiva, "R0"); + real totimp = _msk->get_real(F_IMPON); totimp.round(2); + real totdoc = totimp; totdoc.round(2); + + TProgind pi(righecg.items(), "Importazione in corso...", true, true); + + configfile->set_paragraph("23"); //setto il paragrafo [23] del file ini (testata) + configfile->set(MOV_NUMREG, numregcg); + configfile->set(MOV_DATAREG, datareg); + configfile->set(MOV_CODCAUS, codcau); + + int nrigaco = 1; + + TString8 paragraph; + paragraph.format("%d,%d", LF_RMOV, 1); + configfile->set_paragraph(paragraph); + configfile->set(RMV_NUMRIG, 1); + + TImporto importo(causale.get("SEZIONE")[0], totdoc); + + configfile->set(RMV_ANNOES, anno); + configfile->set(RMV_SEZIONE, causale.get("SEZIONE")); + configfile->set(RMV_IMPORTO, importo.valore().string()); + configfile->set(RMV_CODCMS, causale.get("CODCMS")); + configfile->set(RMV_TIPOC, causale.get("TIPOCF")); + + key.add(2,1); + const TRectype& causale2 = cache().get(LF_RCAUSALI, key); + + FOR_EACH_ASSOC_OBJECT(righecg, obj, keyar, itm) + { + if (!pi.addstatus(1)) + break; + + TString80 idlav(keyar); + real& imp = *(real*)itm; imp.round(2); + + if (!imp.is_zero()) + { + TString8 paragraph; + paragraph.format("%d,%d", LF_RMOV, ++nrigaco); + configfile->set_paragraph(paragraph); + configfile->set(RMV_NUMRIG, nrigaco); + + TImporto importo(causale2.get("SEZIONE")[0], imp); + + const real rimposta = imp * iva / CENTO; + + configfile->set(RMV_ANNOES, anno); + configfile->set(RMV_SEZIONE, causale2.get("SEZIONE")); + configfile->set(RMV_IMPORTO, importo.valore().string()); + configfile->set(RMV_CODCMS, idlav); + } + } + + if(quad > ZERO) + { + TString8 paragraph; + paragraph.format("%d,%d", LF_RMOV, ++nrigaco); + configfile->set_paragraph(paragraph); + configfile->set(RMV_NUMRIG, nrigaco); + + TImporto importo(causale2.get("SEZIONE")[0], quad); + + configfile->set(RMV_ANNOES, anno); + configfile->set(RMV_SEZIONE, causale2.get("SEZIONE")); + configfile->set(RMV_IMPORTO, importo.valore().string()); + configfile->set(RMV_CODCMS, kmax.idlavoro()); + } + + paragraph.format("%d,%d", LF_RMOVIVA, ++nrigaco); + configfile->set_paragraph(paragraph); +} + +//GESTIONE_INI: metodo che si occupa di generare il file ini e di importarlo effettivamente +void TImporta_fat_for_app::gestione_ini(TAssoc_array& righe, TImporta_fat_for_anrow& kmax, const real& quad, const long numregcg) +{ + TConfig* configfile = NULL; + TFilename tmpdir; tmpdir.tempdir(); + + TFilename filename = tmpdir; + filename.add("atsfor01.ini"); + + configfile = new TConfig(filename, "Transaction"); //setto il paragrafo [Transaction] del file ini + + configfile->set_paragraph("Transaction"); + configfile->set("Action","MODIFY"); + configfile->set("Mode","AUTO"); + + const int tipofat = _msk->get_int(F_TIPOFAT); + + switch(tipofat) + { + case 1: importa_fat(righe, kmax, quad, configfile, numregcg); break; + case 2: importa_fat_ric(righe, kmax, quad, configfile, numregcg); break; + default: break; + } + + TString app; + app << "cg2 -0 -i" << tmpdir << SLASH << "ats*.ini"; + TExternal_app primanota(app); + primanota.run(); + + filename.fremove(); +} + +bool TImporta_fat_for_app::transfer() +{ + //genero il nome del file da caricare + TString path = _msk->get(F_PATH); + + bool trovato = false; + bool esiste = false; + bool importato = false; + + TAssoc_array righean; + TAssoc_array righecg; + TImporta_fat_for_anrow kmax; + + for(int i = F_NAME1; i <= F_NAME2; i++) + { + if(_msk->get(i).full()) + { + esiste = true; + + TFilename name = path; + name.add(_msk->get(i)); + + if(name.exist()) + { + trovato = true; + importato = importa(name, righean, righecg); + } + } + } + + if(importato) + { + real quad; + TImporta_fat_for_anrow kmax; + calcola_quadratura(righean, kmax, quad); + long numregcg = genera_movcg(); + genera_analitica(righean, kmax, quad, numregcg); + gestione_ini(righecg, kmax, quad, numregcg); + } + else + { + if(!esiste) + warning_box(TR("E' necessario specidicare almeno uno dei due file")); + else + if(!trovato) + error_box(TR("Nessuno dei due file indicati esiste")); + else + message_box(TR("Elaborazione terminata")); + } + return true; +} + + +void TImporta_fat_for_app::main_loop() +{ + _msk = new TImporta_fat_for_msk("ps0713600a"); + + while (_msk->run() == K_ENTER) + { + if (transfer()) + message_box(TR("Importazione spese completata")); + else + warning_box(TR("L'importazione spese non e' stata completata in modo corretto\nSi prega di correggere gli errori segnalati")); + } +} + + +TImporta_fat_for_app& app() { return (TImporta_fat_for_app&) main_app(); } + + +int ps0713600 (int argc, char* argv[]) +{ + TImporta_fat_for_app main_app; + main_app.run(argc, argv, TR("Importazione Spese")); + return true; +} \ No newline at end of file diff --git a/ps/ps0713600a.h b/ps/ps0713600a.h new file mode 100755 index 000000000..2c2f0de89 --- /dev/null +++ b/ps/ps0713600a.h @@ -0,0 +1,15 @@ +//campi maschera ps0713600a +#define F_PATH 101 +#define F_NAME1 102 +#define F_NAME2 103 +#define F_TIPOFAT 104 +#define F_CODFOR 105 +#define F_RAGSOC 106 +#define F_DATADOC 107 +#define F_DATAREG 108 +#define F_NDOC 109 +#define F_IMPON 110 +#define F_CODIVA 111 +#define F_DESIVA 112 +#define F_CODCAU 113 +#define F_DESCAU 114 \ No newline at end of file diff --git a/ps/ps0713600a.uml b/ps/ps0713600a.uml new file mode 100755 index 000000000..b5c515c51 --- /dev/null +++ b/ps/ps0713600a.uml @@ -0,0 +1,154 @@ +#include "ps0713600a.h" + +TOOLBAR "topbar" 0 0 0 2 + +#include + +ENDPAGE + +PAGE "Importazione Fatture" 0 0 0 -3 + +STRING DLG_PROFILE 50 +BEGIN + PROMPT 9 -12 "Profilo " + PSELECT + FLAGS "H" +END + +GROUPBOX DLG_NULL 78 5 +BEGIN + PROMPT 1 1 "@bParametri file" +END + +STRING F_PATH 255 50 +BEGIN + PROMPT 2 2 "Cartella " + DSELECT + CHECKTYPE REQUIRED + FLAGS "M" +END + +STRING F_NAME1 50 +BEGIN + PROMPT 2 3 "File 1 " + FSELECT "*.csv" + FLAGS "B" + CHECKTYPE NORMAL +END + +STRING F_NAME2 50 +BEGIN + PROMPT 2 4 "File 2 " + FSELECT "*.csv" + FLAGS "B" + CHECKTYPE NORMAL +END + +GROUPBOX DLG_NULL 78 10 +BEGIN + PROMPT 1 6 "@bParametri documento" +END + +RADIOBUTTON F_TIPOFAT 76 +BEGIN + PROMPT 2 7 "Tipo Fattura" + ITEM "1|Fattura" + ITEM "2|Fattura da ricevere" + FLAGS "Z" +END + +NUMBER F_CODFOR 6 +BEGIN + PROMPT 2 10 "Fornitore " + FLAG "UR" + USE LF_CLIFO + INPUT TIPOCF "F" + INPUT CODCF F_CODFOR + DISPLAY "Codice fornitore" CODCF + DISPLAY "Ragione sociale@50" RAGSOC + OUTPUT F_CODFOR CODCF + OUTPUT F_RAGSOC RAGSOC + CHECKTYPE REQUIRED +END + +STRING F_RAGSOC 50 +BEGIN + PROMPT 25 10 "" + USE LF_CLIFO KEY 2 + INPUT TIPOCF "F" + INPUT RAGSOC F_RAGSOC + DISPLAY "Ragione sociale@50" RAGSOC + DISPLAY "Codice fornitore," CODCF + COPY OUTPUT F_CODFOR +END + +DATE F_DATADOC +BEGIN + PROMPT 2 11 "Data Doc. " +END + +DATE F_DATAREG +BEGIN + PROMPT 25 11 "Data Reg. " +END + +NUMBER F_NDOC 6 +BEGIN + PROMPT 2 12 "Num. Doc. " +END + + +NUMBER F_IMPON 8 2 +BEGIN + PROMPT 25 12 "Imponibile" +END + +STRING F_CODIVA 4 +BEGIN + PROMPT 2 13 "Cod. IVA " + USE %IVA + INPUT CODTAB F_CODIVA + DISPLAY "Codice " CODTAB + DISPLAY "Descrizione@50" S0 + OUTPUT F_CODIVA CODTAB + OUTPUT F_DESIVA S0 + CHECKTYPE REQUIRED +END + +STRING F_DESIVA 50 +BEGIN + PROMPT 25 13 "" + USE %IVA KEY 2 + INPUT S0 F_DESIVA + DISPLAY "Descrizione@50" S0 + DISPLAY "Codice " CODTAB + COPY OUTPUT F_CODIVA + CHECKTYPE NORMAL +END + +STRING F_CODCAU 4 +BEGIN + PROMPT 2 14 "Cod. cau. " + USE LF_CAUSALI + INPUT CODCAUS F_CODCAU + DISPLAY "Codice " CODCAUS + DISPLAY "Descrizione@50" DESCR + OUTPUT F_CODCAU CODCAUS + OUTPUT F_DESCAU DESCR + CHECKTYPE REQUIRED +END + +STRING F_DESCAU 50 +BEGIN + PROMPT 25 14 "" + USE LF_CAUSALI KEY 2 + INPUT DESCR F_DESCAU + DISPLAY "Descrizione@50" DESCR + DISPLAY "Codice " CODCAUS + COPY OUTPUT F_CODCAU + CHECKTYPE NORMAL +END + +ENDPAGE + +ENDMASK \ No newline at end of file