コード例 #1
0
ファイル: BusquedaFact.cs プロジェクト: Edwinutec2017/ventas
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            modelo.Factura fact = new modelo.Factura();
            try
            {
                DialogResult dialogo = MessageBox.Show("Decea aser la Devolucion ", "DEVOLUCION", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (dialogo == DialogResult.Yes)
                {
                    fact.IdUser = this.idFact;
                    fact.devolucionTotal();
                }
                else
                {
                    return;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
            if (fact.Mensaje.Equals("Devolucion correcta"))
            {
                MessageBox.Show(fact.Mensaje);

                lblTitulo.Text = "DEVOLUCION DE FACTURA TOTAL";
                controlador.CrudFactura dev = new controlador.CrudFactura();
                dev.buscarFactura(1, "n", dataFact);
            }
            else
            {
                MessageBox.Show(fact.Mensaje);
            }
        }
コード例 #2
0
ファイル: Factura.cs プロジェクト: Edwinutec2017/ventas
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            int seleccion = 0;

            if (chekEfectivo.Checked && chekCredito.Checked || chekCredito.Checked && chekEfectivo.Checked)
            {
                MessageBox.Show("Seleccione el tipo de pago");
            }
            else
            {
                if (chekEfectivo.Checked.Equals(false) && chekCredito.Checked.Equals(false) || chekCredito.Checked.Equals(false) && chekEfectivo.Checked.Equals(false))
                {
                    MessageBox.Show("Seleccione el tipo de pago");
                }
                else
                {
                    if (chekEfectivo.Checked)
                    {
                        seleccion = 7;
                    }
                    else
                    {
                        seleccion = 6;
                    }

                    modelo.Factura fat = new modelo.Factura();

                    /*para el encabezado de la factura*/
                    fat.IdCliente  = this.idCliente;
                    fat.NumeroFact = txtFactura.Text;

                    fat.IdUser   = this.id;
                    fat.Tipo     = seleccion;
                    fat.SubTotal = this.subTotal;
                    fat.Iva1     = this.Iva;
                    fat.Total1   = this.Total;
                    fat.Fecha    = this.fecha;

                    /*para el detalle de la factura*/
                    fat.PrecioVenta   = this.precioVenta;
                    fat.Cantidad      = this.cantidad;
                    fat.Descuento     = this.descuento;
                    fat.Totalproducto = this.totalproducto;
                    fat.Idproducto    = this.idproducto;

                    fat.insertEncabezado();

                    if (fat.Mensaje.Equals("Factura Guardada........"))
                    {
                        MessageBox.Show(fat.Mensaje);
                        controlador.GenerarXml xml = new controlador.GenerarXml();
                        idfacXml = xml.buscaIdFcat(txtFactura.Text);
                        if (idfacXml.Equals(0))
                        {
                            MessageBox.Show("No se  pudo generar la busqueda");
                        }
                        else
                        {
                            if (xml.generar(txtFactura.Text, idfacXml))
                            {
                                if (xml.generarArchivo())
                                {
                                    //MessageBox.Show("Factura Generada.....");
                                    this.Hide();
                                    reporFact.ReporFacturacs rpf = new reporFact.ReporFacturacs();
                                    rpf.Id     = this.id;
                                    rpf.Nombre = this.nombre;
                                    rpf.Rol    = this.rol;
                                    rpf.Show();
                                }
                                else
                                {
                                    MessageBox.Show("No se pudo generar el xml ");
                                }
                            }
                            else
                            {
                                MessageBox.Show("Error de Conexion");
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show(fat.Mensaje);
                    }
                }
            }
        }