/*public ActionResult Comprovantepg(int id) * { * * Pagamento Retorno = new Pagamento(); * PagamentoDAO OP = new PagamentoDAO(); * Retorno = OP.dadosPagamento(id); * * ReportDocument rd = new ReportDocument(); * rd.Load(Path.Combine(Server.MapPath("~/Reports"), "Comprovantepg.rpt")); * rd.SetDataSource(Retorno); * * Response.Buffer = false; * Response.ClearContent(); * Response.ClearHeaders(); * * try * { * Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); * stream.Seek(0, SeekOrigin.Begin); * return File(stream, "application/pdf", "Comprovantepg" + id + ".pdf"); * } * catch (Exception e) * { * throw; * } * * }*/ public ActionResult vendaavista() { if (Session["idVendedor"] != null) { PedidosDAO OV = new PedidosDAO(); string somar = OV.somarPedido(); ViewBag.total = somar; return(View()); } else { return(RedirectToAction("Index")); } }
public ActionResult pedidos() { ViewBag.Status = "g"; if (Session["idVendedor"] != null) { List <Pedidos> Retorno = new List <Pedidos>(); PedidosDAO OV = new PedidosDAO(); Retorno = OV.MostrarPedidos(); string somar = OV.somarPedido(); ViewBag.total = somar; return(View(Retorno)); } else { return(RedirectToAction("Login")); } }
public ActionResult vendaaprazo() { if (Session["idVendedor"] != null) { PedidosDAO OV = new PedidosDAO(); string somar = OV.somarPedido(); ViewBag.total = somar; ClientesDAO objCl = new ClientesDAO(); string idCliente = Request["idCliente"].ToString(); string nomeCliente = objCl.selecionanomeCliente(idCliente); ViewBag.nomeCliente = nomeCliente; return(View()); } else { return(RedirectToAction("Index")); } }
public ActionResult vendas() { if (Session["idVendedor"] != null) { PedidosDAO OV = new PedidosDAO(); string somar = OV.somarPedido(); if (somar == "0") { string retorno = "Favor adicionar pelo menos um produto para concluir a venda."; ViewBag.retorno2 = retorno; return(RedirectToAction("pedidos")); } else { return(View()); } } else { return(RedirectToAction("Index")); } }
public ActionResult pedidos(Pedidos p) { if (Session["idVendedor"] != null) { ViewBag.Status = "p"; ProdutosDAO ObjPro = new ProdutosDAO(); Produtos objpro = new Produtos(); objpro.idProduto = p.idProduto; if (ObjPro.verificaProduto(objpro) == "1") { PedidosDAO objPr = new PedidosDAO(); string idsessao = ""; if (!(string.IsNullOrEmpty(Convert.ToString(Session["idVendedor"])))) { idsessao = Session["idVendedor"].ToString(); } p.idVendedor = Int32.Parse(idsessao); if (objPr.adicionarPedido(p) == "1") { string retorno = "Produto adicionado"; ViewBag.retorno2 = retorno; } else { string retorno = "Erro em adicionar produto"; ViewBag.retorno2 = retorno; } List <Pedidos> objP = new List <Pedidos>(); objP = objPr.MostrarPedidos(); string somar = objPr.somarPedido(); ViewBag.total = somar; /*inicio soma preço total * decimal somar = 0; * decimal totalItens = 0; * for (int i = 0; i < objP.Count; i++) * { * totalItens = objP[i].qtdProduto * objP[i].produtos_precoProduto; * somar = totalItens + somar; * } * ViewBag.total = somar; * Session["totalVenda"] = somar;*/ //fim soma preço total return(View(objP)); } else { PedidosDAO objPr = new PedidosDAO(); List <Pedidos> objP = new List <Pedidos>(); objP = objPr.MostrarPedidos(); /*inicio soma preço total * decimal somar = 0; * decimal totalItens = 0; * for (int i = 0; i < objP.Count; i++) * { * totalItens = objP[i].qtdProduto * objP[i].produtos_precoProduto; * somar = totalItens + somar; * } * ViewBag.total = somar;*/ //fim soma preço total ViewBag.retorno = ObjPro.verificaProduto(objpro); return(View(objP)); } } else { return(RedirectToAction("Index")); } }