Пример #1
0
        private void frmVendasRegistro1_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.Hide();
            frmVendas frm = new frmVendas();

            frm.lblTipoUsuario.Text = this.lblTipoUsuario.Text;
            frm.Show();
        }
        private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            try
            {
                DataGridViewRow dr = dataGridView1.SelectedRows[0];
                this.Hide();
                frmVendas frmVendas = new frmVendas();
                // or simply use column name instead of index
                // dr.Cells["id"].Value.ToString();
                frmVendas.Show();
                frmVendas.txtContaFat.Text     = dr.Cells[0].Value.ToString();
                frmVendas.dtpDataFatura.Text   = dr.Cells[1].Value.ToString();
                frmVendas.txtSubTotal.Text     = dr.Cells[2].Value.ToString();
                frmVendas.txtTaxPer.Text       = dr.Cells[3].Value.ToString();
                frmVendas.txtTaxAmt.Text       = dr.Cells[4].Value.ToString();
                frmVendas.txtDescontoPer.Text  = dr.Cells[5].Value.ToString();
                frmVendas.txtDescontoAmt.Text  = dr.Cells[6].Value.ToString();
                frmVendas.txtTotal.Text        = dr.Cells[7].Value.ToString();
                frmVendas.txtDinheiro.Text     = dr.Cells[8].Value.ToString();
                frmVendas.txtTroco.Text        = dr.Cells[9].Value.ToString();
                frmVendas.btnAtualizar.Enabled = true;
                frmVendas.btnDelete.Enabled    = true;
                frmVendas.btnImprimir.Enabled  = true;
                frmVendas.btnSalvar.Enabled    = false;

                con = new SqlConnection(cs.DBConn);
                con.Open();
                cmd = new SqlCommand("SELECT Product.ProductID,ProductSold.Productname,ProductSold.Price,ProductSold.Quantity,ProductSold.TotalAmount from Invoice_Info,ProductSold,Product where Invoice_info.InvoiceNo=ProductSold.InvoiceNo and Product.ProductID=ProductSold.ProductID and invoice_Info.InvoiceNo='" + dr.Cells[0].Value.ToString() + "'", con);
                rdr = cmd.ExecuteReader();
                while (rdr.Read() == true)
                {
                    ListViewItem lst = new ListViewItem();
                    lst.SubItems.Add(rdr[0].ToString().Trim());
                    lst.SubItems.Add(rdr[1].ToString().Trim());
                    lst.SubItems.Add(rdr[2].ToString().Trim());
                    lst.SubItems.Add(rdr[3].ToString().Trim());
                    lst.SubItems.Add(rdr[4].ToString().Trim());
                    frmVendas.listView1.Items.Add(lst);
                }
                frmVendas.listView1.Enabled          = false;
                frmVendas.btnIncluirCarrinho.Enabled = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #3
0
 private void vendaToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (UsuarioTipo.Text == "ADMIN")
     {
         frmVendas frm = new frmVendas();
         frm.lblTipoUsuario.Text   = lblUsuario.Text;
         frm.btnObterDados.Enabled = true;
         frm.MdiParent             = this;
         frm.Show();
     }
     if (UsuarioTipo.Text == "VENDEDOR")
     {
         frmVendas frm = new frmVendas();
         frm.lblTipoUsuario.Text   = lblUsuario.Text;
         frm.btnObterDados.Enabled = false;
         frm.MdiParent             = this;
         frm.Show();
     }
 }