Exemplo n.º 1
0
        public frmPedidoPendienteDetalles(Pedidos owner)
        {
            _owner = owner;
            String fecha_requerido = "";

            InitializeComponent();

            if (String.IsNullOrWhiteSpace(_owner.ObtenerSeleccionPedidos().Cells["REQUERIDO"].Value.ToString()))
            {
                fecha_requerido = null;
            }
            else
            {
                fecha_requerido = Convert.ToDateTime(_owner.ObtenerSeleccionPedidos().Cells["REQUERIDO"].Value).ToString("dd/MM/yyyy");
            }

            this.labelNumeroPedido.Text           = _owner.ObtenerSeleccionPedidos().Cells["CÓDIGO"].Value.ToString();
            this.textBoxCliente.Text              = _owner.ObtenerSeleccionPedidos().Cells["CLIENTE"].Value.ToString();
            this.textBoxTransporte.Text           = _owner.ObtenerSeleccionPedidos().Cells["TRANSPORTE"].Value.ToString();
            this.textBoxEmpleado.Text             = _owner.ObtenerSeleccionPedidos().Cells["RESPONSABLE"].Value.ToString();
            this.textBoxFechaOrdenado.Text        = Convert.ToDateTime(_owner.ObtenerSeleccionPedidos().Cells["ORDENADO"].Value).ToString("dd/MM/yyyy");
            this.textBoxFechaRequerido.Text       = fecha_requerido;
            this.textBoxCostoEnvio.Text           = Convert.ToDecimal(_owner.ObtenerSeleccionPedidos().Cells["COSTO DE ENVÍO"].Value).ToString("0.00#");
            this.dataGridViewProductos.DataSource = NPedidoDetalles.MostrarPedidoDetalles(Convert.ToInt32(_owner.ObtenerSeleccionPedidos().Cells[1].Value));
            this.dataGridViewProductos.Columns[4].DefaultCellStyle.Format    = "0.00# '$'";
            this.dataGridViewProductos.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            this.dataGridViewProductos.Columns[5].DefaultCellStyle.Format    = "0.00# '%'";
            this.dataGridViewProductos.Columns[5].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
        }
        public FrmEditarPedidoEntregado(Pedidos owner)
        {
            InitializeComponent();
            this._owner = owner;

            CargarClientes();
            CargarTransportistas();
            CargarEmpleados();
            CargarProductos();

            this.labelNumeroPedido.Text            = Convert.ToString(_owner.ObtenerSeleccionPedidos().Cells["CÓDIGO"].Value);
            this.comboBoxClientes.Text             = Convert.ToString(_owner.ObtenerSeleccionPedidos().Cells["CLIENTE"].Value);
            this.comboBoxTransportes.Text          = Convert.ToString(_owner.ObtenerSeleccionPedidos().Cells["TRANSPORTE"].Value);
            this.comboBoxEmpleados.Text            = Convert.ToString(_owner.ObtenerSeleccionPedidos().Cells["RESPONSABLE"].Value);
            this.dateTimePickerFechaOrdenado.Text  = Convert.ToDateTime(_owner.ObtenerSeleccionPedidos().Cells["ORDENADO"].Value).ToString("dd/MM/yyyy");
            this.dateTimePickerFechaEntregado.Text = Convert.ToDateTime(_owner.ObtenerSeleccionPedidos().Cells["ENTREGADO"].Value).ToString("dd/MM/yyyy");
            this.textBoxCostoEnvio.Text            = Convert.ToDecimal(_owner.ObtenerSeleccionPedidos().Cells["COSTO DE ENVÍO"].Value).ToString("0.00#");
            //Creamos otra grilla porque no podemos agregar filas a una grilla binded por un data source
            this.dataGridViewOrigen.Hide();
            this.dataGridViewOrigen.DataSource = NPedidoDetalles.MostrarPedidoDetalles(Convert.ToInt32(_owner.ObtenerSeleccionPedidos().Cells[1].Value));

            for (int fila = 0; fila < (this.dataGridViewOrigen.Rows.Count - 1); fila++)
            {
                this.dataGridViewProductos.Rows.Add("", Convert.ToString(this.dataGridViewOrigen.Rows[fila].Cells["PRODUCTO"].Value),
                                                    Convert.ToInt32(this.dataGridViewOrigen.Rows[fila].Cells["CANT."].Value),
                                                    Convert.ToDecimal(this.dataGridViewOrigen.Rows[fila].Cells["PRECIO"].Value),
                                                    Convert.ToDecimal(this.dataGridViewOrigen.Rows[fila].Cells["DESC."].Value));
            }

            this.dataGridViewProductos.Columns[3].DefaultCellStyle.Format    = "0.00# '$'";
            this.dataGridViewProductos.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            this.dataGridViewProductos.Columns[4].DefaultCellStyle.Format    = "0.00# '%'";
            this.dataGridViewProductos.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
        }
Exemplo n.º 3
0
        public FrmEditarPedidoPendiente(Pedidos owner)
        {
            InitializeComponent();

            try
            {
                this._owner = owner;

                CargarClientes();
                CargarTransportistas();
                CargarEmpleados();
                CargarProductos();

                this.labelNumeroPedido.Text            = Convert.ToString(_owner.ObtenerSeleccionPedidos().Cells["CÓDIGO"].Value);
                this.comboBoxClientes.Text             = Convert.ToString(_owner.ObtenerSeleccionPedidos().Cells["CLIENTE"].Value);
                this.comboBoxTransportes.Text          = Convert.ToString(_owner.ObtenerSeleccionPedidos().Cells["TRANSPORTE"].Value);
                this.comboBoxEmpleados.Text            = Convert.ToString(_owner.ObtenerSeleccionPedidos().Cells["RESPONSABLE"].Value);
                this.dateTimePickerFechaOrdenado.Value = Convert.ToDateTime(_owner.ObtenerSeleccionPedidos().Cells["ORDENADO"].Value);
                this.textBoxCostoEnvio.Text            = Convert.ToDecimal(_owner.ObtenerSeleccionPedidos().Cells["COSTO DE ENVÍO"].Value).ToString("0.00#");

                if (String.IsNullOrWhiteSpace(_owner.ObtenerSeleccionPedidos().Cells["REQUERIDO"].Value.ToString()))
                {
                    this.checkBoxSinFecha.Checked = true;
                }

                else
                {
                    this.checkBoxSinFecha.Checked           = false;
                    this.dateTimePickerFechaRequerido.Value = Convert.ToDateTime(_owner.ObtenerSeleccionPedidos().Cells["REQUERIDO"].Value);
                }

                //Creamos otra grilla porque no podemos agregar filas a una grilla binded por un data source
                this.dataGridViewOrigen.Hide();
                this.dataGridViewOrigen.DataSource = NPedidoDetalles.MostrarPedidoDetalles(Convert.ToInt32(_owner.ObtenerSeleccionPedidos().Cells[1].Value));

                for (int fila = 0; fila < (this.dataGridViewOrigen.Rows.Count - 1); fila++)
                {
                    this.dataGridViewProductos.Rows.Add("", Convert.ToString(this.dataGridViewOrigen.Rows[fila].Cells["PRODUCTO"].Value),
                                                        Convert.ToInt32(this.dataGridViewOrigen.Rows[fila].Cells["CANT."].Value),
                                                        Convert.ToDecimal(this.dataGridViewOrigen.Rows[fila].Cells["PRECIO"].Value),
                                                        Convert.ToDecimal(this.dataGridViewOrigen.Rows[fila].Cells["DESC."].Value));
                }

                this.dataGridViewProductos.Columns[3].DefaultCellStyle.Format    = "0.00# '$'";
                this.dataGridViewProductos.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                this.dataGridViewProductos.Columns[4].DefaultCellStyle.Format    = "0.00# '%'";
                this.dataGridViewProductos.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            }

            catch (Exception ex)
            {
                MensajeError("Datos incompletos. " + ex.Message);
                this._owner.Refrescar();
            }
        }
        public FrmPedidoEntregadoDetalles(Pedidos owner)
        {
            _owner = owner;

            InitializeComponent();

            this.labelNumeroPedido.Text           = _owner.ObtenerSeleccionPedidos().Cells["CÓDIGO"].Value.ToString();
            this.textBoxCliente.Text              = _owner.ObtenerSeleccionPedidos().Cells["CLIENTE"].Value.ToString();
            this.textBoxTransporte.Text           = _owner.ObtenerSeleccionPedidos().Cells["TRANSPORTE"].Value.ToString();
            this.textBoxEmpleado.Text             = _owner.ObtenerSeleccionPedidos().Cells["RESPONSABLE"].Value.ToString();
            this.textBoxFechaOrdenado.Text        = Convert.ToDateTime(_owner.ObtenerSeleccionPedidos().Cells["ORDENADO"].Value).ToString("dd/MM/yyyy");
            this.textBoxFechaEntregado.Text       = Convert.ToDateTime(_owner.ObtenerSeleccionPedidos().Cells["ENTREGADO"].Value).ToString("dd/MM/yyyy");;
            this.textBoxCostoEnvio.Text           = Convert.ToDecimal(_owner.ObtenerSeleccionPedidos().Cells["COSTO DE ENVÍO"].Value).ToString("0.00#");
            this.dataGridViewProductos.DataSource = NPedidoDetalles.MostrarPedidoDetalles(Convert.ToInt32(_owner.ObtenerSeleccionPedidos().Cells[1].Value));
            this.dataGridViewProductos.Columns[4].DefaultCellStyle.Format    = "0.00# '$'";
            this.dataGridViewProductos.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            this.dataGridViewProductos.Columns[5].DefaultCellStyle.Format    = "0.00# '%'";
            this.dataGridViewProductos.Columns[5].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
        }