Example #1
0
 private void button_guardar_Click(object sender, EventArgs e)
 {
     try
     {
         if (comprobarImporte())
         {
             for (int a = 0; a < dataGridView_vencimientos.Rows.Count; a++)
             {
                 if (filas_eliminadas.Count > 0)
                 {
                     eliminar_filas();
                 }
                 if (dataGridView_vencimientos.Rows[a].Cells[3].Value != null && dataGridView_vencimientos.Rows[a].Cells[0].Value != null && !dataGridView_vencimientos.Rows[a].IsNewRow)
                 {
                     actualizar_filas(dataGridView_vencimientos.Rows[a].Cells[0].Value.ToString(), dataGridView_vencimientos.Rows[a].Cells[6].Value.ToString(), dataGridView_vencimientos.Rows[a].Cells[1].Value.ToString(), dataGridView_vencimientos.Rows[a].Cells[3].Value.ToString());
                 }
                 else if (dataGridView_vencimientos.Rows[a].Cells[3].Value != null && dataGridView_vencimientos.Rows[a].Cells[3].Value.ToString() != "0.00" && dataGridView_vencimientos.Rows[a].Cells[0].Value == null && !dataGridView_vencimientos.Rows[a].IsNewRow)
                 {
                     insertar_filas(dataGridView_vencimientos.Rows[a].Cells[6].Value.ToString(), dataGridView_vencimientos.Rows[a].Cells[1].Value.ToString(), dataGridView_vencimientos.Rows[a].Cells[3].Value.ToString());
                 }
             }
             if (vengoDePantallaVer)
             {
                 form_anterior.cargarOperacion(id_operacion_cargado);
             }
             else
             {
                 FormOperacionesLiquidacion nueva = new FormOperacionesLiquidacion(id_comunidad_cargado, id_operacion_cargado, textBox_importe_actual.Text);
                 nueva.Show();
             }
             guardado = "si";
             this.Close();
         }
         else
         {
             MessageBox.Show("Revise los importes, el total es : " + textBox_importe_actual.Text + " y debe ser " + textBox_importe_op.Text);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Revisa los datos : " + ex.Message);
     }
 }
Example #2
0
        private void button_guardar_Click(object sender, EventArgs e)
        {
            if (comprobarImporte())
            {
                for (int a = 0; a < dataGridView_add_iva.Rows.Count; a++)
                {
                    if (dataGridView_add_iva.Rows[a].Cells[3].Value != null && dataGridView_add_iva.Rows[a].Cells[0].Value != null && dataGridView_add_iva.Rows[a].Cells[0].Value.ToString() != "0")
                    {
                        actualizar_filasIVA(dataGridView_add_iva.Rows[a].Cells[3].Value.ToString(), dataGridView_add_iva.Rows[a].Cells[0].Value.ToString(), dataGridView_add_iva.Rows[a].Cells[1].Value.ToString(), dataGridView_add_iva.Rows[a].Cells[2].Value.ToString());
                    }
                    else if (dataGridView_add_iva.Rows[a].Cells[0].Value != null && dataGridView_add_iva.Rows[a].Cells[0].Value.ToString() != "0")
                    {
                        insertar_filasIVA(dataGridView_add_iva.Rows[a].Cells[0].Value.ToString(), dataGridView_add_iva.Rows[a].Cells[1].Value.ToString(), dataGridView_add_iva.Rows[a].Cells[2].Value.ToString());
                    }
                    else if (dataGridView_add_iva.Rows[a].Cells[3].Value != null && dataGridView_add_iva.Rows[a].Cells[0].Value.ToString() == "0")
                    {
                        String sqlDelete = "DELETE FROM com_opdetiva WHERE IdDetOpIVA = " + dataGridView_add_iva.Rows[a].Cells[3].Value;
                        Persistencia.SentenciasSQL.InsertarGenerico(sqlDelete);
                    }
                }
                if (vengoDePantallaVer)
                {
                    form_anterior.cargarOperacion(id_operacion_cargado);
                }
                else
                {
                    FormOperacionesEditReparto nueva = new FormOperacionesEditReparto(id_comunidad_cargado, id_operacion_cargado, (Persistencia.SentenciasSQL.select("SELECT IdTipoReparto FROM com_operaciones WHERE IdOp = " + id_operacion_cargado)).Rows[0][0].ToString(), textBox_importe_actual.Text.Replace('.', ','));
                    nueva.Show();
                }
                guardada = "si";

                this.Close();
            }
            else
            {
                MessageBox.Show("Revise el IVA, el total es : " + textBox_importe_actual.Text + " y debe ser " + importeOperacion_cargado);
            }
        }
 private void button_guardar_Click(object sender, EventArgs e)
 {
     if (filas_eliminadas.Count > 0)
     {
         eliminar_filas();
     }
     if (comprobarImporte())
     {
         for (int a = 0; a < dataGridView_reparto.Rows.Count; a++)
         {
             if (dataGridView_reparto.Rows[a].Cells[3].Value != null && dataGridView_reparto.Rows[a].Cells[0].Value != null)
             {
                 actualizar_filasReparto(dataGridView_reparto.Rows[a].Cells[0].Value.ToString(), dataGridView_reparto.Rows[a].Cells[4].Value.ToString(), dataGridView_reparto.Rows[a].Cells[2].Value.ToString(), dataGridView_reparto.Rows[a].Cells[3].Value.ToString());
             }
             else if (dataGridView_reparto.Rows[a].Cells[3].Value != null && dataGridView_reparto.Rows[a].Cells[0].Value == null)
             {
                 insertar_filasReparto(dataGridView_reparto.Rows[a].Cells[4].Value.ToString(), dataGridView_reparto.Rows[a].Cells[2].Value.ToString(), dataGridView_reparto.Rows[a].Cells[3].Value.ToString());
             }
         }
         if (vengoDePantallaVer)
         {
             form_anterior.cargarOperacion(id_operacion_cargado);
         }
         else
         {
             FormOperacionesVencimientos nueva = new FormOperacionesVencimientos(id_comunidad_cargado, id_operacion_cargado, textBox_importe_actual.Text);
             nueva.Show();
         }
         guardada = "si";
         this.Close();
     }
     else
     {
         MessageBox.Show("Revise los importes, el total es : " + textBox_importe_actual.Text + " y debe ser " + textBox_importe_op.Text);
     }
 }
Example #4
0
        private void button_guardar_Click(object sender, EventArgs e)
        {
            if (comprobarImporte())
            {
                for (int a = 0; a < dataGridView_liquidacion.Rows.Count; a++)
                {
                    if (filas_eliminadas.Count > 0)
                    {
                        eliminar_filas();
                    }
                    if (dataGridView_liquidacion.Rows[a].Cells[3].Value != null && dataGridView_liquidacion.Rows[a].Cells[0].Value != null)
                    {
                        actualizar_filasReparto(dataGridView_liquidacion.Rows[a].Cells[0].Value.ToString(), dataGridView_liquidacion.Rows[a].Cells[4].Value.ToString(), dataGridView_liquidacion.Rows[a].Cells[2].Value.ToString(), dataGridView_liquidacion.Rows[a].Cells[3].Value.ToString());
                    }
                    else if (dataGridView_liquidacion.Rows[a].Cells[3].Value != null && dataGridView_liquidacion.Rows[a].Cells[0].Value == null)
                    {
                        insertar_filasReparto(dataGridView_liquidacion.Rows[a].Cells[4].Value.ToString(), dataGridView_liquidacion.Rows[a].Cells[2].Value.ToString(), dataGridView_liquidacion.Rows[a].Cells[3].Value.ToString());
                    }
                }

                //Si el Tipo de Reparto es <> 1 - > generar operación de ingreso 7001. La op de ingreso se registra en IdOpCrea
                //Para cada liquidación, crear operaciones para cada reparto

                bool   varliquidable;
                String TipoReparto   = (Persistencia.SentenciasSQL.select("SELECT IdTipoReparto FROM com_operaciones WHERE IdOp = " + id_operacion_cargado)).Rows[0][0].ToString();
                String TipoSubcuenta = (Persistencia.SentenciasSQL.select("SELECT IdSubCuenta FROM com_operaciones WHERE IdOp = " + id_operacion_cargado)).Rows[0][0].ToString();

                if ((Convert.ToInt32(TipoSubcuenta) >= 60000 && Convert.ToInt32(TipoSubcuenta) <= 69999) || (Convert.ToInt32(TipoSubcuenta) >= 70100 && Convert.ToInt32(TipoSubcuenta) <= 76900))
                {
                    varliquidable = true;
                }
                else
                {
                    varliquidable = false;
                }

                if (TipoReparto != "1" && varliquidable)
                {
                    String varOpCrea = (Persistencia.SentenciasSQL.select("SELECT IdOpCrea FROM com_operaciones WHERE IdOp = " + id_operacion_cargado)).Rows[0][0].ToString();

                    String    sqlBloqsOp = "SELECT com_opdetbloques.IdOp, com_opdetbloques.IdDivision, com_opdetbloques.IdEntidad, com_opdetbloques.Porcentaje From com_opdetbloques WHERE com_opdetbloques.IdOp = " + id_operacion_cargado;
                    DataTable BloqsOp    = Persistencia.SentenciasSQL.select(sqlBloqsOp);

                    String    sqlLiqsOp = "SELECT com_opdetliquidacion.IdOp, com_opdetliquidacion.IdLiquidacion, com_opdetliquidacion.Porcentaje, com_opdetliquidacion.Importe From com_opdetliquidacion WHERE com_opdetliquidacion.IdOp = " + id_operacion_cargado;
                    DataTable LiqsOp    = Persistencia.SentenciasSQL.select(sqlLiqsOp);

                    int TotalLiqs  = LiqsOp.Rows.Count;
                    int CuentaLiqs = 1;

                    for (int a = 0; a < LiqsOp.Rows.Count; a++)
                    {
                        for (int b = 0; b < LiqsOp.Rows.Count; b++)
                        {
                            String varImpReparto = (Convert.ToDouble(LiqsOp.Rows[a][3].ToString()) * Convert.ToDouble(LiqsOp.Rows[a][2].ToString())).ToString();
                            String strCuentaLiqs = CuentaLiqs + "/" + TotalLiqs;

                            if (strCuentaLiqs == "1/1")
                            {
                                strCuentaLiqs = "";
                            }

                            if (TipoReparto == "2")
                            {
                                Logica.FuncionesTesoreria.CreaOP_PartDiv(id_comunidad_cargado, BloqsOp.Rows[b][1].ToString(), LiqsOp.Rows[a][1].ToString(), varImpReparto.Replace(",", "."), id_operacion_cargado, strCuentaLiqs);
                            }
                        }
                        CuentaLiqs++;
                    }
                }
                if (vengoDePantallaVer)
                {
                    form_anterior.cargarOperacion(id_operacion_cargado);
                }
                else
                {
                    FromOperacionesVer nueva = new FromOperacionesVer(id_operacion_cargado, 1, id_comunidad_cargado);
                    nueva.Show();
                }
                guardada = "si";
                this.Close();
            }
            else
            {
                MessageBox.Show("Revise los importes, el total es : " + textBox_importe_actual.Text + " y debe ser " + textBox_importe_op.Text);
            }
        }
Example #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            // Cabecera de edicion aqui
            //id_comunidad_cargado + "," + id_entidad_nuevo + "," + comboBox_cuenta_gastos.SelectedValue.ToString() + "," + comboBox_tipo_reparto.SelectedValue.ToString() + ",'" + fechaInicio + "','" + textBox_documento.Text + "','" + textBox_descripcion.Text + "'," + comboBox_porcentage

            if (maskedTextBox_fecha.Text == "  /  /")
            {
                MessageBox.Show("La fecha no puede estar vacía");
                maskedTextBox_fecha.Text = (Convert.ToDateTime(DateTime.Now)).ToString("dd-MM-yyyy");
                return;
            }
            if (id_entidad_nuevo == null)
            {
                MessageBox.Show("La identidad no puede estar vacía");
                return;
            }
            if (textBox_documento.Text == "")
            {
                MessageBox.Show("El Documento no puede estar vacío");
                return;
            }
            if (textBox_importe.Text == "")
            {
                MessageBox.Show("El Importe no puede estar vacío");
                return;
            }
            String fechaInicio         = (Convert.ToDateTime(maskedTextBox_fecha.Text)).ToString("yyyy-MM-dd");
            String fecha_actualizacion = (Convert.ToDateTime(DateTime.Now)).ToString("yyyy-MM-dd hh:mm:ss");

            if (id_operacion_cargado != "0")
            {
                if (textBox_expediente.Text != "")
                {
                    String sqlUpdate = "UPDATE com_operaciones SET IdEntidad=" + id_entidad_nuevo + ",IdSubCuenta=" + comboBox_cuenta_gastos.SelectedValue.ToString() + ", IdTipoReparto = " + comboBox_tipo_reparto.SelectedValue.ToString() + ",Fecha='" + fechaInicio + "',Documento='" + textBox_documento.Text + "',Descripcion='" + textBox_descripcion.Text + "',IdRetencion=" + comboBox_porcentage_retencion.SelectedValue.ToString() + ",BaseRet=" + textBox_base_retencion.Text.Replace(',', '.') + ",IdExpte= " + textBox_expediente.Text + " , Retencion=" + textBox_retencion.Text.Replace(',', '.') + ",Notas='" + textBox_notas.Text + "',ImpOp=" + Logica.FuncionesGenerales.ArreglarImportes(textBox_importe.Text) + ",ImpOpPte = " + Logica.FuncionesGenerales.ArreglarImportes(textBox_importe.Text) + ", IdURD = " + Presentacion.Login.getId() + ",FAct = '" + fecha_actualizacion + "'  WHERE IdOp = " + id_operacion_cargado;
                    Persistencia.SentenciasSQL.InsertarGenerico(sqlUpdate);
                }
                else
                {
                    String sqlUpdate = "UPDATE com_operaciones SET IdEntidad=" + id_entidad_nuevo + ",IdSubCuenta=" + comboBox_cuenta_gastos.SelectedValue.ToString() + ", IdTipoReparto = " + comboBox_tipo_reparto.SelectedValue.ToString() + ",Fecha='" + fechaInicio + "',Documento='" + textBox_documento.Text + "',Descripcion='" + textBox_descripcion.Text + "',IdRetencion=" + comboBox_porcentage_retencion.SelectedValue.ToString() + ",BaseRet=" + textBox_base_retencion.Text.Replace(',', '.') + ",Retencion=" + textBox_retencion.Text.Replace(',', '.') + ",Notas='" + textBox_notas.Text + "',ImpOp=" + Logica.FuncionesGenerales.ArreglarImportes(textBox_importe.Text) + ",ImpOpPte = " + Logica.FuncionesGenerales.ArreglarImportes(textBox_importe.Text) + ", IdURD = " + Presentacion.Login.getId() + ",FAct = '" + fecha_actualizacion + "'  WHERE IdOp = " + id_operacion_cargado;
                    Persistencia.SentenciasSQL.InsertarGenerico(sqlUpdate);
                }
                form_anterior.cargarOperacion(id_operacion_cargado);
                this.Close();
            }
            else
            {
                int idop;
                if (textBox_expediente.Text != "")
                {
                    String sqlInsert = "INSERT INTO com_operaciones(IdComunidad, IdEntidad, IdSubCuenta, IdTipoReparto, Fecha, Documento, Descripcion, IdRetencion, BaseRet, Retencion, Notas, IdEstado, IdExpte, ImpOp, ImpOpPte, NumMov, Guardada, IdURD, FAct) VALUES (" + id_comunidad_cargado + "," + id_entidad_nuevo + "," + comboBox_cuenta_gastos.SelectedValue.ToString() + "," + comboBox_tipo_reparto.SelectedValue.ToString() + ",'" + fechaInicio + "','" + textBox_documento.Text + "','" + textBox_descripcion.Text + "'," + comboBox_porcentage_retencion.SelectedValue.ToString() + "," + textBox_base_retencion.Text + "," + textBox_retencion.Text + ",'" + textBox_notas.Text + "','1'," + textBox_expediente.Text + "," + Logica.FuncionesGenerales.ArreglarImportes(textBox_importe.Text) + "," + Logica.FuncionesGenerales.ArreglarImportes(textBox_importe.Text) + ",0,'No'," + Presentacion.Login.getId() + ",'" + fecha_actualizacion + "')";

                    idop = Persistencia.SentenciasSQL.InsertarGenericoID(sqlInsert);
                }
                else
                {
                    String sqlInsert = "INSERT INTO com_operaciones(IdComunidad, IdEntidad, IdSubCuenta, IdTipoReparto, Fecha, Documento, Descripcion, IdRetencion, BaseRet, Retencion, Notas, IdEstado, ImpOp, ImpOpPte, NumMov, Guardada, IdURD, FAct) VALUES (" + id_comunidad_cargado + "," + id_entidad_nuevo + "," + comboBox_cuenta_gastos.SelectedValue.ToString() + "," + comboBox_tipo_reparto.SelectedValue.ToString() + ",'" + fechaInicio + "','" + textBox_documento.Text + "','" + textBox_descripcion.Text + "'," + comboBox_porcentage_retencion.SelectedValue.ToString() + "," + textBox_base_retencion.Text + "," + textBox_retencion.Text + ",'" + textBox_notas.Text + "','1'," + Logica.FuncionesGenerales.ArreglarImportes(textBox_importe.Text) + "," + Logica.FuncionesGenerales.ArreglarImportes(textBox_importe.Text) + ",0,'No'," + Presentacion.Login.getId() + ",'" + fecha_actualizacion + "')";

                    idop = Persistencia.SentenciasSQL.InsertarGenericoID(sqlInsert);
                }
                if (Convert.ToDouble(textBox_retencion.Text) > 0.00)
                {
                    tieneRetencion(idop.ToString());
                }

                FormOperacionesAddIVA nueva = new FormOperacionesAddIVA(id_comunidad_cargado, idop.ToString(), textBox_importe.Text.Replace('.', ','));
                nueva.Show();
                this.Close();
            }
        }