private void creoOperacion () { String fecha = (Convert.ToDateTime(maskedTextBox_fecha.Text)).ToString("yyyy-MM-dd"); String fecha_actualizacion = (Convert.ToDateTime(DateTime.Now)).ToString("yyyy-MM-dd hh:mm:ss"); //CREO OPERACIÓN String sqlInsertOp = "INSERT INTO com_operaciones (IdComunidad, IdEntidad, IdSubCuenta, IdTipoReparto, Fecha, Descripcion, IdEstado, ImpOp, ImpOpPte, NumMov, Guardada, IdURD, FAct) VALUES (" + id_comunidad + "," + id_entidad_nueva + "," + comboBox_subcuenta.SelectedItem.ToString().Split('-')[0] + ",1,'" + fecha + "','" + textBox_descripcion.Text + "',1," + Logica.FuncionesGenerales.ArreglarImportes(textBox_importe.Text) + "," + Logica.FuncionesGenerales.ArreglarImportes(textBox_importe.Text) + ",0,'No'," + Presentacion.Login.getId() + ",'" + fecha_actualizacion + "')"; int op = Persistencia.SentenciasSQL.InsertarGenericoID(sqlInsertOp); String sqlInsertIva = "INSERT INTO com_opdetiva (IdOp, Base, IdIVA, IVA) VALUES (" + op + "," + Logica.FuncionesGenerales.ArreglarImportes(textBox_importe.Text) + ",1,0)"; Persistencia.SentenciasSQL.InsertarGenerico(sqlInsertIva); String sqlSelectBloqueFondo = (Persistencia.SentenciasSQL.select("SELECT IdBloque FROM com_fondos WHERE IdFondo = " + comboBox_fondos.SelectedValue.ToString())).Rows[0][0].ToString(); String sqlInsertReparto = "INSERT INTO com_opdetbloques (IdOp, IdBloque, Porcentaje, Importe) VALUES (" + op + "," + sqlSelectBloqueFondo + ",1," + Logica.FuncionesGenerales.ArreglarImportes(textBox_importe.Text) + ")"; Persistencia.SentenciasSQL.InsertarGenerico(sqlInsertReparto); String sqlInsertVencimiento = "INSERT INTO com_opdetalles (IdOp, IdEntidad, Fecha, FechaPrev, Importe, ImpOpDetPte, NumMov, IdEstado) VALUES (" + op + "," + id_entidad_nueva + ",'" + fecha + "','" + fecha + "'," + Logica.FuncionesGenerales.ArreglarImportes(textBox_importe.Text) + "," + Logica.FuncionesGenerales.ArreglarImportes(textBox_importe.Text) + ",0,1)"; int opdet = Persistencia.SentenciasSQL.InsertarGenericoID(sqlInsertVencimiento); String sqlInsertDetLiq = "INSERT INTO com_opdetliquidacion (IdOp, IdLiquidacion, Porcentaje, Importe) VALUES (" + op + "," + comboBox_liquidación.SelectedValue.ToString() + ",1," + Logica.FuncionesGenerales.ArreglarImportes(textBox_importe.Text) + ")"; Persistencia.SentenciasSQL.InsertarGenerico(sqlInsertDetLiq); //COMPRUEBO QUE SI ES DE STOCK, INTRODUZCAN LOS VALORES PERTINENTES. String sqlSelect = "SELECT com_fondos.IdFondo, com_fondos.Stock FROM com_fondos INNER JOIN com_liquidaciones ON com_fondos.IdFondo = com_liquidaciones.IdFondo WHERE com_liquidaciones.IdLiquidacion =" + comboBox_liquidación.SelectedValue.ToString(); DataTable esStock = Persistencia.SentenciasSQL.select(sqlSelect); if (esStock.Rows.Count > 0) { if (esStock.Rows[0][1].ToString() == "True") { FondosForms.FormModificarStock nueva2 = new FondosForms.FormModificarStock(esStock.Rows[0][0].ToString(), "-"); nueva2.Show(); } } int Idrecibo = Logica.FuncionesTesoreria.CreoReciboID(id_comunidad, id_entidad_nueva, fecha, Logica.FuncionesGenerales.ArreglarImportes(textBox_importe.Text), Logica.FuncionesGenerales.ArreglarImportes(textBox_importe.Text), textBox_descripcion.Text); Logica.FuncionesTesoreria.ActualizoIdReciboVencimiento(Idrecibo.ToString(), opdet.ToString()); form_anterior.cargardatagrid(); this.Close(); MessageBox.Show("Se ha generado el Recibo y debes informarlo"); FromOperacionesVer nueva = new FromOperacionesVer(op.ToString(), 1, id_comunidad); nueva.Show(); }
public void recogerBloque(String id_liquidacion, String nombre_liquidacion) { dataGridView_liquidacion.SelectedCells[1].Value = nombre_liquidacion; dataGridView_liquidacion.SelectedCells[4].Value = id_liquidacion; //COMPRUEBO QUE SI ES DE STOCK, INTRODUZCAN LOS VALORES PERTINENTES. String sqlSelect = "SELECT com_fondos.IdFondo, com_fondos.Stock FROM com_fondos INNER JOIN com_liquidaciones ON com_fondos.IdFondo = com_liquidaciones.IdFondo WHERE com_liquidaciones.IdLiquidacion =" + id_liquidacion; DataTable esStock = Persistencia.SentenciasSQL.select(sqlSelect); if (esStock.Rows.Count > 0) { if (esStock.Rows[0][1].ToString() == "True") { FondosForms.FormModificarStock nueva = new FondosForms.FormModificarStock(esStock.Rows[0][0].ToString(), "+"); nueva.Show(); } } }