private void sales_invoice_comboBox_payments_SelectedIndexChanged(object sender, EventArgs e) { try { if (sales_invoice_comboBox_payments.SelectedIndex != -1) { Hashtable ht = new Hashtable(); ht.Add("@custID", Convert.ToInt32(customer_comboBox_payments.SelectedValue.ToString())); ht.Add("@salesinvoiceID", Convert.ToInt64(sales_invoice_comboBox_payments.SelectedValue.ToString())); double[] arr = SQL_TASKS.SaleInvoiceAmounts("st_getSALESINVOICEAMOUNT", ht); total_amount_textBox_payments.Text = arr[0].ToString(); amount_paid_textBox_payments.Text = arr[1].ToString(); remaining_amount_textBox_payments.Text = arr[2].ToString(); } } catch (Exception ex) { CodingSourceClass.ShowMsg(ex.Message, "Error"); CodingSourceClass.disable_reset(left_panel); enable_crud_buttons(); } }
private void payments_dataGridView_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex != -1) { add_button.Enabled = false; if (edit == true) //updating member { save_button.Enabled = true; } else if (edit == false) //adding member { save_button.Enabled = false; } DataGridViewRow row = payments_dataGridView.Rows[e.RowIndex]; paymentID = Convert.ToInt32(row.Cells[0].Value.ToString()); customer_comboBox_payments.Text = row.Cells["customernameGV"].Value.ToString(); sales_invoice_comboBox_payments.Text = row.Cells["billnoGV"].Value.ToString(); shop_comboBox_payments.Text = row.Cells["shopGV"].Value.ToString(); customerID = Convert.ToInt32(row.Cells["customerIDGV"].Value); salesinvoiceID = Convert.ToInt32(row.Cells["salesinvoiceIDGV"].Value); if (/*sales_invoice_comboBox_payments.SelectedIndex != -1*/ true) { Hashtable ht = new Hashtable(); ht.Add("@custID", customerID); ht.Add("@salesinvoiceID", salesinvoiceID); double[] arr = SQL_TASKS.SaleInvoiceAmounts("st_getSALESINVOICEAMOUNT", ht); total_amount_textBox_payments.Text = arr[0].ToString(); amount_paid_textBox_payments.Text = arr[1].ToString(); remaining_amount_textBox_payments.Text = arr[2].ToString(); } dateTimePicker_payments.Value = Convert.ToDateTime(row.Cells[1].Value); userID = Convert.ToInt32(row.Cells[3].Value.ToString()); postedby = row.Cells[4].Value.ToString(); amount_to_pay_textBox_payments.Text = row.Cells[10].Value.ToString(); cheque_no_textBox.Text = row.Cells[11].Value.ToString(); bank_and_branch_textBox.Text = row.Cells[12].Value.ToString(); clearing_date_dateTimePicker.Text = row.Cells["clearingdateGV"].Value.ToString(); if (cheque_no_textBox.Text == "" && bank_and_branch_textBox.Text == "") { cash_radioButton_sales_invoice.Checked = true; } else { cheque_radioButton.Checked = true; } CodingSourceClass.disable(left_panel); delete_button.Enabled = true; edit_button.Enabled = true; save_button.Enabled = false; cancel_button.Enabled = true; view_button.Enabled = true; } } catch (Exception ex) { CodingSourceClass.ShowMsg(ex.Message, "Error"); enable_crud_buttons(); CodingSourceClass.disable_reset(left_panel); } }