Ejemplo n.º 1
0
        public cXBRL(string file)
        {
            XmlDataProviderManager _y = new XmlDataProviderManager(file, true);

            foreach (XmlNode item in _y.Document.SelectNodes("/xbrl//Nodo"))
            {
                htXBRL.Add(item.Attributes["nome"].Value, item.Attributes["ID"].Value);
                if (item.Attributes["segno"] != null)
                {
                    htSegno.Add(item.Attributes["nome"].Value, item.Attributes["segno"].Value);
                }
            }
        }
Ejemplo n.º 2
0
        private void LoadDataSource()
        {
            _x = new XmlDataProviderManager(SelectedDataSource);

            Utilities u = new Utilities();

            if (!u.CheckXmlDocument(_x.Document, ((App.TipoFile)(Convert.ToInt32(IDTree))), "Data"))
            {
                this.Close();
                return;
            }

            ReloadNodi();
        }
Ejemplo n.º 3
0
        //private void printsingle(Hashtable cliente, XmlDataProviderManager TreeXmlProvider, XmlDataProviderManager _x, string IDTree, WordLib wl, string IDSessione, string IDCliente)
        private void printsingle(Hashtable cliente, XmlDataProviderManager TreeXmlProvider, string IDTree, RTFLib wl, string IDSessione, string IDCliente, string AdditivaTitolo, string nomefile)
        {
            this.selectedSession = IDSessione;
            RecursiveNode(TreeXmlProvider.Document.SelectSingleNode("/Tree/Node"), wl, IDTree, IDSessione, IDCliente, AdditivaTitolo, nomefile);

            istobecompleteforprinting = false;

            if (RecursiveCheck(TreeXmlProvider.Document.SelectSingleNode("/Tree/Node"), IDTree))
            {
                wl.AddTitleDaCompletare();

                RecursiveNode(TreeXmlProvider.Document.SelectSingleNode("/Tree/Node"), wl, IDTree, IDSessione, IDCliente, AdditivaTitolo, nomefile);
            }

            istobecompleteforprinting = true;
        }
        private void buttonComando_Click(object sender, RoutedEventArgs e)
        {
            checkdatecorreto = false;

            //controllo selezione clienti
            if (cmbClienti.SelectedIndex == -1)
            {
                MessageBox.Show("selezionare un cliente");
                return;
            }

            MasterFile mf = MasterFile.Create();
            Utilities  u  = new Utilities();

            int IDCliente = Convert.ToInt32(htClienti[cmbClienti.SelectedIndex].ToString());

            IDPianificazioniVigilanza = App.MasterFile_NewID;

            try
            {
                IDPianificazioniVigilanza = Convert.ToInt32(htDate[cmbData.SelectedIndex].ToString());
            }
            catch (Exception ex)
            {
                cBusinessObjects.logger.Error(ex, "wSchedaPianificazioneVigilanza.buttonComando_Click1 exception");
                string log = ex.Message;
            }

            if (TipologiaAttivita == App.TipoAttivitaScheda.Delete && IDPianificazioniVigilanza == -1)
            {
                MessageBox.Show("selezionare una sessione");
                return;
            }

            App.TipoAttivitaScheda oldTipo = TipologiaAttivita;
            if (TipologiaAttivita == App.TipoAttivitaScheda.New)
            {
                stackPanel1.IsEnabled = false;
                //tabControl1.IsEnabled = false;
                //   gridButtons.IsEnabled = false;
                loading.Visibility = Visibility;
                Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new Action(delegate { }));
                //cBusinessObjects.show_workinprogress("Prima creazione dell'albero in corso...");
            }

            switch (TipologiaAttivita)
            {
            //Nuovo e salva
            case App.TipoAttivitaScheda.New:
            case App.TipoAttivitaScheda.Edit:
                //convalida dati
                //Campi Obbligatorio
                if (!u.ConvalidaDatiInterfaccia(dtpDataInizio, "Data Inizio periodo mancante."))
                {
                    cBusinessObjects.hide_workinprogress();
                    return;
                }


                if (!u.ConvalidaDatiInterfaccia(dtpDataFine, "Data Fine periodo mancante."))
                {
                    cBusinessObjects.hide_workinprogress();
                    return;
                }


                DateTime dtinizio = new DateTime();
                DateTime dtfine   = new DateTime();

                try
                {
                    dtinizio = Convert.ToDateTime(dtpDataInizio.SelectedDate.Value.ToShortDateString());
                }
                catch (Exception ex)
                {
                    cBusinessObjects.logger.Error(ex, "wSchedaPianificazioneVigilanza.buttonComando_Click2 exception");
                    string log = ex.Message;
                    cBusinessObjects.hide_workinprogress();
                    MessageBox.Show("Attenzione data inizio inserita non valida");
                    return;
                }

                try
                {
                    dtfine = Convert.ToDateTime(dtpDataFine.SelectedDate.Value.ToShortDateString());
                }
                catch (Exception ex)
                {
                    cBusinessObjects.logger.Error(ex, "wSchedaPianificazioneVigilanza.buttonComando_Click3 exception");
                    string log = ex.Message;
                    cBusinessObjects.hide_workinprogress();
                    MessageBox.Show("Attenzione data fine inserita non valida");
                    return;
                }

                if (dtinizio.CompareTo(dtfine) > 0)

                {
                    cBusinessObjects.hide_workinprogress();
                    MessageBox.Show("Attenzione data fine precedente a data inizio");
                    return;
                }

                //Controllo che questa data non sia già stata presa
                if (!mf.CheckDoppio_PianificazioniVigilanza(IDPianificazioniVigilanza, IDCliente, dtpDataInizio.SelectedDate.Value.ToShortDateString(), dtpDataFine.SelectedDate.Value.ToShortDateString()))
                {
                    cBusinessObjects.hide_workinprogress();
                    MessageBox.Show("Data già pianificata");
                    return;
                }

                Hashtable htSelected = mf.GetPianificazioniVigilanza(IDPianificazioniVigilanza.ToString());

                if (htSelected.Count != 0)
                {
                    XmlDataProviderManager x = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + htSelected["FileData"].ToString());

                    string    firstdata   = "";
                    string    lastData    = "";
                    DataTable datiTestata = cBusinessObjects.GetData(100003, typeof(PianificazioneVerificheTestata), IDCliente, IDPianificazioniVigilanza, 27);
                    foreach (DataRow item in datiTestata.Rows)
                    {
                        DateTime datehere = new DateTime();

                        try
                        {
                            datehere = Convert.ToDateTime(item["Data"].ToString());
                        }
                        catch (Exception ex)
                        {
                            cBusinessObjects.logger.Error(ex, "wSchedaPianificazioneVerifica.buttonComando_Click4 exception");
                            string log = ex.Message;
                            continue;
                        }

                        if (firstdata == "")
                        {
                            firstdata = item["Data"].ToString();
                        }

                        if (lastData == "")
                        {
                            lastData = item["Data"].ToString();
                        }

                        if (datehere.CompareTo(Convert.ToDateTime(firstdata)) < 0)
                        {
                            firstdata = item["Data"].ToString();
                        }

                        if (datehere.CompareTo(Convert.ToDateTime(lastData)) > 0)
                        {
                            lastData = item["Data"].ToString();
                        }
                    }

                    if (firstdata != "")
                    {
                        if (dtinizio.CompareTo(Convert.ToDateTime(firstdata)) > 0)
                        {
                            cBusinessObjects.hide_workinprogress();
                            MessageBox.Show("Attenzione data inizio successiva alla prima data pianificata.");
                            return;
                        }

                        if (dtfine.CompareTo(Convert.ToDateTime(lastData)) < 0)
                        {
                            cBusinessObjects.hide_workinprogress();
                            MessageBox.Show("Attenzione data fine precedente all ultima data pianificata");
                            return;
                        }
                    }
                }

                checkdatecorreto = true;

                //setto dati
                Hashtable ht = new Hashtable();
                ht.Add("Cliente", IDCliente);
                ht.Add("DataInizio", dtpDataInizio.SelectedDate.Value.ToShortDateString());
                ht.Add("DataFine", ((dtpDataFine.SelectedDate != null) ? dtpDataFine.SelectedDate.Value.ToShortDateString() : dtpDataInizio.SelectedDate.Value.ToShortDateString()));

                IDPianificazioniVigilanza = mf.SetPianificazioniVigilanza(ht, IDPianificazioniVigilanza, IDCliente);

                RegistrazioneEffettuata = true;

                if (TipologiaAttivita == App.TipoAttivitaScheda.New)
                {
                    if (IDClienteImport != "-1")
                    {
                        cBusinessObjects.hide_workinprogress();
                        this.Close();
                    }

                    //Process wait - START
                    //ProgressWindow pw = new ProgressWindow();
                    cBusinessObjects.SessioneIsNew = true;
                    TipologiaAttivita = App.TipoAttivitaScheda.Edit;
                    mf.SetAnafraficaStato(Convert.ToInt32(IDCliente), App.TipoAnagraficaStato.Disponibile);

                    ConfiguraMaschera();

                    foreach (DictionaryEntry item in htClienti)
                    {
                        if (Convert.ToInt32(item.Value.ToString()) == IDCliente)
                        {
                            cmbClienti.SelectedIndex = Convert.ToInt32(item.Key.ToString());
                        }
                    }

                    functionCmbClientiChanged(cmbClienti);

                    cmbData.IsEnabled = true;

                    foreach (DictionaryEntry item in htDate)
                    {
                        if (Convert.ToInt32(item.Value.ToString()) == IDPianificazioniVigilanza)
                        {
                            cmbData.SelectedIndex = Convert.ToInt32(item.Key.ToString());
                        }
                    }

                    functionCmbDataChanged(cmbData);
                    cBusinessObjects.AddSessione("PianificazioniVigilanza", cmbData.SelectedValue.ToString(), IDPianificazioniVigilanza, IDCliente);

                    //Process wait - STOP
                    //pw.Close();
                }
                _DatiCambiati = false;
                break;

            case App.TipoAttivitaScheda.Delete:
                //richiesta conferma
                if (MessageBoxResult.No == u.ConfermaCancellazione())
                {
                    return;
                }
                //cancellazione
                mf.DeletePianificazioniVigilanza(IDPianificazioniVigilanza, IDCliente.ToString());
                RegistrazioneEffettuata = true;
                base.Close();
                break;

            case App.TipoAttivitaScheda.Export:
                break;
            }

            //apro tree appena creato
            if (oldTipo == App.TipoAttivitaScheda.New)
            {
                //MessageBox.Show("apro tree appena creato");
                AccediVigilanza_Click(IDPianificazioniVigilanza.ToString(), false);
            }

            //chiudo maschera
            if (TipologiaAttivita != App.TipoAttivitaScheda.Edit)
            {
                base.Close();
            }
        }
Ejemplo n.º 5
0
        private void buttonStampa_Click(object sender, RoutedEventArgs e)
        {
            //controllo selezione clienti
            if (cmbClienti.SelectedIndex == -1)
            {
                MessageBox.Show("selezionare un cliente");
                return;
            }

            if (cmbData.SelectedIndex == -1)
            {
                MessageBox.Show("selezionare una sessione");
                return;
            }

            if (rdbVerbale.IsChecked == false && rdbMemorandum.IsChecked == false)
            {
                MessageBox.Show("selezionare verbale o memorandum");
                return;
            }

            if (rdbDescrittiva.IsChecked != true && rdbCompleta.IsChecked != true)
            {
                MessageBox.Show("Scegliere il tipo di stampa");
                return;
            }

            //Process wait - START
            //ProgressWindow pw = new ProgressWindow();

            MasterFile mf = MasterFile.Create();

            string IDCliente = htClienti[cmbClienti.SelectedIndex].ToString();

            this.selectedCliente = IDCliente;


            string anno = cmbData.SelectedValue.ToString().Split('/')[2];

            Hashtable cliente = mf.GetAnagrafica(Convert.ToInt32(IDCliente));

            XmlDataProviderManager _t = null;

            Hashtable valueshere = new Hashtable();

            //WordLib wl = new WordLib();
            RTFLib wl = new RTFLib();

            //wl.Verbali = true;

            #region Dati da revisione

            //XmlDataProviderManager _y = null;

            string FileRevisione = mf.GetRevisioneFromEsercizio(IDCliente, anno);



            string RagioneSociale  = "Dato Mancante: Compilare Carta di Lavoro 2.1.1";
            string Indirizzo       = "";
            string REA             = "";
            string CapitaleSociale = "Dato Mancante: Compilare Carta di Lavoro 2.1.5";
            string ids             = "";
            foreach (Hashtable item in mf.GetVerifiche(IDCliente))
            {
                if (cmbData.SelectedValue.ToString() == (item["Data"].ToString()))
                {
                    ids = item["ID"].ToString();
                }
            }
            this.selectedSession = ids;

            cBusinessObjects.idcliente = int.Parse(IDCliente);
            RagioneSociale             = cBusinessObjects.GetRagioneSociale();
            Indirizzo       = cBusinessObjects.GetIndirizzo();
            REA             = cBusinessObjects.GetREA();
            CapitaleSociale = cBusinessObjects.GetCapitaleSociale();

            #endregion

            wl.Watermark = false;
            wl.TabelleSenzaRigheVuote = true;
            wl.SenzaStampareTitoli    = true;
            wl.TitoloVerbale          = false;

            if (rdbDescrittiva.IsChecked == true)
            {
                wl.StampaDescrittiva = true;
            }

            wl.TemplateFileCompletePath = App.AppTemplateStampaNoLogo;
            wl.Open(new Hashtable(), cliente["RagioneSociale"].ToString(), cliente["CodiceFiscale"].ToString(), cmbData.SelectedValue.ToString(), "", true, true, IDCliente);

            if (rdbVerbale.IsChecked == true)
            {
                //if ( chk4.IsChecked == false && Chk5.IsChecked == false )
                //{
                //    MessageBox.Show( "selezionare almeno una tra l'area 4 o 5" );
                //    pw.Close();
                //    return;
                //}

                //if ( chk4.IsChecked == true)
                //{
                string partial_rtf_text = "";

                if (rdbMemorandum.IsChecked == false)
                {
                    foreach (Hashtable item in mf.GetVerifiche(IDCliente))
                    {
                        if (cmbData.SelectedValue.ToString() == (item["Data"].ToString()))
                        {
                            valueshere = item;
                            _t         = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["File"].ToString());
                        }
                    }

                    bool notfoundv = false;
                    if (valueshere.Count == 0)
                    {
                        notfoundv = true;
                    }
                    else
                    {
                        valueshere.Add("PeriodoPianificato", "");
                        DateTime dti_o = Convert.ToDateTime(valueshere["Data"]);

                        foreach (Hashtable item in mf.GetPianificazioniVerifiche(IDCliente))
                        {
                            DateTime dti = Convert.ToDateTime(item["DataInizio"]);
                            DateTime dtf = Convert.ToDateTime(item["DataFine"]);

                            if (dti_o.CompareTo(dti) > 0 && dti_o.CompareTo(dtf) < 0)
                            {
                                valueshere["PeriodoPianificato"] = item["DataInizio"] + " - " + item["DataFine"];
                                break;
                            }
                        }

                        partial_rtf_text = "\\pard\\keepn\\f0 ";

                        string titolohere = "VERBALE DELLA VERIFICA PERIODICA DEL ";
                        try
                        {
                            //if (_t.Document.SelectSingleNode("/Tree//Node[@ID='614']/Sessioni/Sessione[@Selected='#AA82BDE4']").Attributes["Stato"].Value == "2" || _t.Document.SelectSingleNode("/Tree//Node[@ID='615']/Sessioni/Sessione[@Selected='#AA82BDE4']").Attributes["Stato"].Value == "2" || _t.Document.SelectSingleNode("/Tree//Node[@ID='616']/Sessioni/Sessione[@Selected='#AA82BDE4']").Attributes["Stato"].Value == "2" || _t.Document.SelectSingleNode("/Tree//Node[@ID='617']/Sessioni/Sessione[@Selected='#AA82BDE4']").Attributes["Stato"].Value == "2" || _t.Document.SelectSingleNode("/Tree//Node[@ID='618']/Sessioni/Sessione[@Selected='#AA82BDE4']").Attributes["Stato"].Value == "2")
                            //{
                            //  titolohere = "VERBALE DI INSEDIAMENTO DEL ";
                            //}
                            XmlNode node6;
                            string  selection, strNode;
                            int     i;

                            selection = "/Tree//Node[@ID='<idnode>']/Sessioni/Sessione[@Selected='#AA82BDE4']";
                            for (i = 0; i < 5; i++)
                            {
                                strNode = string.Format("{0}", 614 + i);
                                strNode = selection.Replace("<idnode>", strNode);
                                node6   = _t.Document.SelectSingleNode(strNode);
                                if (node6 == null)
                                {
                                    continue;
                                }
                                if (node6.Attributes["Stato"].Value == "2")
                                {
                                    titolohere = "VERBALE DI INSEDIAMENTO DEL ";
                                    break;
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            string log = ex.Message;
                        }

                        wl.SetIntestazione(RagioneSociale, Indirizzo, CapitaleSociale, REA, titolohere, valueshere);

                        partial_rtf_text += "\\trowd\\cellx9900 \\fs24 \\qc\\b ATTIVITA' DI CONTROLLO CONTABILE \\b0\\cell\\row";

                        string TestoHere = "L'organo di revisione procede alla verifica secondo la previsione dell'art.14, primo comma, lettera b), del D. Lgs. 27 Gennaio 2010 n° 39, in conformità al Principio di revisione SA Italia 250B.";

                        partial_rtf_text += "\\trowd\\cellx9900 \\qj " + TestoHere + " \\cell\\row";

                        TestoHere         = "Per lo svolgimento delle attività di revisione e controllo viene utilizzata una procedura informatica che produce carte di lavoro, nelle quali vengono inseriti i dati tabellari raccolti nel corso della sessione, i commenti e le osservazioni annotati, nonché vengono allegati documenti in qualsiasi formato immateriale.";
                        partial_rtf_text += "\\trowd\\cellx9900 \\qj " + TestoHere + " \\cell\\row";

                        bool      esistepianificazione = false;
                        ArrayList al = mf.GetPianificazioniVerifiche(IDCliente);
                        foreach (Hashtable itemHT in al)
                        {
                            string filedata = App.AppDataDataFolder + "\\" + itemHT["FileData"].ToString();
                            //if ((new FileInfo(filedata)).Exists)
                            //{
                            //  XmlDataProviderManager ALXTPP = new XmlDataProviderManager(filedata);

                            //  foreach (XmlNode itemXPP in ALXTPP.Document.SelectNodes("//Dato[@ID=\"100013\"]/Valore/Pianificazione"))
                            //  {
                            //    if (itemXPP.Attributes["Data"].Value == cmbData.SelectedValue.ToString())
                            //    {
                            //      esistepianificazione = true;
                            //      break;
                            //    }
                            //  }
                            //}
                            XmlDataProviderManager ALXTPP = new XmlDataProviderManager(filedata);
                            if (ALXTPP.Document != null)
                            {
                                foreach (XmlNode itemXPP in ALXTPP.Document.SelectNodes("//Dato[@ID=\"100013\"]/Valore/Pianificazione"))
                                {
                                    if (itemXPP.Attributes["Data"].Value == cmbData.SelectedValue.ToString())
                                    {
                                        esistepianificazione = true;
                                        break;
                                    }
                                }
                            }

                            if (esistepianificazione == true)
                            {
                                break;
                            }
                        }

                        if (esistepianificazione == true)
                        {
                            //Inserisco il testo per la pianificazione
                            TestoHere         = "L'attività di controllo è stata pianificata con la carta di lavoro denominata Pianificazione; la sessione avviata rientra fra quelle pianificate.";
                            partial_rtf_text += "\\trowd\\cellx9900 \\qj " + TestoHere + " \\line \\cell\\row";
                        }

                        if (rdbDescrittiva.IsChecked == true)
                        {
                            TestoHere         = "Per economia di lavoro nel presente verbale verrà dato conto delle carte di lavoro utilizzate dalle quali verranno estrapolati le sole osservazioni e i commenti; per i dati raccolti ed inseriti anche in forma tabellare si farà riferimento alle carte di lavoro, conservate con modalità informatica, che si intendono parte integrante del presente verbale. Parimenti i documenti raccolti vengono associati alle carte di lavoro e conservati in modalità informatiche.";
                            partial_rtf_text += "\\trowd\\cellx9900 \\qj " + TestoHere + " \\line \\cell\\row";
                        }

                        TestoHere         = "Vengono eseguite le seguenti verifiche: \\line ";
                        partial_rtf_text += "\\trowd\\cellx9900 \\qj " + TestoHere + " \\cell\\row";

                        // partial_rtf_text += "\\par\n";

                        wl.InsertRtf(partial_rtf_text);



                        printsingle(cliente, _t, (Convert.ToInt32(App.TipoFile.Verifica)).ToString(), wl, valueshere["ID"].ToString(), IDCliente, "", valueshere["FileData"].ToString());
                    }

                    valueshere.Clear();

                    foreach (Hashtable item in mf.GetVigilanze(IDCliente))
                    {
                        if (cmbData.SelectedValue.ToString() == (item["Data"].ToString()))
                        {
                            valueshere = item;
                            _t         = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["File"].ToString());
                        }
                    }

                    if (valueshere.Count > 0)
                    {
                        if (notfoundv == false)
                        {
                            partial_rtf_text  = "\\pard\\keepn\\f0 ";
                            partial_rtf_text += "\\trowd\\cellx9900 \\fs24 \\qc\\b ATTIVITA' DI VIGILANZA \\b0\\cell\\row";

                            string TestoHere = "L’organo di controllo di cui agli artt. 2397 e seguenti Cod. Civ. procede alla verifica prescritta dall'articolo 2404 Cod. Civ.; l'attività da svolgere concernerà i doveri indicati nel primo comma dell'articolo 2403 Cod. Civ., esercitando i poteri di cui all'art. 2404 bis Cod. Civ.";

                            partial_rtf_text += "\\trowd\\cellx9900 \\qj " + TestoHere + " \\cell\\row";
                            partial_rtf_text += "\\trowd\\cellx9900 \\qj \\line \\cell\\row";

                            partial_rtf_text += "\n";
                        }
                        else
                        {
                            string titolohere2 = "VERBALE DELLA VERIFICA DEL ";
                            try
                            {
                                if (_t.Document.SelectSingleNode("/Tree//Node[@ID='614']/Sessioni/Sessione[@Selected='#AA82BDE4']").Attributes["Stato"].Value == "2")
                                {
                                    titolohere2 = "VERBALE DI INSEDIAMENTO DEL ";
                                }
                            }
                            catch (Exception ex)
                            {
                                string log = ex.Message;
                            }

                            wl.SetIntestazione(RagioneSociale, Indirizzo, CapitaleSociale, REA, titolohere2, valueshere);

                            partial_rtf_text += "\\trowd\\cellx9900 \\fs24 \\qc\\b ATTIVITA' DI VIGILANZA \\b0\\cell\\row";

                            string TestoHere = "L’organo di controllo di cui agli artt. 2397 e seguenti Cod. Civ. procede alla verifica prescritta dall'articolo 2404 Cod. Civ.; l'attività da svolgere concernerà i doveri indicati nel primo comma dell'articolo 2403 Cod. Civ., esercitando i poteri di cui all'art. 2404 bis Cod. Civ.";

                            partial_rtf_text += "\\trowd\\cellx9900 \\qj " + TestoHere + " \\cell\\row";
                            partial_rtf_text += "\\trowd\\cellx9900 \\qj \\line \\cell\\row";

                            partial_rtf_text += "\n";
                        }


                        wl.InsertRtf(partial_rtf_text);

                        printsingle(cliente, _t, (Convert.ToInt32(App.TipoFile.Vigilanza)).ToString(), wl, valueshere["ID"].ToString(), IDCliente, "", valueshere["FileData"].ToString());
                    }
                    else
                    {
                        MessageBox.Show("Verifica per attività di vigilanza non trovata");
                    }
                }
                else
                {
                    foreach (Hashtable item in mf.GetVigilanze(IDCliente))
                    {
                        if (cmbData.SelectedValue.ToString() == (item["Data"].ToString()))
                        {
                            valueshere = item;
                            _t         = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["File"].ToString());
                        }
                    }

                    if (valueshere.Count > 0)
                    {
                        valueshere.Add("PeriodoPianificato", "");
                        DateTime dti_o = Convert.ToDateTime(valueshere["Data"]);

                        foreach (Hashtable item in mf.GetPianificazioniVigilanze(IDCliente))
                        {
                            DateTime dti = Convert.ToDateTime(item["DataInizio"]);
                            DateTime dtf = Convert.ToDateTime(item["DataFine"]);

                            if (dti_o.CompareTo(dti) > 0 && dti_o.CompareTo(dtf) < 0)
                            {
                                valueshere["PeriodoPianificato"] = item["DataInizio"] + " - " + item["DataFine"];
                                break;
                            }
                        }

                        partial_rtf_text = "\\pard\\keepn\\f0 ";

                        if (valueshere.Count == 0)
                        {
                            MessageBox.Show("Verifica per attività di vigilanza non trovata");
                        }
                        else
                        {
                            string titolohere3 = "VERBALE DELLA VERIFICA DEL ";
                            try
                            {
                                if (_t.Document.SelectSingleNode("/Tree//Node[@ID='614']/Sessioni/Sessione[@Selected='#AA82BDE4']").Attributes["Stato"].Value == "2")
                                {
                                    titolohere3 = "VERBALE DI INSEDIAMENTO DEL ";
                                }
                            }
                            catch (Exception ex)
                            {
                                string log = ex.Message;
                            }

                            wl.SetIntestazione(RagioneSociale, Indirizzo, CapitaleSociale, REA, titolohere3, valueshere);

                            partial_rtf_text += "\\trowd\\cellx9900 \\fs24 \\qc\\b ATTIVITA' DI VIGILANZA \\b0\\cell\\row";

                            string TestoHere = "L’organo di controllo di cui agli artt. 2397 e seguenti Cod. Civ. procede alla verifica prescritta dall'articolo 2404 Cod. Civ.; l'attività da svolgere concernerà i doveri indicati nel primo comma dell'articolo 2403 Cod. Civ., esercitando i poteri di cui all'art. 2404 bis Cod. Civ.";

                            partial_rtf_text += "\\trowd\\cellx9900 \\qj " + TestoHere + " \\cell\\row";
                            partial_rtf_text += "\\trowd\\cellx9900 \\qj \\line \\cell\\row";

                            bool      esistepianificazione = false;
                            ArrayList al = mf.GetPianificazioniVigilanze(IDCliente);
                            foreach (Hashtable itemHT in al)
                            {
                                string filedata = App.AppDataDataFolder + "\\" + itemHT["FileData"].ToString();
                                if ((new FileInfo(filedata)).Exists)
                                {
                                    XmlDataProviderManager ALXTPP = new XmlDataProviderManager(filedata);

                                    foreach (XmlNode itemXPP in ALXTPP.Document.SelectNodes("//Dato[@ID=\"100003\"]/Valore/Pianificazione"))
                                    {
                                        if (itemXPP.Attributes["Data"].Value == cmbData.SelectedValue.ToString())
                                        {
                                            esistepianificazione = true;
                                            break;
                                        }
                                    }
                                }

                                if (esistepianificazione == true)
                                {
                                    break;
                                }
                            }

                            //partial_rtf_text += "\\trowd\\cellx9900 \\qj " + TestoHere + " \\cell\\row";

                            TestoHere         = "Vengono eseguite le seguenti verifiche: \\line ";
                            partial_rtf_text += "\\trowd\\cellx9900 \\qj " + TestoHere + " \\cell\\row";

                            //   partial_rtf_text += "\\par\n";

                            wl.InsertRtf(partial_rtf_text);

                            printsingle(cliente, _t, (Convert.ToInt32(App.TipoFile.Vigilanza)).ToString(), wl, valueshere["ID"].ToString(), IDCliente, "", valueshere["FileData"].ToString());
                        }
                    }

                    #region memorandum contemporaneo
                    RTFLib wl2 = new RTFLib();
                    wl2.Watermark = false;
                    wl2.TabelleSenzaRigheVuote = true;
                    wl2.SenzaStampareTitoli    = true;
                    wl2.TitoloVerbale          = false;

                    if (rdbDescrittiva.IsChecked == true)
                    {
                        wl2.StampaDescrittiva = true;
                    }

                    wl2.TemplateFileCompletePath = App.AppTemplateStampaNoLogo;
                    wl2.Open(new Hashtable(), cliente["RagioneSociale"].ToString(), cliente["CodiceFiscale"].ToString(), cmbData.SelectedValue.ToString(), "", true, true, IDCliente);
                    foreach (Hashtable item in mf.GetVerifiche(IDCliente))
                    {
                        if (cmbData.SelectedValue.ToString() == (item["Data"].ToString()))
                        {
                            valueshere = item;
                            _t         = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["File"].ToString());
                        }
                    }

                    if (!valueshere.Contains("PeriodoPianificato"))
                    {
                        valueshere.Add("PeriodoPianificato", "");
                    }
                    DateTime dti_o2 = Convert.ToDateTime(valueshere["Data"]);

                    foreach (Hashtable item in mf.GetPianificazioniVerifiche(IDCliente))
                    {
                        DateTime dti = Convert.ToDateTime(item["DataInizio"]);
                        DateTime dtf = Convert.ToDateTime(item["DataFine"]);

                        if (dti_o2.CompareTo(dti) > 0 && dti_o2.CompareTo(dtf) < 0)
                        {
                            valueshere["PeriodoPianificato"] = item["DataInizio"] + " - " + item["DataFine"];
                            break;
                        }
                    }

                    if (valueshere.Count == 0)
                    {
                        MessageBox.Show("Verifica per controllo contabile non trovata");
                    }
                    else
                    {
                        wl2.SetIntestazione(RagioneSociale, Indirizzo, CapitaleSociale, REA, "MEMORANDUM DELLA VERIFICA PERIODICA DEL ", valueshere);

                        string partial_rtf_text2 = "\\pard\\keepn\\f0 ";

                        partial_rtf_text2 += "\\trowd\\cellx9900 \\fs24 \\qc\\b ATTIVITA' DI CONTROLLO CONTABILE \\b0\\cell\\row";

                        string TestoHere2 = "L'organo di revisione procede alla verifica secondo la previsione dell'art.14, primo comma, lettera b), del D. Lgs. 27 Gennaio 2010 n° 39, in conformità al Principio di revisione SA Italia 250B.";

                        partial_rtf_text2 += "\\trowd\\cellx9900 \\qj " + TestoHere2 + " \\cell\\row";

                        TestoHere2         = "Per lo svolgimento delle attività di revisione e controllo viene utilizzata una procedura informatica che produce carte di lavoro, nelle quali vengono inseriti i dati tabellari raccolti nel corso della sessione, i commenti e le osservazioni annotati, nonché vengono allegati documenti in qualsiasi formato immateriale.";
                        partial_rtf_text2 += "\\trowd\\cellx9900 \\qj " + TestoHere2 + " \\cell\\row";

                        bool      esistepianificazione2 = false;
                        ArrayList al2 = mf.GetPianificazioniVerifiche(IDCliente);
                        foreach (Hashtable itemHT in al2)
                        {
                            string filedata = App.AppDataDataFolder + "\\" + itemHT["FileData"].ToString();
                            if ((new FileInfo(filedata)).Exists)
                            {
                                XmlDataProviderManager ALXTPP = new XmlDataProviderManager(filedata);

                                foreach (XmlNode itemXPP in ALXTPP.Document.SelectNodes("//Dato[@ID=\"100013\"]/Valore/Pianificazione"))
                                {
                                    if (itemXPP.Attributes["Data"].Value == cmbData.SelectedValue.ToString())
                                    {
                                        esistepianificazione2 = true;
                                        break;
                                    }
                                }
                            }

                            if (esistepianificazione2 == true)
                            {
                                break;
                            }
                        }

                        if (esistepianificazione2 == true)
                        {
                            //Inserisco il testo per la pianificazione
                            TestoHere2         = "L'attività di controllo è stata pianificata con la carta di lavoro denominata Pianificazione; la sessione avviata rientra fra quelle pianificate.";
                            partial_rtf_text2 += "\\trowd\\cellx9900 \\qj " + TestoHere2 + " \\line \\cell\\row";
                        }

                        if (rdbDescrittiva.IsChecked == true)
                        {
                            TestoHere2         = "Per economia di lavoro nel presente memorandum verrà dato conto delle carte di lavoro utilizzate dalle quali verranno estrapolati le sole osservazioni e i commenti; per i dati raccolti ed inseriti anche in forma tabellare si farà riferimento alle carte di lavoro, conservate con modalità informatica, che si intendono parte integrante del presente verbale. Parimenti i documenti raccolti vengono associati alle carte di lavoro e conservati in modalità informatiche.";
                            partial_rtf_text2 += "\\trowd\\cellx9900 \\qj " + TestoHere2 + " \\line \\cell\\row";
                        }

                        TestoHere2         = "Vengono eseguite le seguenti verifiche: \\line ";
                        partial_rtf_text2 += "\\trowd\\cellx9900 \\qj " + TestoHere2 + " \\cell\\row";

                        //   partial_rtf_text2 += "\\par\n";

                        wl2.InsertRtf(partial_rtf_text2);

                        printsingle(cliente, _t, (Convert.ToInt32(App.TipoFile.Verifica)).ToString(), wl2, valueshere["ID"].ToString(), IDCliente, "", valueshere["FileData"].ToString());
                    }

                    wl2.LastParagraph(valueshere);
                    wl2.SetFilename(App.AppTempFolder + "\\" + cliente["RagioneSociale"].ToString() + "_Memorandum_" + cmbData.SelectedValue.ToString().Replace("/", ""));
                    wl2.Save("");
                    wl2.Close();
                    #endregion
                }
            }
            else if (rdbMemorandum.IsChecked == true)
            {
                foreach (Hashtable item in mf.GetVerifiche(IDCliente))
                {
                    if (cmbData.SelectedValue.ToString() == (item["Data"].ToString()))
                    {
                        valueshere = item;
                        _t         = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["File"].ToString());
                    }
                }

                valueshere.Add("PeriodoPianificato", "");
                DateTime dti_o = Convert.ToDateTime(valueshere["Data"]);

                foreach (Hashtable item in mf.GetPianificazioniVerifiche(IDCliente))
                {
                    DateTime dti = Convert.ToDateTime(item["DataInizio"]);
                    DateTime dtf = Convert.ToDateTime(item["DataFine"]);

                    if (dti_o.CompareTo(dti) > 0 && dti_o.CompareTo(dtf) < 0)
                    {
                        valueshere["PeriodoPianificato"] = item["DataInizio"] + " - " + item["DataFine"];
                        break;
                    }
                }

                if (valueshere.Count == 0)
                {
                    MessageBox.Show("Verifica per controllo contabile non trovata");
                }
                else
                {
                    wl.SetIntestazione(RagioneSociale, Indirizzo, CapitaleSociale, REA, "MEMORANDUM DELLA VERIFICA PERIODICA DEL ", valueshere);

                    string partial_rtf_text = "\\pard\\keepn\\f0 ";

                    partial_rtf_text += "\\trowd\\cellx9900 \\fs24 \\qc\\b ATTIVITA' DI CONTROLLO CONTABILE \\b0\\cell\\row";

                    string TestoHere = "L'organo di revisione procede alla verifica secondo la previsione dell'art.14, primo comma, lettera b), del D. Lgs. 27 Gennaio 2010 n° 39, in conformità al Principio di revisione SA Italia 250B.";

                    partial_rtf_text += "\\trowd\\cellx9900 \\qj " + TestoHere + " \\cell\\row";

                    TestoHere         = "Per lo svolgimento delle attività di revisione e controllo viene utilizzata una procedura informatica che produce carte di lavoro, nelle quali vengono inseriti i dati tabellari raccolti nel corso della sessione, i commenti e le osservazioni annotati, nonché vengono allegati documenti in qualsiasi formato immateriale.";
                    partial_rtf_text += "\\trowd\\cellx9900 \\qj " + TestoHere + " \\cell\\row";

                    bool      esistepianificazione = false;
                    ArrayList al = mf.GetPianificazioniVerifiche(IDCliente);
                    foreach (Hashtable itemHT in al)
                    {
                        string filedata = App.AppDataDataFolder + "\\" + itemHT["FileData"].ToString();
                        if ((new FileInfo(filedata)).Exists)
                        {
                            XmlDataProviderManager ALXTPP = new XmlDataProviderManager(filedata);

                            foreach (XmlNode itemXPP in ALXTPP.Document.SelectNodes("//Dato[@ID=\"100013\"]/Valore/Pianificazione"))
                            {
                                if (itemXPP.Attributes["Data"].Value == cmbData.SelectedValue.ToString())
                                {
                                    esistepianificazione = true;
                                    break;
                                }
                            }
                        }

                        if (esistepianificazione == true)
                        {
                            break;
                        }
                    }

                    if (esistepianificazione == true)
                    {
                        //Inserisco il testo per la pianificazione
                        TestoHere         = "L'attività di controllo è stata pianificata con la carta di lavoro denominata Pianificazione; la sessione avviata rientra fra quelle pianificate.";
                        partial_rtf_text += "\\trowd\\cellx9900 \\qj " + TestoHere + " \\line \\cell\\row";
                    }

                    if (rdbDescrittiva.IsChecked == true)
                    {
                        TestoHere         = "Per economia di lavoro nel presente memorandum verrà dato conto delle carte di lavoro utilizzate dalle quali verranno estrapolati le sole osservazioni e i commenti; per i dati raccolti ed inseriti anche in forma tabellare si farà riferimento alle carte di lavoro, conservate con modalità informatica, che si intendono parte integrante del presente verbale. Parimenti i documenti raccolti vengono associati alle carte di lavoro e conservati in modalità informatiche.";
                        partial_rtf_text += "\\trowd\\cellx9900 \\qj " + TestoHere + " \\line \\cell\\row";
                    }

                    TestoHere         = "Vengono eseguite le seguenti verifiche: \\line ";
                    partial_rtf_text += "\\trowd\\cellx9900 \\qj " + TestoHere + " \\cell\\row";

                    // partial_rtf_text += "\\par\n";

                    wl.InsertRtf(partial_rtf_text);

                    printsingle(cliente, _t, (Convert.ToInt32(App.TipoFile.Verifica)).ToString(), wl, valueshere["ID"].ToString(), IDCliente, "", valueshere["FileData"].ToString());
                }
            }
            else
            {
                //pw.Close();
                return;
            }

            wl.LastParagraph(valueshere);
            string str;
            str = App.AppTempFolder + "\\" + cliente["RagioneSociale"].ToString() + "_VerbaleVerificaPeriodica_" + cmbData.SelectedValue.ToString().Replace("/", "");
            str = str.Replace("*", "_");
            wl.SetFilename(str);
            wl.Save("");
            wl.Close();

            //Process wait - STOP
            //pw.Close();
        }
Ejemplo n.º 6
0
        //private void RecursiveNode(XmlNode node, WordLib wl, XmlDataProviderManager _x, string IDTree, string IDSessione, string IDCliente)
        private void RecursiveNode(XmlNode node, RTFLib wl, XmlDataProviderManager _x, string IDTree, string IDSessione, string IDCliente, string AdditivaTitolo, string nomefile)
        {
            string str;

            try
            {
                if (node.Attributes["ID"].Value == "186")
                {
                    str = "186";
                }
                if ((node.Attributes["ID"].Value == "142" || node.Attributes["ID"].Value == "2016142") && IDTree == "3")
                {
                    return;
                }

                if (node.Attributes["ID"].Value == "142" && IDTree == "28")
                {
                    return;
                }

                if (node.Attributes["ID"].Value == "261" && IDTree == "19")
                {
                    return;
                }

                if (node.ChildNodes.Count == 1 || node.Attributes["Tipologia"].Value == "Nodo Multiplo")
                {
                    if (RecursiveCheck(node, IDTree))
                    {
                        wl.Add(node, IDCliente, IDTree, IDSessione, nomefile);
                    }
                }
                else
                {
                    if (node.ParentNode.Name == "Tree" || RecursiveCheck(node, IDTree))
                    {
                        wl.AddTitle(node.Attributes["Codice"].Value + " " + node.Attributes["Titolo"].Value + AdditivaTitolo, node.ParentNode.Name != "Tree");

                        foreach (XmlNode item in node.ChildNodes)
                        {
                            if (item.Name == "Node")
                            {
                                try
                                {
                                    RecursiveNode(item, wl, _x, IDTree, IDSessione, IDCliente, "", nomefile);
                                }
                                catch (Exception ex)
                                {
                                    cBusinessObjects.logger.Error(ex, "wStampaFascicolo.RecursiveNode1 exception");
                                    str = ex.Message;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                cBusinessObjects.logger.Error(ex, "wStampaFascicolo.RecursiveNode2 exception");
                str = ex.Message;
            }
        }
Ejemplo n.º 7
0
 //private void printsingle(Hashtable cliente, XmlDataProviderManager TreeXmlProvider, XmlDataProviderManager _x, string IDTree, WordLib wl, string IDSessione, string IDCliente)
 private void printsingle(Hashtable cliente, XmlDataProviderManager TreeXmlProvider, XmlDataProviderManager _x, string IDTree, RTFLib wl, string IDSessione, string IDCliente, string AdditivaTitolo, string nomefile)
 {
     selectedSession = IDSessione;
     RecursiveNode(TreeXmlProvider.Document.SelectSingleNode("/Tree/Node"), wl, _x, IDTree, IDSessione, IDCliente, AdditivaTitolo, nomefile);
 }
        public void generateTree()
        {
            _x.Save();

            RevisoftApplication.XmlManager x = new XmlManager();
            x.TipoCodifica = RevisoftApplication.XmlManager.TipologiaCodifica.Normale;
            MasterFile mf = MasterFile.Create();

            string SelectedTreeSource = App.AppTemplateTreeVigilanza;

            XmlDataProviderManager _xTXP = new XmlDataProviderManager(SelectedTreeSource);

            try
            {
                foreach (XmlNode item in _xTXP.Document.SelectNodes("/Tree//Node[@ID][@Codice][@Titolo]"))
                {
                    string isTitolo = "";

                    if (item.ChildNodes.Count > 0)
                    {
                        isTitolo = "Father=\"1\"";
                    }

                    if (_x.Document.SelectSingleNode("//Dato[@ID=\"100003\"]/Valore[@ID=\"" + item.Attributes["ID"].Value + "\"]") == null)
                    {
                        string xml = "<Valore ID=\"" + item.Attributes["ID"].Value + "\" " + isTitolo + " Codice=\"" + item.Attributes["Codice"].Value.Replace("&", "&amp;").Replace("\"", "'") + "\" Titolo=\"" + item.Attributes["Titolo"].Value.Replace("&", "&amp;").Replace("\"", "'") + "\" Checked=\"False\" />";

                        XmlDocument doctmp = new XmlDocument();
                        doctmp.LoadXml(xml);

                        XmlNode tmpNode = doctmp.SelectSingleNode("/Valore");
                        XmlNode cliente = _x.Document.ImportNode(tmpNode, true);

                        _x.Document.SelectSingleNode("//Dato[@ID=\"100003\"]").AppendChild(cliente);
                    }
                    else
                    {
                        //già creato l'albero, non viene aggiornato
                        return;

                        //XmlNode itemhere = _x.Document.SelectSingleNode( "//Dato[@ID=\"100003\"]" ).SelectSingleNode( "//Valore[@ID=\"" + item.Attributes["ID"].Value + "\"]" );
                        //itemhere.Attributes["Codice"].Value = item.Attributes["Codice"].Value;
                        //itemhere.Attributes["Titolo"].Value = item.Attributes["Titolo"].Value;
                    }
                }

                //foreach ( XmlNode item in _x.Document.SelectSingleNode( "//Dato[@ID=\"100003\"]" ).SelectNodes("//Valore"))
                //{
                //    foreach ( DictionaryEntry itemS in htSessioni )
                //    {
                //        if ( item.SelectSingleNode( "//Valore[@ID=\"" + item.Attributes["ID"].Value + "\"]/Pianificazione[@Data=\"" + itemS.Value.ToString() + "\"]" ) == null )
                //        {
                //            string xml = "<Pianificazione ID=\"" + itemS.Key.ToString() + "\" Data=\"" + itemS.Value.ToString() + "\" />";

                //            XmlDocument doctmp = new XmlDocument();
                //            doctmp.LoadXml( xml );

                //            XmlNode tmpNode = doctmp.SelectSingleNode( "/Pianificazione" );
                //            XmlNode cliente = item.OwnerDocument.ImportNode( tmpNode, true );

                //            item.AppendChild( cliente );
                //        }

                //        if ( item.SelectSingleNode( "//Valore[@ID=\"" + item.Attributes["ID"].Value + "\"]/Pianificazione[@Data=\"" + itemS.Value.ToString() + "\"]" ).Attributes["OK"] == null )
                //        {
                //            XmlAttribute attr = item.OwnerDocument.CreateAttribute( "OK" );
                //            item.SelectSingleNode( "//Valore[@ID=\"" + item.Attributes["ID"].Value + "\"]/Pianificazione[@Data=\"" + itemS.Value.ToString() + "\"]" ).Attributes.Append( attr );
                //        }

                //        if ( item.SelectSingleNode( "//Valore[@ID=\"" + item.Attributes["ID"].Value + "\"]/Pianificazione[@Data=\"" + itemS.Value.ToString() + "\"]" ).Attributes["Checked"] == null )
                //        {
                //            XmlAttribute attr = item.OwnerDocument.CreateAttribute( "Checked" );
                //            item.SelectSingleNode( "//Valore[@ID=\"" + item.Attributes["ID"].Value + "\"]/Pianificazione[@Data=\"" + itemS.Value.ToString() + "\"]" ).Attributes.Append( attr );
                //        }
                //    }

                //    //foreach ( XmlNode itemOK in item.SelectNodes( "//Pianificazione" ) )
                //    //{
                //    //    if ( itemOK.Attributes["OK"] == null )
                //    //    {
                //    //        itemOK.ParentNode.RemoveChild( itemOK );
                //    //    }
                //    //}
                //}
            }
            catch (Exception ex)
            {
                cBusinessObjects.logger.Error(ex, "wSchedaSessioniPianificazioniVigilanzeOLD.generateTree exception");
                string log = ex.Message;
            }

            _x.Save();
        }
Ejemplo n.º 9
0
        private void buttonApri_Click(object sender, RoutedEventArgs e)
        {
            MasterFile mf = MasterFile.Create();
            string     selectedSession      = "-1";
            string     selectedSessionTitle = "";

            foreach (object item in stpSessioniISQC.Children)
            {
                if (item.GetType().Name == "RadioButton")
                {
                    if (((RadioButton)(item)).IsChecked == true)
                    {
                        selectedSession      = ((RadioButton)(item)).Tag.ToString();
                        selectedSessionTitle = ((RadioButton)(item)).Content.ToString();
                    }
                }
            }

            if (selectedSession == "-1")
            {
                e.Handled = true;
                return;
            }

            Hashtable ht = mf.GetISQC(selectedSession);

            XmlDataProviderManager _xNew = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + ht["FileData"].ToString());

            WindowWorkArea wa = new WindowWorkArea(ref _xNew);

            //Nodi
            wa.NodeHome = 0;

            RevisoftApplication.XmlManager xt = new XmlManager();
            xt.TipoCodifica = RevisoftApplication.XmlManager.TipologiaCodifica.Normale;
            XmlDataProvider TreeXmlProvider = new XmlDataProvider();

            TreeXmlProvider.Document = xt.LoadEncodedFile(App.AppDataDataFolder + "\\" + ht["File"].ToString());

            if (TreeXmlProvider.Document != null && TreeXmlProvider.Document.SelectSingleNode("/Tree") != null)
            {
                foreach (XmlNode item in TreeXmlProvider.Document.SelectNodes("/Tree//Node"))
                {
                    switch (((App.TipoAttivita)(Convert.ToInt32(_IDTree))))
                    {
                    case App.TipoAttivita.Revisione:
                        if (item.Attributes["ID"].Value == "181")
                        {
                            wa.Nodes.Add(0, item);
                        }
                        break;

                    case App.TipoAttivita.Bilancio:
                        if (item.Attributes["ID"].Value == "182")
                        {
                            wa.Nodes.Add(0, item);
                        }
                        break;

                    case App.TipoAttivita.Conclusione:
                        if (item.Attributes["ID"].Value == "183")
                        {
                            wa.Nodes.Add(0, item);
                        }
                        break;

                    case App.TipoAttivita.Verifica:
                        if (item.Attributes["ID"].Value == "185")
                        {
                            wa.Nodes.Add(0, item);
                        }
                        break;

                    default:
                        e.Handled = true;
                        return;
                    }
                }
            }

            if (wa.Nodes.Count == 0)
            {
                e.Handled = true;
                return;
            }

            wa.NodeNow = wa.NodeHome;

            wa.Owner = Window.GetWindow(this);

            //posizione e dimensioni finestra
            wa.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            wa.Height    = System.Windows.SystemParameters.PrimaryScreenHeight * 90.0 / 100.0;
            wa.Width     = System.Windows.SystemParameters.PrimaryScreenWidth * 90.0 / 100.0;
            wa.MaxHeight = System.Windows.SystemParameters.PrimaryScreenHeight * 90.0 / 100.0;
            wa.MaxWidth  = System.Windows.SystemParameters.PrimaryScreenWidth * 90.0 / 100.0;
            wa.MinHeight = System.Windows.SystemParameters.PrimaryScreenHeight * 90.0 / 100.0;
            wa.MinWidth  = System.Windows.SystemParameters.PrimaryScreenWidth * 90.0 / 100.0;

            //Sessioni
            wa.Sessioni.Clear();
            wa.Sessioni.Add(0, App.AppDataDataFolder + "\\" + ht["FileData"].ToString());

            wa.SessioniTitoli.Clear();
            wa.SessioniTitoli.Add(0, selectedSessionTitle);

            wa.SessioniID.Clear();
            wa.SessioniID.Add(0, selectedSession);

            wa.SessioneHome = 0;
            wa.SessioneNow  = 0;

            //Variabili
            wa.ReadOnly            = true;
            wa.ReadOnlyOLD         = true;
            wa.ApertoInSolaLettura = true;

            //passaggio dati
            wa.IDTree     = "28";
            wa.IDSessione = selectedSession;
            wa.IDCliente  = _IDCliente;

            wa.Stato        = App.TipoTreeNodeStato.Sconosciuto;
            wa.OldStatoNodo = wa.Stato;

            //apertura
            wa.Load();

            App.MessaggioSolaScrittura      = "Carta in sola lettura, premere tasto ESCI";
            App.MessaggioSolaScritturaStato = "Carta in sola lettura, premere tasto ESCI";

            wa.ShowDialog();

            App.MessaggioSolaScrittura      = "Occorre selezionare Sblocca Stato per modificare il contenuto.";
            App.MessaggioSolaScritturaStato = "Sessione in sola lettura, impossibile modificare lo stato.";

            base.Close();
        }
Ejemplo n.º 10
0
        public void LoadDataSource(ref XmlDataProviderManager x, string ID)
        {
            _x = x;

            CheckList.Load(ID, cBusinessObjects.idcliente.ToString(), cBusinessObjects.idsessione.ToString());
        }
Ejemplo n.º 11
0
        //------------------------------------------------------------------------+
        //                             GetNodeString                              |
        //------------------------------------------------------------------------+
        static public string GetNodeString(string albero, string sessione, string nodo)
        {
            MasterFile mf;
            Hashtable  ht;
            string     file, returnvalue;

            mf          = MasterFile.Create();
            file        = string.Empty;
            returnvalue = string.Empty;
            switch ((App.TipoFile)(System.Convert.ToInt32(albero)))
            {
            case App.TipoFile.Revisione:
                ht   = mf.GetRevisione(sessione);
                file = (ht.Contains("File")) ?
                       ht["File"].ToString() : App.AppTemplateTreeRevisione;
                break;

            case App.TipoFile.Verifica:
                ht   = mf.GetVerifica(sessione);
                file = (ht.Contains("File")) ?
                       ht["File"].ToString() : App.AppTemplateTreeVerifica;
                break;

            case App.TipoFile.Vigilanza:
                ht   = mf.GetVigilanza(sessione);
                file = (ht.Contains("File")) ?
                       ht["File"].ToString() : App.AppTemplateTreeVigilanza;
                break;

            case App.TipoFile.Incarico:
            case App.TipoFile.IncaricoCS:
            case App.TipoFile.IncaricoSU:
            case App.TipoFile.IncaricoREV:
                ht   = mf.GetIncarico(sessione);
                file = (ht.Contains("File")) ?
                       ht["File"].ToString() : App.AppTemplateTreeIncarico;
                break;

            case App.TipoFile.ISQC:
                ht   = mf.GetISQC(sessione);
                file = (ht.Contains("File")) ?
                       ht["File"].ToString() : App.AppTemplateTreeISQC;
                break;

            case App.TipoFile.Bilancio:
                ht   = mf.GetBilancio(sessione);
                file = (ht.Contains("File")) ?
                       ht["File"].ToString() : App.AppTemplateTreeBilancio;
                break;

            case App.TipoFile.Conclusione:
                ht   = mf.GetConclusione(sessione);
                file = (ht.Contains("File")) ?
                       ht["File"].ToString() : App.AppTemplateTreeConclusione;
                break;

            default:
                break;
            }
            XmlDataProviderManager _y = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + file);
            XmlNode node = _y.Document.SelectSingleNode("//Tree//Node[@ID='" + nodo + "']");

            if (node != null)
            {
                returnvalue = node.Attributes["Codice"].Value + " " + node.Attributes["Titolo"].Value;
            }
            return(returnvalue);
        }
Ejemplo n.º 12
0
        private void LoadDataSource()
        {
            _x = new XmlDataProviderManager(SelectedDataSource);

            RevisoftApplication.XmlManager x = new XmlManager();
            x.TipoCodifica = RevisoftApplication.XmlManager.TipologiaCodifica.Normale;

            XmlDocument tmpDoc = x.LoadEncodedFile(SelectedDataSource);

            Utilities u = new Utilities();

            if (!u.CheckXmlDocument(tmpDoc, App.TipoFile.Formulario, "Data"))
            {
                this.Close();
                return;
            }

            foreach (XmlNode node in tmpDoc.SelectNodes("/Dati//Dato"))
            {
                XmlNode nodeTree = TreeXmlProvider.Document.SelectSingleNode("/Tree//Node[@ID=" + node.Attributes["ID"].Value + "]");

                if (nodeTree != null)
                {
                    string estensione = "";
                    string file       = "";
                    string image      = ".\\Images\\icone\\Stato\\nothing.png";

                    try
                    {
                        estensione = node.SelectSingleNode("Valore").Attributes["NomeFile"].Value.Split('.').Last();
                        file       = node.SelectSingleNode("Valore").Attributes["NomeFile"].Value.Replace("ruf\\", "");
                        string pathfile = App.AppFormularioFolder + "\\" + file;
                        if (!(new FileInfo(pathfile)).Exists)
                        {
                            estensione = "";
                            file       = "";
                        }
                    }
                    catch (Exception ex)
                    {
                        cBusinessObjects.logger.Error(ex, "wFormulario.LoadDataSource exception");
                        string log = ex.Message;
                    }

                    switch (estensione)
                    {
                    case "doc":
                    case "docx":
                        image = ".\\Images\\icone\\Documenti\\word.png";
                        break;

                    case "pdf":
                        image = ".\\Images\\icone\\Documenti\\pdf.png";
                        break;

                    case "xls":
                    case "xlsx":
                        image = ".\\Images\\icone\\Documenti\\excel.png";
                        break;

                    case "zip":
                        image = ".\\Images\\icone\\Documenti\\zip.png";
                        break;

                    default:
                        image = ".\\Images\\icone\\Documenti\\nothing.png";
                        break;
                    }

                    try
                    {
                        nodeTree.Attributes["TipoDocumento"].Value = image;
                    }
                    catch (Exception ex)
                    {
                        cBusinessObjects.logger.Error(ex, "wFormulario.CreateAttributeTipoDocumento exception");
                        string       log  = ex.Message;
                        XmlAttribute attr = nodeTree.OwnerDocument.CreateAttribute("TipoDocumento");
                        attr.Value = image;
                        nodeTree.Attributes.Append(attr);
                    }

                    try
                    {
                        nodeTree.Attributes["NomeFile"].Value = file;
                    }
                    catch (Exception ex)
                    {
                        cBusinessObjects.logger.Error(ex, "wFormulario.CreateAttributeNomeFile exception");
                        string       log  = ex.Message;
                        XmlAttribute attr = nodeTree.OwnerDocument.CreateAttribute("NomeFile");
                        attr.Value = file;
                        nodeTree.Attributes.Append(attr);
                    }
                }
            }
        }
Ejemplo n.º 13
0
        //----------------------------------------------------------------------------+
        //                                   Clone                                    |
        //----------------------------------------------------------------------------+
        public XmlDataProviderManager Clone()
        {
            XmlDataProviderManager newxdpm = new XmlDataProviderManager(nameFile);

            return(newxdpm);
        }
Ejemplo n.º 14
0
        //----------------------------------------------------------------------------+
        //                               LoadTreeSource                               |
        //----------------------------------------------------------------------------+

        public void LoadTreeSource()
        {
            if (Data == "")
            {
                Data = DateTime.Now.ToShortDateString();
            }
            ArrayList pianificatehere = new ArrayList();

            txtData.Text = Data;
            RevisoftApplication.XmlManager x = new XmlManager();
            x.TipoCodifica = RevisoftApplication.XmlManager.TipologiaCodifica.Normale;
            MasterFile mf    = MasterFile.Create();
            ArrayList  files = new ArrayList();

            switch (TipoAttivita)
            {
            case App.TipoAttivita.Incarico:
                SelectedTreeSource = App.AppTemplateTreeIncarico;
                files = mf.GetIncarichi(IDCliente);
                break;

            case App.TipoAttivita.ISQC:
                SelectedTreeSource = App.AppTemplateTreeISQC;
                files = mf.GetISQCs(IDCliente);
                break;

            case App.TipoAttivita.Revisione:
                SelectedTreeSource = App.AppTemplateTreeRevisione;
                files = mf.GetRevisioni(IDCliente);
                break;

            case App.TipoAttivita.Bilancio:
                SelectedTreeSource = App.AppTemplateTreeBilancio;
                files = mf.GetBilanci(IDCliente);
                break;

            case App.TipoAttivita.Conclusione:
                SelectedTreeSource = App.AppTemplateTreeConclusione;
                files = mf.GetConclusioni(IDCliente);
                break;

            case App.TipoAttivita.Verifica:
                files = mf.GetVerifiche(IDCliente);
                SelectedTreeSource = App.AppTemplateTreeVerifica;
                ArrayList al = mf.GetPianificazioniVerifiche(IDCliente);
                foreach (Hashtable itemHT in al)
                {
                    ALXTPP.Add(itemHT["ID"].ToString());
                }
                break;

            case App.TipoAttivita.Vigilanza:
                files = mf.GetVigilanze(IDCliente);
                SelectedTreeSource = App.AppTemplateTreeVigilanza;
                ArrayList al2 = mf.GetPianificazioniVigilanze(IDCliente);
                foreach (Hashtable itemHT in al2)
                {
                    ALXTPP.Add(itemHT["ID"].ToString());
                }
                break;

            default:
                return;
            }
            if (files.Count > 0)
            {
                string   maxID = "0", id;
                DateTime lastdate = Convert.ToDateTime("01/01/1900");
                string   tobeused = "";
                foreach (Hashtable itemHT in files)
                {
                    if (itemHT.Contains("ID"))
                    {
                        id = itemHT["ID"].ToString();
                        if (Convert.ToInt32(id) > Convert.ToInt32(maxID))
                        {
                            maxID = id; tobeused = itemHT["File"].ToString();
                        }
                    }
                }
                _xTXP = new XmlDataProviderManager(tobeused);
                TreeXmlProvider.Document = x.LoadEncodedFile(tobeused);
            }
            else
            {
                _xTXP = new XmlDataProviderManager(SelectedTreeSource);
                TreeXmlProvider.Document = x.LoadEncodedFile(SelectedTreeSource);
            }
            if (firsttime)
            {
                firsttime = false;
                foreach (XmlNode item in _xTXP.Document.SelectNodes("//Node"))
                {
                    if (item.Attributes["WidthNota"] == null)
                    {
                        XmlAttribute attr = _xTXP.Document.CreateAttribute("WidthNota");
                        item.Attributes.Append(attr);
                    }
                    if (item.SelectNodes("Node").Count > 0)
                    {
                        item.Attributes["WidthNota"].Value = "0";
                    }
                    else
                    {
                        item.Attributes["WidthNota"].Value = "Auto";
                    }
                    if (item.Attributes["Checked"] == null)
                    {
                        XmlAttribute attr = _xTXP.Document.CreateAttribute("Checked");
                        item.Attributes.Append(attr);
                        item.Attributes["Checked"].Value = "False";
                    }
                    if (item.Attributes["NotaTDL"] == null)
                    {
                        XmlAttribute attr = _xTXP.Document.CreateAttribute("NotaTDL");
                        item.Attributes.Append(attr);
                        item.Attributes["NotaTDL"].Value = "";
                    }
                    item.Attributes["Expanded"].Value = "True";
                    item.Attributes["Selected"].Value = "False";
                    if (item.Attributes["Pianificato"] == null)
                    {
                        XmlAttribute attr = item.OwnerDocument.CreateAttribute("Pianificato");
                        attr.Value = "";
                        item.Attributes.Append(attr);
                    }
                    DataTable pianificazione        = null;
                    DataTable pianificazioneTestata = null;
                    foreach (string ALitemXTPP in ALXTPP)
                    {
                        bool   donehere = false;
                        string IDPHERE  = "";
                        string datac    = "";

                        if (TipoAttivita == App.TipoAttivita.Verifica)
                        {
                            IDPHERE = "100013";
                            pianificazioneTestata = cBusinessObjects.GetData(int.Parse(IDPHERE), typeof(PianificazioneVerificheTestata), int.Parse(IDCliente), int.Parse(ALitemXTPP), 26);
                            pianificazione        = cBusinessObjects.GetData(int.Parse(IDPHERE), typeof(PianificazioneVerifiche), int.Parse(IDCliente), int.Parse(ALitemXTPP), 26);
                        }
                        else
                        {
                            IDPHERE = "100003";
                            pianificazioneTestata = cBusinessObjects.GetData(int.Parse(IDPHERE), typeof(PianificazioneVerificheTestata), int.Parse(IDCliente), int.Parse(ALitemXTPP), 27);

                            pianificazione = cBusinessObjects.GetData(int.Parse(IDPHERE), typeof(PianificazioneVerifiche), int.Parse(IDCliente), int.Parse(ALitemXTPP), 27);
                        }
                        foreach (DataRow itemXPP in pianificazione.Rows)
                        {
                            if (itemXPP["NODE_ID"].ToString() != item.Attributes["ID"].Value)
                            {
                                continue;
                            }
                            foreach (DataRow dd in pianificazioneTestata.Rows)
                            {
                                if (dd["ID"].ToString() == itemXPP["PianificazioneID"].ToString())
                                {
                                    datac = dd["Data"].ToString();
                                }
                            }
                            if (datac != Data)
                            {
                                continue;
                            }
                            if (itemXPP["Checked"].ToString() == "True")
                            {
                                item.Attributes["Pianificato"].Value = "P";
                                item.Attributes["Checked"].Value     = "True";
                                StaticUtilities.MarkNodeAsModified(item, App.OBJ_MOD); _isModified = true;
                                pianificatehere.Add(item.Attributes["ID"].Value);
                                break;
                            }
                        }
                        if (donehere)
                        {
                            break;
                        }
                    }
                }
                _xTXP.Save();

                foreach (XmlNode item in TreeXmlProvider.Document.SelectNodes("//Node"))
                {
                    if (item.Attributes["NotaTDL"] == null)
                    {
                        XmlAttribute attr = TreeXmlProvider.Document.CreateAttribute("NotaTDL");
                        item.Attributes.Append(attr);
                        item.Attributes["NotaTDL"].Value = "";
                    }
                    if (item.Attributes["Checked"] == null)
                    {
                        XmlAttribute attr = TreeXmlProvider.Document.CreateAttribute("Checked");
                        item.Attributes.Append(attr);
                        item.Attributes["Checked"].Value = "False";
                    }
                    if (item.Attributes["Pianificato"] == null)
                    {
                        XmlAttribute attr = TreeXmlProvider.Document.CreateAttribute("Pianificato");
                        item.Attributes.Append(attr);
                        item.Attributes["Pianificato"].Value = "";
                    }
                    if (pianificatehere.Contains(item.Attributes["ID"].Value))
                    {
                        item.Attributes["Pianificato"].Value = "P";
                    }
                    if (item.Attributes["WidthNota"] == null)
                    {
                        XmlAttribute attr = TreeXmlProvider.Document.CreateAttribute("WidthNota");
                        item.Attributes.Append(attr);
                    }
                    if (item.SelectNodes("Node").Count > 0)
                    {
                        item.Attributes["WidthNota"].Value = "0";
                    }
                    else
                    {
                        item.Attributes["WidthNota"].Value = "Auto";
                    }
                    if (item.Attributes["Pianificato"].Value == "P")
                    {
                        item.Attributes["Checked"].Value = "True";
                        //item.Attributes["NotaTDL"].Value = "";
                    }
                    StaticUtilities.MarkNodeAsModified(item, App.OBJ_MOD); _isModified = true;
                }
            }
            Utilities u = new Utilities();

            labelAttivita.Content = u.TitoloAttivita(_TipoAttivita);
            TreeXmlProvider.Refresh();
            LoadDataSource();
        }
Ejemplo n.º 15
0
        public void LoadDataSource(ref XmlDataProviderManager x, string ID, string tab, XmlNodeList xnl, Hashtable Sessioni, int SessioneNow, string _IDTree)
        {
            _x = x;

            NodoMultiplo.Load(ref _x, ID, tab, xnl, Sessioni, SessioneNow, _IDTree, new Hashtable(), new Hashtable(), "", "");
        }
Ejemplo n.º 16
0
        //private void functionCmbClientiChanged(ComboBox cmb)
        //{
        //	cmbData.SelectedIndex = -1;

        //	if (cmb.SelectedIndex != -1)
        //	{
        //		try
        //		{
        //			string IDCliente = htClienti[cmb.SelectedIndex].ToString();

        //			OldSelectedCmbClienti = Convert.ToInt32(IDCliente);

        //			MasterFile mf = MasterFile.Create();

        //			int index = 0;
        //			htDate.Clear();
        //			cmbData.Items.Clear();

        //			List<KeyValuePair<string, string>> myList = new List<KeyValuePair<string, string>>();

        //			ArrayList alreadydone = new ArrayList();

        //			foreach (Hashtable item in mf.GetBilanci(IDCliente))
        //			{
        //				myList.Add(new KeyValuePair<string, string>(item["ID"].ToString(), ConvertDataToEsercizio(item["Data"].ToString())));
        //				alreadydone.Add(ConvertDataToEsercizio(item["Data"].ToString()));
        //			}

        //			foreach (Hashtable item in mf.GetRevisioni(IDCliente))
        //			{
        //				if (!alreadydone.Contains(ConvertDataToEsercizio(item["Data"].ToString())))
        //				{
        //					myList.Add(new KeyValuePair<string, string>(item["ID"].ToString(), ConvertDataToEsercizio(item["Data"].ToString())));
        //                          alreadydone.Add( ConvertDataToEsercizio( item["Data"].ToString() ) );
        //				}
        //			}

        //                  foreach ( Hashtable item in mf.GetConclusioni( IDCliente ) )
        //                  {
        //                      if ( !alreadydone.Contains( ConvertDataToEsercizio( item["Data"].ToString() ) ) )
        //                      {
        //                          myList.Add( new KeyValuePair<string, string>( item["ID"].ToString(), ConvertDataToEsercizio( item["Data"].ToString() ) ) );
        //                      }
        //                  }

        //			myList.Sort
        //			(
        //				delegate(KeyValuePair<string, string> firstPair, KeyValuePair<string, string> nextPair)
        //				{
        //					try
        //					{
        //						return nextPair.Value.ToString().CompareTo(firstPair.Value.ToString());
        //					}
        //					catch (Exception ex)
        //					{
        //						string log = ex.Message;
        //						return 1;
        //					}
        //				}
        //			);

        //			foreach (KeyValuePair<string, string> item in myList)
        //			{
        //				cmbData.Items.Add(item.Value);
        //				htDate.Add(index, item.Key);
        //				index++;
        //			}
        //		}
        //		catch (Exception ex)
        //		{
        //			string log = ex.Message;
        //			cmbData.IsEnabled = false;
        //		}
        //	}
        //}

        private void buttonStampa_Click(object sender, RoutedEventArgs e)
        {
            //controllo selezione clienti
            if (cmbClienti.SelectedIndex == -1)
            {
                MessageBox.Show("selezionare un cliente");
                return;
            }

            //Adesso stampa selettivamente o 1/ISQC o 2/3/9 (Borelli 11/12/2017)
            //if (cmbData.SelectedIndex == -1)
            //{
            //    MessageBox.Show("selezionare un anno");
            //    return;
            //}
            Hide();
            ArrayList TBD1 = new ArrayList();

#pragma warning disable CS0219 // La variabile è assegnata, ma il suo valore non viene mai usato
            bool atleastone = false;
#pragma warning restore CS0219 // La variabile è assegnata, ma il suo valore non viene mai usato

            foreach (object item in stpSessioni1.Children)
            {
                if (item.GetType().Name == "CheckBox")
                {
                    if (((CheckBox)(item)).Tag.ToString() == "-1")
                    {
                        continue;
                    }

                    if (((CheckBox)(item)).IsChecked == true)
                    {
                        atleastone = true;
                        TBD1.Add(((CheckBox)(item)).Tag.ToString());
                    }
                }
            }

            //if (cmbData.SelectedIndex == -1 && atleastone == false)
            //{
            //    MessageBox.Show("selezionare almeno un incarico o esercizio");
            //    return;
            //}



            try
            {
                MasterFile mf = MasterFile.Create();

                string IDCliente = htClienti[cmbClienti.SelectedIndex].ToString();

                string anno = "";
                if (cmbData.SelectedIndex != -1)
                {
                    anno = cmbData.SelectedValue.ToString().Split(' ')[0];
                }
                selectedCliente = IDCliente;
                Hashtable cliente = mf.GetAnagrafica(Convert.ToInt32(IDCliente));

                //WordLib wl = new WordLib();
                RTFLib wl = new RTFLib();

                wl.Fascicolo = true;
                wl.StampaLetteraAttestazione         = false;
                wl.StampaManagementLetter            = false;
                wl.StampaLetteraIncarico             = false;
                wl.StampaRelazioneBilancioeVigilanza = false;
                wl.StampaRelazioneBilancio           = false;
                wl.StampaRelazioneVigilanza          = false;
                wl.StampaRelazioneGenerica           = false;
                wl.Utente = txtRevisore.Text;

                Hashtable hthere = new Hashtable();
                hthere.Add("ID", IDCliente);
                hthere.Add("anno", anno);

                wl.TemplateFileCompletePath = App.AppTemplateStampa;
                if (cmbData.SelectedIndex != -1)
                {
                    wl.Open(hthere, cliente["RagioneSociale"].ToString(), cliente["CodiceFiscale"].ToString(), cmbData.SelectedValue.ToString(), "Fascicolo della Revisione \\line\\line esercizio " + cmbData.SelectedValue.ToString() + " \\line\\line\\line\\line\\line\\line\\line\\line ", true, true, IDCliente);
                }
                else
                {
                    wl.Open(hthere, cliente["RagioneSociale"].ToString(), cliente["CodiceFiscale"].ToString(), "", "Fascicolo della Revisione \\line\\line Accettazione Incarico \\line\\line\\line\\line\\line\\line\\line\\line ", true, true, IDCliente);
                }

                foreach (Hashtable htTBD in alIncarichi)
                {
                    if (TBD1.Contains(htTBD["ID"].ToString()))
                    {
                        XmlDataProviderManager _t = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + htTBD["File"].ToString());
                        XmlDataProviderManager _x = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + htTBD["FileData"].ToString());

                        printsingle(cliente, _t, _x, (Convert.ToInt32(App.TipoFile.Incarico)).ToString(), wl, htTBD["ID"].ToString(), IDCliente, " ( Sessione: " + htTBD["DataNomina"].ToString() + " )", htTBD["FileData"].ToString());
                    }
                }

                foreach (Hashtable htTBD in alISQCs)
                {
                    if (TBD1.Contains(htTBD["ID"].ToString()))
                    {
                        XmlDataProviderManager _t = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + htTBD["File"].ToString());
                        XmlDataProviderManager _x = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + htTBD["FileData"].ToString());

                        printsingle(cliente, _t, _x, (Convert.ToInt32(App.TipoFile.ISQC)).ToString(), wl, htTBD["ID"].ToString(), IDCliente, " ( Sessione: " + htTBD["DataNomina"].ToString() + " )", htTBD["FileData"].ToString());
                    }
                }

                if (cmbData.SelectedIndex == -1)// && atleastone == false)
                {
                    ;
                }
                else
                {
                    foreach (Hashtable item in mf.GetRevisioni(IDCliente))
                    {
                        try
                        {
                            if (cmbData.SelectedValue != null && item != null && item["Data"] != null && cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["Data"].ToString()))
                            {
                                XmlDataProviderManager _t = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["File"].ToString());
                                XmlDataProviderManager _x = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["FileData"].ToString());

                                printsingle(cliente, _t, _x, (Convert.ToInt32(App.TipoFile.Revisione)).ToString(), wl, item["ID"].ToString(), IDCliente, "", item["FileData"].ToString());
                                break;
                            }
                        }
                        catch (Exception ex)
                        {
                            cBusinessObjects.logger.Error(ex, "wStampaFascicolo.buttonStampa_Click1 exception");
                            MessageBox.Show("Attenzione, errore nei dati sulle revisioni verificare la stampa");
                            break;
                        }
                    }

                    foreach (Hashtable item in mf.GetBilanci(IDCliente))
                    {
                        try
                        {
                            if (cmbData.SelectedValue != null && item != null && item["Data"] != null && cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["Data"].ToString()))
                            {
                                XmlDataProviderManager _t = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["File"].ToString());
                                XmlDataProviderManager _x = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["FileData"].ToString());

                                printsingle(cliente, _t, _x, (Convert.ToInt32(App.TipoFile.Bilancio)).ToString(), wl, item["ID"].ToString(), IDCliente, "", item["FileData"].ToString());
                                break;
                            }
                        }
                        catch (Exception ex)
                        {
                            cBusinessObjects.logger.Error(ex, "wStampaFascicolo.buttonStampa_Click2 exception");
                            MessageBox.Show("Attenzione, errore nei dati sui bilanci verificare la stampa");
                            break;
                        }
                    }

                    foreach (Hashtable item in mf.GetConclusioni(IDCliente))
                    {
                        try
                        {
                            if (cmbData.SelectedValue != null && item != null && item["Data"] != null && cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["Data"].ToString()))
                            {
                                XmlDataProviderManager _t = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["File"].ToString());
                                XmlDataProviderManager _x = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["FileData"].ToString());

                                printsingle(cliente, _t, _x, (Convert.ToInt32(App.TipoFile.Conclusione)).ToString(), wl, item["ID"].ToString(), IDCliente, "", item["FileData"].ToString());
                                break;
                            }
                        }
                        catch (Exception ex)
                        {
                            cBusinessObjects.logger.Error(ex, "wStampaFascicolo.buttonStampa_Click3 exception");
                            MessageBox.Show("Attenzione, errore nei dati sulle conclusioni verificare la stampa");
                            break;
                        }
                    }
                }

                wl.SetFilename(App.AppTempFolder + "\\" + cliente["RagioneSociale"].ToString() + "_Fascicolo_" + anno);
                wl.SavePDF("", this);
                wl.Close();
            }
            catch (Exception ex)
            {
                cBusinessObjects.logger.Error(ex, "wStampaFascicolo.buttonStampa_Click4 exception");
                string log = ex.Message;
                MessageBox.Show("Attenzione, il processo ha riscontrato un errore: " + log);
            }
        }
Ejemplo n.º 17
0
        public void LoadDataSource(ref XmlDataProviderManager x, string ID, string _IDTree, string IDCliente, string IDSessione)
        {
            _x = x;

            Tabella.Load(ID, "", _IDTree, "", IDCliente, IDSessione);
        }
Ejemplo n.º 18
0
        private void buttonStampa_Click(object sender, RoutedEventArgs e)
        {
            //controllo selezione clienti
            if (cmbClienti.SelectedIndex == -1)
            {
                MessageBox.Show("selezionare un cliente");
                return;
            }

            if (cmbData.SelectedIndex == -1)
            {
                MessageBox.Show("selezionare un esercizio");
                return;
            }

            MasterFile mf = MasterFile.Create();

            string IDCliente = htClienti[cmbClienti.SelectedIndex].ToString();

            string anno = cmbData.SelectedValue.ToString().Split(' ')[0];

            Hashtable cliente = mf.GetAnagrafica(Convert.ToInt32(IDCliente));

            ArrayList NodiDaCompletare = new ArrayList();

            foreach (Hashtable item in mf.GetIncarichi(IDCliente))
            {
                if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["DataNomina"].ToString()))
                {
                    XmlDataProviderManager _t = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["File"].ToString());
                    XmlDataProviderManager _x = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["FileData"].ToString());

                    XmlNodeList NodeList = _x.Document.SelectNodes("/Dati//Dato");

                    foreach (XmlNode nodo in NodeList)
                    {
                        if (nodo.Attributes["Stato"] != null && nodo.Attributes["Stato"].Value == (Convert.ToInt32(App.TipoTreeNodeStato.DaCompletare)).ToString())
                        {
                            XmlNode nodotree = _t.Document.SelectSingleNode("/Tree//Node[@ID='" + nodo.Attributes["ID"].Value + "']");
                            NodiDaCompletare.Add(nodotree.Attributes["Codice"].Value);
                        }
                    }
                }
            }

            foreach (Hashtable item in mf.GetISQCs(IDCliente))
            {
                if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["DataNomina"].ToString()))
                {
                    XmlDataProviderManager _t = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["File"].ToString());
                    XmlDataProviderManager _x = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["FileData"].ToString());

                    XmlNodeList NodeList = _x.Document.SelectNodes("/Dati//Dato");

                    foreach (XmlNode nodo in NodeList)
                    {
                        if (nodo.Attributes["Stato"] != null && nodo.Attributes["Stato"].Value == (Convert.ToInt32(App.TipoTreeNodeStato.DaCompletare)).ToString())
                        {
                            XmlNode nodotree = _t.Document.SelectSingleNode("/Tree//Node[@ID='" + nodo.Attributes["ID"].Value + "']");
                            NodiDaCompletare.Add(nodotree.Attributes["Codice"].Value);
                        }
                    }
                }
            }

            foreach (Hashtable item in mf.GetRevisioni(IDCliente))
            {
                if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["Data"].ToString()))
                {
                    XmlDataProviderManager _t = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["File"].ToString());
                    XmlDataProviderManager _x = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["FileData"].ToString());

                    XmlNodeList NodeList = _x.Document.SelectNodes("/Dati//Dato");

                    foreach (XmlNode nodo in NodeList)
                    {
                        if (nodo.Attributes["Stato"] != null && nodo.Attributes["Stato"].Value == (Convert.ToInt32(App.TipoTreeNodeStato.DaCompletare)).ToString() && nodo.Attributes["ID"].Value != "22")
                        {
                            XmlNode nodotree = _t.Document.SelectSingleNode("/Tree//Node[@ID='" + nodo.Attributes["ID"].Value + "']");
                            NodiDaCompletare.Add(nodotree.Attributes["Codice"].Value);
                        }
                    }
                }
            }

            foreach (Hashtable item in mf.GetBilanci(IDCliente))
            {
                if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["Data"].ToString()))
                {
                    XmlDataProviderManager _t = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["File"].ToString());
                    XmlDataProviderManager _x = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["FileData"].ToString());

                    XmlNodeList NodeList = _x.Document.SelectNodes("/Dati//Dato");

                    foreach (XmlNode nodo in NodeList)
                    {
                        if (nodo.Attributes["Stato"] != null && nodo.Attributes["Stato"].Value == (Convert.ToInt32(App.TipoTreeNodeStato.DaCompletare)).ToString())
                        {
                            XmlNode nodotree = _t.Document.SelectSingleNode("/Tree//Node[@ID='" + nodo.Attributes["ID"].Value + "']");
                            NodiDaCompletare.Add(nodotree.Attributes["Codice"].Value);
                        }
                    }
                }
            }

            foreach (Hashtable item in mf.GetConclusioni(IDCliente))
            {
                if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["Data"].ToString()))
                {
                    XmlDataProviderManager _t = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["File"].ToString());
                    XmlDataProviderManager _x = new XmlDataProviderManager(App.AppDataDataFolder + "\\" + item["FileData"].ToString());

                    XmlNodeList NodeList = _x.Document.SelectNodes("/Dati//Dato");

                    foreach (XmlNode nodo in NodeList)
                    {
                        if (nodo.Attributes["Stato"] != null && nodo.Attributes["Stato"].Value == (Convert.ToInt32(App.TipoTreeNodeStato.DaCompletare)).ToString())
                        {
                            XmlNode nodotree = _t.Document.SelectSingleNode("/Tree//Node[@ID='" + nodo.Attributes["ID"].Value + "']");
                            NodiDaCompletare.Add(nodotree.Attributes["Codice"].Value);
                        }
                    }
                }
            }

            if (NodiDaCompletare.Count > 0)
            {
                string daCompletare = "Attenzione, per questo esercizio risultano 'DA COMPLETARE' le seguenti voci: ";
                foreach (string ndc in NodiDaCompletare)
                {
                    daCompletare += ndc + ", ";
                }

                MessageBox.Show(daCompletare);
                return;
            }
            else
            {
                string sigillo = "";

                GestioneLicenza gl           = new GestioneLicenza();
                string          intestatario = gl.Utente;// UtenteSigillo;
                foreach (Hashtable item in mf.GetIncarichi(IDCliente))
                {
                    if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["DataNomina"].ToString()))
                    {
                        sigillo = (item["Sigillo"] == null) ? "" : item["Sigillo"].ToString();

                        if (sigillo != "")
                        {
                            MessageBox.Show("ATTENZIONE: sigillo già applicato a questa sessione");
                            return;
                        }
                    }
                }

                foreach (Hashtable item in mf.GetISQCs(IDCliente))
                {
                    if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["DataNomina"].ToString()))
                    {
                        sigillo = (item["Sigillo"] == null) ? "" : item["Sigillo"].ToString();

                        if (sigillo != "")
                        {
                            MessageBox.Show("ATTENZIONE: sigillo già applicato a questa sessione");
                            return;
                        }
                    }
                }

                foreach (Hashtable item in mf.GetBilanci(IDCliente))
                {
                    if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["Data"].ToString()))
                    {
                        sigillo = (item["Sigillo"] == null) ? "" : item["Sigillo"].ToString();

                        if (sigillo != "")
                        {
                            MessageBox.Show("ATTENZIONE: sigillo già applicato a questa sessione");
                            return;
                        }
                    }
                }

                foreach (Hashtable item in mf.GetConclusioni(IDCliente))
                {
                    if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["Data"].ToString()))
                    {
                        sigillo = (item["Sigillo"] == null) ? "" : item["Sigillo"].ToString();

                        if (sigillo != "")
                        {
                            MessageBox.Show("ATTENZIONE: sigillo già applicato a questa sessione");
                            return;
                        }
                    }
                }

                foreach (Hashtable item in mf.GetRevisioni(IDCliente))
                {
                    if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["Data"].ToString()))
                    {
                        sigillo = (item["Sigillo"] == null) ? "" : item["Sigillo"].ToString();

                        if (sigillo != "")
                        {
                            MessageBox.Show("ATTENZIONE: sigillo già applicato a questa sessione");
                            return;
                        }
                    }
                }

                if ((cliente["Presidente"] == null || cliente["Presidente"].ToString() != intestatario) &&
                    (cliente["MembroEffettivo"] == null || cliente["MembroEffettivo"].ToString() != intestatario) &&
                    (cliente["MembroEffettivo2"] == null || cliente["MembroEffettivo2"].ToString() != intestatario) &&
                    (cliente["RevisoreAutonomo"] == null || cliente["RevisoreAutonomo"].ToString() != intestatario))
                {
                    MessageBox.Show("ATTENZIONE: l'intestatario di questa licenza non risulta uno dei revisori abilitati per questo cliente");
                    return;
                }

                wSigilloPassword SP = new wSigilloPassword();
                SP.ShowDialog();
                SP.Activate();

                if (!SP.PasswordOK)
                {
                    return;
                }

                string password = SP.Password;

                foreach (Hashtable item in mf.GetIncarichi(IDCliente))
                {
                    if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["DataNomina"].ToString()))
                    {
                        mf.SetSigilloIncarico(Convert.ToInt32(item["ID"].ToString()), intestatario, password);
                    }
                }

                foreach (Hashtable item in mf.GetISQCs(IDCliente))
                {
                    if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["DataNomina"].ToString()))
                    {
                        mf.SetSigilloISQC(Convert.ToInt32(item["ID"].ToString()), intestatario, password);
                    }
                }

                foreach (Hashtable item in mf.GetRevisioni(IDCliente))
                {
                    if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["Data"].ToString()))
                    {
                        mf.SetSigilloRevisione(Convert.ToInt32(item["ID"].ToString()), intestatario, password);
                    }
                }

                foreach (Hashtable item in mf.GetBilanci(IDCliente))
                {
                    if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["Data"].ToString()))
                    {
                        mf.SetSigilloBilancio(Convert.ToInt32(item["ID"].ToString()), intestatario, password);
                    }
                }

                foreach (Hashtable item in mf.GetConclusioni(IDCliente))
                {
                    if (cmbData.SelectedValue.ToString() == ConvertDataToEsercizio(item["Data"].ToString()))
                    {
                        mf.SetSigilloConclusione(Convert.ToInt32(item["ID"].ToString()), intestatario, password);
                    }
                }

                MessageBox.Show("Sigillo applicato con successo");
                base.Close();
            }
        }