Esempio n. 1
0
        private void dgw_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            try
            {
                DataGridViewRow dr = dgw.SelectedRows[0];
                this.Hide();
                Purchaseproduct frmPurchase = new Purchaseproduct();

                if (lblSet.Text == "Purchase")
                {
                    frmPurchase.txt_ven_invoice.Text = ModCS.InvoiceNumber;
                }
                frmPurchase.Show();
                frmPurchase.txtSup_ID.Text       = dr.Cells[0].Value.ToString();
                frmPurchase.txtSupplierID.Text   = dr.Cells[1].Value.ToString();
                frmPurchase.txtSupplierName.Text = dr.Cells[3].Value.ToString();
                frmPurchase.txtContactNo.Text    = dr.Cells[9].Value.ToString();
                frmPurchase.GetSupplierBalance();
            }



            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
        private void PurchaseProductToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Purchaseproduct ss = new Purchaseproduct();

            ss.Show();
            ss.lblUser.Text = lblUser.Text;
        }
Esempio n. 3
0
        private void dgw_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            try
            {
                if (dgw.Rows.Count > 0)
                {
                    {
                        DataGridViewRow dr = dgw.SelectedRows[0];


                        this.Hide();
                        Purchaseproduct frmPurchase = new Purchaseproduct();
                        // or simply use column name instead of index
                        // dr.Cells["id"].Value.ToString();
                        frmPurchase.Show();
                        frmPurchase.txtST_ID.Text         = dr.Cells[0].Value.ToString();
                        frmPurchase.txt_invoice.Text      = dr.Cells[1].Value.ToString();
                        frmPurchase.dateTimePicker1.Text  = dr.Cells[2].Value.ToString();
                        frmPurchase.txt_ven_invoice.Text  = dr.Cells[3].Value.ToString();
                        frmPurchase.combo_pur_type.Text   = dr.Cells[5].Value.ToString();
                        frmPurchase.txtSup_ID.Text        = dr.Cells[6].Value.ToString();
                        frmPurchase.txtSupplierID.Text    = dr.Cells[7].Value.ToString();
                        frmPurchase.txtSupplierName.Text  = dr.Cells[8].Value.ToString();
                        frmPurchase.txt_total_amount.Text = dr.Cells[9].Value.ToString();
                        frmPurchase.txt_discount.Text     = dr.Cells[10].Value.ToString();
                        frmPurchase.txt_dis_amount.Text   = dr.Cells[11].Value.ToString();
                        frmPurchase.txt_tax.Text          = dr.Cells[12].Value.ToString();
                        frmPurchase.txt_tax_amount.Text   = dr.Cells[13].Value.ToString();

                        frmPurchase.txt_net_amount.Text = dr.Cells[14].Value.ToString();
                        frmPurchase.txt_old_bal.Text    = dr.Cells[15].Value.ToString();
                        frmPurchase.txt_new_bal.Text    = dr.Cells[16].Value.ToString();

                        frmPurchase.txt_paid_amount.Text = dr.Cells[17].Value.ToString();
                        frmPurchase.txt_dues.Text        = dr.Cells[18].Value.ToString();
                        frmPurchase.txt_comments.Text    = dr.Cells[19].Value.ToString();


                        frmPurchase.btnSave.Enabled = false;
                        frmPurchase.btn_add.Enabled = false;

                        frmPurchase.GetSupplierBalance1();
                        frmPurchase.btnDelete.Enabled = true;

                        frmPurchase.panel22.Enabled = false;



                        ModCommonClasses.con = new SqlConnection(ModCS.cs);
                        ModCommonClasses.con.Open();
                        string sql = "SELECT tbl_pur_product.Productcode,tbl_pur_product.Barcode,tbl_pur_product.Productname,tbl_pur_product.Typeofunit,tbl_pur_product.Description,tbl_pur_product.Purchaseprice,tbl_pur_product.Qty,tbl_pur_product.Total,tbl_pur_product.Mfd,tbl_pur_product.Expdate from tbl_pur_product,tbl_stock_product,tbl_purchase where tbl_purchase.ST_ID=tbl_pur_product.StockID and tbl_stock_product.Productcode=tbl_pur_product.Productcode and tbl_purchase.ST_ID=" + dr.Cells[0].Value.ToString() + "";
                        ModCommonClasses.cmd = new SqlCommand(sql, ModCommonClasses.con);
                        ModCommonClasses.rdr = ModCommonClasses.cmd.ExecuteReader(CommandBehavior.CloseConnection);
                        frmPurchase.dataGridView1.Rows.Clear();
                        while (ModCommonClasses.rdr.Read() == true)
                        {
                            frmPurchase.dataGridView1.Rows.Add(ModCommonClasses.rdr[0], ModCommonClasses.rdr[1], ModCommonClasses.rdr[2], ModCommonClasses.rdr[3], ModCommonClasses.rdr[4], ModCommonClasses.rdr[5], ModCommonClasses.rdr[6], ModCommonClasses.rdr[7], ModCommonClasses.rdr[8], ModCommonClasses.rdr[9]);
                        }
                        ModCommonClasses.con.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }