private void AddInvoice_Load(object sender, EventArgs e)
        {
            try
            {
                latitude = 0;
                longitude = 0;
                textInvoice.Text = "";
                textValue.Text = "";
                textCustomer.Text = "";
                textStreet.Text = "";
                textCity.Text = "";
                textZip.Text = "";
                textState.Text = "";
                listItems.Items.Clear();
                Add.Enabled = true;
                toolStripStatusLabel2.Text = "";
                mysql_invoices = new MySQL_Invoices(GlobalVar.sqlhost, GlobalVar.sqlport, GlobalVar.sqldatabase, GlobalVar.sqlusername, "");
                mysql_lineitems = new MySQL_LineItems(GlobalVar.sqlhost, GlobalVar.sqlport, GlobalVar.sqldatabase, GlobalVar.sqlusername, "");

            }
            catch
            {
                Cancel_Click(null, null);
            }
        }
        public ConfigureTruckRoute()
        {
            this.TopLevel = true;

            this.MaximizeBox = false;

            mysql_invoices = new MySQL_Invoices(GlobalVar.sqlhost, GlobalVar.sqlport, GlobalVar.sqldatabase, GlobalVar.sqlusername, "");
            mysql_drivers = new MySQL_Drivers(GlobalVar.sqlhost, GlobalVar.sqlport, GlobalVar.sqldatabase, GlobalVar.sqlusername, "");
            mysql_lineitems = new MySQL_LineItems(GlobalVar.sqlhost, GlobalVar.sqlport, GlobalVar.sqldatabase, GlobalVar.sqlusername, "");
            mysql_routes = new MySQL_Routes(GlobalVar.sqlhost, GlobalVar.sqlport, GlobalVar.sqldatabase, GlobalVar.sqlusername, "");
            mysql_invoiceroutes = new MySQL_InvoiceRoute(GlobalVar.sqlhost, GlobalVar.sqlport, GlobalVar.sqldatabase, GlobalVar.sqlusername, "");

            InitializeComponent();
        }
        public DeliverySchedule()
        {
            InitializeComponent();

               this.MaximizeBox = false;

               mysql_invoices = new MySQL_Invoices(GlobalVar.sqlhost, GlobalVar.sqlport, GlobalVar.sqldatabase, GlobalVar.sqlusername, "");
               mysql_drivers = new MySQL_Drivers(GlobalVar.sqlhost, GlobalVar.sqlport, GlobalVar.sqldatabase, GlobalVar.sqlusername, "");
               mysql_lineitems = new MySQL_LineItems(GlobalVar.sqlhost, GlobalVar.sqlport, GlobalVar.sqldatabase, GlobalVar.sqlusername, "");
               mysql_routes = new MySQL_Routes(GlobalVar.sqlhost, GlobalVar.sqlport, GlobalVar.sqldatabase, GlobalVar.sqlusername, "");
               mysql_invoiceroutes = new MySQL_InvoiceRoute(GlobalVar.sqlhost, GlobalVar.sqlport, GlobalVar.sqldatabase, GlobalVar.sqlusername, "");
               viewdate = DateTime.Now;
               scheduleddrivers = new List<DriverInfo>();
               counter = 0;
        }
 private void EditInvoice_Load(object sender, EventArgs e)
 {
     try
     {
         textInvoice.Text = "";
         textValue.Text = "";
         textCustomer.Text = "";
         textStreet.Text = "";
         textCity.Text = "";
         textZip.Text = "";
         textState.Text = "";
         listAddresses.Items.Clear();
         button1.Enabled = false;
         toolStripStatusLabel1.Text = "";
         mysql_invoices = new MySQL_Invoices(GlobalVar.sqlhost, GlobalVar.sqlport, GlobalVar.sqldatabase, GlobalVar.sqlusername, "");
         mysql_lineitems = new MySQL_LineItems(GlobalVar.sqlhost, GlobalVar.sqlport, GlobalVar.sqldatabase, GlobalVar.sqlusername, "");
         newinvoice = mysql_invoices.GetInvoice(inputinvoice.number);
         if (newinvoice != null)
         {
             lineitems = mysql_lineitems.GetLineItems(newinvoice);
             textInvoice.Text = newinvoice.number.ToString();
             textValue.Text = DataFormat.FormatMoneyToString(newinvoice.value);
             if (newinvoice.addr1 != "")
             {
                 textStreet.Text = newinvoice.addr1;
             }
             else
             {
                 textStreet.Text = newinvoice.addr2;
             }
             textCustomer.Text = newinvoice.customername;
             textCity.Text = newinvoice.city;
             textZip.Text = newinvoice.zip;
             textState.Text = newinvoice.state;
             for (int i = 0; i < lineitems.Count; i++)
             {
                 string toinsert = lineitems[i].description + " - " + DataFormat.FormatMoneyToString(lineitems[i].value);
                 listAddresses.Items.Add(toinsert);
             }
             DatePicker.Value = newinvoice.due;
             button1.Enabled = true;
         }
         else { Cancel_Click(null, null); }
     }
     catch
     {
         Cancel_Click(null, null);
     }
 }