Beispiel #1
0
      void escribeProducto(int id, StringBuilder tiket, string dateTicket)
      {
          TotalProducto tp;
          Producto      p     = new Producto();
          Querys        query = new Querys();

          tp = query.contarProducto(id, dateTicket);
          p  = query.buscarProducto(id);
          try
          {
              // if (p != null && tp != null)
              //{
              if (id == 3 || id == 4 || id == 5 || id == 6)
              {
                  tiket.Append("      ");
              }
              tiket.AppendLine(tp.cantidad + new string(' ', ((tp.cantidad > 9) ? 2 : 3)) + p.nombre + new string(' ', CANT_SPACES - p.nombre.Length) + "$" + (tp.precio * tp.cantidad).ToString());
              total += (tp.precio * tp.cantidad);
              //}
          }
          catch
          {
              return;
          }
      }
Beispiel #2
0
        private void numPedido_KeyDown_1(object sender, KeyEventArgs e)
        {
            Querys query = new Querys();

            try
            {
                if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Tab)
                {
                    pedido.idPedidos = Convert.ToInt32(numPedido.Text);

                    pedido = query.buscarPedido(pedido.idPedidos);
                    if (pedido != null)
                    {
                        gridProductos.Rows.Clear();

                        txtComen.Text = pedido.comentarios;
                        lbFecha.Text  = Convert.ToString(pedido.fechaPedido);
                        c             = query.BuscarClienteId(pedido.idCliente);
                        if (c != null)
                        {
                            txtNombreCliente.Text      = c.nombre;
                            txtBuscar.Text             = c.tel;
                            txtDireccionCliente.Text   = c.direccion;
                            txtColoniaCliente.Text     = c.colonia;
                            txtEntreCallesCliente.Text = c.calles;
                        }
                        detalle = query.buscarDetalle(pedido.idPedidos);
                        if (detalle != null)
                        {
                            foreach (detallePedido dp in detalle)
                            {
                                Producto p = new Producto();
                                p = query.buscarProducto(dp.idProducto);
                                DataGridViewRow row = (DataGridViewRow)gridProductos.Rows[0].Clone();
                                row.Cells[0].Value = Convert.ToString(p.id);
                                row.Cells[1].Value = p.nombre;
                                row.Cells[2].Value = Convert.ToString(p.precio);
                                row.Cells[3].Value = dp.cantidad;
                                gridProductos.Rows.Add(row);
                            }
                            actualizarTotal();
                        }
                        btnAceptarPedido.Visible = false;
                    }
                }
            }
            catch
            {
            }
        }