private void EditInvoice_Click(object sender, EventArgs e)
        {
            EditInvoice editinvoice = new EditInvoice();
            if (listRouteItems.SelectedIndex != -1)
            {
                int index = 0;
                for (int i = 0; i < scheduledinvoicesorder.Count; i++)
                {
                    if (scheduledinvoicesorder[i] == listRouteItems.SelectedIndex)
                    {
                        index = i;
                    }
                }
                editinvoice.SetInvoice(scheduledinvoices[index],false,viewdate,driver,listRouteItems.SelectedIndex);
            }
            if (listAllItems.SelectedIndex != -1)
            {
                editinvoice.SetInvoice(viewinvoices[listAllItems.SelectedIndex],false,viewdate,driver,listAllItems.SelectedIndex);

            }
            editinvoice.Show();
            this.Close();
        }
        private void button10_Click(object sender, EventArgs e)
        {
            EditInvoice editinvoice = new EditInvoice();

            editinvoice.SetInvoice(viewinvoices[listInvoices.SelectedIndex],true,viewdate,null,listInvoices.SelectedIndex);
            editinvoice.Show();
            this.Close();
        }
        private void Cancel_Click_1(object sender, EventArgs e)
        {
            try
            {
                newinvoice.addr1 = textStreet.Text;
                newinvoice.addr2 = "";
                newinvoice.city = textCity.Text;
                newinvoice.state = textState.Text;
                newinvoice.zip = textZip.Text;
                newinvoice.latitude = currentgeodata.latitude[listAddresses.SelectedIndex];
                newinvoice.longitude = currentgeodata.longitude[listAddresses.SelectedIndex];
                mysql_invoices.UpdateInvoice(newinvoice, inputinvoice);
                if (_bw != null)
                {
                    _bw.Dispose();
                }

            }
            catch
            {

            }
            if (caller == 0)
            {

                DeliverySchedule deliveryschedule = new DeliverySchedule();
                deliveryschedule.SetDate(viewdate,0);
                deliveryschedule.Show();
                this.Close();
            }
            else if(caller==1)
            {
                ConfigureTruckRoute configureroute = new ConfigureTruckRoute();
                configureroute.SetData(viewdate, driverinfo);
                configureroute.Show();
            }
            else if (caller == 2)
            {
                EditInvoice editinvoice = new EditInvoice();
                editinvoice.SetInvoice(inputinvoice, flag,viewdate,driverinfo,0);
                editinvoice.Show();
            }
            this.Close();
        }