示例#1
0
        private void descontoEspecial()
        {
            dalConfig conf = new dalConfig();
            decimal   descA = 0, descB = 0;

            foreach (DataGridViewRow row in dgvPedProduto.Rows)
            {
                string cat = (string)row.Cells[3].Value;
                if (conf.ListaAppConfig("ESP05").Any(cat.Contains))
                {
                    int x = dgvPedProduto.Rows.Count - 1 <= row.Index + 5 ? dgvPedProduto.Rows.Count - 1 : row.Index + 5;

                    for (int i = row.Index + 1; i <= x; i++)
                    {
                        descA += (decimal)dgvPedProduto.Rows[i].Cells["Subtotal"].Value;
                    }

                    lancaDesconto(row.Index, descA);
                    descA = 0;
                }
                if (conf.ListaAppConfig("ESP10").Any(cat.Contains))
                {
                    int x = dgvPedProduto.Rows.Count - 1 <= row.Index + 10 ? dgvPedProduto.Rows.Count - 1 : row.Index + 10;

                    for (int i = row.Index + 1; i <= x; i++)
                    {
                        descB += (decimal)dgvPedProduto.Rows[i].Cells["Subtotal"].Value;
                    }

                    lancaDesconto(row.Index, descB);
                    descB = 0;
                }
            }
        }
示例#2
0
        private void descontoDiario()
        {
            dalConfig conf = new dalConfig();
            decimal   desc = Convert.ToDecimal(conf.retornaConfig(DateTime.Now.DayOfWeek.ToString()));

            foreach (DataGridViewRow row in dgvPedProduto.Rows)
            {
                string cat = (string)row.Cells[3].Value;

                if (conf.ListaAppConfig("DIA").Any(cat.Contains) && conf.ListaAppConfig("ESP05").Any(cat.Contains))
                {
                    decimal descA    = (decimal)row.Cells[6].Value;
                    decimal desconto = ((decimal)row.Cells[5].Value * desc) / 100;
                    desconto += descA;
                    lancaDesconto(row.Index, desconto);
                }
                else if (conf.ListaAppConfig("DIA").Any(cat.Contains) && conf.ListaAppConfig("ESP10").Any(cat.Contains))
                {
                    decimal descA    = (decimal)row.Cells[6].Value;
                    decimal desconto = ((decimal)row.Cells[5].Value * desc) / 100;
                    desconto += descA;
                    lancaDesconto(row.Index, desconto);
                }
                else if (conf.ListaAppConfig("DIA").Any(cat.Contains) && !conf.ListaAppConfig("ESP05").Any(cat.Contains))
                {
                    decimal desconto = ((decimal)row.Cells[5].Value * desc) / 100;
                    lancaDesconto(row.Index, desconto);
                }
                else if (conf.ListaAppConfig("DIA").Any(cat.Contains) && !conf.ListaAppConfig("ESP10").Any(cat.Contains))
                {
                    decimal desconto = ((decimal)row.Cells[5].Value * desc) / 100;
                    lancaDesconto(row.Index, desconto);
                }
            }
        }
示例#3
0
        private void carregaForm()
        {
            dalConfig conf = new dalConfig();

            //Desconto Especial
            listaCategoriaESP05.Items.Clear();
            foreach (string t in conf.ListaAppConfig("ESP05"))
            {
                listaCategoriaESP05.Items.Add(t);
            }

            cbCategoriaESP05.DataSource    = conf.listaCategoriaAdd("ESP05");
            cbCategoriaESP05.DisplayMember = "Nome";
            cbCategoriaESP05.ValueMember   = "Nome";

            listaCategoriaESP10.Items.Clear();
            foreach (string t in conf.ListaAppConfig("ESP10"))
            {
                listaCategoriaESP10.Items.Add(t);
            }

            cbCategoriaESP10.DataSource    = conf.listaCategoriaAdd("ESP10");
            cbCategoriaESP10.DisplayMember = "Nome";
            cbCategoriaESP10.ValueMember   = "Nome";

            //Desconto Diário
            listaCategoriaDIA.Items.Clear();
            foreach (string t in conf.ListaAppConfig("DIA"))
            {
                listaCategoriaDIA.Items.Add(t);
            }

            cbCategoriaDIA.DataSource    = conf.listaCategoriaAdd("DIA");
            cbCategoriaDIA.DisplayMember = "Nome";
            cbCategoriaDIA.ValueMember   = "Nome";

            //Pula linha
            listaCategoria.Items.Clear();
            foreach (string t in conf.ListaAppConfig("pula"))
            {
                listaCategoria.Items.Add(t);
            }

            cbCategoria.DataSource    = conf.listaCategoriaAdd("pula");
            cbCategoria.DisplayMember = "Nome";
            cbCategoria.ValueMember   = "Nome";
        }
示例#4
0
        private void Cupom(int PedidoID, decimal valorTotal, bool viagem, bool taxas, decimal vltaxa)
        {
            //41 Caracteres - Fonte: Lucida Console - Tamanho: 8
            int                padding = 41;
            dalPedido          dalPed  = new dalPedido();
            dalItensPedido     dalIPed = new dalItensPedido();
            dalEmpresa         emp     = new dalEmpresa();
            dalPedidoPagamento dalPP   = new dalPedidoPagamento();
            dalConfig          conf    = new dalConfig();

            txtFormat      = new RichTextBox();
            txtFormat.Font = new Font("Lucida Console", 8);
            var     ItensCupom  = dalIPed.listaItensCupom(PedidoID);
            var     PedidoCupom = dalPed.PedidoImprimir(PedidoID);
            decimal Pagamento   = dalPP.PagamentoPedido(PedidoID);

            string linha      = "-----------------------------------------";
            string cabecalho  = string.Format("{0}", emp.retornaEmpresa().NomeFantasia);
            string cabecalho2 = string.Format("{0}, {1}", emp.retornaEmpresa().Endereco, emp.retornaEmpresa().Numero);
            string cabecalho3 = string.Format("{0}", emp.retornaEmpresa().Telefone1);
            string info       = string.Format("Pedido No: {0}", PedidoID);
            string infoD      = string.Format("{0:dd/MM/yy HH:mm}", PedidoCupom.Data);
            string infoN      = string.Format("Nome/Mesa: {0}", PedidoCupom.Nome);
            string cab_itens  = string.Format("{0,-22}{1,5}{2,7}{3,7}", "ITEM", "QTD", "V.UNI", "TOTAL");

            txtFormat.Text = cabecalho.PadBoth(padding) + "\r\n";
            txtFormat.AppendText(cabecalho2.PadBoth(padding) + "\r\n");
            txtFormat.AppendText(cabecalho3.PadBoth(padding) + "\r\n");
            txtFormat.AppendText(linha + "\r\n");
            txtFormat.AppendText(info + infoD.PadLeft(padding - info.Length) + "\r\n");
            txtFormat.AppendText(linha + "\r\n");
            txtFormat.AppendText(cab_itens + "\r\n");



            //Itens
            foreach (var item in ItensCupom)
            {
                if (conf.ListaAppConfig("pula").Any(item.categoria.Contains))
                {
                    int inicio_selecao = txtFormat.Text.Length + 23;
                    int inicio_seleca2 = txtFormat.Text.Length;
                    itens = string.Format("{0,-22}{1,5:N}{2,7:N}{3,7:N}", item.produto, item.quantidade, item.valorUnit, item.valorTotal);
                    txtFormat.AppendText("\r\n" + itens + "\r\n");

                    txtFormat.Select(inicio_seleca2, padding);
                    txtFormat.SelectionFont = new Font(txtFormat.Font, FontStyle.Bold);

                    if (item.quantidade > 1)
                    {
                        txtFormat.Select(inicio_selecao, item.quantidade.ToString().Length + 4);
                        txtFormat.SelectionFont = new Font(txtFormat.Font, FontStyle.Bold | FontStyle.Underline);
                    }
                }
                else
                {
                    int inicio_selecao = txtFormat.Text.Length + 23;
                    itens = string.Format("{0,-22}{1,5:N}{2,7:N}{3,7:N}", item.produto, item.quantidade, item.valorUnit, item.valorTotal);
                    txtFormat.AppendText(itens + "\r\n");
                    if (item.quantidade > 1)
                    {
                        txtFormat.Select(inicio_selecao, item.quantidade.ToString().Length + 3);
                        txtFormat.SelectionFont = new Font(txtFormat.Font, FontStyle.Bold | FontStyle.Underline);
                    }
                }
            }

            txtFormat.AppendText(linha + "\r\n");
            if (!PedidoCupom.Status)
            {
                if (PedidoCupom.TaxaS)
                {
                    txtFormat.AppendText(string.Format("{0,-34}{1,7:f}", "SERVIÇO (OPCIONAL)..............: ", vltaxa) + "\r\n");
                }

                txtFormat.AppendText(string.Format("TOTAL DO PEDIDO.................: {0,7:f}".PadBoth(padding), PedidoCupom.ValorTotal) + "\r\n");
                txtFormat.AppendText(string.Format("VALOR PAGO......................: {0,7:f}".PadBoth(padding), PedidoCupom.VlPago) + "\r\n");
                txtFormat.AppendText(string.Format("TROCO...........................: {0,7:f}", PedidoCupom.Troco).PadBoth(padding) + "\r\n\r\n");
                txtFormat.AppendText(string.Format("{0,-41}\r\n{1,-41}", "FORMA DE PAGAMENTO:", PedidoCupom.FormaPagamento));
                txtFormat.AppendText("\r\n");
            }

            if (!string.IsNullOrEmpty(PedidoCupom.Nome))
            {
                int padleft = ((41 - infoN.Length) / 2) + 6;
                int length  = txtFormat.Text.Length + padleft;
                txtFormat.AppendText("\r\n" + infoN.PadBoth(padding) + "\r\n");

                txtFormat.Select(length, PedidoCupom.Nome.Length);
                txtFormat.SelectionFont = new Font(txtFormat.Font, FontStyle.Bold);
            }

            if (viagem)
            {
                string s        = "PARA VIAGEM!";
                int    padleft2 = ((41 - s.Length) / 2);
                int    length2  = txtFormat.Text.Length + padleft2;
                txtFormat.AppendText(s.PadBoth(padding) + "\r\n\r\n");

                txtFormat.Select(length2, s.Length);
                txtFormat.SelectionFont = new Font(txtFormat.Font, FontStyle.Bold);
            }
            else
            {
                txtFormat.AppendText("\r\n");
            }

            txtFormat.AppendText(linha + "\r\n");
            txtFormat.AppendText("Marketaco".PadBoth(padding));
        }