Example #1
0
        //private void button9_Click(object sender, EventArgs e)
        //{
        //    DAO.FacturasDAO facturas = new EquimarFac.DAO.FacturasDAO();
        //    facturas.IDFServicios = Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value);
        //    string resultado = facturas.eliminaserviciosfac();
        //    if (resultado != "Correcto")
        //    {
        //        MessageBox.Show(resultado);
        //    }
        //    else
        //    {
        //        actualizagrid();
        //        calculatotales();
        //    }
        //}

        private void button9_Click(object sender, EventArgs e)
        {
            try
            {
                DAO.FacturasDAO facturasdao = new EquimarFac.DAO.FacturasDAO();
                facturasdao.IDFactura = int.Parse(lbl_idfactura.Text);
                facturasdao.Subtotal  = decimal.Parse(textBox13.Text);
                facturasdao.Iva       = decimal.Parse(textBox14.Text);
                facturasdao.Total     = decimal.Parse(textBox15.Text);



                if (textBox16.Text != "")
                {
                    facturasdao.Descuento_decimal = ((decimal.Parse(textBox16.Text) * decimal.Parse("100")) / ((decimal.Parse(textBox16.Text))));
                }
                else
                {
                    // facturasdao.descuento = "";
                    // facturasdao.PorcentajeDescuento_decimal = int.Parse(textBox16.Text);
                }

                facturasdao.motivodescuento = textBox17.Text;

                string resultado = facturasdao.actualizacompratermina();
                if (resultado != "Correcto")
                {
                    MessageBox.Show(resultado);
                }
                else
                {
                    string resultado2 = descargainventarios();
                    if (resultado2 == "Correcto")
                    {
                        MessageBox.Show("Correcto");
                        GUI.CatalogosForms.Compras facturasgui = new Compras();
                        facturasgui.MdiParent = this.MdiParent;
                        facturasgui.Show();

                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show(resultado2);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Hubo algun error en la informacion " + ex);
            }
        }