Example #1
0
        private void BuscarNumeroPedido(string id)
        {
            n = 5;
            CNFactura objDato = new CNFactura();

            objDato.Numfactura        = int.Parse(id);
            FechacomboBox3.DataSource = objDato.BuscarPedidoFactura();
            if (FechacomboBox3.SelectedIndex == -1)
            {
                MessageBox.Show("No Existe Factura");
            }
            else
            {
                Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB");
                FechacomboBox3.DisplayMember        = "Fecha";
                FechacomboBox3.DropDownStyle        = ComboBoxStyle.DropDownList;
                FechacomboBox3.SelectedIndex        = 0;
                n = 7;
                NumeroPediocomboBox.Items.Add(id);
                NumeroPediocomboBox.DropDownStyle = ComboBoxStyle.DropDownList;
                NumeroPediocomboBox.SelectedIndex = 0;


                NumeroPediocomboBox.Enabled = false;
                FechacomboBox3.Enabled      = true;
            }
        }
 private void btnEmitir_Click(object sender, EventArgs e)
 {
     if (comboBox1.Text.Equals("Factura"))
     {
         CNFactura objDato = new CNFactura();
         objDato.Numfactura = int.Parse(textBoxNumFactura.Text);
         objDato.Numpedido  = int.Parse(textBoxNumeroPedido.Text);
         Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB");
         objDato.Fecha = DateTime.Parse(textBoxFecha.Text);
         objDato.EmitirFactura();
         CNDatos objDatos = new CNDatos();
         f++;
         objDatos.Valor = f;
         objDatos.UpdateNumeroFactura();
         MessageBox.Show("Factura Emitida Exitosamente");
         this.Close();
     }
     else
     {
         CNFactura objDato = new CNFactura();
         objDato.Numfactura = int.Parse(textBoxNumFactura.Text);
         objDato.Numpedido  = int.Parse(textBoxNumeroPedido.Text);
         objDato.Fecha      = DateTime.Parse(textBoxFecha.Text);
         objDato.EmitirConsumidor();
         MessageBox.Show("Consumidor Final Emitido Exitosamente");
         this.Close();
     }
 }
Example #3
0
        private void ListaFactura()
        {
            CNFactura objDato = new CNFactura();

            FacturasdataGridView.DataSource = objDato.ListaFactura();
            IndexTable();
        }
Example #4
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            if (FacturasdataGridView.SelectedRows.Count > 0)
            {
                if (FacturasdataGridView.CurrentRow.Cells[6].Value.ToString().Equals("ANULADO"))
                {
                    MessageBox.Show("La Factura Ya Esta Anulada");
                }
                else
                {
                    String            Men     = "¿Seguro que quiere anular a esta Factura?";
                    String            Tit     = "Anular Factura";
                    MessageBoxButtons buttons = MessageBoxButtons.YesNo;
                    DialogResult      result  = MessageBox.Show(Men, Tit, buttons);
                    if (result == DialogResult.Yes)
                    {
                        CNFactura objDato = new CNFactura();
                        objDato.Numfactura = int.Parse(FacturasdataGridView.CurrentRow.Cells[0].Value.ToString());

                        objDato.AnularFactura();
                        ListaFactura();
                        MessageBox.Show("Factuar Anulada Exitosamente");
                    }
                }
            }
            else
            {
                MessageBox.Show("Debe Seleccionar Una Fila");
            }
        }
Example #5
0
        private void BuscarNumeroPedido(string id)
        {
            CNFactura objDato = new CNFactura();

            objDato.Numfactura = int.Parse(id);
            FacturasdataGridView.DataSource = objDato.BuscarNumeroFactura();
            IndexTable();
        }
Example #6
0
        private void BuscarClientePedio(string id)
        {
            CNFactura objDato = new CNFactura();

            objDato.IdCliente = id;
            FacturasdataGridView.DataSource = objDato.BuscarClienteFactura();
            IndexTable();
        }
Example #7
0
        private void listaFecha()
        {
            limpiar();
            n = 11;
            CNFactura objDato = new CNFactura();

            objDato.Numfactura           = int.Parse(NumeroPediocomboBox.GetItemText(NumeroPediocomboBox.SelectedItem));
            FechacomboBox3.DataSource    = objDato.BuscarPedidoFactura();
            FechacomboBox3.DisplayMember = "fecha";
            FechacomboBox3.DropDownStyle = ComboBoxStyle.DropDownList;
            FechacomboBox3.SelectedIndex = 0;
            n = 3;
        }
Example #8
0
        private void cargarClienteNumero()
        {
            CNFactura objDato = new CNFactura();

            objDato.Numfactura = int.Parse(NumeroPediocomboBox.GetItemText(NumeroPediocomboBox.SelectedItem));
            DataTable dato = objDato.BuscarPedidoFactura();

            CNPedido objPedido = new CNPedido();

            objPedido.NumPedido = int.Parse(dato.Rows[0][1].ToString());
            DataTable Pedido = objPedido.BuscarNumeroPedido();
            int       n      = int.Parse(Pedido.Rows[0][8].ToString());

            comboBox2.SelectedIndex = n - 1;
            textBoxSubTotal.Text    = Pedido.Rows[0][3].ToString();
            textBoxServicio.Text    = Pedido.Rows[0][4].ToString();
            textBoxIVA.Text         = Pedido.Rows[0][5].ToString();
            textBoxTotal.Text       = Pedido.Rows[0][6].ToString();
            textBoxEstado.Text      = Pedido.Rows[0][7].ToString();
            int index = FechacomboBox3.FindString(Pedido.Rows[0][2].ToString());

            FechacomboBox3.SelectedIndex = index;


            CNCliente objCli = new CNCliente();

            objCli.Id = Pedido.Rows[0][1].ToString();
            DataTable Cliente = objCli.BuscarID();

            textBoxRUC.Text       = Cliente.Rows[0][1].ToString();
            textBoxNombre.Text    = Cliente.Rows[0][2].ToString();
            textBoxApellido.Text  = Cliente.Rows[0][3].ToString();
            textBoxDireccion.Text = Cliente.Rows[0][4].ToString();
            textBoxCorreo.Text    = Cliente.Rows[0][5].ToString();
            textBoxTelefono.Text  = Cliente.Rows[0][6].ToString();


            CNDetallePedido objDet = new CNDetallePedido();

            objDet.NumPedido = int.Parse(dato.Rows[0][1].ToString());
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB");
            objDet.Fecha = DateTime.Parse(FechacomboBox3.GetItemText(FechacomboBox3.SelectedItem));
            ListaPedido  = objDet.ListaDetallePedidos();
            ProductodataGridView.DataSource = ListaPedido;
            ListaIndex2();
        }
Example #9
0
        private void InsertarFactura()
        {
            CNFactura inserF     = new CNFactura();
            CEFactura objFactura = new CEFactura();

            objFactura.Fecha       = dtpFechaFactura.Value;
            objFactura.IdAutomovil = txtIdAutomovil.Text;
            objFactura.IdUsuario   = FrmPrincipal.id;
            if (inserF.NuevaFactura(objFactura) > 0)
            {
                MessageBox.Show(null, "Se guardó el registro de la factura", "CarWash System", MessageBoxButtons.OK);
            }
            else
            {
                //MessageBox.Show(null, "Error al guardar un nuevo registro de la factura.", "CarWash System", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #10
0
 public void AgregarDetalle()
 {
     foreach (DataGridViewRow fila in dgvFactu.Rows)
     {
         CNFactura insertDetalle = new CNFactura();
         CEFactura objFactura    = new CEFactura();
         objFactura.IdFactura  = Convert.ToInt32(fila.Cells[0].Value.ToString());
         objFactura.IdServicio = Convert.ToInt32(fila.Cells[1].Value.ToString());
         if (insertDetalle.AgregarDetalle(objFactura) > 0)
         {
             MessageBox.Show(null, "Se guardó el registro del detalle de la factura", "CarWash System", MessageBoxButtons.OK);
         }
         else
         {
             MessageBox.Show(null, "Error al guardar un nuevo registro del detalle de la factura.", "CarWash System", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Example #11
0
        private void BuscarClientePedio(string id)
        {
            n = 11;
            CNFactura objDato = new CNFactura();

            objDato.IdCliente = id;
            NumeroPediocomboBox.DataSource = objDato.BuscarClienteFactura();
            if (NumeroPediocomboBox.SelectedIndex == -1)
            {
                MessageBox.Show("No Existe Cliente");
            }
            else
            {
                NumeroPediocomboBox.DisplayMember = "NumFactura";
                NumeroPediocomboBox.DropDownStyle = ComboBoxStyle.DropDownList;
                NumeroPediocomboBox.SelectedIndex = 0;

                listaFecha();
                NumeroPediocomboBox.Enabled = true;
                FechacomboBox3.Enabled      = true;
                n = 3;
            }
        }
Example #12
0
        private void btnFactura_Click(object sender, EventArgs e)
        {
            int i;

            CNDetalleFactura cnDetFactura = new CNDetalleFactura();
            CNFactura        cnFactura    = new CNFactura();
            CEFactura        factura      = new CEFactura();
            CNEmpleado       cnEmpleado   = new CNEmpleado();



            factura.IdEmpleado = cnEmpleado.NombreUsuarioEmpleadoId(lblUsuario.Text);
            factura.Fecha      = DateTime.Now;

            cnFactura.InsertarFactura(factura);
            i = cnFactura.MaxFactura();
            factura.IdFactura = i;
            foreach (CEDetalleFactura det in detallesFactura)
            {
                det.IdFactura = i;
                cnDetFactura.InsertarDFactura(det);
            }
            CNMesa cnMesa = new CNMesa();

            cnMesa.ActualizarEstadoMesa(mesa, 0);
            Factura frmFactura = new Factura(factura);

            if (frmFactura.ShowDialog() == DialogResult.OK)
            {
                this.Dispose();
            }
            else
            {
                limpiar();
            }
        }
Example #13
0
        private void InvestigarCorrelativo()
        {
            CNFactura correlativo = new CNFactura();

            txtIdFactura.Text = Convert.ToString(correlativo.InvestigarCorrelativo());
        }