//listar os itens no cupom public void ListarItensCupom() { dgvCupom.DataSource = BusinesPedido.ListarItemPedido(int.Parse(lblIdPedido.Text)); dgvCupom.Columns["id_pedido"].Visible = false; dgvCupom.Columns["id_produto"].Visible = false; dgvCupom.Columns["descricao"].DisplayIndex = 1; dgvCupom.Columns["descricao"].HeaderText = "Nome do Produto"; dgvCupom.Columns["descricao"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; dgvCupom.Columns["codigo"].DisplayIndex = 2; dgvCupom.Columns["codigo"].HeaderText = "Código"; dgvCupom.Columns["codigo"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; dgvCupom.Columns["quantidade"].DisplayIndex = 3; dgvCupom.Columns["quantidade"].HeaderText = "Qtde."; //dgvCupom.Columns["quantidade"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; dgvCupom.Columns["preco"].DisplayIndex = 4; dgvCupom.Columns["preco"].HeaderText = "Preço un."; //dgvCupom.Columns["preco"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; DataGridViewCellStyle style = dgvCupom.ColumnHeadersDefaultCellStyle; style.BackColor = Color.WhiteSmoke; style.ForeColor = Color.Black; style.Font = new Font("Open Sans", 7, FontStyle.Bold); style.SelectionBackColor = Color.WhiteSmoke; dgvCupom.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dgvCupom.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; dgvCupom.ColumnHeadersHeight = 40; dgvCupom.ColumnHeadersVisible = true; lblTotalItens.Text = dgvCupom.Rows.Count.ToString(); }
//listar detalhes public void DetalhesPedido() { DataTable dt = new DataTable(); dt = BusinesPedido.ListarItemPedido(int.Parse(lblIdPedido.Text)); lblTotal.Text = dt.Rows[0]["Total"].ToString(); Decimal valorTotal = 0; if (!string.IsNullOrEmpty(dt.Rows[0]["Total"].ToString())) { for (int i = 0; i < dt.Rows.Count; i++) { valorTotal += Convert.ToDecimal(dt.Rows[i]["Total"].ToString()); } } lblSubTotalCupom.Text = valorTotal.ToString("N2"); lblTotal.Text = valorTotal.ToString("N2"); }