Beispiel #1
0
        bool leggiRecordDiCoda(TextReader tr, DataRow row)
        {
            int       tipoRecord = import.leggiNumerico(tr, 2);
            Hashtable r          = new Hashtable();

            //			r["TIPORECORD"] = tipoRecord;//NUMERICO		 2		 1
            /*r["PROGRESSIVODIFLUSSO1"] =*/
            import.leggiNumerico(tr, 5);                                  //	NUMERICO		 5		 2 PROGRESSIVO DEL RECORD ALL’INTERNO DEL FLUSSO
            r["TIPOFLUSSO"]           = import.leggiNumerico(tr, 3);      //NUMERICO		 3		 3 INDICA LA TIPOLOGIA DEL FLUSSO IN TRASMISSIONE:      011    GIORNALE DI CASSA
            r["DATAPRODUZIONEFLUSSO"] = import.leggiDataAMG(tr, 8);       //NUMERICO		 8		 4 ESPRESSO NEL FORMATO DATA   AAAAMMGG
            r["PROGRESSIVOPERDATA"]   = import.leggiNumerico(tr, 1);      //NUMERICO		 1		 5 UTILIZZATO IN CASO DI PIU’ FLUSSI INVIATI NELLA STESSA DATA ( PRIMO INVIO = 0 )
            r["CODICEFILIALE"]        = import.leggiNumerico(tr, 5);      //NUMERICO		 5		 6 CODICE DELLA FILIALE CHE EFFETTUA IL  SERVIZIO DI TESORERIA
            r["CODICEENTE"]           = import.leggiNumerico(tr, 3);      //NUMERICO		 3		 7 CODICE DELL’ENTE FORNITO DALLA DIPENDENZA CHE EFFETTUA IL SERVIZIO DI TESORERIA
            r["ANAGRAFICAENTE"]       = import.leggiAlfanumerico(tr, 35); //CARATTERE		35
            r["ESERCIZIOFINANZIARIO"] = import.leggiNumerico(tr, 4);      //(AAAA)			NUMERICO		 4
            r["DATADIRIFERIMENTO"]    = import.leggiDataAMG(tr, 8);       //NUMERICO		 8		 8 GIORNATA A CUI SI RIFERISCONO LE INFORMAZIONI CONTENUTE NEL FLUSSO (AAAAMMGG)
            r["DIVISA"]  = import.leggiAlfanumerico(tr, 1);               //CARATTERE		 1		 9
            r["FILLER1"] = import.leggiAlfanumerico(tr, 175);             //CARATTERE	         175
            if (tipoRecord != 99)
            {
                QueryCreator.ShowError(this, "Mi aspettavo il record 1 invece ho ricevuto il record " + tipoRecord, "");
                return(false);
            }
            foreach (DictionaryEntry de in r)
            {
                if (!row[(string)de.Key].Equals(de.Value))
                {
                    QueryCreator.ShowError(this, "Errore durante la lettura del file",
                                           "Differenze nella colonna " + de.Key
                                           + "\r\nrecord 01: " + row[(string)de.Key]
                                           + "\r\nrecord 99: " + de.Value);
                }
            }
            return(import.vaiACapo(tr));
        }
Beispiel #2
0
        public override DataTable getInfoReversali(object esercDocIncasso, object numDocIncasso)
        {
            string query = "SELECT e.ymov as ypro, el.kpro, p.npro, el.idpro, PRODOC = el.idpro, TPAGTS='', CODABI=0, CODCAB=0, CONTO='', CIN='', NUMQUI=el.nbill,"
                           + "ANABE=ISNULL(c.title,''), "
                           + "CFISC=CASE WHEN ctc.flaghuman = 'S' AND cf IS NOT NULL THEN c.cf WHEN ctc.flaghuman = 'S' AND c.cf IS NULL THEN REPLICATE('9',16) ELSE '' END, "
                           + "CAUSALE=CASE WHEN (SELECT COUNT(*) FROM income e1 join incomelast el1 ON e1.idinc=el1.idinc"
                           + " WHERE e1.ymov = e.ymov AND el1.kpro = el.kpro "
                           + " AND el1.idpro = el.idpro) > 1 THEN 'ACCORPAMENTO INCASSI' ELSE "
                           + " ISNULL(e.doc,'') + ISNULL(CONVERT(varchar(12),e.docdate),'') + ISNULL(e.description,'') END "
                           + " FROM income e "
                           + " JOIN incomelast el on e.idinc=el.idinc "
                           + " JOIN proceeds p ON p.kpro = el.kpro "
                           + "JOIN registry c ON c.idreg = e.idreg "
                           + "JOIN registryclass ctc ON ctc.idregistryclass = c.idregistryclass "
                           + "WHERE p.ypro = " + esercDocIncasso
                           + " AND p.npro = " + numDocIncasso
                           + " AND el.idpro is not null";
            string    errMsg;
            DataTable tInfo = Conn.SQLRunner(query, -1, out errMsg);

            if (tInfo == null)
            {
                QueryCreator.ShowError(form, "Errore durante l'esecuzione della query:\r\n" + query, errMsg);
            }
            return(tInfo);
        }
Beispiel #3
0
        bool leggiEF07RecordBeneficiario(TextReader tr, DataRow r)
        {
            int    ISTTS  = leggiNumerico(tr, 5);     //	Codice istituto
            int    CODEN  = leggiNumerico(tr, 7);     //	Codice ente
            int    ESERC  = leggiNumerico(tr, 4);     //	Anno esercizio
            string TIPREC = leggiAlfanumerico(tr, 2); //	Tipo record

            r["TIPDOC"] = leggiAlfanumerico(tr, 1);   //	Tipo documento
            r["NUMDOC"] = leggiAlfanumerico(tr, 7);   //	Numero documento
            r["PRODOC"] = leggiAlfanumerico(tr, 7);   //	Progressivo documento
            r["ANABE"]  = leggiAlfanumerico(tr, 300); //	Anagrafica beneficiario
            r["INDIR"]  = leggiAlfanumerico(tr, 30);  //	Indirizzo beneficiario
            r["CAP"]    = leggiAlfanumerico(tr, 5);   //	CAP beneficiario
            r["LOC"]    = leggiAlfanumerico(tr, 30);  //	Località beneficiario
            r["CFISC"]  = leggiAlfanumerico(tr, 16);  //	Codice fiscale beneficiario
            r["FILLER"] = leggiAlfanumerico(tr, 86);  //	Campo a disposizione
            if (TIPREC != "03")
            {
                QueryCreator.ShowError(null, "Mi aspettavo il record 03 invece ho ricevuto il record " + TIPREC, "");
                return(false);
            }
            if (!ISTTS.Equals(r["ISTTS"]) || !CODEN.Equals(r["CODEN"]) || !ESERC.Equals(r["ESERC"]))
            {
                QueryCreator.ShowError(null, "Errore nell'intestazione del record 03", "");
                return(false);
            }
            return(vaiACapo(tr));
        }
Beispiel #4
0
        /// <summary>
        ///     01 - RECORD IDENTIFICATIVO DI FLUSSO
        /// </summary>
        /// <param name="tr"></param>
        /// <param name="r"></param>
        /// <returns></returns>
        bool leggiRecordDiTesta(TextReader tr, DataRow r)
        {
            int tipoRecord = import.leggiNumerico(tr, 2);

            r["TIPORECORD1"]          = tipoRecord;                  //NUMERICO		 2		 1
            r["PROGRESSIVODIFLUSSO1"] = import.leggiNumerico(tr, 5); //	NUMERICO		 5		 2 PROGRESSIVO DEL RECORD ALL’INTERNO DEL FLUSSO
            int tipoFlusso = import.leggiNumerico(tr, 3);

            r["TIPOFLUSSO"]           = tipoFlusso;                       //NUMERICO		 3		 3 INDICA LA TIPOLOGIA DEL FLUSSO IN TRASMISSIONE:      011    GIORNALE DI CASSA
            r["DATAPRODUZIONEFLUSSO"] = import.leggiDataAMG(tr, 8);       //NUMERICO		 8		 4 ESPRESSO NEL FORMATO DATA   AAAAMMGG
            r["PROGRESSIVOPERDATA"]   = import.leggiNumerico(tr, 1);      //NUMERICO		 1		 5 UTILIZZATO IN CASO DI PIU’ FLUSSI INVIATI NELLA STESSA DATA ( PRIMO INVIO = 0 )
            r["CODICEFILIALE"]        = import.leggiNumerico(tr, 5);      //NUMERICO		 5		 6 CODICE DELLA FILIALE CHE EFFETTUA IL  SERVIZIO DI TESORERIA
            r["CODICEENTE"]           = import.leggiNumerico(tr, 3);      //NUMERICO		 3		 7 CODICE DELL’ENTE FORNITO DALLA DIPENDENZA CHE EFFETTUA IL SERVIZIO DI TESORERIA
            r["ANAGRAFICAENTE"]       = import.leggiAlfanumerico(tr, 35); //CARATTERE		35
            r["ESERCIZIOFINANZIARIO"] = import.leggiNumerico(tr, 4);      //(AAAA)			NUMERICO		 4
            r["DATADIRIFERIMENTO"]    = import.leggiDataAMG(tr, 8);       //NUMERICO		 8		 8 GIORNATA A CUI SI RIFERISCONO LE INFORMAZIONI CONTENUTE NEL FLUSSO (AAAAMMGG)
            r["DIVISA"]  = import.leggiAlfanumerico(tr, 1);               //CARATTERE		 1		 9
            r["FILLER1"] = import.leggiAlfanumerico(tr, 175);             //CARATTERE	         175
            if (tipoRecord != 1)
            {
                QueryCreator.ShowError(this, "Mi aspettavo il record 1 invece ho ricevuto il record " + tipoRecord, "");
                return(false);
            }
            if (tipoFlusso != 11)
            {
                QueryCreator.ShowError(this, "Mi aspettavo il flusso 11 (giornale di cassa) invece ho ricevuto il flusso " + tipoFlusso, "");
                return(false);
            }
            return(import.vaiACapo(tr));
        }
Beispiel #5
0
 public string leggiAlfanumerico(TextReader tr, int numCifre)
 {
     if (tr.Read(buffer, 0, numCifre) != numCifre)
     {
         QueryCreator.ShowError(form, "ERRORE DURANTE LA LETTURA DEL FILE", "Letti meno byte rispetto al previsto");
     }
     return(new string(buffer, 0, numCifre).Trim());
 }
Beispiel #6
0
        public decimal leggiDecimale(TextReader tr, int numCifre)
        {
            if (tr.Read(buffer, 0, numCifre) != numCifre)
            {
                QueryCreator.ShowError(form, "ERRORE DURANTE LA LETTURA DEL FILE", "Letti meno byte rispetto al previsto");
            }
            string s = new string(buffer, 0, numCifre - 2)
                       + NumberFormatInfo.CurrentInfo.CurrencyDecimalSeparator
                       + new string(buffer, numCifre - 2, 2);

            return(decimal.Parse(s));
        }
Beispiel #7
0
        private string leggiIntestazioneRecord(TextReader tr, DataRow r)
        {
            int ISTTS = leggiNumerico(tr, 5); //    Codice istituto
            int CODEN = leggiNumerico(tr, 7); //    Codice ente
            int ESERC = leggiNumerico(tr, 4); //    Anno esercizio

            if (!ISTTS.Equals(r["ISTTS"]) || !CODEN.Equals(r["CODEN"]) || !ESERC.Equals(r["ESERC"]))
            {
                QueryCreator.ShowError(null, "Errore nell'intestazione di un record 02 o 09", "");
                return(null);
            }
            return(leggiAlfanumerico(tr, 2));//     Tipo record
        }
Beispiel #8
0
 public bool vaiACapo(TextReader tr)
 {
     if (tr.Read(buffer, 0, 2) != 2)
     {
         QueryCreator.ShowError(form, "ERRORE DURANTE LA LETTURA DEL FILE", "Letti meno byte rispetto al previsto");
         return(false);
     }
     if ((buffer[0] != 13) || (buffer[1] != 10))
     {
         QueryCreator.ShowError(form, "Manca l'interruzione di riga", "Manca l'interruzione di riga");
         return(false);
     }
     return(true);
 }
Beispiel #9
0
 /// <summary>
 /// Metodo che mostra un messaggio di errore visualizzando i riferimenti presenti nella riga del flusso
 /// della banca
 /// </summary>
 /// <param name="rBanca"></param>
 private void raiseError(DataRow rBanca)
 {
     QueryCreator.ShowError(form, "Esitazione impossibile",
                            "Impossibile esitare il seguente movimento bancario:"
                            + "\r\nEsercizio: " + rBanca["ESERC"]
                            + "\r\nTipo documento: " + rBanca["TIPDOC"]
                            + "\r\nNumero documento: " + rBanca["NUMDOC"]
                            + "\r\nProgressivo documento: " + rBanca["PRODOC"]
                            + "\r\nNum. bolletta: " + rBanca["NUMQUI"]
                            + "\r\nImporto: " + rBanca["IMPDOC"]
                            + "\r\nBeneficiario: " + rBanca["ANABE"]
                            + "\r\nCausale: " + rBanca["CAUSALE"]
                            + "\r\n\r\n" + erroreBloccante);
 }
Beispiel #10
0
        private string leggiEF06IntestazioneRecord(TextReader tr, DataRow r)
        {
            int    ISTTS1  = leggiNumerico(tr, 3);     //	1	3	N	Codice Istituto Tesoriere
            string FILTESE = leggiAlfanumerico(tr, 3); //	4	3	A	Filiale Tesoreria
            int    CODENT1 = leggiNumerico(tr, 9);     //	7	9	N	Codice Ente
            int    ESERC1  = leggiNumerico(tr, 4);     //	16	4	N	Esercizio

            if (!ISTTS1.Equals(r["ISTTS1"]) || !FILTESE.Equals(r["FILTESE"]) || !CODENT1.Equals(r["CODENT1"]) ||
                !ESERC1.Equals(r["ESERC1"]))
            {
                QueryCreator.ShowError(null, "Errore durante la lettura del file", "Errore nell'intestazione di un record dettaglio o record di coda");
                return(null);
            }
            return(leggiAlfanumerico(tr, 2));            //	20	2	N	Tipo record –Fisso 01
        }
Beispiel #11
0
        public static StreamReader getStreamReader(long quoziente, string fname)
        {
            FileInfo fi         = new FileInfo(fname);
            long     dimensione = fi.Length;
            long     modulo     = fi.Length % quoziente;

            if (modulo > 0)
            {
                QueryCreator.ShowError(null, "La dimensione del file non è un multiplo di " + quoziente, "Errore di dimensione del file");
                return(null);
            }
            else
            {
                return(new StreamReader(new BufferedStream(new FileStream(fname, FileMode.Open), 1048576), Encoding.Default));
            }
        }
Beispiel #12
0
        public long leggiLong(TextReader tr, int numCifre)
        {
            if (tr.Read(buffer, 0, numCifre) != numCifre)
            {
                QueryCreator.ShowError(form, "ERRORE DURANTE LA LETTURA DEL FILE", "Letti meno byte rispetto al previsto");
            }
            string s = new string(buffer, 0, numCifre);

            try {
                return(long.Parse(s));
            }
            catch (Exception e) {
                QueryCreator.ShowException(form, "ERRORE DURANTE LA LETTURA DI UN LONG DAL FILE\r\n" + s, e);
            }
            return(0);
        }
Beispiel #13
0
        private string BuildNomeFile(char progressivo)
        {
            //ITDMSCSM79S19C975E_DF_20171.xml
            //IT80006510806_DF_20171.xml
            DataTable dtLicense = Conn.RUN_SELECT("license", "cf, p_iva", null, null, null, false);

            if (dtLicense == null || dtLicense.Rows.Count == 0)
            {
                QueryCreator.ShowError(this, "Errore del database nel reperire informazioni dalla licenza.", Conn.LastError);
                return("");
            }

            var license       = dtLicense.First();
            var codiceFiscale = license.Field <string>("cf");
            var partitaIVA    = license.Field <string>("p_iva");
            int esercizio     = (int)HelpForm.GetObjectFromString(typeof(int),
                                                                  txtEsercizio.Text.ToString(), "x.y.year");
            string esercizioStr = esercizio.ToString().Substring(2, 2);
            //object trimestre = cmbTrimestre.SelectedValue;
            object mese    = cmbMese.SelectedValue;
            object periodo = DBNull.Value;

            //if(trimestre != DBNull.Value) periodo = trimestre; else
            periodo = mese;

            object kind_registry;

            if (rdbA.Checked)
            {
                kind_registry = 'F';//per gli Acquisti mettiamo la F a indicare che si tratta di Fornitore
            }
            else
            {
                kind_registry = 'C';//per le Vendite mettiamo la V a indicare che si tratta di Cliente
            }
            string NomeFile = "";

            if (codiceFiscale != "")
            {
                NomeFile = "IT" + codiceFiscale + "_" + "DF_" + kind_registry + esercizioStr.ToString() + progressivo + periodo.ToString();
            }
            else
            {
                NomeFile = "IT" + partitaIVA + "_" + "DF_" + kind_registry + esercizioStr.ToString() + progressivo + periodo.ToString();
            }
            return(NomeFile);
        }
Beispiel #14
0
        bool leggiEF07RecordDiTesta(TextReader tr, DataRow r)
        {
            r["ISTTS"] = leggiNumerico(tr, 5);        //    Codice istituto
            r["CODEN"] = leggiNumerico(tr, 7);        //    Codice ente
            r["ESERC"] = leggiNumerico(tr, 4);        //    Anno esercizio
            string tiprec = leggiAlfanumerico(tr, 2); //    Tipo record

            r["DESC"]   = leggiAlfanumerico(tr, 50);  //    Descrizione ente
            r["NDG"]    = leggiLong(tr, 11);          //    Codice anagrafico ente
            r["DTELAB"] = leggiDataGMA(tr, 8);        //	Data elaborazione (nel formato GGMMAAAA)
            r["FILLER"] = leggiAlfanumerico(tr, 413); //    Campo a disposizione
            if (tiprec != "01")
            {
                QueryCreator.ShowError(null, "Mi aspettavo il record 01 invece ho ricevuto il record " + tiprec, "");
                return(false);
            }
            return(vaiACapo(tr));
        }
Beispiel #15
0
        public static string detectType(string fname)
        {
            FileInfo fi         = new FileInfo(fname);
            long     dimensione = fi.Length;

            //EF06  503
            //Ef07  502
            if (fi.Length % 502 == 0)
            {
                return("EF07");
            }
            if (fi.Length % 503 == 0)
            {
                return("EF06");
            }
            QueryCreator.ShowError(null, "La dimensione del file non è un multiplo di 502 o 503.", "Errore di dimensione del file");

            return(null);
        }
Beispiel #16
0
        private bool ValidaFile_conXSD(string fileName)
        {
            bool res = XML_XSD_Validator.Validate(fileName, AppDomain.CurrentDomain.BaseDirectory + "datifatturav2.0.xsd");

            if (!res)
            {
                QueryCreator.ShowError(this, "Errore nella validazione dell'xml\r\n" +
                                       $"Il file  {fileName} contiene errori nei dati che ne causeranno lo scarto. \r\n" +
                                       "Per ottenere l'elenco delle probabili cause del problema, cliccare su OK e poi sul pulsante 'Documenti Elaborati' nella sezione 'Verifiche' in alto a destra del form.\r\n",
                                       XML_XSD_Validator.GetError());
                return(false);
            }
            else
            {
                MessageBox.Show($"File {fileName} validato con successo");
                return(true);
            }
            return(res);
        }
Beispiel #17
0
        public object leggiDataAMG(TextReader tr, int numCifre)
        {
            if (tr.Read(buffer, 0, numCifre) != numCifre)
            {
                QueryCreator.ShowError(form, "ERRORE DURANTE LA LETTURA DEL FILE", "Letti meno byte rispetto al previsto");
            }
            string s = new string(buffer, 0, numCifre);

            try {
                return((object)DateTime.ParseExact(s, "yyyyMMdd", DateTimeFormatInfo.CurrentInfo));
            }
            catch (Exception e) {
                if (new string(buffer, 0, numCifre) != "".PadRight(numCifre, '0'))
                {
                    QueryCreator.ShowException(form, "ERRORE DURANTE LA LETTURA DEL FILE: DATA AMG\r\n" + s, e);
                }
                return(DBNull.Value);
            }
        }
Beispiel #18
0
 public object leggiDataGMA(TextReader tr, int numCifre)
 {
     if (tr.Read(buffer, 0, numCifre) != numCifre)
     {
         QueryCreator.ShowError(form, "ERRORE DURANTE LA LETTURA DEL FILE", "Letti meno byte rispetto al previsto");
     }
     try {
         return((object)DateTime.ParseExact(new string(buffer, 0, numCifre), "ddMMyyyy", DateTimeFormatInfo.CurrentInfo));
     }
     catch (Exception e) {
         string s     = new string(buffer, 0, numCifre);
         string zeri  = "".PadRight(numCifre, '0');
         string spazi = "".PadRight(numCifre, ' ');
         if ((s != zeri) && (s != spazi))
         {
             QueryCreator.ShowException(form, "ERRORE DURANTE LA LETTURA DEL FILE: DATA GMA", e);
         }
         return(DBNull.Value);
     }
 }
Beispiel #19
0
 protected override Form GetForm(string FormName)
 {
     if (FormName == "default")
     {
         if (ExtraParameter == null)
         {
             return(null);
         }
         frmExport F = new frmExport();
         //	ExtraParameter  contiene il parametro da passare a BuildForm
         if (!F.BuildForm(ExtraParameter.ToString(), this))
         {
             QueryCreator.ShowError(null, "Non è stato possibile avviare l'esportazione ",
                                    "Errore nella costruzione del form dei parametri. Provare ad aggiornare il menu.");
             return(null);
         }
         return(F);
     }
     return(null);
 }
Beispiel #20
0
        public string leggiSegnoConDecimalePiuOMeno(TextReader tr, int numCifre, out decimal decimale)
        {
            if (tr.Read(buffer, 0, numCifre) != numCifre)
            {
                QueryCreator.ShowError(form, "ERRORE DURANTE LA LETTURA DEL FILE", "Letti meno byte rispetto al previsto");
            }
            if (buffer[0] != '+' && buffer[0] != '-')
            {
                QueryCreator.ShowError(form, "ERRORE DURANTE LA LETTURA DEL FILE", "Ho incontrato un segno diverso da + o -");
            }

            //			string segno = buffer[0]=='A'? "": "-";
            string s =
                new string(buffer, 0, numCifre - 2)
                + NumberFormatInfo.CurrentInfo.CurrencyDecimalSeparator
                + new string(buffer, numCifre - 2, 2);

            decimale = decimal.Parse(s);
            return(buffer[0].ToString());
        }
Beispiel #21
0
        public int leggiNumerico(TextReader tr, int numCifre)
        {
            if (tr.Read(buffer, 0, numCifre) != numCifre)
            {
                QueryCreator.ShowError(null, "ERRORE DURANTE LA LETTURA DEL FILE", "Letti meno byte rispetto al previsto");
            }
            string s = new string(buffer, 0, numCifre);

            try {
                return(int.Parse(s));
            }
            catch (Exception e) {
                string spazi = "".PadRight(numCifre);
                if (s != spazi)
                {
                    QueryCreator.ShowException(null, "ERRORE DURANTE LA LETTURA DI UN NUMERICO DAL FILE\r\n" + s, e);
                }
                return(0);
            }
        }
Beispiel #22
0
        public void MetaData_AfterPost()
        {
            if (lastdbtable == null)
            {
                return;
            }
            if (lastdboperation == null)
            {
                return;
            }
            string filterrule = Meta.GetSys("filterrule").ToString();
//			RecalcRule(Meta.Conn, lastdbtable, lastdboperation);
            string err = EasyAudits.RecalcAudit(Meta.Conn, lastdbtable, lastdboperation, filterrule);

            if (err != null)
            {
                QueryCreator.ShowError(this, "Errore nella compilazione della s.p. " +
                                       lastdbtable + "(" + lastdboperation + ")" + ".",
                                       err);
            }
        }
Beispiel #23
0
        protected override Form GetForm(string FormName)
        {
            if (FormName == "default")
            {
                frmReportParameter F = new frmReportParameter();
                //	ExtraParameter  contiene il parametro da passare a BuildForm


                if (F.BuildForm(ExtraParameter.ToString(), this))
                {
                    return(F);
                }

                this.LogError("Errore nella costruzione del form dei parametri. Dettaglio:" +
                              ExtraParameter.ToString());
                QueryCreator.ShowError(null, "Non è stato possibile avviare la stampa",
                                       "Errore nella costruzione del form dei parametri. Dettaglio:" +
                                       ExtraParameter.ToString());
                return(null);
            }
            return(null);
        }
Beispiel #24
0
        bool leggiEF06RecordDiTesta(TextReader tr, DataRow r)
        {
            r["ISTTS1"]  = leggiNumerico(tr, 3);     //	1	3	N	Codice Istituto Tesoriere
            r["FILTESE"] = leggiAlfanumerico(tr, 3); //	4	3	A	Filiale Tesoreria
            r["CODENT1"] = leggiNumerico(tr, 9);     //	7	9	N	Codice Ente
            r["ESERC1"]  = leggiNumerico(tr, 4);     //	16	4	N	Esercizio
            //int tiprec = leggiNumerico(tr, 2);
            //r["TIPREC"] = tiprec;		//	20	2	N	Tipo record –Fisso 01
            string tiprec = leggiAlfanumerico(tr, 2);

            r["TIPREC"] = tiprec;                     ////	20	2	A	Tipo record –Fisso 01   Maria tracciato aggiornato
            r["WA035"]  = leggiAlfanumerico(tr, 35);  //	22	35	A	Descrizione flusso prima parte
            r["WA040"]  = leggiAlfanumerico(tr, 40);  //	57	40	A	Descrizione flusso seconda parte
            r["FILLER"] = leggiAlfanumerico(tr, 405); //	97	404	A	Campo vuoto
            Console.WriteLine(r["WA035"]);
            if (tiprec != "01")
            {
                QueryCreator.ShowError(null, "Errore durante la lettura del file", "Era atteso il record 01 invece si è incontrato il record " + tiprec);
                return(false);
            }
            return(vaiACapo(tr));
        }
Beispiel #25
0
        public override DataTable getInfoMandati(object esercDocPagamento, object numDocPagamento)
        {
            string query = "SELECT s.ymov as ypay, el.kpay, p.npay, el.idpay, PRODOC = el.idpay, NUMQUI=el.nbill,"
                           + "TPAGTS=m.methodbankcode, "                                                                                                                                                //codicemodalitaCass
                           + "sCODABI=el.idbank, "                                                                                                                                                      //codiceabi
                           + "sCODCAB=el.idcab, "                                                                                                                                                       //codicecab
                           + "CONTO=REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(ISNULL(el.cc,''),',',''),'.',''),'_',''),'-',''),'*',''),'+',''),'/',''),':',''),';',''), " //contocorrente
                           + "CIN=ISNULL(el.cin,''), "                                                                                                                                                  //cin
                           + "ANABE=ISNULL(c.title,''), "                                                                                                                                               //denominazioneben
                           + "CFISC=CASE WHEN ctc.flaghuman = 'S' AND cf IS NOT NULL THEN c.cf WHEN ctc.flaghuman = 'S' AND c.cf IS NULL THEN REPLICATE('9',16) ELSE '' END, "                          //codicefiscaleben
                           + "CAUSALE = CASE WHEN (SELECT COUNT(*) FROM expense s1 JOIN expenselast sl1 on s1.idexp=sl1.idexp "
                           + " WHERE s1.ymov = s.ymov AND sl1.kpay = el.kpay AND sl1.idpay = el.idpay) > 1 THEN 'ACCORPAMENTO PAGAMENTI' "
                           + " ELSE ISNULL(s.doc,'') + ISNULL(CONVERT(varchar(12),s.docdate),'') + ISNULL(s.description,'') END "
                           + "FROM expense s "
                           + "JOIN expenselast el ON s.idexp=el.idexp "
                           + "JOIN payment p ON p.kpay = el.kpay "
                           + "JOIN paymethod m ON (el.idpaymethod = m.idpaymethod) "
                           + "JOIN registry c ON (c.idreg = s.idreg) "
                           + "JOIN registryclass ctc ON (ctc.idregistryclass = c.idregistryclass) "
                           + "WHERE (p.ypay = " + esercDocPagamento
                           + ") and (p.npay = " + numDocPagamento
                           + ") AND (el.idpay is not null)";
            string    errMsg;
            DataTable tInfo = Conn.SQLRunner(query, -1, out errMsg);

            if (tInfo == null)
            {
                QueryCreator.ShowError(form, "Errore durante l'esecuzione della query:\r\n" + query, errMsg);
            }
            tInfo.Columns.Add("CODABI", typeof(string));
            tInfo.Columns.Add("CODCAB", typeof(string));
            foreach (DataRow r in tInfo.Rows)
            {
                r["CODABI"] = r["sCODABI"];
                r["CODCAB"] = r["sCODCAB"];
            }
            return(tInfo);
        }
Beispiel #26
0
        public void Run()
        {
            if (Running)
            {
                return;
            }
            Running = true;

            tableexamined = 0;
            foreach (DataRow R in ToRecalc.Rows)
            {
                if (MustStop)
                {
                    DialogResult = DialogResult.Cancel;
                    Close();
                    return;
                }

                tableexamined++;
                txtTable.Text = R["tablename"].ToString();


//				RecalcRule(Conn, R["dbtable"].ToString(), R["dboperation"].ToString());
                string err = EasyAudits.RecalcAudit(Conn, R["tablename"].ToString(), R["opkind"].ToString(), filterrule);
                if (err != null)
                {
                    QueryCreator.ShowError(this, "Errore nella compilazione della s.p. " +
                                           R["tablename"].ToString() + "(" + R["opkind"].ToString() + ").",
                                           err);
                }

                progBar.Value = tableexamined;
                //Application.DoEvents();
            }
            //MessageBox.Show("Ricompilazione eseguita con successo");
            DialogResult = DialogResult.OK;
            Close();
        }
Beispiel #27
0
        bool leggiEF07RecordCausale(TextReader tr, DataRow r)
        {
            int    ISTTS  = leggiNumerico(tr, 5);      //	Codice istituto
            int    CODEN  = leggiNumerico(tr, 7);      //	Codice ente
            int    ESERC  = leggiNumerico(tr, 4);      //	Anno esercizio
            string tiprec = leggiAlfanumerico(tr, 2);  //	Tipo record

            r["TIPDOC"]  = leggiAlfanumerico(tr, 1);   //	Tipo documento
            r["NUMDOC"]  = leggiAlfanumerico(tr, 7);   //	Numero documento
            r["PRODOC"]  = leggiAlfanumerico(tr, 7);   //	Progressivo documento
            r["CAUSALE"] = leggiAlfanumerico(tr, 400); //	Causale descrittiva
            r["FILLER"]  = leggiAlfanumerico(tr, 67);  //	Campo a disposizione
            if (tiprec != "04")
            {
                QueryCreator.ShowError(null, "Mi aspettavo il record 04 invece ho ricevuto il record " + tiprec, "");
                return(false);
            }
            if (!ISTTS.Equals(r["ISTTS"]) || !CODEN.Equals(r["CODEN"]) || !ESERC.Equals(r["ESERC"]))
            {
                QueryCreator.ShowError(null, "Errore nell'intestazione del record 04", "");
                return(false);
            }
            return(vaiACapo(tr));
        }
Beispiel #28
0
        public bool parseEF06File(string fname)
        {
            ArrayList    altriEsercizi = new ArrayList();
            StreamReader sr            = getStreamReader(503, fname);

            if (sr == null)
            {
                return(false);
            }

            DS.EF06_TestaCoda.Clear();
            DS.EF06.Clear();
            int numFile   = 0;
            int esercizio = CfgFn.GetNoNullInt32(Conn.GetSys("esercizio"));

            while (sr.Peek() != -1)
            {
                int numRecord = 0;
                numFile++;
                DataRow rTC = DS.EF06_TestaCoda.NewRow();
                if (!leggiEF06RecordDiTesta(sr, rTC))
                {
                    return(false);
                }
                DS.EF06_TestaCoda.Rows.Add(rTC);
                string tiprec = leggiEF06IntestazioneRecord(sr, rTC);
                while (tiprec == "02")
                {
                    numRecord++;
                    DataRow rDett = DS.EF06.NewRow();
                    //rDett["DTELT2"] = rTC["DTELT2"];
                    rDett["ISTTS1"]  = rTC["ISTTS1"];
                    rDett["FILTESE"] = rTC["FILTESE"];
                    rDett["CODENT1"] = rTC["CODENT1"];
                    rDett["ESERC1"]  = rTC["ESERC1"];
                    if (!leggiEF06DettaglioMovimenti(sr, rDett))
                    {
                        return(false);
                    }
                    if (CfgFn.GetNoNullInt32(rDett["ESERC1"]) == esercizio)
                    {
                        DS.EF06.Rows.Add(rDett);
                    }
                    else
                    {
                        if (!altriEsercizi.Contains(rDett["ESERC1"]))
                        {
                            altriEsercizi.Add(rDett["ESERC1"]);
                        }
                    }
                    tiprec = leggiEF06IntestazioneRecord(sr, rTC);
                }
                if (tiprec != "03")
                {
                    QueryCreator.ShowError(null, "Errore durante la lettura del file", "Atteso il record 3; incontrato invece il record " + tiprec);
                    return(false);
                }
                if (!leggiEF06RecordDiCoda(sr, rTC))
                {
                    return(false);
                }
                //				Console.WriteLine(numFile+" "+numRecord);
            }
            sr.Close();
            copia_EF06_IN020304();

            if (altriEsercizi.Count > 0)
            {
                string messaggio = "Nel file ci sono esitazioni relative ad esercizi diversi.\nDopo aver esitato nel "
                                   + Conn.GetSys("esercizio")
                                   + ", se necessario, occorrerà ripetere l'operazione anche per ";
                if (altriEsercizi.Count == 1)
                {
                    messaggio += "l'esercizio " + altriEsercizi[0];
                }
                if (altriEsercizi.Count > 1)
                {
                    messaggio += "gli esercizi " + altriEsercizi[0];
                    for (int i = 1; i < altriEsercizi.Count - 1; i++)
                    {
                        messaggio += ", " + altriEsercizi[i];
                    }
                    messaggio += " e " + altriEsercizi[altriEsercizi.Count - 1];
                }
                messaggio += ". Non è necessario a tal fine manipolare il file in alcun modo.";
                MessageBox.Show(messaggio, "Avviso");
            }
            return(true);
        }
Beispiel #29
0
        public bool parseEF07File(string fname)
        {
            StreamReader sr = getStreamReader(502, fname);

            if (sr == null)
            {
                return(false);
            }
            int esercizio = CfgFn.GetNoNullInt32(Conn.GetSys("esercizio"));

            ArrayList altriEsercizi = new ArrayList();

            DS.IN0109.Clear();
            DS.flussobanca.Clear();
            int numFile = 0;

            while (sr.Peek() != -1)
            {
                int numRecord = 0;
                numFile++;
                DataRow rTC = DS.IN0109.NewRow();
                if (!leggiEF07RecordDiTesta(sr, rTC))
                {
                    return(false);
                }
                DS.IN0109.Rows.Add(rTC);
                string tiprec = leggiIntestazioneRecord(sr, rTC);
                while (tiprec == "02")
                {
                    numRecord++;
                    DataRow rDett = DS.flussobanca.NewRow();
                    rDett["DTELAB"] = rTC["DTELAB"];
                    rDett["ISTTS"]  = rTC["ISTTS"];
                    rDett["CODEN"]  = rTC["CODEN"];
                    rDett["ESERC"]  = rTC["ESERC"];
                    if (!leggiEF07RecordDiDettaglio(sr, rDett))
                    {
                        return(false);
                    }
                    if (!leggiEF07RecordBeneficiario(sr, rDett))
                    {
                        return(false);
                    }
                    if (!leggiEF07RecordCausale(sr, rDett))
                    {
                        return(false);
                    }
                    if (CfgFn.GetNoNullInt32(rDett["ESERC"]) == esercizio)
                    {
                        DS.flussobanca.Rows.Add(rDett);
                    }
                    else
                    {
                        if (!altriEsercizi.Contains(rDett["ESERC"]))
                        {
                            altriEsercizi.Add(rDett["ESERC"]);
                        }
                    }
                    tiprec = leggiIntestazioneRecord(sr, rTC);
                }
                if (tiprec != "09")
                {
                    QueryCreator.ShowError(null, "Mi aspettavo il record 09 invece ho ricevuto il record " + tiprec, "");
                    return(false);
                }
                if (!leggiEF07FileDiCoda(sr, rTC))
                {
                    return(false);
                }
                //				Console.WriteLine(numFile+" "+numRecord);
            }
            sr.Close();
            DS.IN0109.Clear();

            return(true);
        }
Beispiel #30
0
 private void ShowMsg(string msg, string detail)
 {
     QueryCreator.ShowError(this, msg, QueryCreator.GetPrintable(detail));
 }