private void btnBillDetails_Click(object sender, EventArgs e) { if (CheckData()) { CashPaymentDetails obj = new CashPaymentDetails(); obj.objCashPayment = this; obj.Show(); } }
private void gvBillDetails_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { if (gvBillDetails.Rows[e.RowIndex].Cells["Edit"].Value.ToString().Trim() != "") { if (Convert.ToBoolean(gvBillDetails.Rows[e.RowIndex].Cells["Edit"].Selected) == true) { string RefNo = gvBillDetails.Rows[e.RowIndex].Cells[gvBillDetails.Columns["isinos"].Index].Value.ToString(); DataRow[] dr = dtBillRecievedDetails.Select("isinos='" + RefNo + "'"); CashPaymentDetails objPaymentDetails = new CashPaymentDetails(dr); objPaymentDetails.objCashPayment = this; objPaymentDetails.ShowDialog(); objPaymentDetails.isModifyFlag = true; } } if (e.ColumnIndex == gvBillDetails.Columns["Delete"].Index) { DialogResult dlgResult = MessageBox.Show("Do you want delete this record?", "Confirm?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dlgResult == DialogResult.Yes) { //DataRow[] drOut = dtOutStanding.Select("OU_ACCOUNT_ID='" + gvBillDetails.Rows[e.RowIndex].Cells["AccountId"].Value + "'"); //if (drOut.Length > 0) //{ // for (int iRow = 0; iRow < drOut.Length; iRow++) // { // int iSNo = Convert.ToInt32(drOut[iRow][0].ToString()); // DataRow[] drBills = dtAgnstVoucherBill.Select("AG_BILL_NUMBER='" + dtOutStanding.Rows[iSNo - 1]["OU_BILL_NUMBER"].ToString() + "' AND isinos='" + gvBillDetails.Rows[e.RowIndex].Cells["isinos"].Value + "'"); // if (drBills.Length > 0) // { // double OutStdgAmt = Convert.ToDouble(dtOutStanding.Rows[iSNo - 1]["OU_AMOUNT"].ToString()); // double PaidAmt = Convert.ToDouble(dtOutStanding.Rows[iSNo - 1]["OU_AMT_PAID_RCVD"].ToString()); // OutStdgAmt += Convert.ToDouble(drBills[0][15].ToString()); // PaidAmt -= Convert.ToDouble(drBills[0][15].ToString()); // dtOutStanding.Rows[iSNo - 1]["OU_AMOUNT"] = OutStdgAmt; // dtOutStanding.Rows[iSNo - 1]["OU_AMT_PAID_RCVD"] = PaidAmt; // } // } //} int SlNo = Convert.ToInt32(gvBillDetails.Rows[e.RowIndex].Cells[gvBillDetails.Columns["isinos"].Index].Value); //DataRow[] dtRow = dtAgnstVoucherBill.Select("isinos=" + SlNo); //for (int i = 0; i < dtRow.Length; i++) // dtAgnstVoucherBill.Rows.Remove(dtRow[i]); DataRow[] drs = dtBillRecievedDetails.Select("isinos=" + SlNo); dtBillRecievedDetails.Rows.Remove(drs[0]); gvBillDetails.Rows.RemoveAt(e.RowIndex); CaluculatingTotalRcvdAmt(); OrderSerialNo(); MessageBox.Show("Selected information Has Been Deleted", "SSCRM Application", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }