private void GetTotalForPumperForGivenDay(int saletypeid) { try { glosaletypeid = saletypeid; //Disable Auto Gen Columns dgmain.AutoGenerateColumns = false; int dayid = commonFunctions.ToInt(cmb_days.SelectedValue.ToString()); int pumperid = commonFunctions.ToInt(cmb_pumperForcashcol.SelectedValue.ToString()); List <PumperForGivenDayCollectionDetails> dets = new List <PumperForGivenDayCollectionDetails>(); //getting newly inserted values for day to pump and sales type dets = CustomeRepository.PumperForGivenDayCollectionDetails(dayid, pumperid, saletypeid, commonFunctions.ToInt(cmb_sessions.SelectedValue.ToString())).ToList(); //Show it in dgrid dgmain.DataSource = dets; //update summary values DayPumperSaleTypeSummry sumary = new DayPumperSaleTypeSummry(); sumary = CustomeRepository.GetTotalForEachPumperForGivenDay(dayid, pumperid, commonFunctions.ToInt(cmb_sessions.SelectedValue.ToString())); //assign total value on main window num_cashtotal.Value = 0; lbl_currentCashTot.Text = sumary.Cashtotal.ToString(); num_cardtotal.Value = sumary.Cardtotal; num_VoucherTotal.Value = sumary.Vouchertotal; num_expensetotal.Value = sumary.Expensetotal; num_testingtotal.Value = sumary.TestingTotal; //Initialize Value for breakdown num_amount.Value = 0; txt_creditcardNo.Text = ""; txt_rfcardno.Text = ""; txt_voucherNo.Text = ""; //assign total value on breakdown screen switch (saletypeid) { case 2: lbl_total.Text = sumary.Cardtotal.ToString(); break; case 3: lbl_total.Text = sumary.Vouchertotal.ToString(); break; case 4: lbl_total.Text = sumary.Expensetotal.ToString(); break; case 5: lbl_total.Text = sumary.TestingTotal.ToString(); break; default: lbl_total.Text = "0.00"; break; } num_amount.Select(); num_amount.Focus(); } catch (Exception ex) { MessageBox.Show("Error Has found when loading data. Please forword following details to technical" + Environment.NewLine + "[" + ex.Message + Environment.NewLine + ex.Source + "]", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); } }