Beispiel #1
0
        /// <summary>
        /// Generars the specified identifier venta.
        /// </summary>
        /// <param name="idVenta">The identifier venta.</param>
        /// <returns>System.String.</returns>
        public string Generar(string idVenta)
        {
            #region Entidad
            var helper = new HelperScripts();
            var objs   = helper.GetVentaCliente(idVenta);
            if (!helper.LastResult.Success)
            {
                return("");
            }
            #endregion

            #region Action
            Func <Tuple <ventaDto, clienteDto, decimal>, string> action = null;
            switch (objs.Item1.i_IdTipoDocumento)
            {
            case 1:     // FACTURA
            case 3:     // BOLETA
                action = WorkingInvoice;
                break;

            case 7:     // NOTA CREDITO
                action = WorkingNotaCredito;
                break;

            case 8:     // NOTA DEBITO
                action = WorkingNotaDebito;
                break;
            }
            return(action != null?action(objs) : "");

            #endregion
        }
Beispiel #2
0
    TileProxy[] GetSideTiles(int team)
    {
        List <TileProxy> tls = new List <TileProxy>();

        if (team == BoardProxy.PLAYER_TEAM || team == -1)
        {
            for (int y = team == -1 ? 1 : 0; y < height - (team == -1 ? 1 : 0); y++)
            {
                for (int x = team == -1 ? 1 : 0; x < (width / 2) - 1; x++)
                {
                    if (!tiles[x, y].HasObstruction())
                    {
                        tls.Add(tiles[x, y]);
                    }
                }
            }
        }
        else if (team == BoardProxy.ENEMY_TEAM || team == -1)
        {
            for (int y = team == -1 ? 1 : 0; y < height - (team == -1 ? 1 : 0); y++)
            {
                for (int x = (width / 2) + 1; x < width - (team == -1 ? 1 : 0); x++)
                {
                    if (!tiles[x, y].HasObstruction())
                    {
                        tls.Add(tiles[x, y]);
                    }
                }
            }
        }
        TileProxy[] retTls = tls.ToArray();
        HelperScripts.Shuffle(retTls);
        Debug.Log("GetSideTiles: " + retTls.Length.ToString());
        return(retTls);
    }
Beispiel #3
0
    void Start()
    {
        PlayerMeta player = BaseSaver.GetPlayer();
        Glossary   glossy = glossary.GetComponent <Glossary>();

        string[] endings = new string[] { "Death has come..." };
        switch (player.faction)
        {
        case Unit.FactionType.Human:
            faction.sprite = glossy.humanFaction;
            endings        = StoryStatic.HUMAN_DEATHS;
            break;

        case Unit.FactionType.Cthulhu:
            faction.sprite = glossy.chtulhuFaction;
            endings        = StoryStatic.CTHULHU_DEATHS;
            break;

        case Unit.FactionType.Egypt:
            faction.sprite = glossy.egyptFaction;
            endings        = StoryStatic.EGYPT_DEATHS;
            break;
        }
        GetComponent <Image>().color = HelperScripts.GetColorByFaction(player.faction);
        HelperScripts.Shuffle(endings);
        headerTxtl.text = endings[0];
    }
 public Tile GetTile()
 {
     float[] probs = new float[tiles.Length];
     for (int i = 0; i < tiles.Length; i++)
     {
         probs[i] = tiles[i].weight;
     }
     return(tiles[HelperScripts.GetWeigtedIndex(probs)].tile);
 }
 public Enemy GetEnemy()
 {
     float[] probs = new float[enemies.Length];
     for (int i = 0; i < enemies.Length; i++)
     {
         probs[i] = enemies[i].weight;
     }
     return(enemies[HelperScripts.GetWeigtedIndex(probs)].enemy);
 }
 public DestructibleScriptableObject GetDestructible()
 {
     float[] probs = new float[destructibles.Length];
     for (int i = 0; i < destructibles.Length; i++)
     {
         probs[i] = destructibles[i].weight;
     }
     return(destructibles[HelperScripts.GetWeigtedIndex(probs)].destructible);
 }
Beispiel #7
0
    // Start is called before the first frame update
    void Awake()
    {
        instance = this;
        RefreshSelect();

        Color mainColor = HelperScripts.GetColorByFaction(BaseSaver.GetPlayer().faction);

        mainColor.a = .8f;
        GetComponent <Image>().color = mainColor;
        techSelect.transform.GetChild(0).GetComponent <TextMeshProUGUI>().text = "";

        selectTag.SetActive(false);
        techNext.SetActive(false);
    }
Beispiel #8
0
    // Update is called once per frame
    public void Click(string faction)
    {
        Debug.Log("Click: " + faction);
        string     aiStr  = "\nCampaign: Easy\n";
        GameMeta   game   = BaseSaver.GetGame();
        PlayerMeta player = BaseSaver.GetPlayer();

        player.faction = (Unit.FactionType)Enum.Parse(typeof(Unit.FactionType), faction);

        Color mainColor = HelperScripts.GetColorByFaction(player.faction);

        mainColor.a = .5f;
        GetComponent <Image>().color = mainColor;
        //transform.GetChild(2).GetComponent<Image>().color = HelperScripts.GetColorByFactionBold(player.faction);

        ResetParticles();

        if (finalWorld)
        {
            player.world = GameMeta.World.candy;
            aiStr        = "\nCampaign: Hard\n";
        }
        else
        {
            switch (player.faction)
            {
            case Unit.FactionType.Human: player.world = GameMeta.World.nile; break;

            case Unit.FactionType.Egypt: player.world = GameMeta.World.mountain; break;

            case Unit.FactionType.Cthulhu: player.world = GameMeta.World.pyramid; aiStr = "\nCampaign: Hard\n"; break;

            default: player.world = GameMeta.World.nile; break;
            }
        }

        switch (player.faction)
        {
        case Unit.FactionType.Human: SetParticles(human, true); break;

        case Unit.FactionType.Egypt: SetParticles(egypt, true); break;

        case Unit.FactionType.Cthulhu: SetParticles(cthulhu, true); break;
        }

        BaseSaver.PutPlayer(player);
        desc.text = "- " + faction + " - " + aiStr + "Strategy: " + Unit.GetFactionDesc(player.faction);
        btn.SetActive(true);
    }
    static string GetFinalCatchphrase(Skill.Actions act)
    {
        string[] phrases = new string[] { "death..." };
        switch (act)
        {
        //OnSelected
        case Skill.Actions.None: phrases = new string[] { "doom...", "la la la", "shiny", "cute", "where are you guys?" }; break;

        case Skill.Actions.DidAttack: phrases = new string[] { ":)", "are you mommy?", "you'll be my toy", "i see you", "peekaboo" }; break;

        case Skill.Actions.DidDefend: phrases = new string[] { ":|", "ouchie", "that hurts", "that's not fair", "i'll tell on you" }; break;

        case Skill.Actions.DidKill: phrases = new string[] { ";)", "death is my present", "let's play again", "that was fun", "i'm bored with you" }; break;
        }
        HelperScripts.Shuffle(phrases);
        return(phrases[0]);
    }
Beispiel #10
0
    public Sprite GetGrassTile(GameMeta.World wrld)
    {
        Sprite[] gTiles;
        switch (wrld)
        {
        case GameMeta.World.tutorial: return(grassTile);

        case GameMeta.World.mountain: gTiles = grassCamp2; break;

        case GameMeta.World.pyramid: gTiles = grassCamp3; break;

        case GameMeta.World.candy: gTiles = grassCamp4; break;

        default: gTiles = grassCamp1; break;
        }
        HelperScripts.Shuffle(gTiles);
        return(gTiles[0]);
    }
Beispiel #11
0
    public override void DidAttack(UnitProxy attacker, UnitProxy defender)
    {
        List <TileProxy> availableTiles = BoardProxy.instance.GetOpenTiles();

        HelperScripts.Shuffle(availableTiles);

        if (availableTiles.Count > 0)
        {
            TileProxy oldTile = BoardProxy.instance.GetTileAtPosition(defender.GetPosition());
            availableTiles.Remove(oldTile);
            defender.ZapToTile(availableTiles[0], oldTile, "WarpAtk");

            //availableTiles[0].FloatUp(Skill.Actions.None, "whabam!", Color.blue, "WarpAtk");
            //availableTiles[0].ReceiveGridObjectProxy(defender);
            //oldTile.FloatUp(Skill.Actions.None, "poof", Color.cyan, "WarpAtk");
            //oldTile.RemoveGridObjectProxy(defender);
            defender.SnapToCurrentPosition();
        }
    }
Beispiel #12
0
 void CheckWall()
 {
     if (IsWall())
     {
         GetComponent <SpriteRenderer>().sprite = def;
         if (!HasObstacle())
         {
             List <ObstacleProxy> obsList = new List <ObstacleProxy>(BoardProxy.instance.glossary.GetComponent <Glossary>().obstacles);
             ObstacleProxy[]      obsArr  = obsList.ToArray();
             HelperScripts.Shuffle(obsArr);
             ObstacleProxy obs = Instantiate(obsArr[0], transform);
             obs.Init();
             ReceiveGridObjectProxy(obs);
             obs.SnapToCurrentPosition();
             Color ObsColor = new Color(1, .73f, .73f);
             GetComponent <SpriteRenderer>().color = ObsColor;
         }
     }
 }
Beispiel #13
0
    /*
     *
     * Humans say badass murica things
     *
     */
    static string GetHumanCatchphrase(Skill.Actions act)
    {
        string[] phrases = new string[] { "yo" };
        switch (act)
        {
        //OnSelected
        case Skill.Actions.None: phrases = new string[] { "roger", "listening", "standing by", "yo", "copy that", "moving", "walking",
                                                          "hostiles sighted", "investigating", "engaging" }; break;

        case Skill.Actions.DidAttack: phrases = new string[] { "die!", "firing", "eat this!", "burn!", "murica!", "apple pies!", "neutralizing",
                                                               "aiming", "get down!", "boom", "dodge this", "suck on this", "for freedom!", "target acquired" }; break;

        case Skill.Actions.DidDefend: phrases = new string[] { "ouch!", "medic!", "taking damage", "oof", "mommy!", "oops..", "shields down",
                                                               "taking fire", "hamburgers...", "that'll scar", "don't let me die!", "i see the light", "under attack" }; break;

        case Skill.Actions.DidKill: phrases = new string[] { "hoo rah!", "take that!", "enemy down", "who's next?", "and stay down!", "via con dios" }; break;
        }
        HelperScripts.Shuffle(phrases);
        return(phrases[0]);
    }
Beispiel #14
0
        /// <summary>
        /// Genera un Pdf que representa el Comprobante Electronico.
        /// <para>El que podra ser enviado via Correo Electronico</para>
        /// </summary>
        /// <param name="idVenta">Id de la Venta</param>
        public Tuple <string, byte[]> GenerarPdf(string idVenta)
        {
            var objBl = new HelperScripts();
            var aptitudeCertificate = objBl.GetReporteInvoice(idVenta);
            var objVenta            = aptitudeCertificate.First();

            var ds1 = new DataSet();
            var dt  = Utils.Utils.ConvertToDatatable(aptitudeCertificate);

            dt.TableName = "Comprobante";
            ds1.Tables.Add(dt);
            var bl     = new ConfiguracionFacturacionBl();
            var config = bl.Get();

            if (!bl.LastResult.Success)
            {
                throw new Exception("No se pudo cargar la configuracion, " + bl.LastResult.ErrorMessage);
            }
            ds1.Tables.Add(GetDataEmpresa("EmpresaInfo",
                                          new KeyValuePair <string, object>("Logo", config.b_Logo),
                                          new KeyValuePair <string, object>("CodigoQr", GetQrCodeArray(objVenta, config.v_Ruc))
                                          ));
            var leyenda = objVenta.Gratuito == 1
                ? "TRANSFERENCIA GRATUITA DE UN BIEN Y/O SERVICIO PRESTADO GRATUITAMENTE"
                : "SON : " + Utils.Utils.ConvertirenLetras(objVenta.Total) + " " + (objVenta.Moneda == 1 ? "SOLES" : "DOLARES AMERICANOS");
            var rp = new crFacturaElectronica();

            rp.SetDataSource(ds1);
            rp.SetParameterValue("TotalLetras", leyenda);
            rp.SetParameterValue("PaginaWeb", config.v_Web ?? "");
            rp.SetParameterValue("Resolucion", config.v_Resolucion ?? "");
            rp.SetParameterValue("RucEmpresa", "RUC: " + config.v_Ruc);

            using (var st = rp.ExportToStream(ExportFormatType.PortableDocFormat))
            {
                var arr = new byte[st.Length];
                st.Read(arr, 0, arr.Length);
                return(new Tuple <string, byte[]>(objVenta.Documento + ".pdf", arr));
            }
            //rp.ExportToDisk(ExportFormatType.PortableDocFormat, path);
        }
Beispiel #15
0
 // Update is called once per frame
 void Update()
 {
     if ((transform.position - player.transform.position).magnitude < VISIONRADIUS && looking == true)
     {
         RaycastHit2D hit = Physics2D.Raycast(eyes.transform.position, (player.transform.GetChild(5).position - eyes.transform.position).normalized, Mathf.Infinity, ~(1 << LayerMask.NameToLayer("Enemy")));
         Debug.DrawLine(player.transform.GetChild(5).position, eyes.transform.position);
         Debug.DrawLine(transform.position, Vector2.up, Color.blue);
         Debug.DrawLine(player.transform.position, Vector2.up, Color.red);
         Debug.Log(hit.collider);
         if (hit.collider.gameObject.tag.Equals("Player"))
         {
             Debug.Log("Player seen, attacking");
             looking = false;
             GameManager.instance.AddEnemyAttack(new CombatBean(attack, HelperScripts.Clone(GameManager.instance.player.transform.position), HelperScripts.Clone(transform.position), gameObject.GetComponent <AttackMoves>()));
         }
     }
     if (walking)
     {
         rb.velocity = new Vector2(speed, rb.velocity.y);
     }
 }
Beispiel #16
0
    /*
     *
     * Cthulhu says evil things in latin
     *
     */
    static string GetCthulhuCatchphrase(Skill.Actions act)
    {
        string[] phrases = new string[] { "gurgle" };
        switch (act)
        {
        //OnSelected
        case Skill.Actions.None: phrases = new string[] { "*gurgle*", "*squish*", "*belch*", "opus dei", "ora pro nobis", "nocte",
                                                          "satanas graditur", "imperium", "quia sanguinem", "virgineo removete" }; break;

        case Skill.Actions.DidAttack: phrases = new string[] { "sssss", "*squaaaak*", "omnibus idem", "fiat tenebris", "nova sanguinem",
                                                               "lunam in potestatem", "marcescet", "infirma ad vescendum" }; break;

        case Skill.Actions.DidDefend: phrases = new string[] { "*plop*", "*oop*", "opere et veritate", "fortis et liber", "pax aeterna",
                                                               "deus videt omnia", "maledicentibus vobis", "omnes nos", "per vires sanguis" }; break;

        case Skill.Actions.DidKill: phrases = new string[] { "obiit", "odi et amo", "oleum camino", "omnia cum deo", "omnia omnibus",
                                                             "ordo ab chao", "orbis unum", "excelsior", "per festum", "inanis est", "pars requiescant in", "purgare per tenebras" }; break;
        }
        HelperScripts.Shuffle(phrases);
        return(phrases[0]);
    }
Beispiel #17
0
    /// <summary>
    /// When the enemy dies, drop its items and destroy the enemy
    /// </summary>
    private void Death()
    {
        if (enemy.dropChance > Random.Range(0, 1f))
        {
            ItemPickup item = Instantiate(itemPrefab, transform.parent);
            item.SetItem(new ItemStack(enemy.itemDrops[Random.Range(0, enemy.itemDrops.Length)].item, 1));
            item.transform.position = transform.position;
        }

        int numExpOrbs = HelperScripts.RandomVec(enemy.numExpOrbs);
        int expPerOrb  = Mathf.RoundToInt(enemy.experienceDrop / (float)numExpOrbs);

        GetComponent <EnemyMovement>().RemoveSpotClaim();
        Destroy(gameObject);

        for (int i = 0; i < numExpOrbs; i++)
        {
            Experience exp = Instantiate(experiencePrefab, transform.parent);
            exp.transform.position = transform.position;
            exp.experienceAmount   = expPerOrb;
        }
    }
Beispiel #18
0
    /*
     *
     * Egypt says badass culty things
     *
     */
    static string GetEgyptCatchphrase(Skill.Actions act)
    {
        string[] phrases = new string[] { "phsaw" };
        switch (act)
        {
        //OnSelected
        case Skill.Actions.None: phrases = new string[] { "navigating", "moving", "master?", "yes", "i obey", "for egypt", "swiftly",
                                                          "understood", "flying", "i am commanded", "by the wings of Ra" }; break;

        case Skill.Actions.DidAttack: phrases = new string[] { "sand attack", "scarab stab", "titan punch", "fire jab",
                                                               "whirlwind", "breath of horus", "the styx breathes", "release your soul", "give me your breath", "see your sins",
                                                               "breathe death", "the earth taketh", "fire and sand" }; break;

        case Skill.Actions.DidDefend: phrases = new string[] { "impossible!", "witchcraft!", "mummies...", "unravelled", "beat down",
                                                               "mortal wounds", "unholy beast", "i curse thee", "avenge me", "phsaw" }; break;

        case Skill.Actions.DidKill: phrases = new string[] { "rest", "to eternity", "immense power", "sun's blessing", "back to the earth",
                                                             "eternal peace", "sacrifice made", "death to interlopers" }; break;
        }
        HelperScripts.Shuffle(phrases);
        return(phrases[0]);
    }
Beispiel #19
0
    private bool GetNextMove(out Vector2 nextMove)
    {
        nextMove = HelperScripts.GetNextMove(Vector2Int.RoundToInt(transform.position),
                                             Vector2Int.RoundToInt(target.transform.position), firstpassPathfindingLayer,
                                             enemySight, altMove);

        if (nextMove.x != Vector2.positiveInfinity.x)
        {
            return(true);
        }

        // If there is a blockage, it might be because an enemy is in the way, so then we look for a path
        // with the enemy's layer disabled
        nextMove = HelperScripts.GetNextMove(Vector2Int.RoundToInt(transform.position),
                                             Vector2Int.RoundToInt(target.transform.position), secondPassPathfindingLayer, enemySight, altMove);

        if (nextMove.x != Vector2.positiveInfinity.x)
        {
            return(true);
        }

        return(false);
    }
 void Start()
 {
     instance        = this;
     damageParticles = HelperScripts.GetComponentFromChildrenExc <ParticleSystem>(transform);
 }
Beispiel #21
0
 public GameObject GetRandomGummi()
 {
     GameObject[] gummis = new GameObject[] { bearBlack, bearBlue, bearGreen, bearOrange, bearPurple, bearRed, bearYellow };
     HelperScripts.Shuffle(gummis);
     return(gummis[0]);
 }
 void Parry()
 {
     GameManager.instance.AddPlayerAttack(new CombatBean(CombatBean.Attacks.parry, HelperScripts.Clone(MouseWorldPoint()), HelperScripts.Clone(this.transform.position), GetComponent <AttackMoves>()));
 }
Beispiel #23
0
 private void Start()
 {
     animator     = GetComponent <Animator>();
     healthSlider = HelperScripts.GetComponentFromChildrenExc <Slider>(transform);
     InitializeStats();
 }
Beispiel #24
0
    void Awake()
    {
        PlayerMeta    player = BaseSaver.GetPlayer();
        List <string> mages  = new List <string>(new string[] { "HumanBaseMage", "EgyptBaseMage", "CthulhuBaseMage" });
        List <string> scouts = new List <string>(new string[] { "HumanBaseScout", "EgyptBaseScout", "CthulhuBaseScout" });

        int rM  = 0;
        int rSc = 0;
        int rSo = 0;

        foreach (Unit unt in player.characters)
        {
            ClassNode clss = unt.GetCurrentClass();
            while (clss.GetParent() != null)
            {
                clss = clss.GetParent();
            }
            if (mages.Contains(clss.GetType().ToString()))
            {
                rM++;
            }
            else if (scouts.Contains(clss.GetType().ToString()))
            {
                rSc++;
            }
            else
            {
                rSo++;
            }
        }

        //rosterTxt.text = "Current Army: \nMage: " + rM.ToString() + "\nScout: " + rSc.ToString() + "\nSoldier: " + rSo.ToString();
        armyPnl.transform.GetChild(0).GetChild(0).GetComponent <TextMeshProUGUI>().text = rM.ToString();
        armyPnl.transform.GetChild(1).GetChild(0).GetComponent <TextMeshProUGUI>().text = rSc.ToString();
        armyPnl.transform.GetChild(2).GetChild(0).GetComponent <TextMeshProUGUI>().text = rSo.ToString();

        switch (player.faction)
        {
        case Unit.FactionType.Cthulhu:
            armyPnl.transform.GetChild(0).GetChild(2).GetComponent <Image>().sprite = glossary.GetComponent <Glossary>().cthulhuMage.transform.GetChild(0).GetComponent <SpriteRenderer>().sprite;
            armyPnl.transform.GetChild(1).GetChild(2).GetComponent <Image>().sprite = glossary.GetComponent <Glossary>().cthulhuScout.transform.GetChild(0).GetComponent <SpriteRenderer>().sprite;
            armyPnl.transform.GetChild(2).GetChild(2).GetComponent <Image>().sprite = glossary.GetComponent <Glossary>().cthulhuSoldier.transform.GetChild(0).GetComponent <SpriteRenderer>().sprite;
            break;

        case Unit.FactionType.Human:
            armyPnl.transform.GetChild(0).GetChild(2).GetComponent <Image>().sprite = glossary.GetComponent <Glossary>().humanMage.transform.GetChild(0).GetComponent <SpriteRenderer>().sprite;
            armyPnl.transform.GetChild(1).GetChild(2).GetComponent <Image>().sprite = glossary.GetComponent <Glossary>().humanScout.transform.GetChild(0).GetComponent <SpriteRenderer>().sprite;
            armyPnl.transform.GetChild(2).GetChild(2).GetComponent <Image>().sprite = glossary.GetComponent <Glossary>().humanSoldier.transform.GetChild(0).GetComponent <SpriteRenderer>().sprite;
            break;

        case Unit.FactionType.Egypt:
            armyPnl.transform.GetChild(0).GetChild(2).GetComponent <Image>().sprite = glossary.GetComponent <Glossary>().egyptMage.transform.GetChild(0).GetComponent <SpriteRenderer>().sprite;
            armyPnl.transform.GetChild(1).GetChild(2).GetComponent <Image>().sprite = glossary.GetComponent <Glossary>().egyptScout.transform.GetChild(0).GetComponent <SpriteRenderer>().sprite;
            armyPnl.transform.GetChild(2).GetChild(2).GetComponent <Image>().sprite = glossary.GetComponent <Glossary>().egyptSoldier.transform.GetChild(0).GetComponent <SpriteRenderer>().sprite;
            break;
        }


        panels = new GameObject[panelGroup.transform.childCount];
        for (int i = 0; i < panelGroup.transform.childCount; i++)
        {
            panels[i] = panelGroup.transform.GetChild(i).gameObject;
            UnitProxy unt = ClassNode.ComputeClassBaseUnit(player.faction, (Unit.UnitType)i, glossary.GetComponent <Glossary>());
            panels[i].transform.GetChild(1).GetComponent <Image>().sprite = unt.transform.GetChild(0).GetComponent <SpriteRenderer>().sprite;
        }
        selectableUnits = new Unit[] {
            Unit.BuildInitial(player.faction, Unit.UnitType.Mage, BoardProxy.PLAYER_TEAM),
            Unit.BuildInitial(player.faction, Unit.UnitType.Scout, BoardProxy.PLAYER_TEAM),
            Unit.BuildInitial(player.faction, Unit.UnitType.Soldier, BoardProxy.PLAYER_TEAM),
        };
        for (int i = 0; i < selectableUnits.Length && i < panels.Length; i++)
        {
            RefreshPanel(panels[i], selectableUnits[i]);
        }
        selected = null;
        contBtn.gameObject.SetActive(false);
        ResetParticles();

        GetComponent <Image>().color = HelperScripts.GetColorByFaction(player.faction);
    }
Beispiel #25
0
        private Dictionary <OtrosConceptosTributarios, decimal> LoadDetail(List <InvoiceDetail> details, ventaDto obj, decimal igv)
        {
            var helper = new HelperScripts();
            var ventas = helper.GetVentaDetalles(obj.v_IdVenta, _config.i_GroupUndInter ?? 148);

            if (ventas == null)
            {
                return(null);
            }

            var sum = new Dictionary <OtrosConceptosTributarios, decimal>
            {
                { OtrosConceptosTributarios.TotalVentaOperacionesGravadas, 0 },
                { OtrosConceptosTributarios.TotalVentaOperacionesExoneradas, 0 },
                { OtrosConceptosTributarios.TotalVentaOperacionesInafectas, 0 },
                { OtrosConceptosTributarios.TotalVentaOperacionesGratuitas, 0 }
            };

            foreach (var detalle in ventas)
            {
                var item = detalle.Item1;
                var tipoAfectacionIgv = (TipoAfectacionIgv)Enum.ToObject(typeof(TipoAfectacionIgv), detalle.Item3);
                var precioUnit        = (tipoAfectacionIgv == TipoAfectacionIgv.GravadoOperacionOnerosa && obj.i_PreciosIncluyenIgv == 1
                                 ? item.d_Precio / (1M + igv) : item.d_Precio) ?? 0M;
                var            precioItem = precioUnit;
                productoiscDto isc        = null;
                if (IsValueNotNullorZero(item.d_isc))
                {
                    isc = helper.GetIscFromDetail(item.v_IdProductoDetalle, obj.v_Periodo);
                    switch (isc.i_IdSistemaIsc)
                    {
                    case 1:
                        precioItem *= 1M + isc.d_Porcentaje ?? 0;
                        break;

                    case 2:
                        precioItem += isc.d_Monto ?? 0;
                        break;

                    case 3:
                        precioItem += isc.d_Porcentaje * isc.d_Monto ?? 0;
                        break;
                    }
                }
                if (tipoAfectacionIgv == TipoAfectacionIgv.GravadoOperacionOnerosa)
                {
                    precioItem *= (1M + igv);
                }
                var isGratuito = (int)tipoAfectacionIgv % 10 != 0;
                var detail     = new InvoiceDetail
                {
                    CodigoProducto      = item.v_IdProductoDetalle,
                    Cantidad            = item.d_Cantidad ?? 0M,
                    DescripcionProducto = item.v_DescripcionProducto,
                    PrecioUnitario      = isGratuito ? 0 : precioUnit,
                    PrecioAlternativos  = new List <PrecioItemType>
                    {
                        new PrecioItemType
                        {
                            TipoDePrecio = TipoPrecioVenta.PrecioUnitario,
                            Monto        = isGratuito ? 0 : precioItem
                        }         // Precio con ISC e IGV
                    },
                    UnidadMedida = detalle.Item2,
                    ValorVenta   = item.d_ValorVenta ?? 0M,
                    Impuesto     = GetImpuestosLine(item, tipoAfectacionIgv)
                };
                if (isGratuito)
                {
                    detail.PrecioAlternativos.Add(new PrecioItemType
                    {
                        TipoDePrecio = TipoPrecioVenta.ValorReferencial,
                        Monto        = precioItem
                    });
                }

                if (isc != null)
                {
                    detail.Impuesto.Add(new TotalImpuestosType
                    {
                        TipoIsc     = (TipoSistemaIsc)Enum.ToObject(typeof(TipoSistemaIsc), isc.i_IdSistemaIsc ?? 1),
                        TipoTributo = TipoTributo.ISC_EXC,
                        Monto       = item.d_isc ?? 0
                    });
                }
                SetSuma(ref sum, tipoAfectacionIgv, isGratuito ? item.d_Cantidad * precioUnit ?? 0 : detail.ValorVenta);
                details.Add(detail);
            }
            return(sum);
        }