Пример #1
0
        //Metodo para cargar cliente por medio cotizacion
        public void ClientesCotizacion() {
            try
            {
                string codigoFac = globalCodigo;
                DataTable cliente = new DataTable();
                DataGridView contiene = new DataGridView();
                cliente = CapaDatos.ConsultaClientePaFactura(codigoFac);
                contiene.DataSource = cliente;

                DataRow rows = cliente.Rows[0];
                DataRow rows2 = cliente.Rows[0];
                DataRow rows3 = cliente.Rows[0];
                DataRow rows4 = cliente.Rows[0];

                string codigoOss = Convert.ToString(rows[0]);
                string nombress = Convert.ToString(rows2[1]);
                string apellidoss = Convert.ToString(rows3[2]);
                string nitss = Convert.ToString(rows4[3]);

                txt_temporal.Text = codigoOss;
                txt_nombre.Text = nombress;
                txt_apellido.Text = apellidoss;
                txt_nit.Text = nitss;
            }
            catch {
                MessageBox.Show("Errro de Llamado");
            }
        }
Пример #2
0
        //cargar datagridview a traves del codigo cotizacion
        public void cargardetalle()
        {
            try
            {
                columnas();
                int       tempo = Convert.ToInt32(cmb_cotizaciones.SelectedValue.ToString());
                DataTable dt;
                dt = CapaDatos.ConsultadetalleCotizacion(tempo);
                double suma = 0;
                foreach (DataRow row in dt.Rows)
                {
                    int       codigoD   = Convert.ToInt32(row[0].ToString().Trim());
                    DataTable dt2       = CapaDatos.CargarGridAutoIncrement("select descripcion from producto_m where id_producto = " + codigoD + ";");
                    DataRow   rowi      = dt2.Rows[0];
                    string    ronald    = Convert.ToString(rowi[0]);
                    int       cantidadD = Convert.ToInt32(row[1].ToString().Trim());
                    DataTable dt5       = CapaDatos.CargarGridAutoIncrement("select precio_unidad from producto_m where id_producto = " + codigoD + ";");
                    DataRow   dete      = dt5.Rows[0];
                    string    caris     = Convert.ToString(dete[0]);
                    double    final     = Convert.ToDouble(caris);

                    double subtotalD = Convert.ToDouble(row[2].ToString().Trim());
                    //dgv_facturaDetalle.Rows.Insert(0, codigo_facturaM, codigoD, cantidadD, subtotalD);
                    dgv_facturaDetalle.Rows.Add(codigoD, ronald, cantidadD, final, subtotalD);
                    //suma += Convert.ToDouble(row.Cells[].Value);
                    suma += Convert.ToDouble(row[2].ToString().Trim());
                }
                txt_total.Text = Convert.ToString(suma);
            }
            catch
            {
                MessageBox.Show("error al llamdo de cotizacion detalle");
            }
        }
Пример #3
0
        private void cmb_producto_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                txt_codigo.Text = Convert.ToString(cmb_producto.SelectedValue.ToString());


                DataTable dt = new DataTable();
                dt = CapaDatos.ConsultarMarca(cmb_producto.SelectedValue.ToString());
                cmb_marca.DataSource = dt;
                cmb_marca.DisplayMember = "nombre_marca";
                cmb_marca.ValueMember = "id_marca";
                string productoPP = Convert.ToString(cmb_producto.SelectedValue.ToString());

                double precioUN = CapaDatos.ConsultATipoPrecio(txt_tipo.Text, productoPP);
                string precioPP = Convert.ToString(precioUN);
                txt_precioUnidad.Text = precioPP;

                string bodegasP = Convert.ToString(cmb_bodega.SelectedValue.ToString());
                string recibeExistencia = Convert.ToString(CapaDatos.ConsultaExistenciav1(productoPP, bodegasP));
                txt_existencia.Text = recibeExistencia;
            }
            catch { MessageBox.Show("Error de text changed de cmb_producto"); }


        }
Пример #4
0
        public void BuscarCliente()
        {
            try
            {
                BuscarCliente abir = new BuscarCliente();
                //this.Hide();
                abir.ShowDialog();

                if (!String.IsNullOrEmpty(abir.codigoC) && !String.IsNullOrEmpty(abir.nitC) && !String.IsNullOrEmpty(abir.nombreC) &&
                            !String.IsNullOrEmpty(abir.apellidoC))
                {
                    txt_temporal.Text = abir.codigoC;
                    txt_nit.Text = abir.nitC;
                    txt_nombre.Text = abir.nombreC;
                    txt_apellido.Text = abir.apellidoC;
                    txt_tipo.Text = abir.tipo;
                    //this.Close();
                    //this.Show();
                    ProductoControl.Enabled = true;
                    TextLLeno();
                    int incidenciaParcial = CapaDatos.ConsultaInsidencia(txt_temporal.Text);
                    IncidenciaFinal = incidenciaParcial;
                    
                }
            }
            catch
            {
                MessageBox.Show("Error al cargar formulario");
            }
        }
Пример #5
0
        private void btn_guardar_Click(object sender, EventArgs e)
        {
            try
            {
                dtpFechaI.Format       = DateTimePickerFormat.Custom;
                dtpFechaI.CustomFormat = "yyyy-MM-dd";

                dtpFechaT.Format       = DateTimePickerFormat.Custom;
                dtpFechaT.CustomFormat = "yyyy-MM-dd";
                CapaDatos inserta = new CapaDatos();
                inserta.InsertarCotizacion(txtCliente.Text.Trim(), txtTelefono.Text.Trim(), dtpFechaI.Text.Trim(), dtpFechaT.Text.Trim());

                CapaDatos v      = new CapaDatos();
                DataTable dt1    = CapaDatos.CargarGridAutoIncrement("select AUTO_INCREMENT from information_schema.TABLES where TABLE_SCHEMA='crmbd' and TABLE_NAME='cotizacion_encabezado';");
                DataRow   rows   = dt1.Rows[0];
                int       id_req = Convert.ToInt32(rows[0]);

                foreach (DataGridViewRow row in dgvCotizacion.Rows)
                {
                    int    codigo_cotizacionN = id_req - 1;
                    int    codigo_productoN   = Convert.ToInt32(row.Cells[0].Value);
                    int    cantidadN          = Convert.ToInt32(row.Cells[3].Value);
                    double subttotalN         = Convert.ToDouble(row.Cells[4].Value);
                    v.insertar_detalle_cotizacion(codigo_cotizacionN, codigo_productoN, cantidadN, subttotalN);
                }
            }
            catch {
                MessageBox.Show("Error al guardar datos de insercion");
            }
        }
Пример #6
0
        private void btn_guardar_Click(object sender, EventArgs e)
        {
            try
            {
                //formato para los datatimepicker
                dtpFechaI.Format       = DateTimePickerFormat.Custom;
                dtpFechaI.CustomFormat = "yyyy-MM-dd";
                dtpFechaT.Format       = DateTimePickerFormat.Custom;
                dtpFechaT.CustomFormat = "yyyy-MM-dd";
                CapaDatos db = new CapaDatos();

                string id_cotizacionO = txt_codigoTemporal.Text;
                string nombreT        = txtCliente.Text;
                string TelefonoT      = txtTelefono.Text;
                string fechaInn       = dtpFechaI.Text;
                string fechaTerr      = dtpFechaT.Text;

                db.ActualziarCotizacionEncabezado(nombreT, TelefonoT, dtpFechaI.Text.Trim(), dtpFechaT.Text.Trim(), id_cotizacionO);
                MessageBox.Show("correcto");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #7
0
        //Guardar datos de factura, cliente y detalle factura
        private void btn_guardar_Click(object sender, EventArgs e)
        {
            try
            {
           
                Factura fac = new Factura();
                CapaDatos nuev = new CapaDatos();
                //formato para los datatimepicker   
                dtp_fecha.Format = DateTimePickerFormat.Custom;
                dtp_fecha.CustomFormat = "yyyy-MM-dd";

                if (!String.IsNullOrEmpty(txt_nombre.Text.Trim()) && !String.IsNullOrEmpty(txt_apellido.Text.Trim()) &&
                                         cmb_pago.SelectedIndex != -1)
                {
                    CapaDatos db = new CapaDatos();
                    //Manejo db = new Manejo();
                    string formaPago = cmb_pago.SelectedItem.ToString();
                    double sumaTotal = Convert.ToDouble(txt_total.Text.Trim());
                    int IdCliente = Convert.ToInt32(txt_temporal.Text.Trim());
                    string empleados = Convert.ToString(cmb_empleado.SelectedValue.ToString());
                    string BodegaID = Convert.ToString(cmb_bodega.SelectedValue.ToString());
                    db.GuardarFacturaEncabezado(dtp_fecha.Text.Trim(), formaPago, sumaTotal, IdCliente, empleados, BodegaID);

                    int codigoAutoIncrement = CapaDatos.ConsultaUatoIncrementFactura();
                    CapaDatos v = new CapaDatos();
                    /*DataTable dt1 = CapaDatos.CargarGridAutoIncrement("select AUTO_INCREMENT from information_schema.TABLES where TABLE_SCHEMA='prueba' and TABLE_NAME='factura_encabezado';");
                    DataRow rows = dt1.Rows[0];
                    int codigoObtenido = Convert.ToInt32(rows[0]);*/
                    int MiBodega2 = Convert.ToInt32(BodegaID);
                    foreach (DataGridViewRow row in dgv_facturaDetalle.Rows)
                    {
                        int codigo_facturaM = codigoAutoIncrement - 1;
                        int codigo_productoM = Convert.ToInt32(row.Cells[0].Value);
                        int idMarca = Convert.ToInt32(row.Cells[2].Value);
                        int Existencia2 = Convert.ToInt32(CapaDatos.ConsultaExistenciav1(Convert.ToString(codigo_productoM), BodegaID));
                        int cantidadM = Convert.ToInt32(row.Cells[4].Value);
                        int existenciaNueva = Existencia2 - cantidadM;
                        double precioM = Convert.ToDouble(row.Cells[5].Value);
                        double subtotalM = Convert.ToDouble(row.Cells[6].Value);
                        v.ActualziarExistencia(existenciaNueva, codigo_productoM, idMarca, MiBodega2);
                        v.insertar_detalle_factura(codigo_facturaM, codigo_productoM, idMarca, cantidadM, precioM, subtotalM);
                    } //termina mi foreach
                    MessageBox.Show("Se Actualizo Existencia");     
                }
                
                if (chb_habilita.Checked) {
                        CapaDatos nuevo = new CapaDatos();
                        string temporales = cmb_cotizaciones.SelectedValue.ToString();
                        nuevo.ActualizaEstadoPedidoCotizacion(temporales);
                    }
                MessageBox.Show(" Se Guardo Factura Exitosamente ");
                this.Close();
            }
            catch
            {
                MessageBox.Show("Error al Guardar datos de insercion");
            }
        }
Пример #8
0
 public void FuncionCodigo() {
     try
     {
         string enviaCodigo = Convert.ToString(cmb_cotizaciones.SelectedValue.ToString());
         int codigoRecibe = CapaDatos.ConsultacodigoClienteCotizacion(enviaCodigo);
         globalCodigo = Convert.ToString(codigoRecibe);
     }
     catch { MessageBox.Show("No hay Cotizaciones"); }
 }
Пример #9
0
        private void Cotizacion_Load(object sender, EventArgs e)
        {
            ControlProducto.Enabled = false;
            ClienteData.Enabled     = false;
            CapaDatos cap = new CapaDatos();
            //cap.llenar_id_pro(cmbCodigo);
            int codigoAutoIncremente = CapaDatos.ConsultaUatoIncrementCotizacion();

            lbl_codigoAuto.Text = Convert.ToString(codigoAutoIncremente);
        }
Пример #10
0
 private void txt_buscarP_TextChanged(object sender, EventArgs e)
 {
     try
     {
         DataTable carga = CapaDatos.CargarGridAutoIncrement("select id_producto, descripcion, precio_unidad, precio_mayorista from producto_m WHERE id_producto like '%" + txt_buscarP.Text + "%' or descripcion like '%" + txt_buscarP.Text + "%'");
         dgv_productosVista.DataSource = carga;
     }
     catch {
         MessageBox.Show("Error al cargar");
     }
 }
Пример #11
0
 public void Factura_Load(object sender, EventArgs e)
 {
     int IDFACtura = CapaDatos.ConsultaUatoIncrementFactura();
     txt_motrarID.Text = Convert.ToString(IDFACtura);
     ProductoControl.Enabled = false;
     controlCotizacion.Enabled = false;
     ClienteControl.Enabled = false;
     //TextLLeno();
     FuncionCodigo();
     dgv_facturaDetalle.DataSource = null;
 }
Пример #12
0
 public void cargarDetalle()
 {
     try
     {
         DataTable cargas = CapaDatos.CargarGridAutoIncrement("select * from cotizacion_encabezado;");
         dgv_CotizacionVista.DataSource = cargas;
     }
     catch {
         MessageBox.Show("Error al cargar");
     }
 }
Пример #13
0
        public void button1_Click(object sender, EventArgs e)
        {
            try
            {
                BuscarProducto abir = new BuscarProducto();
                //this.Hide();
                abir.ShowDialog();

                Factura   fac         = new Factura();
                CapaDatos nuev        = new CapaDatos();
                string    codigoP     = abir.dgv_productosVista.CurrentRow.Cells[0].Value.ToString();
                string    decripcionP = abir.dgv_productosVista.CurrentRow.Cells[1].Value.ToString();
                string    precioUP    = abir.dgv_productosVista.CurrentRow.Cells[2].Value.ToString();
                string    precioMayor = abir.dgv_productosVista.CurrentRow.Cells[3].Value.ToString();
                string    decidido    = "";
                int       primero     = Convert.ToInt32(txt_tipo.Text);
                if (primero == 1)
                {
                    decidido = precioUP;
                }
                if (primero == 2)
                {
                    decidido = precioMayor;
                }
                double temporal1 = Convert.ToDouble(abir.txt_cantidad.Text);
                int    temporal2 = Convert.ToInt32(decidido);
                double subtot    = temporal1 * temporal2;
                string SubtotalP = Convert.ToString(subtot);



                if (!String.IsNullOrEmpty(codigoP) && !String.IsNullOrEmpty(decripcionP) && !String.IsNullOrEmpty(precioUP) &&
                    !String.IsNullOrEmpty(SubtotalP))
                {
                    dgvCotizacion.Rows.Add(codigoP, decripcionP, abir.txt_cantidad.Text, decidido, SubtotalP);
                    //dgv_facturaDetalle.Rows.Insert(0, cmb_codigo.SelectedValue.ToString(), cmb_descripcion.SelectedValue.ToString(), txt_cantidad.Text, cmb_prueba.SelectedValue.ToString(), subtotall);

                    int suma = 0;
                    foreach (DataGridViewRow row in dgvCotizacion.Rows)
                    {
                        suma += Convert.ToInt32(row.Cells["subtotal"].Value);
                        //suma += (int)row.Cells["Subtotal"].Value;
                    }
                    txt_total.Text         = Convert.ToString(suma);
                    abir.txt_cantidad.Text = "";
                    //this.Close();
                }
                //this.Show();
            }
            catch
            {
                MessageBox.Show("Error al agregar a detalle");
            }
        }
Пример #14
0
 public void CargarDetalle()
 {
     try
     {
         DataTable cargas = CapaDatos.CargarGridAutoIncrement("select * from factura_encabezado;");
         dgv_FacturaVista.DataSource = cargas;
     }
     catch {
         MessageBox.Show("Error de carga");
     }
 }
Пример #15
0
 private void BuscarProducto_Load(object sender, EventArgs e)
 {
     try
     {
         DataTable carga = CapaDatos.CargarGridAutoIncrement("select id_producto, descripcion, precio_unidad, precio_mayorista from producto_m ORDER BY descripcion ASC");
         dgv_productosVista.DataSource = carga;
     }
     catch {
         MessageBox.Show("Error al cargar");
     }
 }
Пример #16
0
 private void txt_buscar_TextChanged(object sender, EventArgs e)
 {
     try
     {
         DataTable carga = CapaDatos.ConsultaCodigoYNombre(txt_buscar.Text);
         dgv_buscarCliente.DataSource = carga;
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #17
0
 //Metodod de total cotizacion
 public void total() {
         if (cmb_cotizaciones.Items.Count <= 0)
         {
             MessageBox.Show("No hay totales");
         }
         else
         {
     string envia = Convert.ToString(cmb_cotizaciones.SelectedValue.ToString());
     double recibe = CapaDatos.ConsultaTotal(envia);
     string recibeConvert = Convert.ToString(recibe);
     txt_total.Text = recibeConvert;
         }
 }
Пример #18
0
        //metodo para cargar la coleccion de datos para el autocomplete
        public AutoCompleteStringCollection Autocomplete()
        {
            CapaDatos nu  = new CapaDatos();
            DataTable dt2 = new DataTable();
            AutoCompleteStringCollection coleccion = new AutoCompleteStringCollection();

            //recorrer y cargar los items para el autocompletado
            foreach (DataRow row in dt2.Rows)
            {
                coleccion.Add(Convert.ToString(row["nombre"]));
            }
            return(coleccion);
        }
Пример #19
0
 //metodo para cargar la coleccion de datos para el autocomplete
 public AutoCompleteStringCollection AutocompleteV2()
 {
     string BodegaF = cmb_bodega.SelectedValue.ToString();
     CapaDatos nu = new CapaDatos();
     DataTable dt2 = nu.Datos(BodegaF);
     AutoCompleteStringCollection coleccion = new AutoCompleteStringCollection();
     //recorrer y cargar los items para el autocompletado
     foreach (DataRow row in dt2.Rows)
     {
         coleccion.Add(Convert.ToString(row["nombre"]));
     }
     return coleccion;
 }
Пример #20
0
 public void ObtenerCodigoCliente()
 {
     try
     {
         int       temporal   = Convert.ToInt32(cmb_cotizaciones.SelectedValue.ToString());
         DataTable cargas     = CapaDatos.CargarGridAutoIncrement("select id_cliente from factura_encabezado where id_factura=" + cmb_cotizaciones.SelectedValue.ToString() + ";");
         DataRow   codigoS    = cargas.Rows[0];
         string    idCLientes = Convert.ToString(codigoS[0]);
         txt_codigoTemporal.Text = idCLientes;
     }
     catch {
         MessageBox.Show("Error de Carga");
     }
 }
Пример #21
0
        public void LLenarTabla()
        {
            /*try
             * {*/
            string constant = Convert.ToString(txt_ratos.Text);
            //DataTable carga = CapaDatos.CargarGridAutoIncrement("select p.id_producto, p.nombre, pr.precio, pr.id_bien, pr.id_tipo, pr.id_marca FROM producto p INNER JOIN precio pr ON p.id_producto = pr.id_bien  WHERE pr.id_tipo ='"+constan+"' ORDER BY p.nombre ASC");
            DataTable carga = CapaDatos.CargaProducto2(constant);

            dgv_productosVista.DataSource = carga;

            /*}
             * catch {
             *  MessageBox.Show("Error al cargar el formularios");
             * }*/
        }
Пример #22
0
        //Cargar datagridview a traves del codigo cotizacion
        public void cargardetalle()
        {
            /*try
            {*/   
            string tempo = Convert.ToString(cmb_cotizaciones.SelectedValue.ToString());
            DataTable dt = CapaDatos.CargarDetalleCotiza(tempo);
            dgv_facturaDetalle.DataSource = dt;

            /*}
            catch
            {
                MessageBox.Show("No hay Cotizacion en base de datos");
            }*/

        }
Пример #23
0
        public void BuscarSelect()
        {
            /*try
             * {*/
            int    constan = Convert.ToInt32(txt_ratos.Text);
            string letra   = Convert.ToString(txt_buscarP.Text);
            //DataTable carga = CapaDatos.CargarGridAutoIncrement("select p.id, p.nombre, p.existencia, pr.precio, pr.id_bien, pr.id_tipo FROM producto p inner JOIN precio pr ON p.id = pr.id_bien WHERE pr.id_tipo='"+constan+"' and p.id like '%"+txt_buscarP.Text+"%' or pr.id_tipo='"+constan+"' and p.nombre like '%"+txt_buscarP.Text+"%'");
            DataTable carga = CapaDatos.CargaProducto(constan, letra);

            dgv_productosVista.DataSource = carga;

            /*}
             * catch {
             *  MessageBox.Show("Error al cargar busqueda");
             * }*/
        }
Пример #24
0
 private void btn_guardar_Click(object sender, EventArgs e)
 {
     try
     {
         CapaDatos db    = new CapaDatos();
         int       Temp1 = Convert.ToInt32(txt_nit.Text);
         int       Temp2 = Convert.ToInt32(txt_telefono.Text);
         int       temp3 = Convert.ToInt32(txt_tipo.Text);
         db.GuardarCliente(Temp1, txt_nombre.Text, txt_apellido.Text, txt_direccion.Text, Temp2, temp3);
         MessageBox.Show("Correcta Insercion");
         this.Close();
     }
     catch {
         MessageBox.Show("Error al guardar resgitro");
     }
 }
Пример #25
0
 private void btn_eliminar_Click(object sender, EventArgs e)
 {
     try
     {
         DialogResult result = MessageBox.Show("Desea Eliminar la Fila? ", " Message of Option Delete ", MessageBoxButtons.YesNo);
         if (result == DialogResult.Yes)
         {
             CapaDatos abrir   = new CapaDatos();
             string    CodigoC = this.dgv_CotizacionVista.CurrentRow.Cells[0].Value.ToString();
             abrir.ActualizaEstado(CodigoC);
         }
     }
     catch {
         MessageBox.Show("Error al borrar");
     }
 }
Пример #26
0
 private void btn_verifica_Click(object sender, EventArgs e)
 {
     btn_guardar.Enabled = true;
     cargardetalle();
     string BodegaID1 = Convert.ToString(cmb_bodega.SelectedValue.ToString());
     foreach (DataGridViewRow row in dgv_facturaDetalle.Rows)
     {
         string ProductoID1 = Convert.ToString(dgv_facturaDetalle.CurrentRow.Cells[0].Value.ToString());              
         int cantidad1 = Convert.ToInt32(dgv_facturaDetalle.CurrentRow.Cells[4].Value.ToString());
         int existencia1 = Convert.ToInt32(CapaDatos.ConsultaExistenciav1(ProductoID1, BodegaID1));
         if (cantidad1 > existencia1)
         {
             dgv_facturaDetalle.CurrentRow.DefaultCellStyle.BackColor = Color.Yellow;
             btn_guardar.Enabled = false;
         }
     }
 }
Пример #27
0
        //Guardar datos de factura, cliente y detalle factura
        private void btn_guardar_Click(object sender, EventArgs e)
        {
            try
            {
                //formato para los datatimepicker
                dtp_fecha.Format       = DateTimePickerFormat.Custom;
                dtp_fecha.CustomFormat = "yyyy-MM-dd";

                if (!String.IsNullOrEmpty(txt_nombre.Text.Trim()) && !String.IsNullOrEmpty(txt_apellido.Text.Trim()) &&
                    !String.IsNullOrEmpty(txt_direccion.Text.Trim()) && !String.IsNullOrEmpty(txt_telefono.Text.Trim()) &&
                    cmb_pago.SelectedIndex != -1)
                {
                    CapaDatos db = new CapaDatos();
                    //Manejo db = new Manejo();
                    string temp  = cmb_pago.SelectedItem.ToString();
                    double temp1 = Convert.ToDouble(txt_total.Text.Trim());
                    int    temp3 = Convert.ToInt32(txt_temporal.Text.Trim());
                    db.GuardarFacturaEncabezado(dtp_fecha.Text.Trim(), temp, temp1, temp3);

                    CapaDatos v      = new CapaDatos();
                    DataTable dt1    = CapaDatos.CargarGridAutoIncrement("select AUTO_INCREMENT from information_schema.TABLES where TABLE_SCHEMA='crmbd' and TABLE_NAME='factura_encabezado';");
                    DataRow   rows   = dt1.Rows[0];
                    int       id_req = Convert.ToInt32(rows[0]);

                    foreach (DataGridViewRow row in dgv_facturaDetalle.Rows)
                    {
                        int    codigo_facturaM  = id_req - 1;
                        int    codigo_productoM = Convert.ToInt32(row.Cells[0].Value);
                        int    cantidadM        = Convert.ToInt32(row.Cells[3].Value);
                        double subtotalM        = Convert.ToDouble(row.Cells[4].Value);
                        v.insertar_detalle_factura(codigo_facturaM, codigo_productoM, cantidadM, subtotalM);
                    } //termina mi foreach
                }
                if (chb_habilita.Checked)
                {
                    CapaDatos nuevo      = new CapaDatos();
                    string    temporales = cmb_cotizaciones.SelectedValue.ToString();
                    nuevo.ActualizaEstadoPedidoCotizacion(temporales);
                }
            }
            catch
            {
                MessageBox.Show("Error al Guardar datos de insercion");
            }
        }
Пример #28
0
        public void cargardetalleFacturaYEncabezado()
        {
            try
            {
                CapaDatos v = new CapaDatos();

                DataTable dt0        = CapaDatos.CargarGridAutoIncrement("select * from factura_encabezado where id_factura = " + cmb_cotizaciones.SelectedValue.ToString() + ";");
                DataRow   fecha      = dt0.Rows[0];
                DataRow   formaPago  = dt0.Rows[0];
                DataRow   Total      = dt0.Rows[0];
                DataRow   id_cliente = dt0.Rows[0];


                DateTime fechaC     = Convert.ToDateTime(fecha[1]);
                string   formaPagoC = Convert.ToString(formaPago[2]);
                string   totalC     = Convert.ToString(Total[3]);
                string   idCLiente  = Convert.ToString(id_cliente[5]);
                int      tempo      = Convert.ToInt32(idCLiente);

                DataTable dt2       = CapaDatos.CargarGridAutoIncrement("select * from cliente_m where id_cliente = " + tempo + ";");
                DataRow   codigoSS  = dt2.Rows[0];
                DataRow   nit       = dt2.Rows[0];
                DataRow   nombre    = dt2.Rows[0];
                DataRow   apellido  = dt2.Rows[0];
                DataRow   direccion = dt2.Rows[0];
                DataRow   telefono  = dt2.Rows[0];

                dtp_fecha.Text = fechaC.ToString();
                cmb_pago.Text  = formaPagoC.ToString();
                txt_total.Text = totalC.ToString();

                txt_nit.Text       = Convert.ToString(nit[1]);
                txt_nombre.Text    = Convert.ToString(nombre[2]);
                txt_apellido.Text  = Convert.ToString(apellido[3]);
                txt_direccion.Text = Convert.ToString(direccion[4]);
                txt_telefono.Text  = Convert.ToString(telefono[5]);


                DataTable dt1 = CapaDatos.CargarGridAutoIncrement("select * from detalle_factura where id_factura = " + cmb_cotizaciones.SelectedValue.ToString() + ";");
                dgv_facturaDetalle.DataSource = dt1;
            }
            catch {
                MessageBox.Show("Error al cargar detalle Factura y encabezado");
            }
        }
Пример #29
0
        public void button1_Click(object sender, EventArgs e)
        {
            try
            {
                int    ProductoID = Convert.ToInt32(txt_codigo.Text);
                string Nombre     = CapaDatos.DescripcionP(cmb_producto.SelectedValue.ToString());
                int    MarcaID    = Convert.ToInt32(cmb_marca.SelectedValue.ToString());
                string NombreMark = CapaDatos.NombreMarka(cmb_marca.SelectedValue.ToString());
                if (!String.IsNullOrEmpty(txt_cantidad.Text))
                {
                    int cantidad = Convert.ToInt32(txt_cantidad.Text);

                    double PrecioUnidad1 = Convert.ToDouble(txt_precioUnidad.Text);
                    double SubTotal      = cantidad * PrecioUnidad1;

                    int ExistenciaF = Convert.ToInt32(txt_existencia.Text);

                    if (cantidad > ExistenciaF)
                    {
                        MessageBox.Show("Existencia Baja");
                    }
                    if (cantidad <= ExistenciaF)
                    {
                        dgvCotizacion.Rows.Add(ProductoID, Nombre, MarcaID, NombreMark, cantidad, PrecioUnidad1, SubTotal);
                        //dgv_facturaDetalle.Rows.Insert(0, cmb_codigo.SelectedValue.ToString(), cmb_descripcion.SelectedValue.ToString(), txt_cantidad.Text, cmb_prueba.SelectedValue.ToString(), subtotall);
                        int suma = 0;
                        foreach (DataGridViewRow row in dgvCotizacion.Rows)
                        {
                            suma += Convert.ToInt32(row.Cells["subtotal"].Value);
                            //suma += (int)row.Cells["Subtotal"].Value;
                        }
                        txt_total.Text    = Convert.ToString(suma);
                        txt_cantidad.Text = "";
                    }
                }
                else
                {
                    MessageBox.Show("Agrege Cantidad de Producto");
                }
            }
            catch
            {
                MessageBox.Show("No se agrego ningun producto");
            }
        }
Пример #30
0
        private void btn_guardar_Click(object sender, EventArgs e)
        {
            try
            {
                CapaDatos nuevo   = new CapaDatos();
                double    precioP = Convert.ToDouble(txt_precioUnidad.Text);
                double    tempo   = precioP * 0.20;
                double    tempo2  = precioP - tempo;

                nuevo.InsertarProducto(txt_descripcion.Text, Convert.ToDouble(txt_precioUnidad.Text), tempo2);
                MessageBox.Show("Se Inserto Correctamente");
                txt_descripcion.Text  = "";
                txt_precioUnidad.Text = "";
            }
            catch {
                MessageBox.Show("Error de insercion");
            }
        }