Ejemplo n.º 1
0
        protected override void Cancelar()
        {
            if (gridBase1.SelectedRows.Count > 0)
            {
                Anular_Documento cancel = new Anular_Documento();
                Anular_Documento.tipoanulacion = FormTitle.Text;
                cancel.secuencia = gridBase1.SelectedRows[0].Cells["dgvsecuencia"].Value.ToString();

                cancel.tabla = "cxcdbfregistro";
                cancel.campo = "idregistro";
                cancel.id = gridBase1.SelectedRows[0].Cells["dgvidregistro"].Value.ToString();
                cancel.nombre = gridBase1.SelectedRows[0].Cells["dgvnombre"].Value.ToString();
                cancel.datos();
                string cmd = string.Format("SELECT * FROM cxcdbfregistro where idregistro = '" + gridBase1.SelectedRows[0].Cells["dgvidregistro"].Value.ToString() + "' ");
                DataSet ds = FuncionesSQL.Fun_Sql_Ejecutar(cmd);

                if (ds.Tables[0].Rows.Count > 0)
                {

                    if (Convert.ToBoolean(ds.Tables[0].Rows[0]["nulo"].ToString()) == false)
                    {
                        if (Funciones_Duke4.Funciones.Fun_Convierte_String_aDecimal(ds.Tables[0].Rows[0]["balance"].ToString()) != Funciones_Duke4.Funciones.Fun_Convierte_String_aDecimal(ds.Tables[0].Rows[0]["total"].ToString()))
                        {
                            Mensajes.Msgb_Tiene_Movimiento_No_Cancelar();
                        } else if (cancel.ShowDialog() == DialogResult.OK)
                        {
                            MessageBox.Show("Registro Cancelado", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            gridBase1.SelectedRows[0].Cells["dgvnulo"].Value = 1;
                            gridBase1.SelectedRows[0].DefaultCellStyle.BackColor = Color.MistyRose;

                        }
                    }
                    else  MessageBox.Show("El documento " + gridBase1.SelectedRows[0].Cells["dgvsecuencia"].Value.ToString() + Environment.NewLine + "de " +
                gridBase1.SelectedRows[0].Cells["dgvnombre"].Value.ToString() + Environment.NewLine + "Ya está cancelado", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    
                    
                }

            }
            else
                MessageBox.Show("Debe hacer selección", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);



        }
Ejemplo n.º 2
0
        protected override void Cancelar()
        {
            if (gridBase1.SelectedRows.Count > 0)
            {
                Anular_Documento cancel = new Anular_Documento();
                Anular_Documento.tipoanulacion = FormTitle.Text;
                cancel.secuencia = gridBase1.SelectedRows[0].Cells["dgvsecuencia"].Value.ToString();

                cancel.tabla  = "cxcdbfdebcre";
                cancel.campo  = "idregistro";
                cancel.id     = gridBase1.SelectedRows[0].Cells["dgvidregistro"].Value.ToString();
                cancel.nombre = gridBase1.SelectedRows[0].Cells["dgvnombre"].Value.ToString();
                if (Funciones_Duke4.Funciones.Fun_Convierte_String_aEntrero(gridBase1.SelectedRows[0].Cells["dgvtiponota"].Value.ToString()) == 1)
                {
                    cancel.query = "update cxcdbfregistro set balance=balance + '" + Funciones_Duke4.Funciones.Fun_Convierte_String_aDecimal(gridBase1.SelectedRows[0].Cells["dgvtotal"].Value.ToString()) + "' where idregistro='" + Funciones_Duke4.Funciones.Fun_Convierte_String_aDecimal(gridBase1.SelectedRows[0].Cells["dgvidregistro"].Value.ToString()) + "'";
                }
                else
                {
                    cancel.query = "update cxcdbfregistro set balance=balance - '" + Funciones_Duke4.Funciones.Fun_Convierte_String_aDecimal(gridBase1.SelectedRows[0].Cells["dgvtotal"].Value.ToString()) + "' where idregistro='" + Funciones_Duke4.Funciones.Fun_Convierte_String_aDecimal(gridBase1.SelectedRows[0].Cells["dgvidregistro"].Value.ToString()) + "'";
                }

                cancel.datos();
                string  cmd = string.Format("SELECT * FROM cxcdbfdebcre where idregistro = '" + gridBase1.SelectedRows[0].Cells["dgvidregistro"].Value.ToString() + "' and nulo =1");
                DataSet ds  = FuncionesSQL.Fun_Sql_Ejecutar(cmd);
                if (ds.Tables[0].Rows.Count == 0)
                {
                    if (cancel.ShowDialog() == DialogResult.OK)
                    {
                        MessageBox.Show("Registro Cancelado", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        gridBase1.SelectedRows[0].Cells["dgvnulo"].Value     = 1;
                        gridBase1.SelectedRows[0].DefaultCellStyle.BackColor = Color.MistyRose;
                    }
                }
                else
                {
                    MessageBox.Show("El documento " + gridBase1.SelectedRows[0].Cells["dgvsecuencia"].Value.ToString() + Environment.NewLine + "de " +
                                    gridBase1.SelectedRows[0].Cells["dgvnombre"].Value.ToString() + Environment.NewLine + "Ya está cancelado", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else
            {
                MessageBox.Show("Debe hacer selección", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Ejemplo n.º 3
0
        protected override void Cancelar()
        {
            if (gridBase1.SelectedRows.Count > 0)
            {
                Anular_Documento cancel = new Anular_Documento();
                Anular_Documento.tipoanulacion = FormTitle.Text;
                cancel.secuencia = gridBase1.SelectedRows[0].Cells["dgvsecuencia"].Value.ToString();

                cancel.tabla  = "cxcdbfotroingreso";
                cancel.campo  = "idotroingreso";
                cancel.id     = gridBase1.SelectedRows[0].Cells["dgvidotroingreso"].Value.ToString();
                cancel.nombre = gridBase1.SelectedRows[0].Cells["dgvbeneficiario"].Value.ToString();
                cancel.datos();
                string  cmd = string.Format("SELECT * FROM cxcdbfotroingreso where idotroingreso = '" + gridBase1.SelectedRows[0].Cells["dgvidotroingreso"].Value.ToString() + "' and nulo>0 ");
                DataSet ds  = FuncionesSQL.Fun_Sql_Ejecutar(cmd);

                if (ds.Tables[0].Rows.Count == 0)
                {
                    if (cancel.ShowDialog() == DialogResult.OK)
                    {
                        MessageBox.Show("Registro Cancelado", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        gridBase1.SelectedRows[0].Cells["dgvnulo"].Value     = 1;
                        gridBase1.SelectedRows[0].DefaultCellStyle.BackColor = Color.MistyRose;
                    }
                }
                else
                {
                    MessageBox.Show("El documento " + gridBase1.SelectedRows[0].Cells["dgvsecuencia"].Value.ToString() + Environment.NewLine + "de " +
                                    gridBase1.SelectedRows[0].Cells["dgvbeneficiario"].Value.ToString() + Environment.NewLine + "Ya está cancelado", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else
            {
                MessageBox.Show("Debe hacer selección", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Ejemplo n.º 4
0
        protected override void Cancelar()
        {
            if (gridBase1.SelectedRows.Count > 0)
            {
                Anular_Documento cancel = new Anular_Documento();
                Anular_Documento.tipoanulacion = FormTitle.Text;

                cancel.secuencia = gridBase1.SelectedRows[0].Cells["dgvsecuencia"].Value.ToString();

                if (Rbnreciboingreso.Checked)
                {
                    cancel.tabla = "cxcdbfcobro";
                    cancel.campo = "idcobro";
                    cancel.query = "update cxcdbfregistro set balance=balance + cxcdbfcobrodetalle.monto from cxcdbfregistro "
                                   + " inner join cxcdbfcobrodetalle on cxcdbfcobrodetalle.idregistro = cxcdbfregistro.idregistro "
                                   + " inner join cxcdbfcobro on cxcdbfcobrodetalle.idcobro=cxcdbfcobro.idcobro where cxcdbfcobro.idcobro = '" + gridBase1.SelectedRows[0].Cells["dgvidcobro"].Value.ToString() + "'";

                    cancel.id     = gridBase1.SelectedRows[0].Cells["dgvidcobro"].Value.ToString();
                    cancel.nombre = gridBase1.SelectedRows[0].Cells["dgvnombre"].Value.ToString();
                    cancel.datos();
                    string  cmd = string.Format("SELECT * FROM cxcdbfcobro where idcobro = '" + gridBase1.SelectedRows[0].Cells["dgvidcobro"].Value.ToString() + "' and nulo =1");
                    DataSet ds  = FuncionesSQL.Fun_Sql_Ejecutar(cmd);
                    if (ds.Tables[0].Rows.Count == 0)
                    {
                        if (cancel.ShowDialog() == DialogResult.OK)
                        {
                            MessageBox.Show("Registro Cancelado", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            gridBase1.SelectedRows[0].Cells["dgvnulo"].Value     = 1;
                            gridBase1.SelectedRows[0].DefaultCellStyle.BackColor = Color.MistyRose;
                        }
                    }
                    else
                    {
                        MessageBox.Show("El documento " + gridBase1.SelectedRows[0].Cells["dgvsecuencia"].Value.ToString() + Environment.NewLine + "de " +
                                        gridBase1.SelectedRows[0].Cells["dgvnombre"].Value.ToString() + Environment.NewLine + "Ya está cancelado", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    //cancel.tabla = "cxcdbfcobroadelantadodetalle";
                    //cancel.campo = "secuencia";
                    //cancel.query = "update cxcdbfregistro set balance=balance + cxcdbfcobroadelantadodetalle.total from cxcdbfregistro "
                    //+ "inner join cxcdbfcobroadelantadodetalle on cxcdbfcobroadelantadodetalle.idfactura = cxcdbfregistro.idregistro "
                    //+ "where cxcdbfregistro.idregistro = '" + refrescarcon.MainGrid.SelectedRows[0].Cells["idregistrofac1"].Value.ToString() + "'"
                    //+ "update cxcdbfcobroadelantado set balance=balance + cxcdbfcobroadelantadodetalle.total from cxcdbfcobroadelantado "
                    //+ "inner join cxcdbfcobroadelantadodetalle on cxcdbfcobroadelantadodetalle.referencia = cxcdbfcobroadelantado.numero "
                    //+ "where cxcdbfcobroadelantadodetalle.referencia = '" + refrescarcon.MainGrid.SelectedRows[0].Cells["numero1"].Value.ToString() + "'";

                    //cancel.id = gridBase1.SelectedRows[0].Cells["dgvidcobro"].Value.ToString();
                    //cancel.nombre = gridBase1.SelectedRows[0].Cells["dgvnombre"].Value.ToString();
                    //cancel.datos();
                    //string cmd = string.Format("SELECT * FROM cxcdbfcobroadelantadodetalle where idcobro = '" + gridBase1.SelectedRows[0].Cells["dgvidcobro"].Value.ToString() + "' and nulo =1");
                    //DataSet ds = FuncionesSQL.Fun_Sql_Ejecutar(cmd);
                    //if (ds.Tables[0].Rows.Count == 0)
                    //{

                    //    if (cancel.ShowDialog() == DialogResult.OK)
                    //    {
                    //        MessageBox.Show("Registro Cancelado", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //        gridBase1.SelectedRows[0].Cells["dgvnulo"].Value = 1;
                    //        gridBase1.SelectedRows[0].DefaultCellStyle.BackColor = Color.MistyRose;

                    //    }
                    //}
                    //else MessageBox.Show("El documento " + gridBase1.SelectedRows[0].Cells["dgvsecuencia"].Value.ToString() + Environment.NewLine + "de " +
                    //  gridBase1.SelectedRows[0].Cells["dgvnombre"].Value.ToString() + Environment.NewLine + "Ya está cancelado", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else
            {
                MessageBox.Show("Debe hacer selección", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }