private void formConfig_Load(object sender, EventArgs e) { carregaForm(); dalConfig conf = new dalConfig(); tbTaxaC.Text = conf.retornaConfig("TaxaC"); tbTaxaD.Text = conf.retornaConfig("TaxaD"); tbDomingo.Text = conf.retornaConfig("Sunday"); tbSegunda.Text = conf.retornaConfig("Monday"); tbTerca.Text = conf.retornaConfig("Tuesday"); tbQuarta.Text = conf.retornaConfig("Wednesday"); tbQuinta.Text = conf.retornaConfig("Thursday"); tbSexta.Text = conf.retornaConfig("Friday"); tbSabado.Text = conf.retornaConfig("Saturday"); if (conf.retornaConfig("SERV") == "S") { rbSimSERV.Checked = true; } else { rbNaoSERV.Checked = true; } }
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; } } }
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); } } }
private void apagarConfig(string id) { try { dalConfig conf = new dalConfig(); conf.delConfig(id); carregaForm(); } catch (Exception) { MessageBox.Show("ERRO", "Não foi possível apagar a categoria", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void adicionaConfig(string id, string nome) { try { dalConfig conf = new dalConfig(); conf.addConfig(id, nome); carregaForm(); } catch (Exception) { MessageBox.Show("ERRO", "Não foi possível adicionar a categoria", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void rbSimSERV_CheckedChanged(object sender, EventArgs e) { dalConfig conf = new dalConfig(); if (rbSimSERV.Checked) { conf.atuConfig("SERV", "S"); } else { conf.atuConfig("SERV", "N"); } }
private void atualizaTaxas(string TaxaC, string TaxaD) { try { dalConfig conf = new dalConfig(); conf.atuConfig("TaxaC", TaxaC); conf.atuConfig("TaxaD", TaxaD); MessageBox.Show("Taxas atualizadas com sucesso", "Atualizar taxas", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception) { throw; } }
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"; }
private void novoPedido() { dalPedido dalPed = new dalPedido(); dalConfig conf = new dalConfig(); bool taxa = conf.retornaConfig("SERV") == "S" ? true : false; dalPed.inserePedido(new Pedido { Nome = tbNomePedido.Text, Data = DateTime.Now, SubTotal = 0, ValorTotal = 0, NumPessoas = 1, Viagem = false, Status = true, Troco = 0, ValorPago = 0, TaxaS = taxa, VlTaxaS = 0 }); dalLogs.addLog(dalOperador.retornaOperador(Principal.OperadorID).Nome, "Adicionou o pedido nº: " + dalPed.selecionaUltimoPedido().PedidoID); tbNomePedido.Text = ""; pedidoDetalhes = new formPedidoDetalhes(); pedidoDetalhes.PedidoID = dalPed.selecionaUltimoPedido().PedidoID; pedidoDetalhes.MdiParent = ActiveForm; pedidoDetalhes.Show(); pedidoDetalhes.FormClosed += PedidoDetalhes_FormClosed; }
private void atualizaDescDiario(string Domingo, string Segunda, string Terca, string Quarta, string Quinta, string Sexta, string Sabado) { try { dalConfig conf = new dalConfig(); conf.atuConfig("Sunday", Domingo); conf.atuConfig("Monday", Segunda); conf.atuConfig("Tuesday", Terca); conf.atuConfig("Wednesday", Quarta); conf.atuConfig("Thursday", Quinta); conf.atuConfig("Friday", Sexta); conf.atuConfig("Saturday", Sabado); MessageBox.Show("Descontos diários atualizados com sucesso", "Atualizar descontos diários", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception) { throw; } }
public void Imprimir() { dalConfig conf = new dalConfig(); PrintDocument documento = new PrintDocument(); if (conf.retornaConfig("Impressora") != "Impressora padrão") { documento.PrinterSettings.PrinterName = conf.retornaConfig("Impressora"); } documento.PrintPage += documento_PrintPage; documento.Print(); Dispose(); // visualiza impressao para depois imprimir /*PrintPreviewDialog dialog = new PrintPreviewDialog(); * dialog.Document = documento; * dialog.ShowDialog();*/ }
private void btGerenciarPedido_Click(object sender, EventArgs e) { if (dalCaixa.verificaCaixa().Status) { if (gerenciarPedido == null) { dalConfig conf = new dalConfig(); gerenciarPedido = new formPedidoGerenciar(); gerenciarPedido.MdiParent = this; gerenciarPedido.Show(); gerenciarPedido.FormClosed += new FormClosedEventHandler(fecharGerenciarPedido); } else { gerenciarPedido.Activate(); } } else { MessageBox.Show("É preciso abrir o caixa antes de fazer pedidos.", "Novo pedido", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
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)); }