Esempio n. 1
0
        private void btnReportes_Click(object sender, EventArgs e)
        {
            frmReporte ofrmReporte = new frmReporte();

            ofrmReporte.Show();
            this.Close();
        }
        private void btnRegistrar_Click(object sender, EventArgs e)
        {
            string mensaje = "";

            errorProvider1.Clear();
            if (Utilidades.ValidarForm2(this, errorProvider1) == false)
            {
                return;
            }
            try
            {
                CalcularTotal();
                C.Documento  = txtDocumento.Text;
                C.Nota       = txtNota.Text;
                C.Fecha      = dtpFecha.Value;
                C.Idusuario  = Program.Idusuario;
                C.Idsucursal = Program.Idsucursal;
                C.Factura    = txtFactura.Text;
                C.Documento2 = Program.Documento;
                mensaje      = C.RegistrarCompra();
                if (mensaje == "1")
                {
                    for (int x = 0; x < dtgEntrada.Rows.Count; x++)
                    {
                        C.Idcompra   = 0;
                        C.Idproducto = Convert.ToInt32(dtgEntrada.Rows[x].Cells[0].Value);
                        C.Idalmacen  = Convert.ToInt32(dtgEntrada.Rows[x].Cells[2].Value);
                        C.Idunidad   = Convert.ToInt32(dtgEntrada.Rows[x].Cells[3].Value);
                        C.Cantidad   = Convert.ToDouble(dtgEntrada.Rows[x].Cells[5].Value);
                        C.Costo      = Convert.ToDouble(dtgEntrada.Rows[x].Cells[6].Value);
                        C.Importe    = Convert.ToDouble(dtgEntrada.Rows[x].Cells[7].Value);
                        C.Itbis      = Convert.ToDouble(dtgEntrada.Rows[x].Cells[9].Value);
                        mensaje      = C.RegistrarDetalleCompra();
                    }
                    if (mensaje == "1")
                    {
                        MessageBoxEx.Show("Registrado con éxito", "FactSYS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        dtgEntrada.Rows.Clear();
                        Cp.Idcompra  = Program.Idtransaccion;
                        Cp.Monto     = total1;
                        Cp.Documento = Program.Documento;
                        Cp.Registrar();
                        Limpiar();
                        Autocompletar();
                        frmReporte obj = new frmReporte();
                        obj.Valor    = 2;
                        obj.Reporte  = "compra.rdlc";
                        obj.Idcompra = Program.Idtransaccion;
                        obj.Show();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 3
0
        private void btnRegistrar_Click(object sender, EventArgs e)
        {
            string mensaje = "";

            try
            {
                if (dtgProducto.Rows.Count > 0 && dtgProveedor.Rows.Count > 0)
                {
                    C.Documento  = txtDocumento.Text;
                    C.Nota       = txtNota.Text;
                    C.Idtercero  = Convert.ToInt32(dtgProveedor.Rows[0].Cells[1].Value);
                    C.Fecha      = dtpFecha.Value;
                    C.Idusuario  = Program.Idusuario;
                    C.Idsucursal = Program.Idsucursal;
                    C.Idmoneda   = Convert.ToInt32(cbMoneda.SelectedValue);
                    C.Idtipo     = 14;
                    C.Factura    = txtFactura.Text;
                    mensaje      = C.RegistrarDevolucion();
                    if (mensaje == "1")
                    {
                        for (int x = 0; x < dtgProducto.Rows.Count; x++)
                        {
                            C.Iddevolucion = 0;
                            C.Idproducto   = Convert.ToInt32(dtgProducto.Rows[x].Cells[1].Value);
                            C.Idunidad     = Convert.ToInt32(dtgProducto.Rows[x].Cells[3].Value);
                            C.Cantidad     = Convert.ToDouble(dtgProducto.Rows[x].Cells[5].Value);
                            C.Costo        = Convert.ToDouble(dtgProducto.Rows[x].Cells[6].Value);
                            C.Importe      = Convert.ToDouble(dtgProducto.Rows[x].Cells[8].Value);
                            C.Itbis        = Convert.ToDouble(dtgProducto.Rows[x].Cells[7].Value);
                            C.Idalmacen    = Convert.ToInt32(dtgProducto.Rows[x].Cells[9].Value);
                            mensaje        = C.RegistrarDetalleDevolucion();
                        }
                        if (mensaje == "1")
                        {
                            MessageBoxEx.Show("Registrado con éxito", "FactSYS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            dtgProducto.Rows.Clear();
                            dtgProveedor.Rows.Clear();
                            txtNota.Clear();
                            txtFactura.Clear();
                            Autocompletar();
                            frmReporte obj = new frmReporte();
                            obj.Valor        = 3;
                            obj.Reporte      = "devolucion_compra.rdlc";
                            obj.Iddevolucion = Program.Iddevolucion;
                            obj.Show();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show(ex.Message);
            }
        }