Beispiel #1
0
        //private DataTable GetDatatable() {
        //    DataTable dt = new DataTable();
        //    dt.Columns.Add("Id");
        //    dt.Columns.Add("FuelType");
        //    dt.Columns.Add("Quntity");
        //    dt.Columns.Add("Price");
        //    dt.Columns.Add("Total");
        //    dt.Columns.Add("Additions");
        //    dt.Columns.Add("Deductions");
        //    dt.Columns.Add("Net");
        //    return dt;
        //}

        private void frm_grn_Load(object sender, EventArgs e)
        {
            try
            {
                documentno     = CustomeRepository.GetSetDocumentNumber("SC001", 0, "FRN", 1);
                txt_DocNo.Text = documentno;
                if (txt_DocNo.Text.Trim() != "")
                {
                    LoadTanks(txt_DocNo.Text);
                }
                LoadFuels();
                //pnl_header.BackColor = commonFunctions.PanelHeaderBackGroundColor;
                pnl_header.ForeColor = commonFunctions.PanelHeaderForColor;
                pnl_footer.BackColor = commonFunctions.PanelHeaderBackGroundColor;
                pnl_footer.ForeColor = Color.Black;

                lbl_headerpaneltext.Text = "Fuel Unloading".ToUpper();

                this.WindowState = FormWindowState.Maximized;
                this.Text        = "Fuel Unloading";
                commonFunctions.FormatDataGrid(dgmain);
                dgmain.AutoGenerateColumns = false;
            }
            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);
            }
        }
Beispiel #2
0
        private void button2_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 (MessageBox.Show("Do you want to End this Day?. " +
                                    Environment.NewLine +
                                    "Bfore you continue please check all the pumpers details are properly entered to system" +
                                    Environment.NewLine +
                                    "And All the Nozzels are Close Properly."
                                    , Messaging.MessageCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    int x = CustomeRepository.ClosePump(commonFunctions.ToInt(cmb_days.SelectedValue.ToString()));
                    if (x > 0)
                    {
                        MessageBox.Show("Successfully End the day", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            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);
            }
        }
Beispiel #3
0
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         if (commonFunctions.ToInt(cmb_pumperForcashcol.SelectedValue.ToString()) >= 0)
         {
             if (MessageBox.Show("Do you want to Save this record?", Messaging.MessageCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
             {
                 CustomeRepository.InsertTotalCashCollection(
                     commonFunctions.ToInt(cmb_pumperForcashcol.SelectedValue.ToString()),
                     commonFunctions.ToInt(cmb_pumperForcashcol.SelectedValue.ToString()),
                     commonFunctions.ToDecimal(lbl_currentCashTot.Text.Trim()),
                     num_cardtotal.Value,
                     num_VoucherTotal.Value,
                     num_expensetotal.Value
                     );
                 MessageBox.Show("Successfully Saved the record", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error inserting the record..", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #4
0
        private void AddorReduceCash(bool isadd)
        {
            decimal valuesaved = decimal.Zero;

            if (isadd)
            {
                valuesaved = num_cashtotal.Value;
            }
            else
            {
                valuesaved = -1 * num_cashtotal.Value;
            }
            CustomeRepository.InsertCollectionBreakdown(
                valuesaved,
                commonFunctions.ToInt(cmb_days.SelectedValue.ToString()),
                commonFunctions.ToInt(cmb_pumperForcashcol.SelectedValue.ToString()), 0,
                1,
                1, //sales type,
                txt_creditcardNo.Text,
                txt_voucherNo.Text.Trim(),
                commonFunctions.ToInt(cmb_bank.SelectedValue.ToString()),
                1,
                0, commonFunctions.ToInt(cmb_sessions.SelectedValue.ToString())
                );


            GetTotalForPumperForGivenDay(commonFunctions.ToInt(lbl_salesID.Text.ToString()));

            LogRepository.Log("Cash Collection Manual Change To : " + lbl_currentCashTot.Text.ToString(), LogType.Log, commonFunctions.LoginuserID);
        }
Beispiel #5
0
        private void lst_nozzels_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lst_nozzels.SelectedItems.Count > 0)
            {
                dt.Rows.Clear();
                var selectedtank = (Tank)lst_nozzels.SelectedItems[0].Tag;
                lbl_innerdia.Text = selectedtank.InnerDiameter.ToString();
                lbl_len.Text      = selectedtank.Length.ToString();
                lbl_capacity.Text = selectedtank.Capacity.ToString();
                lbl_stock.Text    = selectedtank.CurrentSIH.ToString();


                lst_nos.Items.Clear();
                var tanks = CustomeRepository.GetNozzelsOFTanks(selectedtank.Id);
                foreach (var item in tanks)
                {
                    DataRow drow = dt.NewRow();
                    drow[0] = item.Id;
                    drow[1] = item.NozzelName;
                    drow[2] = 0.00;
                    string       name = item.NozzelName;
                    ListViewItem itm  = new ListViewItem(name + Environment.NewLine + item.LastTotalizerReading.ToString());
                    itm.Tag        = item;
                    itm.ImageIndex = 0;
                    lst_nos.Items.Add(itm);
                    dt.Rows.Add(drow);
                }
            }
        }
Beispiel #6
0
        private void lst_dailydet_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (lst_dailydet.SelectedItems.Count > 0)
                {
                    DailyPumperTotal tot = (DailyPumperTotal)lst_dailydet.SelectedItems[0].Tag;
                    if (tot != null)
                    {
                        lbl_totalValss.Text = tot.Total.ToString();
                        lbl_saletype.Text   = tot.SaleType;

                        var dets = CustomeRepository.GetGetCollectionFOrDay_Pumper_SaleType(tot.DayID, tot.PumperId, tot.SaleId, commonFunctions.ToInt(cmb_sessions.SelectedValue.ToString()));
                        if (dets != null)
                        {
                            dgmain.AutoGenerateColumns = false;
                            dgmain.DataSource          = dets.Breaks;
                        }
                        //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();
                    }
                }
            }
            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);
            }
        }
Beispiel #7
0
        bool CheckSalesValidation()
        {
            bool x = CustomeRepository.CheckSalesValidation(commonFunctions.ToInt(cmb_days.SelectedValue.ToString()), commonFunctions.ToInt(cmb_sessions.SelectedValue.ToString()),
                                                            commonFunctions.ToInt(cmb_pumperForcashcol.SelectedValue.ToString()));

            return(x);
        }
Beispiel #8
0
 private void GetNozzelTotalizerReadings()
 {
     if (lst_nozzels.SelectedItems.Count > 0)
     {
         UnloadingNozzelReading read = (UnloadingNozzelReading)lst_nozzels.SelectedItems[0].Tag;
         num_TotalizerReadings.Value = CustomeRepository.GetNozzelTotalizerReadings(txt_DocNo.Text, read.NozzelId);
     }
 }
Beispiel #9
0
        private void btn_savecashDet_Click(object sender, EventArgs e)
        {
            try
            {
                if (num_amount.Value <= 0)
                {
                    return;
                }

                if (MessageBox.Show("Do you want to Save this record?", Messaging.MessageCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    int vehicleid = 1;
                    switch (glosaletypeid)
                    {
                    case 2:
                        vehicleid = 1;
                        break;

                    case 3:
                        if (cmb_Vehicles.SelectedValue == null)
                        {
                            MessageBox.Show("Please select vehicle from the list", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else
                        {
                            vehicleid = commonFunctions.ToInt(cmb_Vehicles.SelectedValue.ToString());
                        }
                        break;

                    default:
                        vehicleid = 1;
                        break;
                    }

                    int x = CustomeRepository.InsertCollectionBreakdown(
                        num_amount.Value,
                        commonFunctions.ToInt(cmb_days.SelectedValue.ToString()),
                        commonFunctions.ToInt(cmb_pumperForcashcol.SelectedValue.ToString()), 0,
                        vehicleid,
                        commonFunctions.ToInt(lbl_salesID.Text.ToString()),
                        txt_creditcardNo.Text,
                        txt_voucherNo.Text.Trim(),
                        commonFunctions.ToInt(cmb_bank.SelectedValue.ToString()),
                        1,
                        0, commonFunctions.ToInt(cmb_sessions.SelectedValue.ToString())
                        );


                    GetTotalForPumperForGivenDay(commonFunctions.ToInt(lbl_salesID.Text.ToString()));

                    num_amount.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error Has found when Saving data. Please forword following details to technical" + Environment.NewLine + "[" + ex.Message + Environment.NewLine + ex.Source + "]", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #10
0
 private void cmb_fueltypes_SelectedIndexChanged(object sender, EventArgs e)
 {
     //KeyValue value = (KeyValue)cmb_fueltypes.SelectedValue;
     if (commonFunctions.ToInt(cmb_fueltypes.SelectedValue.ToString()) > 0)
     {
         FuelType ft = CustomeRepository.GetFuelRecord(commonFunctions.ToInt(cmb_fueltypes.SelectedValue.ToString()));
         txt_price.Text = ft.UnitPrice.ToString();
         CalculateBalance();
     }
 }
Beispiel #11
0
 private bool CheckForUnclosedDays()
 {
     if (CustomeRepository.CheckForUnclosedDays() > 0)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
        private void cmb_Nozzels_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (commonFunctions.ToInt(cmb_Nozzels.SelectedValue.ToString().Trim()) > -1)
            {
                decimal val = CustomeRepository.GetNozzelFuelPrice(commonFunctions.ToInt(cmb_Nozzels.SelectedValue.ToString().Trim()));
                txt_price.Text = val.ToString();

                decimal val2 = CustomeRepository.GetNozzelTotalizerReading(commonFunctions.ToInt(cmb_Nozzels.SelectedValue.ToString().Trim()));
                txt_creading.Text = val2.ToString();
            }
        }
Beispiel #13
0
 private void button4_Click(object sender, EventArgs e)
 {
     if (lst_tanks.SelectedItems.Count > 0)
     {
         UnloadingDipReadings read = (UnloadingDipReadings)lst_tanks.SelectedItems[0].Tag;
         CustomeRepository.UpdateDipValues(txt_DocNo.Text.Trim(), read.TankD, num_afterReading.Value, 2);
         if (txt_DocNo.Text.Trim() != "")
         {
             LoadTanks(txt_DocNo.Text);
         }
     }
 }
Beispiel #14
0
 private void btn_show_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Do you want to Save this record?", Messaging.MessageCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         if (lst_tanks.SelectedItems.Count > 0)
         {
             UnloadingNozzelReading reading = (UnloadingNozzelReading)lst_nozzels.SelectedItems[0].Tag;
             CustomeRepository.SaveTotalizerForUnloading(txt_DocNo.Text.Trim(), reading.NozzelId, num_TotalizerReadings.Value);
             LoadNozzels(txt_DocNo.Text.Trim(), reading.TankId);
         }
     }
 }
Beispiel #15
0
 private void LoadCustomerOutstandings()
 {
     if (cmb_customer.SelectedValue != null)
     {
         Customer cus = new Customer();
         cus = CustomeRepository.GetCustomerDetails(commonFunctions.ToInt(cmb_customer.SelectedValue.ToString()));
         lbl_creditLinit.Text  = cus.CreditLimit.ToString();
         lbl_limitAlert.Text   = cus.OutstandingAlertLimit.ToString();
         lbl_cqlimit.Text      = cus.ChequeLimit.ToString();
         lbl_cqbalance.Text    = cus.ChequeBalance.ToString();
         lbl_rank.Text         = "RANK-" + cus.Rating.ToString();
         lbl_outstandings.Text = cus.Outstanding.ToString();
     }
 }
Beispiel #16
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (CustomeRepository.IsExistsDifferentLog(
                        commonFunctions.ToInt(cmb_days.SelectedValue.ToString()),
                        commonFunctions.ToInt(cmb_sessions.SelectedValue.ToString()),
                        commonFunctions.ToInt(cmb_pumper.SelectedValue.ToString())
                        ) > 0)
                {
                    MessageBox.Show("Already Printed for this Day ,Session and pumper ", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (MessageBox.Show("Do you want to Save and Print this record?", Messaging.MessageCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    DifferentLog log = new DifferentLog();
                    log.CardTotal       = commonFunctions.ToDecimal(lbl_card.Text.Trim());
                    log.CashTotal       = commonFunctions.ToDecimal(lbl_cash.Text.Trim());
                    log.VoucherTotal    = commonFunctions.ToDecimal(lbl_Voucher.Text.Trim());
                    log.Expenses        = commonFunctions.ToDecimal(lbl_expense.Text.Trim());
                    log.Testing         = commonFunctions.ToDecimal(lbl_othertotal.Text.Trim());
                    log.DayID           = commonFunctions.ToInt(cmb_days.SelectedValue.ToString());
                    log.PumperId        = commonFunctions.ToInt(cmb_pumper.SelectedValue.ToString());
                    log.SessionId       = commonFunctions.ToInt(cmb_sessions.SelectedValue.ToString());
                    log.SystemTotal     = commonFunctions.ToDecimal(lbl_systemtotal.Text.Trim());
                    log.TotalCollection = commonFunctions.ToDecimal(lbl_totalCollection.Text.Trim());
                    log.Differences     = commonFunctions.ToDecimal(lbl_diff.Text.Trim());
                    log.DiffCaculated   = true;
                    log.IsFinal         = true;
                    log.IgnoreDiff      = chk_ignorediff.Checked;
                    log.ModifiedDate    = DateTime.Now;
                    log.CreatedDate     = DateTime.Now;
                    log.CreatedUser     = commonFunctions.LoginuserID;
                    log.ModifiedUser    = commonFunctions.LoginuserID;
                    log.DataTransfer    = 1;


                    CustomeRepository.InsertSalesPrint(log);
                    string filename = PrintRepository.WriteSimpleReciept(log, cmb_pumper.Text, commonFunctions.GlobalCompany);
                    System.Diagnostics.Process.Start(filename);
                }
            }
            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);
            }
        }
Beispiel #17
0
 private void LoadTanks()
 {
     try
     {
         var tanks = CustomeRepository.GetAllTanks();
         foreach (var item in tanks)
         {
             string       name = item.TankName;
             ListViewItem itm  = new ListViewItem(name);
             itm.Tag        = item;
             itm.ImageIndex = 0;
             lst_nozzels.Items.Add(itm);
         }
     }
     catch (Exception ex) { }
 }
Beispiel #18
0
        private void LoadVehicles(int cusid)
        {
            lst_vehicles.Items.Clear();
            List <Vehicle> vehis = CustomeRepository.GetVehicleForCustomers(cusid).ToList();

            if (vehis != null && vehis.Count > 0)
            {
                foreach (var item in vehis)
                {
                    ListViewItem itm = new ListViewItem(item.VehicleName, 0);
                    itm.Tag = item;
                    lst_vehicles.Items.Add(itm);
                    lst_vehicles.Items[0].Selected = true;
                }
            }
        }
        private void btn_save_Click(object sender, EventArgs e)
        {
            if (Calculate())
            {
                MessageBox.Show("New totalizer reaing must grater than existing reading.", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            try
            {
                if (CustomeRepository.CheckExistanceOFNozzelForDayInTotalizer(commonFunctions.ToInt(cmb_days.SelectedValue.ToString()), commonFunctions.ToInt(cmb_Nozzels.SelectedValue.ToString())))
                {
                    MessageBox.Show("Record already Exist for this nozzel .", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (!ValidateInput())
                {
                    return;
                }
                TotalizeReading type = new TotalizeReading();
                type.Id               = int.Parse(lbl_id.Text.Trim());
                type.NozzelID         = commonFunctions.ToInt(cmb_Nozzels.SelectedValue.ToString());
                type.DayID            = commonFunctions.ToInt(cmb_days.SelectedValue.ToString());
                type.CussreentReading = txt_exreading.Value;
                type.NewReading       = txt_creading.Value;
                type.SIH              = commonFunctions.ToDecimal(txt_qty.Text.Trim());
                type.UPrice           = commonFunctions.ToDecimal(txt_price.Text.Trim());
                type.Value            = commonFunctions.ToDecimal(txt_total.Text.Trim());
                type.ShiftID          = commonFunctions.ToInt(cmb_Shifts.SelectedValue.ToString());
                type.GroupOfCompanyID = 1;
                type.ModifiedUser     = commonFunctions.LoginuserID;
                type.ModifiedDate     = DateTime.Now;
                type.CreatedUser      = commonFunctions.LoginuserID;
                type.CreatedDate      = DateTime.Now;
                type.DataTransfer     = 1;

                if (MessageBox.Show("Do you want to insert this record?", Messaging.MessageCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    repo.Save(type);
                    GetData();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error Has found when Saving data. Please forword following details to technical" + Environment.NewLine + "[" + ex.Message + Environment.NewLine + ex.Source + "]", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #20
0
 private void LoadNozzels(string docno, int tankid)
 {
     try
     {
         lst_nozzels.Items.Clear();
         var Nozzels = CustomeRepository.GetAllNozzelssByTankForUnloading(docno, tankid);
         foreach (var item in Nozzels)
         {
             string       name = item.NozzelName + " - " + item.Reading.ToString();
             ListViewItem itm  = new ListViewItem(name);
             itm.Tag        = item;
             itm.ImageIndex = 0;
             lst_nozzels.Items.Add(itm);
         }
     }
     catch (Exception ex) { }
 }
Beispiel #21
0
 private void LoadTanks(string docno)
 {
     try
     {
         lst_tanks.Items.Clear();
         tanks = CustomeRepository.GetAllTanksForUnloading(docno).ToList();
         foreach (var item in tanks)
         {
             string       name = item.TankName + "-[" + item.BeforeTankQty + "L]";
             ListViewItem itm  = new ListViewItem(name);
             itm.Tag        = item;
             itm.ImageIndex = 1;
             lst_tanks.Items.Add(itm);
         }
     }
     catch (Exception ex) { }
 }
Beispiel #22
0
        private void dgmain_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            if (dgmain.Rows[e.RowIndex].IsNewRow == false)
            {
                lst_nozzels.Items.Clear();
                lbl_id.Text = dgmain.Rows[e.RowIndex].Cells[0].Value.ToString().Trim();

                IEnumerable <DaySession> sessions = CustomeRepository.GetDaySessionForDay(commonFunctions.ToInt(lbl_id.Text.Trim()));

                foreach (var item in sessions)
                {
                    ListViewItem itemx = new ListViewItem(item.SessionName, 0);
                    itemx.Tag = item;
                    lst_nozzels.Items.Add(itemx);
                }
            }
        }
Beispiel #23
0
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         //if (CustomeRepository.CheckForDocumentNo(txt_DocNo.Text) >= 0) {
         //    MessageBox.Show("Record Already Exists..", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
         //    return;
         //}
         if (MessageBox.Show("Do you want to Save this record?", Messaging.MessageCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             CustomeRepository.InitializeUnloading(txt_DocNo.Text, commonFunctions.LoginuserID);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error inserting the record..", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Beispiel #24
0
 private void button6_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Do you want to Save this record?", Messaging.MessageCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         FuelType      ft    = CustomeRepository.GetFuelRecord(commonFunctions.ToInt(cmb_fueltypes.SelectedValue.ToString()));
         UnloadingFuel model = new UnloadingFuel();
         model.Id         = ft.Id;
         model.Price      = ft.UnitPrice;
         model.Quntity    = txt_qty.Value;
         model.Total      = num_total.Value;
         model.Net        = commonFunctions.ToDecimal(lbl_nettotal.Text.Trim());
         model.FuelType   = cmb_fueltypes.Text;
         model.Additions  = num_additions.Value;
         model.Deductions = num_deductions.Value;
         repo.Add(model);
         dgmain.DataSource = repo;
         Calculate();
     }
 }
Beispiel #25
0
        private void GetValues(string docno, int bORa)
        {
            if (lst_tanks.SelectedItems.Count > 0)
            {
                decimal brefore           = decimal.Zero;
                decimal After             = decimal.Zero;
                UnloadingDipReadings read = (UnloadingDipReadings)lst_tanks.SelectedItems[0].Tag;
                brefore = CustomeRepository.GetNozzelTotalizerReadings(txt_DocNo.Text, read.TankD, 1);
                After   = CustomeRepository.GetNozzelTotalizerReadings(txt_DocNo.Text, read.TankD, 2);
                num_beforedipreading.Value = brefore;
                num_afterReading.Value     = After;

                lbl_totbfore.Text       = read.BeforeTankQty.ToString();
                lbl_Totafter.Text       = read.AfterTankQty.ToString();
                lbl_systemUnloaded.Text = (read.AfterTankQty - read.BeforeTankQty).ToString();
                decimal unloadedqty = commonFunctions.ToDecimal(lbl_unloadedqty.Text.Trim());
                decimal variance    = unloadedqty - (read.AfterTankQty - read.BeforeTankQty);
                lbl_Variance.Text = variance.ToString();
            }
        }
Beispiel #26
0
 private void GetData()
 {
     try
     {
         if (cmb_days.Text.Trim() != "")
         {
             int did = commonFunctions.ToInt(cmb_days.SelectedValue.ToString().Trim());
             dgmain.AutoGenerateColumns = false;
             List <RosterViewModel> stl = CustomeRepository.GetFuelTypes(did).ToList();
             if (stl != null)
             {
                 dgmain.DataSource = stl;
             }
         }
     }
     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);
     }
 }
Beispiel #27
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            try
            {
                if (!CustomeRepository.CheckExistancePumperForNozzel(commonFunctions.ToInt(cmb_days.SelectedValue.ToString()), commonFunctions.ToInt(cmb_Nozzels.SelectedValue.ToString()), commonFunctions.ToInt(cmb_pumper.SelectedValue.ToString())))
                {
                    MessageBox.Show("Pumper is already assigned for this nozzel in this day.", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }


                if (!ValidateInput())
                {
                    return;
                }
                Roster type = new Roster();
                type.Id         = int.Parse(lbl_id.Text.Trim());
                type.NozzelID   = commonFunctions.ToInt(cmb_Nozzels.SelectedValue.ToString());
                type.PumperID   = commonFunctions.ToInt(cmb_pumper.SelectedValue.ToString());
                type.ShiftID    = commonFunctions.ToInt(cmb_Shifts.SelectedValue.ToString());
                type.DayStartID = commonFunctions.ToInt(cmb_days.SelectedValue.ToString());
                type.ActualEndH = commonFunctions.ToInt(cmb_starth.Text.Trim());
                type.AcutalEndM = commonFunctions.ToInt(cmb_startm.Text.Trim());
                type.PlanStartH = commonFunctions.ToInt(cmb_endsH.Text.Trim());
                type.PlanStartM = commonFunctions.ToInt(cmb_endsM.Text.Trim());
                type.ShiftName  = txt_name.Text.Trim();

                type.TotalNoOfWorkigH = 0;

                if (MessageBox.Show("Do you want to insert this record?", Messaging.MessageCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    repo.Save(type);
                    GetData();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error Has found when Saving data. Please forword following details to technical" + Environment.NewLine + "[" + ex.Message + Environment.NewLine + ex.Source + "]", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #28
0
 private void GetNozzelsForPumperOnGivenDay()
 {
     try
     {
         var details = CustomeRepository.GetNozzelsForPumperOnGivenDay(commonFunctions.ToInt(cmb_days.SelectedValue.ToString()), commonFunctions.ToInt(cmb_pumper.SelectedValue.ToString()));
         lst_nozzels.Items.Clear();
         lst_dailydet.Items.Clear();
         dgmain.DataSource = null;
         foreach (var item in details)
         {
             string       name = item.Name;
             ListViewItem itm  = new ListViewItem(name);
             itm.Tag        = item;
             itm.ImageIndex = 4;
             lst_nozzels.Items.Add(itm);
         }
     }
     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);
     }
 }
Beispiel #29
0
        private void btn_cashcolupdate_Click(object sender, EventArgs e)
        {
            try
            {
                if (commonFunctions.ToInt(lbl_breakdid.Text.ToString()) <= 0)
                {
                    MessageBox.Show("Please select a record to delete", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (MessageBox.Show("Do you want to Delete this record?", Messaging.MessageCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    CustomeRepository.RemoveCollectionBreakdown(commonFunctions.ToInt(lbl_breakdid.Text.ToString()));
                    GetTotalForPumperForGivenDay(commonFunctions.ToInt(lbl_salesID.Text.ToString()));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error Has found when Saving data. Please forword following details to technical" + Environment.NewLine + "[" + ex.Message + Environment.NewLine + ex.Source + "]", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            //
        }
Beispiel #30
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            try
            {
                if (!ValidateInput())
                {
                    return;
                }

                if (CheckForUnclosedDays())
                {
                    MessageBox.Show("There is uncompleted day . Please Complete the day and retry again!.",
                                    Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                //DayMaster type = new DayMaster();
                //type.Id = int.Parse(lbl_id.Text.Trim());
                //type.CancelledUserId = commonFunctions.LoginuserID;
                //type.CancelReason = txt_cancelr.Text.Trim();
                //type.CencelledDate = DateTime.Now;
                //type.DateStamp = GetDateStamp();
                //type.Day = txt_day.Text.ToString();
                //type.Iscancel = chk_cancelday.Checked;
                //type.IsCompleted = false;
                //type.IsShiftCreated = false;

                if (MessageBox.Show("Do you want to insert this record?", Messaging.MessageCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    CustomeRepository.InitializeDailyPumperAssign(GetDateStamp(), txt_day.Text.ToString());

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