Exemplo n.º 1
0
    public void RefreshTable()
    {
        //load a lista de compras
        List <Compra> compras = StorageManager.Compras();

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

        //adiciona os outros valores
        foreach (Compra compra in compras)
        {
            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));

            tableContent.Add(linha);
        }
        table.Desenhar(tableContent);
    }
Exemplo n.º 2
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;
            }
        }
    }
Exemplo n.º 3
0
    public string FormatString(string value)
    {
        value = value.Replace(".", "");
        bool foundComma = false;

        for (int i = value.Length - 1; i >= 0; i--)
        {
            if (value[i] == ","[0])
            {
                if (foundComma)
                {
                    value = value.Remove(i, 1);
                }
                else
                {
                    foundComma = true;
                }
            }
        }
        print("1- " + value);

        if (!foundComma)
        {
            value += ",00";
        }
        else
        {
            int commaPos = value.LastIndexOf(","[0]);
            value += "00";
            value  = value.Substring(0, commaPos + 3);
        }
        return(Ultilities.Money(Ultilities.ParseFloat(value)));
    }
Exemplo n.º 4
0
 public void Preencher(Compra compra)
 {
     NomeDoFornecedor.field.text = compra.Fornecedor;
     AreaDaCompra.value          = (int)compra.Area;
     DataDaCompra.field.text     = compra.Data;
     valorDaCompra.field.text    = Ultilities.Money(compra.Valor);
     formaDePagamento.value      = (int)compra.Pagamento;
     notaFiscal.text             = Ultilities.FormatarNF(compra.NotaFiscal);
     banco.value = (int)compra.Banco;
     obs.text    = compra.Obs;
 }
Exemplo n.º 5
0
    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);
    }
Exemplo n.º 6
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);
    }
Exemplo n.º 7
0
    private IEnumerator AprovCoroutine(Compra compra, Retorno retorno)
    {
        elementos[0].text = compra.Fornecedor;
        elementos[1].text = compra.Data;
        elementos[2].text = System.Enum.GetName(typeof(AreasDoHotel), (AreasDoHotel)compra.Area);
        elementos[3].text = "R$ " + Ultilities.Money(compra.Valor);
        elementos[4].text = System.Enum.GetName(typeof(FormaDePagamento), (FormaDePagamento)compra.Pagamento);
        elementos[5].text = Ultilities.FormatarNF(compra.NotaFiscal);
        elementos[6].text = System.Enum.GetName(typeof(Caixa), (Caixa)compra.Banco);
        elementos[7].text = compra.Obs;

        while (aprovado == cancelado)
        {
            yield return(0);
        }
        if (aprovado)
        {
            retorno.Invoke(compra);
        }
        aprovado  = false;
        cancelado = false;
        gameObject.SetActive(false);
    }