Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                calculaprecios();
                if ((richTextBox1.Text != "") && (textBox8.Text != "") && (textBox13.Text != "") && (comboBox3.SelectedIndex != -1) && (comboBox1.SelectedIndex != -1))
                {
                    DAO.FacturasDAO facturasdao = new EquimarFac.DAO.FacturasDAO();
                    //this.IDFactura, this.NumeroProgresivo, this.Fecha, this.Concepto, this.Subtotal, this.Iva, this.Total, this.ConceptoT);
                    facturasdao.IDFactura = int.Parse(this.Text);
                    //facturasdao.Folio = (textBox8.Text);
                    facturasdao.NumeroProgresivo = 1;
                    facturasdao.Fecha            = DateTime.Now;
                    facturasdao.Concepto         = richTextBox1.Text;
                    facturasdao.Subtotal         = decimal.Parse(textBox13.Text);
                    facturasdao.Iva   = decimal.Parse(textBox14.Text);
                    facturasdao.Total = decimal.Parse(textBox15.Text);
                    //, this.Descuento_decimal, this.MotivoDescuento_string, this.PorcentajeDescuento_decimal, this.Moneda, this.TipoDeCambio_decimal, this.FechaTipoCambio_datetime, this.UUID, this.Folio);
                    if (((checkBox3.Checked) | (checkBox4.Checked)) && textBox2.Text != "")
                    {
                        if (checkBox3.Checked)
                        {
                            //porcentaje
                            facturasdao.Descuento_decimal           = descuentopublic;
                            facturasdao.PorcentajeDescuento_decimal = descuentoporcentajepublic;
                        }

                        if (checkBox4.Checked)
                        {
                            //cantidad
                            facturasdao.Descuento_decimal           = descuentopublic;
                            facturasdao.PorcentajeDescuento_decimal = descuentoporcentajepublic;
                        }
                    }
                    else
                    {
                    }
                    facturasdao.MotivoDescuento_string = textBox3.Text;
                    facturasdao.Moneda = comboBox3.Text;
                    if (textBox4.Text != "")
                    {
                        facturasdao.TipoDeCambio_decimal = decimal.Parse(textBox4.Text);
                    }
                    else
                    {
                    }
                    //facturasdao.TipoDeCambio_decimal = decimal.Parse(textBox4.Text);
                    facturasdao.FechaTipoCambio_datetime = (dateTimePicker5.Value);
                    facturasdao.UUID  = "";
                    facturasdao.Folio = "";
                    Numalet let = new Numalet();
                    if (comboBox3.Text == "USD")
                    {
                        let.MascaraSalidaDecimal   = "00'/100 U.S.D'";
                        let.SeparadorDecimalSalida = "Dolares";
                        //observar que sin esta propiedad queda "veintiuno pesos" en vez de "veintiún pesos":
                        let.ApocoparUnoParteEntera = true;

                        facturasdao.ConceptoT = ("Son: " + let.ToCustomCardinal(textBox15.Text));
                        //Son: un mil ciento veintiún pesos 24/100 M.N.
                    }
                    else
                    {
                        let.MascaraSalidaDecimal   = "00'/100 M.N'";
                        let.SeparadorDecimalSalida = "Pesos";
                        //observar que sin esta propiedad queda "veintiuno pesos" en vez de "veintiún pesos":
                        let.ApocoparUnoParteEntera = true;

                        facturasdao.ConceptoT = ("Son: " + let.ToCustomCardinal(textBox15.Text));
                        //Son: un mil ciento veintiún pesos 24/100 M.N.
                    }
                    string resultado = facturasdao.actualiza_notacredito();
                    if (resultado != "Correcto")
                    {
                        MessageBox.Show(resultado);
                    }
                    else
                    {
                        //facturasgui.actualizagrid();
                        //this.Close();
                        carganotasgrid();
                    }
                }
                else
                {
                    MessageBox.Show("Verifique su informacion por datos faltantes");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }