Пример #1
0
        private void EditMovimentacao()
        {
            if (Restrito())
            {
                return;
            }

            if (GridLista.SelectedRows.Count == 0)
            {
                return;
            }

            if (Convert.ToInt32(GridLista.SelectedRows[0].Cells["ID"].Value) <= 0)
            {
                return;
            }

            if (GridLista.SelectedRows[0].Cells["Descrição"].Value.ToString().Contains("Venda"))
            {
                DetailsPedido.idPedido = Validation.ConvertToInt32(GridLista.SelectedRows[0].Cells["ID"].Value);
                OpenForm.Show <DetailsPedido>(this);
                return;
            }

            AddCaixaMov.idMov = Convert.ToInt32(GridLista.SelectedRows[0].Cells["ID"].Value);
            var f = new AddCaixaMov();

            if (f.ShowDialog() == DialogResult.OK)
            {
                LoadTotais();
            }
        }
Пример #2
0
        private void Eventos()
        {
            KeyDown   += KeyDowns;
            KeyPreview = true;

            Shown += async(s, e) =>
            {
                Resolution.SetScreenMaximized(this);

                Refresh();
                LoadData();

                await DataTableAsync();
            };

            if (_modelCaixa.Tipo != "Fechado")
            {
                GridLista.CellDoubleClick += (s, e) => EditMovimentacao();

                GridLista2.CellDoubleClick += (s, e) =>
                {
                    DetailsPedido.idPedido = Convert.ToInt32(GridLista2.SelectedRows[0].Cells["N° Venda"].Value);
                    OpenForm.Show <DetailsPedido>(this);
                };
            }

            btnEditar.Click += (s, e) => EditMovimentacao();

            btnLancamentos.Click += (s, e) =>
            {
                if (Restrito())
                {
                    return;
                }

                if (_modelCaixa.Tipo == "Fechado")
                {
                    Alert.Message("Oppss!", "Não é possível fazer lançamentos em um caixa fechado.",
                                  Alert.AlertType.warning);
                    return;
                }

                AddCaixaMov.idCaixa = idCaixa;
                AddCaixaMov.idMov   = 0;
                using (var f = new AddCaixaMov())
                {
                    if (f.ShowDialog() == DialogResult.OK)
                    {
                        LoadTotais();
                    }
                }
            };

            FecharCaixa.Click += async(s, e) =>
            {
                if (Restrito())
                {
                    return;
                }

                Financeiro.FecharCaixa.idCaixa = idCaixa;
                var f = new FecharCaixa();
                if (f.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                txtFechado.Text        = DateTime.Now.ToString("dd/mm/YYYY HH:mm", Program.cultura);
                panel7.BackColor       = Color.FromArgb(192, 0, 0);
                label7.Text            = @"Caixa Fechado";
                FecharCaixa.Enabled    = false;
                btnLancamentos.Enabled = false;

                if (Financeiro.FecharCaixa.fecharImprimir)
                {
                    await RenderizarAsync();
                }
            };

            GridLista2.CellFormatting += (s, e) =>
            {
                foreach (DataGridViewRow row in GridLista2.Rows)
                {
                    if (Validation.ConvertToDouble(row.Cells[3].Value) < Validation.ConvertToDouble(row.Cells[2].Value))
                    {
                        row.Cells[3].Style.Font = new Font("Segoe UI Semibold", 9.75F, FontStyle.Bold,
                                                           GraphicsUnit.Point, 0);
                        row.Cells[3].Style.ForeColor = Color.White;
                        row.Cells[3].Style.BackColor = Color.FromArgb(255, 89, 89);
                    }
                    else
                    {
                        row.Cells[3].Style.Font = new Font("Segoe UI Semibold", 9.75F, FontStyle.Bold,
                                                           GraphicsUnit.Point, 0);
                        row.Cells[3].Style.ForeColor = Color.White;
                        row.Cells[3].Style.BackColor = Color.FromArgb(139, 215, 146);
                    }
                }
            };

            GridLista.CellFormatting += (s, e) =>
            {
                foreach (DataGridViewRow row in GridLista.Rows)
                {
                    if (row.Cells[2].Value.ToString().Contains("ENTRADA") ||
                        row.Cells[2].Value.ToString().Contains("Venda"))
                    {
                        row.Cells[3].Style.Font = new Font("Segoe UI Semibold", 9.75F, FontStyle.Bold,
                                                           GraphicsUnit.Point, 0);
                        row.Cells[3].Style.ForeColor = Color.White;
                        row.Cells[3].Style.BackColor = Color.FromArgb(139, 215, 146);
                    }
                    else
                    {
                        row.Cells[3].Style.Font = new Font("Segoe UI Semibold", 9.75F, FontStyle.Bold,
                                                           GraphicsUnit.Point, 0);
                        row.Cells[3].Style.ForeColor = Color.White;
                        row.Cells[3].Style.BackColor = Color.FromArgb(255, 89, 89);
                    }
                }
            };

            btnExit.Click += (s, e) => Close();

            btnHelp.Click += (s, e) => Support.OpenLinkBrowser(Program.URL_BASE + "/ajuda");

            btnFinalizarImprimir.Click += async(s, e) => await RenderizarAsync();
        }