Example #1
0
 private void dataGridView_gastos_DoubleClick(object sender, EventArgs e)
 {
     if (dataGridView_gastos.SelectedRows.Count > 0)
     {
         OperacionesForms.FromOperacionesVer nueva = new OperacionesForms.FromOperacionesVer(dataGridView_gastos.SelectedRows[0].Cells[2].Value.ToString(), 2);
         nueva.Show();
     }
 }
        private void dataGridView_recibos_DoubleClick(object sender, EventArgs e)
        {
            String sqlSelectIdOp = "SELECT com_operaciones.IdOp FROM com_operaciones INNER JOIN com_opdetalles ON com_operaciones.IdOp = com_opdetalles.IdOp WHERE com_opdetalles.IdRecibo = " + dataGridView_recibos.SelectedRows[0].Cells[0].Value.ToString();

            DataTable idOp = Persistencia.SentenciasSQL.select(sqlSelectIdOp);

            if (idOp.Rows.Count > 0)
            {
                OperacionesForms.FromOperacionesVer nueva = new OperacionesForms.FromOperacionesVer(idOp.Rows[0][0].ToString(), 2);
                nueva.Show();
            }
        }
 private void dataGridView_entradas_DoubleClick(object sender, EventArgs e)
 {
     OperacionesForms.FromOperacionesVer nueva = new OperacionesForms.FromOperacionesVer(dataGridView_entradas.SelectedRows[0].Cells[0].Value.ToString(), 0);
     nueva.Show();
 }
Example #4
0
 private void verOperaciĆ³nToolStripMenuItem_Click(object sender, EventArgs e)
 {
     OperacionesForms.FromOperacionesVer nueva = new OperacionesForms.FromOperacionesVer(dataGridView_vencmientos.SelectedRows[0].Cells[1].Value.ToString(), 2);
     nueva.Show();
 }
 private void dataGridView_operacionesComuneros_DoubleClick(object sender, EventArgs e)
 {
     OperacionesForms.FromOperacionesVer nueva = new OperacionesForms.FromOperacionesVer(dataGridView_operacionesComuneros.SelectedCells[0].Value.ToString(), 2);
     nueva.Show();
 }
Example #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox_importe.Text == textBox_acumulado.Text)
            {
                String fecha       = (Convert.ToDateTime(DateTime.Now.ToShortDateString())).ToString("yyyy-MM-dd");
                String fechaActual = (Convert.ToDateTime(DateTime.Now.ToShortDateString())).ToString("yyyy-MM-dd hh:mm:ss");

                String    sqlSelect     = "SELECT Nombre, IdSubCuenta, IdBloque, SaldoActual FROM com_provisiones WHERE IdProvision = " + id_provision;
                DataTable filaProvision = Persistencia.SentenciasSQL.select(sqlSelect);

                String idEntidadComunidad = (Persistencia.SentenciasSQL.select("SELECT IdEntidad FROM com_comunidades WHERE IdComunidad = " + id_comunidad_cargado)).Rows[0][0].ToString();

                String sqlInsertarOP = "INSERT INTO com_operaciones (IdComunidad, IdEntidad, IdSubCuenta, IdTipoReparto, Fecha, Descripcion, IdEstado, ImpOp, ImpOpPte, NumMov, Guardada, IdURD, FAct) VALUES (" + id_comunidad_cargado + "," + idEntidadComunidad + "," + filaProvision.Rows[0][1].ToString() + ",1,'" + fecha + "','" + filaProvision.Rows[0][0].ToString() + "','1'," + textBox_importe.Text.Replace(',', '.') + "," + textBox_importe.Text.Replace(',', '.') + ",0,'Si'," + Login.getId() + ",'" + fechaActual + "')";

                int id_opNueva = Persistencia.SentenciasSQL.InsertarGenericoID(sqlInsertarOP);

                //INSERTAR BLOQUE
                String sqlBloque = "INSERT INTO com_opdetbloques (IdOp, IdBloque, Porcentaje, Importe) VALUES (" + id_opNueva + "," + filaProvision.Rows[0][2].ToString() + ",1, " + textBox_importe.Text.Replace(',', '.') + ")";

                Persistencia.SentenciasSQL.InsertarGenerico(sqlBloque);

                //INSERTAR IVA
                String sqlIVA = "INSERT INTO com_opdetiva (IdOp, Base, IdIVA, IVA) VALUES (" + id_opNueva + ", " + textBox_importe.Text.Replace(',', '.') + " ,1,0)";
                Persistencia.SentenciasSQL.InsertarGenerico(sqlIVA);

                //INSERTAR VENCIMIENTO

                String sqlVencimiento = "INSERT INTO com_opdetalles ( IdOp, IdEntidad, Fecha, Importe, ImpOpDetPte, NumMov, IdEstado) VALUES(" + id_opNueva + "," + idEntidadComunidad + ",'" + fecha + "'," + textBox_importe.Text.Replace(',', '.') + "," + textBox_importe.Text.Replace(',', '.') + ",0,1)";
                Persistencia.SentenciasSQL.InsertarGenerico(sqlVencimiento);


                for (int a = 0; a < dataGridView_liquidaciones.Rows.Count; a++)
                {
                    if (dataGridView_liquidaciones.Rows[a].Cells[3].Value != null)
                    {
                        double por     = Convert.ToDouble(dataGridView_liquidaciones.Rows[a].Cells[1].Value.ToString()) / 100;
                        double importe = Convert.ToDouble(dataGridView_liquidaciones.Rows[a].Cells[2].Value.ToString());

                        String sqlInsertLiquidacion = "INSERT INTO com_opdetliquidacion (IdOp, IdLiquidacion, Porcentaje, Importe) VALUES (" + id_opNueva.ToString() + "," + dataGridView_liquidaciones.Rows[a].Cells[3].Value.ToString() + "," + por.ToString().Replace(',', '.') + "," + importe.ToString().Replace(',', '.') + ")";

                        Persistencia.SentenciasSQL.InsertarGenerico(sqlInsertLiquidacion);
                    }
                }

                //ACTUALIZAMOS EL SALDO DE LA PROVISION
                double anterior_provision = Convert.ToDouble(filaProvision.Rows[0][3].ToString());

                if (dedondevengo.Contains("Dotar"))
                {
                    anterior_provision = anterior_provision + Convert.ToDouble(textBox_importe.Text);
                }
                else
                {
                    anterior_provision = anterior_provision - Convert.ToDouble(textBox_importe.Text);
                }
                String sqlUpdateProvision = "UPDATE com_provisiones SET SaldoActual=" + anterior_provision.ToString().Replace(',', '.') + " WHERE IdProvision = " + id_provision;
                Persistencia.SentenciasSQL.InsertarGenerico(sqlUpdateProvision);

                //ABRO LA OPERACION
                OperacionesForms.FromOperacionesVer nueva = new OperacionesForms.FromOperacionesVer(id_comunidad_cargado, id_opNueva.ToString());
                nueva.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("Los Importes no coinciden");
            }
        }