private void frmaportaciones_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F2)
            {
                Close();
            }
            if (e.KeyCode == Keys.F5)
            {
                frmconstancias_Shown(null, null);
            }

            if (e.KeyCode == Keys.F9)
            {
                DialogResult dialogResult = MessageBox.Show("¿DESEA ACTUALIZAR ESTE FOLIO?", "Constancias", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    if (!string.IsNullOrWhiteSpace(lblhistorico.Text))
                    {
                        string query = "delete from datos.detalleconstancia where historico ='{0}'";
                        string paso  = string.Format(query, lblhistorico.Text);
                        globales.consulta(paso);

                        foreach (DataGridViewRow row in dataco.Rows)
                        {
                            try
                            {
                                {
                                    string inicio  = Convert.ToString(row.Cells[0].Value);
                                    string final   = Convert.ToString(row.Cells[1].Value);
                                    string monto   = Convert.ToString(row.Cells[2].Value);
                                    string detalle = Convert.ToString(row.Cells[3].Value);

                                    string ins            = "insert into datos.detalleconstancia (rfc,historico,desde,hasta,monto,descripcion) values ('{0}','{1}','{2}','{3}','{4}','{5}')";
                                    string insertadetalle = string.Format(ins, txtrfc.Text, lblhistorico.Text, inicio, final, monto, detalle);
                                    if (!string.IsNullOrWhiteSpace(inicio))
                                    {
                                        globales.consulta(insertadetalle);
                                    }
                                }
                            }
                            catch
                            {
                                MessageBox.Show("VERIFIQUE FORMATOS, CONTACTE A SISTEMAS");
                            }
                        }
                        string actu            = "update datos.constancias set monto_total='{0}',total_con_letra='{1}',motivo='{2}',antig_a='{3}',antig_m='{4}',antig_q='{5}',quincenas='{6}' where num_histo='{7}'";
                        double numletr         = double.Parse(lblnumero.Text, System.Globalization.NumberStyles.Currency);
                        string actualizaconsta = string.Format(actu, numletr, lblletra.Text, txtconcepto.Text, lblanios.Text, lblmeses.Text, lblquincenas.Text, lbltquincenas.Text, lblhistorico.Text);

                        globales.consulta(actualizaconsta);
                        MessageBox.Show("REGISTROS ACTUALIZADOS");
                    }
                    else
                    {
                        MessageBox.Show("NO ESTAS TRABAJANDO SOBRE UN FOLIO YA EXISTENTE");
                    }
                }
                this.Close();
            }


            if (e.KeyCode == Keys.F6)
            {
                if (string.IsNullOrWhiteSpace(txtrfc.Text))
                {
                    return;
                }
                dataco.Rows.Clear();
                lblhistorico.Text  = "";
                lblconstancia.Text = "";
                lblrecibo.Text     = "";
                dataco.Rows.Clear();
                frmgrafica p = new frmgrafica(this.resultado, this.resultado2, true);
                p.ShowDialog();
                string quincena = p.quincenas.Replace("Quincenas", "");

                int Qtotales = Convert.ToInt32(quincena);
                int AA       = Convert.ToInt32((Qtotales) / 24);
                int QAux     = Qtotales - (AA * 24);
                int AM       = Convert.ToInt32((QAux / 2));
                int AQ       = QAux - (AM * 2);
                lbltquincenas.Text   = Convert.ToString(quincena);
                lblquincenas.Text    = Convert.ToString(AQ);
                lblmeses.Text        = Convert.ToString(AM);
                lblanios.Text        = Convert.ToString(AA);
                lblanios.Enabled     = true;
                lblmeses.Enabled     = true;
                lblquincenas.Enabled = true;
                lblnumero.Enabled    = true;
                lblletra.Enabled     = true;
                comboBox1.Enabled    = true;
                txtconcepto.Enabled  = true;

                comboBox1.Focus();
                calculaporfuera();
                calcula();
            }
        }
        private void frmaportaciones_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Insert)
            {
                if (string.IsNullOrWhiteSpace(txtrfc.Text))
                {
                    return;
                }

                if (dtggrid.Rows.Count != 0)
                {
                    return;
                }

                DialogResult p = globales.MessageBoxQuestion("¿Deseas registrar una nueva aportación?", "Aviso", globales.menuPrincipal);
                if (p == DialogResult.No)
                {
                    return;
                }
                this.esInsertar = true;
                string inicio  = string.Format("{0:d}", DateTime.Now);
                string final   = string.Format("{0:d}", DateTime.Now);
                string entrada = "0.00";
                string salida  = "0.00";
                string cuenta  = "";
                string fecha   = string.Format("{0:d}", DateTime.Now);

                dtggrid.Rows.Insert(0);
                dtggrid.Rows[0].Cells[0].Value             = inicio;
                dtggrid.Rows[0].Cells[1].Value             = final;
                dtggrid.Rows[0].Cells[2].Value             = "";
                dtggrid.Rows[0].Cells[3].Value             = entrada;
                dtggrid.Rows[0].Cells[4].Value             = salida;
                dtggrid.Rows[0].Cells[5].Value             = cuenta;
                dtggrid.Rows[0].Cells[6].Value             = "";
                dtggrid.Rows[0].Cells[7].Value             = fecha;
                dtggrid.Rows[0].Cells[8].Value             = "";
                dtggrid.Rows[0].DefaultCellStyle.BackColor = Color.FromArgb(200, 230, 201);
                string query = "insert into datos.aportaciones(rfc,inicio,final,new_tipo,entrada,salida,cuenta,fum,fecharegistro,status,idusuario) values('{0}','{1}','{2}','',0,0,'{3}','{4}','{4}','n',{5}) returning id";

                query = string.Format(query, txtrfc.Text, string.Format("{0:yyyy-MM-dd}", DateTime.Parse(inicio)), string.Format("{0:yyyy-MM-dd}", DateTime.Parse(final)), cuenta, string.Format("{0:yyyy-MM-dd}", DateTime.Parse(fecha)), globales.id_usuario);

                List <Dictionary <string, object> > resultado = globales.consulta(query);
                dtggrid.Rows[0].Cells[8].Value = resultado[0]["id"];
                dtggrid.CurrentCell            = dtggrid.Rows[0].Cells[0];
                this.esInsertar = false;
            }

            if (e.KeyCode == Keys.F2)
            {
                button2_Click(null, null);
            }
            if (e.KeyCode == Keys.F5)
            {
                inicia();
            }


            if (e.Control && e.KeyCode == Keys.T)
            {
                pnlAntiguedad.Visible = !pnlAntiguedad.Visible;
                lblQuincenas2.Text    = "";
                lblquincenas1.Text    = "";
                lblsaldo.Text         = "";
                return;
            }
            if (e.Control && e.KeyCode == Keys.F11)
            {
                btbuscar_Click(null, null);
            }
            if (e.Control && e.KeyCode == Keys.F6)
            {
                if (string.IsNullOrWhiteSpace(txtrfc.Text))
                {
                    return;
                }
                string query = "select inicio, final, new_tipo, entrada, salida, cuenta, movimiento,fecharegistro, id" +
                               " FROM datos.aportaciones WHERE rfc = '{0}' AND COALESCE (TRIM(status),'')<>'e' AND COALESCE (TRIM(status),'')<>'p'" +
                               "ORDER BY inicio,final desc,new_tipo asc; ";
                query           = string.Format(query, txtrfc.Text);
                this.resultado2 = globales.consulta(query);
                frmgrafica p = new frmgrafica(this.resultado, this.resultado2, true);
                p.ShowDialog();
                return;
            }
            if (e.KeyCode == Keys.F6)
            {
                if (string.IsNullOrWhiteSpace(txtrfc.Text))
                {
                    return;
                }
                string query = "select inicio, final, new_tipo, entrada, salida, cuenta, movimiento,fecharegistro, id" +
                               " FROM datos.aportaciones WHERE rfc = '{0}' AND COALESCE (TRIM(status),'')<>'e' AND COALESCE (TRIM(status),'')<>'p'" +
                               "ORDER BY inicio,final desc,new_tipo asc; ";
                query           = string.Format(query, txtrfc.Text);
                this.resultado2 = globales.consulta(query);
                frmgrafica p = new frmgrafica(this.resultado, this.resultado2);

                p.ShowDialog();
            }


            if (e.KeyCode == Keys.Down)
            {
                ActiveControl = dtggrid;
            }

            if (e.KeyCode == Keys.F4)
            {
                dtggrid.Select();
                dtggrid.Focus();
                bool bandera;
                if (bandera = true)
                {
                    txtrfc.Select();
                    bandera = true;
                }
            }

            if (e.KeyCode == Keys.F10)
            {
                globales.showModal(new frmModalModificarEmpleado(txtrfc.Text));
            }
        }
Exemple #3
0
        private void frmconsultas_KeyDown_1(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F2)
            {
                button2_Click(null, null);
            }
            if (e.KeyCode == Keys.F5)
            {
                inicia();
            }


            if (e.Control && e.KeyCode == Keys.T)
            {
                pnlAntiguedad.Visible = !pnlAntiguedad.Visible;
                lblQuincenas2.Text    = "";
                lblquincenas1.Text    = "";
                lblsaldo.Text         = "";
                return;
            }
            //if (e.Control && e.KeyCode == Keys.F11)
            //{
            //    btbuscar_Click(null, null);
            //}
            if (e.Control && e.KeyCode == Keys.F6)
            {
                if (string.IsNullOrWhiteSpace(txtrfc.Text))
                {
                    return;
                }
                string query = "select inicio, final, new_tipo, entrada, salida, cuenta, movimiento,fecharegistro, id" +
                               " FROM datos.aportaciones WHERE rfc = '{0}' AND COALESCE (TRIM(status),'')<>'e' AND COALESCE (TRIM(status),'')<>'p'" +
                               "ORDER BY inicio,new_tipo asc; ";
                query           = string.Format(query, txtrfc.Text);
                this.resultado2 = globales.consulta(query);
                frmgrafica p = new frmgrafica(this.resultado, this.resultado2, true);
                p.ShowDialog();
                return;
            }
            if (e.KeyCode == Keys.F6)
            {
                if (string.IsNullOrWhiteSpace(txtrfc.Text))
                {
                    return;
                }
                string query = "select inicio, final, new_tipo, entrada, salida, cuenta, movimiento,fecharegistro, id" +
                               " FROM datos.aportaciones WHERE rfc = '{0}' AND COALESCE (TRIM(status),'')<>'e' AND COALESCE (TRIM(status),'')<>'p'" +
                               "ORDER BY inicio,new_tipo asc; ";
                query           = string.Format(query, txtrfc.Text);
                this.resultado2 = globales.consulta(query);
                frmgrafica p = new frmgrafica(this.resultado, this.resultado2);

                p.ShowDialog();
            }


            if (e.KeyCode == Keys.Down)
            {
                ActiveControl = dtggrid;
            }

            if (e.KeyCode == Keys.F4)
            {
                dtggrid.Select();
                dtggrid.Focus();
                bool bandera;
                if (bandera = true)
                {
                    txtrfc.Select();
                    bandera = true;
                }
            }
        }