예제 #1
0
        private void Cbo_codCot_SelectedIndexChanged_1(object sender, EventArgs e)
        {
            if (Cbo_opcion.SelectedIndex == 1)
            {
                encontradoCot = logicaConsulta.comprobarCotizacion(listaCot.ElementAt(Cbo_codCot.SelectedIndex).ToString(), Txt_cotizacion);

                if (encontradoCot == true)
                {
                    TextBox textBox = new TextBox();
                    bcliente = true;

                    logicaConsulta.obtenerCotizacionE(listaCot.ElementAt(Cbo_codCot.SelectedIndex).ToString(), textBox, Txt_fecha, true);
                    logicaConsulta.consultarCliente(listaClientes.ElementAt(Int32.Parse(textBox.Text) - 1).ToString(), Txt_nombres, Txt_apellidos, Txt_nit, false);
                    logicaConsulta.obtenerCotizacionD(listaCot.ElementAt(Cbo_codCot.SelectedIndex).ToString(), Dgv_factura);
                    Cbo_cliente.SelectedIndex = Int32.Parse(textBox.Text) - 1;

                    iddCotizacion = listaCot.ElementAt(Cbo_codCot.SelectedIndex).ToString();

                    double subtotal = 0;
                    int    cantidad = 0;

                    if (Dgv_factura.Rows.Count - 1 > 0)
                    {
                        for (int i = 0; i < Dgv_factura.Rows.Count - 1; i++)
                        {
                            subtotal += Double.Parse(Dgv_factura.Rows[i].Cells[4].Value.ToString());
                            cantidad += Int32.Parse(Dgv_factura.Rows[i].Cells[1].Value.ToString());
                        }

                        Txt_subtotalGeneral.Text = "Q. " + String.Format("{0:0.00}", subtotal);
                        Txt_total.Text           = "Q. " + String.Format("{0:0.00}", subtotal);
                        int registros = cantidad;
                        Txt_registros.Text = registros.ToString();
                    }
                }
            }

            if (Cbo_opcion.SelectedIndex == 0)
            {
                iddCotizacion = "NULL";
            }
        }
 private void Cbo_clientes_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(listaClientes.ElementAt(Cbo_clientes.SelectedIndex).ToString()))
     {
         bcliente = logicaConsulta.consultarCliente(listaClientes.ElementAt(Cbo_clientes.SelectedIndex).ToString(), Txt_nombres, Txt_apellidos, Txt_nit, false);
     }
     else
     {
         MessageBox.Show("Campo Vacio!", "Facturacion", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #3
0
        private void Cbo_doc_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (Cbo_documento.SelectedIndex)
            {
            case 0:
                break;

            case 1:
                encontradoCot = logicaConsulta.comprobarCotizacion(listaCotizacion.ElementAt(Cbo_doc.SelectedIndex).ToString(), Txt_cotizacion);

                Txt_pedido.Text   = null;
                Txt_fechaPed.Text = null;
                if (encontradoCot == true)
                {
                    TextBox textBox = new TextBox();
                    iddCotizacion = listaCotizacion.ElementAt(Cbo_doc.SelectedIndex).ToString();
                    bcliente      = true;

                    logicaConsulta.obtenerCotizacionE(iddCotizacion, textBox, Txt_fechaCot, true);
                    logicaConsulta.consultarCliente(listaClientes.ElementAt(Int32.Parse(textBox.Text) - 1).ToString(), Txt_nombres, Txt_apellidos, Txt_nit, false);
                    logicaConsulta.obtenerCotizacionD(iddCotizacion, Dgv_factura);
                    Cbo_cliente.SelectedIndex = Int32.Parse(textBox.Text) - 1;

                    subtotal = 0;
                    cantidad = 0;

                    if (Dgv_factura.Rows.Count - 1 > 0)
                    {
                        for (int i = 0; i < Dgv_factura.Rows.Count - 1; i++)
                        {
                            subtotal += Double.Parse(Dgv_factura.Rows[i].Cells[4].Value.ToString());
                            cantidad += Int32.Parse(Dgv_factura.Rows[i].Cells[1].Value.ToString());
                        }

                        Txt_subtotalGeneral.Text = "Q. " + String.Format("{0:0.00}", subtotal);
                        Txt_total.Text           = "Q. " + String.Format("{0:0.00}", subtotal);
                        int registros = Dgv_factura.Rows.Count - 1;
                        Txt_registros.Text = registros.ToString();
                    }
                }
                break;

            case 2:
                encontradoPed = logicaConsulta.comprobarPedido(listaPedidos.ElementAt(Cbo_doc.SelectedIndex).ToString(), Txt_pedido);
                if (encontradoPed == true)
                {
                    TextBox textBox = new TextBox();
                    iddPedido = listaPedidos.ElementAt(Cbo_doc.SelectedIndex).ToString();
                    bcliente  = true;
                    logicaConsulta.obtenerPedidoE(iddPedido, textBox, Txt_fechaCot, Txt_cotizacion, Txt_fechaPed);
                    iddCotizacion = Txt_cotizacion.Text;
                    logicaConsulta.consultarCliente(listaClientes.ElementAt(Int32.Parse(textBox.Text) - 1).ToString(), Txt_nombres, Txt_apellidos, Txt_nit, false);
                    logicaConsulta.obtenerPedidoD(iddPedido, Dgv_factura);
                    Cbo_cliente.SelectedIndex = Int32.Parse(textBox.Text) - 1;


                    subtotal = 0;
                    cantidad = 0;

                    if (Dgv_factura.Rows.Count - 1 > 0)
                    {
                        for (int i = 0; i < Dgv_factura.Rows.Count - 1; i++)
                        {
                            subtotal += Double.Parse(Dgv_factura.Rows[i].Cells[4].Value.ToString());
                            cantidad += Int32.Parse(Dgv_factura.Rows[i].Cells[1].Value.ToString());
                        }

                        Txt_subtotalGeneral.Text = "Q. " + String.Format("{0:0.00}", subtotal);
                        Txt_total.Text           = "Q. " + String.Format("{0:0.00}", subtotal);
                        int registros = Dgv_factura.Rows.Count - 1;
                        Txt_registros.Text = registros.ToString();
                    }
                }
                break;
            }
        }