Exemple #1
0
    public void RefreshItem(Compra compra)
    {
        for (int i = 0; i < table.tableContent.Count; i++)
        {
            if (table.tableContent[i][1].Value == compra.Fornecedor && int.Parse(table.tableContent[i][5].Value) == compra.NotaFiscal)
            {
                List <Tabela3.TableItem> linha = new List <Tabela3.TableItem>();
                linha.Add(new Tabela3.TableItem(compra.Data));
                linha.Add(new Tabela3.TableItem(compra.Fornecedor));
                linha.Add(new Tabela3.TableItem(compra.Area.ToString()));
                linha.Add(new Tabela3.TableItem(Ultilities.Money(compra.Valor)));
                linha.Add(new Tabela3.TableItem(compra.Pagamento.ToString()));
                linha.Add(new Tabela3.TableItem(Ultilities.NF(compra.NotaFiscal)));
                linha.Add(new Tabela3.TableItem(compra.Banco.ToString()));
                linha.Add(new Tabela3.TableItem(compra.Obs));
                table.tableContent[i] = linha;


                float currentScroll = table.bar.value;
                table.Desenhar(table.tableContent);
                table.bar.value = currentScroll;
                table.OnScroll(table.bar.value);
                return;
            }
        }
    }
    public IEnumerator Desenhar()
    {
        yield return(0);

        if (jaExistia)
        {
            print("mudando fornecedor");
            PlayerPrefs.SetString("FornecedorCpF", input.field.text);
        }
        else
        {
            print("mudando outra coisa");
            string lastName = PlayerPrefs.GetString("FornecedorCpF");
            if (input.ValoresASeremProcurados.Contains(lastName))
            {
                print("Possuia o nome " + lastName);
                input.field.text = lastName;
            }
            else
            {
                print("Não possuia o nome " + lastName);
            }
        }

        jaExistia = true;

        //PlayerPrefs.SetString("FornecedorCpF", input.field.text);

        //prepara o conteudo da tabela
        List <List <Tabela3.TableItem> > tableContent = new List <List <Tabela3.TableItem> >();

        foreach (Compra item in comprasPassiveis)
        {
            if (item.Fornecedor == input.field.text)
            {
                List <Tabela3.TableItem> linha = new List <Tabela3.TableItem>();
                linha.Add(new Tabela3.TableItem(item.Data));
                linha.Add(new Tabela3.TableItem(item.Area.ToString()));
                linha.Add(new Tabela3.TableItem(Ultilities.Money(item.Valor)));
                linha.Add(new Tabela3.TableItem(item.Pagamento.ToString()));
                linha.Add(new Tabela3.TableItem(NF(item.NotaFiscal)));
                linha.Add(new Tabela3.TableItem(item.Banco.ToString()));
                linha.Add(new Tabela3.TableItem(item.Obs));

                tableContent.Add(linha);
            }
        }
        table.Desenhar(tableContent);
    }
Exemple #3
0
    public override void Setup(List <Compra> compras)
    {
        base.Setup(compras);

        List <string> areas           = new List <string>();
        List <float>  gastoTotal      = new List <float>();
        List <int>    numeroDeCompras = new List <int>();

        foreach (Compra item in compras)
        {
            int index = areas.IndexOf(item.Area.ToString());
            if (index >= 0)
            {
                gastoTotal[index]      += item.Valor;
                gastoTotal[index]       = (float)System.Math.Round(gastoTotal[index], 2);
                numeroDeCompras[index] += 1;
            }
            else
            {
                areas.Add(item.Area.ToString());
                gastoTotal.Add(item.Valor);
                numeroDeCompras.Add(1);
            }
        }


        //prepara o conteudo da tabela
        List <List <Tabela3.TableItem> > tableContent = new List <List <Tabela3.TableItem> >();

        //adiciona os outros valores
        for (int i = 0; i < areas.Count; i++)
        {
            List <Tabela3.TableItem> linha = new List <Tabela3.TableItem>();
            linha.Add(new Tabela3.TableItem(areas[i]));
            linha.Add(new Tabela3.TableItem(Ultilities.Money(gastoTotal[i])));
            linha.Add(new Tabela3.TableItem(numeroDeCompras[i]));

            tableContent.Add(linha);
        }
        table.Desenhar(tableContent);
    }