Beispiel #1
0
        public string serviciosA(string banfn, string bnfpo)
        {
            List <ZEBAN_S_BE> servicios = ZEBAN_S_BLL.GET(Int32.Parse(banfn), bnfpo);
            List <ZEBAN_I_BE> IMP       = ZEBAN_I_BLL.GET(Int32.Parse(banfn), bnfpo);
            string            listas    = "";

            foreach (ZEBAN_S_BE s in servicios)
            {
                foreach (ZEBAN_I_BE i in IMP)
                {
                    if (s.BNFPO.Trim() == i.BNFPO.Trim())
                    {
                        listas += s.SERIAL + "|" + i.ASSET_NUM.Trim() + "|" + s.TEXTO + "|" + s.MENGE + "|";
                    }
                }
            }

            return(listas);
        }
Beispiel #2
0
        public string servicios(string banfn, string bnfpo)
        {
            List <ZEBAN_S_BE> servicios    = ZEBAN_S_BLL.GET(Int32.Parse(banfn), bnfpo);
            List <ZEBAN_I_BE> imputaciones = ZEBAN_I_BLL.GET(Int32.Parse(banfn), bnfpo);
            string            listas       = "";

            foreach (ZEBAN_S_BE s in servicios)
            {
                foreach (ZEBAN_I_BE i in imputaciones)
                {
                    if (s.SERIAL.Equals(i.SERIAL))
                    {
                        listas += s.SERIAL + "|" + s.SERVICIO.Trim() + "|" + s.TEXTO + "|" + s.MENGE + "|"
                                  + s.PREIS + "|" + desc_costes(i.COSTCENTER.Trim()) + "|" + desc_cuentas(i.GL_ACCOUNT.Trim()) + "|" + i.ASSET_NUM.Trim() + "|";
                    }
                }
            }

            return(listas);
        }
Beispiel #3
0
        public string aprobar(string banfn, string user, string url)
        {
            string[] ur = url.Split('/');
            string   u  = "";

            for (int i = 0; i < ur.Length - 1; i++)
            {
                u += ur[i] + "/";
            }
            List <ZEBAN_P_BE> requ       = ZEBAN_P_BLL.GET(banfn);
            string            referencia = "";//27.01.2017

            if (requ.Count > 0)
            {
                referencia     = requ[0].REFERENCIA;//27.01.2017
                requ[0].STATUS = rol(USUARIO_BLL.GET(user)[0]) + "";
                if (requ[0].STATUS.Equals("5") | requ[0].STATUS.Equals("6"))
                {
                    Conexion          con   = new Conexion();
                    List <ZEBAN_BE>   Items = ZEBAN_BLL.GET(Int32.Parse(banfn));
                    List <ZEBAN_I_BE> imps  = new List <ZEBAN_I_BE>();
                    List <ZEBAN_S_BE> servs = new List <ZEBAN_S_BE>();
                    foreach (ZEBAN_BE z in Items)
                    {
                        List <ZEBAN_I_BE> ii = ZEBAN_I_BLL.GET(z.BANFN, z.BNFPO.Trim());
                        List <ZEBAN_S_BE> ss = ZEBAN_S_BLL.GET(z.BANFN, z.BNFPO.Trim());
                        foreach (ZEBAN_I_BE i in ii)
                        {
                            imps.Add(i);
                            if (z.TIPO.Trim() != "F")
                            {
                                ZEBAN_S_BE t = new ZEBAN_S_BE();
                                t.ASSET_NUM  = i.ASSET_NUM.Trim();
                                t.COSTCENTER = i.COSTCENTER.Trim();
                                t.BANFN      = i.BANFN;
                                t.BNFPO      = i.BNFPO.Trim();
                                t.GL_ACCOUNT = i.GL_ACCOUNT.Trim();
                                t.SERIAL     = i.SERIAL;
                                //t.
                                servs.Add(t);
                            }
                        }
                        if (z.TIPO.Trim() == "F")
                        {
                            foreach (ZEBAN_S_BE s in ss)
                            {
                                s.SERVICIO = completa(s.SERVICIO.Trim(), 18);
                                servs.Add(s);
                            }
                        }
                    }
                    string[] ret = con.bapi_pr_create2(Items, imps, servs, user, u, referencia); //Crea requisición//27.01.2017
                    string   status;                                                             // = "E";
                    if (!ret[0].Equals(""))
                    {
                        status            = "B";
                        requ[0].APROBO    = user;
                        requ[0].SAP_BANFN = ret[0];
                        requ[0].STATUS    = "6";
                        int i = ZEBAN_P_BLL.UPDATE(requ[0]);
                        if (i > 0)
                        {
                            ZEBAN_H_BE his = new ZEBAN_H_BE();
                            his.BANFN    = banfn;
                            his.FECHA    = DateTime.Now;
                            his.NIPLOGIN = user;

                            ZEBAN_H_BLL.INSERT(his);

                            List <ZEBAN_D_BE> docs = ZEBAN_D_BLL.GET(Int32.Parse(banfn));
                            for (int y = 0; y < docs.Count; y++)
                            {
                                byte[] bytes = docs[y].INFO;
                                string name  = docs[y].NOMBRE + "." + docs[y].EXT;

                                ret[i] = con.rfcFuncionAdjuntar(ret[0], "BUS2105", name, bytes);
                            }



                            enviarF(user, Int32.Parse(banfn), u, ret[0]);
                            //return "Se ha aprobado la requisición";
                        }
                        ret[1] = "Se ha creado la requisición " + ret[0] + " en SAP";
                    }
                    else
                    {
                        status = "Hubieron errores al crear la requisición:";
                    }

                    return("\n" + ret[1]);
                }
                else
                {
                    requ[0].APROBO = user;
                    int i = ZEBAN_P_BLL.UPDATE(requ[0]);
                    if (i > 0)
                    {
                        ZEBAN_H_BE his = new ZEBAN_H_BE();
                        his.BANFN    = banfn;
                        his.FECHA    = DateTime.Now;
                        his.NIPLOGIN = user;

                        ZEBAN_H_BLL.INSERT(his);
                        enviar(user, Int32.Parse(banfn), u);
                        return("Se ha aprobado la requisición");
                    }
                }
            }
            return("Hubo un error al aprobar la requisición");
        }