示例#1
0
    public void add_product(Object Src, CommandEventArgs As)
    {
        DetalleCotizaVO VO = new DetalleCotizaVO();
        DetalleCotizaBL BL = new DetalleCotizaBL();

        VO.ProductoRef        = As.CommandName.ToString().Split('|')[0];
        VO.CotizacionId       = Int32.Parse(Session["OrderNumber"].ToString());
        VO.ProductoDesc       = As.CommandName.ToString().Split('|')[2] + " - " + As.CommandArgument.ToString().Split('|')[0];
        VO.ProductoPrecio     = Double.Parse(As.CommandName.ToString().Split('|')[3]);
        VO.Cantidad           = 1;
        VO.TiempoEntrega      = 0;
        VO.UnidadMedida       = Int32.Parse(As.CommandArgument.ToString().Split('|')[1]);
        VO.TipoMoneda         = Int32.Parse(As.CommandArgument.ToString().Split('|')[2]);
        VO.UsuarioIdActualiza = Int32.Parse(Session["usuarioID"].ToString());
        VO.ProductoComodin    = 0;
        VO.AplicaRango        = Int32.Parse(As.CommandName.ToString().Split('|')[4]);;
        //VO.Descuento = Double.Parse(As.CommandArgument.ToString().Split('|')[3]);
        VO.Operacion = DetalleCotizaVO.INSERTAR;
        VO           = (DetalleCotizaVO)BL.execute(VO);

        if (VO.Resultado == 0)
        {
            Response.Redirect("../Cotizador/ShopCart.aspx?cotizacionid=" + Session["OrderNumber"]);
        }
        else
        {
            lblError.Text = VO.MensajeError;
        }
    }
示例#2
0
    public object execute(object o)
    {
        VOReg = (DetalleCotizaVO)o;

        if (VOReg.Operacion == DetalleCotizaVO.ACTUALIZAR)
        {
            return(actualizaDetalles());
        }
        else if (VOReg.Operacion == DetalleCotizaVO.INSERTAR)
        {
            return(insertaDetalles());
        }
        else if (VOReg.Operacion == DetalleCotizaVO.BUSCAR)
        {
            return(buscarDetalle());
        }
        else if (VOReg.Operacion == DetalleCotizaVO.BUSCAR_DETALLES_COTIZACION)
        {
            return(buscarDetallesCotizacion());
        }

        return(VOReg);
    }
示例#3
0
    public void Add_To_Cart(Object Src, EventArgs Args)
    {
        Label FVBookID    = (Label)FormViewDisplay.FindControl("BookID");
        Label FVBookTitle = (Label)FormViewDisplay.FindControl("BookTitle");

        //Decimal BookPrice = Decimal.Parse(FVBookPrice.Text.Replace("$",""));
        //Label FVBookSalePrice = (Label)FormViewDisplay.FindControl("BookSalePrice");
        Label FVBookSalePrice = (Label)FormViewDisplay.FindControl("lblPrecio");

        Label FVBookAuthor = (Label)FormViewDisplay.FindControl("BookAuthor");

        Decimal BookPrice;
        TextBox FVCantidad      = (TextBox)FormViewDisplay.FindControl("txtCantidad");
        TextBox FVTiempoEntrega = (TextBox)FormViewDisplay.FindControl("txtTiempoEntrega");
        Label   FVDescuento     = (Label)FormViewDisplay.FindControl("lblDescuento");

        if (FVBookSalePrice.Text != "")
        {
            //BookPrice = Decimal.Parse(FVBookSalePrice.Text.Replace("Special Price: $", ""));
            BookPrice = Decimal.Parse(FVBookSalePrice.Text);
        }

        //DropDownList FVunidadMedida = (DropDownList)FormViewDisplay.FindControl("lstUnidadMedida");
        Label FVTipoMoneda = (Label)FormViewDisplay.FindControl("lblMoneda");


        DetalleCotizaVO VO = new DetalleCotizaVO();
        DetalleCotizaBL BL = new DetalleCotizaBL();

        //log.Info("numero de sesion = " + Session["OrderNumber"].ToString());

        VO.ProductoRef  = FVBookID.Text;
        VO.CotizacionId = Int32.Parse(Session["OrderNumber"].ToString());
        VO.ProductoDesc = FVBookTitle.Text + " - " + FVBookAuthor.Text;
        //VO.productoPrecio = FVBookPrice.Text;
        VO.ProductoPrecio     = Double.Parse(FVBookSalePrice.Text);
        VO.Cantidad           = Int32.Parse(FVCantidad.Text);
        VO.TiempoEntrega      = Int32.Parse(FVTiempoEntrega.Text);
        VO.UnidadMedida       = Int32.Parse(((DropDownList)FormViewDisplay.FindControl("lstUnidadMedida")).SelectedValue);
        VO.TipoMoneda         = Int32.Parse(FVTipoMoneda.Text);
        VO.UsuarioIdActualiza = Int32.Parse(Session["usuarioID"].ToString());
        VO.ProductoComodin    = 0;
        VO.Descuento          = Double.Parse(FVDescuento.Text);
        VO.Operacion          = DetalleCotizaVO.INSERTAR;
        VO = (DetalleCotizaVO)BL.execute(VO);

        Button botonTemp = (Button)Src;

        if (VO.Resultado == 0)
        {
            botonTemp.Text      = "Producto Añadido";
            botonTemp.ForeColor = Color.FromName("#00C000");
            botonTemp.BackColor = Color.FromName("#E0E0E0");
            botonTemp.Font.Bold = true;
            Response.Redirect("../Cotizador/ShopCart.aspx?cotizacionid=" + Session["OrderNumber"]);
        }
        else
        {
            botonTemp.Text      = VO.MensajeError;
            botonTemp.ForeColor = Color.FromName("#990000");
            botonTemp.BackColor = Color.FromName("#E0E0E0");
            botonTemp.Font.Bold = true;
        }
    }
    protected void Button6_Click(object sender, EventArgs e)
    {
        NoItemsMessage.Visible = false;

        cotizacionVO VO = new cotizacionVO();
        CotizacionBL BL = new CotizacionBL();

        VO.Operacion           = cotizacionVO.ACTUALIZAR;
        VO.CotizacionId        = Int32.Parse(Request["cotizacionid"]);
        VO.EstatusCotizacionId = 2;

        VO = (cotizacionVO)BL.execute(VO);
        if (VO.Resultado == 0)
        {
            ErrMessage.Text      = "COTIZACION APROBADA";
            intEstatusCotizacion = 2;
            //Button btnActualizar = (Button)ShopCartGrid.Row.FindControl("Button3");
            //btnActualizar.Visible = false;
        }
        else
        {
            ErrMessage.Text = "Los datos NO se actualizaron correctamente";
        }

        String carpetaEmpresa = "C:/CompacW/Empresas/CALVEK";
        int    prueba         = 0;
        int    prueba2        = 0;
        saludo nuevo          = new saludo();
        String lSerie         = "            ";
        Double lFolio         = new Double();
        int    gIdDocto       = 0;

        String lCodigoConcepto = "";

        nuevo.fInicializaSDKW();
        nuevo.fAbreEmpresaW(carpetaEmpresa);
        prueba = nuevo.fSiguienteFolioW("1", lSerie, ref lFolio);

        nuevo.fPosPrimerConceptoDoctoW();

        nuevo.fLeeDatoConceptoDoctoW("cCodigoC01", lCodigoConcepto, 31);

        //nuevo.fCierraEmpresaW();
        //nuevo.fTerminaSDKW();

        String lFecha = lblFechaCotizacion.Text.Substring(3, 2) + "/" + lblFechaCotizacion.Text.Substring(0, 2) + "/" + lblFechaCotizacion.Text.Substring(6, 4);

        //lblComodin.Text += "<BR>Serie:" + lSerie;
        //lblComodin.Text += "<BR>Folio:" + lFolio.ToString();

        //lblEtiqueta.Visible = true;
        //lblEtiqueta.Text += "<BR>";
        //lblEtiqueta.Text += "<BR>Folio:" + lFolio;
        //lblEtiqueta.Text += "<BR>Serie:" + lSerie;
        //lblEtiqueta.Text += "<BR>NumMoneda:" + lblMoneda.Text;
        //lblEtiqueta.Text += "<BR>TipoCambio:" + lblTipoCambio.Text;
        //lblEtiqueta.Text += "<BR>concepto:" + f_RellenaConBlancos("1", 31);
        //lblEtiqueta.Text += "<BR>Serie:" + f_RellenaConBlancos(lSerie, 12);
        //lblEtiqueta.Text += "<BR>fecha:" + f_RellenaConBlancos(lFecha, 24);
        //lblEtiqueta.Text += "<BR>CodigoCteProv:" + f_RellenaConBlancos(lblCodigoCliente.Text, 31);
        //lblEtiqueta.Text += "<BR>CodigoAgente:" + f_RellenaConBlancos(lblCodigoAgente.Text, 31);
        //lblEtiqueta.Text += "<BR>Referencia:" + f_RellenaConBlancos(Session["OrderNumber"].ToString(), 21);

        //tDocumento EncabezadoDocumento = new tDocumento();
        //EncabezadoDocumento.aFolio = lFolio;
        //EncabezadoDocumento.aSerie = lSerie;
        //EncabezadoDocumento.aNumMoneda = Int32.Parse(lblNumMoneda.Text);
        //EncabezadoDocumento.aTipoCambio = Double.Parse(lblTipoCambio.Text);
        //EncabezadoDocumento.aImporte = 0;
        //EncabezadoDocumento.aDescuentoDoc1 = 0;
        //EncabezadoDocumento.aDescuentoDoc2 = 0;
        //EncabezadoDocumento.aSistemaOrigen = 55; //SDK ISV //aSistemaOrigen
        //EncabezadoDocumento.aCodConcepto = f_RellenaConBlancos("1",31);
        //EncabezadoDocumento.aSerie = f_RellenaConBlancos(lSerie,12);
        //EncabezadoDocumento.aFecha = f_RellenaConBlancos(lFecha,24);
        //EncabezadoDocumento.aCodigoCteProv = f_RellenaConBlancos(lblCodigoCliente.Text,31);
        //EncabezadoDocumento.aCodigoAgente = f_RellenaConBlancos(lblCodigoAgente.Text,31);
        //EncabezadoDocumento.aReferencia = f_RellenaConBlancos(Session["OrderNumber"].ToString(),21);
        //EncabezadoDocumento.aAfecta = 0;

        ////nuevo.fInicializaSDKW();
        ////nuevo.fAbreEmpresaW(carpetaEmpresa);

        prueba = nuevo.fBuscaConceptoDoctoW("1");  //MGW100006 Tabla de Conceptos de Documento
        if (prueba == 0)
        {
            NoItemsMessage.Text = "SE ENCONTRO CONCEPTO. ";
        }
        else
        {
            NoItemsMessage.Text = "NO SE ENCONTRO CONCEPTO. ";
        }

        prueba = nuevo.fAltaDocumentoW(ref gIdDocto, lFolio, lSerie, Int32.Parse(lblNumMoneda.Text), Double.Parse(lblTipoCambio.Text), 0, 0, 0, 55, lCodigoConcepto, lFecha, lblCodigoCliente.Text, lblCodigoAgente.Text, Session["OrderNumber"].ToString(), 0);
        //prueba = nuevo.fAltaDocumentoW(ref gIdDocto);

        //tMovimiento RegMovimiento = new tMovimiento();
        Boolean gPrimerMovto = true;
        int     lConsecutivoMovto;

        if (prueba == 0)
        {
            // se agregan movimientos de los productos

            DetalleCotizaVO VODetalleCotiza = new DetalleCotizaVO();
            DetalleCotizaBL BLDetalleCotiza = new DetalleCotizaBL();
            VODetalleCotiza.Operacion = DetalleCotizaVO.BUSCAR_DETALLES_COTIZACION;
            VODetalleCotiza           = (DetalleCotizaVO)BLDetalleCotiza.execute(VODetalleCotiza);

            String[,] arregloDetalles;
            arregloDetalles = VODetalleCotiza.ArrDetalles;
            int    lIdMovimiento     = 0;
            String lValorConsecutivo = "0";

            for (int i = 0; i <= arregloDetalles.GetLength(1) - 1; i++)
            {
                if (gPrimerMovto)
                {
                    lConsecutivoMovto = 100;
                }
                else
                {
                    nuevo.fPosUltimoMovimientoW();
                    nuevo.fLeeDatoMovimientoW("cNumeroM01", lValorConsecutivo, 10);
                    lConsecutivoMovto = 100 + Int32.Parse(lValorConsecutivo);
                    //lConsecutivoMovto += 100;
                }
                gPrimerMovto = false;

                //RegMovimiento.aConsecutivo = lConsecutivoMovto;
                //RegMovimiento.aUnidades = Double.Parse(arregloDetalles[3, i]);//' En caso de producto con series, lotes y/o pedimentos y carcateristicas este valor es cero
                //RegMovimiento.aPrecio = Double.Parse(arregloDetalles[2, i]) * Double.Parse(arregloDetalles[5, i]); //' Usado para docuementos de venta
                //RegMovimiento.aCosto = 0;       //' Usado para docuemtnos de compra y/o inventarios
                //RegMovimiento.aCodProdSer = arregloDetalles[0, i];
                //RegMovimiento.aCodAlmacen = "QGEN001"; // Pendiente
                //RegMovimiento.aReferencia = f_RellenaConBlancos(Session["OrderNumber"].ToString(),21);
                //RegMovimiento.aCodClasificacion = "" + ((char)0);  //' No tiene uso, valor omision en blancos

                prueba2 = nuevo.fAltaMovimientoW(gIdDocto, ref lIdMovimiento, lConsecutivoMovto, Double.Parse(arregloDetalles[3, i]), (Double.Parse(arregloDetalles[2, i]) * Double.Parse(arregloDetalles[5, i])), 0, arregloDetalles[0, i], "QGEN001", Session["OrderNumber"].ToString(), "" + ((char)0));
                if (prueba2 == 0)
                {
                    ErrMessage.Text += "COTIZACION EN ADMIN PAQ EXITOSA";
                }
                else
                {
                    NoItemsMessage.Visible = true;
                    NoItemsMessage.Text    = nuevo.MensajeError(prueba2);
                    nuevo.f_TerminaW(2);         // 0.- Se cancelan los cambios documento
                }
            }
        }
        else
        {
            NoItemsMessage.Visible = true;
            NoItemsMessage.Text   += nuevo.MensajeError(prueba);
            nuevo.f_TerminaW(0);     // 0.- Se cancelan los cambios documento
        }


        nuevo.fCierraEmpresaW();
        nuevo.fTerminaSDKW();

        //      //lblComodin.Text = "HOLA";
    }