From 11dc9c50b7e47ff2b1759ce480e25893b746bb39 Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 10 Mar 2009 14:00:21 +0000 Subject: [PATCH] Patch level : Files correlati : Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/trunk@18474 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ps/indice_programmi.txt | 4 - ps/ps0001.cpp | 30 - ps/ps0001.h | 3 - ps/ps0001100.cpp | 1594 --------------------------------------- ps/ps0001100.h | 13 - ps/ps0001100.uml | 94 --- ps/ps0001200.cpp | 1158 ---------------------------- ps/ps0001200.h | 13 - ps/ps0001200.uml | 240 ------ ps/ps0001300.cpp | 66 -- ps/ps0001300.h | 5 - 11 files changed, 3220 deletions(-) delete mode 100755 ps/ps0001.cpp delete mode 100755 ps/ps0001.h delete mode 100755 ps/ps0001100.cpp delete mode 100755 ps/ps0001100.h delete mode 100755 ps/ps0001100.uml delete mode 100755 ps/ps0001200.cpp delete mode 100755 ps/ps0001200.h delete mode 100755 ps/ps0001200.uml delete mode 100755 ps/ps0001300.cpp delete mode 100755 ps/ps0001300.h diff --git a/ps/indice_programmi.txt b/ps/indice_programmi.txt index 9fa72d2c7..56eed120a 100755 --- a/ps/indice_programmi.txt +++ b/ps/indice_programmi.txt @@ -57,10 +57,6 @@ Configurazione campi per utente PN0001 Importazione dati vendite al dettaglio -PS0001 -Esportazione Salus -Esportazione prospetto scadenze Salus - PS0077 (ex ve7) Trasferimento documenti Teamsystem (ex ve7100, Pedretti) diff --git a/ps/ps0001.cpp b/ps/ps0001.cpp deleted file mode 100755 index 6c0994d14..000000000 --- a/ps/ps0001.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include - -#include "ps0001.h" - -int main(int argc, char** argv) -{ - const int op = argc < 2 ? 0 : argv[1][1]-'0'; - switch (op) - { - case 0: - ps0001100(argc,argv); - break; - case 1: - ps0001200(argc,argv); - break; - case 2: - ps0001300(argc,argv); - break; - default: - ps0001100(argc,argv); - break; - } - exit(0); - return 0; -} - - - - - diff --git a/ps/ps0001.h b/ps/ps0001.h deleted file mode 100755 index 4ff1d6347..000000000 --- a/ps/ps0001.h +++ /dev/null @@ -1,3 +0,0 @@ -int ps0001100(int argc, char* argv[]); -int ps0001200(int argc, char* argv[]); -int ps0001300(int argc, char* argv[]); \ No newline at end of file diff --git a/ps/ps0001100.cpp b/ps/ps0001100.cpp deleted file mode 100755 index efa760d8f..000000000 --- a/ps/ps0001100.cpp +++ /dev/null @@ -1,1594 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - - -#include "../cg/cg2101.h" -#include "../cg/cglib02.h" -#include "../cg/cgpagame.h" -#include "../cg/cgsaldac.h" - -#include "ps0001.h" -#include "ps0001100.h" - - -/////////////////////////////////////////////////////////// -// TDettaglio_mask -/////////////////////////////////////////////////////////// - -class TTrasf_mask : public TAutomask -{ -private: - void serialize(bool bSave); - -protected: - virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); - -public: - TTrasf_mask(); - ~TTrasf_mask(); -}; - -bool TTrasf_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) -{ - bool ok = true; - switch (o.dlg()) - { - case F_PATH: - break; - default: - break; - } - return ok; -} - -void TTrasf_mask::serialize(bool bSave) -{ - const char* defpar = "tc"; - TConfig ini(CONFIG_DITTA, defpar); - for (int i = fields()-1; i >= 0; i--) - { - TMask_field& f = fld(i); - const TFieldref* fr = f.field(); - if (fr != NULL) - { - if (bSave) - fr->write(ini, defpar, f.get()); - else - f.set(fr->read(ini, defpar)); - } - } -} - -TTrasf_mask::TTrasf_mask() - : TAutomask("ps0001100") -{ - serialize(false); -} - -TTrasf_mask::~TTrasf_mask() -{ - serialize(true); -} - -/////////////////////////////////////////////////////////// -// TClienti_textset -/////////////////////////////////////////////////////////// - -class TClienti_textset : public TAS400_recordset -{ - -protected: - -public: - TClienti_textset(); -}; - -TClienti_textset::TClienti_textset() - : TAS400_recordset(TString("AS400(2865,0,0)\n")) -{ - create_field("SUPPLIER CODE", 0, 15); - create_field("NAME", 15, 50); - create_field("LOOKUP CODE", 65, 15); - create_field("SHORT HEADING", 65, 15); - create_field("DESCRIPTION", 80, 50); - create_field("LONG DESCRIPTION", 130, 255); - create_field("ANALYSIS 1 - COA_UK", 385, 10); - create_field("ANALYSIS 2", 395, 10); - create_field("ANALYSIS 3", 405, 10); - create_field("ANALYSIS 4 - CUST_SUPP_GROUP", 415, 3); - create_field("ANALYSIS 5 - WITHHOLD_TAX", 418, 10); - create_field("E-MAIL ADDRESS", 428, 124); - create_field("WEB PAGE ADDRESS", 552, 124); - create_field("BANK SUB CODE", 676, 5); - create_field("COMPANY ADDRESS", 681, 15); - create_field("PAY ADDRESS", 696, 15); - create_field("ACCOUNT CODE", 711, 15); - create_field("CURRENCY CODE", 726, 3); - create_field("CREDIT LIMIT", 729, 18, _realfld); - create_field("PAYMENT METHOD", 747, 4); // ?? - create_field("PAYMENT TERMS GROUP", 751, 15); - create_field("Name/Address 1", 766, 50); - create_field("Name/Address 2", 816, 50); - create_field("Name/Address 3", 866, 50); - create_field("Name/Address 4", 916, 50); - create_field("Name/Address 5", 966, 50); - create_field("Town/City", 1016, 50); - create_field("State", 1066, 50); - create_field("Postal Code", 1116, 20); - create_field("Country", 1136, 50); - create_field("Telephone Number", 1186, 50); - create_field("Telex/Fax Number", 1236, 50); - create_field("Web Page Address", 1866, 124); - create_field("Long Description", 1990, 255); - create_field("Short Heading", 2245, 15); - create_field("Lookup Code", 2260, 15); - create_field("Bank Sub Code", 2275, 5); - create_field("Bank Lookup Code", 2280, 15); - create_field("Bank Address Code", 2295, 15); - create_field("Bank Account Name", 2310, 50); - create_field("Bank Account Number", 2360, 34); - create_field("Filler", 2394, 3); - create_field("Filler", 2397, 3); - create_field("Bank Name", 2400, 50); - create_field("Bank Branch", 2450, 50); - create_field("Bank Sorting Code", 2500, 15); - create_field("Comment", 2515, 255); - create_field("Vat Code", 2770, 20); - create_field("Fiscal Code", 2790, 20); - create_field("Birth Date", 2810, 20); - create_field("Sex", 2830, 2); - create_field("Birth Town", 2832, 30); -} - -/////////////////////////////////////////////////////////// -// TFornitori_textset -/////////////////////////////////////////////////////////// - -class TFornitori_textset : public TAS400_recordset -{ - -protected: - -public: - TFornitori_textset(); -}; - -TFornitori_textset::TFornitori_textset() - : TAS400_recordset(TString("AS400(2865,0,0)\n")) -{ - create_field("SUPPLIER CODE", 0, 15); - create_field("NAME", 15, 50); - create_field("LOOKUP CODE", 65, 15); - create_field("SHORT HEADING", 65, 15); - create_field("DESCRIPTION", 80, 50); - create_field("LONG DESCRIPTION", 130, 255); - create_field("ANALYSIS 1 - COA_UK", 385, 20); - create_field("ANALYSIS 2", 405, 10); - create_field("ANALYSIS 3", 415, 10); - create_field("ANALYSIS 4 - CUST_SUPP_GROUP", 425, 3); - create_field("ANALYSIS 5 - WITHHOLD_TAX", 428, 10); - create_field("E-MAIL ADDRESS", 438, 124); - create_field("WEB PAGE ADDRESS", 562, 124); - create_field("BANK SUB CODE", 686, 5); - create_field("COMPANY ADDRESS", 691, 15); - create_field("PAY ADDRESS", 706, 15); - create_field("ACCOUNT CODE", 721, 15); - create_field("CURRENCY CODE", 736, 3); - create_field("CREDIT LIMIT", 739, 18, _realfld); - create_field("PAYMENT METHOD", 757, 4); // ?? - create_field("PAYMENT TERMS GROUP", 761, 15); - create_field("Name/Address 1", 776, 50); - create_field("Name/Address 2", 826, 50); - create_field("Name/Address 3", 876, 50); - create_field("Name/Address 4", 926, 50); - create_field("Name/Address 5", 976, 50); - create_field("Town/City", 1026, 50); - create_field("State", 1076, 50); - create_field("Postal Code", 1126, 20); - create_field("Country", 1146, 50); - create_field("Telephone Number", 1196, 50); - create_field("Telex/Fax Number", 1246, 50); - create_field("Web Page Address", 1866, 124); - create_field("Long Description", 1990, 255); - create_field("Short Heading", 2245, 15); - create_field("Lookup Code", 2260, 15); - create_field("Bank Sub Code", 2275, 5); - create_field("Bank Lookup Code", 2280, 15); - create_field("Bank Address Code", 2295, 15); - create_field("Bank Account Name", 2310, 50); - create_field("Bank Account Number", 2360, 34); - create_field("Filler", 2394, 3); - create_field("Filler", 2397, 3); - create_field("Bank Name", 2400, 50); - create_field("Bank Branch", 2450, 50); - create_field("Bank Sorting Code", 2500, 15); - create_field("Comment", 2515, 255); - create_field("Vat Code", 2770, 20); - create_field("Fiscal Code", 2790, 20); - create_field("Birth Date", 2810, 20); - create_field("Sex", 2830, 2); - create_field("Birth Town", 2832, 30); -} - -/////////////////////////////////////////////////////////// -// TPartCliFo_textset -/////////////////////////////////////////////////////////// - -class TPartCliFo_textset : public TAS400_recordset -{ - -protected: - -public: - TPartCliFo_textset(); -}; - -TPartCliFo_textset::TPartCliFo_textset() - : TAS400_recordset(TString("AS400(293,0,0)\n")) -{ - create_field("Filler", 0, 5, _intfld); - create_field("Line No", 5, 5, _intfld); - create_field("Codice Conto", 10, 12); - create_field("Descrizione Conto", 22, 50); - create_field("Periodo", 72, 50, _longfld); - create_field("Data Fattura / NC", 122, 10, _datefld); - create_field("Numero Fattura / NC", 132, 20); - create_field("Descrizione", 152, 50); - create_field("Importo Euro (Avere = negativo)", 202, 18, _realfld); - create_field("Cod Valuta", 220, 3); - create_field("Importo in Valuta", 223, 18, _realfld); - create_field("Data Scadenza", 241, 10, _datefld); - create_field("Non Utilizzare", 251, 1); - create_field("Non Utilizzare", 242, 1); - create_field("Non Utilizzare", 253, 1); - create_field("T1 - Non utilizzare", 254, 1); - create_field("T2 - Non utilizzare", 255, 1); - create_field("T3 - Non utilizzare", 256, 1); - create_field("T4 - Non utilizzare (Cod Iva)", 257, 10); - create_field("T5 - Non utilizzare", 267, 1); - create_field("T6 - Non utilizzare", 268, 1); - create_field("T7 - Prot Iva", 269, 10); - create_field("T8 - Cod Riten", 279, 1); - create_field("T9 - Divisione", 280, 10); - create_field("T10 - Non utilizzare", 290, 1); -} - -/////////////////////////////////////////////////////////// -// TPartForPer_textset -/////////////////////////////////////////////////////////// - -class TPartForPer_textset : public TAS400_recordset -{ - -protected: - -public: - TPartForPer_textset(); -}; - -TPartForPer_textset::TPartForPer_textset() - : TAS400_recordset(TString("AS400(279,0,0)\n")) -{ - create_field("Data Reg ne", 0, 10); - create_field("Conto", 10, 12); - create_field("Descrizione conto", 22, 50); - create_field("Periodo", 72, 7); - create_field("Imp. Euro", 79, 18, _realfld); - create_field("Causale", 97, 5, _alfafld, false, TVariant("PMFRE")); // fissi - create_field("Ledger", 102, 1, _alfafld, false, TVariant("A")); // fissi - create_field("Data Doc to", 103, 10, _datefld); - create_field("Rif. Doc to", 113, 10); - create_field("N Giornale", 123, 5, _intfld); // num.reg. - create_field("N Riga Giorn.", 128, 5, _intfld); // num.rig - - create_field("Cod Valuta", 133, 3); - create_field("Imp Valuta", 136, 18, _realfld); - create_field("Region", 154, 6); // vuoto - create_field("Centro di Costo", 160, 20); - create_field("Cod Iva", 180, 10); - create_field("Misc Code", 190, 6); // vuoto - create_field("Prot Iva", 196, 10); - create_field("Rit Acc", 206, 10, _alfafld, false, TVariant("11401")); - create_field("IndicatoreAlloc", 216, 6); // vuoto - create_field("Rif to Alloc", 222, 6); // vuoto - create_field("Data Allocazione", 228, 10); // vuoto - create_field("Tipo Oper Cespite", 238, 10); // vuoto - create_field("Codice Cespite", 248, 10); // vuoto - create_field("Descrizione Cespite", 258, 10); // vuoto - create_field("Divisione", 268, 10); -} - -/////////////////////////////////////////////////////////// -// TSaldi_textset -/////////////////////////////////////////////////////////// - -class TSaldi_textset : public TAS400_recordset -{ - -protected: - -public: - TSaldi_textset(); -}; - -TSaldi_textset::TSaldi_textset() - : TAS400_recordset(TString("AS400(302,0,0)\n")) -{ - create_field("Filler", 0, 5, _intfld); - create_field("Line No", 5, 5, _intfld); - create_field("Codice Conto", 10, 12); - create_field("Descrizione Conto", 22, 50); - create_field("Periodo", 72, 50, _longfld); - create_field("Data Documento", 122, 10, _datefld); - create_field("Riferimento Doc to", 132, 20); - create_field("Descrizione", 152, 50); - create_field("Importo Euro (Avere = negativo)", 202, 18, _realfld); - create_field("Cod Valuta", 220, 3); - create_field("Importo in Valuta", 223, 18, _realfld); - create_field("Data Scadenza", 241, 10, _datefld); - create_field("Non Utilizzare", 251, 1); - create_field("Non Utilizzare", 242, 1); - create_field("Non Utilizzare", 253, 1); - create_field("T1 - Non utilizzare", 254, 1); - create_field("T2 - Non utilizzare", 255, 1); - create_field("T3 - Non utilizzare", 256, 1); - create_field("T4 - Non utilizzare (Cod Iva)", 257, 10); - create_field("T5 - Non utilizzare", 267, 1); - create_field("T6 - Non utilizzare", 268, 1); - create_field("T7 - Prot Iva", 269, 10); - create_field("T8 - Cod Riten", 279, 10); - create_field("T9 - Divisione", 289, 10); - create_field("T10 - Non utilizzare", 299, 1); -} - - -/////////////////////////////////////////////////////////// -// TMovim_textset -/////////////////////////////////////////////////////////// - -class TMovim_textset : public TAS400_recordset -{ - -protected: - -public: - TMovim_textset(); -}; - -TMovim_textset::TMovim_textset() - : TAS400_recordset(TString("AS400(385,0,0)\n")) -{ - create_field("Mov No", 0, 5, _intfld); - create_field("Line No", 5, 5, _intfld); - create_field("Codice Conto", 10, 12); - create_field("Descrizione Conto", 22, 50); - create_field("Periodo", 72, 50, _longfld); - create_field("Data Documento", 122, 10, _datefld); - create_field("Riferimento Doc to", 132, 20); - create_field("Descrizione", 152, 50); - create_field("Importo Euro (Avere = negativo)", 202, 18, _realfld); - create_field("Cod Valuta", 220, 3); - create_field("Importo in Valuta", 223, 18, _realfld); - create_field("Data Scadenza", 241, 10, _datefld); - create_field("Non Utilizzare", 251, 1); - create_field("Non Utilizzare", 252, 1); - create_field("Non Utilizzare", 253, 1); - create_field("T1 - Non utilizzare", 254, 1); - create_field("T2 - Non utilizzare", 255, 1); - create_field("T3 - Non utilizzare: Centro di Costo", 256, 20); - create_field("T4 - Non utilizzare (Cod Iva)", 276, 10); - create_field("T5 - Non utilizzare", 286, 1); - create_field("T6 - Non utilizzare", 287, 1); - create_field("T7 - Prot Iva", 288, 10); - create_field("T8 - Cod Riten", 298, 10); - create_field("T9 - Divisione", 308, 10); - create_field("x", 318, 1); - create_field("T10 - Codice Causale originale", 319, 10); - create_field("Descrizione Causale originale", 329, 50); - create_field("Numero operazione originale", 379, 5, _intfld); -} - -/////////////////////////////////////////////////////////// -// TTrasf_app -/////////////////////////////////////////////////////////// - -class TTrasf_app : public TSkeleton_application -{ - -protected: - void export_clienti(const TTrasf_mask & m); - void export_fornitori(const TTrasf_mask & m); - void load_partite_aperte(const TTrasf_mask & m, const char * tipocf, TPartite_array &part); - void export_partite_clienti(const TTrasf_mask & m); - void export_partite_fornitori(const TTrasf_mask & m); - void export_saldi(const TTrasf_mask & m); - void export_movimenti(const TTrasf_mask & m); - virtual const char * extra_modules() const {return "ba";} - -public: - virtual bool create(); - virtual void main_loop(); - virtual bool destroy(); - TTrasf_app() {} -}; - -TTrasf_app& app() { return (TTrasf_app&)main_app(); } - -/////////////////////////////////////////////////////////// -// Utility functions -/////////////////////////////////////////////////////////// - -static void pag2pag(TVariant & p) -{ - TString16 s = p.as_string(); - while (s.len() < 3) - s.insert("0"); - - if (s == "027" || s == "011" || s == "014") - p = "120T"; - else - if (s == "034") - p = "14T"; - else - if (s == "028") - p = "150T"; - else - if (s == "004" || s == "005" || s == "015" || s == "024") - p = "30T"; - else - if (s == "038") - p = "45T"; - else - if (s == "006" || s == "021" || s == "25") - p = "60T"; - else - if (s == "002" || s == "010" || s == "033") - p = "90T"; - else - if (s == "001" || s == "003") - p = "NOW"; - else - if (s == "017" || s == "019" || s == "026" || s == "032") - p = "30M"; - else - if (s == "029") - p = "40T"; - else - if (s == "002" || s == "008" || s == "009" || s == "016" || s == "022" || s == "023") - p = "60M"; - else - if (s == "007" || s == "031" || s == "036") - p = "90M"; - else - if (s == "035" || s == "037") - p = "120M"; - else - if (s == "012" || s == "013") - p = "150M"; - else - p = ""; -} - -static bool cli2code(const TRectype & clifo, const TString & div, TVariant & code, TString & descr) -{ - if (clifo.get(CLI_TIPOCF) == "C") - code = "D"; - else - code = "C"; - - - const TString & pi = clifo.get(CLI_PAIV); - const int gruppo = clifo.get_int(CLI_GRUPPORIC); - const int conto = clifo.get_int(CLI_CONTORIC); - const long sottoconto = clifo.get_long(CLI_SOTTOCRIC); - TString key("CL|"); - - key << div << "|" << format("%03d%03d%06ld", gruppo, conto, sottoconto); - - const TRectype & maprec = cache().get(LF_MULTIREL, key); - bool grouped = !maprec.empty(); - - if (grouped) - { - TToken_string data(maprec.get("DATA"), ','); - descr = data.get(); - code = data.get(); - } - else - { - TString sl(clifo.get(CLI_RAGSOC)); - - if (sl.len() > 30 && sl[29] == ' ') - { - TString sr(sl.mid(30)); - - sl = sl.left(30); - sl.trim(); - sl << " " << sr; - } - - descr = sl; - if (pi.full()) - code += (const char *) pi; - else - code += (const char *) clifo.get(CLI_COFI); - } - - return grouped; -} - -static void count2code(TBill & c, const TString& div, TVariant & code) -{ - TString key(40); - if (c.tipo() > ' ') - { - TString descr; - - key << c.tipo() << "|" << c.sottoconto(); - - const TRectype & clifo = cache().get(LF_CLIFO, key); - - cli2code(clifo, div, code, descr); - } - else - { - code = format("%03d%03d%06ld", c.gruppo(), c.conto(), c.sottoconto()); - key << "DV|" << div << "|" << code.as_string(); - - const TRectype & map = cache().get(LF_MULTIREL, key); - - if (!map.empty()) - code = map.get("DATA"); - } -} - -static void iva2iva(TString & codiva, TString & div) -{ - TString key; - - key << "IV|" << div << "|" << codiva; - const TRectype & map = cache().get(LF_MULTIREL, key); - - if (!map.empty()) - codiva = map.get("DATA"); -} - -static void ditta2div(long codditta, TString & div) -{ - switch (codditta) - { - case 1: - case 3: - break; - case 5: - div = "246"; - return; - break; - case 7: - break; - case 10: - div = "245"; - return; - break; - case 25: - div ="247"; - return; - break; - default : - break; - } - div = "241"; -} - -/////////////////////////////////////////////////////////// -// TTrasf_app -/////////////////////////////////////////////////////////// - -bool TTrasf_app::create() -{ - return TSkeleton_application::create(); -} - -bool TTrasf_app::destroy() -{ - return TSkeleton_application::destroy(); -} - -void TTrasf_app::export_clienti(const TTrasf_mask & m) -{ - TClienti_textset outputfile; - TFilename name = m.get(F_PATH); - TString div; - TString descr; - TVariant v; - - ditta2div(prefix().get_codditta(), div); - name.add("clienti.slk"); - - TISAM_recordset clienti("USE CLIFO SELECT TIPOCF==\"C\""); - TProgind pin(clienti.items(), TR("Esportazione Clienti"), true, true); - - for (bool ok = clienti.move_first(); ok; ok = clienti.move_next()) - { - TVariant code; - TString sl(clienti.get(CLI_RAGSOC).as_string()); - - if (sl.len() > 30 && sl[29] == ' ') - { - TString sr(sl.mid(30)); - - sl = sl.left(30); - sl.trim(); - sl << " " << sr; - } - - const TVariant ragsoc(sl); - const TVariant shortragsoc(sl.left(15)); - TString pi(clienti.get(CLI_PAIV).as_string()); - TString cofi(clienti.get(CLI_COFI).as_string()); - - if (pi.blank() || cofi.blank()) - continue; - if (cli2code(clienti.cursor()->curr(), div, code, descr)) - continue; - - outputfile.new_rec(); - outputfile.set("SUPPLIER CODE", code); - outputfile.set("NAME", ragsoc); - outputfile.set("LOOKUP CODE", shortragsoc); - outputfile.set("SHORT HEADING", shortragsoc); - outputfile.set("DESCRIPTION", ragsoc); - outputfile.set("LONG DESCRIPTION", ragsoc); - outputfile.set("ANALYSIS 1 - COA_UK", "DEBTOR"); - outputfile.set("ANALYSIS 2", "SOUTH"); - outputfile.set("ANALYSIS 3", "Y"); - outputfile.set("ANALYSIS 4 - CUST_SUPP_GROUP", "501"); - outputfile.set("E-MAIL ADDRESS", clienti.get(CLI_MAIL)); - outputfile.set("BANK SUB CODE", "00000"); - outputfile.set("Bank Sub Code", "00000"); - outputfile.set("WEB PAGE ADDRESS", ""); - outputfile.set("ACCOUNT CODE", code); - v = clienti.get(CLI_CODVAL); - if (v.as_string().blank()) - v = "EUR"; - outputfile.set("CURRENCY CODE", v); - outputfile.set("CREDIT LIMIT", clienti.get(CLI_FIDO)); - - v = clienti.get(CLI_CODPAG); - pag2pag(v); - outputfile.set("PAYMENT TERMS GROUP", v); - - outputfile.set("Name/Address 1", ragsoc); - TString s(clienti.get(CLI_INDCF).as_string()); - s << " " << clienti.get(CLI_CIVCF).as_string();; - outputfile.set("Name/Address 2", s); - outputfile.set("Name/Address 3", clienti.get(CLI_LOCCF)); - - TString key; key << "|" << clienti.get(CLI_COMCF).as_string(); - const TRectype & rec = cache().get(LF_COMUNI, key); - - outputfile.set("Town/City", rec.get(COM_DENCOM)); - outputfile.set("State", rec.get(COM_PROVCOM)); - outputfile.set("Postal Code", rec.get(COM_CAPCOM)); - descr = clienti.get(CLI_STATOPAIV).as_string(); - if (descr.blank()) - descr = "IT"; - outputfile.set("Country", descr); - s = clienti.get(CLI_PTEL).as_string(); - if (s.full()) - s << "/" ; - s << clienti.get(CLI_TEL).as_string() << " " << clienti.get(CLI_PTEL2).as_string(); - if (clienti.get(CLI_PTEL2).as_string().full()) - s << "/" ; - s << clienti.get(CLI_TEL2).as_string() << " "<< clienti.get(CLI_PTEL3).as_string(); - if (clienti.get(CLI_PTEL3).as_string().full()) - s << "/" ; - s << clienti.get(CLI_TEL3).as_string(); - outputfile.set("Telephone Number", s); - s = clienti.get(CLI_PFAX).as_string(); - if (s.full()) - s << "/" ; - s << clienti.get(CLI_FAX).as_string(); - v = s; - outputfile.set("Telex/Fax Number", s); - outputfile.set("Long Description", ragsoc); - outputfile.set("Short Heading", shortragsoc); - outputfile.set("Lookup Code", shortragsoc); - outputfile.set("Comment", clienti.get(CLI_REFERENTE)); - if (pi.blank()) - { - pi = cofi; - cofi = ""; - } - outputfile.set("Vat Code", pi); - pin.addstatus(1L);; - if (pin.iscancelled()) - break; - } - outputfile.save_as(name, fmt_silk); -} - -void TTrasf_app::export_fornitori(const TTrasf_mask & m) -{ - TFornitori_textset outputfile; - TFilename name = m.get(F_PATH); - TString div; - TString descr; - TVariant v; - const TString16 wm("ABCDEHLMPRST"); - - ditta2div(prefix().get_codditta(), div); - name.add("fornitori.slk"); - - TISAM_recordset fornitori("USE CLIFO SELECT TIPOCF==\"F\""); - TProgind pin(fornitori.items(), TR("Esportazione Fornitori"), true, true); - - for (bool ok = fornitori.move_first(); ok; ok = fornitori.move_next()) - { - TVariant code; - TString sl(fornitori.get(CLI_RAGSOC).as_string()); - - if (sl.len() > 30 && sl[29] == ' ') - { - TString sr(sl.mid(30)); - - sl = sl.left(30); - sl.trim(); - sl << " " << sr; - } - - TVariant ragsoc(sl); - TVariant shortragsoc(sl.left(15)); - TString pi(fornitori.get(CLI_PAIV).as_string()); - TString cofi(fornitori.get(CLI_COFI).as_string()); - - if (pi.blank() || cofi.blank()) - continue; - cli2code(fornitori.cursor()->curr(), div, code, descr); - outputfile.new_rec(); - outputfile.set("SUPPLIER CODE", code); - outputfile.set("NAME", ragsoc); - outputfile.set("LOOKUP CODE", shortragsoc); - outputfile.set("SHORT HEADING", shortragsoc); - outputfile.set("DESCRIPTION", ragsoc); - outputfile.set("LONG DESCRIPTION", ragsoc); - outputfile.set("E-MAIL ADDRESS", fornitori.get(CLI_MAIL)); - outputfile.set("WEB PAGE ADDRESS", ""); - outputfile.set("ACCOUNT CODE", code); - v = fornitori.get(CLI_CODVAL); - if (v.as_string().blank()) - v = "EUR"; - outputfile.set("CURRENCY CODE", v); - outputfile.set("CREDIT LIMIT", fornitori.get(CLI_FIDO)); - - v = fornitori.get(CLI_CODPAG); - pag2pag(v); - outputfile.set("PAYMENT TERMS GROUP", v); - - outputfile.set("Name/Address 1", ragsoc); - TString s(fornitori.get(CLI_INDCF).as_string()); - s << " " << fornitori.get(CLI_CIVCF).as_string();; - outputfile.set("Name/Address 2", s); - outputfile.set("Name/Address 3", fornitori.get(CLI_LOCCF)); - - TString key; key << "|" << fornitori.get(CLI_COMCF).as_string(); - const TRectype & rec = cache().get(LF_COMUNI, key); - - outputfile.set("Town/City", rec.get(COM_DENCOM)); - outputfile.set("State", rec.get(COM_PROVCOM)); - outputfile.set("Postal Code", rec.get(COM_CAPCOM)); - v = fornitori.get(CLI_STATOPAIV); - if (v.as_string().blank()) - v = "IT"; - outputfile.set("Country", v); - s = fornitori.get(CLI_PTEL).as_string(); - if (s.full()) - s << "/" ; - s << fornitori.get(CLI_TEL).as_string() << " " << fornitori.get(CLI_PTEL2).as_string(); - if (fornitori.get(CLI_PTEL2).as_string().full()) - s << "/"; - s << fornitori.get(CLI_TEL2).as_string() << " " << fornitori.get(CLI_PTEL3).as_string(); - if (fornitori.get(CLI_PTEL3).as_string().full()) - s << "/"; - s << fornitori.get(CLI_TEL3).as_string(); - outputfile.set("Telephone Number", s); - s = fornitori.get(CLI_PFAX).as_string(); - if (s.full()) - s << "/" ; - s << fornitori.get(CLI_FAX).as_string(); - outputfile.set("Telex/Fax Number", s); - outputfile.set("Long Description", ragsoc); - outputfile.set("Short Heading", shortragsoc); - outputfile.set("Lookup Code", shortragsoc); - const TString8 abi(fornitori.get(CLI_CODABI).as_string()); - TString16 cab(abi) ; - - cab << fornitori.get(CLI_CODCAB).as_string(); - - const TRectype & abirec = cache().get("%BAN", abi); - const TRectype & cabrec = cache().get("%BAN", cab); - - v = abirec.get("S0"); - outputfile.set("Bank Lookup Code", v); - outputfile.set("Bank Account Name", v); - outputfile.set("Bank Name", v); - outputfile.set("Bank Address Code", cab); - outputfile.set("Bank Account Number", fornitori.get(CLI_NUMCC)); - outputfile.set("Bank Branch", cabrec.get("S0")); - v = fornitori.get(CLI_IBAN).as_string(); - if (v.as_string().len() > 5) - { - v = v.as_string().left(5); - outputfile.set("Bank Sorting Code", v); - } - outputfile.set("Comment", fornitori.get(CLI_REFERENTE)); - v = ""; - const bool persona = cofi.len() > 11; - if (persona) - v = atoi(cofi.mid(9,2)) > 31 ? "F" :"M"; - if (pi.blank()) - { - pi = cofi; - cofi = ""; - } - outputfile.set("Vat Code", pi); - outputfile.set("Fiscal Code", cofi); - outputfile.set("Fiscal Code", cofi); - outputfile.set("Sex", v); - - outputfile.set("ANALYSIS 1 - COA_UK", "CREDITORS<1YR"); - outputfile.set("ANALYSIS 2", "SOUTH"); - outputfile.set("ANALYSIS 3", "Y"); - outputfile.set("BANK SUB CODE", "00000"); - outputfile.set("Bank Sub Code", "00000"); - if (!persona) - { - outputfile.set("ANALYSIS 4 - CUST_SUPP_GROUP", "001"); - outputfile.set("ANALYSIS 5 - WITHHOLD_TAX", ""); - } - else - { - outputfile.set("ANALYSIS 4 - CUST_SUPP_GROUP", "201"); - outputfile.set("ANALYSIS 5 - WITHHOLD_TAX", "10401"); - const int year = 1900 + atoi(cofi.mid(6, 2)); - int month = wm.find(cofi[8]) + 1; - int day = atoi(cofi.mid(9, 2)); - - if (month < 1) - month = 1; - if (day > 40) - day -= 40; - - const TDate datanasc(day, month, year); - - v = datanasc.string(full, '/'); - outputfile.set("Birth Date", v); - key = "|"; key << cofi.mid(11, 4); - - const TRectype & recnasc = cache().get(LF_COMUNI, key); - - v = recnasc.get(COM_DENCOM); - const TString & prov = recnasc.get(COM_PROVCOM); - if (prov.full()) - { - v += " ("; - v += (const char *) prov; - v += ")"; - } - outputfile.set("Birth Town", v); - } - pin.addstatus(1L);; - if (pin.iscancelled()) - break; - } - outputfile.save_as(name, fmt_silk); -} - -void TTrasf_app::load_partite_aperte(const TTrasf_mask & m, const char * tipocf, TPartite_array &part) -{ - TString query; - const TDate datalim = m.get_date(F_DATALIM); - - query << "USE PART SELECT (NRIGA==1)&&(TIPOC==\"" << tipocf << "\")"; - - TISAM_recordset partite(query); - TProgind pin(partite.items(), TR("Caricamento Partite Aperte"), true, true); - - for (bool ok = partite.move_first(); ok; ok = partite.move_next()) - { - TPartita * p = new TPartita(partite.cursor()->curr()); - TImporto saldo = p->calcola_saldo_al(false, datalim, datalim, datalim); - - saldo.normalize('D'); - if (saldo.valore() != ZERO) - part.insert(p); - else - delete p; - pin.addstatus(1L);; - if (pin.iscancelled()) - break; - } - -} - -void TTrasf_app::export_partite_clienti(const TTrasf_mask & m) -{ - TPartCliFo_textset outputfile; - TFilename name = m.get(F_PATH); - TPartite_array part; - TString descr; - long line = 0L; - const TDate datalim = m.get_date(F_DATALIM); - TString div; - TVariant v; - - ditta2div(prefix().get_codditta(), div); - name.add("partcli.slk"); - - load_partite_aperte(m, "C", part); - TProgind pi(part.items(), TR("Esportazione Partite Clienti"), true, true); - - for (const TPartita * p = part.first(); p != NULL; p = part.next()) - { - TImporto saldo = p->calcola_saldo_al(false, datalim, datalim, datalim); - TImporto saldoval = p->calcola_saldo_al(true, datalim, datalim, datalim); - TVariant code; - TVariant grouped_code; - TString key("C|"); - int row = p->prima_fattura(); - - if (row < 0) - row = 1; - - const TRiga_partite & rigafatt = p->riga(row); - - key << rigafatt.get(PART_SOTTOCONTO); - - const TRectype & rec = cache().get(LF_CLIFO, key); - const bool grouped = cli2code(rec, div, code, descr); - - outputfile.new_rec(); - outputfile.set("Line No", ++line); - outputfile.set("Codice Conto", code); - outputfile.set("Descrizione Conto", descr); - outputfile.set("Data Fattura / NC", rigafatt.get_date(PART_DATADOC)); - outputfile.set("Numero Fattura / NC", rigafatt.get(PART_NUMDOC)); - if (!grouped) - v = rigafatt.get(PART_DESCR); - else - { - const TRectype & reccli = cache().get(LF_CLIFO, key); - - descr = reccli.get(CLI_COFI); - descr << " " << reccli.get(CLI_RAGSOC); - v = descr; - } - outputfile.set("Descrizione", v); - saldo.normalize('D'); - outputfile.set("Importo Euro (Avere = negativo)", saldo.valore()); - if (rigafatt.get(PART_CODVAL).full()) - v = rigafatt.get(PART_CODVAL); - else - v = "EUR"; - outputfile.set("Cod Valuta", v); - saldoval.normalize('D'); - outputfile.set("Importo in Valuta", saldoval.valore()); - - const int nrate = rigafatt.rate(); - - if (nrate > 0) - outputfile.set("Data Scadenza", rigafatt.rata(rigafatt.rate()).get_date(SCAD_DATASCAD)); - outputfile.set("T7 - Prot Iva", rigafatt.get(PART_PROTIVA)); - outputfile.set("T9 - Divisione", div); - } - outputfile.save_as(name, fmt_silk); -} - -void TTrasf_app::export_partite_fornitori(const TTrasf_mask & m) -{ - TPartCliFo_textset outputfile; - TPartForPer_textset outputfileper; - TFilename name = m.get(F_PATH); - TFilename nameper = m.get(F_PATH); - TPartite_array part; - TString descr; - long line = 0L; - const TDate datalim = m.get_date(F_DATALIM); - TString div; - TVariant v; - long nummov = 0L; - - ditta2div(prefix().get_codditta(), div); - - name.add("partfor.slk"); - nameper.add("partforper.slk"); - - load_partite_aperte(m, "F", part); - TProgind pin(part.items(), TR("Esportazione Partite Fornitori"), true, true); - - for (const TPartita * p = part.first(); p != NULL; p = part.next()) - { - TImporto saldo = p->calcola_saldo_al(false, datalim, datalim, datalim); - TImporto saldoval = p->calcola_saldo_al(true, datalim, datalim, datalim); - TVariant code; - TString key("F|"); - int row = p->prima_fattura(); - - if (row < 0) - row = 1; - - const TRiga_partite & rigafatt = p->riga(row); - - key << rigafatt.get(PART_SOTTOCONTO); - - const TRectype & rec = cache().get(LF_CLIFO, key); - const bool percipiente = rec.get_char(CLI_TIPOAPER) == 'F' && rec.get_char(CLI_CODANAGPER); - - if (percipiente) - { - const long numreg = rigafatt.get_long(PART_NREG); - - if (numreg > 0L) - { - TMovimentoPN movim; - - movim.lfile().put(MOV_NUMREG, numreg); - movim.read(); - - const TDate datareg = movim.lfile().get_date(MOV_DATAREG); - TDate datadoc = movim.lfile().get_date(MOV_DATADOC); - const TString d = movim.lfile().get(MOV_DESCR); - const TString rifdoc(movim.lfile().get(MOV_NUMDOC)); - const real ritfis(movim.lfile().get_real(MOV_RITFIS)); - const real totdoc = movim.lfile().get_real(MOV_TOTDOC) + ritfis; - TString protiva(movim.lfile().get(MOV_PROTIVA)); - - protiva << movim.lfile().get(MOV_REG); - if (!datadoc.ok()) - datadoc = datareg; - nummov++; - long rowno = 0; - const int rowscg = movim.cg_items(); - const int rowsiva = movim.iva_items(); - for (int i = 0; i < rowscg; i++) - { - const TRectype & row = movim.cg(i); - - if (row.get_char(RMV_ROWTYPE) == 'T') - { - outputfileper.new_rec(); - - outputfileper.set("Data Reg ne", datareg); - - TBill c(row.get_int(RMV_GRUPPO), row.get_int(RMV_CONTO), row.get_long(RMV_SOTTOCONTO), row.get_char(RMV_TIPOC)); - - count2code(c, div, v); - outputfileper.set("Conto", v); - outputfileper.set("Descrizione conto", c.descrizione()); - - TImporto val( row.get_char(RMV_SEZIONE), totdoc); - - val.normalize('D'); - v = row.get(RMV_DESCR); - if (v.as_string().blank()) - v = d; - outputfileper.set("Descrizione", v); - outputfileper.set("Imp. Euro", val.valore()); - outputfileper.set("Data Doc to", datadoc); - outputfileper.set("Rif. Doc to", rifdoc); - outputfileper.set("N Giornale", nummov); // num.reg. - rowno++; - outputfileper.set("N Riga Giorn.", rowno); // num.rig - outputfileper.set("Cod Valuta", "EUR"); - outputfileper.set("Imp Valuta", val.valore()); - outputfileper.set("Centro di Costo", row.get(RMV_CODCMS)); - outputfileper.set("Prot Iva", protiva); - outputfileper.set("Divisione", div); - if (ritfis != ZERO) - { - outputfileper.new_rec(); - - outputfileper.set("Data Reg ne", datareg); - - TBill c(row.get_int(RMV_GRUPPO), row.get_int(RMV_CONTO), row.get_long(RMV_SOTTOCONTO), row.get_char(RMV_TIPOC)); - - count2code(c, div, v); - outputfileper.set("Conto", v); - outputfileper.set("Descrizione conto", c.descrizione()); - - TImporto val( row.get_char(RMV_SEZIONE), ritfis); - - val.normalize('D'); - v = row.get(RMV_DESCR); - if (v.as_string().blank()) - v = d; - outputfileper.set("Descrizione", v); - outputfileper.set("Imp. Euro", val.valore()); - outputfileper.set("Data Doc to", datadoc); - outputfileper.set("Rif. Doc to", rifdoc); - outputfileper.set("N Giornale", nummov); // num.reg. - rowno++; - outputfileper.set("N Riga Giorn.", rowno); // num.rig - outputfileper.set("Cod Valuta", "EUR"); - outputfileper.set("Imp Valuta", val.valore()); - outputfileper.set("Centro di Costo", row.get(RMV_CODCMS)); - outputfileper.set("Prot Iva", protiva); - outputfileper.set("Divisione", div); - } - } - else - { - if (row.get(RMV_ROWTYPE) != "I" || rowsiva == 0) - { - outputfileper.new_rec(); - - outputfileper.set("Data Reg ne", datareg); - - TBill c(row.get_int(RMV_GRUPPO), row.get_int(RMV_CONTO), row.get_long(RMV_SOTTOCONTO), row.get_char(RMV_TIPOC)); - - count2code(c, div, v); - outputfileper.set("Conto", v); - outputfileper.set("Descrizione conto", c.descrizione()); - - TImporto val( row.get_char(RMV_SEZIONE), row.get_real(RMV_IMPORTO)); - - val.normalize('D'); - v = row.get(RMV_DESCR); - if (v.as_string().blank()) - v = d; - outputfileper.set("Descrizione", v); - outputfileper.set("Imp. Euro", val.valore()); - outputfileper.set("Data Doc to", datadoc); - outputfileper.set("Rif. Doc to", rifdoc); - outputfileper.set("N Giornale", nummov); // num.reg. - rowno++; - outputfileper.set("N Riga Giorn.", rowno); // num.rig - outputfileper.set("Cod Valuta", "EUR"); - outputfileper.set("Imp Valuta", val.valore()); - outputfileper.set("Centro di Costo", row.get(RMV_CODCMS)); - outputfileper.set("Prot Iva", protiva); - outputfileper.set("Divisione", div); - } - } - } - for (int j = 0; j < rowsiva; j++) - { - const TRectype & row = movim.iva(j); - - outputfileper.new_rec(); - - outputfileper.set("Data Reg ne", datareg); - - TBill c(row.get_int(RMI_GRUPPO), row.get_int(RMI_CONTO), row.get_long(RMI_SOTTOCONTO), row.get_char(RMI_TIPOC)); - - count2code(c, div, v); - outputfileper.set("Conto", v); - outputfileper.set("Descrizione conto", c.descrizione()); - - const int nrowcg = row.get_int(RMI_RIGAIMP) - 1; - - if (nrowcg >= 0) - { - TImporto val( movim.cg(nrowcg).get_char(RMV_SEZIONE), row.get_real(RMI_IMPONIBILE)); - val.normalize('D'); - outputfileper.set("Imp. Euro", val.valore()); - outputfileper.set("Cod Valuta", "EUR"); - outputfileper.set("Imp Valuta", val.valore()); - } - else - message_box("Riga IVA senza sezione mov. %ld riga %d", numreg, i + 1); - - - v = ""; - if (nrowcg >= 0) - v = movim.cg(nrowcg).get(RMV_DESCR); - if (v.as_string().blank()) - v = d; - outputfileper.set("Descrizione", v); - outputfileper.set("Data Doc to", datadoc); - outputfileper.set("Rif. Doc to", rifdoc); - outputfileper.set("N Giornale", nummov); // num.reg. - rowno++; - outputfileper.set("N Riga Giorn.", rowno); // num.rig - outputfileper.set("Centro di Costo", row.get(RMI_CODCMS)); - - TString codiva(row.get(RMI_CODIVA)); - - iva2iva(codiva, div); - outputfileper.set("Cod Iva", codiva); - outputfileper.set("Prot Iva", protiva); - outputfileper.set("Divisione", div); - } - } - } - const bool grouped = cli2code(rec, div, code, descr); - - outputfile.new_rec(); - outputfile.set("Line No", ++line); - outputfile.set("Codice Conto", code); - outputfile.set("Descrizione Conto", descr); - outputfile.set("Data Fattura / NC", rigafatt.get_date(PART_DATADOC)); - outputfile.set("Numero Fattura / NC", rigafatt.get(PART_NUMDOC)); - outputfile.set("Descrizione", rigafatt.get(PART_DESCR)); - saldo.normalize('D'); - outputfile.set("Importo Euro (Avere = negativo)", saldo.valore()); - if (rigafatt.get(PART_CODVAL).full()) - v = rigafatt.get(PART_CODVAL); - else - v = "EUR"; - outputfile.set("Cod Valuta", v); - saldoval.normalize('D'); - outputfile.set("Importo in Valuta", saldoval.valore()); - - const int nrate = rigafatt.rate(); - - if (nrate > 0) - outputfile.set("Data Scadenza", rigafatt.rata(nrate).get_date(SCAD_DATASCAD)); - descr = rigafatt.get(PART_PROTIVA); - descr << rigafatt.get(PART_REG); - outputfile.set("T7 - Prot Iva", descr); - outputfile.set("T9 - Divisione", div); - } - outputfile.save_as(name, fmt_silk); - outputfileper.save_as(nameper, fmt_silk); -} - -void TTrasf_app::export_saldi(const TTrasf_mask & m) -{ - TArray saldi_ragg; - TString_array ragg_codes; - TString_array ragg_descrs; - TSaldi_textset outputfile; - TFilename name = m.get(F_PATH); - long line = 0L; - TString div; - TString80 rifdoc("SALDI AP.DIV "); - TString80 key; - TVariant v; - const TDate datalim = m.get_date(F_DATALIM); - TDate dataap = datalim; - TSaldo sld; - TEsercizi_contabili esc; - const int codes = esc.date2esc(datalim); - const TDate dataini = esc.esercizio(codes).inizio(); - - ++dataap; - ditta2div(prefix().get_codditta(), div); - rifdoc << div; - - - name.add("saldi.slk"); - - TISAM_recordset saldi("USE SALDI\nFROM ANNOES=#ANNO\nTO ANNOES=#ANNO"); - - saldi.set_var("#ANNO", (long) codes); - TProgind pin(saldi.items(), TR("Esportazione Saldi"), true, true); - - for (bool ok = saldi.move_first(); ok; ok = saldi.move_next()) - { - const TRectype & sal = saldi.cursor()->curr(); - int gruppo = sal.get_int(SLD_GRUPPO); - int conto = sal.get_int(SLD_CONTO); - - key.format("%03d|%03d|0", gruppo, conto); - - const TRectype & contorec = cache().get(LF_PCON, key); - char tipoconto = contorec.get_char(PCN_TMCF); - TBill c(gruppo, conto, sal.get_long(SLD_SOTTOCONTO), tipoconto); - TString descr; - TVariant code; - bool grouped = false; - - if (tipoconto > ' ') - { - key.cut(0); - key << tipoconto << "|" << c.sottoconto(); - const TRectype & rec = cache().get(LF_CLIFO, key); - - grouped = cli2code(rec, div, code, descr); - TString c = code.as_string(); - } - - const int sottoconto = c.sottoconto(); - - const real& saldo = sld.saldo_periodo(gruppo, conto, sottoconto, dataini, datalim, c.indicatore_bilancio(), false); - - if (saldo != ZERO) - { - if (grouped) - { - int index = ragg_codes.find(code.as_string()); - - if (index < 0) - { - index = ragg_codes.add(code.as_string()); - ragg_descrs.add(descr, index); - } - real * imp = (real *) saldi_ragg.objptr(index); - - if (imp == NULL) - { - imp = new real; - saldi_ragg.add(imp, index); - } - (*imp) += saldo; - } - else - { - outputfile.new_rec(); - outputfile.set("Line No", ++line); - count2code(c, div, v); - outputfile.set("Codice Conto", v); - v = c.descrizione(); - outputfile.set("Descrizione Conto", v); - outputfile.set("Descrizione", v); - outputfile.set("Data Documento", dataap); - v = rifdoc; - outputfile.set("Riferimento Doc to", v); - - outputfile.set("Importo Euro (Avere = negativo)", saldo); - outputfile.set("Cod Valuta", "EUR"); - outputfile.set("Importo in Valuta", saldo); - outputfile.set("T9 - Divisione", div); - } - } - pin.addstatus(1L);; - if (pin.iscancelled()) - break; - } - for (int i = 0 ; i < saldi_ragg.items(); i++) - { - real * imp = (real *) saldi_ragg.objptr(i); - - if (imp != NULL && *imp != ZERO) - { - const TString & code = ragg_codes.row(i); - const TString & descr = ragg_descrs.row(i); - outputfile.new_rec(); - outputfile.set("Line No", ++line); - v = code; - outputfile.set("Codice Conto", v); - v = descr; - outputfile.set("Descrizione Conto", v); - outputfile.set("Descrizione", v); - outputfile.set("Data Documento", dataap); - v = rifdoc; - outputfile.set("Riferimento Doc to", v); - - outputfile.set("Importo Euro (Avere = negativo)", *imp); - outputfile.set("Cod Valuta", "EUR"); - outputfile.set("Importo in Valuta", *imp); - outputfile.set("T9 - Divisione", div); - } - } - outputfile.save_as(name, fmt_silk); -} - -void TTrasf_app::export_movimenti(const TTrasf_mask & m) -{ - TMovim_textset outputfile; - TFilename name = m.get(F_PATH); - TString div; - TString80 rifdoc; - TVariant v; - TString descr; - const TDate datalim = m.get_date(F_DATALIM); - const TDate datamov = m.get_date(F_DATAMOV); - TPartite_array p; - long nummov = 0L; - - ditta2div(prefix().get_codditta(), div); - name.add("movim.slk"); - - TISAM_recordset mov("USE MOV"); - TProgind pi(mov.items(), TR("Esportazione Movimenti"), true, true); - - for (bool ok = mov.move_first(); ok; ok = mov.move_next()) - { - const TDate datacomp = mov.get(MOV_DATACOMP).as_date(); - - if (datacomp > datalim && datacomp <= datamov) - { - TMovimentoPN movim; - const long numreg = mov.get(MOV_NUMREG).as_int(); - TDate datadoc = mov.get(MOV_DATADOC).as_date(); - const TString d = mov.get(MOV_DESCR).as_string(); - const TString8 codcaus(mov.get(MOV_CODCAUS).as_string()); - const TString80 descrcau(cache().get(LF_CAUSALI, codcaus, CAU_DESCR)); - TString16 protiva(mov.get(MOV_PROTIVA).as_string()); - - protiva << mov.get(MOV_REG).as_string(); - rifdoc = mov.get(MOV_NUMDOC).as_string(); - if (!datadoc.ok()) - datadoc = mov.get(MOV_DATAREG).as_date(); - - movim.lfile().put(MOV_NUMREG, numreg); - movim.read(); - p.destroy(); - p.add_numreg(numreg); - TPartita * par; - int rowpart = -1; - if (mov.get(MOV_REG).as_string().full()) - for (par = p.first(); rowpart < 0 && par != NULL; par = p.next()) - rowpart = par->prima_fattura(numreg); - - nummov++; - long rowno = 0; - const int rowscg = movim.cg_items(); - const int rowsiva = movim.iva_items(); - for (int i = 0; i < rowscg; i++) - { - const TRectype & row = movim.cg(i); - - if (row.get_char(RMV_ROWTYPE) == 'T' && rowpart >= 0) - { - const TRiga_partite & rp = p.first()->riga(rowpart); - const int rate = rp.rate(); - TVariant v; - TString descr; - - for (int j = 0; j < rate; j++) - { - const TRiga_scadenze & sc = rp.rata(j + 1); - - outputfile.new_rec(); - - outputfile.set("Mov No", nummov); - rowno++; - outputfile.set("Line No", rowno); - - TBill c(row.get_int(RMV_GRUPPO), row.get_int(RMV_CONTO), row.get_long(RMV_SOTTOCONTO), row.get_char(RMV_TIPOC)); - - count2code(c, div, v); - outputfile.set("Codice Conto", v); - outputfile.set("Descrizione Conto", c.descrizione()); - outputfile.set("Data Documento", datadoc); - outputfile.set("Riferimento Doc to", rifdoc); - descr = row.get(RMV_DESCR); - if (descr.blank()) - descr = d; - outputfile.set("Descrizione", descr); - TImporto val = sc.importo(false); - - val.normalize('D'); - outputfile.set("Importo Euro (Avere = negativo)", val.valore()); - outputfile.set("Cod Valuta", "EUR"); - outputfile.set("Importo in Valuta", val.valore()); - outputfile.set("Data Scadenza", sc.get_date(SCAD_DATASCAD)); - outputfile.set("T3 - Non utilizzare: Centro di Costo", row.get(RMV_CODCMS)); - outputfile.set("T7 - Prot Iva", protiva); - outputfile.set("T9 - Divisione", div); - outputfile.set("T10 - Codice Causale originale", codcaus); - outputfile.set("Descrizione Causale originale", descrcau); - outputfile.set("Numero operazione originale", numreg); - } - } - else - { - if (row.get(RMV_ROWTYPE) != "I" || rowsiva == 0) - { - outputfile.new_rec(); - outputfile.set("Mov No", nummov); - rowno++; - outputfile.set("Line No", rowno); - - TBill c(row.get_int(RMV_GRUPPO), row.get_int(RMV_CONTO), row.get_long(RMV_SOTTOCONTO), row.get_char(RMV_TIPOC)); - - count2code(c, div, v); - outputfile.set("Codice Conto", v); - outputfile.set("Descrizione Conto", c.descrizione()); - outputfile.set("Data Documento", datadoc); - outputfile.set("Riferimento Doc to", rifdoc); - descr = row.get(RMV_DESCR); - if (descr.blank()) - descr = d; - outputfile.set("Descrizione", descr); - TImporto val( row.get_char(RMV_SEZIONE), row.get_real(RMV_IMPORTO)); - - val.normalize('D'); - outputfile.set("Importo Euro (Avere = negativo)", val.valore()); - outputfile.set("Cod Valuta", "EUR"); - outputfile.set("Importo in Valuta", val.valore()); - outputfile.set("T3 - Non utilizzare: Centro di Costo", row.get(RMV_CODCMS)); - outputfile.set("T7 - Prot Iva", protiva); - outputfile.set("T9 - Divisione", div); - outputfile.set("T10 - Codice Causale originale", codcaus); - outputfile.set("Descrizione Causale originale", descrcau); - outputfile.set("Numero operazione originale", numreg); - - } - } - } - for (int j = 0; j < rowsiva; j++) - { - const TRectype & row = movim.iva(j); - - outputfile.new_rec(); - outputfile.set("Mov No", nummov); - rowno++; - outputfile.set("Line No", rowno); - - TBill c(row.get_int(RMI_GRUPPO), row.get_int(RMI_CONTO), row.get_long(RMI_SOTTOCONTO), row.get_char(RMI_TIPOC)); - - count2code(c, div, v); - outputfile.set("Codice Conto", v); - outputfile.set("Descrizione Conto", c.descrizione()); - outputfile.set("Data Documento", datadoc); - outputfile.set("Riferimento Doc to", rifdoc); - const int nrowcg = row.get_int(RMI_RIGAIMP) - 1; - descr.cut(0); - if (nrowcg >= 0) - descr = movim.cg(nrowcg).get(RMV_DESCR); - if (descr.blank()) - descr = d; - outputfile.set("Descrizione", descr); - if (nrowcg >= 0) - { - TImporto val( movim.cg(nrowcg).get_char(RMV_SEZIONE), row.get_real(RMI_IMPONIBILE)); - val.normalize('D'); - outputfile.set("Importo Euro (Avere = negativo)", val.valore()); - outputfile.set("Cod Valuta", "EUR"); - outputfile.set("Importo in Valuta", val.valore()); - } - else - message_box("Riga IVA senza sezione mov. %ld riga %d", numreg, i + 1); - - outputfile.set("Data Scadenza", datalim); // ?????? - outputfile.set("T3 - Non utilizzare: Centro di Costo", row.get(RMV_CODCMS)); - - TString codiva = row.get(RMI_CODIVA); - - iva2iva(codiva, div); - outputfile.set("T4 - Non utilizzare (Cod Iva)", codiva); - outputfile.set("T7 - Prot Iva", protiva); - outputfile.set("T9 - Divisione", div); - outputfile.set("T10 - Codice Causale originale", codcaus); - outputfile.set("Descrizione Causale originale", descrcau); - outputfile.set("Numero operazione originale", numreg); - } - - } - pi.addstatus(1L);; - if (pi.iscancelled()) - break; - } - outputfile.save_as(name, fmt_silk); -} - -void TTrasf_app::main_loop() -{ - TTrasf_mask m; - while (m.run() != K_QUIT) - { - if (m.get_bool(F_CL)) - export_clienti(m); - if (m.get_bool(F_FO)) - export_fornitori(m); - if (m.get_bool(F_PC)) - export_partite_clienti(m); - if (m.get_bool(F_PF)) - export_partite_fornitori(m); - if (m.get_bool(F_SA)) - export_saldi(m); - if (m.get_bool(F_MO)) - export_movimenti(m); - } -} - -int ps0001100(int argc, char* argv[]) -{ - TTrasf_app a; - a.run(argc, argv, TR("Esportazione Salus")); - return 0; -} diff --git a/ps/ps0001100.h b/ps/ps0001100.h deleted file mode 100755 index 57da49cbf..000000000 --- a/ps/ps0001100.h +++ /dev/null @@ -1,13 +0,0 @@ -#define F_CODDITTA 101 -#define F_RAGSOC 102 -#define F_PATH 103 -#define F_CL 104 -#define F_FO 105 -#define F_BC 106 -#define F_PC 107 -#define F_PF 108 -#define F_SA 110 -#define F_MO 111 -#define F_DATALIM 112 -#define F_DATAMOV 113 - diff --git a/ps/ps0001100.uml b/ps/ps0001100.uml deleted file mode 100755 index 9e06dbcf6..000000000 --- a/ps/ps0001100.uml +++ /dev/null @@ -1,94 +0,0 @@ -#include "ps0001100.h" - -PAGE "Invio dati contabilita'" -1 -1 80 14 - -GROUPBOX DLG_NULL 76 3 -BEGIN - PROMPT 2 1 "@bDitta corrente" -END - -NUMBER F_CODDITTA 5 -BEGIN - PROMPT 3 2 "Codice " - FLAGS "FD" - USE LF_NDITTE - INPUT CODDITTA F_CODDITTA - OUTPUT F_RAGSOC RAGSOC - CHECKTYPE REQUIRED -END - -STRING F_RAGSOC 50 -BEGIN - PROMPT 23 2 "" - FLAGS "D" -END - -DATE F_DATALIM -BEGIN - PROMPT 2 4 "Data limite " - FIELD datalim -END - -DATE F_DATAMOV -BEGIN - PROMPT 40 4 "Data movimenti " - FIELD datamov -END - -BOOLEAN F_CL -BEGIN - PROMPT 2 6 "Clienti" - FIELD cl -END - -BOOLEAN F_FO -BEGIN - PROMPT 14 6 "Fornitori" - FIELD fo -END - -BOOLEAN F_PC -BEGIN - PROMPT 26 6 "Partite clienti" - FIELD pc -END - -BOOLEAN F_PF -BEGIN - PROMPT 40 6 "Partite fornitori" - FIELD pf -END - -BOOLEAN F_SA -BEGIN - PROMPT 59 6 "Saldi" - FIELD cs -END - -BOOLEAN F_MO -BEGIN - PROMPT 69 6 "Movimenti" - FIELD mo -END - -STRING F_PATH 256 30 -BEGIN - PROMPT 2 8 "Cartella di output " - DSELECT - CHECKTYPE REQUIRED - FIELD Outth -END - -BUTTON DLG_OK 9 2 -BEGIN - PROMPT -12 -1 "" -END - -BUTTON DLG_QUIT 9 2 -BEGIN - PROMPT -22 -1 "" -END - -ENDPAGE - -ENDMASK diff --git a/ps/ps0001200.cpp b/ps/ps0001200.cpp deleted file mode 100755 index 94ed76e33..000000000 --- a/ps/ps0001200.cpp +++ /dev/null @@ -1,1158 +0,0 @@ -#include -#include - -#include "../cg/cgsaldac.h" -#include "../cg/cglib02.h" -#include "ps0001.h" -#include "../sc/sc2201.h" -#include "ps0001200.h" - -#include -#include -#include -#include - -class TPRSC_recordset : public TAS400_recordset -{ -public: - TPRSC_recordset(const TString_array & colnames); -}; - -TPRSC_recordset::TPRSC_recordset(const TString_array & colnames) : TAS400_recordset("AS400(356,0,0)") -{ - create_field("Cliente", 0, 11); - create_field("RagioneSociale", -1, 50); - create_field("Valuta", -1, 3); - for (int i = 0; i < colnames.items(); i++) - create_field(colnames.row(i), -1, 15, _realfld); - create_field("Totale", -1, 15, _realfld); - create_field("Esposto", -1, 15, _realfld); - create_field("Saldo", -1, 15, _realfld); - create_field("Differenza", -1, 15, _realfld); -} - -/////////////////////////////////////////////////////////// -// Stampa prospetto scadenze -/////////////////////////////////////////////////////////// - -#define NUMERO_FASCE 9 -#define LIMITI {0, 30, 60, 90, 120, 150, 180, 210, 240, 270} - -enum tipo_st {clienti=0, fornitori=1}; - -class TLineTotal : public TObject //Oggetto di base per i TAssoc_array dei totali -{ -public: - real _s[NUMERO_FASCE];// Scaglioni scaduto - real _ns[NUMERO_FASCE];// Scaglioni a scadere - real _es; // esposto - real _sl; // saldo - - virtual TObject* dup() const { return new TLineTotal(*this); } - virtual TLineTotal & copy(const TLineTotal & l); - TLineTotal(const TLineTotal* l) { copy(*l); } - TLineTotal(); -}; - -TLineTotal & TLineTotal::copy(const TLineTotal & l) -{ - for (int i = 0; i < NUMERO_FASCE; i++) - { - _s[i] = l._s[i]; - _ns[i] = l._ns[i]; - } - _es=l._es; - _sl=l._sl; - return *this; -} - -TLineTotal::TLineTotal() -{ - for (int i = 0; i < NUMERO_FASCE; i++) - { - _s[i] = ZERO; - _ns[i] = ZERO; - } - _es = ZERO; - _sl = ZERO; -} - -class TProspettoScadenze : public TPrintapp -{ - TRelation *_rel1, *_rel2; // Relazioni di lavoro... - int _cur1, _cur2, // Identificatori dei cursori di lavoro... - _cur3, _cur4; - TSelection_ext_mask *_m; - TLocalisamfile *_scad,*_pagsca; - tipo_st _tipost; // Tipo di stampa impostato - bool _end_printed, - _stvaluta, - _ordcod, // VERO=ordine per codice, FALSO=ordine per ragione sociale - _sinfasce, - _nsinfasce; - TString _anno,_numdoc,_protiva,_datadoc,_codval, - _cod, _cod_pre, _des, _des_pre; - TDate _limop, _limscad, _datas, _limbf; // Data limite operazione, data limite scaduto e data di stampa - int _gcr, // Giorni per Calcolo Rischio (valido solo per stampa clienti) - _sfasce, - _nsfasce; - real _unsnc,_uns, _unsesp; // Unassigned per partita. - TArray _conti_cf, // array per conti mastro - _t, // Array per i totali - _ns_date, // Date per non scaduto - _s_date, // Date per lo scaduto - _ragg_tot; - bool _excel; - TPRSC_recordset * _recset; - - static TString _last_game; - static bool fil_function(const TRelation *); - TString_array _colnames; - -public: - virtual const char * extra_modules() const {return "sc";} - virtual bool preprocess_page(int file, int counter); - virtual bool preprocess_print(int file, int counter); - virtual void postclose_print(); - virtual print_action postprocess_print(int file, int counter); - virtual print_action postprocess_page(int file, int counter); - virtual void preprocess_header() {}; - virtual void preprocess_footer() ; - virtual bool user_create(); - virtual bool user_destroy(); - virtual bool set_print(int); - virtual void set_page (int file, int counter); - void print_totali_rows(int nriga, bool what); - void export_totali_rows(); - void export_grouped_rows(); - void print_totali(int nriga); - void print_header(); - int calc_last_column(); - void update_totals(bool what, real& esp, real s[NUMERO_FASCE], real ns[NUMERO_FASCE]); - void compute_unassigned(TPartita& p, const TDate & datalim); - void compute_all(TPartita& p, TBill& bill); - void print_real(TString& dest, const real& num); - void riempi_conti_mastro(const char cf); - void calcola_saldo(); - TProspettoScadenze(); -}; - -TString TProspettoScadenze::_last_game; - -inline TProspettoScadenze& app() {return (TProspettoScadenze&)main_app();} - -void TProspettoScadenze::print_real(TString& dest, const real& num) -{ - const bool stampa_in_valuta = _stvaluta && !_codval.blank(); - const TString& val = stampa_in_valuta ? _codval : EMPTY_STRING; - const TCurrency cur(num, val); - dest = cur.string(true); - dest.right_just(10); -} - -bool TProspettoScadenze::fil_function(const TRelation *r) -{ - TRectype& part = r->curr(LF_PARTITE); - - TString80 key; - key.format("%03d%03d%06ld%4d", - part.get_int(PART_GRUPPO), part.get_int(PART_CONTO), - part.get_long(PART_SOTTOCONTO), part.get_int(PART_ANNO)); - key << part.get(PART_NUMPART); - - const bool rt = key != _last_game; - if (rt) - _last_game = key; - return rt; -} - -void TProspettoScadenze::update_totals(bool what, real& esp, - real s[NUMERO_FASCE], real ns[NUMERO_FASCE]) -{ - TAssoc_array& a = (TAssoc_array&) _t[what]; - TLineTotal *ll = (TLineTotal *) a.objptr(_codval); - if (ll == NULL) - { - ll = new TLineTotal; - a.add(_codval, ll); - } - for (int i = 0; i < NUMERO_FASCE; i++) - { - ll->_s[i] += s[i]; - ll->_ns[i] += ns[i]; - } - ll->_es += esp; -} - -void TProspettoScadenze::compute_unassigned(TPartita& p, const TDate & datalim) -{ - TRecord_array& ra = p.unassigned(); - - _uns = _unsnc = _unsesp = ZERO; - for (int r = ra.last_row(); r > 0; r = ra.pred_row(r)) - { - const TRectype& rec = ra.row(r); - const TRiga_partite& sum = p.riga(rec.get_int(PAGSCA_NRIGP)); - const char * field = (_stvaluta && sum.in_valuta() ? PAGSCA_IMPORTOVAL : PAGSCA_IMPORTO); - const TDate & datascad = sum.get_date(PART_DATAPAG); - - if ((datascad <= datalim)) - { - if (sum.get_int(PART_TIPOMOV) == 2) // Is it a credit note ? - _unsnc += rec.get_real(field); - else - _uns += rec.get_real(field); - } - else - { - if (sum.get_int(PART_TIPOMOV) == 2) // Is it a credit note ? - _unsesp -= rec.get_real(field); - else - _unsesp += rec.get_real(field); - } - - } -} - -void TProspettoScadenze::compute_all(TPartita& p, TBill& bill) -{ - real residuo; - real s[NUMERO_FASCE]; - real ns[NUMERO_FASCE]; - real res_pagati; - real esposto; - - compute_unassigned(p, _limbf); - esposto = _unsesp; - for (int r = p.last(); r > 0; r = p.pred(r)) // Browse all rows (partite) - { - const TRiga_partite& rp = p.riga(r); - // se la data di registrazione della partita ' > di _limop (data lim operazione) - // non deve scorrere le scadenze - const TDate data_reg(rp.get_date(PART_DATAREG)); - if (data_reg > _limop) continue; - for (int n = rp.rate(); n > 0; n--) // Browse all rows (scadenze) - { - const TRiga_scadenze& rs = rp.rata(n); - const TDate d(rs.get_date(SCAD_DATASCAD)); - const char* field = (_stvaluta && rs.in_valuta()) ? PAGSCA_IMPORTOVAL : PAGSCA_IMPORTO; - const char* sfield = (_stvaluta && rs.in_valuta()) ? SCAD_IMPORTOVAL : SCAD_IMPORTO; - const char ssez = rp.sezione(); - TImporto scd(ssez,rs.get_real(sfield)); // Importo in scadenza... - TImporto pag(rs.importo_pagato(_stvaluta)); // Quanto e' stato pagato per questa scadenza? - TImporto bf; - TImporto work_imp; - - // Scorre le righe di pagamento per trovare la riga corripondente alla prima data pagamento - // di questa rata. Motivo: il primo pagamento delle rata corrente, effettuato tramite effetto - // (ai fini del calcolo B.F.) deve essere considerato con la data scadenza - const int lst = rs.last(); - int prima_riga_pagamento = -1; - TDate first_date;// data relativa alla prima riga di pagamento - - for (int pp = rs.first(); pp <= lst; pp = rs.succ(pp)) - { - const TRiga_partite& sum = p.riga(pp); - TDate current_date(sum.get_date(PART_DATAPAG)); - int tipo_pag = rs.get_int(SCAD_TIPOPAG); - const tipo_movimento tipomov = (tipo_movimento) sum.get_int(PART_TIPOMOV); - - if (tipomov != tm_insoluto && tipo_pag >= 2 && tipo_pag <= 7) //Incasso tramite effetto - if (prima_riga_pagamento==-1 || first_date > current_date) - { - first_date = current_date; - prima_riga_pagamento = pp; - } - } - - for (pp = rs.first(); pp <= lst; pp = rs.succ(pp)) // Browse all rows (pagamenti) - { - const TRectype pg = rs.row(pp); - const TRiga_partite& sum = p.riga(pp); - const char sez = sum.sezione(); - const int tipomov = sum.get_int(PART_TIPOMOV); - // se tipomov e' 2 (Nota di credito assegnata) - // storna da scdz. In entrambi i casi si ha l'operatore +=, perche' nel TImporto e' gia' - // compresa la sezione opposta - if (tipomov == tm_nota_credito) - { - work_imp = TImporto(sez,pg.get_real(field)); - scd += work_imp; - pag -= work_imp; - } - if ((tipomov == tm_pagamento || tipomov == tm_pagamento_insoluto) && _tipost == clienti) - { - TDate data_pag(sum.get_date(PART_DATAPAG)); - int tipo_pag = sum.get_int(PART_TIPOPAG); - if (tipo_pag>=2 && tipo_pag<=7 && data_pag.ok()) //Incasso tramite effetto - { - if (prima_riga_pagamento > -1 && prima_riga_pagamento == pp) - data_pag = d; // Se e' il primo pagamento(in ordine di data) di questa rata - // prende la data di scadenza relativa. - if (data_pag > _limbf) // && data_pag <= _limscad) - bf += TImporto(sez,pg.get_real(field)); - } - } - } - - const char scd_sez = (_tipost == fornitori ? 'A' : 'D'); - const char pag_sez = (_tipost == fornitori ? 'D' : 'A'); - - scd.normalize(scd_sez); - - real rscd = scd.valore(); - - pag -= bf; - pag.normalize(pag_sez); - - real rpag = pag.valore(); - - real res = rscd - rpag; // Scadenze - pagati = scaduto per questo gruppo di rate - - if (_uns > ZERO) // Rettifica i pagamenti con i non assegnati (calcolo sul residuo: scadenza-pagamento) - { - real gap = (_uns > res ? res : _uns); // questo e' quanto manca per completare questa scadenza - res -= gap; - _uns -= gap; // aggiorna la cache.. - } - if (_unsnc > ZERO) // Rettifica le scadenze con le N.C non assegnate. - { - real gap = (_unsnc > rscd ? rscd : _unsnc); - rscd -= gap; - _unsnc -= gap; - } - if (rscd == ZERO) // Se le scadenze sono a zero, vuol dire che sono state stornate - res = ZERO; // da qualche nota di credito o non assegnato percio' non si ha residuo - - if (d > _limscad) - { - if (_nsinfasce) - { - for (int i = _nsfasce + 1; i >= 0; i--) - { - const TDate & limdate = (TDate&)_ns_date[i]; - if (limdate.ok() && d > limdate) - { - ns[i] += res; - break; - } - } - } - else - ns[0] += res; - } - else - { - if (_sinfasce) - { - for (int i = _sfasce + 1; i >= 0; i--) - { - const TDate & limdate = (TDate&)_s_date[i]; - if (limdate.ok() && d <= limdate) - { - s[i] += res; - break; - } - } - } - else - s[0] += res; - } - residuo += res; - bool sbf; - TImporto esp = rs.esposto(_stvaluta, _limscad, _limbf, sbf); - esposto += esp.valore(); - } - } - - // Aggiorna i totali... - update_totals(0, esposto, s, ns); // Singolo... - update_totals(1, esposto, s, ns); // ...Generale -} - -void TProspettoScadenze::calcola_saldo() -{ - TAssoc_array& a = (TAssoc_array&) _t[0]; - TLineTotal *ll = (TLineTotal *) a.objptr(_codval); - TEsercizi_contabili e; - TSaldo saldo; - int g,c; - const long s = atol(_cod_pre); - - for (int i = 0; i < _conti_cf.items(); i++) - { - TToken_string& cf = (TToken_string&)_conti_cf[i]; - g = cf.get_int(0); - c = cf.get_int(1); - TToken_string key; - key.add(g); key.add(c); key.add(""); - const TRectype& pc = cache().get(LF_PCON, key); - int indbil_conto = pc.get_int (PCN_INDBIL); - const int codes = e.date2esc(_limop); - saldo.set_annoes(codes); - TDate dataini(e.esercizio(codes).inizio()); - saldo.data_limite_bilancio( 1, g, c, s, dataini, _limop, indbil_conto, false); - if (_tipost == fornitori) - ll->_sl -= saldo.saldo(); - else - ll->_sl += saldo.saldo(); - } - // aggiorno il totale generale - TAssoc_array& at = (TAssoc_array&) _t[1]; - TLineTotal *lt = (TLineTotal *) at.objptr(_codval); - if (lt == NULL) - { - lt = new TLineTotal; - at.add(_codval, lt); - } - lt->_sl += ll->_sl; -} - -bool TProspettoScadenze::preprocess_page(int file, int counter) -{ - if (file == LF_PARTITE) - { - const TRectype& curr = current_cursor()->curr(file); - - TBill bill(curr); - const bool checked = _m->selected(bill); - - if (!checked && !_end_printed) // Se non e' stato selezionato salta al prossimo record - return false; - -// int nriga = 1; - if (_tipost == clienti || _tipost == fornitori) - { - const TRectype& clifo = current_cursor()->curr(LF_CLIFO); - _des = clifo.get(CLI_RAGSOC); - _cod = clifo.get(CLI_CODCF); - } - else - { - const TRectype& pcon = current_cursor()->curr(LF_PCON); - _des = pcon.get(PCN_DESCR); - _cod = pcon.get(PCN_GRUPPO); - _cod << " " << pcon.get(PCN_CONTO); - _cod << " " << pcon.get(PCN_SOTTOCONTO); - } - - if (_cod != _cod_pre || _end_printed) // Controlla se e' cambiato il codice cli/fo/conto - { - reset_print(); - if (((TAssoc_array&) _t[0]).items() > 0) - print_totali(1); - _des.trim(); - _cod_pre = _cod; - _des_pre = _des; - } - - if (!curr.empty()) - { - TPartita p(curr); - - //Pesca gli estremi dalla prima riga di fattura, che non e' necessariamente la riga #1 - const int r = p.prima_fattura(); - - if (r > 0) //Skip next partita if no fatture! - { - TRiga_partite& rp = p.riga(r); - _anno = rp.get(PART_ANNO); - _anno.ltrim(2); - _numdoc = rp.get(PART_NUMDOC); - _protiva = rp.get(PART_PROTIVA); - _datadoc = (const char*) rp.get_date(PART_DATADOC); - _codval = (_stvaluta ? rp.get(PART_CODVAL): ""); - if (_codval.empty()) _codval = " "; - // Now performing fulkrum... - compute_all(p, bill); - } - current_cursor()->repos(); // Very, very necessary... - } - } - return true; -} - -bool TProspettoScadenze::preprocess_print(int file, int counter) -{ - return true; -} - -print_action TProspettoScadenze::postprocess_print(int file, int counter) -{ - print_action rt = NEXT_PAGE; - if (!_end_printed) - { - if ((file == LF_PARTITE)) - { - rt = REPEAT_PAGE; - _end_printed = true; - } - } - else - { - if (((TAssoc_array&) _t[0]).items() > 0) - { - print_totali(1); - print_one(0); - } - if (((TAssoc_array&) _t[1]).items() > 0) - { - print_totali_rows(1,1); - print_one(0); - } - } - return rt; -} - -void TProspettoScadenze::postclose_print() -{ - if (_excel) - { - export_grouped_rows(); - TFilename slk; slk.tempdir(); slk.add("prosscad.slk"); - _recset->save_as(slk, fmt_silk); - xvt_sys_goto_url(slk, "open"); - delete _recset; - _recset = NULL; - } -} - -print_action TProspettoScadenze::postprocess_page(int file, int counter) -{ - return NEXT_PAGE; -} - -bool TProspettoScadenze::user_create() -{ - _rel1 = new TRelation(LF_PARTITE); - _rel1->add(LF_CLIFO,"TIPOCF=TIPOC|CODCF=SOTTOCONTO",1); - _cur1 = add_cursor(new TCursor(_rel1)); - _cur2 = add_cursor(new TSorted_cursor(_rel1,"UPPER(20->RAGSOC)||NUMPART","",1)); - - _rel2 = new TRelation(LF_PARTITE); - _rel2->add(LF_PCON,"GRUPPO=GRUPPO|CONTO=CONTO|SOTTOCONTO=SOTTOCONTO",1); - _cur3 = add_cursor(new TCursor(_rel2)); - _cur4 = add_cursor(new TSorted_cursor(_rel2,"UPPER(19->DESCR)|ANNO|NUMPART","",1)); - - _scad = new TLocalisamfile(LF_SCADENZE); - _pagsca = new TLocalisamfile(LF_PAGSCA); - _t.add(new TAssoc_array);_t.add(new TAssoc_array); - - TConfig conf (CONFIG_DITTA,"cg"); - _m = new TSelection_ext_mask("ps0001200"); - _m->enable(F_VALUTA,conf.get_bool("GesVal")); - - enable_print_menu(); - return true; -} - -bool TProspettoScadenze::user_destroy() -{ - if (_rel1) delete _rel1; - if (_rel2) delete _rel2; - if (_scad) delete _scad; - if (_pagsca) delete _pagsca; - if (_m) delete _m; - _t.destroy(); - return true; -} - -void TProspettoScadenze::riempi_conti_mastro(const char cf) -{ - _conti_cf.destroy(); - TRelation rel = TRelation(LF_PCON); - TString80 filtro; - filtro.format("TMCF==\'%c\'", cf); - TCursor cur(&rel, filtro); - TToken_string gc(10); - for (cur=0; cur.pos() < cur.items(); ++cur) - { - const int g = cur.curr().get_int(PCN_GRUPPO); - const int c = cur.curr().get_int(PCN_CONTO); - gc.add(g,0); - gc.add(c,1); - _conti_cf.add(gc); - } -} - -bool TProspettoScadenze::set_print(int) -{ - KEY k = _m->run(); - _excel = k != K_ENTER; - if (k != K_QUIT) - { - reset_files(); - reset_print(); - printer().footerlen(5); - if (_m->get_who() == 'C') - _tipost = clienti; - else - _tipost = fornitori; - riempi_conti_mastro(_m->get_who()); - if (_m->get_key() == 1) - _ordcod = true; - else - _ordcod = false; - _end_printed = false; - _gcr = _m->get_int(F_GIORNI); - _stvaluta = _m->get_bool(F_VALUTA); - _datas = (const char *)(_m->get(F_DATASTAMPA)); - _limop = (const char *)(_m->get(F_DATAOPERAZIONE)); - _limscad = (const char *)(_m->get(F_DATASCADUTO)); - _limbf = _limscad - (long)_gcr; // Limite inferiore per le scadenze a Buon Fine. - _sinfasce = _m->get_bool(F_SCADINFASCE); - _sfasce = _m->get_int(F_SCADFASCE); - _nsinfasce = _m->get_bool(F_ASCADINFASCE); - _nsfasce = _m->get_int(F_ASCADFASCE); - _s_date.destroy(); - _ns_date.destroy(); - for (int i = 0; i <= NUMERO_FASCE; i++) - { - _s_date.add(new TDate); - _ns_date.add(new TDate); - } - int limiti[NUMERO_FASCE + 1] = LIMITI; - for (int j = 0; j <= _sfasce; j++) - (TDate &)_s_date[j] = _limscad - (const long) limiti[j]; - for (int k = 0; k <= _nsfasce; k++) - (TDate &)_ns_date[k] = _limscad + (const long) limiti[k]; - _anno.cut(0);_numdoc.cut(0);_protiva.cut(0);_datadoc.cut(0); - _codval.cut(0);_cod.cut(0); _des.cut(0); _cod_pre.cut(0); - for (int it=0; it < _t.items(); it++) - { - TAssoc_array& aa = (TAssoc_array&) _t[it]; - aa.destroy(); // Totali lineari (singolo e generale) - } - - get_cursor(_cur1)->set_filterfunction(fil_function,true); - get_cursor(_cur2)->set_filterfunction(fil_function,true); - get_cursor(_cur3)->set_filterfunction(fil_function,true); - get_cursor(_cur4)->set_filterfunction(fil_function,true); - _last_game.cut(0); - - TRectype filter_from(LF_PARTITE), filter_to(LF_PARTITE); - - switch (_tipost) - { - case clienti: - case fornitori: - filter_from.put("TIPOC", _tipost == clienti ? "C" : "F"); - filter_to = filter_from; - if (_ordcod) // Per codice... - { - select_cursor(_cur1); - get_cursor(_cur1)->setregion(filter_from, filter_to); - } - else // ... e ragione sociale - { - select_cursor(_cur2); - get_cursor(_cur2)->setregion(filter_from, filter_to); - } - add_file(LF_PARTITE); - add_file(LF_CLIFO,LF_PARTITE); - break; - default: break; - } // End of inner switch - if (_excel) - { - _colnames.destroy(); - if (_sinfasce) - { - for (int i = 1; i <= _sfasce; i++) - _colnames.add(format("Scaduto <= %3d gg", limiti[i])); - _colnames.add(format("Scaduto > %3d gg", limiti[_sfasce])); - } - else - _colnames.add("Scaduto"); - if (_nsinfasce) - { - for (int i = 1; i <= _nsfasce; i++) - _colnames.add(format("A Scadere <= %3d gg", limiti[i])); - _colnames.add(format("A Scadere > %3d gg", limiti[_nsfasce])); - } - else - _colnames.add("A Scadere"); - _recset = new TPRSC_recordset(_colnames); - } - return true; - } // End if - return false; -} - -void TProspettoScadenze::print_totali_rows(int nriga, bool what) -// If what is 0 prints single total... else prints also general total -{ - reset_print(); - TAssoc_array& xassoc = (TAssoc_array&) _t[what]; - if (_cod_pre.blank()) - { - xassoc.destroy(); - return; - } - TString_array as; - const int items = xassoc.items(); - - xassoc.get_keys(as); - as.sort(); - for (int i=0; i < items; i++) - { - if (!what && !_excel) - calcola_saldo(); - - TString k(as.row(i)); // Chiave di ordinamento(valuta) - TString value; - TLineTotal& v = (TLineTotal&)xassoc[k]; - real tot = ZERO; - int pos = 40; - TString rw(255); - - rw = ""; - if (_sinfasce) - { - for (int i = 0; i <= _sfasce; i++) - { - if (v._s[i] != ZERO) - { - print_real(value, v._s[i]); - rw << format("@%dg%11s", pos, (const char*) value); - tot += v._s[i]; - } - pos += 11; - } - } - else - { - if (v._s[0] != ZERO) - { - print_real(value, v._s[0]); - rw << format("@%dg%11s", pos, (const char*) value); - tot += v._s[0]; - } - pos += 11; - } - - if (_nsinfasce) - { - for (int i = 0; i <= _nsfasce; i++) - { - if (v._ns[i] != ZERO) - { - print_real(value, v._ns[i]); - rw << format("@%dg%11s", pos, (const char*) value); - tot += v._ns[i]; - } - pos += 11; - } - } - else - { - if (v._ns[0] != ZERO) - { - print_real(value, v._ns[0]); - rw << format("@%dg%11s", pos, (const char*) value); - tot += v._ns[0]; - } - pos += 11; - } - - if (tot != ZERO) - { - print_real(value, tot); - rw << format("@%dg%11s", pos, (const char*) value); - } - pos += 11; - if (v._es != ZERO) - { - print_real(value, v._es); - rw << format("@%dg%11s", pos, (const char*) value); - } - pos += 11; - if (v._sl != ZERO) - { - print_real(value, v._sl); - rw << format("@%dg%11s", pos, (const char*) value); - } - pos += 11; - - const real diff = v._sl - (tot - v._es); - if (diff != ZERO) - { - print_real(value, diff); - rw << format("@%dg%11s", pos, (const char*) value); - } - - if (rw.not_empty()) - { - if (!what) - { - TString s = _des_pre.left(25); - rw.insert(format("%6s@8g%-25s", (const char*) _cod_pre, (const char*) s)); - } - else - { - TString meno; - const int last_column = calc_last_column(); - - meno.fill('-', last_column); - set_row(nriga++, meno); - rw.insert("@8gTOTALE GENERALE"); - } - set_row(nriga, rw); - } - } - xassoc.destroy(); // Distrugge il totale appena stampato -} - - -void TProspettoScadenze::export_totali_rows() -// If what is 0 prints single total... else prints also general total -{ - if (_cod_pre.blank()) - return; - TAssoc_array& xassoc = (TAssoc_array&) _t[0]; - TString_array as; - const int items = xassoc.items(); - - xassoc.get_keys(as); - as.sort(); - for (int i=0; i < items; i++) - { - TVariant var(_cod_pre); - TString k(as.row(i)); // Chiave di ordinamento(valuta) - TLineTotal& v = (TLineTotal&)xassoc[k]; - - calcola_saldo(); - - real t1; - real t2; - for (int j = NUMERO_FASCE; j >= 0; j--) - t1 += v._s[j]; - for (int jj = 0; jj <= NUMERO_FASCE; jj++) - t2 += v._ns[jj]; - if (t1 == ZERO && t2 == ZERO && v._es == ZERO && v._sl == ZERO) - continue; - TString key; - - key << (_tipost == clienti ? "C|" : "F") << _cod_pre; - - const TRectype & rec = cache().get(LF_CLIFO, key); - const int gruppo = rec.get_int(CLI_GRUPPORIC); - const int conto = rec.get_int(CLI_CONTORIC); - const long sottoconto = rec.get_long(CLI_SOTTOCRIC); - - if (gruppo == 9 && conto == 1 && sottoconto < 13) - { - TLineTotal * rt = (TLineTotal *) _ragg_tot.objptr(sottoconto - 1); - - if (rt == NULL) - { - rt = new TLineTotal; - _ragg_tot.add(rt, sottoconto - 1); - } - - int j; - - for (j = 0; j < NUMERO_FASCE; j++) - rt->_s[j] += v._s[j]; - for (j = 0; j < NUMERO_FASCE; j++) - rt->_ns[j] += v._ns[j]; - rt->_sl += v._sl; - rt->_es += v._es; - continue; - } - - - - _recset->new_rec(); - var = _cod_pre; - _recset->set("Cliente", var); - var = _des_pre; - _recset->set("RagioneSociale", var); - var = k; - _recset->set("Valuta", var); - int col = 0; - real tot = ZERO; - - if (_sinfasce) - { - for (int i = 0; i <= _sfasce; i++) - { - _recset->set(_colnames.row(col++), v._s[i]); - tot += v._s[i]; - } - } - else - { - _recset->set(_colnames.row(col++), v._s[0]); - tot += v._s[0]; - } - - if (_nsinfasce) - { - for (int i = 0; i <= _nsfasce; i++) - { - _recset->set(_colnames.row(col++), v._ns[i]); - tot += v._ns[i]; - } - } - else - { - _recset->set(_colnames.row(col++), v._ns[0]); - tot += v._ns[0]; - col++; - } - - const real diff = v._sl - (tot - v._es); - - _recset->set("Totale", tot); - _recset->set("Esposto", v._es); - _recset->set("Saldo", v._sl); - _recset->set("Differenza", diff); - } -} - -void TProspettoScadenze::export_grouped_rows() -// If what is 0 prints single total... else prints also general total -{ - for (int i = 0; i < 12; i++) - { - TLineTotal * rt = (TLineTotal *) _ragg_tot.objptr(i); - - if (rt != NULL) - { - const int sottoconto = i + 1; - TLineTotal& v = * rt; - TVariant var; - - _recset->new_rec(); - TString code; - code.format("RAGG%06d", sottoconto); - var = code; - _recset->set("Cliente", var); - - switch (sottoconto) - { - case 1: - var = "Clienti ASL"; - break; - case 2: - var = "Clienti Delegazioni"; - break; - case 3: - var = "Clienti Convenzione Diverse"; - break; - case 4: - var = "Clienti Convenzione Fase"; - break; - case 5: - var = "Clienti Privati"; - break; - case 6: - var = "Clienti Convenzione CASPIE"; - break; - case 7: - var = "Clienti Convenzione FISDE"; - break; - case 8: - var = "Clienti Convenzione SANICARD"; - break; - case 9: - var = "Clienti Convenzione BLUE ASSISTANCE"; - break; - case 10: - var = "Clienti Convenzione UNISALUTE"; - break; - case 11: - var = "Clienti Convenzione FASDAC"; - break; - case 12: - var = "Clienti Convenzione ASSIRETE"; - break; - default: - var = ""; - break; - } - _recset->set("RagioneSociale", var); - _recset->set("Valuta", ""); - int col = 0; - real tot = ZERO; - - if (_sinfasce) - { - for (int i = 0; i <= _sfasce; i++) - { - _recset->set(_colnames.row(col++), v._s[i]); - tot += v._s[i]; - } - } - else - { - _recset->set(_colnames.row(col++), v._s[0]); - tot += v._s[0]; - } - - if (_nsinfasce) - { - for (int i = 0; i <= _nsfasce; i++) - { - _recset->set(_colnames.row(col++), v._ns[i]); - tot += v._ns[i]; - } - } - else - { - _recset->set(_colnames.row(col++), v._ns[0]); - tot += v._ns[0]; - col++; - } - - const real diff = v._sl - (tot - v._es); - - _recset->set("Totale", tot); - _recset->set("Esposto", v._es); - _recset->set("Saldo", v._sl); - _recset->set("Differenza", diff); - } - } -} - -void TProspettoScadenze::print_totali(int nriga) -{ - reset_row(nriga); - if (_excel) - export_totali_rows(); - print_totali_rows(nriga,0); -} - -void TProspettoScadenze::print_header() -// Setta le righe dell'intestazione -{ - int soh = 1; - const int last_column = calc_last_column(); - const long firm = get_firm(); - TString rw(last_column); - TString meno(last_column); - - reset_header (); - TLocalisamfile ditte(LF_NDITTE); - ditte.zero(); - ditte.put(NDT_CODDITTA, firm); - ditte.read(); - if (ditte.bad()) ditte.zero(); - - TString s; - s = ditte.get(NDT_RAGSOC); - TString datas = _datas.string(); - TString limop = _limop.string(); - TString limscad = _limscad.string(); - - set_header (soh++, "Ditta : %ld %s@%ldgData %s @%ldgPag. @#", - firm, (const char *)s, last_column - 30, (const char *)datas, last_column - 10); - - switch (_tipost) - { - case fornitori: - case clienti: - { - TString s1,s2, s3, lim; - int o = 0; // Offset per scaglioni. - - - if (_tipost==fornitori) - set_header(soh++,"@%ldg** PREVISIONE PAGAMENTI FORNITORI **", (last_column - 37) / 2); - else - set_header(soh++,"@%ldg** PREVISIONE INCASSI CLIENTI **", (last_column - 34) / 2); - set_header (soh++,"@%ldgAl %s - Operazioni al %s", (last_column - 40) / 2, (const char*)limscad, (const char*)limop); - meno.fill('-', last_column); - set_header(soh++,(const char *)meno); - set_header(soh,"CODICE@8gC O G N O M E E N O M E "); - int limiti[NUMERO_FASCE + 1] = LIMITI; - int pos = 40; - - rw.cut(0); - if (_sinfasce) - { - for (int i = 1; i <= _sfasce; i++) - { - rw << format("@%dg <= %3d gg", pos, limiti[i] ); - pos += 11; - } - rw << format("@%dg >%3d gg", pos, limiti[_sfasce]); - pos += 11; - set_header(soh, format("@%dg%s", 40+((pos-40)/2), "SCADUTO")); - } - else - { - set_header(soh, format("@%dg%11s", pos, "SCADUTO")); - pos += 11; - } - - const int pos_ascad = pos; - if (_nsinfasce) - { - for (int i = 1; i <= _nsfasce; i++) - { - rw << format("@%dg <= %3d gg", pos, limiti[i]); - pos = pos + 11; - } - rw << format("@%dg >%3d gg", pos, limiti[_nsfasce]); - pos = pos + 11; - set_header(soh, format("@%dg%s", pos_ascad+((pos-pos_ascad)/2)-5, "A SCADERE")); - } - else - { - set_header(soh, format("@%dg%11s", pos, "A SCADERE")); - pos += 11; - } - set_header(soh, format("@%dg%11s", pos, "TOTALE")); - pos += 11; - set_header(soh, format("@%dg%11s", pos, "ESPOSTO")); - pos += 11; - set_header(soh, format("@%dg%11s", pos, "SALDO")); - pos += 11; - set_header(soh, format("@%dg%11s", pos, " DIFFERENZA")); - set_header(++soh,(const char *)rw); - break; - } - default: - break; - } - set_header(++soh, (const char *) meno); -} - -void TProspettoScadenze::preprocess_footer() -{ -} - -int TProspettoScadenze::calc_last_column() -// Setta le righe dell'intestazione -{ - int pos = 110; - - if (_sinfasce) - pos += _sfasce * 11; - else - pos += 11; - if (_nsinfasce) - pos = pos + _nsfasce * 11; - else - pos += 11; - return pos; -} - -void TProspettoScadenze::set_page(int file, int counter) -{ - print_header(); -} - -TProspettoScadenze::TProspettoScadenze() -{ - _rel1 = _rel2 = NULL; -} - -int ps0001200(int argc, char** argv) -{ - TProspettoScadenze app; - app.run(argc, argv, "Stampa Previsione Incassi/Pagamenti"); - return 0; -} diff --git a/ps/ps0001200.h b/ps/ps0001200.h deleted file mode 100755 index 91c3e2a82..000000000 --- a/ps/ps0001200.h +++ /dev/null @@ -1,13 +0,0 @@ -#include "../sc/scselmsk.h" - -#define F_CODDITTA 101 -#define F_RAGSOC 102 -#define F_DATASTAMPA 103 -#define F_DATAOPERAZIONE 104 -#define F_DATASCADUTO 105 -#define F_GIORNI 106 -#define F_VALUTA 107 -#define F_SCADINFASCE 201 -#define F_SCADFASCE 202 -#define F_ASCADINFASCE 203 -#define F_ASCADFASCE 204 diff --git a/ps/ps0001200.uml b/ps/ps0001200.uml deleted file mode 100755 index 9213286ad..000000000 --- a/ps/ps0001200.uml +++ /dev/null @@ -1,240 +0,0 @@ -#include "ps0001200.h" - -PAGE "Stampa Previsione Incassi/Pagamenti Salus" -1 -1 78 20 - -NUMBER F_CODDITTA 5 -BEGIN - PROMPT 2 1 "Cod. " - FLAGS "DFR" - USE LF_NDITTE - INPUT CODDITTA F_CODDITTA - OUTPUT F_RAGSOC RAGSOC - CHECKTYPE REQUIRED -END - -STRING F_RAGSOC 50 46 -BEGIN - PROMPT 14 1 "R.S. " - FLAGS "D" -END - -GROUPBOX DLG_NULL 68 7 -BEGIN - PROMPT 1 2 "" -END - -DATE F_DATASTAMPA -BEGIN - PROMPT 2 3 "Data di stampa " - HELP "Data di stampa" - CHECKTYPE REQUIRED - WARNING "Si deve specificare la data di stampa" - FLAGS "A" -END - -DATE F_DATAOPERAZIONE -BEGIN - PROMPT 2 4 "Data limite operazione " - HELP "Data limite operazione" - CHECKTYPE REQUIRED - FLAGS "A" -END - -DATE F_DATASCADUTO -BEGIN - PROMPT 2 5 "Data limite scaduto " - HELP "Data limite scaduto" - CHECKTYPE REQUIRED - WARNING "Data limite scaduto non valida" -END - -NUMBER F_GIORNI 3 -BEGIN - PROMPT 2 6 "Giorni per calcolo rischio " - HELP "Inserire il numero di giorni per il calcolo del rischio" -END - -BOOLEAN F_VALUTA -BEGIN - PROMPT 2 7 "Stampa in valuta" - HELP "Selezionare se si vuole la stampa in valuta" -END - -RADIOBUTTON SC_CLIFO 20 -BEGIN - PROMPT 1 9 "Selezione" - ITEM "C|Clienti" MESSAGE ENABLE, F_GIORNI|K_SPACE,SC_SORTCF - ITEM "F|Fornitori" MESSAGE DISABLE, F_GIORNI|K_SPACE,SC_SORTCF - //ITEM "P|Conti" MESSAGE DISABLE, F_GIORNI|K_SPACE,SC_SORTCF -END - -RADIOBUTTON SC_SORTCF 29 -BEGIN - GROUP 1 - PROMPT 23 9 "Ordinamento" - ITEM "1|Per codice/conto" - ITEM "2|Per rag.soc./descrizione" -END - -BUTTON SC_SELECT 10 1 -BEGIN - PROMPT 55 10 "S~elezione" -END - -BUTTON SC_RESET 10 1 -BEGIN - PROMPT 55 11 "A~zzera" -END - -NUMBER SC_CFCODFR 6 -BEGIN - PROMPT 2 14 "Da codice " - FLAGS "B" - GROUP 3 -END - -NUMBER SC_CFCODTO 6 -BEGIN - PROMPT 37 14 "a codice " - FLAGS "B" - GROUP 3 -END - -STRING SC_CFDESFR 50 40 -BEGIN - PROMPT 2 14 "Da ragione sociale " - GROUP 4 - FLAGS "HB" -END - -STRING SC_CFDESTO 50 40 -BEGIN - PROMPT 2 15 "A ragione sociale " - GROUP 4 - FLAGS "HB" -END - -NUMBER SC_PCONCODFR1 3 -BEGIN - PROMPT 2 14 "Da conto " - GROUP 5 -END - -NUMBER SC_PCONCODFR2 3 -BEGIN - PROMPT 15 14 "" - GROUP 5 -END - -NUMBER SC_PCONCODFR3 6 -BEGIN - PROMPT 19 14 "" - FLAGS "B" - GROUP 5 -END - -NUMBER SC_PCONCODTO1 3 -BEGIN - PROMPT 31 14 "a conto " - GROUP 5 -END - -NUMBER SC_PCONCODTO2 3 -BEGIN - PROMPT 43 14 "" - GROUP 5 -END - -NUMBER SC_PCONCODTO3 6 -BEGIN - PROMPT 47 14 "" - FLAGS "B" - GROUP 5 -END - -STRING SC_PCONDESFR 50 40 -BEGIN - PROMPT 2 14 "Da descrizione " - GROUP 6 - FLAGS "HB" -END - -STRING SC_PCONDESTO 50 40 -BEGIN - PROMPT 2 15 "A descrizione " - GROUP 6 - FLAGS "HB" -END - -NUMBER SC_NSEL 3 -BEGIN - PROMPT 60 13 "N. " - FLAGS "D" -END - -BOOLEAN F_SCADINFASCE -BEGIN - PROMPT 2 16 "Scaduto suddiviso in fasce" - HELP "Selezionare se si vuole la stampa scaduto suddiviso in fasce" - MESSAGE TRUE ENABLE,F_SCADFASCE - MESSAGE FALSE RESET,F_SCADFASCE|DISABLE,F_SCADFASCE -END - -LISTBOX F_SCADFASCE 3 -BEGIN - PROMPT 35 16 "Fino alla fascia " - ITEM "0|0" - ITEM "1|30" - ITEM "2|60" - ITEM "3|90" - ITEM "4|120" - ITEM "5|150" - ITEM "6|180" - ITEM "7|210" - ITEM "8|240" -END - -BOOLEAN F_ASCADINFASCE -BEGIN - PROMPT 2 17 "A scadere suddiviso in fasce" - HELP "Selezionare se si vuole la stampa a scadere suddiviso in fasce" - MESSAGE TRUE ENABLE,F_ASCADFASCE - MESSAGE FALSE RESET,F_ASCADFASCE|DISABLE,F_ASCADFASCE -END - -LISTBOX F_ASCADFASCE 3 -BEGIN - PROMPT 35 17 "Fino alla fascia " - ITEM "0|0" - ITEM "1|30" - ITEM "2|60" - ITEM "3|90" - ITEM "4|120" - ITEM "5|150" - ITEM "6|180" - ITEM "7|210" - ITEM "8|240" - NUM_EXPR {#F_SCADFASCE+#F_ASCADFASCE < 10} - WARNING "E' possibile selezionare massimo 9 fasce in totale" -END - -BUTTON DLG_PRINT 10 2 -BEGIN - PROMPT -13 -1 "" - MESSAGE EXIT,K_ENTER -END - -BUTTON DLG_EDIT 10 2 -BEGIN - PROMPT -23 -1 "" - PICTURE BMP_EDIT - MESSAGE EXIT,69 -END - -BUTTON DLG_QUIT 10 2 -BEGIN - PROMPT -33 -1 "" -END - -ENDPAGE -ENDMASK diff --git a/ps/ps0001300.cpp b/ps/ps0001300.cpp deleted file mode 100755 index 9dc09af35..000000000 --- a/ps/ps0001300.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include - -#include "ps0001.h" -#include "ps0001300.h" - -class TSispac_multirel_app : public TMultirel_application -{ - -protected: - virtual void set_descr(TMask & m, const TString & desc); - virtual void get_mask_name(TString& tabname) const; - //magico metodo per impedire la navigazione su tabelle diverse da quella corrente del cursore - virtual bool has_filtered_cursor() const { return true; } - virtual bool user_create(); - virtual void init_query_mode(TMask& m); - virtual void init_query_insert_mode(TMask& m); - -public: - - TSispac_multirel_app() {} - virtual ~TSispac_multirel_app() {} -}; - -void TSispac_multirel_app::set_descr(TMask & m, const TString & desc) -{ - m.set(F_DESC, desc); -} - -void TSispac_multirel_app::get_mask_name(TString& tabname) const -{ - TMultirel_application::get_mask_name(tabname); - tabname.overwrite("dv", 2); -} - -void TSispac_multirel_app::init_query_mode(TMask& m) -{ - TMultirel_application::init_query_mode(m); - m.show(-1); - m.hide(-2); -} - -void TSispac_multirel_app::init_query_insert_mode(TMask& m) -{ - TMultirel_application::init_query_insert_mode(m); - m.hide(-1); - m.show(-2); -} - -bool TSispac_multirel_app::user_create() -{ - bool ok = TMultirel_application::user_create(); - - if (ok) - { - TMask & m = *get_mask(); - - set_search_field(F_CODTAB); - } - return ok; -} -int ps0001300(int argc, char* argv[]) -{ - TSispac_multirel_app a; - a.run(argc, argv, TR("Tabella")); - return 0; -} diff --git a/ps/ps0001300.h b/ps/ps0001300.h deleted file mode 100755 index 5bdb7a5e8..000000000 --- a/ps/ps0001300.h +++ /dev/null @@ -1,5 +0,0 @@ -#define F_COD 101 -#define F_CODTAB 102 -#define F_DESC 103 -#define F_COD_CAMPO 104 -#define F_CODTAB1 105