Exemple #1
0
        private void btn_show_Click(object sender, EventArgs e)
        {
            try
            {
                if (cmb_days.SelectedValue == null)
                {
                    MessageBox.Show("Please select a day to continue", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (cmb_pumper.SelectedValue == null)
                {
                    MessageBox.Show("Please select a Pumper to continue", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (cmb_sessions.SelectedValue == null)
                {
                    MessageBox.Show("Please select a session to continue", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                lbl_card.Text       = "0.00";
                lbl_cash.Text       = "0.00";
                lbl_Voucher.Text    = "0.00";
                lbl_expense.Text    = "0.00";
                lbl_totalValss.Text = "0.00";

                GetNozzelsForPumperOnGivenDay();
                List <DailyPumperTotal> tovals = CustomeRepository.GetDailyPumperTotal(
                    commonFunctions.ToInt(cmb_days.SelectedValue.ToString()),
                    commonFunctions.ToInt(cmb_pumper.SelectedValue.ToString()),
                    commonFunctions.ToInt(cmb_sessions.SelectedValue.ToString())).ToList();
                if (tovals != null)
                {
                    LoadListView(tovals);
                }

                decimal totalCollection = 0;
                foreach (var item in tovals)
                {
                    totalCollection += item.Total;
                }
                lbl_totalCollection.Text = totalCollection.ToString();

                TwoKeyNumer SystemTotal = CustomeRepository.GetSystemTotalForPumperForDay(
                    commonFunctions.ToInt(cmb_days.SelectedValue.ToString()),
                    commonFunctions.ToInt(cmb_pumper.SelectedValue.ToString()),
                    commonFunctions.ToInt(cmb_sessions.SelectedValue.ToString())
                    );
                if (SystemTotal != null)
                {
                    lbl_systemtotal.Text = SystemTotal.Value.ToString();
                }
                else
                {
                    lbl_systemtotal.Text = "0.00";
                }

                var dets = CustomeRepository.GetGetCollectionFOrDay_Pumper_SaleType(
                    commonFunctions.ToInt(cmb_days.SelectedValue.ToString()),
                    commonFunctions.ToInt(cmb_pumper.SelectedValue.ToString()),
                    1,
                    commonFunctions.ToInt(cmb_sessions.SelectedValue.ToString())
                    );
                if (dets != null)
                {
                    lbl_cash.Text       = dets.CashTotal.ToString();
                    lbl_card.Text       = dets.CardTotal.ToString();
                    lbl_Voucher.Text    = dets.VoucherTotal.ToString();
                    lbl_expense.Text    = dets.Expenses.ToString();
                    lbl_othertotal.Text = dets.Other.ToString();
                }

                RunGetDiff();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error Has found in program. Please forword following details to technical" + Environment.NewLine + "[" + ex.Message + Environment.NewLine + ex.Source + "]", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }