Пример #1
0
    private void Validacionfechacalendario(DateTime fecha)
    {
        PlazoEntrega     Plazo  = Funciones.PlazoEntrega("Termo");
        SelectFromcodexp Codexp = Funciones.TablaCodExp(id_temp.Value);

        if (Codexp.Hascodexp == 1 && Codexp.Status == 0)
        {
            panelExpress.Visible = true;
            LblExpress.Text      = "ATENCIÓN: Hay una solicitud de código express pendiente, aún así usted puede solicitar un código para otra fecha o bien seleccionar una dentro de los plazos de entrega.";
            LblExpress.ForeColor = System.Drawing.Color.Red;
            PanelSinCod.Visible  = true;
        }
        else if (Codexp.Hascodexp == 1 && Codexp.Status == 1)
        {
            //codigo express liberado
        }
        else
        {
            if (fecha < Plazo.Fecha.AddDays(-1) && fecha > DateTime.Now)
            {
                panelExpress.Visible = true;
                LblExpress.Text      = "ATENCIÓN: Nuestro programa de producción puede ofrecer entrega a partir del día " + Plazo.Fecha.ToString("dd-MM-yyyy") + " en adelante. Si necesita que los productos sean entregados antes de la fecha " +
                                       "indicada, debe solicitar un código express.";

                PanelSinCod.Visible = true;
            }
            else
            {
                panelExpress.Visible = false;
            }
        }
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string User = Page.User.Identity.Name;

        DUser = new nsCliente.Usuario(User);


        if (DUser.HasEmpresa)
        {
            if (DUser.InfoEmpresas.Count > 1)
            {
                PnlBtnToMdlChangeCli.Visible = true;
            }
            else
            {
                PnlBtnToMdlChangeCli.Visible = false;
            }
            if (!IsPostBack)
            {
                rut = Request.QueryString["RUT"];
                if (!string.IsNullOrEmpty(rut))
                {
                    Cli = new DatosCliente(rut);
                }
                else
                {
                    Cli = DUser.InfoEmpresas.First();
                }
                HdnRutCli.Value = Cli.Rut;
                FillInformation(Cli);
            }
            else
            {
            }
        }
        else
        {
            Response.Redirect(Error404.Redireccion(MasterPageFile, User + ", no tienes empresa asignada :(. Por favor comuníquese con el administrador."));
        }



        Thread.CurrentThread.CurrentCulture = new CultureInfo("es-CL");
        FunDetPed    Funcion           = new FunDetPed();
        PlazoEntrega Plazoentregatermo = Funcion.PlazoEntrega("Termo");

        diastermo.Text  = "(" + Plazoentregatermo.Dias.ToString() + " días hábiles)";
        FechaTermo.Text = "Entrega el " + Plazoentregatermo.Fecha.ToShortDateString();
        PlazoEntrega Plazolamina = Funcion.PlazoEntrega("Lamina");

        DiasLaminas.Text  = "(" + Plazolamina.Dias.ToString() + " días hábiles)";
        FechaLaminas.Text = "Entrega el " + Plazolamina.Fecha.ToShortDateString();
        PlazoEntrega Plazoarq = Funcion.PlazoEntrega("Arq");

        DiasArq.Text  = "(" + Plazoarq.Dias.ToString() + " días hábiles)";
        FechaArq.Text = "Entrega el " + Plazoarq.Fecha.ToShortDateString();
    }
Пример #3
0
        public TOD(string codigoFuncionPlazoEntrega4055, string metodoPagoCargosTrasnporte4215,
                   PlazoEntrega plazoEntregaC100)
            : base("TOD")
        {
            _codigoFuncionPlazoEntrega_4055  = codigoFuncionPlazoEntrega4055;
            _metodoPagoCargosTrasnporte_4215 = metodoPagoCargosTrasnporte4215;
            _plazoEntrega_C100 = plazoEntregaC100;

            Segmento = montaSegmento();
        }
Пример #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Infousuario Datosusu = Usuario.DatosUsuario();

        string rutEmpresa = Datosusu.Rutempresa;

        ocultoRut.Value = rutEmpresa;


        if (!IsPostBack)
        {
            textFechHasta.Text             = DateTime.Now.ToShortDateString();
            TextFechDesde.Text             = DateTime.Now.AddDays(-30).ToShortDateString();
            CalendarFechDesde.SelectedDate = DateTime.Now.AddDays(-30);
            CalendarFechDesde.VisibleDate  = DateTime.Now.AddDays(-30);
        }
        PlazoEntrega plazo = Funcion.PlazoEntrega("Termo");

        diascorridos = plazo.DiasCorridos;
    }
Пример #5
0
    public PlazoEntrega PlazoEntrega(string TipoProducto)
    {
        PlazoEntrega variables = new PlazoEntrega();



        int    dias   = 0;
        string Select = "";

        if (TipoProducto == "Termo")
        {
            Select = @"Select Top 1 N1 FROM PLABAL.dbo.DIASENTREGA ORDER By ID DESC";
        }
        else if (TipoProducto == "Lamina")
        {
            Select = @"Select Top 1 A1 FROM PLABAL.dbo.DIASENTREGA ORDER By ID DESC";
        }
        else if (TipoProducto == "Arq")
        {
            Select = @"Select Top 1 H1 FROM PLABAL.dbo.DIASENTREGA ORDER By ID DESC";
        }


        ConnPlabal.Open();
        cmdPlabal = new SqlCommand(Select, ConnPlabal);
        drPlabal  = cmdPlabal.ExecuteReader();
        drPlabal.Read();

        if (drPlabal.HasRows)
        {
            dias = Convert.ToInt32(drPlabal[0].ToString());
        }
        else
        {
        }
        drPlabal.Close();
        ConnPlabal.Close();
        variables.Dias = dias;

        //selecciona la fecha segun la matriz de entrega
        CultureInfo ci       = new CultureInfo("en-US");
        int         sumadias = dias;
        int         j        = 1;

        for (int i = 0; i < sumadias; i++)
        {
            string diasem = DateTime.Now.AddDays(j).DayOfWeek.ToString();


            if (diasem == "Saturday" || diasem == "Sábado" || diasem == "Sabado")
            {
                sumadias = sumadias + 2;
            }
            else if (Esferiado(DateTime.Now.AddDays(j).ToString("M/d/yyyy", ci)) == 1)
            {
                if (diasem != "Saturday" && diasem != "Sunday")
                {
                    if (diasem != "Domingo" && diasem != "Sábado")
                    {
                        sumadias = sumadias + 1;
                    }
                }
            }

            j = j + 1;
        }

        if (Convert.ToInt32(DateTime.Now.Hour.ToString()) >= 15)
        {
            sumadias = sumadias + 1;
        }
        variables.DiasCorridos = sumadias;
        variables.Fecha        = DateTime.Now.AddDays(sumadias);
        return(variables);
    }
Пример #6
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
        }
    }
Пример #7
0
    private HtmlGenericControl TablaPlazosEntrega()
    {
        //tabla plazos de entrega
        DataTable          tablaPlazos = Funciones.FechasdeEntrega("Termo", DateTime.Now);
        HtmlGenericControl tabla       = new HtmlGenericControl("table");
        HtmlGenericControl thead       = new HtmlGenericControl("thead");
        HtmlGenericControl tr          = new HtmlGenericControl("tr");
        HtmlGenericControl th1         = new HtmlGenericControl("th");
        HtmlGenericControl th2         = new HtmlGenericControl("th");
        HtmlGenericControl th3         = new HtmlGenericControl("th");

        th1.InnerHtml = "Fecha";
        th2.InnerHtml = "Retiro";
        th3.InnerHtml = "Despacho";
        tr.Controls.Add(th1);
        tr.Controls.Add(th2);
        tr.Controls.Add(th3);
        tabla.ID = "TablaFechas";
        thead.Controls.Add(tr);
        thead.Attributes.Add("class", "cabecera");
        tabla.Controls.Add(thead);
        tabla.Attributes.Add("class", "table table-bordered tablafechas");
        int          introw            = 1;
        FunDetPed    Funcion           = new FunDetPed();
        PlazoEntrega Plazoentregatermo = Funcion.PlazoEntrega("Termo");
        int          Dexp      = Plazoentregatermo.Dias - 1;
        double       valor     = 180 / Dexp;
        int          PorcColor = Convert.ToInt32(Math.Round(valor, 0));

        int contcolor = 90;

        HtmlGenericControl tbody = new HtmlGenericControl("tbody");

        foreach (DataRow row in tablaPlazos.Rows)
        {
            HtmlGenericControl tr2 = new HtmlGenericControl("tr");
            HtmlGenericControl td0 = new HtmlGenericControl("td");
            HtmlGenericControl td1 = new HtmlGenericControl("td");
            HtmlGenericControl td2 = new HtmlGenericControl("td");
            HtmlGenericControl td3 = new HtmlGenericControl("td");

            td1.Attributes.Add("class", "seleccionhover cuadros");
            td2.Attributes.Add("class", "seleccionhover cuadros");


            td0.Attributes.Add("id", introw.ToString() + "1");
            td0.InnerHtml = row[1].ToString();
            td3.Attributes.Add("style", "display:none");
            td3.InnerHtml = row[3].ToString();


            if (row[2].ToString() == "express")
            {
                double operacion1 = Math.Round(NetoPedido * (1 + Funciones.ExponencialInv(40, -0.25, Convert.ToInt32(row[0].ToString()))));


                td1.Attributes.Add("id", introw.ToString() + "2");
                td0.Attributes.Add("class", "express ");
                td1.Attributes.Add("class", "express seleccionhover cuadros");
                td1.InnerHtml = operacion1.ToString("C0");
                td1.Attributes.Add("onclick", "Seleccionfecha('" + row[3].ToString() + "', 'retiro','" + introw.ToString() + "2','" + row[1].ToString() + "')");

                double operacion2 = Math.Round(NetoDespacho + NetoPedido * (1 + Funciones.ExponencialInv(40, -0.25, Convert.ToInt32(row[0].ToString()))));


                td2.Attributes.Add("id", introw.ToString() + "3");
                td2.Attributes.Add("class", "express seleccionhover cuadros");
                td2.InnerHtml = operacion2.ToString("C0");
                td2.Attributes.Add("onclick", "Seleccionfecha('" + row[3].ToString() + "', 'despacho','" + introw.ToString() + "3','" + row[1].ToString() + "')");

                contcolor = contcolor + PorcColor;
            }
            else
            {
                td1.Attributes.Add("id", introw.ToString() + "2");
                td1.InnerHtml = NetoPedido.ToString("C0");
                td1.Attributes.Add("onclick", "Seleccionfecha('" + row[3].ToString() + "', 'retiro','" + introw.ToString() + "2','" + row[1].ToString() + "')");


                td2.Attributes.Add("id", introw.ToString() + "3");
                td2.InnerHtml = (NetoDespacho + NetoPedido).ToString("C0");
                td2.Attributes.Add("onclick", "Seleccionfecha('" + row[3].ToString() + "', 'despacho','" + introw.ToString() + "3','" + row[1].ToString() + "')");
            }
            if (row[4].ToString() == "Best")
            {
                tr2.Attributes.Add("class", "recomendado");
                tr2.Attributes.Add("data-content", "Recomendado");
                tr2.Attributes.Add("rel", "popover");
                tr2.Attributes.Add("data-placement", "top");
                tr2.Attributes.Add("data-trigger", "hover");
            }
            tr2.Controls.Add(td0);
            tr2.Controls.Add(td1);
            tr2.Controls.Add(td2);
            tr2.Controls.Add(td3);
            tbody.Controls.Add(tr2);



            introw++;
        }
        tabla.Controls.Add(tbody);

        return(tabla);
    }
Пример #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Usuario     Usuario  = new Usuario();
        INFOcliente DatosCli = new INFOcliente();
        Infousuario infousu  = Usuario.Info;

        if (!IsPostBack)
        {
            Mensaje            Msj;
            HtmlGenericControl br;
            string[]           UserList = new string[3];
            UserList[0] = "ALLCLIENTES";
            UserList[1] = Page.User.Identity.Name;
            UserList[2] = infousu.Empresa.Trim();
            Msj         = new Mensaje(UserList);
            if (Msj.HasMessages)
            {
                PanelAlerta.Visible = true;
                foreach (var item in Msj.Mensajes)
                {
                    HtmlGenericControl HeadMsj = new HtmlGenericControl("label")
                    {
                        InnerHtml = item.From + " : &nbsp;"
                    };
                    HeadMsj.Attributes.Add("class", "font-weight-bold");
                    MsjPortal.Controls.Add(HeadMsj);
                    HtmlGenericControl Mensaje = new HtmlGenericControl("label")
                    {
                        InnerHtml = item.Cuerpo
                    };
                    MsjPortal.Controls.Add(Mensaje);
                    br = new HtmlGenericControl("br");
                    MsjPortal.Controls.Add(br);
                }
            }
        }



        DatosCli.Actualizarestado(infousu.IdEmpresa);
        string nombre = infousu.Empresa;

        Page.Title = nombre;
        if (infousu.Rutempresa != "" && infousu.Rutempresa != null)
        {
            Montos InfoFin = DatosCli.Montos();


            lblCreditoDis.Text = InfoFin.Credit.ToString("C0");

            lblDeuda.Text          = InfoFin.Utilizado.ToString("C0");
            LabelDisponible.Text   = InfoFin.Disponible.ToString("C0");
            Hiddendisponible.Value = InfoFin.Disponible.ToString();
            LblCliente.Text        = "Cliente: " + infousu.Empresa;
        }
        else
        {
        }
        Thread.CurrentThread.CurrentCulture = new CultureInfo("es-CL");
        FunDetPed    Funcion           = new FunDetPed();
        PlazoEntrega Plazoentregatermo = Funcion.PlazoEntrega("Termo");

        diastermo.Text  = "(" + Plazoentregatermo.Dias.ToString() + " días hábiles)";
        FechaTermo.Text = "Entrega el " + Plazoentregatermo.Fecha.ToShortDateString();
        PlazoEntrega Plazolamina = Funcion.PlazoEntrega("Lamina");

        DiasLaminas.Text  = "(" + Plazolamina.Dias.ToString() + " días hábiles)";
        FechaLaminas.Text = "Entrega el " + Plazolamina.Fecha.ToShortDateString();
        PlazoEntrega Plazoarq = Funcion.PlazoEntrega("Arq");

        DiasArq.Text  = "(" + Plazoarq.Dias.ToString() + " días hábiles)";
        FechaArq.Text = "Entrega el " + Plazoarq.Fecha.ToShortDateString();
    }