示例#1
0
        public DocumentiFooter(DocumentiEdit par)
        {
            _parent      = par;
            change_event = true;
            dbcon_       = DependencyService.Get <ISQLiteDb>().GetConnection();
            InitializeComponent();

            //m_tot_merce.Culture = new System.Globalization.CultureInfo("it-IT");
            //numericTextBox.Culture = new System.Globalization.CultureInfo("fr-FR");

            //var culture = new CultureInfo("it-IT");
            //culture.NumberFormat.CurrencyGroupSeparator = "?";
            //culture.NumberFormat.NumberGroupSeparator = "?";
            //m_imponibile.Culture = culture;

            if (Device.Idiom == TargetIdiom.Tablet)
            {
                m_colli_text.WidthRequest = 100;
                m_colli.WidthRequest      = 100;

                m_cod_pag_text.WidthRequest = 100;
                m_cod_pag.WidthRequest      = 100;

                grid.RowSpacing = grid.RowSpacing += 20;
            }
        }
        private async void Edit()
        {
            dataGrid.ResetSwipeOffset();
            if (swipeIndex == 0 || swipeDoc == null)
            {
                return;
            }

            Fatture fat   = null;
            bool    nuova = false;

            swipeIndex = 0;
            try
            {
                string sql     = String.Format("SELECT * from FATTURE2 WHERE fat_tipo = {0} AND fat_n_doc = {1} LIMIT 1", swipeDoc.fat_tipo, swipeDoc.fat_n_doc);
                var    docList = await dbcon_.QueryAsync <Fatture>(sql);

                if (docList.Count > 0)
                {
                    fat = docList[0];
                }
            }
            catch (Exception ex)
            {
                await DisplayAlert("Attenzione!", ex.Message, "OK");

                return;
            }
            if (fat == null)
            {
                return;
            }
            var page = new DocumentiEdit(ref fat, ref nuova);
            await Navigation.PushAsync(page);
        }
示例#3
0
 public DocumentiNote(DocumentiEdit par)
 {
     _parent      = par;
     change_event = true;
     dbcon_       = DependencyService.Get <ISQLiteDb>().GetConnection();
     InitializeComponent();
 }
        public DocumentiBody(DocumentiEdit par)
        {
            swipeIndex = 0;
            dbcon_     = DependencyService.Get <ISQLiteDb>().GetConnection();

            _parent = par;
            InitializeComponent();
            dataGrid.ColumnSizer      = Syncfusion.SfDataGrid.XForms.ColumnSizer.LastColumnFill;
            dataGrid.GridLongPressed += DataGrid_GridLongPressed;
        }
        public DocumentiHeader(DocumentiEdit par)
        {
            _parent = par;
            _first  = true;
            _dbcon  = DependencyService.Get <ISQLiteDb>().GetConnection();

            InitializeComponent();

            if (Device.Idiom == TargetIdiom.Tablet)
            {
                m_cli_cod.WidthRequest = 150;
                m_dst_cod.WidthRequest = 150;
                m_n_doc.WidthRequest   = 150;
                m_d_doc.WidthRequest   = 150;
            }


            SetProtection();
        }
示例#6
0
        async void OnModificaClicked(object sender, System.EventArgs e)
        {
            Fatture fat = null;
            SQLiteAsyncConnection dbcon_ = DependencyService.Get <ISQLiteDb>().GetConnection();

            bool nuova    = false;
            bool editable = false;

            busyIndicator.IsBusy = true;
            try
            {
                var sql     = string.Format("SELECT * from FATTURE2 WHERE fat_tipo = {0} ORDER BY fat_tipo, fat_n_doc DESC LIMIT 1", (short)tipo_);
                var docList = await dbcon_.QueryAsync <Fatture>(sql);

                foreach (var doc in docList)
                {
                    fat = doc;
                    break;
                }
            }
            catch (Exception ex)
            {
                busyIndicator.IsBusy = false;
                await DisplayAlert("Attenzione!", ex.Message, "OK");

                return;
            }
            if (fat == null)
            {
                busyIndicator.IsBusy = false;
                await DisplayAlert("Attenzione!", "Non è stato trovato in archivio alcun documento", "Ok");

                return;
            }
            editable = fat.fat_editable;
            var page = new DocumentiEdit(ref fat, ref nuova);
            await Navigation.PushAsync(page);

            busyIndicator.IsBusy = false;
        }
        async void DataGrid_GridLongPressed(object sender, Syncfusion.SfDataGrid.XForms.GridLongPressedEventArgs e)
        {
            var doc = e.RowData as Documents;

            busyIndicator.IsBusy = true;

            Fatture fat   = null;
            bool    nuova = false;

            try
            {
                string sql     = String.Format("SELECT * from FATTURE2 WHERE fat_tipo = {0} AND fat_n_doc = {1} LIMIT 1", doc.fat_tipo, doc.fat_n_doc);
                var    docList = await dbcon_.QueryAsync <Fatture>(sql);

                if (docList.Count > 0)
                {
                    fat = docList[0];
                }
            }
            catch (Exception ex)
            {
                busyIndicator.IsBusy = false;
                await DisplayAlert("Attenzione!", ex.Message, "OK");

                return;
            }
            if (fat == null)
            {
                busyIndicator.IsBusy = false;
                return;
            }
            var page = new DocumentiEdit(ref fat, ref nuova);
            await Navigation.PushAsync(page);

            busyIndicator.IsBusy = false;
        }
示例#8
0
        async void OnAggiungiClicked(object sender, System.EventArgs e)
        {
            var       fat = new Fatture();
            LocalImpo lim = null;
            Agenti    age = null;

            SQLiteAsyncConnection dbcon_ = DependencyService.Get <ISQLiteDb>().GetConnection();

            busyIndicator.IsBusy = true;

            //
            // Leggiamo le impostazioni
            //
            try
            {
                lim = await dbcon_.GetAsync <LocalImpo>(1);
            }
            catch
            {
                busyIndicator.IsBusy = false;
                await DisplayAlert("Attenzione!", "Impostazioni locali non trovate!\nRiavviare l'App.", "OK");

                return;
            }

            if (!lim.data_download)
            {
                busyIndicator.IsBusy = false;
                await DisplayAlert("Attenzione!", "Dati non presenti sul dispositivo!\nPer procedere è necessario scaricare i dati dal server.", "OK");

                return;
            }
            if (string.IsNullOrWhiteSpace(lim.registro))
            {
                busyIndicator.IsBusy = false;
                await DisplayAlert("Attenzione!", "Registro non impostato!\nPer inserire documenti è necessario fare le impostazioni iniziali.", "OK");

                return;
            }
            if (lim.age == 0)
            {
                busyIndicator.IsBusy = false;
                await DisplayAlert("Attenzione!", "Agente non impostato!\nPer inserire documenti è necessario fare le impostazioni iniziali.", "OK");

                return;
            }
            if (lim.dep == 0)
            {
                busyIndicator.IsBusy = false;
                await DisplayAlert("Attenzione!", "Deposito non impostato!\nPer inserire documenti è necessario fare le impostazioni iniziali.", "OK");

                return;
            }


            //
            // Leggiamo i dati dell' agente
            //
            try
            {
                age = await dbcon_.GetAsync <Agenti>(lim.age);
            }
            catch
            {
                busyIndicator.IsBusy = false;
                await DisplayAlert("Attenzione!", "L' Agente impostato non è presente in archivio!", "OK");

                return;
            }

            bool nuova = true;

            //
            // Inizializziamo il documento
            //
            fat.fat_n_doc     = 1;
            fat.fat_tipo      = (short)tipo_;
            fat.fat_registro  = lim.registro;
            fat.fat_d_doc     = DateTime.Now;
            fat.fat_editable  = true;
            fat.fat_local_doc = true;
            fat.fat_age       = lim.age;

            try
            {
                fat.fat_n_doc = 1;
                var sql  = string.Format("SELECT * FROM fatture2 WHERE fat_tipo = {0} AND fat_n_doc > {1} AND fat_n_doc <= {2} ORDER BY fat_n_doc DESC LIMIT 1", (short)tipo_, RsaUtils.GetFirstRegNumber(lim.registro), RsaUtils.GetLastRegNumber(lim.registro));
                var list = await dbcon_.QueryAsync <Fatture>(sql);

                foreach (var doc in list)
                {
                    fat.fat_n_doc += doc.fat_n_doc;
                    break;
                }
            }
            catch (Exception ex)
            {
                await DisplayAlert("Attenzione!", ex.Message, "OK");

                return;
            }
            var page = new DocumentiEdit(ref fat, ref nuova);
            await Navigation.PushAsync(page);

            busyIndicator.IsBusy = false;
        }