Example #1
0
    public TempPedidos DatosPedidoTemp(string ID)
    {
        TempPedidos valores = new TempPedidos();

        string Select = "SELECT UserId,nombre,CONVERT(VARCHAR,fecha,105),tipo_despacho,observacion, Rutadj, Estado, Direccionentrega, fechaentrega FROM PLABAL.dbo.e_temp_pedidos WHERE id = @ID";

        ConnPlabal.Open();
        cmdPlabal = new SqlCommand(Select, ConnPlabal);
        cmdPlabal.Parameters.AddWithValue("@ID", ID);
        cmdPlabal.Parameters.AddWithValue("@Estado", "0");
        drPlabal = cmdPlabal.ExecuteReader();
        drPlabal.Read();

        if (drPlabal.HasRows)
        {
            valores.id_usuario    = drPlabal[0].ToString();
            valores.nombre        = drPlabal[1].ToString();
            valores.fecha         = drPlabal[2].ToString();
            valores.tipo_despacho = drPlabal[3].ToString().Trim();
            valores.observacion   = drPlabal[4].ToString();
            valores.Rutadj        = drPlabal[5].ToString();
            valores.Estado        = drPlabal[6].ToString();
            valores.Direcciondesp = drPlabal[7].ToString();
            if (drPlabal[8] != DBNull.Value)
            {
                valores.Fechaentrega = drPlabal.GetDateTime(8);
            }
            else
            {
            }
        }
        else
        {
        }
        drPlabal.Close();
        ConnPlabal.Close();
        return(valores);
    }
Example #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Infousuario Infousu = DatosUsuario.DatosUsuario();

        IDTemp        = Request.QueryString["ID"];
        id_temp.Value = IDTemp;

        TempPedidos InfoPedido = csPEDIDO.DatosPedidoTemp(IDTemp);

        NombrePedido       = InfoPedido.nombre;
        Observa            = InfoPedido.observacion;
        RutaFile           = InfoPedido.Rutadj;
        HiddenStatus.Value = InfoPedido.Estado;

        PlazoEntrega Plazoentrega = Funciones.PlazoEntrega("Termo");



        diascorridos = Plazoentrega.DiasCorridos;
        fechlimit    = Plazoentrega.Fecha;
        if (RutaFile != "" && !IsPostBack)
        {
            //info de entrega
            string tipodes   = InfoPedido.tipo_despacho;
            string direccion = "";
            direccion = InfoPedido.Direcciondesp;
            if (tipodes.Contains("Retiro"))
            {
                DirEntrega.Visible = false;
            }
            else
            {
                DirEntrega.Visible = true;
                DirEntrega.Text    = "Dirección de entrega: " + direccion;
            }
            DateTime fechaentr;
            fechaentr = InfoPedido.Fechaentrega;

            Validacionfechacalendario(fechaentr);



            TipoEntrega.Text = InfoPedido.tipo_despacho;


            TextDireccion.Text = InfoPedido.Direcciondesp;

            TextDireccion.Text = direccion;


            SelectFromcodexp express = Funciones.TablaCodExp(IDTemp);

            if (express.Hascodexp == 1 && express.Status == 0)
            {
                AlertInfoEntrega.Text      = "Código Express Solicitado. A la espera de liberación.";
                EnviarPedido.Enabled       = false;
                AlertInfoEntrega.ForeColor = System.Drawing.Color.Red;
                AlertInfoEntrega.Font.Bold = true;
                Fechaentrega.Visible       = true;

                Fechaentrega.Text = "Fecha de entrega: " + express.Datecode.ToString("dd-MM-yyyy");
            }
            else if (express.Hascodexp == 1 && express.Status == 1)
            {
                AlertInfoEntrega.Text = "Código Express liberado, el pedido debe ser enviado a fabricar antes de ";
                EnviarPedido.Enabled  = true;
                CultureInfo ci = new CultureInfo("en-US");

                expiration.Value           = express.Expiredtime.ToString("M/d/yyyy", ci) + " " + express.Expiredtime.ToString("h:mm tt", ci);
                AlertInfoEntrega.ForeColor = System.Drawing.Color.Blue;
                AlertInfoEntrega.Font.Bold = true;
                Fechaentrega.Visible       = true;

                Fechaentrega.Text = "Fecha de entrega: " + express.Datecode.ToString("dd-MM-yyyy");
            }
            else if (express.Hascodexp == 0)
            {
                EnviarPedido.Enabled = true;
            }


            if (Infousu.Rutempresa == "99558220-1")
            {
            }
            else if (Infousu.Rutempresa == "78509610-K")
            {
            }
            else
            {
                //Funcion detalle pedido para otros clientes
                Tabla = DetalleOtrosCli(RutaFile, "Despacho normal");
            }


            MOPanelFechas.Controls.Add(TablaPlazosEntrega());



            NetodelPedido.Text = "Neto total " + NetoPedido.ToString("C0");
            LblKilos.Text      = kilosPedido.ToString() + " kilos";
            //lblNombrePedido.Text = NombrePedido;
            lblObservacion.Text          = Observa;
            LblM2.Text                   = m2Pedido.ToString("0.##") + " metros cuadrados";
            GridDetallePedido.DataSource = Tabla;
            GridDetallePedido.DataBind();


            //codigo express
        }
    }