Exemple #1
0
        public void verificarMir7(string fechafac, string año, decimal importe, decimal importeIVA, decimal importeSub, string moneda, string numerodoc, ref string mensaje, ref string advertencia, string val_fec, string val_impt, string val_imps, string val_iva, string val_mon, decimal importedesc)
        {
            PNegocio.FacturasNE nFac = new PNegocio.FacturasNE();
            List <string[]>     listaDiferentesInstancias = new List <string[]>();

            listaDiferentesInstancias = (List <string[]>)Session["listaDiferentesInstancias"];
            string repuesta =
                nFac.validardatosMir7(listaDiferentesInstancias, fechafac, año, importe, importeIVA, importeSub, moneda, numerodoc, val_fec, val_impt, val_imps, val_iva, val_mon, importedesc);

            if (repuesta.Contains('N'))
            {
                mensaje = mensaje + "Error: no se pudo validar algunos datos en SAP.</br>";
            }
            else
            {
                if (repuesta.Contains('M'))
                {
                    mensaje = mensaje + "Tipo de moneda incorrecta.</br>";
                }
                if (repuesta.Contains('I'))
                {
                    mensaje = mensaje + "Importe total incorrecto: " + importe + "</br>";
                }
                if (repuesta.Contains('V'))
                {
                    mensaje = mensaje + "Importe IVA incorrecto: " + importeIVA + "</br>";
                }
                if (repuesta.Contains('S'))
                {
                    mensaje = mensaje + "Importe subtotal incorrecto: " + importeSub + "</br>";
                }
                if (repuesta.Contains('F'))
                {
                    advertencia = advertencia + "Fecha diferente al sistema</br>";
                }
                if (repuesta.Contains('E'))
                {
                    mensaje = mensaje + "No existe moneda registrada en el sistema.</br>";
                }
            }
        }
        public void cargardatos(bool adjuntar)
        {
            PNegocio.FacturasNE nFac = new PNegocio.FacturasNE();//Es el bean que tiene el acceso al web service
            List <PEntidades.FacturasXVerificar> lstFact = new List <PEntidades.FacturasXVerificar>();

            string ordenarOrden = "X";

            try
            {
                int n_instancias = 0;
                try
                {
                    if (this.hidActualiza.Value != "actualiza" && Request.Form["actualizar"] != "actualiza")
                    {
                        lstFact = (List <PEntidades.FacturasXVerificar>)Session["lstFacturas2"];
                    }
                }
                catch (Exception)
                {
                }
                string mensaje = "";
                if (lstFact == null || lstFact.Count <= 0)
                {
                    List <string[]> listaDiferentesInstancias = (List <string[]>)Session["listaDiferentesInstancias"];
                    listaDiferentesInstanciasg = listaDiferentesInstancias;

                    //string ordenarComo = this.rdbMostrarComo.Text.Trim();
                    //string ordenarRef = "";
                    //if (ordenarComo == "Referencia")
                    //{
                    //    ordenarOrden = "";
                    //    ordenarRef = "X";
                    //}

                    //Gen.Util.CS.Gen.convertirFecha(
                    string flow = Gen.Util.CS.Gen.convertirFecha_SAP(this.datepicker.Text.Trim());
                    string fhig = Gen.Util.CS.Gen.convertirFecha_SAP(this.datepicker2.Text.Trim());

                    string monedaHig = this.txtMoneda1.Text.Trim();
                    string monedaLow = this.txtMoneda2.Text.Trim();

                    //string factHig = Gen.Util.CS.Gen.convertirFecha_SAP(this.txtffact1.Text.Trim());
                    //string factLow = Gen.Util.CS.Gen.convertirFecha_SAP(this.txtffact2.Text.Trim());

                    string refhig = this.txtRef1.Text.Trim();
                    string refLow = this.txtRef2.Text.Trim();


                    if (refLow == "")
                    {
                        refLow = refhig;
                    }
                    if (refhig == "")
                    {
                        refhig = refLow;
                    }

                    //"f hig", "f low", "fact hig", "fact low", "moneda hig", "moneda low", objLifnr, ordenarOrden, ordenarRef, "ref hig", "ref low"
                    n_instancias = listaDiferentesInstancias.Count;
                    //if (n_instancias > 0)
                    //{
                    if (flow != "" || refLow != "" || monedaLow != "")
                    {
                        //mgv - probar llamada conexion SAP
                        //lstFact = nFac.getListFacturasNewConSAP(
                        //listaDiferentesInstancias,    ordenarOrden, "",        fhig, flow,
                        //"", "",                       monedaHig, monedaLow,    refhig, refLow, ref mensaje   );
                        //mgv - cambio a conexion SAP

                        lstFact = nFac.getListFacturasNew(
                            listaDiferentesInstancias,
                            ordenarOrden, "",
                            fhig, flow,
                            //txtffact1.Text, txtffact2.Text,
                            "", "",
                            monedaHig, monedaLow,
                            refhig, refLow, ref mensaje
                            );
                    }

                    //}
                    Session["lstFacturas2"] = lstFact; //----new----- // se guarda en la sesion el resultado
                    /*Pinta la lista en còdigo HTML*/
                }

                try
                {
                    PNegocio.ConvertTittles conv = new PNegocio.ConvertTittles();

                    if (lstFact.Count > 0)
                    {
                        this.lblTabla.Text        = conv.convertListToTableInCode(lstFact, ordenarOrden);
                        this.btnActualiza.Visible = true;
                    }
                    else
                    {
                        if (String.IsNullOrEmpty(mensaje))
                        {
                            string[] status = nFac.status;
                            this.lblTabla.Text = "<br/><br/><br/><br/><h3>Ingrese un dato para mostrar Factura</h3>";
                            if (status.Length > 0)
                            {
                                for (int i = 0; i < status.Length; i++)
                                {
                                    if (status[i] != "" && status[i] != null)
                                    {
                                        this.lblTabla.Text += "<br/><h3>" + status[i] + "</h3>";
                                    }
                                }
                                this.lblTabla.Text += "<br/><h3>" + "Se recomienda intentar utilizando los campos para selección especifica(Referencia, Moneda y Fecha)" + "</h3>";
                            }
                            if (n_instancias <= 0)
                            {
                                this.lblTabla.Text = "<br/><br/><br/><h3>" + "Este usuario no tiene sociedades activas, por lo que no puede obtener datos" + "</h3>";
                            }
                        }
                        else
                        {
                            this.lblTabla.Text = "<br/><br/><br/><br/><h3>Por el momento no se tiene acceso a las facturas porque están siendo tratadas por el administrador. </br> Actualice o intente más tarde.</h3>";
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
            catch (Exception)
            {
                this.lblTabla.Text = "<h3>Ocurrio un error al obtener los datos<h3>";
            }
        }