示例#1
0
        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;
        }
示例#4
0
        //do one or the other (default invoice)
        public List<Invoice> FilterInvoices(DateTime date,List<int> invoice)
        {
            try
            {

                List<Invoice> filteredinvoices = new List<Invoice>();
                if (invoice != null)
                {
                    for (int j = 0; j < invoice.Count; j++)
                    {
                        for (int i = 0; i < rawinvoices.Count; i++)
                        {
                            if (rawinvoices[i].number==invoice[j])
                            {
                                filteredinvoices.Add(rawinvoices[i]);
                            }
                        }
                    }
                    return (filteredinvoices);
                }else{
                    mysql_invoices = new MySQL_Invoices(GlobalVar.sqlhost, GlobalVar.sqlport, GlobalVar.sqldatabase, GlobalVar.sqlusername, "");
                    List<Invoice> blockedinvoices= mysql_invoices.GetBlocks(date);
                    for (int i = 0; i < rawinvoices.Count; i++)
                    {
                        if (rawinvoices[i].due.Day == date.Day && rawinvoices[i].due.Month == date.Month && rawinvoices[i].due.Year == date.Year)
                        {
                                                    filteredinvoices.Add(rawinvoices[i]);
                                                    if (blockedinvoices != null)
                                                    {
                                                        for (int j = 0; j < blockedinvoices.Count; j++)
                                                        {
                                                            if (rawinvoices[i].number == blockedinvoices[j].number)
                                                            {
                                                                filteredinvoices.RemoveAt(filteredinvoices.Count - 1);
                                                            }
                                                        }
                                                    }
                        }
                    }

                        return (filteredinvoices);
                }
            }
            catch
            {
                return null;
            }
        }
        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();
                listAddresses.Enabled = false;
                toolStripStatusLabel1.Text = "";
                mysql_invoices = new MySQL_Invoices(GlobalVar.sqlhost, GlobalVar.sqlport, GlobalVar.sqldatabase, GlobalVar.sqlusername, "");

                newinvoice = mysql_invoices.GetInvoice(inputinvoice.number);
                if (newinvoice != null)
                {

                    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;

                }
                else { Cancel_Click(null, null); }
            }
            catch
            {
                Cancel_Click(null, null);
            }
        }
 private void OptimizeWindow_Load(object sender, EventArgs e)
 {
     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_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, "");
     buttonSave.Enabled = false;
     textDistance.Text = "600";
     textCapacity.Text = "15";
     textRadius.Text = "50";
     textRate.Text = "";
     textOvertime.Text = "";
     textFuel.Text = "";
     textMaitenance.Text = "";
     listDrivers.Items.Clear();
     listRoutes.Items.Clear();
     optimized = false;
     counter = 0;
     radioButton1.Checked = true;
     driverassignments = new List<int>();
     textStatus.Text = "";
     checkBox1.Checked = true;
     DoRefresh();
     toolStripStatusLabel1.Text = "";
 }
 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);
     }
 }