private void button4_Click(object sender, EventArgs e)
        {
            FormConFacServicios acceso = new FormConFacServicios();

            acceso.Close();
            this.Hide();
        }
        private void consultarFacturaToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            FormConFacServicios FormCc = new FormConFacServicios();

            FormCc.MdiParent = this;
            FormCc.Show();
        }
        private void button3_Click(object sender, EventArgs e)
        {
            {
                FormConFacServicios FConsultarFactura = new FormConFacServicios();
                FConsultarFactura.MdiParent     = Principal.ActiveForm;
                FConsultarFactura.StartPosition = FormStartPosition.CenterScreen;
                FConsultarFactura.Show();

                this.Close();
            }
        }
Exemple #4
0
        private void button3_Click(object sender, EventArgs e)
        {
            ClaseFacturaServicios ObjFactura = new ClaseFacturaServicios();

            try
            {
                ObjFactura.NumFactura = int.Parse(label6.Text);
                ObjFactura.NitEmpresa = long.Parse(label9.Text);
                ObjFactura.Fecha      = Convert.ToDateTime(dateTimePicker1.Value.ToShortDateString());
                ObjFactura.IdEmpleado = long.Parse(comboBox1.SelectedValue.ToString());
                ObjFactura.IdCliente  = long.Parse(textBox1.Text);



                bool insertarfacturaOK = ObjFactura.InsertarFacturaServicios();

                if (insertarfacturaOK == true)
                {
                    bool insertardetalleOK = false;
                    int  filas             = dataGridView1.Rows.Count;

                    for (int i = 0; i < filas - 1; i++)
                    {
                        ObjFactura.NitEmpresa  = long.Parse(label9.Text);
                        ObjFactura.NumFactura  = int.Parse(label6.Text);
                        ObjFactura.IdServicios = long.Parse(dataGridView1.Rows[i].Cells["IdServicios"].Value.ToString());
                        ObjFactura.Cantidad    = int.Parse(dataGridView1.Rows[i].Cells["Cantidad"].Value.ToString());
                        ObjFactura.ValorIva    = long.Parse(dataGridView1.Rows[i].Cells["ValorIva"].Value.ToString());
                        ObjFactura.SubTotal    = long.Parse(dataGridView1.Rows[i].Cells["SubTotal"].Value.ToString());

                        insertardetalleOK = ObjFactura.InsertarDetalleFServicios();
                    }

                    if (insertardetalleOK == true)
                    {
                        MessageBox.Show("La Factura Fue Generada correctamente");
                        FormConFacServicios FConsultarFactura = new FormConFacServicios();
                        FConsultarFactura.MdiParent  = Principal.ActiveForm;
                        FConsultarFactura.NumFactura = int.Parse(label6.Text);
                        FConsultarFactura.Show();

                        this.Close();
                    }
                    else
                    {
                        if (ObjFactura.NumFactura == 1)
                        {
                            MessageBox.Show("El Sistema Fue ajustado con exito, puede iniciar a generar sus facturas");
                            this.Close();
                        }
                        else
                        {
                            MessageBox.Show("La Factura Fue Generada pero no se pudo completar  el detalle");
                        }
                    }
                }
                else
                {
                    MessageBox.Show("La Factura No Pudo Generarse. " + ObjFactura.Mensaje);
                }
            }
            catch (Exception Ex)
            {
                MessageBox.Show("Error!: " + Ex.Message + " " + ObjFactura.Mensaje);
            }
        }